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.
This commit is contained in:
@ -233,6 +233,25 @@ gtk_tool_palette_reconfigured (GtkToolPalette *palette)
|
||||
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (palette));
|
||||
}
|
||||
|
||||
static void
|
||||
reset_orientation_style (GtkToolPalette *palette)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (palette));
|
||||
|
||||
if (palette->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_tool_palette_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -263,6 +282,7 @@ gtk_tool_palette_set_property (GObject *object,
|
||||
if ((guint) g_value_get_enum (value) != palette->priv->orientation)
|
||||
{
|
||||
palette->priv->orientation = g_value_get_enum (value);
|
||||
reset_orientation_style (palette);
|
||||
gtk_tool_palette_reconfigured (palette);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user