[evolution] I#1716 - Mail: Show an error message on Archive when the Archive folder is not set
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#1716 - Mail: Show an error message on Archive when the Archive folder is not set
- Date: Thu, 2 Dec 2021 11:21:41 +0000 (UTC)
commit ec139ea507f1656f7fcaba5f83a26dee1fcf6a34
Author: Milan Crha <mcrha redhat com>
Date: Thu Dec 2 12:20:04 2021 +0100
I#1716 - Mail: Show an error message on Archive when the Archive folder is not set
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1716
src/mail/e-mail-reader.c | 23 +++++++++++------------
src/mail/e-mail-reader.h | 1 -
src/mail/mail.error.xml | 5 +++++
3 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/src/mail/e-mail-reader.c b/src/mail/e-mail-reader.c
index b7473648f0..4c9210b5a0 100644
--- a/src/mail/e-mail-reader.c
+++ b/src/mail/e-mail-reader.c
@@ -1282,10 +1282,19 @@ action_mail_archive_cb (GtkAction *action,
folder = e_mail_reader_ref_folder (reader);
archive_folder = em_utils_get_archive_folder_uri_from_folder (folder, backend, uids, TRUE);
- if (archive_folder != NULL)
+ if (archive_folder && *archive_folder) {
mail_transfer_messages (
session, folder, uids,
TRUE, archive_folder, 0, NULL, NULL);
+ } else {
+ EAlertSink *alert_sink;
+
+ alert_sink = e_mail_reader_get_alert_sink (reader);
+
+ e_alert_submit (
+ alert_sink, "mail:no-archive-folder",
+ NULL);
+ }
g_clear_object (&folder);
g_ptr_array_unref (uids);
@@ -4556,7 +4565,7 @@ mail_reader_update_actions (EMailReader *reader,
gtk_action_set_sensitive (action, sensitive);
action_name = "mail-archive";
- sensitive = any_messages_selected && (state & E_MAIL_READER_FOLDER_ARCHIVE_FOLDER_SET) != 0;
+ sensitive = any_messages_selected;
action = e_mail_reader_get_action (reader, action_name);
gtk_action_set_sensitive (action, sensitive);
@@ -5470,7 +5479,6 @@ e_mail_reader_check_state (EMailReader *reader)
gboolean is_mailing_list;
gboolean is_junk_folder = FALSE;
gboolean is_vtrash_folder = FALSE;
- gboolean archive_folder_set = FALSE;
guint32 state = 0;
guint ii;
@@ -5487,7 +5495,6 @@ e_mail_reader_check_state (EMailReader *reader)
uids = e_mail_reader_get_selected_uids_with_collapsed_threads (reader);
if (folder != NULL) {
- gchar *archive_folder;
guint32 folder_flags;
store = camel_folder_get_parent_store (folder);
@@ -5497,12 +5504,6 @@ e_mail_reader_check_state (EMailReader *reader)
drafts_or_outbox =
em_utils_folder_is_drafts (registry, folder) ||
em_utils_folder_is_outbox (registry, folder);
-
- archive_folder = em_utils_get_archive_folder_uri_from_folder (folder, backend, uids, TRUE);
- if (archive_folder && *archive_folder)
- archive_folder_set = TRUE;
-
- g_free (archive_folder);
}
/* Initialize this flag based on whether there are any
@@ -5634,8 +5635,6 @@ e_mail_reader_check_state (EMailReader *reader)
state |= E_MAIL_READER_FOLDER_IS_JUNK;
if (is_vtrash_folder)
state |= E_MAIL_READER_FOLDER_IS_VTRASH;
- if (archive_folder_set)
- state |= E_MAIL_READER_FOLDER_ARCHIVE_FOLDER_SET;
if (has_mail_note)
state |= E_MAIL_READER_SELECTION_HAS_MAIL_NOTE;
if (has_color)
diff --git a/src/mail/e-mail-reader.h b/src/mail/e-mail-reader.h
index 05818e9a07..ce0ced4927 100644
--- a/src/mail/e-mail-reader.h
+++ b/src/mail/e-mail-reader.h
@@ -89,7 +89,6 @@ enum {
E_MAIL_READER_SELECTION_IS_MAILING_LIST = 1 << 16,
E_MAIL_READER_FOLDER_IS_JUNK = 1 << 17,
E_MAIL_READER_FOLDER_IS_VTRASH = 1 << 18,
- E_MAIL_READER_FOLDER_ARCHIVE_FOLDER_SET = 1 << 19,
E_MAIL_READER_SELECTION_HAS_IGNORE_THREAD = 1 << 20,
E_MAIL_READER_SELECTION_HAS_NOTIGNORE_THREAD = 1 << 21,
E_MAIL_READER_SELECTION_HAS_MAIL_NOTE = 1 << 22,
diff --git a/src/mail/mail.error.xml b/src/mail/mail.error.xml
index fee493ff84..421bf1f587 100644
--- a/src/mail/mail.error.xml
+++ b/src/mail/mail.error.xml
@@ -656,4 +656,9 @@ in the folder will be available in offline mode.</_secondary>
<_primary>Failed to empty Junk folder “{0}”</_primary>
<secondary>{1}</secondary>
</error>
+
+ <error id="no-archive-folder" type="error">
+ <_primary>Cannot archive messages</_primary>
+ <_secondary>No Archive folder is configured. Please configure one for the account in order to be able to
archive messages.</_secondary>
+ </error>
</error-list>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]