Fix marking all as (un)read recursively when the confirmation
authorwwp <wwp@free.fr>
Wed, 4 Jan 2017 10:14:15 +0000 (11:14 +0100)
committerwwp <wwp@free.fr>
Wed, 4 Jan 2017 10:14:15 +0000 (11:14 +0100)
dialogue is enabled and the user clicks No: confirmation dialog
was taken into account just for the current folder, subtree was
marked anyway, and this only under certain conditions that I'd
prefer not to list here becau<woosh>

src/folderutils.c
src/folderview.c
src/mainwindow.c
src/summaryview.c
src/summaryview.h
src/toolbar.c

index ce2fe3c..355af85 100644 (file)
@@ -132,7 +132,7 @@ void folderutils_mark_all_read(FolderItem *item)
        if (mainwin && mainwin->summaryview &&
            mainwin->summaryview->folder_item == item) {
                debug_print("folder opened, using summary\n");
-               summary_mark_all_read(mainwin->summaryview);
+               summary_mark_all_read(mainwin->summaryview, FALSE);
        } else {
                msglist = folder_item_get_msg_list(item);
                debug_print("got msglist %p\n", msglist);
@@ -172,7 +172,7 @@ void folderutils_mark_all_unread(FolderItem *item)
        if (mainwin && mainwin->summaryview &&
            mainwin->summaryview->folder_item == item) {
                debug_print("folder opened, using summary\n");
-               summary_mark_all_unread(mainwin->summaryview);
+               summary_mark_all_unread(mainwin->summaryview, FALSE);
        } else {
                msglist = folder_item_get_msg_list(item);
                debug_print("got msglist %p\n", msglist);
index 71391ef..d48a8de 100644 (file)
@@ -876,8 +876,7 @@ static void mark_all_read_unread_handler(GtkAction *action, gpointer data,
                                                        _("Do you really want to mark all mails in this "
                                                        "folder as unread?");
        }
-       if (folderview->summaryview->folder_item != item &&
-           prefs_common.ask_mark_all_read) {
+       if (prefs_common.ask_mark_all_read) {
                val = alertpanel_full(title, message,
                          GTK_STOCK_NO, GTK_STOCK_YES, NULL,
                          TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT);
index c6305bc..6c8aa07 100644 (file)
@@ -4479,13 +4479,13 @@ static void mark_as_unread_cb(GtkAction *action, gpointer data)
 static void mark_all_read_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_mark_all_read(mainwin->summaryview);
+       summary_mark_all_read(mainwin->summaryview, TRUE);
 }
 
 static void mark_all_unread_cb(GtkAction *action, gpointer data)
 {
        MainWindow *mainwin = (MainWindow *)data;
-       summary_mark_all_unread(mainwin->summaryview);
+       summary_mark_all_unread(mainwin->summaryview, TRUE);
 }
 
 static void mark_as_spam_cb(GtkAction *action, gpointer data)
index fd28235..5fa3e7f 100644 (file)
@@ -4141,14 +4141,16 @@ void summary_msgs_unlock(SummaryView *summaryview)
        summary_status_show(summaryview);
 }
 
-void summary_mark_all_read(SummaryView *summaryview)
+void summary_mark_all_read(SummaryView *summaryview, gboolean ask_if_needed)
 {
        GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GtkCMCTreeNode *node;
        AlertValue val;
        gboolean froze = FALSE;
 
-       if (prefs_common.ask_mark_all_read) {
+       /* ask_if_needed is FALSE when user-asking is performed by caller,
+          commonly when the caller is a mark-as-read-recursive func */
+       if (ask_if_needed && prefs_common.ask_mark_all_read) {
                val = alertpanel_full(_("Mark all as read"),
                          _("Do you really want to mark all mails in this folder as read?"),
                          GTK_STOCK_NO, GTK_STOCK_YES, NULL,
@@ -4178,15 +4180,17 @@ void summary_mark_all_read(SummaryView *summaryview)
        summary_status_show(summaryview);
 }
 
-void summary_mark_all_unread(SummaryView *summaryview)
+void summary_mark_all_unread(SummaryView *summaryview, gboolean ask_if_needed)
 {
        GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
        GtkCMCTreeNode *node;
        AlertValue val;
        gboolean froze = FALSE;
 
-       if (prefs_common.ask_mark_all_read) {
-               val = alertpanel_full(_("Mark all as unread"),
+       /* ask_if_needed is FALSE when user-asking is performed by caller,
+          commonly when the caller is a mark-as-unread-recursive func */
+       if (ask_if_needed && prefs_common.ask_mark_all_read) {
+               val = alertpanel_full(_("FOO Mark all as unread"),
                          _("Do you really want to mark all mails in this folder as unread?"),
                          GTK_STOCK_NO, GTK_STOCK_YES, NULL,
                          TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT);
index 66c0c4d..2d192e5 100644 (file)
@@ -276,8 +276,8 @@ void summary_mark_as_read     (SummaryView          *summaryview);
 void summary_mark_as_unread      (SummaryView          *summaryview);
 void summary_msgs_lock           (SummaryView          *summaryview);
 void summary_msgs_unlock         (SummaryView          *summaryview);
-void summary_mark_all_read       (SummaryView          *summaryview);
-void summary_mark_all_unread     (SummaryView          *summaryview);
+void summary_mark_all_read       (SummaryView          *summaryview, gboolean ask_if_needed);
+void summary_mark_all_unread     (SummaryView          *summaryview, gboolean ask_if_needed);
 void summary_mark_as_spam        (SummaryView          *summaryview, 
                                   guint                 action, 
                                   GtkWidget            *widget);
index 6819586..c41b487 100644 (file)
@@ -1602,7 +1602,7 @@ static void toolbar_all_read_cb(GtkWidget *widget, gpointer data)
        switch (toolbar_item->type) {
        case TOOLBAR_MAIN:
                mainwin = (MainWindow *) toolbar_item->parent;
-               summary_mark_all_read(mainwin->summaryview);
+               summary_mark_all_read(mainwin->summaryview, TRUE);
                break;
        case TOOLBAR_MSGVIEW:
                /* TODO: see toolbar_next_unread_cb() if you need
@@ -1624,7 +1624,7 @@ static void toolbar_all_unread_cb(GtkWidget *widget, gpointer data)
        switch (toolbar_item->type) {
        case TOOLBAR_MAIN:
                mainwin = (MainWindow *) toolbar_item->parent;
-               summary_mark_all_unread(mainwin->summaryview);
+               summary_mark_all_unread(mainwin->summaryview, TRUE);
                break;
        case TOOLBAR_MSGVIEW:
                /* TODO: see toolbar_next_unread_cb() if you need