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

Proposed by Alistair Buxton
Status: Merged
Approved by: Ted Gould
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
Ted Gould (community) Approve
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.
Revision history for this message
Ted Gould (ted) wrote :

Cool. Great investigation!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libdbusmenu-gtk/parser.c'
--- libdbusmenu-gtk/parser.c 2013-06-18 19:59:44 +0000
+++ libdbusmenu-gtk/parser.c 2013-11-03 03:15:26 +0000
@@ -97,9 +97,7 @@
97 gpointer data);97 gpointer data);
98static void item_inserted_cb (GtkContainer * menu,98static void item_inserted_cb (GtkContainer * menu,
99 GtkWidget * widget,99 GtkWidget * widget,
100#ifdef HAVE_GTK3
101 gint position,100 gint position,
102#endif
103 gpointer data);101 gpointer data);
104static void item_removed_cb (GtkContainer * menu,102static void item_removed_cb (GtkContainer * menu,
105 GtkWidget * widget,103 GtkWidget * widget,
@@ -431,11 +429,7 @@
431429
432 pdata->shell = menu;430 pdata->shell = menu;
433 pdata->item_inserted_handler_id = g_signal_connect (G_OBJECT (menu),431 pdata->item_inserted_handler_id = g_signal_connect (G_OBJECT (menu),
434#ifdef HAVE_GTK3
435 "insert",432 "insert",
436#else
437 "child-added",
438#endif
439 G_CALLBACK (item_inserted_cb),433 G_CALLBACK (item_inserted_cb),
440 mi);434 mi);
441 pdata->item_removed_handler_id = g_signal_connect (G_OBJECT (menu),435 pdata->item_removed_handler_id = g_signal_connect (G_OBJECT (menu),
@@ -1394,9 +1388,7 @@
1394static void1388static void
1395item_inserted_cb (GtkContainer *menu,1389item_inserted_cb (GtkContainer *menu,
1396 GtkWidget *widget,1390 GtkWidget *widget,
1397#ifdef HAVE_GTK3
1398 gint position,1391 gint position,
1399#endif
1400 gpointer data)1392 gpointer data)
1401{1393{
1402 DbusmenuMenuitem *menuitem = (DbusmenuMenuitem *)data;1394 DbusmenuMenuitem *menuitem = (DbusmenuMenuitem *)data;

Subscribers

People subscribed via source and target branches