[Xfce4-commits] [apps/xfce4-notifyd] 01/01: Check for better icon fallbacks

noreply at xfce.org noreply at xfce.org
Fri Sep 9 22:52:31 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 f145d516c42e09a5fb337f8694bc0f44dd69f029
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Fri Sep 9 22:51:23 2016 +0200

    Check for better icon fallbacks
    
    This is especially nice when e.g. an application requests a symbolic
    icon and the theme doesn't have one, then we still find and display a
    fallback.
---
 xfce4-notifyd/xfce-notify-window.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/xfce4-notifyd/xfce-notify-window.c b/xfce4-notifyd/xfce-notify-window.c
index b16b8ba..12975e0 100644
--- a/xfce4-notifyd/xfce-notify-window.c
+++ b/xfce4-notifyd/xfce-notify-window.c
@@ -783,11 +783,12 @@ xfce_notify_window_set_icon_name (XfceNotifyWindow *window,
     if (icon_name && *icon_name) {
         gint w, h;
         GdkPixbuf *pix = NULL;
+        GIcon *icon;
 
         gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &w, &h);
 
         if (g_path_is_absolute (icon_name)) {
-          pix = gdk_pixbuf_new_from_file_at_size (icon_name, w, h, NULL);
+            pix = gdk_pixbuf_new_from_file_at_size (icon_name, w, h, NULL);
         }
         else if (g_str_has_prefix (icon_name, "file://")) {
             filename = g_filename_from_uri (icon_name, NULL, NULL);
@@ -795,15 +796,11 @@ xfce_notify_window_set_icon_name (XfceNotifyWindow *window,
               pix = gdk_pixbuf_new_from_file_at_size (filename, w, h, NULL);
             g_free (filename);
         }
-        else if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default(), icon_name)) {
-            gtk_image_set_from_icon_name (GTK_IMAGE (window->icon),
-                                          icon_name, GTK_ICON_SIZE_DIALOG);
-            /* As -symbolic icons use GTK_ICON_SIZE_MENU by default, we have to make
-               sure that SIZE_DIALOG (48px) is used */
-            gtk_image_set_pixel_size (GTK_IMAGE (window->icon), w);
+        else {
+            icon = g_themed_icon_new_with_default_fallbacks (icon_name);
+            gtk_image_set_from_gicon (GTK_IMAGE (window->icon), icon, GTK_ICON_SIZE_DIALOG);
             icon_set = TRUE;
         }
-        else
             g_warning ("The icon could not be found: %s", icon_name);
         if (pix) {
             gtk_image_set_from_pixbuf (GTK_IMAGE (window->icon), pix);

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


More information about the Xfce4-commits mailing list