aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-folder-pane.c4
-rw-r--r--mail/e-mail-paned-view.c2
-rw-r--r--mail/e-mail-reader-utils.c4
-rw-r--r--mail/e-mail-reader.c6
-rw-r--r--mail/em-composer-utils.c7
-rw-r--r--mail/em-folder-tree-model.c2
-rw-r--r--mail/em-utils.c16
-rw-r--r--mail/em-utils.h2
-rw-r--r--mail/mail-folder-cache.c7
9 files changed, 24 insertions, 26 deletions
diff --git a/mail/e-mail-folder-pane.c b/mail/e-mail-folder-pane.c
index 12123128e1..4035e48ae7 100644
--- a/mail/e-mail-folder-pane.c
+++ b/mail/e-mail-folder-pane.c
@@ -90,7 +90,7 @@ mail_paned_view_open_selected_mail (EMailPanedView *view)
folder = e_mail_reader_get_folder (reader);
folder_uri = e_mail_reader_get_folder_uri (reader);
- if (em_utils_folder_is_drafts (folder, folder_uri) ||
+ if (em_utils_folder_is_drafts (folder) ||
em_utils_folder_is_outbox (folder, folder_uri) ||
em_utils_folder_is_templates (folder, folder_uri)) {
em_utils_edit_messages (shell, folder, uids, TRUE);
@@ -120,7 +120,7 @@ mail_paned_view_open_selected_mail (EMailPanedView *view)
(CamelVeeMessageInfo *) info, &real_uid);
real_folder_uri = camel_folder_get_uri (real_folder);
- if (em_utils_folder_is_drafts (real_folder, real_folder_uri) ||
+ if (em_utils_folder_is_drafts (real_folder) ||
em_utils_folder_is_outbox (real_folder, real_folder_uri)) {
GPtrArray *edits;
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index 62d3e67c8e..06da0a02dd 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -782,7 +782,7 @@ mail_paned_view_update_view_instance (EMailView *view)
e_filename_make_safe (view_id);
outgoing_folder =
- em_utils_folder_is_drafts (folder, folder_uri) ||
+ em_utils_folder_is_drafts (folder) ||
em_utils_folder_is_outbox (folder, folder_uri) ||
em_utils_folder_is_sent (folder, folder_uri);
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 7f7d57d438..9be062d9c9 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -241,7 +241,7 @@ e_mail_reader_open_selected (EMailReader *reader)
return 0;
}
- if (em_utils_folder_is_drafts (folder, folder_uri) ||
+ if (em_utils_folder_is_drafts (folder) ||
em_utils_folder_is_outbox (folder, folder_uri) ||
em_utils_folder_is_templates (folder, folder_uri)) {
em_utils_edit_messages (shell, folder, uids, TRUE);
@@ -272,7 +272,7 @@ e_mail_reader_open_selected (EMailReader *reader)
(CamelVeeMessageInfo *) info, &real_uid);
real_folder_uri = camel_folder_get_uri (real_folder);
- if (em_utils_folder_is_drafts (real_folder, real_folder_uri) ||
+ if (em_utils_folder_is_drafts (real_folder) ||
em_utils_folder_is_outbox (real_folder, real_folder_uri)) {
GPtrArray *edits;
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index b9e77b825c..c3ad3165ed 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -924,7 +924,7 @@ action_mail_message_edit_cb (GtkAction *action,
shell_backend = E_SHELL_BACKEND (backend);
shell = e_shell_backend_get_shell (shell_backend);
- replace = em_utils_folder_is_drafts (folder, folder_uri);
+ replace = em_utils_folder_is_drafts (folder);
em_utils_edit_messages (shell, folder, uids, replace);
}
@@ -2930,7 +2930,7 @@ mail_reader_set_folder (EMailReader *reader,
folder_uri = camel_folder_get_uri (folder);
outgoing = folder != NULL && folder_uri != NULL && (
- em_utils_folder_is_drafts (folder, folder_uri) ||
+ em_utils_folder_is_drafts (folder) ||
em_utils_folder_is_outbox (folder, folder_uri) ||
em_utils_folder_is_sent (folder, folder_uri));
@@ -3806,7 +3806,7 @@ e_mail_reader_check_state (EMailReader *reader)
}
drafts_or_outbox =
- em_utils_folder_is_drafts (folder, folder_uri) ||
+ em_utils_folder_is_drafts (folder) ||
em_utils_folder_is_outbox (folder, folder_uri);
/* Initialize this flag based on whether there are any
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 31a40293e4..68d5c004d7 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1138,14 +1138,13 @@ edit_message (EShell *shell,
composer = e_msg_composer_new_with_message (shell, message, NULL);
- if (message_uid != NULL) {
+ if (message_uid != NULL && em_utils_folder_is_drafts (folder)) {
const gchar *folder_uri;
folder_uri = camel_folder_get_uri (folder);
- if (em_utils_folder_is_drafts (folder, folder_uri))
- e_msg_composer_set_draft_headers (
- composer, folder_uri, message_uid);
+ e_msg_composer_set_draft_headers (
+ composer, folder_uri, message_uid);
}
composer_set_no_change (composer);
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 072f5e448b..4240dc06f0 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -694,7 +694,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model,
unread = fi->unread;
if (mail_folder_cache_get_folder_from_uri (
folder_cache, fi->uri, &folder) && folder) {
- is_drafts = em_utils_folder_is_drafts (folder, fi->uri);
+ is_drafts = em_utils_folder_is_drafts (folder);
if (is_drafts || em_utils_folder_is_outbox (folder, fi->uri)) {
gint total;
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 676a0f69db..ba496dcae9 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1051,22 +1051,24 @@ em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri)
/**
* em_utils_folder_is_drafts:
- * @folder: folder
- * @uri: uri for this folder, if known
+ * @folder: a #CamelFolder
*
* Decides if @folder is a Drafts folder.
*
* Returns %TRUE if this is a Drafts folder or %FALSE otherwise.
**/
gboolean
-em_utils_folder_is_drafts (CamelFolder *folder, const gchar *uri)
+em_utils_folder_is_drafts (CamelFolder *folder)
{
CamelFolder *local_drafts_folder;
CamelSession *session;
CamelStore *store;
EAccountList *account_list;
EIterator *iterator;
- gint is_drafts = FALSE;
+ gchar *folder_uri;
+ gboolean is_drafts = FALSE;
+
+ g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
local_drafts_folder =
e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_DRAFTS);
@@ -1074,8 +1076,7 @@ em_utils_folder_is_drafts (CamelFolder *folder, const gchar *uri)
if (folder == local_drafts_folder)
return TRUE;
- if (folder == NULL || uri == NULL)
- return FALSE;
+ folder_uri = e_mail_folder_uri_from_folder (folder);
store = camel_folder_get_parent_store (folder);
session = camel_service_get_session (CAMEL_SERVICE (store));
@@ -1095,7 +1096,7 @@ em_utils_folder_is_drafts (CamelFolder *folder, const gchar *uri)
drafts_uri = em_uri_to_camel (
account->drafts_folder_uri);
is_drafts = e_mail_folder_uri_equal (
- session, drafts_uri, uri);
+ session, drafts_uri, folder_uri);
g_free (drafts_uri);
}
@@ -1103,6 +1104,7 @@ em_utils_folder_is_drafts (CamelFolder *folder, const gchar *uri)
}
g_object_unref (iterator);
+ g_free (folder_uri);
return is_drafts;
}
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 12fa7b36d5..744bfe64c3 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -62,7 +62,7 @@ void em_utils_selection_get_uidlist (GtkSelectionData *data, EMailSession *sessi
void em_utils_selection_set_urilist (GtkSelectionData *data, CamelFolder *folder, GPtrArray *uids);
void em_utils_selection_get_urilist (GtkSelectionData *data, CamelFolder *folder);
-gboolean em_utils_folder_is_drafts (CamelFolder *folder, const gchar *uri);
+gboolean em_utils_folder_is_drafts (CamelFolder *folder);
gboolean em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri);
gboolean em_utils_folder_is_sent (CamelFolder *folder, const gchar *uri);
gboolean em_utils_folder_is_outbox (CamelFolder *folder, const gchar *uri);
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 1a6e48da1d..c23030bdb4 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -264,8 +264,7 @@ update_1folder (MailFolderCache *self,
d(printf("update 1 folder '%s'\n", folder->full_name));
if ((self->priv->count_trash && (CAMEL_IS_VTRASH_FOLDER (folder)))
- || (is_drafts = em_utils_folder_is_drafts (
- folder, info ? info->uri : NULL))
+ || (is_drafts = em_utils_folder_is_drafts (folder))
|| (is_outbox = em_utils_folder_is_outbox (
folder, info ? info->uri : NULL))
|| (self->priv->count_sent && em_utils_folder_is_sent (
@@ -289,9 +288,7 @@ update_1folder (MailFolderCache *self,
else
unread = camel_folder_get_unread_message_count (folder);
}
- } else if (info && !em_utils_folder_is_drafts (NULL, info->uri) &&
- !em_utils_folder_is_outbox (NULL, info->uri))
- unread = info->unread;
+ }
d(printf("folder updated: unread %d: '%s'\n", unread, mfi->full_name));