[Xfce4-commits] <libxfce4ui:master> Improve explanation label.

Jérôme Guelfucci noreply at xfce.org
Sun Dec 30 15:42:18 CET 2012


Updating branch refs/heads/master
         to 77eded0c2c4dd95e7117db4bce6634f998a825aa (commit)
       from 76c2d966f23155e7faa40427dbd8a8cc0e26a038 (commit)

commit 77eded0c2c4dd95e7117db4bce6634f998a825aa
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sat Dec 22 10:22:29 2012 +0100

    Improve explanation label.
    
    Make it italic and escape the text because the command may contain
    special caracters.

 libxfce4kbd-private/xfce-shortcut-dialog.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/libxfce4kbd-private/xfce-shortcut-dialog.c b/libxfce4kbd-private/xfce-shortcut-dialog.c
index f85bff9..4fbffc3 100644
--- a/libxfce4kbd-private/xfce-shortcut-dialog.c
+++ b/libxfce4kbd-private/xfce-shortcut-dialog.c
@@ -200,7 +200,9 @@ xfce_shortcut_dialog_create_contents (XfceShortcutDialog *dialog,
   GtkWidget   *label;
   const gchar *action_type;
   const gchar *title;
-  gchar       *explanation_label;
+  const gchar *explanation_label;
+  gchar       *explanation_label_escaped;
+  gchar       *explanation_label_markup;
 
   if (g_utf8_collate (provider, "xfwm4") == 0)
     {
@@ -264,13 +266,17 @@ xfce_shortcut_dialog_create_contents (XfceShortcutDialog *dialog,
   explanation_label =
     g_strdup_printf (_("Press now the keyboard keys you want to use to trigger the %s '%s'."),
                      action_type, action_name);
+  explanation_label_escaped = g_markup_escape_text (explanation_label, -1);
+  explanation_label_markup = g_strdup_printf ("<i>%s</i>", explanation_label_escaped);
 
-  label = gtk_label_new (explanation_label);
+  label = gtk_label_new (NULL);
+  gtk_label_set_markup (GTK_LABEL (label), explanation_label_markup);
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
   gtk_container_add (GTK_CONTAINER (content_box), label);
   gtk_widget_show (label);
-  g_free (explanation_label);
+  g_free (explanation_label_escaped);
+  g_free (explanation_label_markup);
 
   /* Box and labels to display the shortcut currently being grabbed.
    * It will be updated to key-press events. */


More information about the Xfce4-commits mailing list