aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-callbacks.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-04-25 21:46:45 +0800
committerDan Winship <danw@src.gnome.org>2001-04-25 21:46:45 +0800
commite27847398ef1ca04e0bd944e9d2245570e373541 (patch)
treebdc2b611b8f0d01f2da22b37eccf997a9c2abe61 /mail/mail-callbacks.c
parentb024121e896a03f60f92496b9ed5df259547aa7a (diff)
downloadgsoc2013-evolution-e27847398ef1ca04e0bd944e9d2245570e373541.tar.gz
gsoc2013-evolution-e27847398ef1ca04e0bd944e9d2245570e373541.tar.zst
gsoc2013-evolution-e27847398ef1ca04e0bd944e9d2245570e373541.zip
New foot-shooting-prevention helper function. (edit_msg_internal,
* mail-callbacks.c (are_you_sure): New foot-shooting-prevention helper function. (edit_msg_internal, view_msg): If the user has more than 10 messages selected, ask before opening them all in separate windows, to protect against misclicks/typos after "select all" (which we've had at least two reports of now). svn path=/trunk/; revision=9559
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r--mail/mail-callbacks.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 722d8c9a7e..6919ac32e9 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -1121,6 +1121,26 @@ is_drafts_folder (CamelFolder *folder)
return FALSE;
}
+static gboolean
+are_you_sure (const char *msg, GPtrArray *uids, FolderBrowser *fb)
+{
+ GtkWidget *window = gtk_widget_get_ancestor (fb, GTK_TYPE_WINDOW);
+ GtkWidget *dialog;
+ char *buf;
+ int button, i;
+
+ buf = g_strdup_printf (msg, uids->len);
+ dialog = gnome_ok_cancel_dialog_parented (buf, NULL, NULL, (GtkWindow *)window);
+ button = gnome_dialog_run_and_close (dialog);
+ if (button != 0) {
+ for (i = 0; i < uids->len; i++)
+ g_free (uids->pdata[i]);
+ g_ptr_array_free (uids, TRUE);
+ }
+
+ return button == 0;
+}
+
static void
edit_msg_internal (FolderBrowser *fb)
{
@@ -1132,6 +1152,9 @@ edit_msg_internal (FolderBrowser *fb)
uids = g_ptr_array_new ();
message_list_foreach (fb->message_list, enumerate_msg, uids);
+ if (uids->len > 10 && !are_you_sure (_("Are you sure you want to edit all %d messages?"), uids, fb))
+ return;
+
mail_get_messages (fb->folder, uids, do_edit_messages, fb);
}
@@ -1546,6 +1569,10 @@ view_msg (GtkWidget *widget, gpointer user_data)
uids = g_ptr_array_new ();
message_list_foreach (fb->message_list, enumerate_msg, uids);
+
+ if (uids->len > 10 && !are_you_sure (_("Are you sure you want to open all %d messages in separate windows?"), uids, fb))
+ return;
+
for (i = 0; i < uids->len; i++) {
mail_get_message (fb->folder, uids->pdata [i], do_view_message, fb, mail_thread_queued);
g_free (uids->pdata [i]);