summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/menu_gtk.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/gtk/menu_gtk.cc')
-rw-r--r--chrome/browser/gtk/menu_gtk.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/chrome/browser/gtk/menu_gtk.cc b/chrome/browser/gtk/menu_gtk.cc
index af6c4e9..6b38c3c 100644
--- a/chrome/browser/gtk/menu_gtk.cc
+++ b/chrome/browser/gtk/menu_gtk.cc
@@ -73,8 +73,10 @@ GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap) {
} // namespace
MenuGtk::MenuGtk(MenuGtk::Delegate* delegate,
- const MenuCreateMaterial* menu_data)
+ const MenuCreateMaterial* menu_data,
+ GtkAccelGroup* accel_group)
: delegate_(delegate),
+ accel_group_(accel_group),
menu_(gtk_menu_new()) {
g_object_ref_sink(menu_);
BuildMenuIn(menu_, menu_data);
@@ -146,6 +148,18 @@ void MenuGtk::BuildMenuIn(GtkWidget* menu,
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu);
}
+ if (menu_data->accel_key) {
+ // If we ever want to let the user do any key remaping, we'll need to
+ // change the following so we make a gtk_accel_map which keeps the actual
+ // keys.
+ gtk_widget_add_accelerator(menu_item,
+ "activate",
+ accel_group_,
+ menu_data->accel_key,
+ GdkModifierType(menu_data->accel_modifiers),
+ GTK_ACCEL_VISIBLE);
+ }
+
g_object_set_data(G_OBJECT(menu_item), "menu-data",
const_cast<MenuCreateMaterial*>(menu_data));