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.cc34
1 files changed, 20 insertions, 14 deletions
diff --git a/chrome/browser/gtk/menu_gtk.cc b/chrome/browser/gtk/menu_gtk.cc
index 6d12f26..b6df673 100644
--- a/chrome/browser/gtk/menu_gtk.cc
+++ b/chrome/browser/gtk/menu_gtk.cc
@@ -342,26 +342,32 @@ void MenuGtk::MenuPositionFunc(GtkMenu* menu,
// static
void MenuGtk::SetMenuItemInfo(GtkWidget* widget, gpointer userdata) {
MenuGtk* menu = reinterpret_cast<MenuGtk*>(userdata);
+ int id;
+
const MenuCreateMaterial* data =
reinterpret_cast<const MenuCreateMaterial*>(
g_object_get_data(G_OBJECT(widget), "menu-data"));
-
if (data) {
- if (GTK_IS_CHECK_MENU_ITEM(widget)) {
- GtkCheckMenuItem* item = GTK_CHECK_MENU_ITEM(widget);
- gtk_check_menu_item_set_active(
- item, menu->delegate_->IsItemChecked(data->id));
- }
+ id = data->id;
+ } else {
+ id = reinterpret_cast<int>(
+ g_object_get_data(G_OBJECT(widget), "menu-id"));
+ }
+
+ if (GTK_IS_CHECK_MENU_ITEM(widget)) {
+ GtkCheckMenuItem* item = GTK_CHECK_MENU_ITEM(widget);
+ gtk_check_menu_item_set_active(
+ item, menu->delegate_->IsItemChecked(id));
+ }
- if (GTK_IS_MENU_ITEM(widget)) {
- gtk_widget_set_sensitive(
- widget, menu->delegate_->IsCommandEnabled(data->id));
+ if (GTK_IS_MENU_ITEM(widget)) {
+ gtk_widget_set_sensitive(
+ widget, menu->delegate_->IsCommandEnabled(id));
- GtkWidget* submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget));
- if (submenu) {
- gtk_container_foreach(GTK_CONTAINER(submenu), &SetMenuItemInfo,
- userdata);
- }
+ GtkWidget* submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget));
+ if (submenu) {
+ gtk_container_foreach(GTK_CONTAINER(submenu), &SetMenuItemInfo,
+ userdata);
}
}
}