diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mark-all-read/mark-all-read.c | 31 |
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: |