summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej <ndrwrdck@gmail.com>2013-04-17 21:09:27 +0100
committerAndrzej <ndrwrdck@gmail.com>2013-04-17 21:13:27 +0100
commitef2daa326f8cadb648c6827c719386eea0b54433 (patch)
tree90f20a8bbcb727a5663df6510183ded1bfafc559
parent971713b1852a0a0ff007e45bdf54707980e5c7f3 (diff)
PanelImage: better handling of minimum sizes.
-rw-r--r--libxfce4panel/xfce-panel-image.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/libxfce4panel/xfce-panel-image.c b/libxfce4panel/xfce-panel-image.c
index 1783f39b..ded78ea1 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;