Merge lp:~ted/indicator-datetime/no-double-appointments into lp:~karl-qdh/ubuntu/natty/indicator-datetime/indicator-datetime.withappointments

Proposed by Ted Gould
Status: Merged
Merged at revision: 46
Proposed branch: lp:~ted/indicator-datetime/no-double-appointments
Merge into: lp:~karl-qdh/ubuntu/natty/indicator-datetime/indicator-datetime.withappointments
Diff against target: 54 lines (+10/-9)
1 file modified
src/datetime-service.c (+10/-9)
To merge this branch: bzr merge lp:~ted/indicator-datetime/no-double-appointments
Reviewer Review Type Date Requested Status
Karl Lattimer Pending
Review via email: mp+48672@code.launchpad.net

Description of the change

I think this fixes the double menu items. I think the issue was that the list had a incrementor and a head that was confusing things. Also cleaned up a ref'ing issue.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/datetime-service.c'
--- src/datetime-service.c 2011-02-04 12:26:38 +0000
+++ src/datetime-service.c 2011-02-04 21:58:06 +0000
@@ -293,7 +293,6 @@
293 time_t t1, t2;293 time_t t1, t2;
294 gchar *query, *is, *ie, *ad;294 gchar *query, *is, *ie, *ad;
295 GList *objects = NULL, *l;295 GList *objects = NULL, *l;
296 DbusmenuMenuitem * item = NULL;
297 GError *gerror = NULL;296 GError *gerror = NULL;
298 gint i;297 gint i;
299 gint width, height;298 gint width, height;
@@ -316,18 +315,18 @@
316 }315 }
317 g_debug("Number of objects returned: %d", g_list_length(objects));316 g_debug("Number of objects returned: %d", g_list_length(objects));
318 gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);317 gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
318
319 /* Remove all of the previous appointments */
319 if (appointments != NULL) {320 if (appointments != NULL) {
320 g_debug("Freeing old appointments");321 g_debug("Freeing old appointments");
321 for (l = appointments; l; l = l->next) {322 while (appointments != NULL) {
322 g_debug("Freeing old appointment");323 DbusmenuMenuitem * litem = DBUSMENU_MENUITEM(appointments->data);
323 item = l->data;324 g_debug("Freeing old appointment: %p", litem);
324 // Remove all the existing menu items which are in appointments.325 // Remove all the existing menu items which are in appointments.
325 appointments = g_list_remove(appointments, item);326 appointments = g_list_remove(appointments, litem);
326 dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(item));327 dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(litem));
327 //g_free(item); freeing makes it crash :/ is that a double free from child delete?328 g_object_unref(G_OBJECT(litem));
328 item = NULL;
329 }329 }
330 appointments = NULL;
331 }330 }
332 331
333 // Sort the list see above FIXME regarding queries332 // Sort the list see above FIXME regarding queries
@@ -343,6 +342,7 @@
343 char right[20];342 char right[20];
344 //const gchar *uri;343 //const gchar *uri;
345 struct tm tmp_tm;344 struct tm tmp_tm;
345 DbusmenuMenuitem * item;
346346
347 ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp);347 ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp);
348348
@@ -441,6 +441,7 @@
441 441
442 dbusmenu_menuitem_child_add_position (root, item, 4+i);442 dbusmenu_menuitem_child_add_position (root, item, 4+i);
443 appointments = g_list_append (appointments, item); // Keep track of the items here to make them east to remove443 appointments = g_list_append (appointments, item); // Keep track of the items here to make them east to remove
444 g_debug("Adding appointment: %p", item);
444 445
445 if (i == 4) break; // See above FIXME regarding query result limit446 if (i == 4) break; // See above FIXME regarding query result limit
446 i++;447 i++;

Subscribers

People subscribed via source and target branches

to all changes: