2005-08-31 [colin] 1.9.13cvs75
authorColin Leroy <colin@colino.net>
Wed, 31 Aug 2005 16:30:30 +0000 (16:30 +0000)
committerColin Leroy <colin@colino.net>
Wed, 31 Aug 2005 16:30:30 +0000 (16:30 +0000)
* src/folderview.c
* src/folderview.h
* src/prefs_summaries.c
* src/summaryview.c
Fix "go to next new", fix preference
(Open unread/next swapped)

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/folderview.c
src/folderview.h
src/prefs_summaries.c
src/summaryview.c

index 9c7d3da71ce221b72ff20097d5d123c00d296df1..4588807fd6739238e485f7fb88d652b9b3b25d91 100644 (file)
@@ -1,3 +1,12 @@
+2005-08-31 [colin]     1.9.13cvs75
+
+       * src/folderview.c
+       * src/folderview.h
+       * src/prefs_summaries.c
+       * src/summaryview.c
+               Fix "go to next new", fix preference
+               (Open unread/next swapped)
+
 2005-08-31 [paul]      1.9.13cvs74
 
        * src/compose.c
index 5bf02fdefcd445b170d048d5758ec091d2be4441..eaf2ec2a8d9431adc804cb0e24254d1ffe98ea5d 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.207.2.58 -r 1.207.2.59 src/folderview.c;  cvs diff -u -r 1.274.2.56 -r 1.274.2.57 src/mainwindow.c;  cvs diff -u -r 1.83.2.37 -r 1.83.2.38 src/mimeview.c;  cvs diff -u -r 1.2.2.14 -r 1.2.2.15 src/gtk/filesel.c;  cvs diff -u -r 1.1.4.4 -r 1.1.4.5 src/gtk/filesel.h;  ) > 1.9.13cvs72.patchset
 ( cvs diff -u -r 1.395.2.117 -r 1.395.2.118 src/summaryview.c;  ) > 1.9.13cvs73.patchset
 ( cvs diff -u -r 1.382.2.157 -r 1.382.2.158 src/compose.c;  cvs diff -u -r 1.207.2.59 -r 1.207.2.60 src/folderview.c;  cvs diff -u -r 1.8.2.8 -r 1.8.2.9 src/headerview.c;  cvs diff -u -r 1.2 -r 1.3 src/headerview.h;  cvs diff -u -r 1.274.2.57 -r 1.274.2.58 src/mainwindow.c;  cvs diff -u -r 1.204.2.55 -r 1.204.2.56 src/prefs_common.c;  cvs diff -u -r 1.103.2.27 -r 1.103.2.28 src/prefs_common.h;  cvs diff -u -r 1.4.2.11 -r 1.4.2.12 src/prefs_fonts.c;  cvs diff -u -r 1.395.2.118 -r 1.395.2.119 src/summaryview.c;  cvs diff -u -r 1.96.2.72 -r 1.96.2.73 src/textview.c;  cvs diff -u -r 1.9.2.15 -r 1.9.2.16 src/common/defs.h;  ) > 1.9.13cvs74.patchset
+( cvs diff -u -r 1.207.2.60 -r 1.207.2.61 src/folderview.c;  cvs diff -u -r 1.20.2.6 -r 1.20.2.7 src/folderview.h;  cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/prefs_summaries.c;  cvs diff -u -r 1.395.2.119 -r 1.395.2.120 src/summaryview.c;  ) > 1.9.13cvs75.patchset
index 6b2b8937d45fe2c0952c38a2ba4aa7c199b446a8..acae4e9118c6c4d6e4ff0f81d5f46d17ef6db603 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=13
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=74
+EXTRA_VERSION=75
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 36d436b409f41d99861f83a160e6c8310be1433b..86f25e82ab05030d26f93efbce616e60ce306f51 100644 (file)
@@ -784,6 +784,44 @@ void folderview_select_next_unread(FolderView *folderview)
                folderview_select_node(folderview, node);
 }
 
