[gtk+/kill-size-request] Remove size_request from GtkSeparator
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/kill-size-request] Remove size_request from GtkSeparator
- Date: Wed, 27 Oct 2010 12:34:19 +0000 (UTC)
commit 7947f1933eea61f1a112fc2fe28a344c2173b11d
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 27 08:33:42 2010 -0400
Remove size_request from GtkSeparator
gtk/gtkseparator.c | 72 ++++++++++++++++++++++++++++++++-------------------
1 files changed, 45 insertions(+), 27 deletions(-)
---
diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c
index e3c1e6b..025b80f 100644
--- a/gtk/gtkseparator.c
+++ b/gtk/gtkseparator.c
@@ -61,9 +61,14 @@ static void gtk_separator_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
-
-static void gtk_separator_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+static void gtk_separator_get_preferred_width
+ (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+static void gtk_separator_get_preferred_height
+ (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
static gboolean gtk_separator_draw (GtkWidget *widget,
cairo_t *cr);
@@ -82,12 +87,12 @@ gtk_separator_class_init (GtkSeparatorClass *class)
object_class->set_property = gtk_separator_set_property;
object_class->get_property = gtk_separator_get_property;
- widget_class->size_request = gtk_separator_size_request;
+ widget_class->get_preferred_width = gtk_separator_get_preferred_width;
+ widget_class->get_preferred_height = gtk_separator_get_preferred_height;
+
widget_class->draw = gtk_separator_draw;
- g_object_class_override_property (object_class,
- PROP_ORIENTATION,
- "orientation");
+ g_object_class_override_property (object_class, PROP_ORIENTATION, "orientation");
g_type_class_add_private (object_class, sizeof (GtkSeparatorPrivate));
}
@@ -149,42 +154,55 @@ gtk_separator_get_property (GObject *object,
}
static void
-gtk_separator_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+gtk_separator_get_preferred_size (GtkWidget *widget,
+ GtkOrientation orientation,
+ gint *minimum,
+ gint *natural)
{
GtkSeparator *separator = GTK_SEPARATOR (widget);
GtkSeparatorPrivate *private = separator->priv;
GtkStyle *style;
- gboolean wide_separators;
- gint separator_width;
- gint separator_height;
+ gboolean wide_sep;
+ gint sep_width;
+ gint sep_height;
style = gtk_widget_get_style (widget);
gtk_widget_style_get (widget,
- "wide-separators", &wide_separators,
- "separator-width", &separator_width,
- "separator-height", &separator_height,
+ "wide-separators", &wide_sep,
+ "separator-width", &sep_width,
+ "separator-height", &sep_height,
NULL);
- requisition->width = 1;
- requisition->height = 1;
-
- if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (orientation == private->orientation)
{
- if (wide_separators)
- requisition->height = separator_height;
- else
- requisition->height = style->ythickness;
+ *minimum = *natural = 1;
+ }
+ else if (orientation == GTK_ORIENTATION_VERTICAL)
+ {
+ *minimum = *natural = wide_sep ? sep_height : style->ythickness;
}
else
{
- if (wide_separators)
- requisition->width = separator_width;
- else
- requisition->width = style->xthickness;
+ *minimum = *natural = wide_sep ? sep_width : style->xthickness;
}
}
+static void
+gtk_separator_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ gtk_separator_get_preferred_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum, natural);
+}
+
+static void
+gtk_separator_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ gtk_separator_get_preferred_size (widget, GTK_ORIENTATION_VERTICAL, minimum, natural);
+}
+
static gboolean
gtk_separator_draw (GtkWidget *widget,
cairo_t *cr)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]