[baobab] Be more careful about escaping pango markup



commit 8cf47ce9455a8ecb397ed0e29fe4997c369c0c48
Author: Paolo Borelli <pborelli gnome org>
Date:   Fri Aug 3 11:04:44 2012 +0200

    Be more careful about escaping pango markup

 src/baobab-chart.c              |    3 +++
 src/baobab-location-widget.vala |    6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/baobab-chart.c b/src/baobab-chart.c
index aca23e8..0876c19 100644
--- a/src/baobab-chart.c
+++ b/src/baobab-chart.c
@@ -1205,6 +1205,7 @@ baobab_chart_query_tooltip (GtkWidget  *widget,
   BaobabChart *chart = BAOBAB_CHART (widget);
   BaobabChartItem *item;
   char *markup;
+  char *escaped;
 
   if (chart->priv->highlighted_item == NULL)
     return FALSE;
@@ -1220,8 +1221,10 @@ baobab_chart_query_tooltip (GtkWidget  *widget,
                         "\n",
                         item->size,
                         NULL);
+  escaped = g_markup_escape_text (markup, -1);
   gtk_tooltip_set_markup (tooltip, markup);
   g_free (markup);
+  g_free (escaped);
 
   return TRUE;
 }
diff --git a/src/baobab-location-widget.vala b/src/baobab-location-widget.vala
index 73d8720..6cd7b82 100644
--- a/src/baobab-location-widget.vala
+++ b/src/baobab-location-widget.vala
@@ -54,7 +54,8 @@ namespace Baobab {
                 warning ("Failed to load icon %s: %s", location.icon.to_string(), e.message);
             }
 
-            var label = new Gtk.Label ("<b>%s</b>".printf (location.name));
+            var escaped = GLib.Markup.escape_text (location.name, -1);
+            var label = new Gtk.Label ("<b>%s</b>".printf (escaped));
             name_size_group.add_widget (label);
             label.use_markup = true;
             label.hexpand = true;
@@ -63,7 +64,8 @@ namespace Baobab {
             label.xalign = 0;
             attach (label, 1, 0, 1, 1);
 
-            label = new Gtk.Label ("<small>%s</small>".printf (location.file != null ? location.file.get_parse_name () : ""));
+            escaped = location.file != null ? GLib.Markup.escape_text (location.file.get_parse_name (), -1) : "";
+            label = new Gtk.Label ("<small>%s</small>".printf (escaped));
             name_size_group.add_widget (label);
             label.use_markup = true;
             label.hexpand = true;



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