[goffice] GOOptionMenu: handle markup.



commit 75a561ce15d56c31111878c6711b0a3374846bbc
Author: Morten Welinder <terra gnome org>
Date:   Fri Apr 6 19:26:06 2018 -0400

    GOOptionMenu: handle markup.

 ChangeLog                   |    5 +++++
 NEWS                        |    1 +
 goffice/gtk/go-optionmenu.c |   13 +++++++------
 3 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fbe9f06..0f674c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-04-06  Morten Welinder  <terra gnome org>
+
+       * goffice/gtk/go-optionmenu.c (go_option_menu_update_contents):
+       Handle markup.
+
 2018-03-25  Morten Welinder  <terra gnome org>
 
        * goffice/utils/go-file.c (go_file_get_modtime): New function.
diff --git a/NEWS b/NEWS
index 5dd6c47..0542f3c 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Hiroshi Hatake:
 Morten:
        * Fixes required for running with musl.  [#794115]
        * Store last-know modtime for GODoc.
+       * Option menus: handle markup for labels.
 
 --------------------------------------------------------------------------
 goffice 0.10.39:
diff --git a/goffice/gtk/go-optionmenu.c b/goffice/gtk/go-optionmenu.c
index 5ef75bf..59b439e 100644
--- a/goffice/gtk/go-optionmenu.c
+++ b/goffice/gtk/go-optionmenu.c
@@ -108,18 +108,19 @@ go_option_menu_detacher (GtkWidget *widget, GtkMenu *menu)
 static void
 go_option_menu_update_contents (GOOptionMenu *option_menu)
 {
-       const char *text;
        GtkWidget *w;
+       const char *text = NULL;
+       gboolean use_markup = FALSE;
 
        g_return_if_fail (GO_IS_OPTION_MENU (option_menu));
 
        w = gtk_bin_get_child (GTK_BIN (option_menu->selected));
-       if (GTK_IS_LABEL (w))
-               text = gtk_label_get_text (GTK_LABEL (w));
-       else
-               text = "";
-
+       if (GTK_IS_LABEL (w)) {
+               text = gtk_label_get_label (GTK_LABEL (w));
+               use_markup = gtk_label_get_use_markup (GTK_LABEL (w));
+       }
        gtk_label_set_text (option_menu->button_label, text);
+       gtk_label_set_use_markup (option_menu->button_label, use_markup);
 }
 
 void


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