From 97513daeb03ba302613de3ebbfcf356bc75fa611 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 15 Jun 2010 13:49:05 -0500 Subject: Switch to using the accel map with paths --- libdbusmenu-gtk/client.c | 21 ++++++++++++--------- 1 file 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("/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; -- cgit v1.2.3