From 44bd4d29adb79c74ffbedc551a5a2414d652e7b1 Mon Sep 17 00:00:00 2001 From: karl-qdh Date: Wed, 2 Mar 2011 14:00:41 +0000 Subject: Remove items from menu when the show events key changes --- src/datetime-service.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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(); } } -- cgit v1.2.3