Merge lp:~mterry/libdbusmenu/check-gmi-for-accel-closures into lp:libdbusmenu/0.5

Proposed by Michael Terry
Status: Merged
Merged at revision: 279
Proposed branch: lp:~mterry/libdbusmenu/check-gmi-for-accel-closures
Merge into: lp:libdbusmenu/0.5
Diff against target: 20 lines (+9/-2)
1 file modified
libdbusmenu-gtk/menuitem.c (+9/-2)
To merge this branch: bzr merge lp:~mterry/libdbusmenu/check-gmi-for-accel-closures
Reviewer Review Type Date Requested Status
DBus Menu Team Pending
Review via email: mp+54230@code.launchpad.net

Description of the change

In figuring out what the heck is wrong with eclipse, I've discovered that SWT menu items are crazy with respect to menu item accelerators.

They use deprecated direct access to the struct to set the user-visible string, then go and set an accelerator on the menu item directly. Now, at least if they ever plan to move to gtk3, they'll have to fix that, but for now, we should deal with it.

Here's a patch to check the menu item for closures directly, if the accel label doesn't have them. It just grabs the first one if any exist.

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 'libdbusmenu-gtk/menuitem.c'
--- libdbusmenu-gtk/menuitem.c 2011-03-10 00:43:07 +0000
+++ libdbusmenu-gtk/menuitem.c 2011-03-21 16:11:30 +0000
@@ -236,8 +236,15 @@
236 NULL);236 NULL);
237 }237 }
238238
239 if (closure == NULL)239 if (closure == NULL) {
240 return FALSE;240 /* As a fallback, check for a closure in the related menu item. This
241 actually happens with SWT menu items. */
242 GList * closures = gtk_widget_list_accel_closures (GTK_WIDGET (gmi));
243 if (closures == NULL)
244 return FALSE;
245 closure = closures->data;
246 g_list_free (closures);
247 }
241248
242 GtkAccelGroup * group = gtk_accel_group_from_accel_closure(closure);249 GtkAccelGroup * group = gtk_accel_group_from_accel_closure(closure);
243250

Subscribers

People subscribed via source and target branches