[gnome-color-manager] Escape profile titles that have markup in the titles



commit 1ae3d38908757bc788d95c473b3c1b41cbbc2962
Author: Richard Hughes <richard hughsie com>
Date:   Thu Sep 15 09:24:03 2011 +0100

    Escape profile titles that have markup in the titles
    
    This ensures we can show profiles with '<', '>' and '&' in the title.
    
    Resolves https://bugzilla.gnome.org/show_bug.cgi?id=659127

 src/gcm-cell-renderer-profile-text.c |    5 ++++-
 src/gcm-viewer.c                     |    4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/gcm-cell-renderer-profile-text.c b/src/gcm-cell-renderer-profile-text.c
index 523c11f..3437f18 100644
--- a/src/gcm-cell-renderer-profile-text.c
+++ b/src/gcm-cell-renderer-profile-text.c
@@ -63,6 +63,7 @@ gcm_cell_renderer_get_profile_text (CdProfile *profile)
 {
 	CdColorspace colorspace;
 	const gchar *id;
+	gchar *markup = NULL;
 	GString *string;
 
 	if (profile == NULL) {
@@ -74,7 +75,8 @@ gcm_cell_renderer_get_profile_text (CdProfile *profile)
 	/* add profile description */
 	id = cd_profile_get_title (profile);
 	if (id != NULL && id[0] != '\0') {
-		string = g_string_new (id);
+		markup = g_markup_escape_text (id, -1);
+		string = g_string_new (markup);
 		goto out;
 	}
 
@@ -91,6 +93,7 @@ gcm_cell_renderer_get_profile_text (CdProfile *profile)
 	/* fall back to ID, ick */
 	string = g_string_new (cd_profile_get_id (profile));
 out:
+	g_free (markup);
 	return string;
 }
 
diff --git a/src/gcm-viewer.c b/src/gcm-viewer.c
index bffccfc..0822095 100644
--- a/src/gcm-viewer.c
+++ b/src/gcm-viewer.c
@@ -1007,7 +1007,9 @@ gcm_viewer_set_profile (GcmViewerPrivate *viewer, CdProfile *profile)
 	} else {
 		gtk_widget_show (widget);
 		widget = GTK_WIDGET (gtk_builder_get_object (viewer->builder, "label_profile_model"));
-		gtk_label_set_label (GTK_LABEL(widget), profile_model);
+		temp = g_markup_escape_text (profile_model, -1);
+		gtk_label_set_label (GTK_LABEL(widget), temp);
+		g_free (temp);
 	}
 
 	/* set new datetime */



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