[gtk+] GtkColorSwatch: Respect an explicitly set size
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkColorSwatch: Respect an explicitly set size
- Date: Thu, 10 Jul 2014 00:52:36 +0000 (UTC)
commit b68a28fbb02adc716eb6c00ad1338fc514fd39b5
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jul 9 20:44:06 2014 -0400
GtkColorSwatch: Respect an explicitly set size
This will let us use a suitably sized color swatch in the color
button.
gtk/gtkcolorswatch.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index ccee3ea..2f97f94 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -353,7 +353,14 @@ swatch_get_preferred_width (GtkWidget *widget,
gint *min,
gint *nat)
{
- *min = *nat = 48;
+ gint w, h;
+
+ gtk_widget_get_size_request (widget, &w, &h);
+
+ if (w < 0)
+ w = 48;
+
+ *min = *nat = w;
}
static void
@@ -361,7 +368,14 @@ swatch_get_preferred_height (GtkWidget *widget,
gint *min,
gint *nat)
{
- *min = *nat = 32;
+ gint w, h;
+
+ gtk_widget_get_size_request (widget, &w, &h);
+
+ if (h < 0)
+ h = 32;
+
+ *min = *nat = h;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]