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
1=== modified file 'src/datetime-service.c'
2--- src/datetime-service.c 2011-02-04 12:26:38 +0000
3+++ src/datetime-service.c 2011-02-04 21:58:06 +0000
4@@ -293,7 +293,6 @@
5 time_t t1, t2;
6 gchar *query, *is, *ie, *ad;
7 GList *objects = NULL, *l;
8- DbusmenuMenuitem * item = NULL;
9 GError *gerror = NULL;
10 gint i;
11 gint width, height;
12@@ -316,18 +315,18 @@
13 }
14 g_debug("Number of objects returned: %d", g_list_length(objects));
15 gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
16+
17+ /* Remove all of the previous appointments */
18 if (appointments != NULL) {
19 g_debug("Freeing old appointments");
20- for (l = appointments; l; l = l->next) {
21- g_debug("Freeing old appointment");
22- item = l->data;
23+ while (appointments != NULL) {
24+ DbusmenuMenuitem * litem = DBUSMENU_MENUITEM(appointments->data);
25+ g_debug("Freeing old appointment: %p", litem);
26 // Remove all the existing menu items which are in appointments.
27- appointments = g_list_remove(appointments, item);
28- dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(item));
29- //g_free(item); freeing makes it crash :/ is that a double free from child delete?
30- item = NULL;
31+ appointments = g_list_remove(appointments, litem);
32+ dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(litem));
33+ g_object_unref(G_OBJECT(litem));
34 }
35- appointments = NULL;
36 }
37
38 // Sort the list see above FIXME regarding queries
39@@ -343,6 +342,7 @@
40 char right[20];
41 //const gchar *uri;
42 struct tm tmp_tm;
43+ DbusmenuMenuitem * item;
44
45 ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp);
46
47@@ -441,6 +441,7 @@
48
49 dbusmenu_menuitem_child_add_position (root, item, 4+i);
50 appointments = g_list_append (appointments, item); // Keep track of the items here to make them east to remove
51+ g_debug("Adding appointment: %p", item);
52
53 if (i == 4) break; // See above FIXME regarding query result limit
54 i++;

Subscribers

People subscribed via source and target branches

to all changes: