Commit ed45d23b authored by Matthew Barnes's avatar Matthew Barnes

Remove mail_tools_folder_to_url().

Use camel_folder_get_uri() instead.
parent 4118d671
......@@ -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);
}
......
......@@ -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
......
......@@ -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);
}
......
......@@ -521,17 +521,6 @@ mail_config_service_set_save_passwd (EAccountService *service, gboolean save_pas
service->save_passwd = save_passwd;
}
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)
{
......@@ -539,7 +528,8 @@ mail_config_folder_to_cachename (CamelFolder *folder, const gchar *prefix)
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);
......
......@@ -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);
......
......@@ -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;
}
......@@ -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;
}
......@@ -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
......@@ -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;
......
......@@ -603,13 +603,11 @@ all_accounts:
CAMEL_FOLDER (search_folder), list,
priv->search_account_cancel);
uri = mail_tools_folder_to_url (CAMEL_FOLDER (search_folder));
folder_uri = camel_folder_get_uri (CAMEL_FOLDER (search_folder));
mail_shell_view_show_search_results_folder (
E_MAIL_SHELL_VIEW (shell_view),
CAMEL_FOLDER (search_folder), uri);
g_free (uri);
CAMEL_FOLDER (search_folder), folder_uri);
goto execute;
......@@ -756,13 +754,11 @@ current_account:
CAMEL_FOLDER (search_folder), list,
priv->search_account_cancel);
uri = mail_tools_folder_to_url (CAMEL_FOLDER (search_folder));
folder_uri = camel_folder_get_uri (CAMEL_FOLDER (search_folder));
mail_shell_view_show_search_results_folder (
E_MAIL_SHELL_VIEW (shell_view),
CAMEL_FOLDER (search_folder), uri);
g_free (uri);
CAMEL_FOLDER (search_folder), folder_uri);
execute:
......
......@@ -2236,14 +2236,14 @@ check_is_instance (icalcomponent *icalcomp)
static gboolean
in_proper_folder (CamelFolder *folder)
{
const gchar *folder_uri;
gboolean res = TRUE;
gint flags = 0;
gchar *uri;
if (!folder)
return FALSE;
uri = mail_tools_folder_to_url (folder);
folder_uri = camel_folder_get_uri (folder);
if (mail_folder_cache_get_folder_info_flags (mail_folder_cache_get_default (),
folder, &flags)) {
......@@ -2255,21 +2255,19 @@ in_proper_folder (CamelFolder *folder)
/* or any other virtual folder */
CAMEL_IS_VEE_FOLDER (folder) ||
/* or anything else except of sent, outbox or drafts folder */
(!em_utils_folder_is_sent (folder, uri) &&
!em_utils_folder_is_outbox (folder, uri) &&
!em_utils_folder_is_drafts (folder, uri))
(!em_utils_folder_is_sent (folder, folder_uri) &&
!em_utils_folder_is_outbox (folder, folder_uri) &&
!em_utils_folder_is_drafts (folder, folder_uri))
));
} else {
/* cannot check for Inbox folder here */
res = (folder->folder_flags & (CAMEL_FOLDER_IS_TRASH | CAMEL_FOLDER_IS_JUNK)) == 0 && (
(CAMEL_IS_VEE_FOLDER (folder)) || (
!em_utils_folder_is_sent (folder, uri) &&
!em_utils_folder_is_outbox (folder, uri) &&
!em_utils_folder_is_drafts (folder, uri)));
!em_utils_folder_is_sent (folder, folder_uri) &&
!em_utils_folder_is_outbox (folder, folder_uri) &&
!em_utils_folder_is_drafts (folder, folder_uri)));
}
g_free (uri);
return res;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment