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

Proposed by Michael Terry on 2011-03-21
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 2011-03-21 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
1=== modified file 'libdbusmenu-gtk/menuitem.c'
2--- libdbusmenu-gtk/menuitem.c 2011-03-10 00:43:07 +0000
3+++ libdbusmenu-gtk/menuitem.c 2011-03-21 16:11:30 +0000
4@@ -236,8 +236,15 @@
5 NULL);
6 }
7
8- if (closure == NULL)
9- return FALSE;
10+ if (closure == NULL) {
11+ /* As a fallback, check for a closure in the related menu item. This
12+ actually happens with SWT menu items. */
13+ GList * closures = gtk_widget_list_accel_closures (GTK_WIDGET (gmi));
14+ if (closures == NULL)
15+ return FALSE;
16+ closure = closures->data;
17+ g_list_free (closures);
18+ }
19
20 GtkAccelGroup * group = gtk_accel_group_from_accel_closure(closure);
21

Subscribers

People subscribed via source and target branches