[evolution] Bug 563555 - Confirm before forwarding many emails inline
- From: Matthew Barnes <mbarnes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution] Bug 563555 - Confirm before forwarding many emails inline
- Date: Thu, 19 Nov 2009 21:09:34 +0000 (UTC)
commit 82e862889dce6540714a90444473454e3ef9c66b
Author: Ritesh Khadgaray <khadgaray gmail com>
Date: Thu Nov 19 16:08:34 2009 -0500
Bug 563555 - Confirm before forwarding many emails inline
mail/e-mail-reader-utils.c | 19 +++----------------
mail/e-mail-reader.c | 24 ++++++++++++++++++++----
mail/em-utils.c | 23 +++++++++++++++++++++++
mail/em-utils.h | 1 +
4 files changed, 47 insertions(+), 20 deletions(-)
---
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 3cfc3b3..2e63418 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -209,22 +209,9 @@ e_mail_reader_open_selected (EMailReader *reader)
folder_uri = message_list->folder_uri;
uids = message_list_get_selected (message_list);
- if (uids->len >= 10) {
- gchar *len_str;
- gboolean proceed;
-
- len_str = g_strdup_printf ("%d", uids->len);
-
- proceed = em_utils_prompt_user (
- window, "/apps/evolution/mail/prompts/open_many",
- "mail:ask-open-many", len_str, NULL);
-
- g_free (len_str);
-
- if (!proceed) {
- message_list_free_uids (message_list, uids);
- return 0;
- }
+ if (!em_utils_ask_open_many (window, uids->len)) {
+ message_list_free_uids (message_list, uids);
+ return 0;
}
if (em_utils_folder_is_drafts (folder, folder_uri) ||
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 73e2621..847ffd2 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -386,8 +386,12 @@ action_mail_forward_cb (GtkAction *action,
folder = message_list->folder;
folder_uri = message_list->folder_uri;
uids = message_list_get_selected (message_list);
+ g_return_if_fail (uids != NULL);
- em_utils_forward_messages (folder, uids, folder_uri);
+ if (em_utils_ask_open_many (window, uids->len))
+ em_utils_forward_messages (folder, uids, folder_uri);
+ else
+ message_list_free_uids (message_list, uids);
}
static void
@@ -406,8 +410,12 @@ action_mail_forward_attached_cb (GtkAction *action,
folder = message_list->folder;
folder_uri = message_list->folder_uri;
uids = message_list_get_selected (message_list);
+ g_return_if_fail (uids != NULL);
- em_utils_forward_attached (folder, uids, folder_uri);
+ if (em_utils_ask_open_many (window, uids->len))
+ em_utils_forward_attached (folder, uids, folder_uri);
+ else
+ message_list_free_uids (message_list, uids);
}
static void
@@ -426,8 +434,12 @@ action_mail_forward_inline_cb (GtkAction *action,
folder = message_list->folder;
folder_uri = message_list->folder_uri;
uids = message_list_get_selected (message_list);
+ g_return_if_fail (uids != NULL);
- em_utils_forward_inline (folder, uids, folder_uri);
+ if (em_utils_ask_open_many (window, uids->len))
+ em_utils_forward_inline (folder, uids, folder_uri);
+ else
+ message_list_free_uids (message_list, uids);
}
static void
@@ -446,8 +458,12 @@ action_mail_forward_quoted_cb (GtkAction *action,
folder = message_list->folder;
folder_uri = message_list->folder_uri;
uids = message_list_get_selected (message_list);
+ g_return_if_fail (uids != NULL);
- em_utils_forward_quoted (folder, uids, folder_uri);
+ if (em_utils_ask_open_many (window, uids->len))
+ em_utils_forward_quoted (folder, uids, folder_uri);
+ else
+ message_list_free_uids (message_list, uids);
}
static void
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 407c686..1ccea47 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -79,6 +79,10 @@
#include "em-format-quote.h"
#include "e-mail-local.h"
+/* How many is too many? */
+/* Used in em_util_ask_open_many() */
+#define TOO_MANY 10
+
static void emu_save_part_done (CamelMimePart *part, gchar *name, gint done, gpointer data);
#define d(x)
@@ -113,6 +117,25 @@ em_utils_get_config_dir (void)
return e_shell_backend_get_config_dir (shell_backend);
}
+gboolean
+em_utils_ask_open_many (GtkWindow *parent,
+ gint how_many)
+{
+ gchar *string;
+ gboolean proceed;
+
+ if (how_many < TOO_MANY)
+ return TRUE;
+
+ string = g_strdup_printf ("%d", how_many);
+ proceed = em_utils_prompt_user (
+ parent, "/apps/evolution/mail/prompts/open_many",
+ "mail:ask-open-many", string, NULL);
+ g_free (string);
+
+ return proceed;
+}
+
/**
* em_utils_prompt_user:
* @parent: parent window
diff --git a/mail/em-utils.h b/mail/em-utils.h
index b61dce3..5cf3dfa 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -41,6 +41,7 @@ struct _EMFormat;
const gchar * em_utils_get_data_dir (void);
const gchar * em_utils_get_config_dir (void);
+gboolean em_utils_ask_open_many (GtkWindow *parent, gint how_many);
gboolean em_utils_prompt_user(GtkWindow *parent, const gchar *promptkey, const gchar *tag, const gchar *arg0, ...);
GPtrArray *em_utils_uids_copy (GPtrArray *uids);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]