aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-09-09 01:17:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-09-09 01:26:24 +0800
commit5136f4e554d327cdd663ef1890e7ceded732ec9b (patch)
tree852ce6da3177f14280534430b73240368d029811
parent5305abd266cfb070ff5620e77fcac8150864a738 (diff)
downloadgsoc2013-evolution-5136f4e554d327cdd663ef1890e7ceded732ec9b.tar
gsoc2013-evolution-5136f4e554d327cdd663ef1890e7ceded732ec9b.tar.gz
gsoc2013-evolution-5136f4e554d327cdd663ef1890e7ceded732ec9b.tar.bz2
gsoc2013-evolution-5136f4e554d327cdd663ef1890e7ceded732ec9b.tar.lz
gsoc2013-evolution-5136f4e554d327cdd663ef1890e7ceded732ec9b.tar.xz
gsoc2013-evolution-5136f4e554d327cdd663ef1890e7ceded732ec9b.tar.zst
gsoc2013-evolution-5136f4e554d327cdd663ef1890e7ceded732ec9b.zip
Fix folder name encoding in em_folder_utils_create_folder().
When creating a top-level folder, the folder name was still URI-encoded. So for example "Top Level Folder" was coming out "Top%20Level%20Folder". The em_folder_tree_store_root_selected() "if" branch is uncommented and looks unnecessary to me, so I'm removing it. Always parse the URI with e_mail_folder_uri_parse(), which produces a decoded folder name.
-rw-r--r--mail/em-folder-utils.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index 4181a41981..52e70c96ba 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -582,9 +582,10 @@ em_folder_utils_create_folder (GtkWindow *parent,
EMFolderTreeModel *model;
EMailAccountStore *account_store;
CamelStore *store = NULL;
- gchar *folder_name = NULL;
GtkWidget *dialog;
GQueue queue = G_QUEUE_INIT;
+ const gchar *folder_uri;
+ gchar *folder_name = NULL;
GError *error = NULL;
g_return_if_fail (GTK_IS_WINDOW (parent));
@@ -626,28 +627,12 @@ em_folder_utils_create_folder (GtkWindow *parent,
if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
goto exit;
- if (em_folder_tree_store_root_selected (folder_tree, &store)) {
- const gchar *folder_uri;
-
- folder_uri = em_folder_selector_get_selected_uri (selector);
-
- if (!folder_uri || !strrchr (folder_uri, '/'))
- g_set_error (
- &error, CAMEL_FOLDER_ERROR,
- CAMEL_FOLDER_ERROR_INVALID,
- _("Invalid folder URI '%s'"),
- folder_uri ? folder_uri : "null");
- else
- folder_name = g_strdup (strrchr (folder_uri, '/'));
- } else {
- const gchar *folder_uri;
-
- folder_uri = em_folder_selector_get_selected_uri (selector);
+ folder_uri = em_folder_selector_get_selected_uri (selector);
+ g_return_if_fail (folder_uri != NULL);
- e_mail_folder_uri_parse (
- CAMEL_SESSION (session), folder_uri,
- &store, &folder_name, &error);
- }
+ e_mail_folder_uri_parse (
+ CAMEL_SESSION (session), folder_uri,
+ &store, &folder_name, &error);
/* XXX This is unlikely to fail since the URI comes straight from
* EMFolderSelector, but leave a breadcrumb if it does fail. */