summaryrefslogtreecommitdiff
path: root/gtk/gtkseparator.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2011-01-12 22:28:43 +0100
committerCarlos Garnacho <carlosg@gnome.org>2011-01-12 22:28:43 +0100
commitefae64be666e7d7489f1a7b8b19d6a9d760a6cda (patch)
tree1799d0cd7fb216556552fe41a5182fa78f026d8b /gtk/gtkseparator.c
parent8ad724ebcc07a5cd167bfde8c9387a9b8da96fdd (diff)
downloadgtk+-efae64be666e7d7489f1a7b8b19d6a9d760a6cda.tar.gz
Set vertical/horizontal class on all widgets overriding GtkOrientable::orientation
This is so g_object_set() on that property leaves widgets' style in a meaningful state. Fully fixes bugĀ 639157.
Diffstat (limited to 'gtk/gtkseparator.c')
-rw-r--r--gtk/gtkseparator.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c
index 1de28a1a58..b30292fc50 100644
--- a/gtk/gtkseparator.c
+++ b/gtk/gtkseparator.c
@@ -113,6 +113,25 @@ gtk_separator_init (GtkSeparator *separator)
}
static void
+reset_orientation_style (GtkSeparator *separator)
+{
+ GtkStyleContext *context;
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (separator));
+
+ if (separator->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ {
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_VERTICAL);
+ gtk_style_context_remove_class (context, GTK_STYLE_CLASS_HORIZONTAL);
+ }
+ else
+ {
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
+ gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VERTICAL);
+ }
+}
+
+static void
gtk_separator_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -125,6 +144,7 @@ gtk_separator_set_property (GObject *object,
{
case PROP_ORIENTATION:
private->orientation = g_value_get_enum (value);
+ reset_orientation_style (separator);
gtk_widget_queue_resize (GTK_WIDGET (object));
break;
default: