[Xfce4-commits] <xfce4-panel:andrzejr/wrapper3> PanelImage: better handling of minimum sizes.

Andrzej noreply at xfce.org
Mon Aug 26 00:26:09 CEST 2013


Updating branch refs/heads/andrzejr/wrapper3
         to 866af5da283392b63ba23fe560154ec1e4c87582 (commit)
       from 8fff5877bbca65545f9dcfac788aa48fcf037f3e (commit)

commit 866af5da283392b63ba23fe560154ec1e4c87582
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Wed Apr 17 21:09:27 2013 +0100

    PanelImage: better handling of minimum sizes.

 libxfce4panel/xfce-panel-image.c |   40 ++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/libxfce4panel/xfce-panel-image.c b/libxfce4panel/xfce-panel-image.c
index 1783f39..ded78ea 100644
--- a/libxfce4panel/xfce-panel-image.c
+++ b/libxfce4panel/xfce-panel-image.c
@@ -359,30 +359,27 @@ xfce_panel_image_get_preferred_width (GtkWidget *widget,
   XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv;
   GtkAllocation          alloc;
   gint                   width, width_min;
-#ifdef GTK_BUTTON_SIZING_FIX
-  gint                   correction;
-#endif
 
   if (priv->size > 0)
-    width = width_min = priv->size;
+    width = priv->size;
   else if (priv->pixbuf != NULL)
-    {
-      width = gdk_pixbuf_get_width (priv->pixbuf);
-      width_min = width / 2;
-    }
+    width = gdk_pixbuf_get_width (priv->pixbuf);
   else
     {
       gtk_widget_get_allocation (widget, &alloc);
       width = alloc.width;
-      width_min = width / 2;
     }
 
 #ifdef GTK_BUTTON_SIZING_FIX
-  correction = xfce_panel_image_padding_correction (widget);
-  width -= correction;
-  width_min -= correction;
+  width -= xfce_panel_image_padding_correction (widget);
+  width = MAX (width, 0);
 #endif
 
+  if (priv->size > 0)
+    width_min = width;
+  else
+    width_min = 0;
+
   if (minimum_width != NULL)
     *minimum_width = width_min;
 
@@ -400,30 +397,27 @@ xfce_panel_image_get_preferred_height (GtkWidget *widget,
   XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv;
   GtkAllocation          alloc;
   gint                   height, height_min;
-#ifdef GTK_BUTTON_SIZING_FIX
-  gint                   correction;
-#endif
 
   if (priv->size > 0)
     height = height_min = priv->size;
   else if (priv->pixbuf != NULL)
-    {
-      height = gdk_pixbuf_get_height (priv->pixbuf);
-      height_min = height / 2;
-    }
+    height = gdk_pixbuf_get_height (priv->pixbuf);
   else
     {
       gtk_widget_get_allocation (widget, &alloc);
       height = alloc.height;
-      height_min = height / 2;
     }
 
 #ifdef GTK_BUTTON_SIZING_FIX
-  correction = xfce_panel_image_padding_correction (widget);
-  height -= correction;
-  height_min -= correction;
+  height -= xfce_panel_image_padding_correction (widget);
+  height = MAX (height, 0);
 #endif
 
+  if (priv->size > 0)
+    height_min = height;
+  else
+    height_min = 0;
+
   if (minimum_height != NULL)
     *minimum_height = height_min;
 


More information about the Xfce4-commits mailing list