Merge lp:~mterry/indicator-applet/global-desc-update-callback into lp:indicator-applet/0.4

Proposed by Michael Terry
Status: Merged
Merged at revision: 386
Proposed branch: lp:~mterry/indicator-applet/global-desc-update-callback
Merge into: lp:indicator-applet/0.4
Diff against target: 47 lines (+17/-6)
1 file modified
src/applet-main.c (+17/-6)
To merge this branch: bzr merge lp:~mterry/indicator-applet/global-desc-update-callback
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+57533@code.launchpad.net

Description of the change

Every time an indicator-applet adds an entry, it connects to the global IndicatorObject INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE signal with the new entry menuitem as an argument.

But it never cleaned it up, meaning that we could crash after the menuitem goes away and another entry emits the DESC_UPDATE signal.

This branch changes it to just one signal connection and has the applet search for the right entry. This matches how it handles other global signals.

This might fix linked bug 745115.

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/applet-main.c'
2--- src/applet-main.c 2011-03-22 20:35:19 +0000
3+++ src/applet-main.c 2011-04-13 16:29:30 +0000
4@@ -266,10 +266,22 @@
5 }
6
7 static void
8-accessible_desc_update (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menuitem)
9-{
10- g_return_if_fail(GTK_IS_WIDGET(menuitem));
11- update_accessible_desc(entry, menuitem);
12+accessible_desc_update_cb (GtkWidget * widget, gpointer userdata)
13+{
14+ gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
15+
16+ if (data != userdata) {
17+ return;
18+ }
19+
20+ IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data;
21+ update_accessible_desc(entry, widget);
22+}
23+
24+static void
25+accessible_desc_update (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
26+{
27+ gtk_container_foreach(GTK_CONTAINER(menubar), accessible_desc_update_cb, entry);
28 return;
29 }
30
31@@ -350,8 +362,6 @@
32
33 gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), menuitem, position.menupos);
34
35- g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menuitem);
36-
37 if (something_visible) {
38 if (entry->accessible_desc != NULL) {
39 update_accessible_desc(entry, menuitem);
40@@ -529,6 +539,7 @@
41 g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_removed), menubar);
42 g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, G_CALLBACK(entry_moved), menubar);
43 g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_MENU_SHOW, G_CALLBACK(menu_show), menubar);
44+ g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menubar);
45
46 /* Work on the entries */
47 GList * entries = indicator_object_get_entries(io);

Subscribers

People subscribed via source and target branches

to status/vote changes: