summaryrefslogtreecommitdiff
path: root/gtk/gtkorientable.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2011-01-12 22:55:55 +0100
committerCarlos Garnacho <carlosg@gnome.org>2011-01-12 22:58:41 +0100
commite2e7075533b003f54ed0852af8595d3ef4f23b01 (patch)
treece65645fa59ed53ee5b8d52010e3ef6a8f466980 /gtk/gtkorientable.c
parentb6464b6c0a467226057e21d7f35e8afa50321422 (diff)
downloadgtk+-e2e7075533b003f54ed0852af8595d3ef4f23b01.tar.gz
Redo patch in efae64b (Set vertical/horizontal class...)
Add a _gtk_orientable_set_style_classes() function so all orientation changes to style happen in a single place.
Diffstat (limited to 'gtk/gtkorientable.c')
-rw-r--r--gtk/gtkorientable.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/gtk/gtkorientable.c b/gtk/gtkorientable.c
index d3627252fb..81fcf6c384 100644
--- a/gtk/gtkorientable.c
+++ b/gtk/gtkorientable.c
@@ -80,8 +80,6 @@ void
gtk_orientable_set_orientation (GtkOrientable *orientable,
GtkOrientation orientation)
{
- GtkStyleContext *context;
-
g_return_if_fail (GTK_IS_ORIENTABLE (orientable));
g_object_set (orientable,
@@ -89,20 +87,7 @@ gtk_orientable_set_orientation (GtkOrientable *orientable,
NULL);
if (GTK_IS_WIDGET (orientable))
- {
- context = gtk_widget_get_style_context (GTK_WIDGET (orientable));
-
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VERTICAL);
- }
- else
- {
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_VERTICAL);
- gtk_style_context_remove_class (context, GTK_STYLE_CLASS_HORIZONTAL);
- }
- }
+ _gtk_orientable_set_style_classes (orientable);
}
/**
@@ -129,3 +114,27 @@ gtk_orientable_get_orientation (GtkOrientable *orientable)
return orientation;
}
+
+void
+_gtk_orientable_set_style_classes (GtkOrientable *orientable)
+{
+ GtkStyleContext *context;
+ GtkOrientation orientation;
+
+ g_return_if_fail (GTK_IS_ORIENTABLE (orientable));
+ g_return_if_fail (GTK_IS_WIDGET (orientable));
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (orientable));
+ orientation = gtk_orientable_get_orientation (orientable);
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
+ gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VERTICAL);
+ }
+ else
+ {
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_VERTICAL);
+ gtk_style_context_remove_class (context, GTK_STYLE_CLASS_HORIZONTAL);
+ }
+}