aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkarl-qdh <karl@qdh.org.uk>2011-02-08 16:21:32 +0000
committerkarl-qdh <karl@qdh.org.uk>2011-02-08 16:21:32 +0000
commitd59aaf9c31b2db87b517095caff818a9ff50343a (patch)
treea879abb0e939253288aab5eaf4b5a5df1f72d76b /src
parent68d701af0a08a91071b6db4697b1df20108ea613 (diff)
downloadayatana-indicator-datetime-d59aaf9c31b2db87b517095caff818a9ff50343a.tar.gz
ayatana-indicator-datetime-d59aaf9c31b2db87b517095caff818a9ff50343a.tar.bz2
ayatana-indicator-datetime-d59aaf9c31b2db87b517095caff818a9ff50343a.zip
Re-adding tedg's changes
Diffstat (limited to 'src')
-rw-r--r--src/datetime-service.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 3aa6acf..eb280dc 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -342,7 +342,6 @@ update_appointment_menu_items (gpointer user_data) {
time_t t1, t2;
gchar *query, *is, *ie, *ad;
GList *objects = NULL, *l;
- DbusmenuMenuitem * item = NULL;
GError *gerror = NULL;
gint i;
gint width, height;
@@ -365,18 +364,18 @@ update_appointment_menu_items (gpointer user_data) {
}
g_debug("Number of objects returned: %d", g_list_length(objects));
gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
+
+ /* Remove all of the previous appointments */
if (appointments != NULL) {
g_debug("Freeing old appointments");
- for (l = appointments; l; l = l->next) {
- g_debug("Freeing old appointment");
- item = l->data;
+ 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, item);
- dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(item));
- //g_free(item); freeing makes it crash :/ is that a double free from child delete?
- item = NULL;
+ appointments = g_list_remove(appointments, litem);
+ dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(litem));
+ g_object_unref(G_OBJECT(litem));
}
- appointments = NULL;
}
// Sort the list see above FIXME regarding queries
@@ -392,6 +391,7 @@ update_appointment_menu_items (gpointer user_data) {
char right[20];
//const gchar *uri;
struct tm tmp_tm;
+ DbusmenuMenuitem * item;
ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp);
@@ -491,6 +491,7 @@ update_appointment_menu_items (gpointer user_data) {
}
dbusmenu_menuitem_child_add_position (root, item, 4+i);
appointments = g_list_append (appointments, item); // Keep track of the items here to make them east to remove
+ g_debug("Adding appointment: %p", item);
if (i == 4) break; // See above FIXME regarding query result limit
i++;