aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-shell-content.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/e-mail-shell-content.c')
-rw-r--r--mail/e-mail-shell-content.c123
1 files changed, 1 insertions, 122 deletions
diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c
index d0d51baf1b..747794b662 100644
--- a/mail/e-mail-shell-content.c
+++ b/mail/e-mail-shell-content.c
@@ -238,128 +238,7 @@ mail_shell_content_constructed (GObject *object)
static guint32
mail_shell_content_check_state (EShellContent *shell_content)
{
- EMailReader *reader;
- EMailShellContent *mail_shell_content;
- MessageList *message_list;
- GPtrArray *uids;
- CamelFolder *folder;
- CamelStore *store;
- const gchar *folder_uri;
- const gchar *tag;
- gboolean can_clear_flags = FALSE;
- gboolean can_flag_completed = FALSE;
- gboolean can_flag_for_followup = FALSE;
- gboolean has_deleted = FALSE;
- gboolean has_important = FALSE;
- gboolean has_junk = FALSE;
- gboolean has_not_junk = FALSE;
- gboolean has_read = FALSE;
- gboolean has_undeleted = FALSE;
- gboolean has_unimportant = FALSE;
- gboolean has_unread = FALSE;
- gboolean draft_or_outbox;
- guint32 state = 0;
- guint ii;
-
- reader = E_MAIL_READER (shell_content);
- message_list = e_mail_reader_get_message_list (reader);
- mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content);
- uids = message_list_get_selected (message_list);
- folder_uri = message_list->folder_uri;
- folder = message_list->folder;
- store = CAMEL_STORE (folder->parent_store);
-
- draft_or_outbox =
- em_utils_folder_is_drafts (folder, folder_uri) ||
- em_utils_folder_is_outbox (folder, folder_uri);
- if (!draft_or_outbox) {
- has_junk = !(store->flags & CAMEL_STORE_VJUNK);
- has_not_junk = TRUE;
- }
-
- for (ii = 0; ii < uids->len; ii++) {
- CamelMessageInfo *info;
- guint32 flags;
-
- info = camel_folder_get_message_info (
- folder, uids->pdata[ii]);
- if (info == NULL)
- continue;
-
- flags = camel_message_info_flags (info);
-
- if (flags & CAMEL_MESSAGE_SEEN)
- has_read = TRUE;
- else
- has_unread = TRUE;
-
- if (flags & CAMEL_MESSAGE_DELETED)
- has_deleted = TRUE;
- else
- has_undeleted = TRUE;
-
- if (flags & CAMEL_MESSAGE_FLAGGED)
- has_important = TRUE;
- else
- has_unimportant = TRUE;
-
- tag = camel_message_info_user_tag (info, "follow-up");
- if (tag != NULL && *tag != '\0') {
- can_clear_flags = TRUE;
- tag = camel_message_info_user_tag (
- info, "completed-on");
- if (tag != NULL && *tag != '\0')
- can_flag_completed = TRUE;
- } else
- can_flag_for_followup = TRUE;
- }
-
- if (uids->len == 1)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_SINGLE;
- if (uids->len > 1)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_MULTIPLE;
- if (!draft_or_outbox && uids->len == 1)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_CAN_ADD_SENDER;
-#if 0 /* FIXME */
- if (can_edit)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_CAN_EDIT;
-#endif
- if (can_clear_flags)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_FLAG_CLEAR;
- if (can_flag_completed)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_FLAG_COMPLETED;
- if (can_flag_for_followup)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_FLAG_FOLLOWUP;
- if (has_deleted)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_HAS_DELETED;
- if (has_important)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_HAS_IMPORTANT;
- if (has_junk)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_HAS_JUNK;
- if (has_not_junk)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_HAS_NOT_JUNK;
- if (has_read)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_HAS_READ;
- if (has_undeleted)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_HAS_UNDELETED;
- if (has_unimportant)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_HAS_UNIMPORTANT;
- if (has_unread)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_HAS_UNREAD;
-#if 0 /* FIXME */
- if (has_callto_uri)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_HAS_URI_CALLTO;
- if (has_http_uri)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_HAS_URI_HTTP;
- if (has_mailto_uri)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_HAS_URI_MAILTO;
- if (is_mailing_list)
- state |= E_MAIL_SHELL_CONTENT_SELECTION_IS_MAILING_LIST;
-#endif
-
- em_utils_uids_free (uids);
-
- return state;
+ return e_mail_reader_check_state (E_MAIL_READER (shell_content));
}
static GtkActionGroup *