Commit 7fd9f2d3 authored by Daniel Boles's avatar Daniel Boles

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
parent 5d27915a
...@@ -5146,7 +5146,7 @@ gtk_notebook_update_labels (GtkNotebook *notebook) ...@@ -5146,7 +5146,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);
} }
...@@ -6350,7 +6350,7 @@ gtk_notebook_menu_item_create (GtkNotebook *notebook, ...@@ -6350,7 +6350,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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment