Stop assuming that priv->label_widget will be a GtkLabel.

https://bugzilla.gnome.org/show_bug.cgi?id=623603
This commit is contained in:
Tomeu Vizoso 2010-07-12 17:02:06 +02:00
parent 0a61e919e2
commit 568865ab1b

View File

@ -421,26 +421,29 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
gtk_widget_show (label); gtk_widget_show (label);
} }
gtk_label_set_ellipsize (GTK_LABEL (label), if (GTK_IS_LABEL (label))
gtk_tool_item_get_ellipsize_mode (GTK_TOOL_ITEM (button)));
text_orientation = gtk_tool_item_get_text_orientation (GTK_TOOL_ITEM (button));
if (text_orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_label_set_angle (GTK_LABEL (label), 0);
gtk_misc_set_alignment (GTK_MISC (label),
gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)),
0.5);
}
else
{ {
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_NONE); gtk_label_set_ellipsize (GTK_LABEL (label),
if (gtk_widget_get_direction (GTK_WIDGET (tool_item)) == GTK_TEXT_DIR_RTL) gtk_tool_item_get_ellipsize_mode (GTK_TOOL_ITEM (button)));
gtk_label_set_angle (GTK_LABEL (label), -90); text_orientation = gtk_tool_item_get_text_orientation (GTK_TOOL_ITEM (button));
else if (text_orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_label_set_angle (GTK_LABEL (label), 90); {
gtk_misc_set_alignment (GTK_MISC (label), gtk_label_set_angle (GTK_LABEL (label), 0);
0.5, gtk_misc_set_alignment (GTK_MISC (label),
1 - gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button))); gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)),
0.5);
}
else
{
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_NONE);
if (gtk_widget_get_direction (GTK_WIDGET (tool_item)) == GTK_TEXT_DIR_RTL)
gtk_label_set_angle (GTK_LABEL (label), -90);
else
gtk_label_set_angle (GTK_LABEL (label), 90);
gtk_misc_set_alignment (GTK_MISC (label),
0.5,
1 - gtk_tool_item_get_text_alignment (GTK_TOOL_ITEM (button)));
}
} }
} }