tool button: Update style classes
When changing tool button contents according to the toolbar-style property, we need to update the style classes to ensure that the visual style matches. https://bugzilla.gnome.org/show_bug.cgi?id=760560
This commit is contained in:
@ -601,6 +601,7 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
|||||||
if (icon)
|
if (icon)
|
||||||
gtk_container_add (GTK_CONTAINER (button->priv->button), icon);
|
gtk_container_add (GTK_CONTAINER (button->priv->button), icon);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button");
|
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button");
|
||||||
|
gtk_style_context_remove_class (gtk_widget_get_style_context (button->priv->button), "text-button");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_TOOLBAR_BOTH:
|
case GTK_TOOLBAR_BOTH:
|
||||||
@ -612,6 +613,8 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
|||||||
gtk_box_pack_start (GTK_BOX (box), icon, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box), icon, TRUE, TRUE, 0);
|
||||||
gtk_box_pack_end (GTK_BOX (box), label, FALSE, TRUE, 0);
|
gtk_box_pack_end (GTK_BOX (box), label, FALSE, TRUE, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (button->priv->button), box);
|
gtk_container_add (GTK_CONTAINER (button->priv->button), box);
|
||||||
|
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button");
|
||||||
|
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "text-button");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_TOOLBAR_BOTH_HORIZ:
|
case GTK_TOOLBAR_BOTH_HORIZ:
|
||||||
@ -632,11 +635,14 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
|||||||
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
|
||||||
}
|
}
|
||||||
gtk_container_add (GTK_CONTAINER (button->priv->button), box);
|
gtk_container_add (GTK_CONTAINER (button->priv->button), box);
|
||||||
|
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "image-button");
|
||||||
|
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "text-button");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_TOOLBAR_TEXT:
|
case GTK_TOOLBAR_TEXT:
|
||||||
gtk_container_add (GTK_CONTAINER (button->priv->button), label);
|
gtk_container_add (GTK_CONTAINER (button->priv->button), label);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "text-button");
|
gtk_style_context_add_class (gtk_widget_get_style_context (button->priv->button), "text-button");
|
||||||
|
gtk_style_context_remove_class (gtk_widget_get_style_context (button->priv->button), "image-button");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user