[gdm] Escape names before showing in markup



commit 9d026c2b626c1eb9c1b257765d02a8fc925d82f3
Author: William Jon McCann <jmccann redhat com>
Date:   Fri Jun 11 01:46:39 2010 -0400

    Escape names before showing in markup
    
    https://bugzilla.gnome.org/show_bug.cgi?id=619588

 gui/simple-greeter/gdm-chooser-widget.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-chooser-widget.c b/gui/simple-greeter/gdm-chooser-widget.c
index 180cbcd..57c4189 100644
--- a/gui/simple-greeter/gdm-chooser-widget.c
+++ b/gui/simple-greeter/gdm-chooser-widget.c
@@ -1623,6 +1623,7 @@ name_cell_data_func (GtkTreeViewColumn  *tree_column,
 {
         gboolean is_in_use;
         char    *name;
+        char    *escaped;
         char    *markup;
 
         name = NULL;
@@ -1631,15 +1632,22 @@ name_cell_data_func (GtkTreeViewColumn  *tree_column,
                             CHOOSER_ITEM_IS_IN_USE_COLUMN, &is_in_use,
                             CHOOSER_NAME_COLUMN, &name,
                             -1);
+        if (name != NULL) {
+                escaped = g_markup_escape_text (name, -1);
+                g_free (name);
+        } else {
+                escaped = NULL;
+        }
 
         if (is_in_use) {
                 markup = g_strdup_printf ("<b>%s</b>\n"
                                           "<i><span size=\"x-small\">%s</span></i>",
-                                          name ? name : "(null)", widget->priv->in_use_message);
+                                          escaped != NULL ? escaped : "(none)",
+                                          widget->priv->in_use_message);
         } else {
-                markup = g_strdup_printf ("%s", name ? name : "(null)");
+                markup = g_strdup_printf ("%s", escaped != NULL ? escaped : "(none)");
         }
-        g_free (name);
+        g_free (escaped);
 
         g_object_set (cell, "markup", markup, NULL);
         g_free (markup);



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