Factored some more code
This commit is contained in:
parent
5502c26fa9
commit
dbcf0dc6c5
|
@ -124,6 +124,10 @@ 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)
|
||||||
{
|
{
|
||||||
|
GdkScreen * screen;
|
||||||
|
GdkWindow * root;
|
||||||
|
GdkRectangle rect;
|
||||||
|
|
||||||
if((panel->config = config_new()) == NULL)
|
if((panel->config = config_new()) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
panel_window_init(&panel->top, iconsize);
|
panel_window_init(&panel->top, iconsize);
|
||||||
|
@ -132,6 +136,12 @@ int panel_init(Panel * panel, GtkIconSize iconsize)
|
||||||
panel->ab_window = NULL;
|
panel->ab_window = NULL;
|
||||||
panel->lo_window = NULL;
|
panel->lo_window = NULL;
|
||||||
panel->sh_window = NULL;
|
panel->sh_window = NULL;
|
||||||
|
/* root window */
|
||||||
|
screen = gdk_screen_get_default();
|
||||||
|
root = gdk_screen_get_root_window(screen);
|
||||||
|
gdk_screen_get_monitor_geometry(screen, 0, &rect);
|
||||||
|
panel->root_height = rect.height;
|
||||||
|
panel->root_width = rect.width;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,6 @@ static int _notify(GtkIconSize iconsize, int timeout, char * applets[])
|
||||||
char * filename;
|
char * filename;
|
||||||
size_t i;
|
size_t i;
|
||||||
PanelAppletHelper helper;
|
PanelAppletHelper helper;
|
||||||
GdkScreen * screen;
|
|
||||||
GdkWindow * root;
|
|
||||||
GdkRectangle rect;
|
|
||||||
|
|
||||||
panel_init(&panel, iconsize);
|
panel_init(&panel, iconsize);
|
||||||
if((filename = _config_get_filename()) != NULL
|
if((filename = _config_get_filename()) != NULL
|
||||||
|
@ -94,12 +91,6 @@ static int _notify(GtkIconSize iconsize, int timeout, char * applets[])
|
||||||
if(timeout > 0)
|
if(timeout > 0)
|
||||||
panel.timeout = g_timeout_add(timeout * 1000,
|
panel.timeout = g_timeout_add(timeout * 1000,
|
||||||
_notify_on_timeout, &panel);
|
_notify_on_timeout, &panel);
|
||||||
/* root window */
|
|
||||||
screen = gdk_screen_get_default();
|
|
||||||
root = gdk_screen_get_root_window(screen);
|
|
||||||
gdk_screen_get_monitor_geometry(screen, 0, &rect);
|
|
||||||
panel.root_height = rect.height;
|
|
||||||
panel.root_width = rect.width;
|
|
||||||
gtk_main();
|
gtk_main();
|
||||||
panel_destroy(&panel);
|
panel_destroy(&panel);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -64,9 +64,6 @@ static int _test(GtkIconSize iconsize, char * applets[])
|
||||||
char * filename;
|
char * filename;
|
||||||
size_t i;
|
size_t i;
|
||||||
PanelAppletHelper helper;
|
PanelAppletHelper helper;
|
||||||
GdkScreen * screen;
|
|
||||||
GdkWindow * root;
|
|
||||||
GdkRectangle rect;
|
|
||||||
|
|
||||||
panel_init(&panel, iconsize);
|
panel_init(&panel, iconsize);
|
||||||
if((filename = _config_get_filename()) != NULL
|
if((filename = _config_get_filename()) != NULL
|
||||||
|
@ -79,12 +76,6 @@ static int _test(GtkIconSize iconsize, char * applets[])
|
||||||
_helper_append(&helper, &panel.top, applets[i]);
|
_helper_append(&helper, &panel.top, applets[i]);
|
||||||
gtk_widget_show_all(panel.top.window);
|
gtk_widget_show_all(panel.top.window);
|
||||||
panel.timeout = 0;
|
panel.timeout = 0;
|
||||||
/* root window */
|
|
||||||
screen = gdk_screen_get_default();
|
|
||||||
root = gdk_screen_get_root_window(screen);
|
|
||||||
gdk_screen_get_monitor_geometry(screen, 0, &rect);
|
|
||||||
panel.root_height = rect.height;
|
|
||||||
panel.root_width = rect.width;
|
|
||||||
gtk_main();
|
gtk_main();
|
||||||
panel_destroy(&panel);
|
panel_destroy(&panel);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user