[Xfce4-commits] [panel-plugins/xfce4-weather-plugin] 01/01: Silence some startup warnings

noreply at xfce.org noreply at xfce.org
Sat Mar 23 10:56:04 CET 2019


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

b   l   u   e   s   a   b   r   e       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 panel-plugins/xfce4-weather-plugin.

commit e2ba205e90aeab44f0d91a6091c06e494838575c
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sat Mar 23 05:55:57 2019 -0400

    Silence some startup warnings
---
 panel-plugin/weather-icon.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/weather-icon.c b/panel-plugin/weather-icon.c
index 49a2f59..3ec0b4a 100644
--- a/panel-plugin/weather-icon.c
+++ b/panel-plugin/weather-icon.c
@@ -153,6 +153,23 @@ make_fallback_icon_filename(const gchar *sizedir)
 }
 
 
+static GdkPixbuf *
+quiet_gdk_pixbuf_new_from_file_at_scale(const char *filename,
+                                        int width,
+                                        int height,
+                                        gboolean preserve_aspect_ratio,
+                                        GError **error)
+{
+    if (height == 0)
+        height = 1;
+
+    if (width == 0)
+        width = 1;
+
+    return gdk_pixbuf_new_from_file_at_scale (filename, width, height, preserve_aspect_ratio, error);
+}
+
+
 GdkPixbuf *
 get_icon(const icon_theme *theme,
          const gchar *symbol_name,
@@ -180,7 +197,7 @@ get_icon(const icon_theme *theme,
     /* check whether icon has been verified to be missing before */
     if (!icon_missing(theme, sizedir, symbol_name, suffix)) {
         filename = make_icon_filename(theme, sizedir, symbol_name, suffix);
-        image = gdk_pixbuf_new_from_file_at_scale(filename, size, size, TRUE, NULL);
+        image = quiet_gdk_pixbuf_new_from_file_at_scale(filename, size, size, TRUE, NULL);
     }
 
     if (image == NULL) {
@@ -202,8 +219,8 @@ get_icon(const icon_theme *theme,
         else {
             /* last chance: get NODATA icon from standard theme */
             filename = make_fallback_icon_filename(sizedir);
-            image = gdk_pixbuf_new_from_file_at_scale(filename, size, size,
-                                                      TRUE, NULL);
+            image = quiet_gdk_pixbuf_new_from_file_at_scale(filename, size, size,
+                                                            TRUE, NULL);
             if (G_UNLIKELY(image == NULL))
                 g_warning("Failed to open fallback icon from standard theme: %s",
                           filename);

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


More information about the Xfce4-commits mailing list