add Summary->Next/Prev labeled message
authorPaul Mangan <paul@claws-mail.org>
Mon, 27 Aug 2001 13:36:15 +0000 (13:36 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 27 Aug 2001 13:36:15 +0000 (13:36 +0000)
ChangeLog.claws
src/mainwindow.c
src/summaryview.c

index cd629c69d89e92b399982e5b265cdce3d9a5ceba..ed9afdd2ee01c776c05dc956991757ac6d93135e 100644 (file)
@@ -1,3 +1,15 @@
+2001-08-27 [paul]
+
+       * src/mainwindow.c
+               new functions: next_labeled_cb(), prev_labeled_cb()
+
+       * src/summaryview.c
+               new functions: summary_find_next_labeled_msg(), summary_find_prev_labeled_msg(),
+               summary_select_next_labeled(), summary_select_prev_labeled()
+
+       * src/pixmaps/dir-close.xpm, src/pixmaps/dir-open.xpm, src/pixmaps/trash.xpm
+               give claws blue folders and a blue trash can
+
 2001-08-27 [paul]
 
        * configure.in
 2001-05-04 [sergey]
 
        * src/mainwindow.c (next_marked_cb, prev_marked_cb): new
-       functions.  
+       functions.
 
        * src/summaryview.c
        (summary_find_next_marked_msg, summary_find_prev_marked_msg,
index a2dc3ac6c4aa5f42097be163813c1feb30552aaf..45a8ce8d28ccd1260319a071db6ae706409825f2 100644 (file)
@@ -325,6 +325,16 @@ static void prev_marked_cb  (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
 
+static void next_labeled_cb     (MainWindow    *mainwin,
+                                 guint          action,
+                                 GtkWidget     *widget);
+
+
+static void prev_labeled_cb     (MainWindow    *mainwin,
+                                 guint          action,
+                                 GtkWidget     *widget);
+
+
 static void goto_folder_cb      (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
@@ -536,6 +546,8 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Summary/N_ext unread message"),  NULL, next_unread_cb, 0, NULL},
        {N_("/_Summary/Prev marked message"),   NULL, prev_marked_cb, 0, NULL},
        {N_("/_Summary/Next marked message"),   NULL, next_marked_cb, 0, NULL},
+       {N_("/_Summary/Prev labeled message"),  NULL, prev_labeled_cb, 0, NULL},
+       {N_("/_Summary/Next labeled message"),  NULL, next_labeled_cb, 0, NULL},
        {N_("/_Summary/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Summary/_Go to other folder"),   "<alt>G", goto_folder_cb, 0, NULL},
        {N_("/_Summary/---"),                   NULL, NULL, 0, "<Separator>"},
@@ -1284,14 +1296,16 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/Message/Re-edit", M_ALLOW_REEDIT},
 
                {"/Summary/Delete duplicated messages", M_MSG_EXIST|M_EXEC|M_UNLOCKED},
-               {"/Summary/Filter messages"    , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
-               {"/Summary/Execute"            , M_MSG_EXIST|M_UNLOCKED},
-               {"/Summary/Prev message"       , M_MSG_EXIST},
-               {"/Summary/Next message"       , M_MSG_EXIST},
-               {"/Summary/Prev marked message", M_MSG_EXIST},
-               {"/Summary/Next marked message", M_MSG_EXIST},
-               {"/Summary/Next unread message", M_MSG_EXIST},
-               {"/Summary/Sort"               , M_MSG_EXIST},
+               {"/Summary/Filter messages"     , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
+               {"/Summary/Execute"             , M_MSG_EXIST|M_UNLOCKED},
+               {"/Summary/Prev message"        , M_MSG_EXIST},
+               {"/Summary/Next message"        , M_MSG_EXIST},
+               {"/Summary/Prev marked message" , M_MSG_EXIST},
+               {"/Summary/Next marked message" , M_MSG_EXIST},
+               {"/Summary/Prev labeled message", M_MSG_EXIST},
+               {"/Summary/Next labeled message", M_MSG_EXIST},
+               {"/Summary/Next unread message" , M_MSG_EXIST},
+               {"/Summary/Sort"                , M_MSG_EXIST},
 
                {"/Configuration", M_UNLOCKED},
 
@@ -2596,6 +2610,18 @@ static void prev_marked_cb(MainWindow *mainwin, guint action,
        summary_select_prev_marked(mainwin->summaryview);
 }
 
+static void next_labeled_cb(MainWindow *mainwin, guint action,
+                          GtkWidget *widget)
+{
+       summary_select_next_labeled(mainwin->summaryview);
+}
+
+static void prev_labeled_cb(MainWindow *mainwin, guint action,
+                          GtkWidget *widget)
+{
+       summary_select_prev_labeled(mainwin->summaryview);
+}
+
 static void goto_folder_cb(MainWindow *mainwin, guint action,
                           GtkWidget *widget)
 {
index bb924c59e57cc8d8977261d591e872c952a982a0..90c1d85474cbc6d37fb16d7d83e94478193b556c 100644 (file)
@@ -166,6 +166,12 @@ static GtkCTreeNode *summary_find_next_marked_msg
 static GtkCTreeNode *summary_find_prev_marked_msg
                                        (SummaryView            *summaryview,
                                         GtkCTreeNode           *current_node);
+static GtkCTreeNode *summary_find_next_labeled_msg
+                                       (SummaryView            *summaryview,
+                                        GtkCTreeNode           *current_node);
+static GtkCTreeNode *summary_find_prev_labeled_msg
+                                       (SummaryView            *summaryview,
+                                        GtkCTreeNode           *current_node);
 static GtkCTreeNode *summary_find_msg_by_msgnum
                                        (SummaryView            *summaryview,
                                         guint                   msgnum);
@@ -1205,6 +1211,66 @@ void summary_select_prev_marked(SummaryView *summaryview)
        }
 }
 
+void summary_select_next_labeled(SummaryView *summaryview)
+{
+       GtkCTreeNode *node;
+       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+
+       node = summary_find_next_labeled_msg(summaryview,
+                                           summaryview->selected);
+
+       if (!node) {
+               AlertValue val;
+
+               val = alertpanel(_("No more labeled messages"),
+                                _("No labeled message found. "
+                                  "Search from the beginning?"),
+                                _("Yes"), _("No"), NULL);
+               if (val != G_ALERTDEFAULT) return;
+               node = summary_find_next_labeled_msg(summaryview,
+                                                   NULL);
+       }
+       if (!node) {
+               alertpanel_notice(_("No labeled messages."));
+       } else {
+               gtk_sctree_unselect_all(GTK_SCTREE(ctree));
+               gtk_sctree_select(GTK_SCTREE(ctree), node);
+               if (summaryview->displayed == node)
+                       summaryview->displayed = NULL;
+               summary_display_msg(summaryview, node, FALSE);
+       }
+}
+
+void summary_select_prev_labeled(SummaryView *summaryview)
+{
+       GtkCTreeNode *node;
+       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+
+       node = summary_find_prev_labeled_msg(summaryview,
+                                           summaryview->selected);
+
+       if (!node) {
+               AlertValue val;
+
+               val = alertpanel(_("No more labeled messages"),
+                                _("No labeled message found. "
+                                  "Search from the end?"),
+                                _("Yes"), _("No"), NULL);
+               if (val != G_ALERTDEFAULT) return;
+               node = summary_find_prev_labeled_msg(summaryview,
+                                                   NULL);
+       }
+       if (!node) {
+               alertpanel_notice(_("No labeled messages."));
+       } else {
+               gtk_sctree_unselect_all(GTK_SCTREE(ctree));
+               gtk_sctree_select(GTK_SCTREE(ctree), node);
+               if (summaryview->displayed == node)
+                       summaryview->displayed = NULL;
+               summary_display_msg(summaryview, node, FALSE);
+       }
+}
+
 void summary_select_by_msgnum(SummaryView *summaryview, guint msgnum)
 {
        GtkCTreeNode *node;
@@ -1310,6 +1376,46 @@ static GtkCTreeNode *summary_find_prev_marked_msg(SummaryView *summaryview,
        return node;
 }
 
+static GtkCTreeNode *summary_find_next_labeled_msg(SummaryView *summaryview,
+                                                 GtkCTreeNode *current_node)
+{
+       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCTreeNode *node;
+       MsgInfo *msginfo;
+
+       if (current_node)
+               node = GTK_CTREE_NODE_NEXT(current_node);
+       else
+               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+
+       for (; node != NULL; node = GTK_CTREE_NODE_NEXT(node)) {
+               msginfo = gtk_ctree_node_get_row_data(ctree, node);
+                if (MSG_GET_COLORLABEL_VALUE(msginfo->flags) > 0) 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
+               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list_end);
+
+       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;
+       }
+
+       return node;
+}
+
 static GtkCTreeNode *summary_find_msg_by_msgnum(SummaryView *summaryview,
                                                guint msgnum)
 {