[gtk+] builtinicon: Change the way size is handled
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] builtinicon: Change the way size is handled
- Date: Wed, 16 Dec 2015 03:46:57 +0000 (UTC)
commit fab181fcfa782b19dcc96a1c7f5b47033b4c200b
Author: Benjamin Otte <otte redhat com>
Date: Wed Dec 16 04:44:52 2015 +0100
builtinicon: Change the way size is handled
Make min-width/height have preference over the set default size. This
allows shrinking the widget. The default size is only used if min-width
is not set (or explicitly set to 0.
gtk/gtkbuiltinicon.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkbuiltinicon.c b/gtk/gtkbuiltinicon.c
index c2e2c07..9c497c4 100644
--- a/gtk/gtkbuiltinicon.c
+++ b/gtk/gtkbuiltinicon.c
@@ -22,6 +22,7 @@
#include "gtkbuiltiniconprivate.h"
#include "gtkcssnodeprivate.h"
+#include "gtkcssnumbervalueprivate.h"
#include "gtkrendericonprivate.h"
typedef struct _GtkBuiltinIconPrivate GtkBuiltinIconPrivate;
@@ -43,6 +44,19 @@ gtk_builtin_icon_get_preferred_size (GtkCssGadget *gadget,
gint *natural_baseline)
{
GtkBuiltinIconPrivate *priv = gtk_builtin_icon_get_instance_private (GTK_BUILTIN_ICON (gadget));
+ double min_size;
+ guint property;
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ property = GTK_CSS_PROPERTY_MIN_WIDTH;
+ else
+ property = GTK_CSS_PROPERTY_MIN_HEIGHT;
+ min_size = _gtk_css_number_value_get (gtk_css_style_get_value (gtk_css_gadget_get_style (gadget),
property), 100);
+ if (min_size > 0.0)
+ {
+ *minimum = *natural = 0;
+ return;
+ }
*minimum = priv->default_size;
*natural = priv->default_size;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]