+static GtkCTreeNode *folderview_find_next_new(GtkCTree *ctree,
+                                                GtkCTreeNode *node)
+{
+       FolderItem *item;
+
+       if (node)
+               node = gtkut_ctree_node_next(ctree, node);
+       else
+               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+
+       for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
+               item = gtk_ctree_node_get_row_data(ctree, node);
+               if (item && item->new_msgs > 0 && item->stype != F_TRASH)
+                       return node;
+       }
+
+       return NULL;
+}
+
+void folderview_select_next_new(FolderView *folderview)
+{
+       GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+       GtkCTreeNode *node = NULL;
+
+       if ((node = folderview_find_next_new(ctree, folderview->opened))
+           != NULL) {
+               folderview_select_node(folderview, node);
+               return;
+       }
+
+       if (!folderview->opened ||
+           folderview->opened == GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list))
+               return;
+       /* search again from the first node */
+       if ((node = folderview_find_next_new(ctree, NULL)) != NULL)
+               folderview_select_node(folderview, node);
+}
+
 FolderItem *folderview_get_selected_item(FolderView *folderview)
 {
        GtkCTree *ctree = GTK_CTREE(folderview->ctree);
index 208159500f462e3061ef1e88704c2f247b781b97..af1537b8c55ce3b11a7c116ec31d7cd099b9e66c 100644 (file)
@@ -99,6 +99,7 @@ void folderview_select                        (FolderView     *folderview,
                                         FolderItem     *item);
 void folderview_unselect               (FolderView     *folderview);
 void folderview_select_next_unread     (FolderView     *folderview);
+void folderview_select_next_new                (FolderView     *folderview);
 
 FolderItem *folderview_get_selected_item(FolderView    *folderview);
 
index 781b409be6ba484291179e8521276160995e644c..744123f31a4bd0b6578a5db60e7ba02f7d4fc456 100644 (file)
@@ -875,10 +875,10 @@ void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
        
        menu = gtk_menu_new ();
        MENUITEM_ADD (menu, menuitem, _("Do nothing"), 0);
-       MENUITEM_ADD (menu, menuitem, _("Select first new (or unread) message"),
-                     SELECTONENTRY_NEW);
        MENUITEM_ADD (menu, menuitem, _("Select first unread (or new) message"),
                      SELECTONENTRY_UNREAD);
+       MENUITEM_ADD (menu, menuitem, _("Select first new (or unread) message"),
+                     SELECTONENTRY_NEW);
 
        gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_select_on_entry), menu);
        
@@ -887,7 +887,7 @@ void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
        gtk_widget_show (hbox_nextunreadmsgdialog);
        gtk_box_pack_start (GTK_BOX (vbox1), hbox_nextunreadmsgdialog, FALSE, FALSE, 0);
 
-       label = gtk_label_new (_("Show no-unread-message dialog"));
+       label = gtk_label_new (_("Show \"no unread (or new) message\" dialog"));
        gtk_widget_show (label);
        gtk_box_pack_start (GTK_BOX (hbox_nextunreadmsgdialog), label, FALSE, FALSE, 8);
 
index 4f4784e6970116a21265205597f2e99a4044d431..4f1de27eac20f661c979ee3333ccdd37519be193 100644 (file)
@@ -1374,8 +1374,6 @@ void summary_select_next_unread(SummaryView *summaryview)
                        }
 
                        if (val == G_ALERTDEFAULT) {
-                               g_signal_stop_emission_by_name(G_OBJECT(ctree),
-                                                        "key_press_event");
                                folderview_select_next_unread(summaryview->folderview);
                                return;
                        } 
