[gnome-panel/gtk3] Fix warning in size request when there is no pixbuf



commit 2edaeb4abbc8ec6714aefd1fb83df9011d8a42a5
Author: Germán Póo-Caamaño <gpoo gnome org>
Date:   Fri Dec 31 01:09:19 2010 -0800

    Fix warning in size request when there is no pixbuf
    
    This patch fix a regression introduced in #beec7ccc.
    Without the condition, the width returned is -1, which
    produces a warning on every action that involves an
    applet.
    
    Also fixed format.
    
    Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>

 gnome-panel/button-widget.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/gnome-panel/button-widget.c b/gnome-panel/button-widget.c
index f76b193..5786b87 100644
--- a/gnome-panel/button-widget.c
+++ b/gnome-panel/button-widget.c
@@ -422,19 +422,27 @@ button_widget_draw (GtkWidget *widget,
 }
 
 static void
-button_widget_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width)
+button_widget_get_preferred_width (GtkWidget *widget,
+				   gint *minimal_width,
+				   gint *natural_width)
 {
 	ButtonWidget *button_widget = BUTTON_WIDGET (widget);
 
-	*minimal_width = *natural_width = gdk_pixbuf_get_width  (button_widget->priv->pixbuf);
+	if (button_widget->priv->pixbuf) {
+		*minimal_width = *natural_width = gdk_pixbuf_get_width (button_widget->priv->pixbuf);
+	}
 }
 
 static void
-button_widget_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height)
+button_widget_get_preferred_height (GtkWidget *widget,
+				    gint *minimal_height,
+				    gint *natural_height)
 {
 	ButtonWidget *button_widget = BUTTON_WIDGET (widget);
 
-	*minimal_height = *natural_height = gdk_pixbuf_get_height (button_widget->priv->pixbuf);
+	if (button_widget->priv->pixbuf) {
+		*minimal_height = *natural_height = gdk_pixbuf_get_height (button_widget->priv->pixbuf);
+	}
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]