diff options
author | Ted Gould <ted@gould.cx> | 2010-06-22 11:11:22 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-06-22 11:11:22 -0500 |
commit | e6b8f2b386820ef345bbbf3b73a7a5955b48c0fe (patch) | |
tree | 428f56973ec41046489ab02c69a69618899d0e19 | |
parent | 55338f48370c4e0007aff36c8b18add4ace435f6 (diff) | |
parent | 4a755f012fbd4fa6050901ac6d8402b35c26985b (diff) | |
download | libdbusmenu-e6b8f2b386820ef345bbbf3b73a7a5955b48c0fe.tar.gz libdbusmenu-e6b8f2b386820ef345bbbf3b73a7a5955b48c0fe.tar.bz2 libdbusmenu-e6b8f2b386820ef345bbbf3b73a7a5955b48c0fe.zip |
* Upstream Merge
* Fixing getting accelerators from menuitems
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | libdbusmenu-gtk/menuitem.c | 22 |
2 files changed, 20 insertions, 9 deletions
diff --git a/debian/changelog b/debian/changelog index a1a828a..cd73096 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +libdbusmenu (0.3.2-1ubuntu1~ppa3) lucid; urgency=low + + * Upstream Merge + * Fixing getting accelerators from menuitems + + -- Ted Gould <ted@ubuntu.com> Tue, 22 Jun 2010 11:10:59 -0500 + libdbusmenu (0.3.2-1ubuntu1~ppa2) lucid; urgency=low * Upstream Merge diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c index a448f88..57cd258 100644 --- a/libdbusmenu-gtk/menuitem.c +++ b/libdbusmenu-gtk/menuitem.c @@ -246,19 +246,20 @@ dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, c g_return_val_if_fail(GTK_IS_MENU_ITEM(gmi), FALSE); GClosure * closure = NULL; - GList * clist; + GtkWidget *label = GTK_BIN (gmi)->child; - clist = gtk_widget_list_accel_closures(GTK_WIDGET(gmi)); - if (clist == NULL) { - g_warning("Menuitem does not have any closures."); - return FALSE; - } + if (GTK_IS_ACCEL_LABEL (label)) + { + g_object_get (label, + "accel-closure", &closure, + NULL); + } - closure = (GClosure *)clist->data; - g_list_free(clist); + if (closure == NULL) + return FALSE; GtkAccelGroup * group = gtk_accel_group_from_accel_closure(closure); - + /* Seriously, if this returns NULL something is seriously wrong in GTK. */ g_return_val_if_fail(group != NULL, FALSE); @@ -267,6 +268,9 @@ dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, c /* Again, not much we can do except complain loudly. */ g_return_val_if_fail(key != NULL, FALSE); + if (!gtk_accelerator_valid (key->accel_key, key->accel_mods)) + return FALSE; + return dbusmenu_menuitem_property_set_shortcut(menuitem, key->accel_key, key->accel_mods); } |