Applied the marknav patch (commands to move to prev/next marked message).

This commit is contained in:
Sergey Vlasov 2001-05-04 13:04:31 +00:00
parent 5a1a399abf
commit ac69e85e63
4 changed files with 140 additions and 0 deletions

View file

@ -1,3 +1,13 @@
2001-05-04 [sergey]
* src/mainwindow.c (next_marked_cb, prev_marked_cb): new
functions.
* src/summaryview.c
(summary_find_next_marked_msg, summary_find_prev_marked_msg,
summary_select_next_marked, summary_select_prev_marked): new
functions.
2001-05-03 [sergey]
* src/news.c: fixed a bug when no article can be fetched after

View file

@ -293,6 +293,14 @@ static void next_unread_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
static void next_marked_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
static void prev_marked_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
static void goto_folder_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
@ -482,6 +490,8 @@ static GtkItemFactoryEntry mainwin_entries[] =
{N_("/_Summary/_Prev message"), NULL, prev_cb, 0, NULL},
{N_("/_Summary/_Next message"), NULL, next_cb, 0, NULL},
{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/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Summary/_Go to other folder"), "<alt>G", goto_folder_cb, 0, NULL},
{N_("/_Summary/---"), NULL, NULL, 0, "<Separator>"},
@ -1991,6 +2001,18 @@ static void next_unread_cb(MainWindow *mainwin, guint action,
summary_select_next_unread(mainwin->summaryview);
}
static void next_marked_cb(MainWindow *mainwin, guint action,
GtkWidget *widget)
{
summary_select_next_marked(mainwin->summaryview);
}
static void prev_marked_cb(MainWindow *mainwin, guint action,
GtkWidget *widget)
{
summary_select_prev_marked(mainwin->summaryview);
}
static void goto_folder_cb(MainWindow *mainwin, guint action,
GtkWidget *widget)
{

View file

@ -136,6 +136,12 @@ static void summary_set_menu_sensitive (SummaryView *summaryview);
static GtkCTreeNode *summary_find_next_unread_msg
(SummaryView *summaryview,
GtkCTreeNode *current_node);
static GtkCTreeNode *summary_find_next_marked_msg
(SummaryView *summaryview,
GtkCTreeNode *current_node);
static GtkCTreeNode *summary_find_prev_marked_msg
(SummaryView *summaryview,
GtkCTreeNode *current_node);
static GtkCTreeNode *summary_find_msg_by_msgnum
(SummaryView *summaryview,
guint msgnum);
@ -843,6 +849,66 @@ void summary_select_next_unread(SummaryView *summaryview)
}
}
void summary_select_next_marked(SummaryView *summaryview)
{
GtkCTreeNode *node;
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
node = summary_find_next_marked_msg(summaryview,
summaryview->selected);
if (!node) {
AlertValue val;
val = alertpanel(_("No more marked messages"),
_("No marked message found. "
"Search from the beginning?"),
_("Yes"), _("No"), NULL);
if (val != G_ALERTDEFAULT) return;
node = summary_find_next_marked_msg(summaryview,
NULL);
}
if (!node) {
alertpanel_notice(_("No marked 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_marked(SummaryView *summaryview)
{
GtkCTreeNode *node;
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
node = summary_find_prev_marked_msg(summaryview,
summaryview->selected);
if (!node) {
AlertValue val;
val = alertpanel(_("No more marked messages"),
_("No marked message found. "
"Search from the end?"),
_("Yes"), _("No"), NULL);
if (val != G_ALERTDEFAULT) return;
node = summary_find_prev_marked_msg(summaryview,
NULL);
}
if (!node) {
alertpanel_notice(_("No marked 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;
@ -891,6 +957,46 @@ static GtkCTreeNode *summary_find_next_unread_msg(SummaryView *summaryview,
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 = 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_IS_MARKED(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(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_IS_MARKED(msginfo->flags)) break;
}
return node;
}
static GtkCTreeNode *summary_find_msg_by_msgnum(SummaryView *summaryview,
guint msgnum)
{

View file

@ -147,6 +147,8 @@ void summary_clear_list (SummaryView *summaryview);
void summary_clear_all (SummaryView *summaryview);
void summary_select_next_unread (SummaryView *summaryview);
void summary_select_next_marked (SummaryView *summaryview);
void summary_select_prev_marked (SummaryView *summaryview);
void summary_select_by_msgnum (SummaryView *summaryview,
guint msgnum);
guint summary_get_current_msgnum (SummaryView *summaryview);