[seahorse] Unescape URI's before presenting them to the user.



commit 326b399cf90019a80c0abeff98b44a39e1cd9455
Author: Adam Schreiber <sadam gnome org>
Date:   Sat Feb 13 10:00:58 2010 -0500

    Unescape URI's before presenting them to the user.

 daemon/seahorse-service-crypto.c  |    6 ++++--
 pgp/seahorse-pgp-key-properties.c |   12 +++++++-----
 src/seahorse-viewer.c             |   10 ++++++----
 ssh/seahorse-ssh-key-properties.c |   12 +++++++-----
 4 files changed, 24 insertions(+), 16 deletions(-)
---
diff --git a/daemon/seahorse-service-crypto.c b/daemon/seahorse-service-crypto.c
index f120556..6296766 100644
--- a/daemon/seahorse-service-crypto.c
+++ b/daemon/seahorse-service-crypto.c
@@ -183,7 +183,7 @@ notify_signatures (const gchar* data, gpgme_verify_result_t status)
 {
 	const gchar *icon = NULL;
 	SeahorseObject *object;
-	gchar *title, *body;
+	gchar *title, *body, *unesc_data;
 	gboolean sig = FALSE;
 	GSList *rawids;
 	GList *keys;
@@ -258,7 +258,9 @@ notify_signatures (const gchar* data, gpgme_verify_result_t status)
 
 	if (data) {
 		data = seahorse_util_uri_get_last (data);
-		title = g_strdup_printf ("%s: %s", data, title);
+	    unesc_data = g_uri_unescape_string (data, NULL);
+		title = g_strdup_printf ("%s: %s", unesc_data, title);
+		g_free (unesc_data);
 	} else {
 		title = g_strdup (title);
 	}
diff --git a/pgp/seahorse-pgp-key-properties.c b/pgp/seahorse-pgp-key-properties.c
index 5fbdab3..3ef90ba 100644
--- a/pgp/seahorse-pgp-key-properties.c
+++ b/pgp/seahorse-pgp-key-properties.c
@@ -996,16 +996,18 @@ static void
 export_complete (GFile *file, GAsyncResult *result, gchar *contents)
 {
 	GError *err = NULL;
-	gchar *uri;
+	gchar *uri, *unesc_uri;
 	
 	g_free (contents);
 
 	if (!g_file_replace_contents_finish (file, result, NULL, &err)) {
 		uri = g_file_get_uri (file);
-	        seahorse_util_handle_error (err, _("Couldn't export key to \"%s\""),
-	                                    seahorse_util_uri_get_last (uri));
-	        g_clear_error (&err);
-	        g_free (uri);
+		unesc_uri = g_uri_unescape_string (seahorse_util_uri_get_last (uri), NULL);
+        seahorse_util_handle_error (err, _("Couldn't export key to \"%s\""),
+                                    unesc_uri);
+        g_clear_error (&err);
+        g_free (uri);
+        g_free (unesc_uri);
 	}
 }
 
diff --git a/src/seahorse-viewer.c b/src/seahorse-viewer.c
index 2e53113..929c3d9 100644
--- a/src/seahorse-viewer.c
+++ b/src/seahorse-viewer.c
@@ -287,9 +287,9 @@ static void
 on_key_export_file (GtkAction* action, SeahorseViewer* self) 
 {
 	GError *error = NULL;
-	GList* objects;
-	GtkDialog* dialog;
-	char* uri;
+	GList *objects;
+	GtkDialog *dialog;
+	gchar *uri, *unesc_uri;
 	
 	g_return_if_fail (SEAHORSE_IS_VIEWER (self));
 	g_return_if_fail (GTK_IS_ACTION (action));
@@ -312,9 +312,11 @@ on_key_export_file (GtkAction* action, SeahorseViewer* self)
 		file = g_file_new_for_uri (uri);
 		output = G_OUTPUT_STREAM (g_file_replace (file, NULL, FALSE, 0, NULL, &error));
 		if (output == NULL) {
+		    unesc_uri = g_uri_unescape_string (seahorse_util_uri_get_last (uri), NULL);
 			seahorse_util_handle_error (error, _ ("Couldn't export key to \"%s\""), 
-			                            seahorse_util_uri_get_last (uri), NULL);
+			                            unesc_uri, NULL);
 			g_clear_error (&error);
+			g_free (unesc_uri);
 		} else {
 			op = seahorse_source_export_objects (objects, output);
 			seahorse_progress_show (op, _("Exporting keys"), TRUE);
diff --git a/ssh/seahorse-ssh-key-properties.c b/ssh/seahorse-ssh-key-properties.c
index 083f3d3..52a8b4f 100644
--- a/ssh/seahorse-ssh-key-properties.c
+++ b/ssh/seahorse-ssh-key-properties.c
@@ -158,16 +158,18 @@ static void
 export_complete (GFile *file, GAsyncResult *result, guchar *contents)
 {
 	GError *err = NULL;
-	gchar *uri;
+	gchar *uri, *unesc_uri;
 	
 	g_free (contents);
 	
 	if (!g_file_replace_contents_finish (file, result, NULL, &err)) {
 		uri = g_file_get_uri (file);
-	        seahorse_util_handle_error (err, _("Couldn't export key to \"%s\""),
-	                                    seahorse_util_uri_get_last (uri));
-	        g_clear_error (&err);
-	        g_free (uri);
+		unesc_uri = g_uri_unescape_string (seahorse_util_uri_get_last (uri), NULL);
+        seahorse_util_handle_error (err, _("Couldn't export key to \"%s\""),
+                                    unesc_uri);
+        g_clear_error (&err);
+        g_free (uri);
+        g_free (unesc_uri);
 	}
 }
 



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