From 1e465e817ab0d5d7ce776dfbd5e544e5d5aca22a Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Thu, 2 Apr 2009 19:20:38 +0000 Subject: Don't allow hotkeys to activate un-activatable menu items on linux. BUG=9400 Review URL: http://codereview.chromium.org/56184 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13025 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/menu_gtk.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chrome/browser/gtk/menu_gtk.cc b/chrome/browser/gtk/menu_gtk.cc index 47a89f9..dac60ab 100644 --- a/chrome/browser/gtk/menu_gtk.cc +++ b/chrome/browser/gtk/menu_gtk.cc @@ -190,7 +190,9 @@ void MenuGtk::OnMenuItemActivated(GtkMenuItem* menuitem, MenuGtk* menu) { const MenuCreateMaterial* data = reinterpret_cast( g_object_get_data(G_OBJECT(menuitem), "menu-data")); - menu->delegate_->ExecuteCommand(data->id); + // The menu item can still be activated by hotkeys even if it is disabled. + if (menu->delegate_->IsCommandEnabled(data->id)) + menu->delegate_->ExecuteCommand(data->id); } } @@ -201,7 +203,9 @@ void MenuGtk::OnMenuItemActivatedById(GtkMenuItem* menuitem, MenuGtk* menu) { if (!gtk_menu_item_get_submenu(menuitem)) { int id = reinterpret_cast( g_object_get_data(G_OBJECT(menuitem), "menu-id")); - menu->delegate_->ExecuteCommand(id); + // The menu item can still be activated by hotkeys even if it is disabled. + if (menu->delegate_->IsCommandEnabled(id)) + menu->delegate_->ExecuteCommand(id); } } -- cgit v1.1