#include "pixmaps/replied.xpm"
#include "pixmaps/forwarded.xpm"
#include "pixmaps/clip.xpm"
+#include "pixmaps/ignorethread.xpm"
#define STATUSBAR_PUSH(mainwin, str) \
{ \
static GdkBitmap *repliedxpmmask;
static GdkPixmap *forwardedxpm;
static GdkBitmap *forwardedxpmmask;
+static GdkPixmap *ignorethreadxpm;
+static GdkBitmap *ignorethreadxpmmask;
static GdkPixmap *clipxpm;
static GdkBitmap *clipxpmmask;
static void summary_execute_delete_func (GtkCTree *ctree,
GtkCTreeNode *node,
gpointer data);
+static void summary_ignore_thread(SummaryView *summaryview);
+static void summary_unignore_thread(SummaryView *summaryview);
/* thread functions */
static void summary_thread_func (GtkCTree *ctree,
SummaryView *summaryview);
static void summary_subject_clicked (GtkWidget *button,
SummaryView *summaryview);
+static void summary_mark_clicked (GtkWidget *button,
+ SummaryView *summaryview);
static void summary_start_drag (GtkWidget *widget,
int button,
static gint summary_cmp_by_score (GtkCList *clist,
gconstpointer ptr1,
gconstpointer ptr2);
+static gint summary_cmp_by_label (GtkCList *clist,
+ gconstpointer ptr1,
+ gconstpointer ptr2);
GtkTargetEntry summary_drag_types[1] =
{
{N_("/_Mark/_Unmark"), NULL, summary_unmark, 0, NULL},
{N_("/_Mark/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Mark/Mark as unr_ead"), NULL, summary_mark_as_unread, 0, NULL},
- {N_("/_Mark/Mark as rea_d"),
- NULL, summary_mark_as_read, 0, NULL},
+ {N_("/_Mark/Mark as rea_d"), NULL, summary_mark_as_read, 0, NULL},
+ {N_("/_Mark/Ignore thread"), NULL, summary_ignore_thread, 0, NULL},
+ {N_("/_Mark/Unignore thread"), NULL, summary_unignore_thread, 0, NULL},
+
{N_("/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Reply"), NULL, summary_reply_cb, COMPOSE_REPLY, NULL},
{N_("/Repl_y to sender"), NULL, summary_reply_cb, COMPOSE_REPLY_TO_SENDER, NULL},
{N_("/Select _all"), NULL, summary_select_all, 0, NULL}
};
+/* L A B E L C O L O R S T U F F */
+
+static struct
+{
+ GdkColor color;
+ gchar *label;
+
+ GdkPixmap *xpm;
+ GdkBitmap *xbm;
+ GtkPixmap *pixmap;
+}
+label_colors[] =
+{
+ { { 0, 0xffff, (0x99 << 8), 0x0 }, N_("Orange"), NULL, NULL, NULL },
+ { { 0, 0xffff, 0, 0 }, N_("Red"), NULL, NULL, NULL },
+ { { 0, 0xffff, (0x66 << 8), 0xffff }, N_("Pink"), NULL, NULL, NULL },
+ { { 0, 0x0, (0xcc << 8), 0xffff }, N_("Sky blue"), NULL, NULL, NULL },
+ { { 0, 0x0, 0x0, 0xffff }, N_("Blue"), NULL, NULL, NULL },
+ { { 0, 0x0, 0x99 << 8, 0x0 }, N_("Green"), NULL, NULL, NULL },
+ { { 0, 0x66 << 8, 0x33 << 8, 0x33 << 8 }, N_("Brown"), NULL, NULL, NULL }
+};
+
+#define LABEL_COLORS_ELEMS (sizeof label_colors / sizeof label_colors[0])
+
+static void label_menu_item_activate_cb(GtkWidget *widget, gpointer data)
+{
+ guint color = GPOINTER_TO_UINT(data);
+ SummaryView *view = gtk_object_get_data(GTK_OBJECT(widget), "view");
+
+ g_return_if_fail(view);
+ color <<= 7;
+ summary_set_label(view, color, NULL);
+}
+
+/* summary_set_label_color() - labelcolor parameter is the color *flag*
+ * for the messsage; not the color index */
+void summary_set_label_color(GtkCTree *ctree, GtkCTreeNode *node,
+ guint labelcolor)
+{
+ GdkColor color;
+ GtkStyle *style, *prev_style, *ctree_style;
+ MsgInfo *msginfo;
+ gint color_index = ((gint)(labelcolor >> 7)) - 1;
+
+ ctree_style = gtk_widget_get_style(GTK_WIDGET(ctree));
+
+ prev_style = gtk_ctree_node_get_row_style(ctree, node);
+
+ if (!prev_style)
+ prev_style = ctree_style;
+
+ style = gtk_style_copy(prev_style);
+
+ if (color_index < 0 || color_index >= LABEL_COLORS_ELEMS) {
+ labelcolor = MSG_LABEL;
+ color.red = ctree_style->fg[GTK_STATE_NORMAL].red;
+ color.green = ctree_style->fg[GTK_STATE_NORMAL].green;
+ color.blue = ctree_style->fg[GTK_STATE_NORMAL].blue;
+ style->fg[GTK_STATE_NORMAL] = color;
+
+ color.red = ctree_style->fg[GTK_STATE_SELECTED].red;
+ color.green = ctree_style->fg[GTK_STATE_SELECTED].green;
+ color.blue = ctree_style->fg[GTK_STATE_SELECTED].blue;
+ style->fg[GTK_STATE_SELECTED] = color;
+ gtk_ctree_node_set_row_style(ctree, node, style);
+ }
+ else
+ color = label_colors[color_index].color;
+
+ msginfo = gtk_ctree_node_get_row_data(ctree, node);
+
+ MSG_UNSET_FLAGS(msginfo->flags, MSG_LABEL);
+ MSG_SET_FLAGS(msginfo->flags, labelcolor);
+
+ if ( style ) {
+ style->fg[GTK_STATE_NORMAL] = color;
+ style->fg[GTK_STATE_SELECTED] = color;
+ gtk_ctree_node_set_row_style(ctree, node, style);
+ }
+}
+
+void summary_set_label(SummaryView *summaryview, guint labelcolor, GtkWidget *widget)
+{
+ GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+ GtkCList *clist = GTK_CLIST(summaryview->ctree);
+ GList *cur;
+
+ for (cur = clist->selection; cur != NULL; cur = cur->next)
+ summary_set_label_color(ctree, GTK_CTREE_NODE(cur->data), labelcolor);
+}
+
+/* summary_create_label_pixmaps() - creates label pixmaps. perhaps a little
+ * bit contrived. */
+static gboolean summary_create_label_pixmaps(SummaryView *summaryview)
+{
+ const char *FMT = "+ c #%2.2X%2.2X%2.2X";
+ char buf[40];
+ char * dummy_xpm[] = {
+ "16 16 3 1",
+ " c None",
+ ". c #000000",
+ "+ c #000000",
+ "................",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ ".++++++++++++++.",
+ "................"
+ };
+
+ gint n;
+
+ for (n = 0; n < LABEL_COLORS_ELEMS; n++) {
+ GdkBitmap *xpmmask;
+ GdkPixmap *xpm;
+ GtkPixmap *pixmap;
+
+ /* put correct color in xpm data */
+ sprintf(buf, FMT, label_colors[n].color.red >> 8,
+ label_colors[n].color.green >> 8,
+ label_colors[n].color.blue >> 8);
+ g_print("%s\n", buf);
+ dummy_xpm[3] = buf;
+
+ /* create pixmaps */
+ xpm = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(summaryview->scrolledwin)->window, &xpmmask, NULL,
+ (gchar **) &dummy_xpm);
+ pixmap = GTK_PIXMAP(gtk_pixmap_new(xpm, xpmmask));
+
+ /* store it somewhere */
+ label_colors[n].xpm = xpm;
+ label_colors[n].xbm = xpmmask;
+ label_colors[n].pixmap = pixmap;
+ }
+}
+
+static void summary_create_label_menu(SummaryView *summaryview)
+{
+ const gint LABEL_MENU_POS = 5;
+ GtkWidget *label_menu_item;
+ GtkWidget *label_menu;
+ GtkWidget *item;
+ gint i;
+
+ summary_create_label_pixmaps(summaryview);
+
+ label_menu_item = gtk_menu_item_new_with_label(_("Label"));
+ gtk_menu_insert(GTK_MENU(summaryview->popupmenu), label_menu_item, LABEL_MENU_POS);
+ gtk_widget_show(label_menu_item);
+ summaryview->label_menu_item = label_menu_item;
+
+ label_menu = gtk_menu_new();
+
+ /* create sub items. for the menu item activation callback we pass the
+ * index of label_colors[] as data parameter. for the None color we pass
+ * an invalid (high) value. also we attach a data pointer so we can
+ * always get back the SummaryView pointer. */
+ item = gtk_menu_item_new_with_label(_("None"));
+ gtk_menu_append(GTK_MENU(label_menu), item);
+ gtk_signal_connect(GTK_OBJECT(item), "activate",
+ GTK_SIGNAL_FUNC(label_menu_item_activate_cb),
+ GUINT_TO_POINTER(-1));
+ gtk_object_set_data(GTK_OBJECT(item), "view", summaryview);
+ gtk_widget_show(item);
+
+ item = gtk_menu_item_new();
+ gtk_menu_append(GTK_MENU(label_menu), item);
+ gtk_widget_show(item);
+
+ /* create pixmap/label menu items */
+ for (i = 0; i < LABEL_COLORS_ELEMS; i++) {
+ GtkWidget *label, *hbox, *align, *pixmap;
+ item = gtk_menu_item_new();
+
+ label = gtk_label_new(label_colors[i].label);
+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
+ gtk_widget_show(label);
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_widget_show(hbox);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+
+ align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
+ gtk_widget_show(align);
+ gtk_container_set_border_width (GTK_CONTAINER(align), 1);
+
+ pixmap = GTK_WIDGET(label_colors[i].pixmap);
+
+ gtk_container_add (GTK_CONTAINER (align), pixmap);
+ gtk_widget_set_usize (align, 16, 16);
+ gtk_widget_show(pixmap);
+
+ gtk_box_pack_start(GTK_BOX (hbox), align, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4);
+
+ gtk_menu_append(GTK_MENU(label_menu), item);
+ gtk_signal_connect(GTK_OBJECT(item), "activate",
+ GTK_SIGNAL_FUNC(label_menu_item_activate_cb),
+ GUINT_TO_POINTER(i + 1));
+ gtk_object_set_data(GTK_OBJECT(item), "view", summaryview);
+ gtk_widget_show(item);
+
+ }
+
+ gtk_widget_show(label_menu);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(label_menu_item), label_menu);
+ summaryview->label_menu = label_menu;
+}
+
SummaryView *summary_create(void)
{
SummaryView *summaryview;
"clicked",
GTK_SIGNAL_FUNC(summary_subject_clicked),
summaryview);
+ gtk_signal_connect
+ (GTK_OBJECT(GTK_CLIST(ctree)->column[S_COL_MARK].button),
+ "clicked",
+ GTK_SIGNAL_FUNC(summary_mark_clicked),
+ summaryview);
/* create status label */
hbox = gtk_hbox_new(FALSE, 0);
summaryview->sort_mode = SORT_BY_NONE;
summaryview->sort_type = GTK_SORT_ASCENDING;
+// summary_create_label_menu(summaryview);
+
summary_change_display_item(summaryview);
gtk_widget_show_all(vbox);
replied_xpm);
PIXMAP_CREATE(summaryview->ctree, forwardedxpm, forwardedxpmmask,
forwarded_xpm);
+ PIXMAP_CREATE(summaryview->ctree, ignorethreadxpm, ignorethreadxpmmask,
+ ignorethread_xpm);
PIXMAP_CREATE(summaryview->ctree, clipxpm, clipxpmmask, clip_xpm);
PIXMAP_CREATE(summaryview->hbox, folderxpm, folderxpmmask,
DIRECTORY_OPEN_XPM);
summary_clear_list(summaryview);
summary_set_menu_sensitive(summaryview);
+ summary_create_label_menu(summaryview);
+
}
GtkCTreeNode * summary_find_next_important_score(SummaryView *summaryview,
GtkCTreeNode *best_node = NULL;
if (current_node)
- //node = current_node;
+ /*node = current_node;*/
node = GTK_CTREE_NODE_NEXT(current_node);
else
node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
GtkCTreeNode *best_node = NULL;
if (current_node)
- //node = current_node;
+ /*node = current_node;*/
node = GTK_CTREE_NODE_PREV(current_node);
else
node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
messageview_clear(summaryview->messageview);
buf = NULL;
- if (!item || !item->path || !item->parent ||
+ if (!item || !item->path || !item->parent || item->no_select ||
(item->folder->type == F_MH &&
((buf = folder_item_get_path(item)) == NULL ||
change_dir(buf) < 0))) {
menu_set_insensitive_all
(GTK_MENU_SHELL(summaryview->popupmenu));
return;
- }
+ }
if (summaryview->folder_item->folder->type != F_NEWS) {
if (summaryview->folder_item->stype != F_TRASH)
menu_set_sensitive(ifactory, "/Move...", TRUE);
menu_set_sensitive(ifactory, "/Copy...", TRUE);
}
+
+ gtk_widget_set_sensitive(summaryview->label_menu_item, TRUE);
menu_set_sensitive(ifactory, "/Execute", TRUE);
sens = (selection == SUMMARY_SELECTED_MULTIPLE) ? FALSE : TRUE;
menu_set_sensitive(ifactory, "/Reply", sens);
menu_set_sensitive(ifactory, "/Reply to sender", sens);
menu_set_sensitive(ifactory, "/Reply to all", sens);
- menu_set_sensitive(ifactory, "/Forward", sens);
- menu_set_sensitive(ifactory, "/Forward as attachment", sens);
-
+ menu_set_sensitive(ifactory, "/Forward", TRUE);
+ menu_set_sensitive(ifactory, "/Forward as attachment", TRUE);
+
menu_set_sensitive(ifactory, "/Open in new window", sens);
menu_set_sensitive(ifactory, "/View source", sens);
menu_set_sensitive(ifactory, "/Show all header", sens);
menu_set_sensitive(ifactory, "/Mark/Mark", TRUE);
menu_set_sensitive(ifactory, "/Mark/Unmark", TRUE);
- menu_set_sensitive(ifactory, "/Mark/Mark as unread", TRUE);
- menu_set_sensitive(ifactory, "/Mark/Mark as read", TRUE);
+ menu_set_sensitive(ifactory, "/Mark/Mark as unread", TRUE);
+ menu_set_sensitive(ifactory, "/Mark/Mark as read", TRUE);
+ menu_set_sensitive(ifactory, "/Mark/Ignore thread", TRUE);
+ menu_set_sensitive(ifactory, "/Mark/Unignore thread", TRUE);
menu_set_sensitive(ifactory, "/Select all", TRUE);
if (node) {
gtk_sctree_unselect_all(GTK_SCTREE(ctree));
gtk_sctree_select(GTK_SCTREE(ctree), node);
+
+ /* BUGFIX: select next unread message
+ * REVERT: causes incorrect folder stats
+ * gtk_ctree_node_moveto(ctree, node, -1, 0.5, 0.0);
+ */
+
if (summaryview->displayed == node)
summaryview->displayed = NULL;
summary_display_msg(summaryview, node, FALSE);
if (current_node)
node = current_node;
- //node = GTK_CTREE_NODE_NEXT(current_node);
+ /*node = GTK_CTREE_NODE_NEXT(current_node);*/
else
node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
for (; node != NULL; node = GTK_CTREE_NODE_NEXT(node)) {
msginfo = gtk_ctree_node_get_row_data(ctree, node);
- if (MSG_IS_UNREAD(msginfo->flags)) break;
+ if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) break;
}
return node;
if (current_node)
node = current_node;
- //node = GTK_CTREE_NODE_PREV(current_node);
+ /*node = GTK_CTREE_NODE_PREV(current_node);*/
else
node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list_end);
msginfo = gtk_ctree_node_get_row_data(ctree, node);
- if (MSG_IS_NEW(msginfo->flags))
+ if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
summaryview->newmsgs++;
- if (MSG_IS_UNREAD(msginfo->flags))
+ if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
summaryview->unread++;
if (MSG_IS_DELETED(msginfo->flags))
summaryview->deleted++;
node != NULL; node = GTK_CTREE_NODE_NEXT(node)) {
msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
- if (MSG_IS_NEW(msginfo->flags))
+ if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
summaryview->newmsgs++;
- if (MSG_IS_UNREAD(msginfo->flags))
+ if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
summaryview->unread++;
if (MSG_IS_DELETED(msginfo->flags))
summaryview->deleted++;
case SORT_BY_SCORE:
cmp_func = (GtkCListCompareFunc)summary_cmp_by_score;
break;
+ case SORT_BY_LABEL:
+ cmp_func = (GtkCListCompareFunc)summary_cmp_by_label;
+ break;
default:
return;
}
gtk_ctree_sort_node(ctree, NULL);
gtk_ctree_node_moveto(ctree, summaryview->selected, -1, 0.5, 0);
- //gtkut_ctree_set_focus_row(ctree, summaryview->selected);
+ /*gtkut_ctree_set_focus_row(ctree, summaryview->selected);*/
prefs_folder_item_set_config(summaryview->folder_item,
summaryview->sort_type,
parent = g_hash_table_lookup
(msgid_table, msginfo->inreplyto);
}
- if (parent == NULL && msginfo->subject) {
+ if (parent == NULL && msginfo->subject &&
+ g_strncasecmp(msginfo->subject, "Re: ", 4) == 0) {
parent = subject_table_lookup
(subject_table, msginfo->subject);
}
+ if(parent) {
+ parentinfo = gtk_ctree_node_get_row_data(ctree, parent);
+ if(parentinfo && MSG_IS_IGNORE_THREAD(parentinfo->flags)) {
+/*
+ if (MSG_IS_NEW(msginfo->flags))
+ summaryview->newmsgs--;
+ if (MSG_IS_UNREAD(msginfo->flags))
+ summaryview->unread--;
+*/
+ MSG_SET_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
+ }
+ }
node = gtk_ctree_insert_node
(ctree, parent, NULL, text, 2,
GTKUT_CTREE_NODE_SET_ROW_DATA(node, msginfo);
summary_set_marks_func(ctree, node, summaryview);
+
+ if ( MSG_GET_LABEL(msginfo->flags) )
+ summary_set_label_color(ctree, node, (msginfo->flags & MSG_LABEL));
/* preserve previous node if the message is
duplicated */
*cur_msginfo->inreplyto) {
cur_parent = g_hash_table_lookup(msgid_table, cur_msginfo->inreplyto);
}
- if (cur_parent == NULL && cur_msginfo->subject) {
+ if (cur_parent == NULL &&
+ cur_msginfo->subject &&
+ g_strncasecmp(cur_msginfo->subject,
+ "Re: ", 4) == 0) {
cur_parent = subject_table_lookup(subject_table, cur_msginfo->subject);
}
}
GTKUT_CTREE_NODE_SET_ROW_DATA(node, msginfo);
summary_set_marks_func(ctree, node, summaryview);
+ if ( MSG_GET_LABEL(msginfo->flags) )
+ summary_set_label_color(ctree, node, (msginfo->flags & MSG_LABEL));
+
if (msginfo->msgid && *msginfo->msgid &&
g_hash_table_lookup(msgid_table, msginfo->msgid)
== NULL)
text[S_COL_FROM] = msginfo->fromname ? msginfo->fromname :
_("(No From)");
if (prefs_common.swap_from && msginfo->from && msginfo->to &&
- cur_account && cur_account->address &&
!MSG_IS_NEWS(msginfo->flags)) {
gchar *from;
Xalloca(from, strlen(msginfo->from) + 1, return);
strcpy(from, msginfo->from);
extract_address(from);
- if (!strcmp(from, cur_account->address)) {
+ if (account_find_mail_from_address(from)) {
g_free(to);
to = g_strconcat("-->", msginfo->to, NULL);
text[S_COL_FROM] = to;
}
g_free(filename);
- if (MSG_IS_NEW(msginfo->flags))
+ if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
summaryview->newmsgs--;
- if (MSG_IS_UNREAD(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)) {
MSG_UNSET_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
flags = msginfo->flags;
- gtk_ctree_node_set_foreground(ctree, row, &summaryview->color_normal);
+ gtk_ctree_node_set_foreground(ctree, row, NULL);
/* set new/unread column */
- if (MSG_IS_NEW(flags)) {
+ if (MSG_IS_IGNORE_THREAD(flags)) {
+ gtk_ctree_node_set_pixmap(ctree, row, S_COL_UNREAD,
+ ignorethreadxpm, ignorethreadxpmmask);
+ } else if (MSG_IS_NEW(flags)) {
gtk_ctree_node_set_pixmap(ctree, row, S_COL_UNREAD,
newxpm, newxpmmask);
} else if (MSG_IS_UNREAD(flags)) {
MsgInfo *msginfo;
msginfo = gtk_ctree_node_get_row_data(ctree, row);
- if (MSG_IS_NEW(msginfo->flags))
+ if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
summaryview->newmsgs--;
- if (MSG_IS_UNREAD(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)) {
MSG_UNSET_FLAGS(msginfo->flags, MSG_REPLIED | MSG_FORWARDED);
if (!MSG_IS_UNREAD(msginfo->flags)) {
MSG_SET_FLAGS(msginfo->flags, MSG_UNREAD);
-
gtk_ctree_node_set_pixmap(ctree, row, S_COL_UNREAD,
unreadxpm, unreadxpmmask);
summaryview->unread++;
if (!summaryview->folder_item ||
summaryview->folder_item->folder->type == F_NEWS) return;
- to_folder = foldersel_folder_sel(NULL);
+ to_folder = foldersel_folder_sel(NULL, NULL);
summary_move_selected_to(summaryview, to_folder);
}
if (!summaryview->folder_item ||
summaryview->folder_item->folder->type == F_NEWS) return;
- to_folder = foldersel_folder_sel(NULL);
+ to_folder = foldersel_folder_sel(NULL, NULL);
summary_copy_selected_to(summaryview, to_folder);
}
msginfo->msgid))
g_hash_table_remove(summaryview->msgid_table,
msginfo->msgid);
+
+ if (msginfo->subject &&
+ node == subject_table_lookup(summaryview->subject_table,
+ msginfo->subject)) {
+ gchar *s = msginfo->subject + (g_strncasecmp(msginfo->subject, "Re: ", 4) == 0 ? 4 : 0);
+ g_hash_table_remove(summaryview->subject_table, s);
+ }
}
}
if(msginfo->inreplyto) {
parent = g_hash_table_lookup(msgid_table, msginfo->inreplyto);
}
- if (parent == NULL && msginfo->subject) {
+ if (parent == NULL && msginfo->subject &&
+ g_strncasecmp(msginfo->subject, "Re: ", 4) == 0) {
parent = subject_table_lookup(subject_table, msginfo->subject);
}
case GDK_G:
BREAK_ON_MODIFIER_KEY();
KEY_PRESS_EVENT_STOP();
- to_folder = foldersel_folder_sel(NULL);
+ to_folder = foldersel_folder_sel(NULL, NULL);
if (to_folder) {
debug_print(_("Go to %s\n"), to_folder->path);
folderview_select(summaryview->folderview, to_folder);
gtk_widget_grab_focus(summaryview->folderview->ctree);
return;
default:
+ break;
}
if (!summaryview->selected) {
summary_save_as(summaryview);
break;
default:
+ break;
}
}
}
break;
default:
+ break;
}
if (summaryview->display_msg)
prefs_common.summary_col_subject = width;
break;
default:
+ break;
}
}
GtkWidget *widget)
{
MsgInfo *msginfo;
+ GList *sel = GTK_CLIST(summaryview->ctree)->selection;
msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
summaryview->selected);
compose_reply(msginfo, FALSE, TRUE, FALSE);
break;
case COMPOSE_FORWARD:
- compose_forward(NULL, msginfo, FALSE);
- break;
+ if (!sel->next) {
+ compose_forward(NULL, msginfo, FALSE);
+ break;
+ }
+ /* if (sel->next) FALL THROUGH */
case COMPOSE_FORWARD_AS_ATTACH:
- compose_forward(NULL, msginfo, TRUE);
+ {
+ GSList *msginfo_list = NULL;
+ for ( ; sel != NULL; sel = sel->next)
+ msginfo_list = g_slist_append(msginfo_list,
+ gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
+ GTK_CTREE_NODE(sel->data)));
+ compose_forward_multiple(NULL, msginfo_list);
+ g_slist_free(msginfo_list);
+ }
break;
default:
g_warning("summary_reply_cb(): invalid action: %d\n", action);
guint action,
GtkWidget *widget_)
{
- GtkWidget *submenu;
- GList *groups, *tmp;
+ const gint ADD_SENDER_TO_ADDRESSBOOK_MENU_POS = 13;
+ GtkWidget *submenu;
+ GList *groups, *tmp;
GtkMenuShell *menushell;
- GtkWidget *menu;
- GtkWidget *menuitem;
- GList *child;
- gboolean found = FALSE;
- MsgInfo *msginfo;
- gchar *from_address;
+ GtkWidget *menu;
+ GtkWidget *menuitem;
+ GList *child;
+ gboolean found = FALSE;
+ MsgInfo *msginfo;
+ gchar *from_address;
menushell = GTK_MENU_SHELL(summaryview->popupmenu);
g_return_if_fail(menushell != NULL);
if (!found) {
submenu = gtk_menu_item_new_with_label(_("Add sender to address book"));
gtk_object_set_data(GTK_OBJECT(submenu), "contacts", (gpointer)1);
- gtk_menu_insert(GTK_MENU(summaryview->popupmenu), submenu, 12);
+ gtk_menu_insert(GTK_MENU(summaryview->popupmenu), submenu, ADD_SENDER_TO_ADDRESSBOOK_MENU_POS);
gtk_widget_show(submenu);
}
else {
summary_sort(summaryview, SORT_BY_SUBJECT);
}
+static void summary_mark_clicked(GtkWidget *button,
+ SummaryView *summaryview)
+{
+ summary_sort(summaryview, SORT_BY_LABEL);
+}
+
void summary_change_display_item(SummaryView *summaryview)
{
GtkCList *clist = GTK_CLIST(summaryview->ctree);
return strcasecmp(msginfo1->subject, msginfo2->subject);
}
+static gint summary_cmp_by_label(GtkCList *clist,
+ gconstpointer ptr1, gconstpointer ptr2)
+{
+ MsgInfo *msginfo1 = ((GtkCListRow *)ptr1)->data;
+ MsgInfo *msginfo2 = ((GtkCListRow *)ptr2)->data;
+
+ return MSG_GET_LABEL(msginfo1->flags) - MSG_GET_LABEL(msginfo2->flags);
+}
+
static gint summary_cmp_by_score(GtkCList *clist,
gconstpointer ptr1, gconstpointer ptr2)
{
else
return summary_cmp_by_date(clist, ptr1, ptr2);
}
+
+static void summary_ignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpointer data)
+{
+ SummaryView *summaryview = (SummaryView *) data;
+ MsgInfo *msginfo;
+
+ msginfo = gtk_ctree_node_get_row_data(ctree, row);
+ if (MSG_IS_NEW(msginfo->flags))
+ summaryview->newmsgs--;
+ if (MSG_IS_UNREAD(msginfo->flags))
+ summaryview->unread--;
+ MSG_SET_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
+
+ CHANGE_FLAGS(msginfo);
+
+ summary_set_row_marks(summaryview, row);
+ 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);
+ GList *cur;
+
+ 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);
+ }
+
+ summary_status_show(summaryview);
+}
+
+static void summary_unignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpointer data)
+{
+ SummaryView *summaryview = (SummaryView *) data;
+ MsgInfo *msginfo;
+
+ msginfo = gtk_ctree_node_get_row_data(ctree, row);
+ if (MSG_IS_NEW(msginfo->flags))
+ summaryview->newmsgs++;
+ if (MSG_IS_UNREAD(msginfo->flags))
+ summaryview->unread++;
+ MSG_UNSET_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
+
+ CHANGE_FLAGS(msginfo);
+
+ summary_set_row_marks(summaryview, row);
+ debug_print(_("Message %d is marked as unignore thread\n"),
+ msginfo->msgnum);
+}
+
+static void summary_unignore_thread(SummaryView *summaryview)
+{
+ GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+ GList *cur;
+
+ 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);
+ }
+
+ summary_status_show(summaryview);
+}
+