[Xfce4-commits] <xfce4-panel:master> PanelImage: better handling of minimum sizes.
Nick Schermer
noreply at xfce.org
Sat Nov 30 17:12:16 CET 2013
Updating branch refs/heads/master
to 38c9dee6624146cac6e4d7596575291d65099a30 (commit)
from 334f991cafbbe8d05f5ca9c5dac7ba4bba9a509e (commit)
commit 38c9dee6624146cac6e4d7596575291d65099a30
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