mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 03:10:09 +00:00
Notebook: Don’t show raw underline/markup in popup
If @menu_label == NULL, we create a default page->menu_label. This took @tab_label.get_label() and passed that to page->menu_label.set_text(). This is wrong because we set the plain text of the menu_label from the rich text of @tab_label. So, if @tab_label used mnemonics or markup, our menu_label got the raw underline or markup tags shown in it as raw text. As we call set_text() on the menu Label, the fix is to be symmetric: use @tab_label’s get_text() as source, as that strips underlines and markup. It’s not worth making the default Label ‘inherit’ :use-underline/markup; that’s a slippery slope, and users wanting such things can just create a fully fledged GtkLabel to pass as @menu_label to suppress the default. https://bugzilla.gnome.org/show_bug.cgi?id=705509
This commit is contained in:
parent
b64a403100
commit
146082d464
@ -4332,7 +4332,7 @@ gtk_notebook_update_labels (GtkNotebook *notebook)
|
|||||||
{
|
{
|
||||||
if (GTK_IS_LABEL (page->tab_label))
|
if (GTK_IS_LABEL (page->tab_label))
|
||||||
gtk_label_set_text (GTK_LABEL (page->menu_label),
|
gtk_label_set_text (GTK_LABEL (page->menu_label),
|
||||||
gtk_label_get_label (GTK_LABEL (page->tab_label)));
|
gtk_label_get_text (GTK_LABEL (page->tab_label)));
|
||||||
else
|
else
|
||||||
gtk_label_set_text (GTK_LABEL (page->menu_label), string);
|
gtk_label_set_text (GTK_LABEL (page->menu_label), string);
|
||||||
}
|
}
|
||||||
@ -5560,7 +5560,7 @@ gtk_notebook_menu_item_create (GtkNotebook *notebook,
|
|||||||
if (page->default_menu)
|
if (page->default_menu)
|
||||||
{
|
{
|
||||||
if (GTK_IS_LABEL (page->tab_label))
|
if (GTK_IS_LABEL (page->tab_label))
|
||||||
page->menu_label = gtk_label_new (gtk_label_get_label (GTK_LABEL (page->tab_label)));
|
page->menu_label = gtk_label_new (gtk_label_get_text (GTK_LABEL (page->tab_label)));
|
||||||
else
|
else
|
||||||
page->menu_label = gtk_label_new ("");
|
page->menu_label = gtk_label_new ("");
|
||||||
gtk_widget_set_halign (page->menu_label, GTK_ALIGN_START);
|
gtk_widget_set_halign (page->menu_label, GTK_ALIGN_START);
|
||||||
|
Loading…
Reference in New Issue
Block a user