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 ce2fe3cbb6397a40dffc52ba9a9be5d51e4a8f35..355af8553194c50dcc93037df2489f31e5138266 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 71391ef01b184564fcf1d7c6d4ab212ad69ebdab..d48a8de9a5e3bdad0f9682b04c28002ae4cb9a00 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 c6305bc3277886fafedee7906b3858ed97705bc5..6c8aa07faaf885a2f9537fbb67e26881debec886 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 fd28235dfdba5ed6a11524cde8fc65987854783e..5fa3e7fd8573f350a754b3782997690e3c3bf810 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 66c0c4d734fd95cd87a0ecdc449eda93b8d7b786..2d192e5734a46ab94afd7717d405b80129a035fc 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 68195862c89383eab47fd43d99b6dffadbeb637f..c41b4877739ca0e1ef48486b3c1c8e4b1715f9c1 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