GNOME Bugzilla – Bug 665822
Extension icons are not displayed in context menu
Last modified: 2011-12-19 10:48:13 UTC
Noticed against Nautilus 3.2.1 (Fedora 16) The icons brought up by the extensions to the context menus are not displayed, whether they are addressed by name or by path.
It happens that nautilus stores a GdkPixbuf as a "menu-icon" pseudo-property (don't know how to call that) of the GtkAction (see src/nautilus-view.c). But this "menu-icon" pixbuf is never used to draw the image in a menu item. One can also notice that this same "menu-icon" pseudo-property is used to store a GIcon, which is later used to draw the image in a menu item (see src/nautilus-window-bookmarks.c). I think the better fix would be to directly used the actual "gicon" property of the GtkAction in src/nautilus-view.c, and I propose the joined patch. Regards Pierre
Created attachment 203123 [details] [review] Use the "gicon" property of the GtkAction
Review of attachment 203123 [details] [review]: ::: libnautilus-private/nautilus-icon-info.c @@ +502,3 @@ + + icon_file = g_file_new_for_path (path); + icon = g_file_icon_new (icon_file); I don't see the point of these functions here; can't you just use the GIcon you create instead of going through NautilusIconInfo just to destroy it and get the GIcon again? ::: src/nautilus-view.c @@ -4725,2 @@ if (icon != NULL) { - pixbuf = get_menu_icon (icon); Hmm, GdkPixbuf implements GIcon, so can't you just get away with calling gtk_action_set_gicon(action, pixbuf) here?
Hi Cosimo, Thanks for having taken the time to review the patch. I just missed that GdkPixbuf implemented GIcon :( So there is a second proposal in replacement of the first. Regards
Created attachment 203287 [details] [review] Use the "gicon" property of the GtkAction
Review of attachment 203287 [details] [review]: Thanks! Looks good to me for git master, with the following minor coding style fix. ::: libnautilus-private/nautilus-ui-utilities.c @@ +138,3 @@ + pixbuf = nautilus_ui_get_menu_icon (icon_name); + if (pixbuf != NULL) { + gtk_action_set_gicon (action, (GIcon *)pixbuf); (GIcon *) pixbuf -> G_ICON (pixbuf) ::: src/nautilus-view.c @@ +4643,3 @@ if (pixbuf != NULL) { + gtk_action_set_gicon (action, (GIcon *)pixbuf); + g_object_unref (pixbuf); Ditto
Pushed to master to get this in today's 3.3.3 release.