[gtk/wip/baedert/for-master: 31/39] label: Only parse mnemonic attributes if we need to



commit 78e6475f9f69f5640511bde5b1740c07460a7534
Author: Timm Bäder <mail baedert org>
Date:   Tue Apr 14 11:11:08 2020 +0200

    label: Only parse mnemonic attributes if we need to

 gtk/gtklabel.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 3050b5adaf..9b75acfc04 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -2284,7 +2284,8 @@ no_uline:
       self->mnemonic_keyval = accel_keyval;
 
       /* Extract the text to display */
-      if (!pango_parse_markup (new_text, -1, '_', &attrs, &text, NULL, &error))
+      if (!pango_parse_markup (new_text, -1, '_',
+                               do_mnemonics ? &attrs : NULL, &text, NULL, &error))
         goto error_set;
 
       if (do_mnemonics)
@@ -2312,14 +2313,12 @@ no_uline:
   if (text)
     gtk_label_set_text_internal (self, text);
 
-  if (attrs)
-    {
-      g_clear_pointer (&self->markup_attrs, pango_attr_list_unref);
-      self->markup_attrs = attrs;
 
-      if (mnemonic_attr)
-        pango_attr_list_insert_before (self->markup_attrs, mnemonic_attr);
-    }
+  g_clear_pointer (&self->markup_attrs, pango_attr_list_unref);
+  self->markup_attrs = attrs;
+
+  if (mnemonic_attr)
+    pango_attr_list_insert_before (self->markup_attrs, mnemonic_attr);
 
   return;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]