diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-02-01 22:53:16 -0600 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-02-01 22:53:16 -0600 |
commit | f9dc8cc28aa8dcffbec8f010d71234119d6d889d (patch) | |
tree | 85b6bba4301782830d413489fc50e2c2aebe131f | |
parent | 33beea08d1a833a3517b1a7a858d14ecc438017c (diff) | |
download | ayatana-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
-rw-r--r-- | src/indicator-power.c | 7 |
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); |