| 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 "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 for (int i = 0; commands[i].str_id != MENU_END; ++i) { | 238 for (int i = 0; commands[i].str_id != MENU_END; ++i) { |
| 239 GtkWidget* menu_item = BuildMenuItem( | 239 GtkWidget* menu_item = BuildMenuItem( |
| 240 commands[i].str_id, commands[i].command, commands[i].tag, | 240 commands[i].str_id, commands[i].command, commands[i].tag, |
| 241 id_to_menu_item, menu); | 241 id_to_menu_item, menu); |
| 242 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); | 242 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); |
| 243 } | 243 } |
| 244 | 244 |
| 245 gtk_widget_show(menu); | 245 gtk_widget_show(menu); |
| 246 | 246 |
| 247 GtkWidget* menu_item = gtk_menu_item_new_with_mnemonic( | 247 GtkWidget* menu_item = gtk_menu_item_new_with_mnemonic( |
| 248 gfx::ConvertAcceleratorsFromWindowsStyle( | 248 gfx::RemoveWindowsStyleAccelerators( |
| 249 l10n_util::GetStringUTF8(menu_str_id)).c_str()); | 249 l10n_util::GetStringUTF8(menu_str_id)).c_str()); |
| 250 | 250 |
| 251 // Give the owner a chance to sink the reference before we add it to the menu | 251 // Give the owner a chance to sink the reference before we add it to the menu |
| 252 // bar. | 252 // bar. |
| 253 if (owner) | 253 if (owner) |
| 254 owner->Init(menu, menu_item); | 254 owner->Init(menu, menu_item); |
| 255 | 255 |
| 256 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu); | 256 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu); |
| 257 gtk_widget_show(menu_item); | 257 gtk_widget_show(menu_item); |
| 258 gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar_.get()), menu_item); | 258 gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar_.get()), menu_item); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 | 322 |
| 323 void GlobalMenuBar::OnItemActivated(GtkWidget* sender) { | 323 void GlobalMenuBar::OnItemActivated(GtkWidget* sender) { |
| 324 if (block_activation_) | 324 if (block_activation_) |
| 325 return; | 325 return; |
| 326 | 326 |
| 327 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(sender), "command-id")); | 327 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(sender), "command-id")); |
| 328 browser_->ExecuteCommandIfEnabled(id); | 328 browser_->ExecuteCommandIfEnabled(id); |
| 329 } | 329 } |
| OLD | NEW |