@@ -1390,17 +1388,37 @@ void summary_select_next_unread(SummaryView *summaryview)
 void summary_select_prev_new(SummaryView *summaryview)
 {
        GtkCTreeNode *node;
+       gboolean skip_cur = FALSE;
+
+       if (summaryview->displayed 
+       &&  summaryview->selected == summaryview->displayed) {
+               debug_print("skipping current\n");
+               skip_cur = TRUE;
+       }
 
        node = summary_find_prev_flagged_msg
-               (summaryview, summaryview->selected, MSG_NEW, FALSE);
+               (summaryview, summaryview->selected, MSG_NEW, skip_cur);
 
        if (!node) {
-               AlertValue val;
+               AlertValue val = 0;
 
-               val = alertpanel(_("No more new messages"),
-                                _("No new message found. "
-                                  "Search from the end?"),
-                                GTK_STOCK_YES, GTK_STOCK_NO, NULL);
+               switch (prefs_common.next_unread_msg_dialog) {
+                       case NEXTUNREADMSGDIALOG_ALWAYS:
+                               val = alertpanel(_("No more new messages"),
+                                                _("No new message found. "
+                                                  "Search from the end?"),
+                                                GTK_STOCK_YES, GTK_STOCK_NO, NULL);
+                               break;
+                       case NEXTUNREADMSGDIALOG_ASSUME_YES:
+                               val = G_ALERTDEFAULT;
+                               break;
+                       case NEXTUNREADMSGDIALOG_ASSUME_NO:
+                               val = !G_ALERTDEFAULT;
+                               break;
+                       default:
+                               debug_print(
+                                       _("Internal error: unexpected value for prefs_common.next_unread_msg_dialog\n"));
+               }
                if (val != G_ALERTDEFAULT) return;
                node = summary_find_prev_flagged_msg(summaryview, NULL,
                                                     MSG_NEW, FALSE);
@@ -1416,28 +1434,55 @@ void summary_select_next_new(SummaryView *summaryview)
 {
        GtkCTreeNode *node = summaryview->selected;
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-
-       while ((node = summary_find_next_flagged_msg
-               (summaryview, node, MSG_NEW, FALSE)) == NULL) {
-               AlertValue val;
-
-               val = alertpanel(_("No more new messages"),
-                                _("No new message found. "
-                                  "Go to next folder?"),
-                                GTK_STOCK_YES, _("_Search again"),
-                                GTK_STOCK_NO);
-               if (val == G_ALERTDEFAULT) {
-                       g_signal_stop_emission_by_name(G_OBJECT(ctree),"key_press_event");
-                       folderview_select_next_unread(summaryview->folderview);
-                       return;
-               } else if (val == G_ALERTALTERNATE)
-                       node = NULL;
-               else
-                       return;
+       gboolean skip_cur = FALSE;
+       
+       if (summaryview->displayed 
+       &&  summaryview->selected == summaryview->displayed) {
+               debug_print("skipping cur (%p %p)\n",
+                       summaryview->displayed, summaryview->selected);
+               skip_cur = TRUE;
        }
 
+
+       node = summary_find_next_flagged_msg
+               (summaryview, node, MSG_NEW, skip_cur);
+       
        if (node)
                summary_select_node(summaryview, node, TRUE, FALSE);
+       else {
+               node = summary_find_next_flagged_msg
+                       (summaryview, NULL, MSG_NEW, FALSE);
+               if (node == NULL) {
+                       AlertValue val = 0;
+
+                       switch (prefs_common.next_unread_msg_dialog) {
+                               case NEXTUNREADMSGDIALOG_ALWAYS:
+                                       val = alertpanel(_("No more new messages"),
+                                                        _("No new message found. "
+                                                          "Go to next folder?"),
+                                                        GTK_STOCK_YES, GTK_STOCK_NO, NULL);
+                                       break;
+                               case NEXTUNREADMSGDIALOG_ASSUME_YES:
+                                       val = G_ALERTDEFAULT;
+                                       break;
+                               case NEXTUNREADMSGDIALOG_ASSUME_NO:
+                                       val = G_ALERTOTHER;
+                                       break;
+                               default:
+                                       debug_print(
+                                               _("Internal error: unexpected value for prefs_common.next_unread_msg_dialog\n"));
+                       }
+
+                       if (val == G_ALERTDEFAULT) {
+                               folderview_select_next_new(summaryview->folderview);
+                               return;
+                       } 
+                       else
+                               return;
+               } else
+                       summary_select_node(summaryview, node, TRUE, FALSE);
+
+       }
 }
 
 void summary_select_prev_marked(SummaryView *summaryview)