aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-11 13:16:32 -0600
committerTed Gould <ted@gould.cx>2010-02-11 13:16:32 -0600
commitb1d66f9d77fa960d7e59353e1e33250060493ec6 (patch)
tree76e6f5ba0232e54a2eec8ce714ffd387d404cef5 /src
parent4ec15094555e5bc71a46f16ea9bf101e41e59631 (diff)
downloadayatana-indicator-session-b1d66f9d77fa960d7e59353e1e33250060493ec6.tar.gz
ayatana-indicator-session-b1d66f9d77fa960d7e59353e1e33250060493ec6.tar.bz2
ayatana-indicator-session-b1d66f9d77fa960d7e59353e1e33250060493ec6.zip
Refactoring so the menu is created in init.
Diffstat (limited to 'src')
-rw-r--r--src/indicator-session.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c
index dda8c76..2017fff 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -51,6 +51,8 @@ struct _IndicatorSessionClass {
struct _IndicatorSession {
IndicatorObject parent;
IndicatorServiceManager * service;
+ GtkImage * status_image;
+ GtkMenu * menu;
};
GType indicator_session_get_type (void);
@@ -96,6 +98,9 @@ indicator_session_init (IndicatorSession *self)
/* Now let's fire these guys up. */
self->service = indicator_service_manager_new_version(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_VERSION);
+ self->status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown-panel", GTK_ICON_SIZE_MENU));
+ self->menu = GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT));
+
return;
}
@@ -130,9 +135,8 @@ get_label (IndicatorObject * io)
static GtkImage *
get_icon (IndicatorObject * io)
{
- GtkImage * status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown-panel", GTK_ICON_SIZE_MENU));
- gtk_widget_show(GTK_WIDGET(status_image));
- return status_image;
+ gtk_widget_show(GTK_WIDGET(INDICATOR_SESSION(io)->status_image));
+ return INDICATOR_SESSION(io)->status_image;
}
/* Indicator based function to get the menu for the whole
@@ -141,7 +145,7 @@ get_icon (IndicatorObject * io)
static GtkMenu *
get_menu (IndicatorObject * io)
{
- return GTK_MENU(dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT));
+ return INDICATOR_SESSION(io)->menu;
}