aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkarl-qdh <karl@qdh.org.uk>2011-03-02 14:00:41 +0000
committerkarl-qdh <karl@qdh.org.uk>2011-03-02 14:00:41 +0000
commit44bd4d29adb79c74ffbedc551a5a2414d652e7b1 (patch)
treee86ebc8912507b0c5252948782e0c7a1426a995b
parent7b2980b759af73f4ae6ac76409d10d908762d24f (diff)
downloadayatana-indicator-datetime-44bd4d29adb79c74ffbedc551a5a2414d652e7b1.tar.gz
ayatana-indicator-datetime-44bd4d29adb79c74ffbedc551a5a2414d652e7b1.tar.bz2
ayatana-indicator-datetime-44bd4d29adb79c74ffbedc551a5a2414d652e7b1.zip
Remove items from menu when the show events key changes
-rw-r--r--src/datetime-service.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index b748841..1983275 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -306,6 +306,18 @@ show_events_changed (void)
} else {
dbusmenu_menuitem_property_set_bool(add_appointment, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
dbusmenu_menuitem_property_set_bool(events_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+ /* Remove all of the previous appointments */
+ if (appointments != NULL) {
+ g_debug("Freeing old appointments");
+ while (appointments != NULL) {
+ DbusmenuMenuitem * litem = DBUSMENU_MENUITEM(appointments->data);
+ g_debug("Freeing old appointment: %p", litem);
+ // Remove all the existing menu items which are in appointments.
+ appointments = g_list_remove(appointments, litem);
+ dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(litem));
+ g_object_unref(G_OBJECT(litem));
+ }
+ }
stop_ecal_timer();
}
}