After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 665822 - Extension icons are not displayed in context menu
Extension icons are not displayed in context menu
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Views: All
0.x.x [obsolete]
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-12-08 22:24 UTC by Pierre Wieser
Modified: 2011-12-19 10:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use the "gicon" property of the GtkAction (6.28 KB, patch)
2011-12-08 22:36 UTC, Pierre Wieser
needs-work Details | Review
Use the "gicon" property of the GtkAction (3.82 KB, patch)
2011-12-12 19:13 UTC, Pierre Wieser
committed Details | Review

Description Pierre Wieser 2011-12-08 22:24:23 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.
Comment 1 Pierre Wieser 2011-12-08 22:34:20 UTC
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
Comment 2 Pierre Wieser 2011-12-08 22:36:31 UTC
Created attachment 203123 [details] [review]
Use the "gicon" property of the GtkAction
Comment 3 Cosimo Cecchi 2011-12-12 16:59:24 UTC
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?
Comment 4 Pierre Wieser 2011-12-12 19:11:59 UTC
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
Comment 5 Pierre Wieser 2011-12-12 19:13:13 UTC
Created attachment 203287 [details] [review]
Use the "gicon" property of the GtkAction
Comment 6 Cosimo Cecchi 2011-12-14 14:43:44 UTC
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
Comment 7 Cosimo Cecchi 2011-12-19 10:48:13 UTC
Pushed to master to get this in today's 3.3.3 release.