aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/indicator-power.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index 896555b..eb2b605 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -369,9 +369,14 @@ build_menu (IndicatorPower *self)
IndicatorPowerPrivate *priv = self->priv;
GtkWidget *item;
GtkWidget *image;
+ GList *children;
guint n_devices = 0;
- priv->menu = GTK_MENU (gtk_menu_new ());
+ if (priv->menu == NULL)
+ priv->menu = GTK_MENU (gtk_menu_new ());
+
+ children = gtk_container_get_children (GTK_CONTAINER (priv->menu));
+ g_list_foreach (children, (GFunc) gtk_widget_destroy, NULL);
/* devices */
n_devices += menu_add_device (priv->menu, priv->device);