[Xfce4-commits] [apps/xfce4-notifyd] 01/03: Fix priorities of icon handling according to the fd.o spec

noreply at xfce.org noreply at xfce.org
Sun Oct 2 21:57:53 CEST 2016


This is an automated email from the git hooks/post-receive script.

ochosi pushed a commit to branch master
in repository apps/xfce4-notifyd.

commit 01d1a5921edfbb3fefb8c69f43b5390ddb7f90bc
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sun Oct 2 17:02:17 2016 +0200

    Fix priorities of icon handling according to the fd.o spec
    
    This means: image-data > image-path > app_icon
    For more read here: https://developer.gnome.org/notification-spec/#id2776582
---
 xfce4-notifyd/xfce-notify-daemon.c | 74 +++++++++++++++++++-------------------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/xfce4-notifyd/xfce-notify-daemon.c b/xfce4-notifyd/xfce-notify-daemon.c
index a264cd3..3679ec6 100644
--- a/xfce4-notifyd/xfce-notify-daemon.c
+++ b/xfce4-notifyd/xfce-notify-daemon.c
@@ -1113,7 +1113,6 @@ static gboolean notify_notify (XfceNotifyGBus *skeleton,
        && (window = g_tree_lookup(xndaemon->active_notifications,
                                   GUINT_TO_POINTER(replaces_id))))
     {
-        xfce_notify_window_set_icon_name(window, app_icon);
         xfce_notify_window_set_summary(window, summary);
         xfce_notify_window_set_body(window, body);
         xfce_notify_window_set_actions(window, actions, xndaemon->css_provider);
@@ -1153,47 +1152,48 @@ static gboolean notify_notify (XfceNotifyGBus *skeleton,
         g_idle_add(notify_show_window, window);
     }
 
-    if (!app_icon || !*app_icon) {
-        if (image_data) {
-            pix = notify_pixbuf_from_image_data(image_data);
-            if(pix) {
-                xfce_notify_window_set_icon_pixbuf(window, pix);
-                g_object_unref(G_OBJECT(pix));
-            }
-            g_variant_unref(image_data);
-        }
-        else if (image_path) {
-            xfce_notify_window_set_icon_name (window, image_path);
+    if (image_data) {
+        pix = notify_pixbuf_from_image_data(image_data);
+        if(pix) {
+            xfce_notify_window_set_icon_pixbuf(window, pix);
+            g_object_unref(G_OBJECT(pix));
         }
-        else {
-            if(desktop_id) {
-                gchar *resource = g_strdup_printf("applications%c%s.desktop",
-                                                  G_DIR_SEPARATOR,
-                                                  desktop_id);
-                XfceRc *rcfile = xfce_rc_config_open(XFCE_RESOURCE_DATA,
-                                                     resource, TRUE);
-                if(rcfile) {
-                    if(xfce_rc_has_group(rcfile, "Desktop Entry")) {
-                        const gchar *icon_file;
-                        xfce_rc_set_group(rcfile, "Desktop Entry");
-                        icon_file = xfce_rc_read_entry(rcfile, "Icon", NULL);
-                        if(icon_file) {
-                            pix = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
-                                                           icon_file,
-                                                           32,
-                                                           GTK_ICON_LOOKUP_FORCE_SIZE,
-                                                           NULL);
-
-                            if(pix) {
-                                xfce_notify_window_set_icon_pixbuf(window, pix);
-                                g_object_unref(G_OBJECT(pix));
-                            }
+        g_variant_unref(image_data);
+    }
+    else if (image_path) {
+        xfce_notify_window_set_icon_name (window, image_path);
+    }
+    else if (app_icon) {
+        xfce_notify_window_set_icon_name(window, app_icon);
+    }
+    else {
+        if(desktop_id) {
+            gchar *resource = g_strdup_printf("applications%c%s.desktop",
+                                              G_DIR_SEPARATOR,
+                                              desktop_id);
+            XfceRc *rcfile = xfce_rc_config_open(XFCE_RESOURCE_DATA,
+                                                 resource, TRUE);
+            if(rcfile) {
+                if(xfce_rc_has_group(rcfile, "Desktop Entry")) {
+                    const gchar *icon_file;
+                    xfce_rc_set_group(rcfile, "Desktop Entry");
+                    icon_file = xfce_rc_read_entry(rcfile, "Icon", NULL);
+                    if(icon_file) {
+                        pix = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
+                                                       icon_file,
+                                                       32,
+                                                       GTK_ICON_LOOKUP_FORCE_SIZE,
+                                                       NULL);
+
+                        if(pix) {
+                            xfce_notify_window_set_icon_pixbuf(window, pix);
+                            g_object_unref(G_OBJECT(pix));
                         }
                     }
-                    xfce_rc_close(rcfile);
                 }
-                g_free(resource);
+                xfce_rc_close(rcfile);
             }
+            g_free(resource);
         }
     }
 

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


More information about the Xfce4-commits mailing list