[Xfce4-commits] [xfce/xfce4-panel] 01/01: launcher: Fix custom images
noreply at xfce.org
noreply at xfce.org
Wed Nov 1 11:00:31 CET 2017
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-panel.
commit 6345387b168fd25240b1d025e277fb0ea4c7131e
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Wed Nov 1 11:00:15 2017 +0100
launcher: Fix custom images
---
plugins/launcher/launcher.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index de92ffb..133b303 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -1611,9 +1611,18 @@ launcher_plugin_menu_construct (LauncherPlugin *plugin)
icon_name = garcon_menu_item_get_icon_name (item);
if (!panel_str_is_empty (icon_name))
{
- image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DND);
+ GdkPixbuf *pix = NULL;
+ if (g_path_is_absolute (icon_name))
+ {
+ pix = gdk_pixbuf_new_from_file_at_size (icon_name, 16, 16, NULL);
+ image = gtk_image_new_from_pixbuf (pix);
+ }
+ else
+ image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
gtk_box_pack_start (GTK_BOX (box), image, FALSE, TRUE, 3);
gtk_widget_show (image);
+ if (pix)
+ g_object_unref (G_OBJECT (pix));
}
}
}
@@ -1739,9 +1748,19 @@ launcher_plugin_button_update (LauncherPlugin *plugin)
icon_name = garcon_menu_item_get_icon_name (item);
- gtk_image_set_from_icon_name (GTK_IMAGE (plugin->child),
- panel_str_is_empty (icon_name) ? "image-missing" : icon_name,
- icon_size);
+ if (!panel_str_is_empty (icon_name))
+ {
+ if (g_path_is_absolute (icon_name)) {
+ GdkPixbuf *pix = NULL;
+
+ pix = gdk_pixbuf_new_from_file_at_size (icon_name, icon_size, icon_size, NULL);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (plugin->child), pix);
+ g_object_unref (G_OBJECT (pix));
+ }
+ else
+ gtk_image_set_from_icon_name (GTK_IMAGE (plugin->child), icon_name,
+ icon_size);
+ }
panel_utils_set_atk_info (plugin->button,
garcon_menu_item_get_name (item),
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list