Factored some more code

This commit is contained in:
Pierre Pronchery 2013-11-21 05:44:11 +01:00
parent dbcf0dc6c5
commit 296293c4b1
3 changed files with 5 additions and 10 deletions

View File

@ -124,12 +124,17 @@ static int _helper_append(PanelAppletHelper * helper, PanelWindow * window,
/* panel_init */
int panel_init(Panel * panel, GtkIconSize iconsize)
{
char * filename;
GdkScreen * screen;
GdkWindow * root;
GdkRectangle rect;
if((panel->config = config_new()) == NULL)
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 = panel->top.window;
panel->source = 0;

View File

@ -65,15 +65,10 @@ static int _usage(void);
static int _notify(GtkIconSize iconsize, int timeout, char * applets[])
{
Panel panel;
char * filename;
size_t i;
PanelAppletHelper helper;
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)
gtk_window_set_has_resize_grip(GTK_WINDOW(panel.top.window), FALSE);
#endif

View File

@ -61,15 +61,10 @@ static int _usage(void);
static int _test(GtkIconSize iconsize, char * applets[])
{
Panel panel;
char * filename;
size_t i;
PanelAppletHelper helper;
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"));
_helper_init(&helper, &panel, PANEL_APPLET_TYPE_NORMAL, iconsize);
for(i = 0; applets[i] != NULL; i++)