diff options
author | karl-qdh <karl@qdh.org.uk> | 2011-03-02 14:00:41 +0000 |
---|---|---|
committer | karl-qdh <karl@qdh.org.uk> | 2011-03-02 14:00:41 +0000 |
commit | 44bd4d29adb79c74ffbedc551a5a2414d652e7b1 (patch) | |
tree | e86ebc8912507b0c5252948782e0c7a1426a995b | |
parent | 7b2980b759af73f4ae6ac76409d10d908762d24f (diff) | |
download | ayatana-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.c | 12 |
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(); } } |