diff options
Diffstat (limited to 'chrome/browser/gtk/menu_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/menu_gtk.cc | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/chrome/browser/gtk/menu_gtk.cc b/chrome/browser/gtk/menu_gtk.cc index b6df673..ca3da0e 100644 --- a/chrome/browser/gtk/menu_gtk.cc +++ b/chrome/browser/gtk/menu_gtk.cc @@ -11,31 +11,6 @@ #include "chrome/common/gtk_util.h" #include "skia/include/SkBitmap.h" -namespace { - -struct SetIconState { - bool found; - const SkBitmap* icon; - int id; -}; - -void SetIconImpl(GtkWidget* widget, void* raw) { - SetIconState* data = reinterpret_cast<SetIconState*>(raw); - int this_id = - reinterpret_cast<int>(g_object_get_data(G_OBJECT(widget), "menu-id")); - - if (this_id == data->id) { - GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(data->icon); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(widget), - gtk_image_new_from_pixbuf(pixbuf)); - g_object_unref(pixbuf); - - data->found = true; - } -} - -} // namespace - MenuGtk::MenuGtk(MenuGtk::Delegate* delegate, const MenuCreateMaterial* menu_data, GtkAccelGroup* accel_group) @@ -54,7 +29,6 @@ MenuGtk::MenuGtk(MenuGtk::Delegate* delegate, bool load) } MenuGtk::~MenuGtk() { - STLDeleteElements(&children_); menu_.Destroy(); if (dummy_accel_group_) g_object_unref(dummy_accel_group_); @@ -73,20 +47,6 @@ void MenuGtk::AppendMenuItemWithIcon(int command_id, AddMenuItemWithId(menu_item, command_id); } -MenuGtk* MenuGtk::AppendSubMenuWithIcon(int command_id, - const std::string& label, - const SkBitmap& icon) { - GtkWidget* menu_item = BuildMenuItemWithImage(label, icon); - - MenuGtk* submenu = new MenuGtk(delegate_, false); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu->menu_.get()); - children_.push_back(submenu); - - AddMenuItemWithId(menu_item, command_id); - - return submenu; -} - void MenuGtk::AppendSeparator() { GtkWidget* menu_item = gtk_separator_menu_item_new(); gtk_widget_show(menu_item); @@ -122,25 +82,6 @@ void MenuGtk::Cancel() { gtk_menu_popdown(GTK_MENU(menu_.get())); } -bool MenuGtk::SetIcon(const SkBitmap& icon, int item_id) { - // First search items in this menu. - SetIconState state; - state.found = false; - state.icon = &icon; - state.id = item_id; - gtk_container_foreach(GTK_CONTAINER(menu_.get()), SetIconImpl, &state); - if (state.found) - return true; - - for (std::vector<MenuGtk*>::iterator it = children_.begin(); - it != children_.end(); ++it) { - if ((*it)->SetIcon(icon, item_id)) - return true; - } - - return false; -} - // static std::string MenuGtk::ConvertAcceleratorsFromWindowsStyle( const std::string& label) { |