[Xfce4-commits] [apps/xfce4-notifyd] 01/01: Improve application icon name matching

noreply at xfce.org noreply at xfce.org
Thu Oct 5 00:44:46 CEST 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 apps/xfce4-notifyd.

commit c42998daefe6f926a67b7f2e816b08891f02dd55
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Thu Oct 5 00:43:51 2017 +0200

    Improve application icon name matching
    
    Before the fallbacks of gtk_icon_theme_lookup_icon weren't actually
    used.
---
 xfce4-notifyd-config/main.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/xfce4-notifyd-config/main.c b/xfce4-notifyd-config/main.c
index 7ab3d8f..3e41060 100644
--- a/xfce4-notifyd-config/main.c
+++ b/xfce4-notifyd-config/main.c
@@ -401,22 +401,31 @@ xfce4_notifyd_known_applications_changed (XfconfChannel *channel,
 
     if (known_applications != NULL) {
         for (i = 0; i < known_applications->len; i++) {
+            GtkIconInfo *icon_info;
+
             known_application = g_ptr_array_index (known_applications, i);
             hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
             label = gtk_label_new (g_value_get_string (known_application));
             icon_name = g_value_get_string (known_application);
-            if (gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default(), icon_name, 16, GTK_ICON_LOOKUP_GENERIC_FALLBACK))
-                icon = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
+            icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default(), icon_name, 16, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+            if (icon_info) {
+                GdkPixbuf *pix = NULL;
+
+                pix = gtk_icon_info_load_icon (icon_info, NULL);
+                icon = gtk_image_new_from_pixbuf (pix);
+                if (pix)
+                    g_object_unref (G_OBJECT (pix));
+            }
             else {
                 gchar *icon_name_new = g_ascii_strdown (icon_name, -1);
                 if (gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default(), icon_name_new, 16, GTK_ICON_LOOKUP_GENERIC_FALLBACK))
                     icon = gtk_image_new_from_icon_name (icon_name_new, GTK_ICON_SIZE_MENU);
                 else {
                     icon = gtk_image_new ();
-                    gtk_image_set_pixel_size (GTK_IMAGE (icon), 16);
                 }
                 g_free (icon_name_new);
             }
+            gtk_image_set_pixel_size (GTK_IMAGE (icon), 16);
 
 #if GTK_CHECK_VERSION (3, 16, 0)
             gtk_label_set_xalign (GTK_LABEL (label), 0);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list