+ GtkSeparatorPrivate *private;
+ GtkStyleContext *context;
+
+ separator->priv = G_TYPE_INSTANCE_GET_PRIVATE (separator,
+ GTK_TYPE_SEPARATOR,
+ GtkSeparatorPrivate);
+ private = separator->priv;
+
+ gtk_widget_set_has_window (GTK_WIDGET (separator), FALSE);
+
+ private->orientation = GTK_ORIENTATION_HORIZONTAL;
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (separator));
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
+}
+
+static void
+gtk_separator_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkSeparator *separator = GTK_SEPARATOR (object);
+ GtkSeparatorPrivate *private = separator->priv;
+
+ switch (prop_id)
+ {
+ case PROP_ORIENTATION:
+ private->orientation = g_value_get_enum (value);
+ _gtk_orientable_set_style_classes (GTK_ORIENTABLE (object));
+ gtk_widget_queue_resize (GTK_WIDGET (object));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_separator_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkSeparator *separator = GTK_SEPARATOR (object);
+ GtkSeparatorPrivate *private = separator->priv;
+
+ switch (prop_id)
+ {
+ case PROP_ORIENTATION:
+ g_value_set_enum (value, private->orientation);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_separator_get_preferred_size (GtkWidget *widget,
+ GtkOrientation orientation,
+ gint *minimum,
+ gint *natural)
+{
+ GtkSeparator *separator = GTK_SEPARATOR (widget);
+ GtkSeparatorPrivate *private = separator->priv;
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ GtkBorder border;
+ gboolean wide_sep;
+ gint sep_width;
+ gint sep_height;
+
+ context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
+ gtk_style_context_get_border (context, state, &border);
+
+ gtk_widget_style_get (widget,
+ "wide-separators", &wide_sep,
+ "separator-width", &sep_width,
+ "separator-height", &sep_height,
+ NULL);
+
+ if (orientation == private->orientation)
+ {
+ *minimum = *natural = 1;
+ }
+ else if (orientation == GTK_ORIENTATION_VERTICAL)
+ {
+ *minimum = *natural = wide_sep ? sep_height : border.top;
+ }
+ else
+ {
+ *minimum = *natural = wide_sep ? sep_width : border.left;
+ }
+}
+
+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);