modelmenuitem: Set label on menu items

We have to add a check for GTK_IS_ACCEL_LABEL too now...
This commit is contained in:
Timm Bäder 2017-07-12 08:09:04 +02:00 committed by Matthias Clasen
parent 5116ce19b7
commit 308f41487d
4 changed files with 9 additions and 5 deletions

View File

@ -995,7 +995,7 @@ gtk_accel_label_set_label (GtkAccelLabel *accel_label,
g_return_if_fail (GTK_IS_ACCEL_LABEL (accel_label));
gtk_label_set_label (GTK_LABEL (priv->text_label), text);
gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->text_label), text);
}
const char *

View File

@ -1923,6 +1923,9 @@ gtk_menu_item_get_use_underline (GtkMenuItem *menu_item)
child = gtk_bin_get_child (GTK_BIN (menu_item));
if (GTK_IS_LABEL (child))
return gtk_label_get_use_underline (GTK_LABEL (child));
else if (GTK_IS_ACCEL_LABEL (child))
return gtk_accel_label_get_use_underline (GTK_ACCEL_LABEL (child));
return FALSE;
}

View File

@ -1813,8 +1813,6 @@ gtk_menu_shell_tracker_insert_func (GtkMenuTrackerItem *item,
label = gtk_menu_tracker_item_get_label (item);
if (label)
gtk_menu_item_set_label (GTK_MENU_ITEM (widget), label);
gtk_widget_show (widget);
}
else if (gtk_menu_tracker_item_get_has_link (item, G_MENU_LINK_SUBMENU))
{
@ -1852,8 +1850,6 @@ gtk_menu_shell_tracker_insert_func (GtkMenuTrackerItem *item,
g_signal_connect (submenu, "hide", G_CALLBACK (gtk_menu_shell_submenu_hidden), item);
g_signal_connect (submenu, "selection-done", G_CALLBACK (gtk_menu_shell_submenu_selection_done), item);
}
gtk_widget_show (widget);
}
else
{

View File

@ -252,6 +252,11 @@ gtk_model_menu_item_set_text (GtkModelMenuItem *item,
gtk_label_set_text_with_mnemonic (GTK_LABEL (child), text);
return;
}
else if (GTK_IS_ACCEL_LABEL (child))
{
gtk_accel_label_set_label (GTK_ACCEL_LABEL (child), text);
return;
}
if (!GTK_IS_CONTAINER (child))
return;