Let the code look closer to the main code
This commit is contained in:
parent
0a497172ed
commit
10fc298d89
|
@ -53,6 +53,7 @@ typedef struct _PanelWindow
|
||||||
int height;
|
int height;
|
||||||
|
|
||||||
/* applets */
|
/* applets */
|
||||||
|
PanelAppletHelper * helper;
|
||||||
PanelApplet * applets;
|
PanelApplet * applets;
|
||||||
size_t applets_cnt;
|
size_t applets_cnt;
|
||||||
|
|
||||||
|
@ -107,11 +108,11 @@ static int _panel_append(Panel * panel, PanelPosition position,
|
||||||
char const * applet);
|
char const * applet);
|
||||||
|
|
||||||
/* PanelWindow */
|
/* PanelWindow */
|
||||||
static void _panel_window_init(PanelWindow * panel, GtkIconSize iconsize);
|
static void _panel_window_init(PanelWindow * panel,
|
||||||
|
PanelAppletHelper * helper);
|
||||||
static void _panel_window_destroy(PanelWindow * panel);
|
static void _panel_window_destroy(PanelWindow * panel);
|
||||||
|
|
||||||
static int _panel_window_append(PanelWindow * window,
|
static int _panel_window_append(PanelWindow * window, char const * applet);
|
||||||
PanelAppletHelper * helper, char const * applet);
|
|
||||||
|
|
||||||
static int _applet_list(void);
|
static int _applet_list(void);
|
||||||
static char * _config_get_filename(void);
|
static char * _config_get_filename(void);
|
||||||
|
@ -171,7 +172,8 @@ static int _panel_init(Panel * panel, PanelAppletType type,
|
||||||
&& config_load(panel->config, filename) != 0)
|
&& config_load(panel->config, filename) != 0)
|
||||||
error_print(PROGNAME);
|
error_print(PROGNAME);
|
||||||
free(filename);
|
free(filename);
|
||||||
_panel_window_init(&panel->top, iconsize);
|
_helper_init(&panel->helper, panel, type, iconsize);
|
||||||
|
_panel_window_init(&panel->top, &panel->helper);
|
||||||
panel->window = panel->top.window;
|
panel->window = panel->top.window;
|
||||||
panel->timeout = 0;
|
panel->timeout = 0;
|
||||||
panel->source = 0;
|
panel->source = 0;
|
||||||
|
@ -184,7 +186,6 @@ static int _panel_init(Panel * panel, PanelAppletType type,
|
||||||
gdk_screen_get_monitor_geometry(screen, 0, &rect);
|
gdk_screen_get_monitor_geometry(screen, 0, &rect);
|
||||||
panel->root_height = rect.height;
|
panel->root_height = rect.height;
|
||||||
panel->root_width = rect.width;
|
panel->root_width = rect.width;
|
||||||
_helper_init(&panel->helper, panel, type, iconsize);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,22 +212,23 @@ static int _panel_append(Panel * panel, PanelPosition position,
|
||||||
char const * applet)
|
char const * applet)
|
||||||
{
|
{
|
||||||
if(position == PANEL_POSITION_TOP)
|
if(position == PANEL_POSITION_TOP)
|
||||||
return _panel_window_append(&panel->top, &panel->helper,
|
return _panel_window_append(&panel->top, applet);
|
||||||
applet);
|
|
||||||
return -error_set_code(1, "%s", "Invalid panel position");
|
return -error_set_code(1, "%s", "Invalid panel position");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* PanelWindow */
|
/* PanelWindow */
|
||||||
/* panel_window_init */
|
/* panel_window_init */
|
||||||
static void _panel_window_init(PanelWindow * panel, GtkIconSize iconsize)
|
static void _panel_window_init(PanelWindow * panel, PanelAppletHelper * helper)
|
||||||
{
|
{
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
|
|
||||||
if(gtk_icon_size_lookup(iconsize, &rect.width, &rect.height) == TRUE)
|
if(gtk_icon_size_lookup(helper->icon_size, &rect.width, &rect.height)
|
||||||
|
== TRUE)
|
||||||
panel->height = rect.height + 8;
|
panel->height = rect.height + 8;
|
||||||
else
|
else
|
||||||
panel->height = 72;
|
panel->height = 72;
|
||||||
|
panel->helper = helper;
|
||||||
panel->applets = NULL;
|
panel->applets = NULL;
|
||||||
panel->applets_cnt = 0;
|
panel->applets_cnt = 0;
|
||||||
panel->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
panel->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
|
@ -256,9 +258,9 @@ static void _panel_window_destroy(PanelWindow * panel)
|
||||||
|
|
||||||
|
|
||||||
/* panel_window_append */
|
/* panel_window_append */
|
||||||
static int _panel_window_append(PanelWindow * window,
|
static int _panel_window_append(PanelWindow * window, char const * applet)
|
||||||
PanelAppletHelper * helper, char const * applet)
|
|
||||||
{
|
{
|
||||||
|
PanelAppletHelper * helper = window->helper;
|
||||||
PanelApplet * pa;
|
PanelApplet * pa;
|
||||||
|
|
||||||
if((pa = realloc(window->applets, sizeof(*pa)
|
if((pa = realloc(window->applets, sizeof(*pa)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user