#include "prefs_folder_item.h"
#include "filtering.h"
#include "string_match.h"
-
-#define STATUSBAR_PUSH(mainwin, str) \
-{ \
- gtk_statusbar_push(GTK_STATUSBAR(mainwin->statusbar), \
- mainwin->summaryview_cid, str); \
- gtkut_widget_wait_for_draw(mainwin->hbox_stat); \
-}
-
-#define STATUSBAR_POP(mainwin) \
-{ \
- gtk_statusbar_pop(GTK_STATUSBAR(mainwin->statusbar), \
- mainwin->summaryview_cid); \
-}
+#include "toolbar.h"
#define SUMMARY_COL_MARK_WIDTH 10
#define SUMMARY_COL_UNREAD_WIDTH 13
static void summary_set_marks_func (GtkCTree *ctree,
GtkCTreeNode *node,
gpointer data);
-static void summary_write_cache_func (GtkCTree *ctree,
- GtkCTreeNode *node,
- gpointer data);
static void summary_set_menu_sensitive (SummaryView *summaryview);
gboolean all_headers);
static void summary_set_row_marks (SummaryView *summaryview,
GtkCTreeNode *row);
-static void summaryview_subject_filter_init (PrefsFolderItem *prefs);
/* message handling */
static void summary_mark_row (SummaryView *summaryview,
void summary_simplify_subject(SummaryView *summaryview, gchar * rexp,
GSList * mlist);
+#if 0
void summary_processing(SummaryView *summaryview, GSList * mlist);
+#endif
static void summary_filter_func (GtkCTree *ctree,
GtkCTreeNode *node,
gpointer data);
static gint summary_cmp_by_subject (GtkCList *clist,
gconstpointer ptr1,
gconstpointer ptr2);
+static gint summary_cmp_by_simplified_subject
+ (GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2);
static gint summary_cmp_by_score (GtkCList *clist,
gconstpointer ptr1,
gconstpointer ptr2);
GtkItemFactory *popupfactory;
gint n_entries;
- debug_print(_("Creating summary view...\n"));
+ debug_print("Creating summary view...\n");
summaryview = g_new0(SummaryView, 1);
vbox = gtk_vbox_new(FALSE, 2);
summaryview->popupfactory = popupfactory;
summaryview->lock_count = 0;
+ /* CLAWS: need this to get the SummaryView * from
+ * the CList */
+ gtk_object_set_data(GTK_OBJECT(ctree), "summaryview", (gpointer)summaryview);
+
gtk_widget_show_all(vbox);
return summaryview;
gtk_widget_show(pixmap);
summaryview->folder_pixmap = pixmap;
+ /* Init Summaryview prefs */
+ summaryview->simplify_subject_preg = NULL;
+
summary_clear_list(summaryview);
summary_set_column_titles(summaryview);
summary_colorlabel_menu_create(summaryview);
return best_node;
}
-gboolean summary_show(SummaryView *summaryview, FolderItem *item,
- gboolean update_cache)
+gboolean summary_show(SummaryView *summaryview, FolderItem *item)
{
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
GtkCTreeNode *node;
gboolean is_refresh;
guint selected_msgnum = 0;
guint displayed_msgnum = 0;
- GtkCTreeNode *selected_node = summaryview->folderview->selected;
GSList *cur;
if (summary_is_locked(summaryview)) return FALSE;
STATUSBAR_POP(summaryview->mainwin);
is_refresh = (!prefs_common.open_inbox_on_inc &&
- item == summaryview->folder_item &&
- update_cache == FALSE) ? TRUE : FALSE;
+ item == summaryview->folder_item) ? TRUE : FALSE;
if (is_refresh) {
selected_msgnum = summary_get_msgnum(summaryview,
summaryview->selected);
summary_unlock(summaryview);
summary_execute(summaryview);
summary_lock(summaryview);
- } else if (G_ALERTALTERNATE == val)
- summary_write_cache(summaryview);
- else {
+ } else if (G_ALERTALTERNATE == val) {
+ /* DO NOTHING */
+ } else {
summary_unlock(summaryview);
inc_unlock();
return FALSE;
}
folder_update_op_count();
- } else {
- /*
- * CLAWS: summary_show() is responsible for updating the caches.
- * after filtering inc.c::inc_finished() forces the update of
- * the cache by indirectly calling summary_show() (by re-selecting
- * the currently selected mail folder).
- * this collides with the new filtering system that may have set
- * any message flag before calling summary_show().
- * we can prevent this cache-write by checking the opened member
- * of the folderview. if this is NULL, the folderview forced
- * an update of the summary view.
- */
- if (summaryview->folderview->opened)
- summary_write_cache(summaryview);
- }
-
- summaryview->folderview->opened = selected_node;
-
+ }
+
gtk_clist_freeze(GTK_CLIST(ctree));
summary_clear_list(summaryview);
((buf = folder_item_get_path(item)) == NULL ||
change_dir(buf) < 0))) {
g_free(buf);
- debug_print(_("empty folder\n\n"));
+ debug_print("empty folder\n\n");
summary_set_hide_read_msgs_menu(summaryview, FALSE);
if (is_refresh)
messageview_clear(summaryview->messageview);
BY OTHER PROGRAMS TO THE FOLDER
*/
mlist = folder_item_get_msg_list(item);
-
+#if 0
summary_processing(summaryview, mlist);
-
+#endif
for(cur = mlist ; cur != NULL ; cur = g_slist_next(cur)) {
MsgInfo * msginfo = (MsgInfo *) cur->data;
}
}
- summaryview->killed_messages = NULL;
-
if (summaryview->folder_item->hide_read_msgs) {
GSList *not_killed;
&& !MSG_IS_IGNORE_THREAD(msginfo->flags))
not_killed = g_slist_append(not_killed, msginfo);
else
- summaryview->killed_messages =
- g_slist_append(summaryview->killed_messages, msginfo);
+ procmsg_msginfo_free(msginfo);
}
g_slist_free(mlist);
mlist = not_killed;
summary_set_hide_read_msgs_menu(summaryview, FALSE);
}
- if ((global_scoring || item->prefs->scoring) &&
- (item->folder->type == F_NEWS)) {
+ if ((global_scoring || item->prefs->scoring)) {
GSList *not_killed;
gint kill_score;
for(cur = mlist ; cur != NULL ; cur = g_slist_next(cur)) {
MsgInfo * msginfo = (MsgInfo *) cur->data;
- if (MSG_IS_NEWS(msginfo->flags) &&
- (msginfo->score <= kill_score))
- summaryview->killed_messages = g_slist_append(summaryview->killed_messages, msginfo);
+ if (msginfo->score > kill_score)
+ not_killed = g_slist_append(not_killed, msginfo);
else
- not_killed = g_slist_append(not_killed,
- msginfo);
+ procmsg_msginfo_free(msginfo);
}
g_slist_free(mlist);
mlist = not_killed;
if (item->sort_key != SORT_BY_NONE)
summary_sort(summaryview, item->sort_key, item->sort_type);
- summary_write_cache(summaryview);
-
gtk_signal_handler_unblock_by_data(GTK_OBJECT(ctree), summaryview);
gtk_clist_thaw(GTK_CLIST(ctree));
summary_status_show(summaryview);
summary_set_menu_sensitive(summaryview);
- main_window_set_toolbar_sensitive(summaryview->mainwin);
+ toolbar_set_sensitive(summaryview->mainwin);
debug_print("\n");
STATUSBAR_PUSH(summaryview->mainwin, _("Done."));
{
GtkCList *clist = GTK_CLIST(summaryview->ctree);
gint optimal_width;
- GSList * cur;
gtk_clist_freeze(clist);
- for(cur = summaryview->killed_messages ; cur != NULL ;
- cur = g_slist_next(cur)) {
- MsgInfo * msginfo = (MsgInfo *) cur->data;
-
- procmsg_msginfo_free(msginfo);
- }
- g_slist_free(summaryview->killed_messages);
- summaryview->killed_messages = NULL;
-
gtk_ctree_pre_recursive(GTK_CTREE(summaryview->ctree),
NULL, summary_free_msginfo_func, NULL);
{
summary_clear_list(summaryview);
summary_set_menu_sensitive(summaryview);
- main_window_set_toolbar_sensitive(summaryview->mainwin);
+ toolbar_set_sensitive(summaryview->mainwin);
summary_status_show(summaryview);
}
menu_set_sensitive(ifactory, "/Move...", FALSE);
menu_set_sensitive(ifactory, "/Delete", TRUE);
- menu_set_sensitive(ifactory, "/Select thread", TRUE);
menu_set_sensitive(ifactory, "/Select all", TRUE);
menu_set_sensitive(ifactory, "/Copy...", TRUE);
menu_set_sensitive(ifactory, "/Execute", TRUE);
else
menu_set_sensitive(ifactory, "/Re-edit", FALSE);
+ menu_set_sensitive(ifactory, "/Select thread", sens);
menu_set_sensitive(ifactory, "/Save as...", sens);
menu_set_sensitive(ifactory, "/Print...", TRUE);
MsgInfo *src_msginfo, *dst_msginfo;
GHashTable *subject_table;
- debug_print(_("Attracting messages by subject..."));
+ debug_print("Attracting messages by subject...");
STATUSBAR_PUSH(summaryview->mainwin,
_("Attracting messages by subject..."));
gtk_clist_thaw(clist);
- debug_print(_("done.\n"));
+ debug_print("done.\n");
STATUSBAR_POP(summaryview->mainwin);
main_window_cursor_normal(summaryview->mainwin);
{
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
GtkCList *clist = GTK_CLIST(summaryview->ctree);
- GtkCListCompareFunc cmp_func;
+ GtkCListCompareFunc cmp_func = NULL;
FolderItem *item = summaryview->folder_item;
if (!item || !item->path || !item->parent || item->no_select) return;
cmp_func = (GtkCListCompareFunc)summary_cmp_by_from;
break;
case SORT_BY_SUBJECT:
- cmp_func = (GtkCListCompareFunc)summary_cmp_by_subject;
+ if (summaryview->simplify_subject_preg)
+ cmp_func = (GtkCListCompareFunc)summary_cmp_by_simplified_subject;
+ else
+ cmp_func = (GtkCListCompareFunc)summary_cmp_by_subject;
break;
case SORT_BY_SCORE:
cmp_func = (GtkCListCompareFunc)summary_cmp_by_score;
cmp_func = (GtkCListCompareFunc)summary_cmp_by_label;
break;
case SORT_BY_NONE:
- item->sort_key = sort_key;
- item->sort_type = SORT_ASCENDING;
- summary_set_column_titles(summaryview);
- summary_set_menu_sensitive(summaryview);
+ cmp_func = NULL;
return;
default:
return;
}
- debug_print(_("Sorting summary..."));
- STATUSBAR_PUSH(summaryview->mainwin, _("Sorting summary..."));
-
- main_window_cursor_wait(summaryview->mainwin);
-
- gtk_clist_set_compare_func(clist, cmp_func);
-
- gtk_clist_set_sort_type(clist, (GtkSortType)sort_type);
item->sort_key = sort_key;
item->sort_type = sort_type;
summary_set_column_titles(summaryview);
summary_set_menu_sensitive(summaryview);
+ if(cmp_func != NULL) {
+ debug_print("Sorting summary...");
+ STATUSBAR_PUSH(summaryview->mainwin, _("Sorting summary..."));
- gtk_sctree_sort_recursive(ctree, NULL);
+ main_window_cursor_wait(summaryview->mainwin);
- gtk_ctree_node_moveto(ctree, summaryview->selected, -1, 0.5, 0);
+ gtk_clist_set_compare_func(clist, cmp_func);
- debug_print(_("done.\n"));
- STATUSBAR_POP(summaryview->mainwin);
+ gtk_clist_set_sort_type(clist, (GtkSortType)sort_type);
- main_window_cursor_normal(summaryview->mainwin);
+ gtk_sctree_sort_recursive(ctree, NULL);
+
+ gtk_ctree_node_moveto(ctree, summaryview->selected, -1, 0.5, 0);
+
+ main_window_cursor_normal(summaryview->mainwin);
+
+ debug_print("done.\n");
+ STATUSBAR_POP(summaryview->mainwin);
+ }
}
gboolean summary_insert_gnode_func(GtkCTree *ctree, guint depth, GNode *gnode,
if (!mlist) return;
- debug_print(_("\tSetting summary from message data..."));
+ debug_print("\tSetting summary from message data...");
STATUSBAR_PUSH(summaryview->mainwin,
_("Setting summary from message data..."));
gdk_flush();
summaryview->folder_item->prefs->important_score;
}
- summaryview_subject_filter_init(summaryview->folder_item->prefs);
-
if (summaryview->folder_item->threaded) {
GNode *root, *gnode;
if (prefs_common.use_addr_book)
end_address_completion();
- debug_print(_("done.\n"));
+ debug_print("done.\n");
STATUSBAR_POP(summaryview->mainwin);
if (debug_mode) {
debug_print("\tmsgid hash table size = %d\n",
}
}
-struct wcachefp
-{
- FILE *cache_fp;
- FILE *mark_fp;
-};
-
-gint summary_write_cache(SummaryView *summaryview)
-{
- struct wcachefp fps;
- GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
- gint ver = CACHE_VERSION;
- gchar *buf;
- gchar *cachefile, *markfile;
- GSList *cur;
- gint filemode = 0;
- PrefsFolderItem *prefs;
-
- if (!summaryview->folder_item || !summaryview->folder_item->path)
- return -1;
-
- if (!summaryview->folder_item->cache)
- return -1;
-
- folder_item_write_cache(summaryview->folder_item);
- return 0;
-
- if (summaryview->folder_item->folder->update_mark != NULL)
- summaryview->folder_item->folder->update_mark(summaryview->folder_item->folder, summaryview->folder_item);
-
- cachefile = folder_item_get_cache_file(summaryview->folder_item);
- g_return_val_if_fail(cachefile != NULL, -1);
- if ((fps.cache_fp = fopen(cachefile, "wb")) == NULL) {
- FILE_OP_ERROR(cachefile, "fopen");
- g_free(cachefile);
- return -1;
- }
- if (change_file_mode_rw(fps.cache_fp, cachefile) < 0)
- FILE_OP_ERROR(cachefile, "chmod");
-
- prefs = summaryview->folder_item->prefs;
- if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
- /* for cache file */
- filemode = prefs->folder_chmod;
- if (filemode & S_IRGRP) filemode |= S_IWGRP;
- if (filemode & S_IROTH) filemode |= S_IWOTH;
-#if HAVE_FCHMOD
- fchmod(fileno(fps.cache_fp), filemode);
-#else
- chmod(cachefile, filemode);
-#endif
- }
-
- g_free(cachefile);
-
- markfile = folder_item_get_mark_file(summaryview->folder_item);
- if ((fps.mark_fp = fopen(markfile, "wb")) == NULL) {
- FILE_OP_ERROR(markfile, "fopen");
- fclose(fps.cache_fp);
- g_free(markfile);
- return -1;
- }
- if (change_file_mode_rw(fps.mark_fp, markfile) < 0)
- FILE_OP_ERROR(markfile, "chmod");
- if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
-#if HAVE_FCHMOD
- fchmod(fileno(fps.mark_fp), filemode);
-#else
- chmod(markfile, filemode);
-#endif
- }
-
- g_free(markfile);
-
- buf = g_strdup_printf(_("Writing summary cache (%s)..."),
- summaryview->folder_item->path);
- debug_print(buf);
- STATUSBAR_PUSH(summaryview->mainwin, buf);
- g_free(buf);
-
- WRITE_CACHE_DATA_INT(ver, fps.cache_fp);
- ver = MARK_VERSION;
- WRITE_CACHE_DATA_INT(ver, fps.mark_fp);
-
- gtk_ctree_pre_recursive(ctree, NULL, summary_write_cache_func, &fps);
-
- for (cur = summaryview->killed_messages; cur != NULL; cur = cur->next) {
- MsgInfo *msginfo = (MsgInfo *)cur->data;
- procmsg_write_cache(msginfo, fps.cache_fp);
- procmsg_write_flags(msginfo, fps.mark_fp);
- }
-
- procmsg_flush_mark_queue(summaryview->folder_item, fps.mark_fp);
-
- fclose(fps.cache_fp);
- fclose(fps.mark_fp);
-
- debug_print(_("done.\n"));
- STATUSBAR_POP(summaryview->mainwin);
-
- return 0;
-}
-
-static void summary_write_cache_func(GtkCTree *ctree, GtkCTreeNode *node,
- gpointer data)
-{
- struct wcachefp *fps = data;
- MsgInfo *msginfo = gtk_ctree_node_get_row_data(ctree, node);
-
- if (msginfo == NULL) return;
-
- procmsg_write_cache(msginfo, fps->cache_fp);
- procmsg_write_flags(msginfo, fps->mark_fp);
-}
-
static gchar *summary_complete_address(const gchar *addr)
{
gint count;
static gchar *to = NULL;
static gchar col_score[11];
static gchar buf[BUFFSIZE];
- PrefsFolderItem *prefs = summaryview->folder_item->prefs;
gint *col_pos = summaryview->col_pos;
text[col_pos[S_COL_MARK]] = NULL;
}
}
- if (prefs->enable_simplify_subject
- && prefs->simplify_subject_preg != NULL )
+ if (summaryview->simplify_subject_preg != NULL)
text[col_pos[S_COL_SUBJECT]] = msginfo->subject ?
string_remove_match(buf, BUFFSIZE, msginfo->subject,
- prefs->simplify_subject_preg) :
-
+ summaryview->simplify_subject_preg) :
_("(No Subject)");
else
text[col_pos[S_COL_SUBJECT]] = msginfo->subject ? msginfo->subject :
}
g_free(filename);
-/* NOT NEEDED ANYMORE
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))
summaryview->unread--;
-*/
+
procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0);
summary_set_row_marks(summaryview, row);
gtk_clist_thaw(GTK_CLIST(ctree));
}
summary_set_menu_sensitive(summaryview);
- main_window_set_toolbar_sensitive(summaryview->mainwin);
+ toolbar_set_sensitive(summaryview->mainwin);
summary_unlock(summaryview);
}
procmsg_msginfo_unset_flags(msginfo, MSG_DELETED, MSG_MOVE | MSG_COPY);
procmsg_msginfo_set_flags(msginfo, MSG_MARKED, 0);
summary_set_row_marks(summaryview, row);
- debug_print(_("Message %s/%d is marked\n"), msginfo->folder->path, msginfo->msgnum);
+ debug_print("Message %s/%d is marked\n", msginfo->folder->path, msginfo->msgnum);
}
static void summary_lock_row(SummaryView *summaryview, GtkCTreeNode *row)
procmsg_msginfo_unset_flags(msginfo, MSG_DELETED, MSG_MOVE | MSG_COPY);
procmsg_msginfo_set_flags(msginfo, MSG_LOCKED, 0);
summary_set_row_marks(summaryview, row);
- debug_print(_("Message %d is locked\n"), msginfo->msgnum);
+ debug_print("Message %d is locked\n", msginfo->msgnum);
}
void summary_mark(SummaryView *summaryview)
MsgInfo *msginfo;
msginfo = gtk_ctree_node_get_row_data(ctree, row);
-/* NOT NEEDED ANYMORE
+
+ if(!MSG_IS_NEW(msginfo->flags) && !MSG_IS_UNREAD(msginfo->flags))
+ return;
+
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))
summaryview->unread--;
-*/
+
procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0);
summary_set_row_marks(summaryview, row);
- debug_print(_("Message %d is marked as read\n"),
+ debug_print("Message %d is marked as read\n",
msginfo->msgnum);
}
procmsg_msginfo_unset_flags(msginfo, MSG_DELETED, 0);
summaryview->deleted--;
}
-/* NOT NEEDED ANYMORE
+
if (!MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
summaryview->unread++;
-*/
procmsg_msginfo_unset_flags(msginfo, MSG_REPLIED | MSG_FORWARDED, 0);
procmsg_msginfo_set_flags(msginfo, MSG_UNREAD, 0);
- debug_print(_("Message %d is marked as unread\n"),
+ debug_print("Message %d is marked as unread\n",
msginfo->msgnum);
summary_set_row_marks(summaryview, row);
summaryview->folder_item->stype != F_TRASH)
summary_set_row_marks(summaryview, row);
- debug_print(_("Message %s/%d is set to delete\n"),
+ debug_print("Message %s/%d is set to delete\n",
msginfo->folder->path, msginfo->msgnum);
}
if (summaryview->folder_item->stype == F_TRASH) return;
main_window_cursor_wait(summaryview->mainwin);
- debug_print(_("Deleting duplicated messages..."));
+ debug_print("Deleting duplicated messages...");
STATUSBAR_PUSH(summaryview->mainwin,
_("Deleting duplicated messages..."));
else
summary_status_show(summaryview);
- debug_print(_("done.\n"));
+ debug_print("done.\n");
STATUSBAR_POP(summaryview->mainwin);
main_window_cursor_normal(summaryview->mainwin);
}
procmsg_msginfo_unset_flags(msginfo, MSG_MARKED | MSG_DELETED, MSG_MOVE | MSG_COPY);
summary_set_row_marks(summaryview, row);
- debug_print(_("Message %s/%d is unmarked\n"),
+ debug_print("Message %s/%d is unmarked\n",
msginfo->folder->path, msginfo->msgnum);
}
}
}
- debug_print(_("Message %d is set to move to %s\n"),
+ debug_print("Message %d is set to move to %s\n",
msginfo->msgnum, to_folder->path);
}
}
}
- debug_print(_("Message %d is set to copy to %s\n"),
+ debug_print("Message %d is set to copy to %s\n",
msginfo->msgnum, to_folder->path);
}
}
src = procmsg_get_message_file(msginfo);
- if (copy_file(src, dest) < 0) {
+ if (copy_file(src, dest, TRUE) < 0) {
alertpanel_error(_("Can't save the file `%s'."),
g_basename(dest));
}
summary_update_status(summaryview);
summary_status_show(summaryview);
- summary_write_cache(summaryview);
-
gtk_ctree_node_moveto(ctree, summaryview->selected, -1, 0.5, 0);
gtk_clist_thaw(clist);
if (summaryview->mlist) {
procmsg_move_messages(summaryview->mlist);
- folderview_update_item_foreach(summaryview->folder_table);
+ folderview_update_item_foreach(summaryview->folder_table, FALSE);
for (cur = summaryview->mlist; cur != NULL; cur = cur->next)
procmsg_msginfo_free((MsgInfo *)cur->data);
procmsg_copy_messages(summaryview->mlist);
/* folder_item_scan_foreach(summaryview->folder_table); */
- folderview_update_item_foreach(summaryview->folder_table);
+ folderview_update_item_foreach(summaryview->folder_table, FALSE);
g_slist_free(summaryview->mlist);
summaryview->mlist = NULL;
summary_lock(summaryview);
- debug_print(_("Building threads..."));
+ debug_print("Building threads...");
STATUSBAR_PUSH(summaryview->mainwin, _("Building threads..."));
main_window_cursor_wait(summaryview->mainwin);
gtk_signal_handler_unblock_by_func(GTK_OBJECT(ctree),
summary_tree_expanded, summaryview);
- debug_print(_("done.\n"));
+ debug_print("done.\n");
STATUSBAR_POP(summaryview->mainwin);
main_window_cursor_normal(summaryview->mainwin);
summary_lock(summaryview);
- debug_print(_("Unthreading..."));
+ debug_print("Unthreading...");
STATUSBAR_PUSH(summaryview->mainwin, _("Unthreading..."));
main_window_cursor_wait(summaryview->mainwin);
-
+
gtk_signal_handler_block_by_func(GTK_OBJECT(ctree),
summary_tree_collapsed, summaryview);
gtk_clist_freeze(GTK_CLIST(ctree));
}
}
+ /* CLAWS: and sort it */
+ gtk_sctree_sort_recursive(ctree, NULL);
+
gtk_clist_thaw(GTK_CLIST(ctree));
gtk_signal_handler_unblock_by_func(GTK_OBJECT(ctree),
summary_tree_collapsed, summaryview);
- debug_print(_("done.\n"));
+ debug_print("done.\n");
STATUSBAR_POP(summaryview->mainwin);
main_window_cursor_normal(summaryview->mainwin);
summary_lock(summaryview);
- debug_print(_("Unthreading for execution..."));
+ debug_print("Unthreading for execution...");
gtk_clist_freeze(GTK_CLIST(ctree));
gtk_clist_thaw(GTK_CLIST(ctree));
- debug_print(_("done.\n"));
+ debug_print("done.\n");
summary_unlock(summaryview);
}
}
}
-void summary_processing(SummaryView *summaryview, GSList * mlist)
-{
- GSList * processing_list;
- FolderItem * folder_item;
- GSList * cur;
- gchar * buf;
-
- folder_item = summaryview->folder_item;
- if (folder_item == NULL)
- return;
-
- processing_list = folder_item->prefs->processing;
-
- if (processing_list == NULL)
- return;
-
- summary_lock(summaryview);
-
- buf = g_strdup_printf(_("Processing (%s)..."), folder_item->path);
- debug_print(buf);
- STATUSBAR_PUSH(summaryview->mainwin, buf);
- g_free(buf);
-
- main_window_cursor_wait(summaryview->mainwin);
-
- summaryview->folder_table = g_hash_table_new(NULL, NULL);
-
- for(cur = mlist ; cur != NULL ; cur = cur->next) {
- MsgInfo * msginfo;
-
- msginfo = (MsgInfo *) cur->data;
- filter_message_by_msginfo(processing_list, msginfo,
- summaryview->folder_table);
- }
-
- /* folder_item_scan_foreach(summaryview->folder_table); */
- folderview_update_item_foreach(summaryview->folder_table);
-
- g_hash_table_destroy(summaryview->folder_table);
- summaryview->folder_table = NULL;
-
- if (prefs_common.immediate_exec) {
- summary_unlock(summaryview);
- summary_execute(summaryview);
- summary_lock(summaryview);
- } else
- summary_status_show(summaryview);
-
- debug_print(_("done.\n"));
- STATUSBAR_POP(summaryview->mainwin);
- main_window_cursor_normal(summaryview->mainwin);
-
- summary_unlock(summaryview);
-}
-
void summary_expand_threads(SummaryView *summaryview)
{
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
summary_lock(summaryview);
- debug_print(_("filtering..."));
+ debug_print("filtering...");
STATUSBAR_PUSH(summaryview->mainwin, _("Filtering..."));
main_window_cursor_wait(summaryview->mainwin);
gtk_clist_thaw(GTK_CLIST(summaryview->ctree));
/* folder_item_scan_foreach(summaryview->folder_table); */
- folderview_update_item_foreach(summaryview->folder_table);
+ folderview_update_item_foreach(summaryview->folder_table, FALSE);
g_hash_table_destroy(summaryview->folder_table);
summaryview->folder_table = NULL;
}
- debug_print(_("done.\n"));
+ debug_print("done.\n");
STATUSBAR_POP(summaryview->mainwin);
main_window_cursor_normal(summaryview->mainwin);
* we want the lock to be context aware...
*/
if (global_processing) {
- summary_show(summaryview, summaryview->folder_item, TRUE);
+ summary_show(summaryview, summaryview->folder_item);
}
}
item = summaryview->folder_item;
- summary_lock(summaryview);
- summary_write_cache(summaryview);
- summary_unlock(summaryview);
-
summary_clear_all(summaryview);
gtk_widget_destroy(summaryview->ctree);
gtk_container_add(GTK_CONTAINER(scrolledwin), ctree);
gtk_widget_show(ctree);
- summary_show(summaryview, item, FALSE);
+ summary_show(summaryview, item);
summary_select_by_msgnum(summaryview, selected_msgnum);
summaryview->displayed = summary_find_msg_by_msgnum(summaryview, displayed_msgnum);
GTK_CLIST(ctree)->selection->next) {
summaryview->display_msg = FALSE;
summary_set_menu_sensitive(summaryview);
- main_window_set_toolbar_sensitive(summaryview->mainwin);
+ toolbar_set_sensitive(summaryview->mainwin);
return;
}
summaryview->display_msg = FALSE;
} else {
summary_set_menu_sensitive(summaryview);
- main_window_set_toolbar_sensitive(summaryview->mainwin);
+ toolbar_set_sensitive(summaryview->mainwin);
}
}
return strcasecmp(msginfo1->subject, msginfo2->subject);
}
+static gint summary_cmp_by_simplified_subject
+ (GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
+{
+ const PrefsFolderItem *prefs;
+ const gchar *str1, *str2;
+ const GtkCListRow *r1 = (const GtkCListRow *) ptr1;
+ const GtkCListRow *r2 = (const GtkCListRow *) ptr2;
+ const MsgInfo *msginfo1 = r1->data;
+ const MsgInfo *msginfo2 = r2->data;
+ const SummaryView *sv = gtk_object_get_data(GTK_OBJECT(clist), "summaryview");
+
+ g_return_val_if_fail(sv, -1);
+ g_return_val_if_fail(msginfo1 != NULL && msginfo2 != NULL, -1);
+
+ str1 = GTK_CELL_TEXT(r1->cell[sv->col_pos[S_COL_SUBJECT]])->text;
+ str2 = GTK_CELL_TEXT(r2->cell[sv->col_pos[S_COL_SUBJECT]])->text;
+
+ if (!str1)
+ return str2 != NULL;
+
+ if (!str2)
+ return -1;
+
+ prefs = msginfo1->folder->prefs;
+ if (!prefs)
+ prefs = msginfo2->folder->prefs;
+ if (!prefs)
+ return -1;
+
+ return strcasecmp(str1, str2);
+}
+
static gint summary_cmp_by_label(GtkCList *clist,
gconstpointer ptr1, gconstpointer ptr2)
{
if (mff->account->mark_crosspost_read && MSG_IS_NEWS(msginfo->flags)) {
line = g_string_sized_new(128);
g_string_sprintf(line, "%s:%d", msginfo->folder->path, msginfo->msgnum);
- debug_print(_("nfcp: checking <%s>"), line->str);
+ debug_print("nfcp: checking <%s>", line->str);
if (mff->newsart &&
g_hash_table_lookup_extended(mff->newsart, line->str, &key, &value)) {
- debug_print(_(" <%s>"), (gchar *)value);
+ 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);
procmsg_msginfo_set_flags(msginfo, mff->account->crosspost_col, 0);
g_free(key);
}
g_string_free(line, TRUE);
- debug_print(_("\n"));
+ debug_print("\n");
}
}
msginfo = gtk_ctree_node_get_row_data(ctree, row);
gtk_ctree_select(GTK_CTREE(ctree), row);
- debug_print(_("Message %d selected\n"), msginfo->msgnum);
+ debug_print("Message %d selected\n", msginfo->msgnum);
}
/* select current thread */
MsgInfo *msginfo;
msginfo = gtk_ctree_node_get_row_data(ctree, row);
-/* NOT NEEDED ANYMORE
+
if (MSG_IS_NEW(msginfo->flags))
summaryview->newmsgs--;
if (MSG_IS_UNREAD(msginfo->flags))
summaryview->unread--;
-*/
+
procmsg_msginfo_set_flags(msginfo, MSG_IGNORE_THREAD, 0);
summary_set_row_marks(summaryview, row);
- debug_print(_("Message %d is marked as ignore thread\n"),
+ debug_print("Message %d is marked as ignore thread\n",
msginfo->msgnum);
}
-
static void summary_ignore_thread(SummaryView *summaryview)
{
GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
MsgInfo *msginfo;
msginfo = gtk_ctree_node_get_row_data(ctree, row);
-/* NOT NEEDED ANYMORE
+
if (MSG_IS_NEW(msginfo->flags))
summaryview->newmsgs++;
if (MSG_IS_UNREAD(msginfo->flags))
summaryview->unread++;
-*/
+
procmsg_msginfo_unset_flags(msginfo, MSG_IGNORE_THREAD, 0);
summary_set_row_marks(summaryview, row);
- debug_print(_("Message %d is marked as unignore thread\n"),
+ debug_print("Message %d is marked as unignore thread\n",
msginfo->msgnum);
}
summary_status_show(summaryview);
}
+#if 0 /* OLD PROCESSING */
static gboolean processing_apply_func(GNode *node, gpointer data)
{
FolderItem *item;
processing_apply_func, summaryview);
}
}
+#endif
void summary_toggle_show_read_messages(SummaryView *summaryview)
{
summaryview->folder_item->hide_read_msgs = 0;
else
summaryview->folder_item->hide_read_msgs = 1;
- summary_show(summaryview, summaryview->folder_item, FALSE);
+ summary_show(summaryview, summaryview->folder_item);
}
static void summary_set_hide_read_msgs_menu (SummaryView *summaryview,
gtk_object_set_data(GTK_OBJECT(widget), "dont_toggle",
GINT_TO_POINTER(0));
}
-static void summaryview_subject_filter_init(PrefsFolderItem *prefs)
-{
- int err;
- gchar buf[BUFFSIZE];
- if (prefs->enable_simplify_subject) {
- if (prefs->simplify_subject_regexp &&
- *prefs->simplify_subject_regexp != 0x00) {
-
- if (!prefs->simplify_subject_preg)
- prefs->simplify_subject_preg = g_new(regex_t, 1);
- else
- regfree(prefs->simplify_subject_preg);
-
- err = string_match_precompile(prefs->simplify_subject_regexp,
- prefs->simplify_subject_preg, REG_EXTENDED);
- if (err) {
- regerror(err, prefs->simplify_subject_preg, buf, BUFFSIZE);
- alertpanel_error(_("Regular expression (regexp) error:\n%s"), buf);
- g_free(prefs->simplify_subject_preg);
- prefs->simplify_subject_preg = NULL;
- }
- } else {
- if (prefs->simplify_subject_preg) {
- regfree(prefs->simplify_subject_preg);
- g_free(prefs->simplify_subject_preg);
- prefs->simplify_subject_preg = NULL;
- }
- }
- }
-}
void summary_reflect_prefs_pixmap_theme(SummaryView *summaryview)
{
gtk_widget_show(pixmap);
summaryview->folder_pixmap = pixmap;
- summary_write_cache(summaryview);
-
folderview_unselect(summaryview->folderview);
folderview_select(summaryview->folderview, summaryview->folder_item);
}
/*
* Harvest addresses for selected messages in summary view.
*/
-void summary_harvest_address( SummaryView *summaryview ) {
+void summary_harvest_address(SummaryView *summaryview)
+{
GtkCTree *ctree = GTK_CTREE( summaryview->ctree );
GList *cur;
GList *msgList;
g_list_free( msgList );
}
+static regex_t *summary_compile_simplify_regexp(gchar *simplify_subject_regexp)
+{
+ int err;
+ gchar buf[BUFFSIZE];
+ regex_t *preg = NULL;
+
+ preg = g_new0(regex_t, 1);
+
+ err = string_match_precompile(simplify_subject_regexp,
+ preg, REG_EXTENDED);
+ if (err) {
+ regerror(err, preg, buf, BUFFSIZE);
+ alertpanel_error(_("Regular expression (regexp) error:\n%s"), buf);
+ g_free(preg);
+ preg = NULL;
+ }
+
+ return preg;
+}
+
+void summary_set_prefs_from_folderitem(SummaryView *summaryview, FolderItem *item)
+{
+ g_return_if_fail(summaryview != NULL);
+ g_return_if_fail(item != NULL);
+
+ /* Subject simplification */
+ if(summaryview->simplify_subject_preg) {
+ regfree(summaryview->simplify_subject_preg);
+ g_free(summaryview->simplify_subject_preg);
+ summaryview->simplify_subject_preg = NULL;
+ }
+ if(item->prefs && item->prefs->simplify_subject_regexp &&
+ item->prefs->simplify_subject_regexp[0] && item->prefs->enable_simplify_subject)
+ summaryview->simplify_subject_preg = summary_compile_simplify_regexp(item->prefs->simplify_subject_regexp);
+}
+
/*
* End of Source.
*/
-