From: Paul Mangan Date: Mon, 27 Aug 2001 13:36:15 +0000 (+0000) Subject: add Summary->Next/Prev labeled message X-Git-Tag: pre_compose_gui_improvement~32 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=29f5317a16f3f68cc26e8e82defd2bdcaaad37b7 add Summary->Next/Prev labeled message --- diff --git a/ChangeLog.claws b/ChangeLog.claws index cd629c69d..ed9afdd2e 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -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 @@ -2074,7 +2086,7 @@ 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, diff --git a/src/mainwindow.c b/src/mainwindow.c index a2dc3ac6c..45a8ce8d2 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -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, ""}, {N_("/_Summary/_Go to other folder"), "G", goto_folder_cb, 0, NULL}, {N_("/_Summary/---"), NULL, NULL, 0, ""}, @@ -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) { diff --git a/src/summaryview.c b/src/summaryview.c index bb924c59e..90c1d8547 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -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) {