aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-06-15 13:49:05 -0500
committerTed Gould <ted@gould.cx>2010-06-15 13:49:05 -0500
commit97513daeb03ba302613de3ebbfcf356bc75fa611 (patch)
treebe637f70958f399357956b95d7ab3548b156fc6c /libdbusmenu-gtk
parent02a8c4e2b1eff14575d1cb78fb35b483f1e35ad7 (diff)
downloadlibdbusmenu-97513daeb03ba302613de3ebbfcf356bc75fa611.tar.gz
libdbusmenu-97513daeb03ba302613de3ebbfcf356bc75fa611.tar.bz2
libdbusmenu-97513daeb03ba302613de3ebbfcf356bc75fa611.zip
Switch to using the accel map with paths
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/client.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c
index ab7f16c..a9c6657 100644
--- a/libdbusmenu-gtk/client.c
+++ b/libdbusmenu-gtk/client.c
@@ -153,17 +153,20 @@ swap_agroup (DbusmenuMenuitem * mi, gpointer userdata) {
return;
}
- if (data->old_agroup != NULL) {
- gtk_widget_remove_accelerator(GTK_WIDGET(gmi), data->old_agroup, key, modifiers);
+ const gchar * accel_path = gtk_menu_item_get_accel_path(gmi);
+
+ if (accel_path != NULL) {
+ gtk_accel_map_change_entry(accel_path, key, modifiers, TRUE /* replace */);
+ } else {
+ gchar * accel_path = g_strdup_printf("<Appmenus>/Generated/%d", dbusmenu_menuitem_get_id(mi));
+ gtk_accel_map_add_entry(accel_path, key, modifiers);
+ gtk_menu_item_set_accel_path(gmi, accel_path);
+ g_free(accel_path);
}
- if (data->new_agroup != NULL) {
- gtk_widget_add_accelerator(GTK_WIDGET(gmi),
- "activate",
- data->new_agroup,
- key,
- modifiers,
- GTK_ACCEL_VISIBLE);
+ GtkMenu * submenu = dbusmenu_gtkclient_menuitem_get_submenu(data->client, mi);
+ if (submenu != NULL) {
+ gtk_menu_set_accel_group(submenu, data->new_agroup);
}
return;