aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorChenthill Palanisamy <pchenthill@novell.com>2010-06-17 14:22:09 +0800
committerChenthill Palanisamy <pchenthill@novell.com>2010-06-17 14:23:14 +0800
commit61215065cabb95ca45702ab15be1e80af4a0489e (patch)
tree0926f59513501ba498411d500e79bd14b595c270 /plugins
parent8dc6fd1344965e5bd0940e99be3af9be26e3f9bb (diff)
downloadgsoc2013-evolution-61215065cabb95ca45702ab15be1e80af4a0489e.tar.gz
gsoc2013-evolution-61215065cabb95ca45702ab15be1e80af4a0489e.tar.zst
gsoc2013-evolution-61215065cabb95ca45702ab15be1e80af4a0489e.zip
Warn the user before marking all messages as read
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mark-all-read/mark-all-read.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index e152ec1c9f..826a596be6 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -44,6 +44,12 @@
N_("Do you want to mark messages as read in the current folder " \
"only, or in the current folder as well as all subfolders?")
+enum {
+ MARK_ALL_READ_CANCEL,
+ MARK_ALL_READ_CURRENT_FOLDER,
+ MARK_ALL_READ_WITH_SUBFOLDERS
+};
+
gboolean e_plugin_ui_init (GtkUIManager *ui_manager,
EShellView *shell_view);
gint e_plugin_lib_enable (EPlugin *ep, gint enable);
@@ -88,7 +94,7 @@ prompt_user (gboolean has_subfolders)
GtkWidget *widget;
GtkWidget *vbox;
gchar *markup;
- gint response;
+ gint response, ret;
if (!has_subfolders) {
EShell *shell;
@@ -99,7 +105,7 @@ prompt_user (gboolean has_subfolders)
return em_utils_prompt_user (
parent, NULL, "mail:ask-mark-all-read", NULL) ?
- GTK_RESPONSE_NO : GTK_RESPONSE_CANCEL;
+ MARK_ALL_READ_CURRENT_FOLDER : MARK_ALL_READ_CANCEL;
}
dialog = gtk_dialog_new ();
@@ -213,7 +219,14 @@ prompt_user (gboolean has_subfolders)
gtk_widget_destroy (dialog);
- return response;
+ if (response == GTK_RESPONSE_YES)
+ ret = MARK_ALL_READ_WITH_SUBFOLDERS;
+ else if (response == GTK_RESPONSE_NO)
+ ret = MARK_ALL_READ_CURRENT_FOLDER;
+ else
+ ret = MARK_ALL_READ_CANCEL;
+
+ return ret;
}
static gboolean
@@ -383,14 +396,14 @@ mar_got_folder (gchar *folder_uri,
if (camel_exception_is_set (&ex))
goto exit;
- if (scan_folder_tree_for_unread (folder_uri) > 1)
- response = prompt_user (folder_info->child != NULL);
- else
- response = GTK_RESPONSE_NO;
+ response = prompt_user (folder_info->child != NULL);
+
+ if (response == MARK_ALL_READ_CANCEL)
+ return;
- if (response == GTK_RESPONSE_NO)
+ if (response == MARK_ALL_READ_CURRENT_FOLDER)
mark_all_as_read (folder);
- else if (response == GTK_RESPONSE_YES)
+ else if (response == MARK_ALL_READ_WITH_SUBFOLDERS)
mar_all_sub_folders (parent_store, folder_info, &ex);
exit: