summaryrefslogtreecommitdiff
path: root/thunarx
diff options
context:
space:
mode:
authorJehan <jehan@girinstud.io>2018-09-18 22:43:35 +0200
committerAlexander Schwinn <alexxcons@xfce.org>2018-09-18 22:43:35 +0200
commit8349a54d998755f51a4e217f7adddb3445af05a8 (patch)
tree872f5bb1ef897daf35ede528f9e27c04d3bd4560 /thunarx
parente2d22a8cd494fb952ea04d5045c6485f4b4e7cea (diff)
downloadthunar-8349a54d998755f51a4e217f7adddb3445af05a8.tar.gz
Right mouse click will not display icons for custom actions.
(Bug #14685) g_icon_to_string() is not meant to return an icon name, it returns a "textual representation of the icon", which is mostly "proprietary to GIcon" (in GIO documentation's own words). In particular the reverse function to get a GIcon back from this representation is g_icon_new_for_string(). The reason why it used to work was because of a special casing (which happens to be the most common case: when you create an icon with a single name); yet even if the most common, relying on special cases is a bad idea. The special case is about to be reinstated in GLib so it will work again as expected, yet only until the next time a widget uses a not special-cased GIcon, for instance if using fallback icons. It is better to really fix the code. Now the menu properly recreates the icon using g_icon_new_for_string(), not assuming what type of icons it was (it could be an icon name, a path, a list of icon names, or whatever else proprietary representation any type of icon may use now or in the future). Also update the doc of thunarx_menu_item_new() to explicitly states that the icon parameter is a textual representation as returned by g_icon_to_string(). In particular this won't break any plug-ins as single icon names and icon paths are proper representations for icons too.
Diffstat (limited to 'thunarx')
-rw-r--r--thunarx/thunarx-menu-item.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/thunarx/thunarx-menu-item.c b/thunarx/thunarx-menu-item.c
index 9f4f608d..d9a518c9 100644
--- a/thunarx/thunarx-menu-item.c
+++ b/thunarx/thunarx-menu-item.c
@@ -145,7 +145,8 @@ thunarx_menu_item_class_init (ThunarxMenuItemClass *klass)
PROP_ICON,
g_param_spec_string ("icon",
"Icon",
- "Name of the icon to display in the menu item",
+ "Textual representation of the icon (as returned "
+ "by g_icon_to_string()) to display in the menu item",
NULL,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
@@ -312,7 +313,9 @@ thunarx_menu_item_finalize (GObject *object)
* @name: identifier for the menu item
* @label: user-visible label of the menu item
* @tooltip: tooltip of the menu item
- * @icon: path or name of the icon to display in the menu item
+ * @icon: textual representation of the icon to display in the menu
+ * item, as returned by g_icon_to_string(). A path or icon name
+ * are valid representations too.
*
* Creates a new menu item that can be added to the toolbar or to a contextual menu.
*