#include "sourcewindow.h"
#include "prefs_common.h"
#include "prefs_summary_column.h"
-#include "prefs_filter.h"
#include "prefs_filtering.h"
#include "account.h"
#include "compose.h"
#include "alertpanel.h"
#include "inputdialog.h"
#include "statusbar.h"
-#include "filter.h"
#include "folder.h"
#include "colorlabel.h"
#include "inc.h"
#include "filtering.h"
#include "string_match.h"
#include "toolbar.h"
+#include "news.h"
#define SUMMARY_COL_MARK_WIDTH 10
#define SUMMARY_COL_UNREAD_WIDTH 13
gpointer data);
static void summary_thread_init (SummaryView *summaryview);
-static void summary_ignore_thread (SummaryView *summaryview);
-static void summary_unignore_thread (SummaryView *summaryview);
+static void summary_ignore_thread (SummaryView *summaryview);
+static void summary_unignore_thread (SummaryView *summaryview);
static void summary_unthread_for_exec (SummaryView *summaryview);
static void summary_unthread_for_exec_func (GtkCTree *ctree,
small_style = gtk_style_copy
(gtk_widget_get_style(summaryview->ctree));
if (!smallfont)
- smallfont = gdk_fontset_load(SMALL_FONT);
+ smallfont = gtkut_font_load(SMALL_FONT);
small_style->font = smallfont;
small_marked_style = gtk_style_copy(small_style);
small_marked_style->fg[GTK_STATE_NORMAL] =
bold_style = gtk_style_copy
(gtk_widget_get_style(summaryview->ctree));
if (!boldfont)
- boldfont = gdk_fontset_load(BOLD_FONT);
+ boldfont = gtkut_font_load(BOLD_FONT);
bold_style->font = boldfont;
bold_marked_style = gtk_style_copy(bold_style);
bold_marked_style->fg[GTK_STATE_NORMAL] =
pixmap = stock_pixmap_widget(summaryview->hbox, STOCK_PIXMAP_QUICKSEARCH);
gtk_container_add (GTK_CONTAINER(summaryview->toggle_search), pixmap);
gtk_widget_show(pixmap);
+ summaryview->quick_search_pixmap = pixmap;
/* Init summaryview prefs */
summaryview->sort_key = SORT_BY_NONE;
return best_node;
}
+#define CURRENTLY_DISPLAYED(m) \
+( (m->msgnum == displayed_msgnum) \
+ && (!g_strcasecmp(m->folder->name,item->name)) )
+
gboolean summary_show(SummaryView *summaryview, FolderItem *item)
{
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
gtk_entry_set_text(GTK_ENTRY(summaryview->search_string), "");
}
- STATUSBAR_POP(summaryview->mainwin);
+ /* STATUSBAR_POP(summaryview->mainwin); */
is_refresh = (item == summaryview->folder_item) ? TRUE : FALSE;
if (is_refresh) {
if ((MSG_IS_UNREAD(msginfo->flags)
|| MSG_IS_MARKED(msginfo->flags)
- || MSG_IS_LOCKED(msginfo->flags))
+ || MSG_IS_LOCKED(msginfo->flags)
+ || CURRENTLY_DISPLAYED(msginfo))
&& !MSG_IS_IGNORE_THREAD(msginfo->flags))
not_killed = g_slist_append(not_killed, msginfo);
else
debug_print("\n");
STATUSBAR_PUSH(summaryview->mainwin, _("Done."));
-
+ STATUSBAR_POP(summaryview->mainwin);
main_window_cursor_normal(summaryview->mainwin);
summary_unlock(summaryview);
inc_unlock();
return TRUE;
}
+#undef CURRENTLY_DISPLAYED
+
void summary_clear_list(SummaryView *summaryview)
{
GtkCList *clist = GTK_CLIST(summaryview->ctree);
summaryview->subject_table = NULL;
}
summaryview->mlist = NULL;
- if (summaryview->folder_table) {
- g_hash_table_destroy(summaryview->folder_table);
- summaryview->folder_table = NULL;
- }
gtk_clist_clear(clist);
if (summaryview->col_pos[S_COL_SUBJECT] == N_SUMMARY_COLS - 1) {
prefs_common.ng_abbrev_len < strlen(summaryview->folder_item->path)) {
gchar *group;
group = get_abbrev_newsgroup_name
- (g_basename(summaryview->folder_item->path));
+ (g_basename(summaryview->folder_item->path), prefs_common.ng_abbrev_len);
gtk_label_set(GTK_LABEL(summaryview->statlabel_folder), group);
g_free(group);
} else {
msginfo->threadscore = msginfo->score;
}
- if (global_scoring || summaryview->folder_item->prefs->scoring) {
- summaryview->important_score = prefs_common.important_score;
- if (summaryview->folder_item->prefs->important_score >
- summaryview->important_score)
- summaryview->important_score =
- summaryview->folder_item->prefs->important_score;
- }
-
if (summaryview->threaded) {
GNode *root, *gnode;
g_node_destroy(root);
+ folder_update_items_when_required(FALSE);
+
summary_thread_init(summaryview);
} else {
gchar *text[N_SUMMARY_COLS];
_("(No Subject)");
}
-#define CHANGE_FLAGS(msginfo) \
-{ \
-if (msginfo->folder->folder->change_flags != NULL) \
-msginfo->folder->folder->change_flags(msginfo->folder->folder, \
- msginfo->folder, \
- msginfo); \
-}
-
static void summary_display_msg(SummaryView *summaryview, GtkCTreeNode *row)
{
summary_display_msg_full(summaryview, row, FALSE, FALSE);
g_free(filename);
if (new_window || !prefs_common.mark_as_read_on_new_window) {
- if (MSG_IS_NEW(msginfo->flags) && MSG_IS_IGNORE_THREAD(msginfo->flags))
+ if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
summaryview->newmsgs--;
- if (MSG_IS_UNREAD(msginfo->flags) && MSG_IS_IGNORE_THREAD(msginfo->flags))
+ if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
summaryview->unread--;
if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
procmsg_msginfo_unset_flags
(msginfo, MSG_NEW | MSG_UNREAD, 0);
+ folder_update_item(msginfo->folder, FALSE);
summary_set_row_marks(summaryview, row);
gtk_clist_thaw(GTK_CLIST(ctree));
summary_status_show(summaryview);
gtk_signal_emit_by_name(GTK_OBJECT(ctree), "scroll_vertical",
type, 0.0);
+
+ if (GTK_CLIST(ctree)->selection)
+ gtk_sctree_set_anchor_row
+ (GTK_SCTREE(ctree),
+ GTK_CTREE_NODE(GTK_CLIST(ctree)->selection->data));
+
}
void summary_toggle_view(SummaryView *summaryview)
if (changed && !prefs_common.immediate_exec) {
msginfo->to_folder->op_count--;
if (msginfo->to_folder->op_count == 0)
- folderview_update_item(msginfo->to_folder, 0);
+ folder_update_item(msginfo->to_folder, FALSE);
}
msginfo->to_folder = NULL;
procmsg_msginfo_unset_flags(msginfo, MSG_DELETED, MSG_MOVE | MSG_COPY);
if (changed && !prefs_common.immediate_exec) {
msginfo->to_folder->op_count--;
if (msginfo->to_folder->op_count == 0)
- folderview_update_item(msginfo->to_folder, 0);
+ folder_update_item(msginfo->to_folder, FALSE);
}
msginfo->to_folder = NULL;
procmsg_msginfo_unset_flags(msginfo, MSG_DELETED, MSG_MOVE | MSG_COPY);
for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next)
summary_mark_row_as_read(summaryview,
GTK_CTREE_NODE(cur->data));
+ folder_update_items_when_required(FALSE);
summary_status_show(summaryview);
}
summary_set_row_marks(summaryview, node);
}
gtk_clist_thaw(clist);
+ folder_update_items_when_required(FALSE);
summary_status_show(summaryview);
}
for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next)
summary_mark_row_as_unread(summaryview,
GTK_CTREE_NODE(cur->data));
+ folder_update_items_when_required(FALSE);
summary_status_show(summaryview);
}
if (changed && !prefs_common.immediate_exec) {
msginfo->to_folder->op_count--;
if (msginfo->to_folder->op_count == 0)
- folderview_update_item(msginfo->to_folder, 0);
+ folder_update_item(msginfo->to_folder, FALSE);
}
msginfo->to_folder = NULL;
procmsg_msginfo_unset_flags(msginfo, MSG_MARKED, MSG_MOVE | MSG_COPY);
if (changed && !prefs_common.immediate_exec) {
msginfo->to_folder->op_count--;
if (msginfo->to_folder->op_count == 0)
- folderview_update_item(msginfo->to_folder, 0);
+ folder_update_item(msginfo->to_folder, FALSE);
}
msginfo->to_folder = NULL;
procmsg_msginfo_unset_flags(msginfo, MSG_MARKED | MSG_DELETED, MSG_MOVE | MSG_COPY);
if (!prefs_common.immediate_exec) {
msginfo->to_folder->op_count--;
if (msginfo->to_folder->op_count == 0) {
- folderview_update_item(msginfo->to_folder, 0);
+ folder_update_item(msginfo->to_folder, FALSE);
changed = TRUE;
}
}
if (changed) {
msginfo->to_folder->op_count++;
if (msginfo->to_folder->op_count == 1)
- folderview_update_item(msginfo->to_folder, 0);
+ folder_update_item(msginfo->to_folder, FALSE);
}
}
else {
summary_status_show(summaryview);
- folderview_update_item(to_folder, 0);
+ folder_update_item(to_folder, FALSE);
+ }
+
+ if (!summaryview->selected) { /* this was the last message */
+ GtkCTreeNode *node = gtk_ctree_node_nth (GTK_CTREE(summaryview->ctree),
+ GTK_CLIST(summaryview->ctree)->rows - 1);
+ if (node)
+ summary_select_node(summaryview, node, TRUE, TRUE);
}
+
}
void summary_move_to(SummaryView *summaryview)
if (!prefs_common.immediate_exec) {
msginfo->to_folder->op_count--;
if (msginfo->to_folder->op_count == 0) {
- folderview_update_item(msginfo->to_folder, 0);
+ folder_update_item(msginfo->to_folder, FALSE);
changed = TRUE;
}
}
if (changed) {
msginfo->to_folder->op_count++;
if (msginfo->to_folder->op_count == 1)
- folderview_update_item(msginfo->to_folder, 0);
+ folder_update_item(msginfo->to_folder, FALSE);
}
}
else {
summary_status_show(summaryview);
- folderview_update_item(to_folder, 0);
+ folder_update_item(to_folder, FALSE);
}
}
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
GSList *cur;
- summaryview->folder_table = g_hash_table_new(NULL, NULL);
-
/* search moving messages and execute */
gtk_ctree_pre_recursive(ctree, NULL, summary_execute_move_func,
summaryview);
if (summaryview->mlist) {
procmsg_move_messages(summaryview->mlist);
- folderview_update_item_foreach(summaryview->folder_table, FALSE);
+ folder_update_items_when_required(FALSE);
for (cur = summaryview->mlist; cur != NULL; cur = cur->next)
procmsg_msginfo_free((MsgInfo *)cur->data);
summaryview->mlist = NULL;
}
- folderview_update_item(summaryview->folder_item, FALSE);
- g_hash_table_destroy(summaryview->folder_table);
- summaryview->folder_table = NULL;
+ folder_update_item(summaryview->folder_item, FALSE);
}
static void summary_execute_move_func(GtkCTree *ctree, GtkCTreeNode *node,
msginfo->to_folder->op_count > 0)
msginfo->to_folder->op_count--;
- g_hash_table_insert(summaryview->folder_table,
- msginfo->to_folder, GINT_TO_POINTER(1));
-
summaryview->mlist =
g_slist_append(summaryview->mlist, msginfo);
gtk_ctree_node_set_row_data(ctree, node, NULL);
{
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
- summaryview->folder_table = g_hash_table_new(NULL, NULL);
-
/* search copying messages and execute */
gtk_ctree_pre_recursive(ctree, NULL, summary_execute_copy_func,
summaryview);
if (summaryview->mlist) {
procmsg_copy_messages(summaryview->mlist);
- /* folder_item_scan_foreach(summaryview->folder_table); */
- folderview_update_item_foreach(summaryview->folder_table, FALSE);
+ folder_update_items_when_required(FALSE);
g_slist_free(summaryview->mlist);
summaryview->mlist = NULL;
}
-
- g_hash_table_destroy(summaryview->folder_table);
- summaryview->folder_table = NULL;
}
static void summary_execute_copy_func(GtkCTree *ctree, GtkCTreeNode *node,
msginfo->to_folder->op_count > 0)
msginfo->to_folder->op_count--;
- g_hash_table_insert(summaryview->folder_table,
- msginfo->to_folder, GINT_TO_POINTER(1));
-
summaryview->mlist =
g_slist_append(summaryview->mlist, msginfo);
summaryview->mlist = NULL;
if ((summaryview->folder_item != trash) && (trash != NULL)) {
- folderview_update_item(trash, FALSE);
+ folder_update_item(trash, FALSE);
}
- folderview_update_item(summaryview->folder_item, FALSE);
+ folder_update_item(summaryview->folder_item, FALSE);
}
static void summary_execute_delete_func(GtkCTree *ctree, GtkCTreeNode *node,
void summary_filter(SummaryView *summaryview)
{
- if (!prefs_common.fltlist && !global_processing) {
+ if (!global_processing) {
alertpanel_error(_("No filter rules defined."));
return;
}
summary_status_show(summaryview);
}
else {
- summaryview->folder_table = g_hash_table_new(NULL, NULL);
-
gtk_ctree_pre_recursive(GTK_CTREE(summaryview->ctree), NULL,
GTK_CTREE_FUNC(summary_filter_func),
summaryview);
gtk_clist_thaw(GTK_CLIST(summaryview->ctree));
- /* folder_item_scan_foreach(summaryview->folder_table); */
- folderview_update_item_foreach(summaryview->folder_table, FALSE);
-
- g_hash_table_destroy(summaryview->folder_table);
- summaryview->folder_table = NULL;
+ folder_update_items_when_required(FALSE);
}
debug_print("done.\n");
gpointer data)
{
MsgInfo *msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
- SummaryView *summaryview = data;
- gchar *file;
- FolderItem *dest;
-
- if (global_processing == NULL) {
- /* old filtering */
- file = procmsg_get_message_file(msginfo);
- dest = filter_get_dest_folder(prefs_common.fltlist, file);
- g_free(file);
- if (dest && strcmp2(dest->path, FILTER_NOT_RECEIVE) != 0 &&
- summaryview->folder_item != dest)
- summary_move_row_to(summaryview, node, dest);
- } else
- filter_message_by_msginfo(global_processing, msginfo, summaryview->folder_table);
+ filter_message_by_msginfo(global_processing, msginfo);
}
void summary_filter_open(SummaryView *summaryview, PrefsFilterType type)
summaryview->selected);
if (!msginfo) return;
- if (global_processing) {
- header_offset = 1;
- hentry_offset = 5;
- }
- else {
- header_offset = 0;
- hentry_offset = 0;
- }
+ header_offset = 1;
+ hentry_offset = 5;
switch (type) {
case FILTER_BY_NONE:
* and have set entries. Otherwise we're hosed.
*/
- if (global_processing)
- prefs_filtering_open(NULL, header, key);
- else
- prefs_filter_open(header, key);
+ prefs_filtering_open(NULL, header, key);
}
void summary_reply(SummaryView *summaryview, ComposeMode mode)
switch (mode) {
case COMPOSE_REPLY:
- compose_reply(msginfo, prefs_common.reply_with_quote,
- FALSE, FALSE, FALSE, text);
+ if (prefs_common.default_reply_list)
+ compose_reply(msginfo, prefs_common.reply_with_quote,
+ FALSE, TRUE, FALSE, text);
+ else
+ compose_reply(msginfo, prefs_common.reply_with_quote,
+ FALSE, FALSE, FALSE, text);
break;
case COMPOSE_REPLY_WITH_QUOTE:
- compose_reply(msginfo, TRUE, FALSE, FALSE, FALSE, text);
+ if (prefs_common.default_reply_list)
+ compose_reply(msginfo, TRUE, FALSE, TRUE, FALSE, text);
+ else
+ compose_reply(msginfo, TRUE, FALSE, FALSE, FALSE, text);
break;
case COMPOSE_REPLY_WITHOUT_QUOTE:
- compose_reply(msginfo, FALSE, FALSE, FALSE, FALSE, NULL);
+ if (prefs_common.default_reply_list)
+ compose_reply(msginfo, FALSE, FALSE, TRUE, FALSE, NULL);
+ else
+ compose_reply(msginfo, FALSE, FALSE, FALSE, FALSE, NULL);
break;
case COMPOSE_REPLY_TO_SENDER:
compose_reply(msginfo, prefs_common.reply_with_quote,
if (!summaryview->selected) {
node = gtk_ctree_node_nth(ctree, 0);
if (node)
- gtk_ctree_select(ctree, node);
+ gtk_sctree_select(GTK_SCTREE(ctree), node);
else
return;
}
debug_print(" <%s>", (gchar *)value);
if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0);
+ folder_update_item(msginfo->folder, FALSE);
procmsg_msginfo_set_flags(msginfo, mff->account->crosspost_col, 0);
}
g_hash_table_remove(mff->newsart, key);
for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next) {
gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), GTK_CTREE_FUNC(summary_ignore_thread_func), summaryview);
}
+ folder_update_items_when_required(FALSE);
summary_status_show(summaryview);
}
for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next) {
gtk_ctree_pre_recursive(ctree, GTK_CTREE_NODE(cur->data), GTK_CTREE_FUNC(summary_unignore_thread_func), summaryview);
}
+ folder_update_items_when_required(FALSE);
summary_status_show(summaryview);
}
gtk_widget_show(pixmap);
summaryview->folder_pixmap = pixmap;
+ pixmap = stock_pixmap_widget(summaryview->hbox, STOCK_PIXMAP_QUICKSEARCH);
+ gtk_container_remove (GTK_CONTAINER(summaryview->toggle_search),
+ summaryview->quick_search_pixmap);
+ gtk_container_add(GTK_CONTAINER(summaryview->toggle_search), pixmap);
+ gtk_widget_show(pixmap);
+ summaryview->quick_search_pixmap = pixmap;
+
folderview_unselect(summaryview->folderview);
folderview_select(summaryview->folderview, summaryview->folder_item);
}
/* Threading */
summaryview->threaded = item->threaded;
+
+ /* Scoring */
+ if (global_scoring || summaryview->folder_item->prefs->scoring) {
+ summaryview->important_score = prefs_common.important_score;
+ if (summaryview->folder_item->prefs->important_score >
+ summaryview->important_score)
+ summaryview->important_score =
+ summaryview->folder_item->prefs->important_score;
+ }
}
void summary_save_prefs_to_folderitem(SummaryView *summaryview, FolderItem *item)