summaryrefslogtreecommitdiff
path: root/gtk/gtkfontchooser.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-09-04 17:17:07 -0400
committerMatthias Clasen <mclasen@redhat.com>2011-09-04 17:17:07 -0400
commitf601994effee42c064f44508844a99207d67e470 (patch)
treeb24200b881cc084ceed5c65e7d8a3c6b0b67d056 /gtk/gtkfontchooser.c
parent53edb2a4fb04ca3dc6004b18af905424bcd8f87f (diff)
downloadgtk+-f601994effee42c064f44508844a99207d67e470.tar.gz
GtkFontChooser: escape markup where required
Since we use markup in the list, we need to escape the font name and preview text pieces that we embed there.
Diffstat (limited to 'gtk/gtkfontchooser.c')
-rw-r--r--gtk/gtkfontchooser.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/gtk/gtkfontchooser.c b/gtk/gtkfontchooser.c
index db9b469ece..c51ea61d64 100644
--- a/gtk/gtkfontchooser.c
+++ b/gtk/gtkfontchooser.c
@@ -748,15 +748,12 @@ populate_list (GtkFontChooser *fontchooser,
gint n_families, i;
PangoFontFamily **families;
- GString *tmp;
- GString *family_and_face;
+ gchar *tmp;
+ gchar *family_and_face;
if (!gtk_widget_has_screen (GTK_WIDGET (fontchooser)))
return;
- tmp = g_string_new (NULL);
- family_and_face = g_string_new (NULL);
-
pango_context_list_families (gtk_widget_get_pango_context (GTK_WIDGET (treeview)),
&families,
&n_families);
@@ -800,18 +797,18 @@ populate_list (GtkFontChooser *fontchooser,
face_name = pango_font_face_get_face_name (faces[j]);
font_desc = pango_font_description_to_string (pango_desc);
- g_string_printf (family_and_face, "%s %s", fam_name, face_name);
- g_string_printf (tmp, ROW_FORMAT_STRING,
- family_and_face->str,
- font_desc,
- fontchooser->priv->preview_text);
+ family_and_face = g_strconcat (fam_name, " ", face_name, NULL);
+ tmp = g_markup_printf_escaped (ROW_FORMAT_STRING,
+ family_and_face,
+ font_desc,
+ fontchooser->priv->preview_text);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter,
FAMILY_COLUMN, families[i],
FACE_COLUMN, faces[j],
- PREVIEW_TITLE_COLUMN, family_and_face->str,
- PREVIEW_TEXT_COLUMN, tmp->str,
+ PREVIEW_TITLE_COLUMN, family_and_face,
+ PREVIEW_TEXT_COLUMN, tmp,
-1);
/* Select the current font,
@@ -839,6 +836,8 @@ populate_list (GtkFontChooser *fontchooser,
pango_font_description_free (pango_desc);
g_free (font_desc);
+ g_free (family_and_face);
+ g_free (tmp);
}
g_free (faces);
@@ -855,8 +854,6 @@ populate_list (GtkFontChooser *fontchooser,
if (selected_font)
pango_font_description_free (selected_font);
- g_string_free (family_and_face, TRUE);
- g_string_free (tmp, TRUE);
g_free (families);
}