Skip to content
Snippets Groups Projects
Commit 37f858db authored by atwilson@chromium.org's avatar atwilson@chromium.org
Browse files

Update menu icons for dynamic items when we update the label.

BUG=66508
TEST=enable background mode, see wrench menu badge toggle when extensions load

Review URL: http://codereview.chromium.org/6014009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70228 0039d316-1c4b-4281-b951-d872f2087c98
parent 6dbd362e
No related merge requests found
......@@ -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());
#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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment