Factored some more code
This commit is contained in:
parent
dbcf0dc6c5
commit
296293c4b1
|
@ -124,12 +124,17 @@ static int _helper_append(PanelAppletHelper * helper, PanelWindow * window,
|
||||||
/* panel_init */
|
/* panel_init */
|
||||||
int panel_init(Panel * panel, GtkIconSize iconsize)
|
int panel_init(Panel * panel, GtkIconSize iconsize)
|
||||||
{
|
{
|
||||||
|
char * filename;
|
||||||
GdkScreen * screen;
|
GdkScreen * screen;
|
||||||
GdkWindow * root;
|
GdkWindow * root;
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
|
|
||||||
if((panel->config = config_new()) == NULL)
|
if((panel->config = config_new()) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
if((filename = _config_get_filename()) != NULL
|
||||||
|
&& config_load(panel->config, filename) != 0)
|
||||||
|
error_print(PROGNAME);
|
||||||
|
free(filename);
|
||||||
panel_window_init(&panel->top, iconsize);
|
panel_window_init(&panel->top, iconsize);
|
||||||
panel->window = panel->top.window;
|
panel->window = panel->top.window;
|
||||||
panel->source = 0;
|
panel->source = 0;
|
||||||
|
|
|
@ -65,15 +65,10 @@ static int _usage(void);
|
||||||
static int _notify(GtkIconSize iconsize, int timeout, char * applets[])
|
static int _notify(GtkIconSize iconsize, int timeout, char * applets[])
|
||||||
{
|
{
|
||||||
Panel panel;
|
Panel panel;
|
||||||
char * filename;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
PanelAppletHelper helper;
|
PanelAppletHelper helper;
|
||||||
|
|
||||||
panel_init(&panel, iconsize);
|
panel_init(&panel, iconsize);
|
||||||
if((filename = _config_get_filename()) != NULL
|
|
||||||
&& config_load(panel.config, filename) != 0)
|
|
||||||
error_print(PROGNAME);
|
|
||||||
free(filename);
|
|
||||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||||
gtk_window_set_has_resize_grip(GTK_WINDOW(panel.top.window), FALSE);
|
gtk_window_set_has_resize_grip(GTK_WINDOW(panel.top.window), FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -61,15 +61,10 @@ static int _usage(void);
|
||||||
static int _test(GtkIconSize iconsize, char * applets[])
|
static int _test(GtkIconSize iconsize, char * applets[])
|
||||||
{
|
{
|
||||||
Panel panel;
|
Panel panel;
|
||||||
char * filename;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
PanelAppletHelper helper;
|
PanelAppletHelper helper;
|
||||||
|
|
||||||
panel_init(&panel, iconsize);
|
panel_init(&panel, iconsize);
|
||||||
if((filename = _config_get_filename()) != NULL
|
|
||||||
&& config_load(panel.config, filename) != 0)
|
|
||||||
error_print(PROGNAME);
|
|
||||||
free(filename);
|
|
||||||
gtk_window_set_title(GTK_WINDOW(panel.top.window), _("Applet tester"));
|
gtk_window_set_title(GTK_WINDOW(panel.top.window), _("Applet tester"));
|
||||||
_helper_init(&helper, &panel, PANEL_APPLET_TYPE_NORMAL, iconsize);
|
_helper_init(&helper, &panel, PANEL_APPLET_TYPE_NORMAL, iconsize);
|
||||||
for(i = 0; applets[i] != NULL; i++)
|
for(i = 0; applets[i] != NULL; i++)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user