[evolution] Fix em_folder_selector_get_selected_uri().



commit c27a45ecf0351bcc8626f832090f855e1b385af3
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue May 24 23:04:16 2011 -0400

    Fix em_folder_selector_get_selected_uri().
    
    Another case of custom logic to build old-style folder URIs.
    The new format simplifies things considerably.

 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 0ec0428..b01b305 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;
 }



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