GtkMenuItem: fix display of accelerators

The accel label in menus was getting a small allocation that
caused its draw code to always omit the accelerator string.
Fix that by setting halign to fill. To keep the menu label
left-aligned, set xalign to 0 to compensate.
This commit is contained in:
Matthias Clasen
2014-07-20 00:12:40 -04:00
parent d6d424f920
commit caa47b2ef4

View File

@@ -2510,8 +2510,8 @@ gtk_menu_item_ensure_label (GtkMenuItem *menu_item)
if (!gtk_bin_get_child (GTK_BIN (menu_item)))
{
accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL);
gtk_widget_set_halign (accel_label, GTK_ALIGN_START);
accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, "xalign", 0.0, NULL);
gtk_widget_set_halign (accel_label, GTK_ALIGN_FILL);
gtk_widget_set_valign (accel_label, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (menu_item), accel_label);