[Xfce4-commits] <xfce4-panel:xfce-4.8> Libxfce4panel: Always try to return an icon.

Nick Schermer noreply at xfce.org
Fri Sep 9 15:24:02 CEST 2011


Updating branch refs/heads/xfce-4.8
         to 9d01521724577e291105bc277ebe1b28392b7c84 (commit)
       from 4d7dd3935b90b4bde52df8064f302953d874bf4c (commit)

commit 9d01521724577e291105bc277ebe1b28392b7c84
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Jul 24 20:47:59 2011 +0200

    Libxfce4panel: Always try to return an icon.
    
    Better in most cases then no icon.
    
    (cherry picked from commit 389ff734e4cc54c68dd87b884b9b5aa8562e6dae)

 libxfce4panel/xfce-panel-convenience.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libxfce4panel/xfce-panel-convenience.c b/libxfce4panel/xfce-panel-convenience.c
index dc26ff8..9df0684 100644
--- a/libxfce4panel/xfce-panel-convenience.c
+++ b/libxfce4panel/xfce-panel-convenience.c
@@ -210,6 +210,16 @@ xfce_panel_pixbuf_from_source (const gchar  *source,
         }
     }
 
+  if (G_UNLIKELY (pixbuf == NULL))
+    {
+      if (G_UNLIKELY (icon_theme == NULL))
+        icon_theme = gtk_icon_theme_get_default ();
+
+      /* bit ugly as a fallback, but in most cases better then no icon */
+      pixbuf = gtk_icon_theme_load_icon (icon_theme, GTK_STOCK_MISSING_IMAGE,
+                                         size, GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+    }
+
   /* scale the pixbug if required */
   if (G_LIKELY (pixbuf != NULL))
     {


More information about the Xfce4-commits mailing list