aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRitesh Khadgaray <khadgaray@gmail.com>2009-11-20 05:08:34 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-11-20 05:08:34 +0800
commit82e862889dce6540714a90444473454e3ef9c66b (patch)
tree19da02f512fdffd883177460cfaba0bbfeacd76c
parentf11f1c477dfbdbe666ad5627ad44ac95bd7c816f (diff)
downloadgsoc2013-evolution-82e862889dce6540714a90444473454e3ef9c66b.tar.gz
gsoc2013-evolution-82e862889dce6540714a90444473454e3ef9c66b.tar.zst
gsoc2013-evolution-82e862889dce6540714a90444473454e3ef9c66b.zip
BugĀ 563555 - Confirm before forwarding many emails inline
-rw-r--r--mail/e-mail-reader-utils.c19
-rw-r--r--mail/e-mail-reader.c24
-rw-r--r--mail/em-utils.c23
-rw-r--r--mail/em-utils.h1
4 files changed, 47 insertions, 20 deletions
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 3cfc3b3e87..2e634186aa 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 73e2621a26..847ffd2aa0 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 407c686a21..1ccea47a8d 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 b61dce395a..5cf3dfa851 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);