| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/gtk/global_menu_bar.h" | 5 #include "chrome/browser/ui/gtk/global_menu_bar.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/gtk/accelerators_gtk.h" | 13 #include "chrome/browser/ui/gtk/accelerators_gtk.h" |
| 14 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 15 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 14 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 15 #include "content/common/notification_service.h" | 17 #include "content/common/notification_service.h" |
| 16 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 18 #include "ui/gfx/gtk_util.h" | 20 #include "ui/gfx/gtk_util.h" |
| 19 | 21 |
| 20 struct GlobalMenuBarCommand { | 22 struct GlobalMenuBarCommand { |
| 21 int str_id; | 23 int str_id; |
| 22 int command; | 24 int command; |
| 25 int tag; |
| 23 }; | 26 }; |
| 24 | 27 |
| 25 namespace { | 28 namespace { |
| 26 | 29 |
| 27 const int MENU_SEPARATOR =-1; | 30 const int MENU_SEPARATOR =-1; |
| 28 const int MENU_END = -2; | 31 const int MENU_END = -2; |
| 32 const int MENU_DISABLED_LABEL = -3; |
| 29 | 33 |
| 30 GlobalMenuBarCommand file_menu[] = { | 34 GlobalMenuBarCommand file_menu[] = { |
| 31 { IDS_NEW_TAB, IDC_NEW_TAB }, | 35 { IDS_NEW_TAB, IDC_NEW_TAB }, |
| 32 { IDS_NEW_WINDOW, IDC_NEW_WINDOW }, | 36 { IDS_NEW_WINDOW, IDC_NEW_WINDOW }, |
| 33 { IDS_NEW_INCOGNITO_WINDOW, IDC_NEW_INCOGNITO_WINDOW }, | 37 { IDS_NEW_INCOGNITO_WINDOW, IDC_NEW_INCOGNITO_WINDOW }, |
| 34 { IDS_REOPEN_CLOSED_TABS_LINUX, IDC_RESTORE_TAB }, | 38 { IDS_REOPEN_CLOSED_TABS_LINUX, IDC_RESTORE_TAB }, |
| 35 { IDS_OPEN_FILE_LINUX, IDC_OPEN_FILE }, | 39 { IDS_OPEN_FILE_LINUX, IDC_OPEN_FILE }, |
| 36 { IDS_OPEN_LOCATION_LINUX, IDC_FOCUS_LOCATION }, | 40 { IDS_OPEN_LOCATION_LINUX, IDC_FOCUS_LOCATION }, |
| 37 | 41 |
| 38 { MENU_SEPARATOR, MENU_SEPARATOR }, | 42 { MENU_SEPARATOR, MENU_SEPARATOR }, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 { MENU_SEPARATOR, MENU_SEPARATOR }, | 96 { MENU_SEPARATOR, MENU_SEPARATOR }, |
| 93 | 97 |
| 94 { IDS_FULLSCREEN, IDC_FULLSCREEN }, | 98 { IDS_FULLSCREEN, IDC_FULLSCREEN }, |
| 95 { IDS_TEXT_DEFAULT_LINUX, IDC_ZOOM_NORMAL }, | 99 { IDS_TEXT_DEFAULT_LINUX, IDC_ZOOM_NORMAL }, |
| 96 { IDS_TEXT_BIGGER_LINUX, IDC_ZOOM_PLUS }, | 100 { IDS_TEXT_BIGGER_LINUX, IDC_ZOOM_PLUS }, |
| 97 { IDS_TEXT_SMALLER_LINUX, IDC_ZOOM_MINUS }, | 101 { IDS_TEXT_SMALLER_LINUX, IDC_ZOOM_MINUS }, |
| 98 | 102 |
| 99 { MENU_END, MENU_END } | 103 { MENU_END, MENU_END } |
| 100 }; | 104 }; |
| 101 | 105 |
| 106 GlobalMenuBarCommand history_menu[] = { |
| 107 { IDS_HISTORY_HOME_LINUX, IDC_HOME }, |
| 108 { IDS_HISTORY_BACK_LINUX, IDC_BACK }, |
| 109 { IDS_HISTORY_FORWARD_LINUX, IDC_FORWARD }, |
| 110 |
| 111 { MENU_SEPARATOR, MENU_SEPARATOR }, |
| 112 |
| 113 { IDS_HISTORY_VISITED_LINUX, MENU_DISABLED_LABEL, |
| 114 GlobalMenuBar::TAG_MOST_VISITED_HEADER }, |
| 115 |
| 116 { MENU_SEPARATOR, MENU_SEPARATOR }, |
| 117 |
| 118 { IDS_HISTORY_CLOSED_LINUX, MENU_DISABLED_LABEL, |
| 119 GlobalMenuBar::TAG_RECENTLY_CLOSED_HEADER }, |
| 120 |
| 121 { MENU_SEPARATOR, MENU_SEPARATOR }, |
| 122 |
| 123 { IDS_SHOWFULLHISTORY_LINK, IDC_SHOW_HISTORY }, |
| 124 |
| 125 { MENU_END, MENU_END } |
| 126 }; |
| 127 |
| 128 GlobalMenuBarCommand bookmark_menu[] = { |
| 129 { IDS_BOOKMARK_MANAGER, IDC_SHOW_BOOKMARK_MANAGER }, |
| 130 { IDS_BOOKMARK_CURRENT_PAGE_LINUX, IDC_BOOKMARK_PAGE }, |
| 131 { IDS_BOOKMARK_ALL_TABS_LINUX, IDC_BOOKMARK_ALL_TABS }, |
| 132 |
| 133 { MENU_SEPARATOR, MENU_SEPARATOR }, |
| 134 // TODO(erg): Real implementation of bookmark bar bookmarks! |
| 135 { MENU_SEPARATOR, MENU_SEPARATOR }, |
| 136 |
| 137 { IDS_BOOMARK_BAR_OPEN_ALL, IDC_BOOKMARK_BAR_OPEN_ALL }, |
| 138 { IDS_BOOMARK_BAR_OPEN_ALL_NEW_WINDOW, IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW }, |
| 139 { IDS_BOOMARK_BAR_OPEN_ALL_INCOGNITO, IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO }, |
| 140 |
| 141 { MENU_SEPARATOR, MENU_SEPARATOR }, |
| 142 // TODO(erg): "Other bookmarks" bookmarks |
| 143 |
| 144 { MENU_END, MENU_END } |
| 145 }; |
| 146 |
| 102 GlobalMenuBarCommand tools_menu[] = { | 147 GlobalMenuBarCommand tools_menu[] = { |
| 103 { IDS_SHOW_DOWNLOADS, IDC_SHOW_DOWNLOADS }, | 148 { IDS_SHOW_DOWNLOADS, IDC_SHOW_DOWNLOADS }, |
| 104 { IDS_SHOW_HISTORY, IDC_SHOW_HISTORY }, | 149 { IDS_SHOW_HISTORY, IDC_SHOW_HISTORY }, |
| 105 { IDS_SHOW_EXTENSIONS, IDC_MANAGE_EXTENSIONS }, | 150 { IDS_SHOW_EXTENSIONS, IDC_MANAGE_EXTENSIONS }, |
| 106 | 151 |
| 107 { MENU_SEPARATOR, MENU_SEPARATOR }, | 152 { MENU_SEPARATOR, MENU_SEPARATOR }, |
| 108 | 153 |
| 109 { IDS_TASK_MANAGER, IDC_TASK_MANAGER }, | 154 { IDS_TASK_MANAGER, IDC_TASK_MANAGER }, |
| 110 { IDS_CLEAR_BROWSING_DATA, IDC_CLEAR_BROWSING_DATA }, | 155 { IDS_CLEAR_BROWSING_DATA, IDC_CLEAR_BROWSING_DATA }, |
| 111 | 156 |
| 112 { MENU_SEPARATOR, MENU_SEPARATOR }, | 157 { MENU_SEPARATOR, MENU_SEPARATOR }, |
| 113 | 158 |
| 114 { IDS_VIEW_SOURCE, IDC_VIEW_SOURCE }, | 159 { IDS_VIEW_SOURCE, IDC_VIEW_SOURCE }, |
| 115 { IDS_DEV_TOOLS, IDC_DEV_TOOLS }, | 160 { IDS_DEV_TOOLS, IDC_DEV_TOOLS }, |
| 116 { IDS_DEV_TOOLS_CONSOLE, IDC_DEV_TOOLS_CONSOLE }, | 161 { IDS_DEV_TOOLS_CONSOLE, IDC_DEV_TOOLS_CONSOLE }, |
| 117 | 162 |
| 118 { MENU_END, MENU_END } | 163 { MENU_END, MENU_END } |
| 119 }; | 164 }; |
| 120 | 165 |
| 121 GlobalMenuBarCommand help_menu[] = { | 166 GlobalMenuBarCommand help_menu[] = { |
| 122 { IDS_FEEDBACK, IDC_FEEDBACK }, | 167 { IDS_FEEDBACK, IDC_FEEDBACK }, |
| 123 { IDS_HELP_PAGE , IDC_HELP_PAGE }, | 168 { IDS_HELP_PAGE , IDC_HELP_PAGE }, |
| 124 { MENU_END, MENU_END } | 169 { MENU_END, MENU_END } |
| 125 }; | 170 }; |
| 126 | 171 |
| 127 } // namespace | 172 } // namespace |
| 128 | 173 |
| 129 GlobalMenuBar::GlobalMenuBar(Browser* browser, | 174 GlobalMenuBar::GlobalMenuBar(Browser* browser) |
| 130 BrowserWindowGtk* window) | |
| 131 : browser_(browser), | 175 : browser_(browser), |
| 132 browser_window_(window), | 176 profile_(browser_->profile()), |
| 133 menu_bar_(gtk_menu_bar_new()), | 177 menu_bar_(gtk_menu_bar_new()), |
| 178 history_menu_(browser_), |
| 134 dummy_accel_group_(gtk_accel_group_new()), | 179 dummy_accel_group_(gtk_accel_group_new()), |
| 135 block_activation_(false) { | 180 block_activation_(false) { |
| 136 // The global menu bar should never actually be shown in the app; it should | 181 // The global menu bar should never actually be shown in the app; it should |
| 137 // instead remain in our widget hierarchy simply to be noticed by third party | 182 // instead remain in our widget hierarchy simply to be noticed by third party |
| 138 // components. | 183 // components. |
| 139 gtk_widget_set_no_show_all(menu_bar_, TRUE); | 184 gtk_widget_set_no_show_all(menu_bar_.get(), TRUE); |
| 140 | 185 |
| 141 // Set a nice name so it shows up in gtkparasite and others. | 186 // Set a nice name so it shows up in gtkparasite and others. |
| 142 gtk_widget_set_name(menu_bar_, "chrome-hidden-global-menubar"); | 187 gtk_widget_set_name(menu_bar_.get(), "chrome-hidden-global-menubar"); |
| 143 | 188 |
| 144 BuildGtkMenuFrom(IDS_FILE_MENU_LINUX, &id_to_menu_item_, file_menu); | 189 BuildGtkMenuFrom(IDS_FILE_MENU_LINUX, &id_to_menu_item_, file_menu); |
| 145 BuildGtkMenuFrom(IDS_EDIT_MENU_LINUX, &id_to_menu_item_, edit_menu); | 190 BuildGtkMenuFrom(IDS_EDIT_MENU_LINUX, &id_to_menu_item_, edit_menu); |
| 146 BuildGtkMenuFrom(IDS_VIEW_MENU_LINUX, &id_to_menu_item_, view_menu); | 191 BuildGtkMenuFrom(IDS_VIEW_MENU_LINUX, &id_to_menu_item_, view_menu); |
| 192 history_menu_.Init(BuildGtkMenuFrom(IDS_HISTORY_MENU_LINUX, &id_to_menu_item_, |
| 193 history_menu)); |
| 194 BuildGtkMenuFrom(IDS_BOOKMARKS_MENU_LINUX, &id_to_menu_item_, bookmark_menu); |
| 147 BuildGtkMenuFrom(IDS_TOOLS_MENU_LINUX, &id_to_menu_item_, tools_menu); | 195 BuildGtkMenuFrom(IDS_TOOLS_MENU_LINUX, &id_to_menu_item_, tools_menu); |
| 148 BuildGtkMenuFrom(IDS_HELP_MENU_LINUX, &id_to_menu_item_, help_menu); | 196 BuildGtkMenuFrom(IDS_HELP_MENU_LINUX, &id_to_menu_item_, help_menu); |
| 149 | 197 |
| 150 for (IDMenuItemMap::const_iterator it = id_to_menu_item_.begin(); | 198 for (CommandIDMenuItemMap::const_iterator it = id_to_menu_item_.begin(); |
| 151 it != id_to_menu_item_.end(); ++it) { | 199 it != id_to_menu_item_.end(); ++it) { |
| 152 // Get the starting enabled state. | 200 // Get the starting enabled state. |
| 153 gtk_widget_set_sensitive( | 201 gtk_widget_set_sensitive( |
| 154 it->second, | 202 it->second, |
| 155 browser_->command_updater()->IsCommandEnabled(it->first)); | 203 browser_->command_updater()->IsCommandEnabled(it->first)); |
| 156 | 204 |
| 157 // Set the accelerator for each menu item. | 205 // Set the accelerator for each menu item. |
| 158 const ui::AcceleratorGtk* accelerator_gtk = | 206 const ui::AcceleratorGtk* accelerator_gtk = |
| 159 AcceleratorsGtk::GetInstance()->GetPrimaryAcceleratorForCommand( | 207 AcceleratorsGtk::GetInstance()->GetPrimaryAcceleratorForCommand( |
| 160 it->first); | 208 it->first); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 172 | 220 |
| 173 // Listen for bookmark bar visibility changes and set the initial state. | 221 // Listen for bookmark bar visibility changes and set the initial state. |
| 174 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, | 222 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, |
| 175 NotificationService::AllSources()); | 223 NotificationService::AllSources()); |
| 176 Observe(NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, | 224 Observe(NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, |
| 177 NotificationService::AllSources(), | 225 NotificationService::AllSources(), |
| 178 NotificationService::NoDetails()); | 226 NotificationService::NoDetails()); |
| 179 } | 227 } |
| 180 | 228 |
| 181 GlobalMenuBar::~GlobalMenuBar() { | 229 GlobalMenuBar::~GlobalMenuBar() { |
| 182 for (IDMenuItemMap::const_iterator it = id_to_menu_item_.begin(); | 230 for (CommandIDMenuItemMap::const_iterator it = id_to_menu_item_.begin(); |
| 183 it != id_to_menu_item_.end(); ++it) { | 231 it != id_to_menu_item_.end(); ++it) { |
| 184 browser_->command_updater()->RemoveCommandObserver(it->first, this); | 232 browser_->command_updater()->RemoveCommandObserver(it->first, this); |
| 185 } | 233 } |
| 186 | 234 |
| 187 g_object_unref(dummy_accel_group_); | 235 g_object_unref(dummy_accel_group_); |
| 188 } | 236 } |
| 189 | 237 |
| 190 void GlobalMenuBar::BuildGtkMenuFrom(int menu_str_id, | 238 GtkWidget* GlobalMenuBar::BuildGtkMenuFrom( |
| 191 std::map<int, GtkWidget*>* id_to_menu_item, | 239 int menu_str_id, |
| 192 GlobalMenuBarCommand* commands) { | 240 std::map<int, GtkWidget*>* id_to_menu_item, |
| 241 GlobalMenuBarCommand* commands) { |
| 193 GtkWidget* menu = gtk_menu_new(); | 242 GtkWidget* menu = gtk_menu_new(); |
| 194 for (int i = 0; commands[i].str_id != MENU_END; ++i) { | 243 for (int i = 0; commands[i].str_id != MENU_END; ++i) { |
| 195 GtkWidget* menu_item = NULL; | 244 GtkWidget* menu_item = BuildMenuItem( |
| 196 if (commands[i].str_id == MENU_SEPARATOR) { | 245 commands[i].str_id, commands[i].command, commands[i].tag, |
| 197 menu_item = gtk_separator_menu_item_new(); | 246 id_to_menu_item, menu); |
| 198 } else { | |
| 199 int command_id = commands[i].command; | |
| 200 std::string label = | |
| 201 gfx::ConvertAcceleratorsFromWindowsStyle( | |
| 202 l10n_util::GetStringUTF8(commands[i].str_id)); | |
| 203 | |
| 204 if (command_id == IDC_SHOW_BOOKMARK_BAR) | |
| 205 menu_item = gtk_check_menu_item_new_with_mnemonic(label.c_str()); | |
| 206 else | |
| 207 menu_item = gtk_menu_item_new_with_mnemonic(label.c_str()); | |
| 208 | |
| 209 id_to_menu_item->insert(std::make_pair(command_id, menu_item)); | |
| 210 g_object_set_data(G_OBJECT(menu_item), "command-id", | |
| 211 GINT_TO_POINTER(command_id)); | |
| 212 g_signal_connect(menu_item, "activate", | |
| 213 G_CALLBACK(OnItemActivatedThunk), this); | |
| 214 } | |
| 215 gtk_widget_show(menu_item); | |
| 216 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); | 247 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); |
| 217 } | 248 } |
| 218 | 249 |
| 219 gtk_widget_show(menu); | 250 gtk_widget_show(menu); |
| 220 | 251 |
| 221 GtkWidget* menu_item = gtk_menu_item_new_with_mnemonic( | 252 GtkWidget* menu_item = gtk_menu_item_new_with_mnemonic( |
| 222 gfx::ConvertAcceleratorsFromWindowsStyle( | 253 gfx::ConvertAcceleratorsFromWindowsStyle( |
| 223 l10n_util::GetStringUTF8(menu_str_id)).c_str()); | 254 l10n_util::GetStringUTF8(menu_str_id)).c_str()); |
| 224 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu); | 255 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu); |
| 225 gtk_widget_show(menu_item); | 256 gtk_widget_show(menu_item); |
| 257 gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar_.get()), menu_item); |
| 226 | 258 |
| 227 gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar_), menu_item); | 259 return menu; |
| 260 } |
| 261 |
| 262 GtkWidget* GlobalMenuBar::BuildMenuItem( |
| 263 int string_id, |
| 264 int command_id, |
| 265 int tag_id, |
| 266 std::map<int, GtkWidget*>* id_to_menu_item, |
| 267 GtkWidget* menu_to_add_to) { |
| 268 GtkWidget* menu_item = NULL; |
| 269 if (string_id == MENU_SEPARATOR) { |
| 270 menu_item = gtk_separator_menu_item_new(); |
| 271 } else { |
| 272 std::string label = |
| 273 gfx::ConvertAcceleratorsFromWindowsStyle( |
| 274 l10n_util::GetStringUTF8(string_id)); |
| 275 |
| 276 if (command_id == IDC_SHOW_BOOKMARK_BAR) |
| 277 menu_item = gtk_check_menu_item_new_with_mnemonic(label.c_str()); |
| 278 else |
| 279 menu_item = gtk_menu_item_new_with_mnemonic(label.c_str()); |
| 280 |
| 281 if (tag_id) { |
| 282 g_object_set_data(G_OBJECT(menu_item), "type-tag", |
| 283 GINT_TO_POINTER(tag_id)); |
| 284 } |
| 285 |
| 286 if (command_id == MENU_DISABLED_LABEL) { |
| 287 gtk_widget_set_sensitive(menu_item, FALSE); |
| 288 } else { |
| 289 id_to_menu_item->insert(std::make_pair(command_id, menu_item)); |
| 290 g_object_set_data(G_OBJECT(menu_item), "command-id", |
| 291 GINT_TO_POINTER(command_id)); |
| 292 g_signal_connect(menu_item, "activate", |
| 293 G_CALLBACK(OnItemActivatedThunk), this); |
| 294 } |
| 295 } |
| 296 gtk_widget_show(menu_item); |
| 297 return menu_item; |
| 228 } | 298 } |
| 229 | 299 |
| 230 void GlobalMenuBar::EnabledStateChangedForCommand(int id, bool enabled) { | 300 void GlobalMenuBar::EnabledStateChangedForCommand(int id, bool enabled) { |
| 231 IDMenuItemMap::iterator it = id_to_menu_item_.find(id); | 301 CommandIDMenuItemMap::iterator it = id_to_menu_item_.find(id); |
| 232 if (it != id_to_menu_item_.end()) | 302 if (it != id_to_menu_item_.end()) |
| 233 gtk_widget_set_sensitive(it->second, enabled); | 303 gtk_widget_set_sensitive(it->second, enabled); |
| 234 } | 304 } |
| 235 | 305 |
| 236 void GlobalMenuBar::Observe(NotificationType type, | 306 void GlobalMenuBar::Observe(NotificationType type, |
| 237 const NotificationSource& source, | 307 const NotificationSource& source, |
| 238 const NotificationDetails& details) { | 308 const NotificationDetails& details) { |
| 239 DCHECK(type.value == NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED); | 309 DCHECK(type.value == NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED); |
| 240 | 310 |
| 241 IDMenuItemMap::iterator it = id_to_menu_item_.find(IDC_SHOW_BOOKMARK_BAR); | 311 CommandIDMenuItemMap::iterator it = |
| 312 id_to_menu_item_.find(IDC_SHOW_BOOKMARK_BAR); |
| 242 if (it != id_to_menu_item_.end()) { | 313 if (it != id_to_menu_item_.end()) { |
| 243 PrefService* prefs = browser_->profile()->GetPrefs(); | 314 PrefService* prefs = browser_->profile()->GetPrefs(); |
| 244 | 315 |
| 245 block_activation_ = true; | 316 block_activation_ = true; |
| 246 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(it->second), | 317 gtk_check_menu_item_set_active( |
| 247 prefs->GetBoolean(prefs::kShowBookmarkBar)); | 318 GTK_CHECK_MENU_ITEM(it->second), |
| 319 prefs->GetBoolean(prefs::kShowBookmarkBar)); |
| 248 block_activation_ = false; | 320 block_activation_ = false; |
| 249 } | 321 } |
| 250 } | 322 } |
| 251 | 323 |
| 252 void GlobalMenuBar::OnItemActivated(GtkWidget* sender) { | 324 void GlobalMenuBar::OnItemActivated(GtkWidget* sender) { |
| 253 if (block_activation_) | 325 if (block_activation_) |
| 254 return; | 326 return; |
| 255 | 327 |
| 256 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(sender), "command-id")); | 328 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(sender), "command-id")); |
| 257 browser_->ExecuteCommandIfEnabled(id); | 329 browser_->ExecuteCommandIfEnabled(id); |
| 258 } | 330 } |
| OLD | NEW |