aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-12 10:08:12 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-13 01:59:00 +0800
commited45d23b84053e1c341db3eb5520311d314ca1ae (patch)
treec91d6e794d79d9f1fe443a69a327c58212ea3ae2 /mail
parent4118d671d44b71592f0e91abb63f2468baaa9318 (diff)
downloadgsoc2013-evolution-ed45d23b84053e1c341db3eb5520311d314ca1ae.tar.gz
gsoc2013-evolution-ed45d23b84053e1c341db3eb5520311d314ca1ae.tar.zst
gsoc2013-evolution-ed45d23b84053e1c341db3eb5520311d314ca1ae.zip
Remove mail_tools_folder_to_url().
Use camel_folder_get_uri() instead.
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-folder-pane.c5
-rw-r--r--mail/e-mail-paned-view.c4
-rw-r--r--mail/e-mail-reader-utils.c5
-rw-r--r--mail/mail-config.c14
-rw-r--r--mail/mail-config.h2
-rw-r--r--mail/mail-folder-cache.c6
-rw-r--r--mail/mail-tools.c32
-rw-r--r--mail/mail-tools.h2
-rw-r--r--mail/message-list.c14
9 files changed, 18 insertions, 66 deletions
diff --git a/mail/e-mail-folder-pane.c b/mail/e-mail-folder-pane.c
index a8c2a3d971..54d5cc4c65 100644
--- a/mail/e-mail-folder-pane.c
+++ b/mail/e-mail-folder-pane.c
@@ -107,7 +107,7 @@ mail_paned_view_open_selected_mail (EMailPanedView *view)
const gchar *uid = uids->pdata[ii];
CamelFolder *real_folder;
CamelMessageInfo *info;
- gchar *real_folder_uri;
+ const gchar *real_folder_uri;
gchar *real_uid;
if (!CAMEL_IS_VEE_FOLDER (folder)) {
@@ -122,7 +122,7 @@ mail_paned_view_open_selected_mail (EMailPanedView *view)
real_folder = camel_vee_folder_get_location (
CAMEL_VEE_FOLDER (folder),
(CamelVeeMessageInfo *) info, &real_uid);
- real_folder_uri = mail_tools_folder_to_url (real_folder);
+ real_folder_uri = camel_folder_get_uri (real_folder);
if (em_utils_folder_is_drafts (real_folder, real_folder_uri) ||
em_utils_folder_is_outbox (real_folder, real_folder_uri)) {
@@ -137,7 +137,6 @@ mail_paned_view_open_selected_mail (EMailPanedView *view)
g_ptr_array_add (views, g_strdup (uid));
}
- g_free (real_folder_uri);
camel_folder_free_message_info (folder, info);
}
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index d63109d420..9782a8de6a 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -718,7 +718,9 @@ mail_paned_view_update_view_instance (EMailView *view)
priv->view_instance = NULL;
}
- view_id = mail_config_folder_to_safe_url (folder);
+ view_id = g_strdup (folder_uri);
+ e_filename_make_safe (view_id);
+
if (e_shell_settings_get_boolean (shell_settings, "mail-global-view-setting"))
view_instance = e_shell_view_new_view_instance (shell_view, "global_view_setting");
else
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 44351c2824..162e78bd36 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -260,7 +260,7 @@ e_mail_reader_open_selected (EMailReader *reader)
const gchar *uid = uids->pdata[ii];
CamelFolder *real_folder;
CamelMessageInfo *info;
- gchar *real_folder_uri;
+ const gchar *real_folder_uri;
gchar *real_uid;
if (!CAMEL_IS_VEE_FOLDER (folder)) {
@@ -275,7 +275,7 @@ e_mail_reader_open_selected (EMailReader *reader)
real_folder = camel_vee_folder_get_location (
CAMEL_VEE_FOLDER (folder),
(CamelVeeMessageInfo *) info, &real_uid);
- real_folder_uri = mail_tools_folder_to_url (real_folder);
+ real_folder_uri = camel_folder_get_uri (real_folder);
if (em_utils_folder_is_drafts (real_folder, real_folder_uri) ||
em_utils_folder_is_outbox (real_folder, real_folder_uri)) {
@@ -290,7 +290,6 @@ e_mail_reader_open_selected (EMailReader *reader)
g_ptr_array_add (views, g_strdup (uid));
}
- g_free (real_folder_uri);
camel_folder_free_message_info (folder, info);
}
diff --git a/mail/mail-config.c b/mail/mail-config.c
index a89722dbaf..fae6bda204 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -522,24 +522,14 @@ mail_config_service_set_save_passwd (EAccountService *service, gboolean save_pas
}
gchar *
-mail_config_folder_to_safe_url (CamelFolder *folder)
-{
- gchar *url;
-
- url = mail_tools_folder_to_url (folder);
- e_filename_make_safe (url);
-
- return url;
-}
-
-gchar *
mail_config_folder_to_cachename (CamelFolder *folder, const gchar *prefix)
{
gchar *url, *basename, *filename;
const gchar *config_dir;
config_dir = mail_session_get_config_dir ();
- url = mail_config_folder_to_safe_url (folder);
+ url = g_strdup (camel_folder_get_uri (folder));
+ e_filename_make_safe (url);
basename = g_strdup_printf ("%s%s", prefix, url);
filename = g_build_filename (config_dir, "folders", basename, NULL);
g_free (basename);
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 8fa7359adf..6c597a628e 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -94,8 +94,6 @@ EAccountService *
/* static utility functions */
gchar * mail_config_folder_to_cachename (CamelFolder *folder,
const gchar *prefix);
-gchar * mail_config_folder_to_safe_url (CamelFolder *folder);
-
gint mail_config_get_sync_timeout (void);
void mail_config_reload_junk_headers (CamelSession *session);
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 8aed1b5768..7ff29c3414 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -1327,7 +1327,7 @@ mail_folder_cache_get_folder_info_flags (MailFolderCache *self,
CamelFolder *folder,
gint *flags)
{
- gchar *uri = mail_tools_folder_to_url (folder);
+ const gchar *uri = camel_folder_get_uri (folder);
struct _find_info fi = { uri, NULL, NULL };
if (self->priv->stores == NULL)
@@ -1348,7 +1348,6 @@ mail_folder_cache_get_folder_info_flags (MailFolderCache *self,
g_mutex_unlock (self->priv->stores_mutex);
camel_url_free (fi.url);
- g_free (uri);
return fi.fi != NULL;
}
@@ -1360,7 +1359,7 @@ mail_folder_cache_get_folder_has_children (MailFolderCache *self,
CamelFolder *folder,
gboolean *found)
{
- gchar *uri = mail_tools_folder_to_url (folder);
+ const gchar *uri = camel_folder_get_uri (folder);
struct _find_info fi = { uri, NULL, NULL };
g_return_val_if_fail (self != NULL, FALSE);
@@ -1380,7 +1379,6 @@ mail_folder_cache_get_folder_has_children (MailFolderCache *self,
g_mutex_unlock (self->priv->stores_mutex);
camel_url_free (fi.url);
- g_free (uri);
return fi.fi != NULL && fi.fi->has_children;
}
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index c005c27f71..23b2a8cd27 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -232,35 +232,3 @@ mail_tool_make_message_attachment (CamelMimeMessage *message)
return part;
}
-
-/* FIXME: This should be a property on CamelFolder */
-gchar *
-mail_tools_folder_to_url (CamelFolder *folder)
-{
- CamelService *service;
- CamelStore *parent_store;
- const gchar *full_name;
- CamelURL *url;
- gchar *out;
-
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
-
- full_name = camel_folder_get_full_name (folder);
- parent_store = camel_folder_get_parent_store (folder);
- service = CAMEL_SERVICE (parent_store);
-
- url = camel_url_copy (service->url);
- if (service->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;
-}
diff --git a/mail/mail-tools.h b/mail/mail-tools.h
index 096ec7f337..f943d963cf 100644
--- a/mail/mail-tools.h
+++ b/mail/mail-tools.h
@@ -39,6 +39,4 @@ gchar *mail_tool_generate_forward_subject (CamelMimeMessage *msg);
/* Make a message into an attachment */
CamelMimePart *mail_tool_make_message_attachment (CamelMimeMessage *message);
-gchar *mail_tools_folder_to_url (CamelFolder *folder);
-
#endif
diff --git a/mail/message-list.c b/mail/message-list.c
index 5a9af96b6c..6200e8956a 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1646,7 +1646,8 @@ ml_tree_value_at_ex (ETreeModel *etm,
CamelURL *curl;
EAccount *account;
gchar *location = NULL;
- gchar *euri, *url;
+ const gchar *uri;
+ gchar *euri;
if (CAMEL_IS_VEE_FOLDER (message_list->folder)) {
folder = camel_vee_folder_get_location ((CamelVeeFolder *)message_list->folder, (CamelVeeMessageInfo *)msg_info, NULL);
@@ -1654,24 +1655,23 @@ ml_tree_value_at_ex (ETreeModel *etm,
folder = message_list->folder;
}
- url = mail_tools_folder_to_url (folder);
- euri = em_uri_from_camel (url);
+ uri = camel_folder_get_uri (folder);
+ euri = em_uri_from_camel (uri);
- account = mail_config_get_account_by_source_url (url);
+ account = mail_config_get_account_by_source_url (uri);
if (account) {
- curl = camel_url_new (url, NULL);
+ curl = camel_url_new (uri, NULL);
location = g_strconcat (account->name, ":", curl->path, NULL);
} else {
/* Local account */
- euri = em_uri_from_camel (url);
+ euri = em_uri_from_camel (uri);
curl = camel_url_new (euri, NULL);
if (curl->host && !strcmp(curl->host, "local") && curl->user && !strcmp(curl->user, "local"))
location = g_strconcat (_("On This Computer"), ":",curl->path, NULL);
}
camel_url_free (curl);
- g_free (url);
g_free (euri);
return location;