Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Unified Diff: chrome/browser/gtk/menu_gtk.cc

Issue 3143046: The "Update Chrome" menu item should appear in addition to the About menu. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: estade fixes -> final try Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/menu_gtk.h ('k') | chrome/browser/wrench_menu_model.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/menu_gtk.cc
diff --git a/chrome/browser/gtk/menu_gtk.cc b/chrome/browser/gtk/menu_gtk.cc
index 80c20c461ae406f6a7f29d77aba671f3dcf5a1f8..129623e9fcf23f3f8d55ba630b31262ea93a589c 100644
--- a/chrome/browser/gtk/menu_gtk.cc
+++ b/chrome/browser/gtk/menu_gtk.cc
@@ -214,22 +214,31 @@ GtkWidget* MenuGtk::AppendSeparator() {
}
GtkWidget* MenuGtk::AppendMenuItem(int command_id, GtkWidget* menu_item) {
- return AppendMenuItemToMenu(command_id, menu_item, menu_, true);
+ return AppendMenuItemToMenu(command_id, NULL, menu_item, menu_, true);
}
-GtkWidget* MenuGtk::AppendMenuItemToMenu(int command_id,
+GtkWidget* MenuGtk::AppendMenuItemToMenu(int index,
+ menus::MenuModel* model,
GtkWidget* menu_item,
GtkWidget* menu,
bool connect_to_activate) {
// Native menu items do their own thing, so only selectively listen for the
// activate signal.
if (connect_to_activate) {
- SetMenuItemID(menu_item, command_id);
+ SetMenuItemID(menu_item, index);
g_signal_connect(menu_item, "activate",
G_CALLBACK(OnMenuItemActivated), this);
}
- gtk_widget_show(menu_item);
+ // AppendMenuItemToMenu is used both internally when we control menu creation
+ // from a model (where the model can choose to hide certain menu items), and
+ // with immediate commands which don't provide the option.
+ if (model) {
+ if (model->IsVisibleAt(index))
+ gtk_widget_show(menu_item);
+ } else {
+ gtk_widget_show(menu_item);
+ }
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
return menu_item;
}
@@ -361,7 +370,7 @@ void MenuGtk::BuildSubmenuFromModel(menus::MenuModel* model, GtkWidget* menu) {
}
g_object_set_data(G_OBJECT(menu_item), "model", model);
- AppendMenuItemToMenu(i, menu_item, menu, connect_to_activate);
+ AppendMenuItemToMenu(i, model, menu_item, menu, connect_to_activate);
if (model->IsLabelDynamicAt(i)) {
g_signal_connect(menu, "show", G_CALLBACK(OnSubmenuShow),
@@ -603,6 +612,11 @@ void MenuGtk::SetMenuItemInfo(GtkWidget* widget, gpointer userdata) {
if (GTK_IS_MENU_ITEM(widget)) {
gtk_widget_set_sensitive(widget, model->IsEnabledAt(id));
+ if (model->IsVisibleAt(id))
+ gtk_widget_show(widget);
+ else
+ gtk_widget_hide(widget);
+
GtkWidget* submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget));
if (submenu) {
gtk_container_foreach(GTK_CONTAINER(submenu), &SetMenuItemInfo,
« no previous file with comments | « chrome/browser/gtk/menu_gtk.h ('k') | chrome/browser/wrench_menu_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698