sync with 0.7.8cvs6
authorPaul Mangan <paul@claws-mail.org>
Tue, 25 Jun 2002 09:20:06 +0000 (09:20 +0000)
committerPaul Mangan <paul@claws-mail.org>
Tue, 25 Jun 2002 09:20:06 +0000 (09:20 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/mainwindow.c
src/summaryview.c
src/summaryview.h

index 51d3d70..f8c2ece 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-06-25
+
+       * src/summaryview.[ch]
+         src/mainwindow.c: added "Go to/{Prev,Next} new message" menu.
+         Made some code cleanups.
+
 2002-06-20
 
        * src/folderview.c
index 788a0bd..c0b3b94 100644 (file)
@@ -1,3 +1,8 @@
+2002-06-25 [paul]      0.7.8claws22
+
+       * sync with 0.7.8cvs6
+               see ChangeLog 2002-06-25
+
 2002-06-24 [paul]      0.7.8claws21
 
        * tools/update-po
index 48ad89f..0565f8c 100644 (file)
@@ -1,3 +1,9 @@
+2002-06-25
+
+       * src/summaryview.[ch]
+         src/mainwindow.c: ¡Ö°ÜÆ°/{¼¡¤Î,Á°¤Î}¿·Ãå¥á¥Ã¥»¡¼¥¸¡×¥á¥Ë¥å¡¼¤òÄɲá£
+         ¾¯¤·¥³¡¼¥É¤òÀ°Íý¡£
+
 2002-06-20
 
        * src/folderview.c
index bb1df1d..d081596 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws21
+EXTRA_VERSION=claws22
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index af7ea28..a6f4d9b 100644 (file)
@@ -386,6 +386,12 @@ static void prev_unread_cb  (MainWindow    *mainwin,
 static void next_unread_cb      (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
+static void prev_new_cb                 (MainWindow    *mainwin,
+                                 guint          action,
+                                 GtkWidget     *widget);
+static void next_new_cb                 (MainWindow    *mainwin,
+                                 guint          action,
+                                 GtkWidget     *widget);
 static void prev_marked_cb      (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
@@ -570,6 +576,9 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_View/_Go to/N_ext unread message"),
                                                "<shift>N", next_unread_cb, 0, NULL},
        {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
+       {N_("/_View/_Go to/Prev ne_w message"), NULL, prev_new_cb, 0, NULL},
+       {N_("/_View/_Go to/Ne_xt new message"), NULL, next_new_cb, 0, NULL},
+       {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
        {N_("/_View/_Go to/Prev _marked message"),
                                                NULL, prev_marked_cb, 0, NULL},
        {N_("/_View/_Go to/Next m_arked message"),
@@ -1695,6 +1704,8 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/View/Go to/Next message"        , M_MSG_EXIST},
                {"/View/Go to/Prev unread message" , M_MSG_EXIST},
                {"/View/Go to/Next unread message" , M_MSG_EXIST},
+               {"/View/Go to/Prev new message"    , M_MSG_EXIST},
+               {"/View/Go to/Next new message"    , M_MSG_EXIST},
                {"/View/Go to/Prev marked message" , M_MSG_EXIST},
                {"/View/Go to/Next marked message" , M_MSG_EXIST},
                {"/View/Go to/Prev labeled message", M_MSG_EXIST},
@@ -3142,6 +3153,16 @@ static void next_unread_cb(MainWindow *mainwin, guint action,
        summary_select_next_unread(mainwin->summaryview);
 }
 
+static void prev_new_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
+{
+       summary_select_prev_new(mainwin->summaryview);
+}
+
+static void next_new_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
+{
+       summary_select_next_new(mainwin->summaryview);
+}
+
 static void prev_marked_cb(MainWindow *mainwin, guint action,
                           GtkWidget *widget)
 {
index f591f39..b70b4cb 100644 (file)
@@ -160,24 +160,18 @@ static GtkCTreeNode *summary_find_prev_msg
 static GtkCTreeNode *summary_find_next_msg
                                        (SummaryView            *summaryview,
                                         GtkCTreeNode           *current_node);
-static GtkCTreeNode *summary_find_prev_unread_msg
-                                       (SummaryView            *summaryview,
-                                        GtkCTreeNode           *current_node);
-static GtkCTreeNode *summary_find_next_unread_msg
-                                       (SummaryView            *summaryview,
-                                        GtkCTreeNode           *current_node);
-static GtkCTreeNode *summary_find_prev_marked_msg
-                                       (SummaryView            *summaryview,
-                                        GtkCTreeNode           *current_node);
-static GtkCTreeNode *summary_find_next_marked_msg
-                                       (SummaryView            *summaryview,
-                                        GtkCTreeNode           *current_node);
-static GtkCTreeNode *summary_find_prev_labeled_msg
-                                       (SummaryView            *summaryview,
-                                        GtkCTreeNode           *current_node);
-static GtkCTreeNode *summary_find_next_labeled_msg
-                                       (SummaryView            *summaryview,
-                                        GtkCTreeNode           *current_node);
+
+static GtkCTreeNode *summary_find_prev_flagged_msg
+                                       (SummaryView    *summaryview,
+                                        GtkCTreeNode   *current_node,
+                                        MsgPermFlags    flags,
+                                        gboolean        start_from_prev);
+static GtkCTreeNode *summary_find_next_flagged_msg
+                                       (SummaryView    *summaryview,
+                                        GtkCTreeNode   *current_node,
+                                        MsgPermFlags    flags,
+                                        gboolean        start_from_next);
+
 static GtkCTreeNode *summary_find_msg_by_msgnum
                                        (SummaryView            *summaryview,
                                         guint                   msgnum);
@@ -886,7 +880,8 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
                if (!summaryview->selected) {
                        /* no selected message - select first unread
                           message, but do not display it */
-                       node = summary_find_next_unread_msg(summaryview, NULL);
+                       node = summary_find_next_flagged_msg(summaryview, NULL,
+                                                            MSG_UNREAD, FALSE);
                        if (node == NULL && GTK_CLIST(ctree)->row_list != NULL)
                                node = gtk_ctree_node_nth
                                        (ctree,
@@ -900,8 +895,8 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
                        node = summary_find_next_important_score(summaryview,
                                                                 NULL);
                else
-                       node = summary_find_next_unread_msg(summaryview, NULL);
-
+               node = summary_find_next_flagged_msg(summaryview, NULL,
+                                                    MSG_UNREAD, FALSE);
                if (node == NULL && GTK_CLIST(ctree)->row_list != NULL) {
                        node = gtk_ctree_node_nth
                                (ctree,
@@ -1079,7 +1074,7 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
        menu_set_sensitive(ifactory, "/Reply to sender",          sens);
        menu_set_sensitive(ifactory, "/Reply to all",             sens);
        menu_set_sensitive(ifactory, "/Forward",                  TRUE);
-       menu_set_sensitive(ifactory, "/Redirect",                 TRUE);
+       menu_set_sensitive(ifactory, "/Redirect",                 sens);
 
        menu_set_sensitive(ifactory, "/Add sender to address book", sens);
        menu_set_sensitive(ifactory, "/Create filter rule",         sens);
@@ -1116,7 +1111,8 @@ void summary_select_prev_unread(SummaryView *summaryview)
 {
        GtkCTreeNode *node;
 
-       node = summary_find_prev_unread_msg(summaryview, summaryview->selected);
+       node = summary_find_prev_flagged_msg
+               (summaryview, summaryview->selected, MSG_UNREAD, FALSE);
 
        if (!node) {
                AlertValue val;
@@ -1139,7 +1135,8 @@ void summary_select_prev_unread(SummaryView *summaryview)
                                        _("Internal error: unexpected value for prefs_common.next_unread_msg_dialog\n"));
                }
                if (val != G_ALERTDEFAULT) return;
-               node = summary_find_prev_unread_msg(summaryview, NULL);
+               node = summary_find_prev_flagged_msg(summaryview, NULL,
+                                                    MSG_UNREAD, FALSE);
        }
 
        if (!node)
@@ -1153,55 +1150,108 @@ void summary_select_next_unread(SummaryView *summaryview)
        GtkCTreeNode *node = summaryview->selected;
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
 
-       node = summary_find_next_unread_msg(summaryview, node);
-       
+       while ((node = summary_find_next_flagged_msg
+               (summaryview, node, MSG_UNREAD, FALSE)) == NULL) {
+               AlertValue val;
+
+               switch (prefs_common.next_unread_msg_dialog) {
+                       case NEXTUNREADMSGDIALOG_ALWAYS:
+                               val = alertpanel(_("No more unread messages"),
+                                                _("No unread message found. "
+                                                  "Go to next folder?"),
+                                                 _("Yes"), _("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) {
+                       if (gtk_signal_n_emissions_by_name
+                               (GTK_OBJECT(ctree), "key_press_event") > 0)
+                                       gtk_signal_emit_stop_by_name
+                                               (GTK_OBJECT(ctree),
+                                                "key_press_event");
+                       folderview_select_next_unread(summaryview->folderview);
+                       return;
+               } else if (val == G_ALERTALTERNATE)
+                       node = NULL;
+               else
+                       return;
+       }
+
        if (node)
                summary_select_node(summaryview, node, TRUE, FALSE);
-       else {
-               node = summary_find_next_unread_msg(summaryview, NULL);
-               if (node == NULL) {
-                       AlertValue val;
-
-                       switch (prefs_common.next_unread_msg_dialog) {
-                               case NEXTUNREADMSGDIALOG_ALWAYS:
-                                       val = alertpanel(_("No more unread messages"),
-                                                        _("No unread message found. "
-                                                          "Go to next folder?"),
-                                                        _("Yes"), _("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) {
-                               if (gtk_signal_n_emissions_by_name
-                                       (GTK_OBJECT(ctree), "key_press_event") > 0)
-                                               gtk_signal_emit_stop_by_name
-                                                       (GTK_OBJECT(ctree),
-                                                        "key_press_event");
-                               folderview_select_next_unread(summaryview->folderview);
-                               return;
-                       } 
-                       else
-                               return;
-               } else
-                       summary_select_node(summaryview, node, TRUE, FALSE);
+}
 
+void summary_select_prev_new(SummaryView *summaryview)
+{
+       GtkCTreeNode *node;
+
+       node = summary_find_prev_flagged_msg
+               (summaryview, summaryview->selected, MSG_NEW, FALSE);
+
+       if (!node) {
+               AlertValue val;
+
+               val = alertpanel(_("No more new messages"),
+                                _("No new message found. "
+                                  "Search from the end?"),
+                                _("Yes"), _("No"), NULL);
+               if (val != G_ALERTDEFAULT) return;
+               node = summary_find_prev_flagged_msg(summaryview, NULL,
+                                                    MSG_NEW, FALSE);
        }
+
+       if (!node)
+               alertpanel_notice(_("No new messages."));
+       else
+               summary_select_node(summaryview, node, TRUE, FALSE);
+}
+
+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?"),
+                                _("Yes"), _("Search again"), _("No"));
+               if (val == G_ALERTDEFAULT) {
+                       if (gtk_signal_n_emissions_by_name
+                               (GTK_OBJECT(ctree), "key_press_event") > 0)
+                                       gtk_signal_emit_stop_by_name
+                                               (GTK_OBJECT(ctree),
+                                                "key_press_event");
+                       folderview_select_next_unread(summaryview->folderview);
+                       return;
+               } else if (val == G_ALERTALTERNATE)
+                       node = NULL;
+               else
+                       return;
+       }
+
+       if (node)
+               summary_select_node(summaryview, node, TRUE, FALSE);
 }
 
 void summary_select_prev_marked(SummaryView *summaryview)
 {
        GtkCTreeNode *node;
 
-       node = summary_find_prev_marked_msg(summaryview, summaryview->selected);
+       node = summary_find_prev_flagged_msg
+               (summaryview, summaryview->selected, MSG_MARKED, TRUE);
 
        if (!node) {
                AlertValue val;
@@ -1211,7 +1261,8 @@ void summary_select_prev_marked(SummaryView *summaryview)
                                   "Search from the end?"),
                                 _("Yes"), _("No"), NULL);
                if (val != G_ALERTDEFAULT) return;
-               node = summary_find_prev_marked_msg(summaryview, NULL);
+               node = summary_find_prev_flagged_msg(summaryview, NULL,
+                                                    MSG_MARKED, TRUE);
        }
 
        if (!node)
@@ -1224,7 +1275,8 @@ void summary_select_next_marked(SummaryView *summaryview)
 {
        GtkCTreeNode *node;
 
-       node = summary_find_next_marked_msg(summaryview, summaryview->selected);
+       node = summary_find_next_flagged_msg
+               (summaryview, summaryview->selected, MSG_MARKED, TRUE);
 
        if (!node) {
                AlertValue val;
@@ -1234,7 +1286,8 @@ void summary_select_next_marked(SummaryView *summaryview)
                                   "Search from the beginning?"),
                                 _("Yes"), _("No"), NULL);
                if (val != G_ALERTDEFAULT) return;
-               node = summary_find_next_marked_msg(summaryview, NULL);
+               node = summary_find_next_flagged_msg(summaryview, NULL,
+                                                    MSG_MARKED, TRUE);
        }
 
        if (!node)
@@ -1247,7 +1300,8 @@ void summary_select_prev_labeled(SummaryView *summaryview)
 {
        GtkCTreeNode *node;
 
-       node = summary_find_prev_labeled_msg(summaryview, summaryview->selected);
+       node = summary_find_prev_flagged_msg
+               (summaryview, summaryview->selected, MSG_CLABEL_FLAG_MASK, TRUE);
 
        if (!node) {
                AlertValue val;
@@ -1257,7 +1311,8 @@ void summary_select_prev_labeled(SummaryView *summaryview)
                                   "Search from the end?"),
                                 _("Yes"), _("No"), NULL);
                if (val != G_ALERTDEFAULT) return;
-               node = summary_find_prev_labeled_msg(summaryview, NULL);
+               node = summary_find_prev_flagged_msg(summaryview, NULL,
+                                                    MSG_CLABEL_FLAG_MASK, TRUE);
        }
 
        if (!node)
@@ -1270,7 +1325,8 @@ void summary_select_next_labeled(SummaryView *summaryview)
 {
        GtkCTreeNode *node;
 
-       node = summary_find_next_labeled_msg(summaryview, summaryview->selected);
+       node = summary_find_next_flagged_msg
+               (summaryview, summaryview->selected, MSG_CLABEL_FLAG_MASK, TRUE);
 
        if (!node) {
                AlertValue val;
@@ -1280,7 +1336,8 @@ void summary_select_next_labeled(SummaryView *summaryview)
                                   "Search from the beginning?"),
                                 _("Yes"), _("No"), NULL);
                if (val != G_ALERTDEFAULT) return;
-               node = summary_find_next_labeled_msg(summaryview, NULL);
+               node = summary_find_next_flagged_msg(summaryview, NULL,
+                                                    MSG_CLABEL_FLAG_MASK, TRUE);
        }
 
        if (!node)
@@ -1380,121 +1437,51 @@ static GtkCTreeNode *summary_find_next_msg(SummaryView *summaryview,
        return node;
 }
 
-static GtkCTreeNode *summary_find_prev_unread_msg(SummaryView *summaryview,
-                                                 GtkCTreeNode *current_node)
+static GtkCTreeNode *summary_find_prev_flagged_msg(SummaryView *summaryview,
+                                                  GtkCTreeNode *current_node,
+                                                  MsgPermFlags flags,
+                                                  gboolean start_from_prev)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GtkCTreeNode *node;
        MsgInfo *msginfo;
 
-       if (current_node)
-               node = current_node;
-       else
-               node = gtk_ctree_node_nth(ctree, GTK_CLIST(ctree)->rows - 1);
-
-       for (; node != NULL; node = GTK_CTREE_NODE_PREV(node)) {
-               msginfo = gtk_ctree_node_get_row_data(ctree, node);
-               if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) break;
-       }
-
-       return node;
-}
-
-static GtkCTreeNode *summary_find_next_unread_msg(SummaryView *summaryview,
-                                                 GtkCTreeNode *current_node)
-{
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
-       MsgInfo *msginfo;
-
-       if (current_node)
-               node = current_node;
-       else
-               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
-
-       for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
-               msginfo = gtk_ctree_node_get_row_data(ctree, node);
-               if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) break;
-       }
-
-       return node;
-}
-
-static GtkCTreeNode *summary_find_prev_marked_msg(SummaryView *summaryview,
-                                                 GtkCTreeNode *current_node)
-{
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
-       MsgInfo *msginfo;
-
-       if (current_node)
-               node = GTK_CTREE_NODE_PREV(current_node);
-       else
-               node = gtk_ctree_node_nth(ctree, GTK_CLIST(ctree)->rows - 1);
-
-       for (; node != NULL; node = GTK_CTREE_NODE_PREV(node)) {
-               msginfo = gtk_ctree_node_get_row_data(ctree, node);
-               if (MSG_IS_MARKED(msginfo->flags)) break;
-       }
-
-       return node;
-}
-
-static GtkCTreeNode *summary_find_next_marked_msg(SummaryView *summaryview,
-                                                 GtkCTreeNode *current_node)
-{
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
-       MsgInfo *msginfo;
-
-       if (current_node)
-               node = gtkut_ctree_node_next(ctree, current_node);
-       else
-               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
-
-       for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
-               msginfo = gtk_ctree_node_get_row_data(ctree, node);
-               if (MSG_IS_MARKED(msginfo->flags)) break;
-       }
-
-       return node;
-}
-
-static GtkCTreeNode *summary_find_prev_labeled_msg(SummaryView *summaryview,
-                                                  GtkCTreeNode *current_node)
-{
-       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
-       GtkCTreeNode *node;
-       MsgInfo *msginfo;
-
-       if (current_node)
-               node = GTK_CTREE_NODE_PREV(current_node);
-       else
+       if (current_node) {
+               if (start_from_prev)
+                       node = GTK_CTREE_NODE_PREV(current_node);
+               else
+                       node = current_node;
+       } else
                node = gtk_ctree_node_nth(ctree, GTK_CLIST(ctree)->rows - 1);
 
        for (; node != NULL; node = GTK_CTREE_NODE_PREV(node)) {
                msginfo = gtk_ctree_node_get_row_data(ctree, node);
-               if (MSG_GET_COLORLABEL_VALUE(msginfo->flags) > 0) break;
+               if ((msginfo->flags.perm_flags & flags) != 0) break;
        }
 
        return node;
 }
 
-static GtkCTreeNode *summary_find_next_labeled_msg(SummaryView *summaryview,
-                                                  GtkCTreeNode *current_node)
+static GtkCTreeNode *summary_find_next_flagged_msg(SummaryView *summaryview,
+                                                  GtkCTreeNode *current_node,
+                                                  MsgPermFlags flags,
+                                                  gboolean start_from_next)
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        GtkCTreeNode *node;
        MsgInfo *msginfo;
 
-       if (current_node)
-               node = gtkut_ctree_node_next(ctree, current_node);
-       else
+       if (current_node) {
+               if (start_from_next)
+                       node = gtkut_ctree_node_next(ctree, current_node);
+               else
+                       node = current_node;
+       } else
                node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
 
        for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
                msginfo = gtk_ctree_node_get_row_data(ctree, node);
-               if (MSG_GET_COLORLABEL_VALUE(msginfo->flags) > 0) break;
+               if ((msginfo->flags.perm_flags & flags) != 0) break;
        }
 
        return node;
index 76c1680..13e7bd4 100644 (file)
@@ -160,6 +160,8 @@ SummarySelection summary_get_selection_type (SummaryView    *summaryview);
 
 void summary_select_prev_unread          (SummaryView          *summaryview);
 void summary_select_next_unread          (SummaryView          *summaryview);
+void summary_select_prev_new     (SummaryView          *summaryview);
+void summary_select_next_new     (SummaryView          *summaryview);
 void summary_select_prev_marked          (SummaryView          *summaryview);
 void summary_select_next_marked          (SummaryView          *summaryview);
 void summary_select_prev_labeled  (SummaryView         *summaryview);