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

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

Issue 6014009: Update menu icons for dynamic items when we update the label. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed broken handling of case with no initial icon. Created 10 years 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 | « no previous file | no next file » | 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 04450efdcd3dd8be63a96dcdc9490d90ac10087a..52b9c12ba1f2a2fcffa4077beee9de8a01ba2d0b 100644
--- a/chrome/browser/gtk/menu_gtk.cc
+++ b/chrome/browser/gtk/menu_gtk.cc
@@ -803,7 +803,6 @@ void MenuGtk::SetMenuItemInfo(GtkWidget* widget, gpointer userdata) {
if (model->IsVisibleAt(id)) {
// Update the menu item label if it is dynamic.
- // TODO(atwilson): Update the icon as well (http://crbug.com/66508).
if (model->IsItemDynamicAt(id)) {
std::string label =
gfx::ConvertAcceleratorsFromWindowsStyle(
@@ -814,6 +813,17 @@ void MenuGtk::SetMenuItemInfo(GtkWidget* widget, gpointer userdata) {
#else
gtk_label_set_label(GTK_LABEL(GTK_BIN(widget)->child), label.c_str());
Evan Stade 2010/12/23 02:36:43 side note. I wonder if this actually works for Gt
#endif
+ if (GTK_IS_IMAGE_MENU_ITEM(widget)) {
+ SkBitmap icon;
+ if (model->GetIconAt(id, &icon)) {
+ GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&icon);
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(widget),
+ gtk_image_new_from_pixbuf(pixbuf));
+ g_object_unref(pixbuf);
+ } else {
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(widget), NULL);
+ }
+ }
}
gtk_widget_show(widget);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698