Commit 9cf4104e authored by Matthew Barnes's avatar Matthew Barnes Committed by Rodrigo Moya
Browse files

Drop 'folder_uri' param from em_utils_folder_is_drafts().

parent 0341ec5c
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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));
......
......@@ -1169,7 +1169,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
num_junked), num_junked);
/* "Drafts" folder */
} else if (em_utils_folder_is_drafts (folder, folder_uri)) {
} else if (em_utils_folder_is_drafts (folder)) {
g_string_append_printf (
buffer, ngettext ("%d draft", "%d drafts",
num_visible), num_visible);
......
......@@ -2286,7 +2286,7 @@ in_proper_folder (CamelFolder *folder)
/* or anything else except of sent, outbox or drafts folder */
(!em_utils_folder_is_sent (folder, folder_uri) &&
!em_utils_folder_is_outbox (folder, folder_uri) &&
!em_utils_folder_is_drafts (folder, folder_uri))
!em_utils_folder_is_drafts (folder))
));
} else {
/* cannot check for Inbox folder here */
......@@ -2294,7 +2294,7 @@ in_proper_folder (CamelFolder *folder)
(CAMEL_IS_VEE_FOLDER (folder)) || (
!em_utils_folder_is_sent (folder, folder_uri) &&
!em_utils_folder_is_outbox (folder, folder_uri) &&
!em_utils_folder_is_drafts (folder, folder_uri)));
!em_utils_folder_is_drafts (folder)));
}
return res;
......
Supports Markdown
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