Merge lp:~a-j-buxton/libdbusmenu/gtk2signalfix into lp:libdbusmenu/14.04

Proposed by Alistair Buxton on 2013-11-03
Status: Merged
Approved by: Ted Gould on 2013-11-04
Approved revision: 462
Merged at revision: 462
Proposed branch: lp:~a-j-buxton/libdbusmenu/gtk2signalfix
Merge into: lp:libdbusmenu/14.04
Diff against target: 35 lines (+0/-8)
1 file modified
libdbusmenu-gtk/parser.c (+0/-8)
To merge this branch: bzr merge lp:~a-j-buxton/libdbusmenu/gtk2signalfix
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve on 2013-11-04
Ted Gould (community) 2013-11-03 Approve on 2013-11-04
Review via email: mp+193690@code.launchpad.net

Commit message

Use "insert" signal instead of "child-added" (LP: #1203888)

In recent Gtk+2 versions, the "insert" signal has been backported from
Gtk+3. This replaces the "child-added" signal, which was carried in an
Ubuntu-specific patch and was dropped in Saucy.

Description of the change

This change removes the special case logic for "insert"/"child-added" since it is no longer needed on current Gtk2.

The full details are in https://bugs.launchpad.net/ubuntu/+source/glipper/+bug/1203888

For a test case see https://bugs.launchpad.net/libdbusmenu/+bug/1203888/comments/8

If libdbusmenu is broken, you will only see "One" in the appindicator menu, and the warning about "child-added". If it is working you will see "One" and "Two".

The tl;dr version:

 * libdbusmenu needed to know when items were added to a GtkMenu. There was no signal for this in Gtk2, so Ubuntu invented one called "child-added" and carried it in a patch called 072_indicator_menu_update.patch:
https://build.opensuse.org/package/view_file/GNOME:Ayatana/gtk2/072_indicator_menu_update.patch?rev=1f0c7b36faaa82554bb480026061409c

 * Gtk3 came out, and it had a signal for this purpose called "insert", so libdbusmenu was patched with a piece of logic to detect Gtk2/3 and use the appropriate signal name:
http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/libdbusmenu/trusty/view/head:/libdbusmenu-gtk/parser.c#L434

 * Later, the "insert" signal was backported to Gtk2:
https://git.gnome.org/browse/gtk+/commit/?h=gtk-2-24&id=5ada51d3c7d3b476d954c4fdddb4895c3de00220

 * The Ubuntu "child-added" patch was subsequently dropped in Saucy, but libdbusmenu was not updated to use the "insert" signal with Gtk2.

To post a comment you must log in.
Ted Gould (ted) wrote :

Cool. Great investigation!

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbusmenu-gtk/parser.c'
2--- libdbusmenu-gtk/parser.c 2013-06-18 19:59:44 +0000
3+++ libdbusmenu-gtk/parser.c 2013-11-03 03:15:26 +0000
4@@ -97,9 +97,7 @@
5 gpointer data);
6 static void item_inserted_cb (GtkContainer * menu,
7 GtkWidget * widget,
8-#ifdef HAVE_GTK3
9 gint position,
10-#endif
11 gpointer data);
12 static void item_removed_cb (GtkContainer * menu,
13 GtkWidget * widget,
14@@ -431,11 +429,7 @@
15
16 pdata->shell = menu;
17 pdata->item_inserted_handler_id = g_signal_connect (G_OBJECT (menu),
18-#ifdef HAVE_GTK3
19 "insert",
20-#else
21- "child-added",
22-#endif
23 G_CALLBACK (item_inserted_cb),
24 mi);
25 pdata->item_removed_handler_id = g_signal_connect (G_OBJECT (menu),
26@@ -1394,9 +1388,7 @@
27 static void
28 item_inserted_cb (GtkContainer *menu,
29 GtkWidget *widget,
30-#ifdef HAVE_GTK3
31 gint position,
32-#endif
33 gpointer data)
34 {
35 DbusmenuMenuitem *menuitem = (DbusmenuMenuitem *)data;

Subscribers

People subscribed via source and target branches