static void summary_status_show (SummaryView *summaryview);
static void summary_set_column_titles (SummaryView *summaryview);
static void summary_set_ctree_from_list (SummaryView *summaryview,
- GSList *mlist);
+ GSList *mlist,
+ guint selected_msgnum);
static inline void summary_set_header (SummaryView *summaryview,
gchar *text[],
MsgInfo *msginfo);
GtkCMCTreeNode *row);
static void summary_mark_row_as_unread (SummaryView *summaryview,
GtkCMCTreeNode *row);
+static gboolean summary_mark_all_read_confirm(gboolean ask_if_needed);
+static gboolean summary_mark_all_unread_confirm(gboolean ask_if_needed);
static void summary_delete_row (SummaryView *summaryview,
GtkCMCTreeNode *row);
static void summary_unmark_row (SummaryView *summaryview,
static void summary_drag_end(GtkWidget *widget,
GdkDragContext *drag_context,
SummaryView *summaryview);
-/* custom compare functions for sorting */
+/* custom compare functions for sorting */
static gint summary_cmp_by_mark (GtkCMCList *clist,
gconstpointer ptr1,
gconstpointer ptr2);
static GtkActionEntry summary_popup_entries[] =
{
- {"SummaryViewPopup", NULL, "SummaryViewPopup" },
- {"SummaryViewPopup/ReplyTo", NULL, N_("Repl_y to") },
- {"SummaryViewPopup/Mark", NULL, N_("_Mark") },
- {"SummaryViewPopup/ColorLabel", NULL, N_("Color la_bel") },
- {"SummaryViewPopup/Tags", NULL, N_("Ta_gs") },
- {"SummaryViewPopup/CreateFilterRule", NULL, N_("Create _filter rule") },
+ {"SummaryViewPopup", NULL, "SummaryViewPopup", NULL, NULL, NULL },
+ {"SummaryViewPopup/ReplyTo", NULL, N_("Repl_y to"), NULL, NULL, NULL },
+ {"SummaryViewPopup/Mark", NULL, N_("_Mark"), NULL, NULL, NULL },
+ {"SummaryViewPopup/ColorLabel", NULL, N_("Color la_bel"), NULL, NULL, NULL },
+ {"SummaryViewPopup/Tags", NULL, N_("Ta_gs"), NULL, NULL, NULL },
+ {"SummaryViewPopup/CreateFilterRule", NULL, N_("Create _filter rule"), NULL, NULL, NULL },
#ifndef GENERIC_UMPC
- {"SummaryViewPopup/CreateProcessingRule", NULL, N_("Create processing rule") },
+ {"SummaryViewPopup/CreateProcessingRule", NULL, N_("Create processing rule"), NULL, NULL, NULL },
#endif
- {"SummaryViewPopup/View", NULL, N_("_View") },
+ {"SummaryViewPopup/View", NULL, N_("_View"), NULL, NULL, NULL },
};
static const gchar *const col_label[N_SUMMARY_COLS] = {
- "", /* S_COL_MARK */
- N_("S"), /* S_COL_STATUS */
- "", /* S_COL_MIME */
- N_("Subject"), /* S_COL_SUBJECT */
- N_("From"), /* S_COL_FROM */
- N_("To"), /* S_COL_TO */
- N_("Date"), /* S_COL_DATE */
- N_("Size"), /* S_COL_SIZE */
- N_("#"), /* S_COL_NUMBER */
- N_("Score"), /* S_COL_SCORE */
- "", /* S_COL_LOCKED */
- N_("Tags"), /* S_COL_TAGS */
+ "", /* S_COL_MARK */
+ N_("S"), /* S_COL_STATUS */
+ "", /* S_COL_MIME */
+ N_("Subject"), /* S_COL_SUBJECT */
+ N_("From"), /* S_COL_FROM */
+ N_("To"), /* S_COL_TO */
+ N_("Date"), /* S_COL_DATE */
+ N_("Size"), /* S_COL_SIZE */
+ N_("#"), /* S_COL_NUMBER */
+ N_("Score"), /* S_COL_SCORE */
+ "", /* S_COL_LOCKED */
+ N_("Tags"), /* S_COL_TAGS */
};
void summary_freeze(SummaryView *summaryview)
toggle_search = gtk_toggle_button_new();
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle_search),
prefs_common.show_searchbar);
- gtkut_widget_set_can_focus(toggle_search, FALSE);
+ gtk_widget_set_can_focus(toggle_search, FALSE);
gtk_widget_show(toggle_search);
CLAWS_SET_TIP(toggle_search, _("Toggle quick search bar"));
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Mark", "Message/Mark/Mark", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Unmark", "Message/Mark/Unmark", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Separator1", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "MarkUnread", "Message/Mark/MarkUnread", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "MarkRead", "Message/Mark/MarkRead", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "MarkUnread", "Message/Mark/MarkUnread", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Separator2", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "MarkAllRead", "Message/Mark/MarkAllRead", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "MarkAllUnread", "Message/Mark/MarkAllUnread", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "Separator3", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "IgnoreThread", "Message/Mark/IgnoreThread", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup/Mark", "UnignoreThread", "Message/Mark/UnignoreThread", GTK_UI_MANAGER_MENUITEM)
}
}
bold_marked_style = gtk_style_copy(bold_style);
- bold_marked_style->fg[GTK_STATE_NORMAL] =
+ bold_marked_style->text[GTK_STATE_NORMAL] =
summaryview->color_marked;
bold_deleted_style = gtk_style_copy(bold_style);
- bold_deleted_style->fg[GTK_STATE_NORMAL] =
+ bold_deleted_style->text[GTK_STATE_NORMAL] =
summaryview->color_dim;
}
val = alertpanel(_("Process mark"),
_("Some marks are left. Process them?"),
- GTK_STOCK_NO, GTK_STOCK_YES, GTK_STOCK_CANCEL);
+ GTK_STOCK_NO, GTK_STOCK_YES, GTK_STOCK_CANCEL, ALERTFOCUS_FIRST);
if (G_ALERTALTERNATE == val) {
summary_unlock(summaryview);
summary_execute(summaryview);
/* set ctree and hash table from the msginfo list, and
create the thread */
- summary_set_ctree_from_list(summaryview, mlist);
+ summary_set_ctree_from_list(summaryview, mlist, selected_msgnum);
g_slist_free(mlist);
if (!summaryview->displayed)
messageview_clear(summaryview->messageview);
summary_unlock(summaryview);
- summary_select_by_msgnum(summaryview, selected_msgnum);
+
+ if (quicksearch_is_running(summaryview->quicksearch))
+ summary_select_by_msgnum(summaryview, selected_msgnum,
+ OPEN_SELECTED_ON_SEARCH_RESULTS);
+ else
+ summary_select_by_msgnum(summaryview, selected_msgnum,
+ OPEN_SELECTED_ON_FOLDER_OPEN);
+
summary_lock(summaryview);
if (!summaryview->selected) {
/* no selected message - select first unread
item->sort_type == SORT_DESCENDING
? 0 : GTK_CMCLIST(ctree)->rows - 1);
summary_unlock(summaryview);
- summary_select_node(summaryview, node, 0);
+
+ if (quicksearch_is_running(summaryview->quicksearch))
+ summary_select_node(summaryview, node,
+ OPEN_SELECTED_ON_SEARCH_RESULTS);
+ else
+ summary_select_node(summaryview, node,
+ OPEN_SELECTED_ON_FOLDER_OPEN);
+
summary_lock(summaryview);
}
} else {
(ctree,
item->sort_type == SORT_DESCENDING
? 0 : GTK_CMCLIST(ctree)->rows - 1);
- gtk_sctree_select(GTK_SCTREE(ctree), node);
- summaryview->selected = node;
- gtk_cmctree_node_moveto(ctree, node, 0, 0.5, 0);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_SEARCH_RESULTS);
}
} else {
/* backward compat */
EntryAction act = prefs_common.summary_select_prio[i];
switch(act) {
- case ACTION_MARKED:
- node = summary_find_next_flagged_msg(summaryview, NULL,
+ case ACTION_OLDEST_MARKED:
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_next_flagged_msg(summaryview, NULL,
+ MSG_MARKED, FALSE);
+ else
+ node = summary_find_prev_flagged_msg(summaryview, NULL,
MSG_MARKED, FALSE);
break;
- case ACTION_NEW:
- node = summary_find_next_flagged_msg(summaryview, NULL,
+ case ACTION_NEWEST_MARKED:
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_prev_flagged_msg(summaryview, NULL,
+ MSG_MARKED, FALSE);
+ else
+ node = summary_find_next_flagged_msg(summaryview, NULL,
+ MSG_MARKED, FALSE);
+ break;
+ case ACTION_OLDEST_NEW:
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_next_flagged_msg(summaryview, NULL,
+ MSG_NEW, FALSE);
+ else
+ node = summary_find_prev_flagged_msg(summaryview, NULL,
MSG_NEW, FALSE);
break;
- case ACTION_UNREAD:
- node = summary_find_next_flagged_msg(summaryview, NULL,
+ case ACTION_NEWEST_NEW:
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_prev_flagged_msg(summaryview, NULL,
+ MSG_NEW, FALSE);
+ else
+ node = summary_find_next_flagged_msg(summaryview, NULL,
+ MSG_NEW, FALSE);
+ break;
+ case ACTION_OLDEST_UNREAD:
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_next_flagged_msg(summaryview, NULL,
+ MSG_UNREAD, FALSE);
+ else
+ node = summary_find_prev_flagged_msg(summaryview, NULL,
+ MSG_UNREAD, FALSE);
+ break;
+ case ACTION_NEWEST_UNREAD:
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_prev_flagged_msg(summaryview, NULL,
+ MSG_UNREAD, FALSE);
+ else
+ node = summary_find_next_flagged_msg(summaryview, NULL,
MSG_UNREAD, FALSE);
break;
case ACTION_LAST_OPENED:
summaryview->folder_item->last_seen);
}
break;
- case ACTION_LAST_LIST:
+ case ACTION_NEWEST_LIST:
if (GTK_CMCLIST(ctree)->row_list != NULL) {
node = gtk_cmctree_node_nth
(ctree,
? 0 : GTK_CMCLIST(ctree)->rows - 1);
}
break;
- case ACTION_FIRST_LIST:
+ case ACTION_OLDEST_LIST:
if (GTK_CMCLIST(ctree)->row_list != NULL) {
node = gtk_cmctree_node_nth
(ctree,
}
summary_unlock(summaryview);
- if (node)
- summary_select_node(summaryview, node, -1);
+
+ if (node) {
+ gint open_selected = -1;
+ if (!is_refresh) {
+ if (OPEN_SELECTED_ON_FOLDER_OPEN)
+ open_selected = 1;
+ else
+ open_selected = 0;
+ }
+ summary_select_node(summaryview, node, open_selected);
+ }
+
summary_lock(summaryview);
}
gboolean sensitive;
gint i;
-#define N_ENTRIES 38
+#ifndef GENERIC_UMPC
+#define N_ENTRIES 39
+#else
+#define N_ENTRIES 28
+#endif
static struct {
const gchar *entry;
SensitiveCondMask cond;
FILL_TABLE("Menus/SummaryViewPopup/Mark", M_TARGET_EXIST);
FILL_TABLE("Menus/SummaryViewPopup/Mark/Mark", M_TARGET_EXIST);
FILL_TABLE("Menus/SummaryViewPopup/Mark/Unmark", M_TARGET_EXIST);
- FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkUnread", M_TARGET_EXIST);
FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkRead", M_TARGET_EXIST);
+ FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkUnread", M_TARGET_EXIST);
FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkAllRead", M_TARGET_EXIST);
+ FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkAllUnread", M_TARGET_EXIST);
FILL_TABLE("Menus/SummaryViewPopup/Mark/IgnoreThread", M_TARGET_EXIST);
FILL_TABLE("Menus/SummaryViewPopup/Mark/UnignoreThread", M_TARGET_EXIST);
FILL_TABLE("Menus/SummaryViewPopup/Mark/WatchThread", M_TARGET_EXIST);
FILL_TABLE("Menus/SummaryViewPopup/Mark/UnwatchThread", M_TARGET_EXIST);
- FILL_TABLE("Menus/SummaryViewPopup/Mark/Unlock", M_TARGET_EXIST);
FILL_TABLE("Menus/SummaryViewPopup/Mark/Lock", M_TARGET_EXIST);
+ FILL_TABLE("Menus/SummaryViewPopup/Mark/Unlock", M_TARGET_EXIST);
FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkSpam", M_TARGET_EXIST, M_CAN_LEARN_SPAM);
FILL_TABLE("Menus/SummaryViewPopup/Mark/MarkHam", M_TARGET_EXIST, M_CAN_LEARN_SPAM);
FILL_TABLE("Menus/SummaryViewPopup/ColorLabel", M_TARGET_EXIST);
GtkCMCTreeNode *node = summaryview->selected;
GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
- node = gtkut_ctree_node_prev(ctree, node);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = gtkut_ctree_node_prev(ctree, node);
+ else
+ node = gtkut_ctree_node_next(ctree, node);
if (node && node != summaryview->selected)
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
}
void summary_select_next(SummaryView *summaryview)
GtkCMCTreeNode *node = summaryview->selected;
GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
- node = gtkut_ctree_node_next(ctree, node);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = gtkut_ctree_node_next(ctree, node);
+ else
+ node = gtkut_ctree_node_prev(ctree, node);
if (node && node != summaryview->selected)
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
}
void summary_select_prev_unread(SummaryView *summaryview)
{
GtkCMCTreeNode *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_UNREAD, skip_cur);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_prev_flagged_msg
+ (summaryview, summaryview->selected, MSG_UNREAD, TRUE);
+ else
+ node = summary_find_next_flagged_msg
+ (summaryview, summaryview->selected, MSG_UNREAD, TRUE);
if (!node || node == summaryview->selected) {
AlertValue val = 0;
val = alertpanel(_("No more unread messages"),
_("No unread message found. "
"Search from the end?"),
- GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL);
+ GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND);
break;
case NEXTUNREADMSGDIALOG_ASSUME_YES:
val = G_ALERTALTERNATE;
_("Internal error: unexpected value for prefs_common.next_unread_msg_dialog\n"));
}
if (val != G_ALERTALTERNATE) return;
- node = summary_find_prev_flagged_msg(summaryview, NULL,
- MSG_UNREAD, FALSE);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_prev_flagged_msg(summaryview, NULL,
+ MSG_UNREAD, FALSE);
+ else
+ node = summary_find_next_flagged_msg(summaryview, NULL,
+ MSG_UNREAD, FALSE);
}
if (!node)
alertpanel_notice(_("No unread messages."));
else
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
}
void summary_select_next_unread(SummaryView *summaryview)
{
GtkCMCTreeNode *node = summaryview->selected;
- 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_UNREAD, skip_cur);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_next_flagged_msg
+ (summaryview, node, MSG_UNREAD, TRUE);
+ else
+ node = summary_find_prev_flagged_msg
+ (summaryview, node, MSG_UNREAD, TRUE);
if (node)
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
else {
- node = summary_find_next_flagged_msg
- (summaryview, NULL, MSG_UNREAD, FALSE);
- if (node == NULL || node == summaryview->selected) {
- AlertValue val = 0;
-
- switch (prefs_common.next_unread_msg_dialog) {
- case NEXTUNREADMSGDIALOG_ALWAYS:
- val = alertpanel(_("No more unread messages"),
- _("No unread message found. "
- "Go to next folder?"),
- GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL);
- break;
- case NEXTUNREADMSGDIALOG_ASSUME_YES:
- val = G_ALERTALTERNATE;
- 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_ALERTALTERNATE)
- folderview_select_next_with_flag(summaryview->folderview, MSG_UNREAD);
- } else {
- summary_select_node(summaryview, node, -1);
- }
+ AlertValue val = 0;
+
+ switch (prefs_common.next_unread_msg_dialog) {
+ case NEXTUNREADMSGDIALOG_ALWAYS:
+ val = alertpanel(_("No more unread messages"),
+ _("No unread message found. "
+ "Go to next folder?"),
+ GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND);
+ break;
+ case NEXTUNREADMSGDIALOG_ASSUME_YES:
+ val = G_ALERTALTERNATE;
+ 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_ALERTALTERNATE)
+ folderview_select_next_with_flag(summaryview->folderview, MSG_UNREAD);
}
}
void summary_select_prev_new(SummaryView *summaryview)
{
GtkCMCTreeNode *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, skip_cur);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_prev_flagged_msg
+ (summaryview, summaryview->selected, MSG_NEW, TRUE);
+ else
+ node = summary_find_next_flagged_msg
+ (summaryview, summaryview->selected, MSG_NEW, TRUE);
if (!node || node == summaryview->selected) {
AlertValue val = 0;
val = alertpanel(_("No more new messages"),
_("No new message found. "
"Search from the end?"),
- GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL);
+ GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND);
break;
case NEXTUNREADMSGDIALOG_ASSUME_YES:
val = G_ALERTALTERNATE;
_("Internal error: unexpected value for prefs_common.next_unread_msg_dialog\n"));
}
if (val != G_ALERTALTERNATE) return;
- node = summary_find_prev_flagged_msg(summaryview, NULL,
- MSG_NEW, FALSE);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_prev_flagged_msg(summaryview, NULL,
+ MSG_NEW, FALSE);
+ else
+ node = summary_find_next_flagged_msg(summaryview, NULL,
+ MSG_NEW, FALSE);
}
if (!node)
alertpanel_notice(_("No new messages."));
else
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
}
void summary_select_next_new(SummaryView *summaryview)
{
GtkCMCTreeNode *node = summaryview->selected;
- 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 (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_next_flagged_msg
+ (summaryview, node, MSG_NEW, TRUE);
+ else
+ node = summary_find_prev_flagged_msg
+ (summaryview, node, MSG_NEW, TRUE);
if (node)
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
else {
- node = summary_find_next_flagged_msg
- (summaryview, NULL, MSG_NEW, FALSE);
- if (node == NULL || node == summaryview->selected) {
- 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_NO, "+"GTK_STOCK_YES, NULL);
- break;
- case NEXTUNREADMSGDIALOG_ASSUME_YES:
- val = G_ALERTALTERNATE;
- 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_ALERTALTERNATE) {
- folderview_select_next_with_flag(summaryview->folderview, MSG_NEW);
- return;
- }
- else
- return;
- } else
- summary_select_node(summaryview, node, -1);
+ 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_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND);
+ break;
+ case NEXTUNREADMSGDIALOG_ASSUME_YES:
+ val = G_ALERTALTERNATE;
+ 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_ALERTALTERNATE)
+ folderview_select_next_with_flag(summaryview->folderview, MSG_NEW);
}
}
{
GtkCMCTreeNode *node;
- node = summary_find_prev_flagged_msg
- (summaryview, summaryview->selected, MSG_MARKED, TRUE);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_prev_flagged_msg
+ (summaryview, summaryview->selected, MSG_MARKED, TRUE);
+ else
+ node = summary_find_next_flagged_msg
+ (summaryview, summaryview->selected, MSG_MARKED, TRUE);
if (!node) {
AlertValue val;
val = alertpanel(_("No more marked messages"),
_("No marked message found. "
"Search from the end?"),
- GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL);
+ GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND);
if (val != G_ALERTALTERNATE) return;
node = summary_find_prev_flagged_msg(summaryview, NULL,
MSG_MARKED, TRUE);
if (!node)
alertpanel_notice(_("No marked messages."));
else
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
}
void summary_select_next_marked(SummaryView *summaryview)
{
GtkCMCTreeNode *node = summaryview->selected;
- 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_MARKED, skip_cur);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_next_flagged_msg
+ (summaryview, node, MSG_MARKED, TRUE);
+ else
+ node = summary_find_prev_flagged_msg
+ (summaryview, node, MSG_MARKED, TRUE);
if (node)
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
else {
- node = summary_find_next_flagged_msg
- (summaryview, NULL, MSG_MARKED, FALSE);
- if (node == NULL || node == summaryview->selected) {
- AlertValue val = 0;
-
- switch (prefs_common.next_unread_msg_dialog) {
- case NEXTUNREADMSGDIALOG_ALWAYS:
- val = alertpanel(_("No more marked messages"),
- _("No marked message found. "
- "Go to next folder?"),
- GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL);
- break;
- case NEXTUNREADMSGDIALOG_ASSUME_YES:
- val = G_ALERTALTERNATE;
- 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_ALERTALTERNATE) {
- folderview_select_next_with_flag(summaryview->folderview, MSG_MARKED);
- return;
- }
- else
- return;
- } else
- summary_select_node(summaryview, node, -1);
+ AlertValue val = 0;
+ switch (prefs_common.next_unread_msg_dialog) {
+ case NEXTUNREADMSGDIALOG_ALWAYS:
+ val = alertpanel(_("No more marked messages"),
+ _("No marked message found. "
+ "Go to next folder?"),
+ GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND);
+ break;
+ case NEXTUNREADMSGDIALOG_ASSUME_YES:
+ val = G_ALERTALTERNATE;
+ 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_ALERTALTERNATE)
+ folderview_select_next_with_flag(summaryview->folderview, MSG_MARKED);
}
}
{
GtkCMCTreeNode *node;
- node = summary_find_prev_flagged_msg
- (summaryview, summaryview->selected, MSG_CLABEL_FLAG_MASK, TRUE);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_prev_flagged_msg
+ (summaryview, summaryview->selected, MSG_CLABEL_FLAG_MASK, TRUE);
+ else
+ node = summary_find_next_flagged_msg
+ (summaryview, summaryview->selected, MSG_CLABEL_FLAG_MASK, TRUE);
if (!node) {
AlertValue val;
val = alertpanel(_("No more labeled messages"),
_("No labeled message found. "
"Search from the end?"),
- GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL);
+ GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND);
if (val != G_ALERTALTERNATE) return;
node = summary_find_prev_flagged_msg(summaryview, NULL,
MSG_CLABEL_FLAG_MASK, TRUE);
if (!node)
alertpanel_notice(_("No labeled messages."));
else
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
}
void summary_select_next_labeled(SummaryView *summaryview)
{
GtkCMCTreeNode *node;
- node = summary_find_next_flagged_msg
- (summaryview, summaryview->selected, MSG_CLABEL_FLAG_MASK, TRUE);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_next_flagged_msg
+ (summaryview, summaryview->selected, MSG_CLABEL_FLAG_MASK, TRUE);
+ else
+ node = summary_find_prev_flagged_msg
+ (summaryview, summaryview->selected, MSG_CLABEL_FLAG_MASK, TRUE);
if (!node) {
AlertValue val;
val = alertpanel(_("No more labeled messages"),
_("No labeled message found. "
"Search from the beginning?"),
- GTK_STOCK_NO, "+"GTK_STOCK_YES, NULL);
+ GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_SECOND);
if (val != G_ALERTALTERNATE) return;
- node = summary_find_next_flagged_msg(summaryview, NULL,
- MSG_CLABEL_FLAG_MASK, TRUE);
+ if (summaryview->sort_type == SORT_ASCENDING)
+ node = summary_find_next_flagged_msg(summaryview, NULL,
+ MSG_CLABEL_FLAG_MASK, TRUE);
+ else
+ node = summary_find_prev_flagged_msg(summaryview, NULL,
+ MSG_CLABEL_FLAG_MASK, TRUE);
}
if (!node)
alertpanel_notice(_("No labeled messages."));
else
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
}
void summary_select_parent(SummaryView *summaryview)
if (summaryview->selected)
node = GTK_CMCTREE_ROW(summaryview->selected)->parent;
if (node)
- summary_select_node(summaryview, node, -1);
-}
-
-void summary_select_by_msgnum(SummaryView *summaryview, guint msgnum)
-{
- GtkCMCTreeNode *node;
-
- node = summary_find_msg_by_msgnum(summaryview, msgnum);
- summary_select_node(summaryview, node, 0);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_PREVNEXT);
}
-void summary_display_by_msgnum(SummaryView *summaryview, guint msgnum)
+void summary_select_by_msgnum(SummaryView *summaryview, guint msgnum,
+ gboolean show)
{
GtkCMCTreeNode *node;
node = summary_find_msg_by_msgnum(summaryview, msgnum);
- summary_select_node(summaryview, node, 1);
+ summary_select_node(summaryview, node, show);
}
void summary_select_by_msg_list(SummaryView *summaryview, GSList *msginfos)
* summary_select_node:
* @summaryview: Summary view.
* @node: Summary tree node.
- * @force_display: -1 unset, 0 don't show the msg, 1 show the msg.
+ * @display_msg: whether to also display the message
*
* Select @node (bringing it into view by scrolling and expanding its
- * thread, if necessary) and unselect all others. If @force_display is
- * 1, display the corresponding message in the message view, if
- * @force_display is -1, obey prefs_common.always_show_msg.
+ * thread, if necessary) and unselect all others.
**/
+
void summary_select_node(SummaryView *summaryview, GtkCMCTreeNode *node,
- gint force_display)
+ gboolean display_msg)
{
GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
- gboolean display_msg;
-
- display_msg = force_display > -1? force_display :
- (prefs_common.always_show_msg == OPENMSG_ALWAYS) ||
- ((prefs_common.always_show_msg == OPENMSG_WHEN_VIEW_VISIBLE &&
- messageview_is_visible(summaryview->messageview)));
+
+ /* If msgview is hidden, we never want to automatically display
+ * a selected message, since that would unhide the msgview. */
+ if (!messageview_is_visible(summaryview->messageview))
+ display_msg = FALSE;
if (summary_is_locked(summaryview)
&& !GTK_SCTREE(ctree)->selecting_range
if (!summaryview->folder_item)
return;
if (node) {
- summary_cancel_mark_read_timeout(summaryview);
gtkut_ctree_expand_parent_all(ctree, node);
summary_lock(summaryview);
return all_read;
}
+typedef struct _ThreadSelectedData {
+ guint msgnum;
+ gboolean is_selected;
+} ThreadSelectedData;
+
+static gboolean summary_update_is_selected(GNode *gnode, gpointer data)
+{
+ ThreadSelectedData *selected = (ThreadSelectedData *)data;
+ MsgInfo *msginfo = (MsgInfo *)gnode->data;
+
+ if (msginfo->msgnum == selected->msgnum) {
+ selected->is_selected = TRUE;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean summary_thread_is_selected(GNode *gnode, guint selected_msgnum)
+{
+ ThreadSelectedData selected;
+
+ selected.msgnum = selected_msgnum;
+ selected.is_selected = FALSE;
+ g_node_traverse(gnode, G_IN_ORDER, G_TRAVERSE_ALL, -1,
+ summary_update_is_selected, &selected);
+ return selected.is_selected;
+}
+
static gboolean summary_insert_gnode_func(GtkCMCTree *ctree, guint depth, GNode *gnode,
GtkCMCTreeNode *cnode, gpointer data)
{
}
static void summary_set_ctree_from_list(SummaryView *summaryview,
- GSList *mlist)
+ GSList *mlist, guint selected_msgnum)
{
GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
MsgInfo *msginfo;
for (gnode = root->children; gnode != NULL;
gnode = gnode->next) {
- if (!summaryview->folder_item->hide_read_threads ||
- !summary_thread_is_read(gnode))
- {
- summary_find_thread_age(gnode);
- node = gtk_sctree_insert_gnode
- (ctree, NULL, node, gnode,
- summary_insert_gnode_func, summaryview);
- }
+ if (!summaryview->folder_item->hide_read_threads ||
+ !summary_thread_is_read(gnode) ||
+ summary_thread_is_selected(gnode, selected_msgnum)) {
+ summary_find_thread_age(gnode);
+ node = gtk_sctree_insert_gnode
+ (ctree, NULL, node, gnode,
+ summary_insert_gnode_func, summaryview);
+ }
}
g_node_destroy(root);
to_text = msginfo->to ? msginfo->to :
(msginfo->cc ? msginfo->cc :
- (msginfo->newsgroups ? msginfo->newsgroups : _("(No Recipient)")
+ (msginfo->newsgroups ? msginfo->newsgroups : NULL
)
);
+ if (!to_text)
+ to_text = _("(No Recipient)");
+ else {
+ if (prefs_common.summary_from_show == SHOW_NAME) {
+ gchar *tmp = procheader_get_fromname(to_text);
+ /* need to keep to_text pointing to stack, so heap-allocated
+ * string from procheader_get_fromname() will be copied to buf */
+ if (tmp != NULL) {
+ strncpy2(buf, tmp, sizeof(buf));
+ g_free(tmp);
+ to_text = buf;
+ }
+ } else if (prefs_common.summary_from_show == SHOW_ADDR)
+ extract_address(to_text);
+ }
+
text[col_pos[S_COL_TO]] = to_text;
if (!should_swap) {
text[col_pos[S_COL_FROM]] = from_text;
} else {
if (prefs_common.use_addr_book) {
gchar *tmp = summary_complete_address(to_text);
+ /* need to keep to_text pointing to stack, so heap-allocated
+ * string from summary_complete_address() will be copied to buf */
if (tmp) {
strncpy2(buf, tmp, sizeof(buf));
g_free(tmp);
msginfo->msgnum);
}
+static void summary_mark_row_as_unread(SummaryView *summaryview,
+ GtkCMCTreeNode *row)
+{
+ GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+ MsgInfo *msginfo;
+
+ msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+ cm_return_if_fail(msginfo);
+
+ if(MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags))
+ return;
+
+ summary_msginfo_set_flags(msginfo, MSG_UNREAD, 0);
+ summary_set_row_marks(summaryview, row);
+ debug_print("Message %d is marked as unread\n",
+ msginfo->msgnum);
+}
+
void summary_mark_as_read(SummaryView *summaryview)
{
GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
if (summary_is_locked(summaryview))
return;
+
+ if ((summaryview->folder_item->total_msgs == (gint)g_list_length(GTK_CMCLIST(ctree)->selection))
+ && !summary_mark_all_read_confirm(TRUE))
+ return;
+
START_LONG_OPERATION(summaryview, FALSE);
folder_item_set_batch(summaryview->folder_item, TRUE);
for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
summary_status_show(summaryview);
}
+void summary_mark_as_unread(SummaryView *summaryview)
+{
+ GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+ GList *cur;
+ gboolean froze = FALSE;
+
+ if (summary_is_locked(summaryview))
+ return;
+
+ if ((summaryview->folder_item->total_msgs == (gint)g_list_length(GTK_CMCLIST(ctree)->selection))
+ && !summary_mark_all_unread_confirm(TRUE))
+ return;
+
+ START_LONG_OPERATION(summaryview, FALSE);
+ folder_item_set_batch(summaryview->folder_item, TRUE);
+ for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+ summary_mark_row_as_unread(summaryview,
+ GTK_CMCTREE_NODE(cur->data));
+ folder_item_set_batch(summaryview->folder_item, FALSE);
+ END_LONG_OPERATION(summaryview);
+
+ summary_status_show(summaryview);
+}
+
void summary_msgs_lock(SummaryView *summaryview)
{
GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
summary_status_show(summaryview);
}
-void summary_mark_all_read(SummaryView *summaryview)
+static gboolean summary_mark_all_read_confirm(gboolean ask_if_needed)
+{
+ /* ask_if_needed is FALSE when user-asking is performed by caller,
+ commonly when the caller is a mark-as-read-recursive func */
+ if (ask_if_needed && prefs_common.ask_mark_all_read) {
+ AlertValue val = alertpanel_full(_("Mark all as read"),
+ _("Do you really want to mark all mails in this folder as read?"),
+ GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST,
+ TRUE, NULL, ALERT_QUESTION);
+
+ if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE)
+ return FALSE;
+ else if (val & G_ALERTDISABLE)
+ prefs_common.ask_mark_all_read = FALSE;
+ }
+ return TRUE;
+}
+
+void summary_mark_all_read(SummaryView *summaryview, gboolean ask_if_needed)
{
GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
GtkCMCTreeNode *node;
- AlertValue val;
gboolean froze = FALSE;
+
+ if (summary_is_locked(summaryview))
+ return;
- if (prefs_common.ask_mark_all_read) {
- val = alertpanel_full(_("Mark all as read"),
- _("Do you really want to mark all mails in this "
- "folder as read?"), GTK_STOCK_NO, GTK_STOCK_YES, NULL,
- TRUE, NULL, ALERT_QUESTION, G_ALERTDEFAULT);
+ if (!summary_mark_all_read_confirm(ask_if_needed))
+ return;
+
+ START_LONG_OPERATION(summaryview, TRUE);
+ folder_item_set_batch(summaryview->folder_item, TRUE);
+ for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;
+ node = gtkut_ctree_node_next(ctree, node))
+ summary_mark_row_as_read(summaryview, node);
+ folder_item_set_batch(summaryview->folder_item, FALSE);
+ for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;
+ node = gtkut_ctree_node_next(ctree, node)) {
+ if (!GTK_CMCTREE_ROW(node)->expanded)
+ summary_set_row_marks(summaryview, node);
+ }
+ END_LONG_OPERATION(summaryview);
+
+ summary_status_show(summaryview);
+}
+
+static gboolean summary_mark_all_unread_confirm(gboolean ask_if_needed)
+{
+ /* ask_if_needed is FALSE when user-asking is performed by caller,
+ commonly when the caller is a mark-as-unread-recursive func */
+ if (ask_if_needed && prefs_common.ask_mark_all_read) {
+ AlertValue val = alertpanel_full(_("Mark all as unread"),
+ _("Do you really want to mark all mails in this folder as unread?"),
+ GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST,
+ TRUE, NULL, ALERT_QUESTION);
if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE)
- return;
+ return FALSE;
else if (val & G_ALERTDISABLE)
prefs_common.ask_mark_all_read = FALSE;
}
+ return TRUE;
+}
+
+void summary_mark_all_unread(SummaryView *summaryview, gboolean ask_if_needed)
+{
+ GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+ GtkCMCTreeNode *node;
+ gboolean froze = FALSE;
if (summary_is_locked(summaryview))
return;
+
+ if (!summary_mark_all_unread_confirm(ask_if_needed))
+ return;
+
START_LONG_OPERATION(summaryview, TRUE);
folder_item_set_batch(summaryview->folder_item, TRUE);
for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;
node = gtkut_ctree_node_next(ctree, node))
- summary_mark_row_as_read(summaryview, node);
+ summary_mark_row_as_unread(summaryview, node);
folder_item_set_batch(summaryview->folder_item, FALSE);
for (node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list); node != NULL;
node = gtkut_ctree_node_next(ctree, node)) {
summary_status_show(summaryview);
}
-
-static void summary_mark_row_as_unread(SummaryView *summaryview,
- GtkCMCTreeNode *row)
-{
- GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
- MsgInfo *msginfo;
-
- msginfo = gtk_cmctree_node_get_row_data(ctree, row);
- cm_return_if_fail(msginfo);
- if (MSG_IS_DELETED(msginfo->flags)) {
- procmsg_msginfo_set_to_folder(msginfo, NULL);
- summary_msginfo_unset_flags(msginfo, MSG_DELETED, 0);
- summaryview->deleted--;
- }
-
- summary_msginfo_set_flags(msginfo, MSG_UNREAD, 0);
- debug_print("Message %d is marked as unread\n",
- msginfo->msgnum);
-
- summary_set_row_marks(summaryview, row);
-}
-
-void summary_mark_as_unread(SummaryView *summaryview)
-{
- GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
- GList *cur;
- gboolean froze = FALSE;
-
- if (summary_is_locked(summaryview))
- return;
- START_LONG_OPERATION(summaryview, FALSE);
- folder_item_set_batch(summaryview->folder_item, TRUE);
- for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL;
- cur = cur->next)
- summary_mark_row_as_unread(summaryview,
- GTK_CMCTREE_NODE(cur->data));
- folder_item_set_batch(summaryview->folder_item, FALSE);
- END_LONG_OPERATION(summaryview);
-
- summary_status_show(summaryview);
-}
-
static gboolean check_permission(SummaryView *summaryview, MsgInfo * msginfo)
{
GList * cur;
}
if (!found) {
- alertpanel_error(_("You're not the author of the article.\n"));
+ alertpanel_error(_("You're not the author of the article."));
}
return found;
if (!prefs_common.live_dangerously) {
gchar *buf = NULL;
- int num = g_list_length(GTK_CMCLIST(summaryview->ctree)->selection);
+ guint num = g_list_length(GTK_CMCLIST(summaryview->ctree)->selection);
buf = g_strdup_printf(ngettext(
"Do you really want to delete the selected message?",
"Do you really want to delete the %d selected messages?", num),
num);
aval = alertpanel(ngettext("Delete message", "Delete messages", num),
buf,
- GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL);
+ GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_SECOND);
g_free(buf);
if (aval != G_ALERTALTERNATE) {
END_LONG_OPERATION(summaryview);
if (!node || prefs_common.next_on_delete == FALSE)
node = summary_find_next_msg(summaryview, sel_last,TRUE);
}
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_DELETEMOVE);
if (prefs_common.immediate_exec || folder_has_parent_of_type(item, F_TRASH)) {
summary_execute(summaryview);
if (!node || prefs_common.next_on_delete == FALSE)
node = summary_find_next_msg(summaryview, sel_last,TRUE);
}
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_DELETEMOVE);
summary_status_show(summaryview);
}
GtkCMCTreeNode *node = gtk_cmctree_node_nth (GTK_CMCTREE(summaryview->ctree),
GTK_CMCLIST(summaryview->ctree)->rows - 1);
if (node)
- summary_select_node(summaryview, node, -1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_DELETEMOVE);
}
}
if (!summaryview->folder_item ||
FOLDER_TYPE(summaryview->folder_item->folder) == F_NEWS) return;
- to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE);
+ to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE,
+ ngettext(
+ "Select folder to move selected message to",
+ "Select folder to move selected messages to",
+ g_list_length(GTK_CMCLIST(summaryview->ctree)->selection))
+ );
summary_move_selected_to(summaryview, to_folder);
}
if (!summaryview->folder_item) return;
- to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE);
+ to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE,
+ ngettext(
+ "Select folder to copy selected message to",
+ "Select folder to copy selected messages to",
+ g_list_length(GTK_CMCLIST(summaryview->ctree)->selection))
+ );
summary_copy_selected_to(summaryview, to_folder);
}
void summary_select_all(SummaryView *summaryview)
{
+ GtkCMCTreeNode *node;
+
if (!summaryview->folder_item) return;
+ if (GTK_CMCLIST(summaryview->ctree)->focus_row < 0) {
+ /* If no row is selected, select (but do not open) the first
+ * row, to get summaryview into correct state for selecting all. */
+ debug_print("summary_select_all: no row selected, selecting first one\n");
+ if (GTK_CMCLIST(summaryview->ctree)->row_list != NULL) {
+ node = gtk_cmctree_node_nth(GTK_CMCTREE(summaryview->ctree), 0);
+ summary_select_node(summaryview, node, FALSE);
+ }
+ }
+
+ /* Now select all rows while locking the summaryview for
+ * faster performance. */
summary_lock(summaryview);
gtk_cmclist_select_all(GTK_CMCLIST(summaryview->ctree));
summary_unlock(summaryview);
+
summary_status_show(summaryview);
}
if (is_file_exist(dest)) {
aval = alertpanel(_("Append or Overwrite"),
_("Append or overwrite existing file?"),
- _("_Append"), _("_Overwrite"),
- GTK_STOCK_CANCEL);
+ _("_Append"), _("_Overwrite"), GTK_STOCK_CANCEL,
+ ALERTFOCUS_FIRST);
if (aval != 0 && aval != 1)
return;
}
"want to continue?"),
g_list_length(clist->selection));
if (g_list_length(clist->selection) > 9
- && alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, "+" GTK_STOCK_YES, NULL)
- != G_ALERTALTERNATE) {
+ && alertpanel(_("Warning"), msg, GTK_STOCK_CANCEL, GTK_STOCK_YES,
+ NULL, ALERTFOCUS_SECOND) != G_ALERTALTERNATE) {
g_free(msg);
return;
}
if (new_selected) {
summary_unlock(summaryview);
- gtk_sctree_select
- (GTK_SCTREE(ctree), new_selected);
+ summary_select_node(summaryview, new_selected, OPEN_SELECTED_ON_DELETEMOVE);
summary_lock(summaryview);
}
if (new_selected) {
summary_unlock(summaryview);
- gtk_sctree_select
- (GTK_SCTREE(ctree), new_selected);
+ summary_select_node(summaryview, new_selected, OPEN_SELECTED_ON_DELETEMOVE);
summary_lock(summaryview);
}
while (node && GTK_CMCTREE_ROW(node)->parent) {
focus_node = node = GTK_CMCTREE_ROW(node)->parent;
}
- gtk_sctree_select(GTK_SCTREE(ctree), focus_node);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_DIRECTIONAL);
node = GTK_CMCTREE_NODE(GTK_CMCLIST(ctree)->row_list);
while (node) {
if (GTK_CMCTREE_ROW(node)->children) {
_("Filtering"),
_("There are some filtering rules that belong to an account.\n"
"Please choose what to do with these rules:"),
- GTK_STOCK_CANCEL, _("_Filter"), NULL, TRUE, G_ALERTALTERNATE, vbox);
+ GTK_STOCK_CANCEL, _("_Filter"), NULL, ALERTFOCUS_SECOND,
+ TRUE, vbox);
if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE) {
return FALSE;
}
/* summary_set_colorlabel_color() - labelcolor parameter is the color *flag*
- * for the messsage; not the color index */
+ * for the message; not the color index */
void summary_set_colorlabel_color(GtkCMCTree *ctree, GtkCMCTreeNode *node,
guint labelcolor)
{
if (color_index < 0 || color_index >= N_COLOR_LABELS) {
if (!prev_style) return;
style = gtk_style_copy(prev_style);
- color = ctree_style->fg[GTK_STATE_NORMAL];
- style->fg[GTK_STATE_NORMAL] = color;
- color = ctree_style->fg[GTK_STATE_SELECTED];
- style->fg[GTK_STATE_SELECTED] = color;
+ color = ctree_style->text[GTK_STATE_NORMAL];
+ style->text[GTK_STATE_NORMAL] = color;
+ color = ctree_style->text[GTK_STATE_SELECTED];
+ style->text[GTK_STATE_SELECTED] = color;
} else {
if (prev_style)
style = gtk_style_copy(prev_style);
else
style = gtk_style_copy(ctree_style);
color = colorlabel_get_color(color_index);
- style->fg[GTK_STATE_NORMAL] = color;
+ style->text[GTK_STATE_NORMAL] = color;
/* get the average of label color and selected fg color
for visibility */
- style->fg[GTK_STATE_SELECTED].red = (color.red + 3*ctree_style->fg[GTK_STATE_SELECTED].red ) / 4;
- style->fg[GTK_STATE_SELECTED].green = (color.green + 3*ctree_style->fg[GTK_STATE_SELECTED].green) / 4;
- style->fg[GTK_STATE_SELECTED].blue = (color.blue + 3*ctree_style->fg[GTK_STATE_SELECTED].blue ) / 4;
+ style->text[GTK_STATE_SELECTED].red = (color.red + 3*ctree_style->text[GTK_STATE_SELECTED].red ) / 4;
+ style->text[GTK_STATE_SELECTED].green = (color.green + 3*ctree_style->text[GTK_STATE_SELECTED].green) / 4;
+ style->text[GTK_STATE_SELECTED].blue = (color.blue + 3*ctree_style->text[GTK_STATE_SELECTED].blue ) / 4;
}
gtk_cmctree_node_set_row_style(ctree, node, style);
GList *cur;
gboolean froze = FALSE;
+ if (prefs_common.ask_override_colorlabel) {
+ GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
+ gboolean ask = FALSE;
+ AlertValue val;
+ guint color;
+ gboolean already_this_color_everywhere = TRUE;
+
+ /* if clearing color labels (applying 'none', 0):
+ - ask if at least one message has a non-0 color label set
+ if applying a non-0 color label:
+ - ask if at least one of the selected messages has a non-0 color label different
+ from the one we want to apply.
+ - don't ask if all messages have the same color label as the one we're applying
+ */
+ for (cur = GTK_CMCLIST(ctree)->selection;
+ !ask && cur != NULL && cur->data != NULL;
+ cur = cur->next) {
+ MsgInfo *msginfo = gtk_cmctree_node_get_row_data(ctree, GTK_CMCTREE_NODE(cur->data));
+ if (msginfo) {
+ color = MSG_GET_COLORLABEL_VALUE(msginfo->flags);
+ if (labelcolor == 0) {
+ /* clearing color labels */
+ ask = (color != 0);
+ } else {
+ already_this_color_everywhere &= (color == labelcolor);
+ ask = ((color != 0) && (color != labelcolor)) && !already_this_color_everywhere;
+ }
+ }
+ }
+
+ if (ask) {
+ gchar *msg;
+
+ if (labelcolor == 0)
+ msg = _("Do you really want to reset the color label of all selected messages?");
+ else
+ msg = _("Do you really want to apply this color label to all selected messages?");
+ val = alertpanel_full(_("Set color label"), msg,
+ GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST,
+ TRUE, NULL, ALERT_QUESTION);
+
+ if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE)
+ return;
+ else if (val & G_ALERTDISABLE)
+ prefs_common.ask_override_colorlabel = FALSE;
+ }
+ }
+
START_LONG_OPERATION(summaryview, FALSE);
for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
summary_set_row_colorlabel(summaryview,
g_object_set_data(G_OBJECT(ctree), "summaryview", (gpointer)summaryview);
for (pos = 0; pos < N_SUMMARY_COLS; pos++) {
- gtkut_widget_set_can_focus(GTK_CMCLIST(ctree)->column[pos].button,
+ gtk_widget_set_can_focus(GTK_CMCLIST(ctree)->column[pos].button,
FALSE);
if (((pos == summaryview->col_pos[S_COL_FROM] && !FOLDER_SHOWS_TO_HDR(summaryview->folder_item)) ||
(pos == summaryview->col_pos[S_COL_TO] && FOLDER_SHOWS_TO_HDR(summaryview->folder_item)) ||
summary_show(summaryview, item);
- summary_select_by_msgnum(summaryview, selected_msgnum);
+ summary_select_by_msgnum(summaryview, selected_msgnum, FALSE);
summaryview->selected = summary_find_msg_by_msgnum(summaryview, selected_msgnum);
summaryview->displayed = summary_find_msg_by_msgnum(summaryview, displayed_msgnum);
MessageView *messageview;
GtkAdjustment *adj;
gboolean mod_pressed;
- gfloat row_align = 0;
if (!event)
return TRUE;
case GDK_KEY_End: case GDK_KEY_KP_End:
next = gtk_cmctree_node_nth(ctree,
g_list_length(GTK_CMCLIST(ctree)->row_list)-1);
- row_align = 1;
break;
case GDK_KEY_Up: case GDK_KEY_KP_Up:
next = gtk_cmctree_node_nth(ctree,
case GDK_KEY_Down: case GDK_KEY_KP_Down:
next = gtk_cmctree_node_nth(ctree,
MIN(GTK_CMCLIST(ctree)->focus_row + 1, GTK_CMCLIST(ctree)->rows));
- row_align = 1;
break;
case GDK_KEY_Page_Up: case GDK_KEY_KP_Page_Up:
next = gtk_cmctree_node_nth(ctree,
(2 * GTK_CMCLIST(ctree)->clist_window_height -
GTK_CMCLIST(ctree)->row_height - CELL_SPACING) /
(2 * (GTK_CMCLIST(ctree)->row_height + CELL_SPACING))));
- row_align = 1;
break;
}
/* Deprecated - what are the non-deprecated equivalents? */
if (gtk_cmctree_node_is_visible(GTK_CMCTREE(ctree), next) != GTK_VISIBILITY_FULL)
- gtk_cmctree_node_moveto(GTK_CMCTREE(ctree), next, 0, row_align, 0);
+ gtkut_ctree_node_move_if_on_the_edge(GTK_CMCTREE(ctree), next, -1);
+ if (!mod_pressed)
+ summary_select_node(summaryview, summaryview->selected, OPEN_SELECTED_ON_DIRECTIONAL);
summaryview->selected = next;
}
}
return g_slist_reverse(msginfo_list);
}
+/*
+ * \brief get number of messages currently selected in SummaryView
+ *
+ * \param summaryview
+ *
+ * \return number of messages currently selected
+ */
+guint summary_get_selection_count(SummaryView *summaryview)
+{
+ cm_return_val_if_fail(summaryview != NULL, 0);
+ return g_list_length(GTK_CMCLIST(summaryview->ctree)->selection);
+}
+
static void summary_sort_by_column_click(SummaryView *summaryview,
FolderSortKey sort_key)
{
summaryview->sort_type == SORT_ASCENDING
? SORT_DESCENDING : SORT_ASCENDING);
else
- summary_sort(summaryview, sort_key, SORT_ASCENDING);
+ summary_sort(summaryview, sort_key, summaryview->sort_type);
node = GTK_CMCTREE_NODE(GTK_CMCLIST(summaryview->ctree)->row_list);
return summary_cmp_by_date(clist, ptr1, ptr2);
}
-static void summary_ignore_thread_func(GtkCMCTree *ctree, GtkCMCTreeNode *row, gpointer data)
+static void summary_ignore_thread_func_mark_unread(GtkCMCTree *ctree, GtkCMCTreeNode *row, gpointer data)
{
- SummaryView *summaryview = (SummaryView *) data;
MsgInfo *msginfo;
msginfo = gtk_cmctree_node_get_row_data(ctree, row);
summary_msginfo_unset_flags(msginfo, MSG_WATCH_THREAD, 0);
summary_msginfo_change_flags(msginfo, MSG_IGNORE_THREAD, 0, MSG_NEW | MSG_UNREAD, 0);
+ debug_print("Message %d is marked as ignore thread\n", msginfo->msgnum);
+}
+
+static void summary_ignore_thread_func_set_row(GtkCMCTree *ctree, GtkCMCTreeNode *row, gpointer data)
+{
+ SummaryView *summaryview = (SummaryView *) data;
+ MsgInfo *msginfo;
+
+ msginfo = gtk_cmctree_node_get_row_data(ctree, row);
+ cm_return_if_fail(msginfo);
+
summary_set_row_marks(summaryview, row);
- debug_print("Message %d is marked as ignore thread\n",
- msginfo->msgnum);
+ debug_print("Message %d update in row view\n", msginfo->msgnum);
}
void summary_ignore_thread(SummaryView *summaryview)
START_LONG_OPERATION(summaryview, FALSE);
for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
- gtk_cmctree_pre_recursive(ctree, GTK_CMCTREE_NODE(cur->data),
- GTK_CMCTREE_FUNC(summary_ignore_thread_func),
+ gtk_cmctree_pre_recursive(ctree, GTK_CMCTREE_NODE(cur->data),
+ GTK_CMCTREE_FUNC(summary_ignore_thread_func_mark_unread),
+ summaryview);
+
+ for (cur = GTK_CMCLIST(ctree)->selection; cur != NULL && cur->data != NULL; cur = cur->next)
+ gtk_cmctree_pre_recursive(ctree, GTK_CMCTREE_NODE(cur->data),
+ GTK_CMCTREE_FUNC(summary_ignore_thread_func_set_row),
summaryview);
END_LONG_OPERATION(summaryview);
summary_watch_thread(summaryview);
}
+
void summary_toggle_show_read_messages(SummaryView *summaryview)
{
FolderItemUpdateData source;
cm_return_val_if_fail(hookdata->item != NULL, FALSE);
cm_return_val_if_fail(summaryview != NULL, FALSE);
- if (hookdata->update_flags & F_ITEM_UPDATE_NAME) {
+ if (hookdata->item == summaryview->folder_item &&
+ hookdata->update_flags & F_ITEM_UPDATE_NAME) {
gchar *name = folder_item_get_name(hookdata->item);
gtk_label_set_text(GTK_LABEL(summaryview->statlabel_folder), name);
g_free(name);
node = gtk_cmctree_node_nth(GTK_CMCTREE(summaryview->ctree), 0);
if (node)
- summary_select_node(summaryview, node, 1);
+ summary_select_node(summaryview, node, OPEN_SELECTED_ON_SEARCH_RESULTS);
}
gint summaryview_export_mbox_list(SummaryView *summaryview)