diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-25 11:04:16 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-05-25 11:04:16 +0800 |
commit | c27a45ecf0351bcc8626f832090f855e1b385af3 (patch) | |
tree | 24128b048fb39fe57baeb3f974b977e491a132ee /mail/em-folder-selector.c | |
parent | ef878b2f23d13e6c647af6089fefd193bbe24c4b (diff) | |
download | gsoc2013-evolution-c27a45ecf0351bcc8626f832090f855e1b385af3.tar.gz gsoc2013-evolution-c27a45ecf0351bcc8626f832090f855e1b385af3.tar.zst gsoc2013-evolution-c27a45ecf0351bcc8626f832090f855e1b385af3.zip |
Fix em_folder_selector_get_selected_uri().
Another case of custom logic to build old-style folder URIs.
The new format simplifies things considerably.
Diffstat (limited to 'mail/em-folder-selector.c')
-rw-r--r-- | mail/em-folder-selector.c | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index 0ec0428323..b01b30550c 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -429,54 +429,28 @@ em_folder_selector_get_selected_uri (EMFolderSelector *emfs) { EMFolderTree *folder_tree; gchar *uri; - const gchar *name; g_return_val_if_fail (EM_IS_FOLDER_SELECTOR (emfs), NULL); folder_tree = em_folder_selector_get_folder_tree (emfs); uri = em_folder_tree_get_selected_uri (folder_tree); - if (uri == NULL) { - d(printf ("no selected folder?\n")); + if (uri == NULL) return NULL; - } if (emfs->name_entry) { - CamelProvider *provider; - CamelURL *url; - - provider = camel_provider_get (uri, NULL); + const gchar *name; + gchar *temp_uri; name = gtk_entry_get_text (emfs->name_entry); + temp_uri = g_strconcat (uri, "/", name, NULL); - url = camel_url_new (uri, NULL); - if (provider && (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH)) { - gchar *path; - - if (url->fragment) - path = g_strdup_printf ("%s/%s", url->fragment, name); - else - path = g_strdup (name); - - camel_url_set_fragment (url, path); - g_free (path); - } else { - gchar *path; - - path = g_strdup_printf ( - "%s/%s", (url->path == NULL || - strcmp (url->path, "/") == 0) ? "": - url->path, name); - camel_url_set_path (url, path); - g_free (path); - } - - g_free (emfs->selected_uri); - emfs->selected_uri = camel_url_to_string (url, 0); - - camel_url_free (url); - uri = emfs->selected_uri; + g_free (uri); + uri = temp_uri; } + g_free (emfs->selected_uri); + emfs->selected_uri = uri; /* takes ownership */ + return uri; } |