aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-power.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-02-01 22:53:16 -0600
committerCharles Kerr <charles.kerr@canonical.com>2012-02-01 22:53:16 -0600
commitf9dc8cc28aa8dcffbec8f010d71234119d6d889d (patch)
tree85b6bba4301782830d413489fc50e2c2aebe131f /src/indicator-power.c
parent33beea08d1a833a3517b1a7a858d14ecc438017c (diff)
downloadayatana-indicator-power-f9dc8cc28aa8dcffbec8f010d71234119d6d889d.tar.gz
ayatana-indicator-power-f9dc8cc28aa8dcffbec8f010d71234119d6d889d.tar.bz2
ayatana-indicator-power-f9dc8cc28aa8dcffbec8f010d71234119d6d889d.zip
create the menu at init time s.t. we don't have to keep checking to see if it exists
Diffstat (limited to 'src/indicator-power.c')
-rw-r--r--src/indicator-power.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index f91119d..e359a03 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -112,7 +112,8 @@ indicator_power_class_init (IndicatorPowerClass *klass)
static void
indicator_power_init (IndicatorPower *self)
{
- self->menu = NULL;
+ self->menu = GTK_MENU(gtk_menu_new());
+
self->accessible_desc = NULL;
self->watcher_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
@@ -589,9 +590,7 @@ build_menu (IndicatorPower *self)
GList *children;
gsize n_devices = 0;
- if (self->menu == NULL)
- self->menu = GTK_MENU (gtk_menu_new ());
-
+ /* remove the existing menuitems */
children = gtk_container_get_children (GTK_CONTAINER (self->menu));
g_list_foreach (children, (GFunc) gtk_widget_destroy, NULL);
g_list_free (children);