Fix more places where old-style folder URIs are used.

This commit is contained in:
Matthew Barnes
2011-05-29 19:17:52 -04:00
parent 95ec5734c1
commit 96822fce5e
3 changed files with 20 additions and 50 deletions

View File

@ -62,8 +62,9 @@
#include "shell/e-shell.h"
#include "shell/e-shell-migrate.h"
#include "e-mail-store.h"
#include "e-mail-backend.h"
#include "e-mail-folder-utils.h"
#include "e-mail-store.h"
#include "em-utils.h"
#define d(x) x
@ -1009,6 +1010,7 @@ create_mbox_account (EShellBackend *shell_backend,
{
EMailBackend *mail_backend;
EMailSession *mail_session;
CamelStore *store;
CamelURL *url;
EAccountList *accounts;
EAccount *account;
@ -1053,20 +1055,19 @@ create_mbox_account (EShellBackend *shell_backend,
goto exit;
}
camel_url_set_fragment (url, "Sent");
folder_uri = camel_url_to_string (url, 0);
e_account_list_add (accounts, account);
store = e_mail_store_add_by_account (mail_session, account);
folder_uri = e_mail_folder_uri_build (store, "Sent");
e_account_set_string (
account, E_ACCOUNT_SENT_FOLDER_URI, folder_uri);
g_free (folder_uri);
camel_url_set_fragment (url, "Drafts");
folder_uri = camel_url_to_string (url, 0);
folder_uri = e_mail_folder_uri_build (store, "Drafts");
e_account_set_string (
account, E_ACCOUNT_DRAFTS_FOLDER_URI, folder_uri);
g_free (folder_uri);
e_account_list_add (accounts, account);
e_mail_store_add_by_account (mail_session, account);
e_account_list_save (accounts);
exit:

View File

@ -2040,27 +2040,24 @@ folder_tree_drop_folder (struct _DragDataReceivedAsync *m)
static gchar *
folder_tree_drop_async__desc (struct _DragDataReceivedAsync *m)
{
CamelURL *url;
const guchar *data;
gchar *buf;
data = gtk_selection_data_get_data (m->selection);
if (m->info == DND_DROP_TYPE_FOLDER) {
url = camel_url_new ((gchar *) data, NULL);
gchar *folder_name = NULL;
e_mail_folder_uri_parse (
CAMEL_SESSION (m->session),
(gchar *) data, NULL, &folder_name, NULL);
g_return_val_if_fail (folder_name != NULL, NULL);
if (m->move)
buf = g_strdup_printf (
_("Moving folder %s"), url->fragment ?
url->fragment : url->path + 1);
return g_strdup_printf (
_("Moving folder %s"), folder_name);
else
buf = g_strdup_printf (
_("Copying folder %s"), url->fragment ?
url->fragment : url->path + 1);
camel_url_free (url);
return buf;
return g_strdup_printf (
_("Copying folder %s"), folder_name);
} else {
if (m->move)
return g_strdup_printf (

View File

@ -546,34 +546,6 @@ store_folder_deleted_cb (CamelStore *store,
store_folder_unsubscribed_cb (store, info, self);
}
static gchar *
folder_to_url (CamelStore *store,
const gchar *full_name)
{
CamelProvider *provider;
CamelService *service;
CamelURL *url;
gchar *out;
service = CAMEL_SERVICE (store);
provider = camel_service_get_provider (service);
url = camel_url_copy (camel_service_get_camel_url (service));
if (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) {
camel_url_set_fragment (url, full_name);
} else {
gchar *name = g_alloca (strlen (full_name)+2);
sprintf(name, "/%s", full_name);
camel_url_set_path (url, name);
}
out = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
camel_url_free (url);
return out;
}
static void
rename_folders (MailFolderCache *self,
struct _store_info *si,
@ -633,9 +605,9 @@ rename_folders (MailFolderCache *self,
/* rename the meta-data we maintain ourselves */
config_dir = mail_session_get_config_dir ();
olduri = folder_to_url (si->store, old);
olduri = e_mail_folder_uri_build (si->store, old);
e_filename_make_safe (olduri);
newuri = folder_to_url (si->store, fi->full_name);
newuri = e_mail_folder_uri_build (si->store, fi->full_name);
e_filename_make_safe (newuri);
oldfile = g_strdup_printf("%s/custom_view-%s.xml", config_dir, olduri);
newfile = g_strdup_printf("%s/custom_view-%s.xml", config_dir, newuri);