aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.c7
-rw-r--r--src/prefs_summary_column.c85
-rw-r--r--src/prefs_summary_column.h7
-rw-r--r--src/summaryview.c42
4 files changed, 100 insertions, 41 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 40cbea87..fb2698f2 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -1820,9 +1820,7 @@ static SensitiveCond main_window_get_current_state(MainWindow *mainwin)
if (selection == SUMMARY_SELECTED_SINGLE)
state |= M_SINGLE_TARGET_EXIST;
if (selection == SUMMARY_SELECTED_SINGLE &&
- (item &&
- (item->stype == F_OUTBOX || item->stype == F_DRAFT ||
- item->stype == F_QUEUE)))
+ FOLDER_ITEM_IS_SENT_FOLDER(item))
state |= M_ALLOW_REEDIT;
if (cur_account)
state |= M_HAVE_ACCOUNT;
@@ -3487,7 +3485,8 @@ static void collapse_threads_cb(MainWindow *mainwin, guint action,
static void set_display_item_cb(MainWindow *mainwin, guint action,
GtkWidget *widget)
{
- prefs_summary_column_open();
+ prefs_summary_column_open
+ (FOLDER_ITEM_IS_SENT_FOLDER(mainwin->summaryview->folder_item));
}
static void sort_summary_cb(MainWindow *mainwin, guint action,
diff --git a/src/prefs_summary_column.c b/src/prefs_summary_column.c
index 8858fdc0..a8c352e7 100644
--- a/src/prefs_summary_column.c
+++ b/src/prefs_summary_column.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -63,6 +63,8 @@ static struct _SummaryColumnDialog
GtkWidget *ok_btn;
GtkWidget *cancel_btn;
+ gboolean sent_folder;
+
gboolean finished;
} summary_col;
@@ -74,7 +76,8 @@ static const gchar *const col_name[N_SUMMARY_VISIBLE_COLS] = {
N_("From"), /* S_COL_FROM */
N_("Date"), /* S_COL_DATE */
N_("Size"), /* S_COL_SIZE */
- N_("Number") /* S_COL_NUMBER */
+ N_("Number"), /* S_COL_NUMBER */
+ N_("To") /* S_COL_TO */
};
static SummaryColumnState default_state[N_SUMMARY_VISIBLE_COLS] = {
@@ -85,7 +88,20 @@ static SummaryColumnState default_state[N_SUMMARY_VISIBLE_COLS] = {
{ S_COL_FROM , TRUE },
{ S_COL_DATE , TRUE },
{ S_COL_SIZE , TRUE },
- { S_COL_NUMBER , FALSE }
+ { S_COL_NUMBER , FALSE },
+ { S_COL_TO , FALSE }
+};
+
+static SummaryColumnState default_sent_state[N_SUMMARY_VISIBLE_COLS] = {
+ { S_COL_MARK , TRUE },
+ { S_COL_UNREAD , TRUE },
+ { S_COL_MIME , TRUE },
+ { S_COL_SUBJECT, TRUE },
+ { S_COL_TO , TRUE },
+ { S_COL_DATE , TRUE },
+ { S_COL_SIZE , TRUE },
+ { S_COL_NUMBER , FALSE },
+ { S_COL_FROM , FALSE }
};
static void prefs_summary_column_create (void);
@@ -112,12 +128,12 @@ static gboolean prefs_summary_column_key_pressed(GtkWidget *widget,
GdkEventKey *event,
gpointer data);
-void prefs_summary_column_open(void)
+void prefs_summary_column_open(gboolean sent_folder)
{
inc_lock();
- if (!summary_col.window)
- prefs_summary_column_create();
+ prefs_summary_column_create();
+ summary_col.sent_folder = sent_folder;
gtkut_box_set_reverse_order(GTK_BOX(summary_col.confirm_area),
!prefs_common.comply_gnome_hig);
@@ -132,7 +148,8 @@ void prefs_summary_column_open(void)
while (summary_col.finished == FALSE)
gtk_main_iteration();
- gtk_widget_hide(summary_col.window);
+ gtk_widget_destroy(summary_col.window);
+ summary_col.window = NULL;
main_window_popup(main_window_get());
inc_unlock();
@@ -338,40 +355,68 @@ static void prefs_summary_column_create(void)
summary_col.cancel_btn = cancel_btn;
}
-SummaryColumnState *prefs_summary_column_get_config(void)
+SummaryColumnState *prefs_summary_column_get_config(gboolean sent_folder)
{
static SummaryColumnState state[N_SUMMARY_VISIBLE_COLS];
SummaryColumnType type;
+ gboolean *col_visible;
+ gint *col_pos;
+ SummaryColumnState *def_state;
gint pos;
+ debug_print("prefs_summary_column_get_config(): "
+ "getting %s folder setting\n",
+ sent_folder ? "sent" : "normal");
+
+ if (sent_folder) {
+ col_visible = prefs_common.summary_sent_col_visible;
+ col_pos = prefs_common.summary_sent_col_pos;
+ def_state = default_sent_state;
+ } else {
+ col_visible = prefs_common.summary_col_visible;
+ col_pos = prefs_common.summary_col_pos;
+ def_state = default_state;
+ }
+
for (pos = 0; pos < N_SUMMARY_VISIBLE_COLS; pos++)
state[pos].type = -1;
for (type = 0; type < N_SUMMARY_VISIBLE_COLS; type++) {
- pos = prefs_common.summary_col_pos[type];
+ pos = col_pos[type];
if (pos < 0 || pos >= N_SUMMARY_VISIBLE_COLS ||
state[pos].type != -1) {
g_warning("Wrong column position\n");
- prefs_summary_column_set_config(default_state);
- return default_state;
+ prefs_summary_column_set_config(def_state, sent_folder);
+ return def_state;
}
state[pos].type = type;
- state[pos].visible = prefs_common.summary_col_visible[type];
+ state[pos].visible = col_visible[type];
}
return state;
}
-void prefs_summary_column_set_config(SummaryColumnState *state)
+void prefs_summary_column_set_config(SummaryColumnState *state,
+ gboolean sent_folder)
{
SummaryColumnType type;
+ gboolean *col_visible;
+ gint *col_pos;
gint pos;
+ if (sent_folder) {
+ col_visible = prefs_common.summary_sent_col_visible;
+ col_pos = prefs_common.summary_sent_col_pos;
+ } else {
+ col_visible = prefs_common.summary_col_visible;
+ col_pos = prefs_common.summary_col_pos;
+ }
+
for (pos = 0; pos < N_SUMMARY_VISIBLE_COLS; pos++) {
type = state[pos].type;
- prefs_common.summary_col_visible[type] = state[pos].visible;
- prefs_common.summary_col_pos[type] = pos;
+ col_visible[type] = state[pos].visible;
+ col_pos[type] = pos;
}
}
@@ -387,7 +432,8 @@ static void prefs_summary_column_set_dialog(SummaryColumnState *state)
gtk_clist_clear(shown_clist);
if (!state)
- state = prefs_summary_column_get_config();
+ state = prefs_summary_column_get_config
+ (summary_col.sent_folder);
for (pos = 0; pos < N_SUMMARY_VISIBLE_COLS; pos++) {
gint row;
@@ -432,7 +478,7 @@ static void prefs_summary_column_set_view(void)
state[pos + row].visible = TRUE;
}
- prefs_summary_column_set_config(state);
+ prefs_summary_column_set_config(state, summary_col.sent_folder);
main_window_set_summary_column();
}
@@ -515,7 +561,10 @@ static void prefs_summary_column_down(void)
static void prefs_summary_column_set_to_default(void)
{
- prefs_summary_column_set_dialog(default_state);
+ if (summary_col.sent_folder)
+ prefs_summary_column_set_dialog(default_sent_state);
+ else
+ prefs_summary_column_set_dialog(default_state);
}
static void prefs_summary_column_ok(void)
diff --git a/src/prefs_summary_column.h b/src/prefs_summary_column.h
index 3ea9101d..2a73a47c 100644
--- a/src/prefs_summary_column.h
+++ b/src/prefs_summary_column.h
@@ -22,9 +22,10 @@
#include "summaryview.h"
-void prefs_summary_column_open(void);
+void prefs_summary_column_open(gboolean sent_folder);
-SummaryColumnState *prefs_summary_column_get_config(void);
-void prefs_summary_column_set_config(SummaryColumnState *state);
+SummaryColumnState *prefs_summary_column_get_config(gboolean sent_folder);
+void prefs_summary_column_set_config(SummaryColumnState *state,
+ gboolean sent_folder);
#endif /* __PREFS_SUMMARY_COLUMN_H__ */
diff --git a/src/summaryview.c b/src/summaryview.c
index 9ca43108..6c653b3b 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -421,6 +421,7 @@ static FolderSortKey col_to_sort_key[] = {
SORT_BY_DATE,
SORT_BY_SIZE,
SORT_BY_NUMBER,
+ SORT_BY_TO
};
static const struct {
@@ -776,6 +777,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
gboolean moved;
gboolean selection_done = FALSE;
gboolean do_qsearch = FALSE;
+ gboolean set_column_order_required = FALSE;
const gchar *key = NULL;
if (summary_is_locked(summaryview)) return FALSE;
@@ -825,6 +827,10 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
} else
summary_write_cache(summaryview);
+ if (FOLDER_ITEM_IS_SENT_FOLDER(summaryview->folder_item) !=
+ FOLDER_ITEM_IS_SENT_FOLDER(item))
+ set_column_order_required = TRUE;
+
folderview_set_opened_item(summaryview->folderview, item);
summary_clear_list_full(summaryview, is_refresh);
@@ -840,6 +846,8 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
summaryview->folder_item = item;
if (item)
item->qsearch_cond_type = QS_ALL;
+ if (set_column_order_required)
+ summary_set_column_order(summaryview);
summary_unlock(summaryview);
inc_unlock();
return TRUE;
@@ -850,6 +858,8 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
messageview_clear(summaryview->messageview);
summaryview->folder_item = item;
+ if (set_column_order_required)
+ summary_set_column_order(summaryview);
g_signal_handlers_block_matched(G_OBJECT(treeview),
(GSignalMatchType)G_SIGNAL_MATCH_DATA,
@@ -1308,10 +1318,7 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
main_window_set_menu_sensitive(summaryview->mainwin);
- if (summaryview->folder_item &&
- (summaryview->folder_item->stype == F_OUTBOX ||
- summaryview->folder_item->stype == F_DRAFT ||
- summaryview->folder_item->stype == F_QUEUE)) {
+ if (FOLDER_ITEM_IS_SENT_FOLDER(summaryview->folder_item)) {
gtk_widget_show(summaryview->reedit_menuitem);
gtk_widget_show(summaryview->reedit_separator);
menu_set_sensitive(ifactory, "/Re-edit", sens);
@@ -2385,11 +2392,11 @@ static void summary_set_row(SummaryView *summaryview, GtkTreeIter *iter,
S_COL_DATE, date_s,
S_COL_SIZE, to_human_readable(msginfo->size),
S_COL_NUMBER, msginfo->msgnum,
+ S_COL_TO, msginfo->to ? msginfo->to : "",
S_COL_MSG_INFO, msginfo,
S_COL_LABEL, color_val,
- S_COL_TO, NULL,
S_COL_FOREGROUND, foreground,
S_COL_BOLD, weight,
@@ -2801,9 +2808,7 @@ static void summary_activate_selected(SummaryView *summaryview)
if (!summaryview->folder_item)
return;
- if (summaryview->folder_item->stype == F_OUTBOX ||
- summaryview->folder_item->stype == F_DRAFT ||
- summaryview->folder_item->stype == F_QUEUE)
+ if (FOLDER_ITEM_IS_SENT_FOLDER(summaryview->folder_item))
summary_reedit(summaryview);
else
summary_open_msg(summaryview);
@@ -2836,10 +2841,7 @@ void summary_reedit(SummaryView *summaryview)
MsgInfo *msginfo;
if (!summaryview->selected) return;
- if (!summaryview->folder_item) return;
- if (summaryview->folder_item->stype != F_OUTBOX &&
- summaryview->folder_item->stype != F_DRAFT &&
- summaryview->folder_item->stype != F_QUEUE) return;
+ if (!FOLDER_ITEM_IS_SENT_FOLDER(summaryview->folder_item)) return;
if (gtkut_tree_row_reference_get_iter
(GTK_TREE_MODEL(summaryview->store),
@@ -5083,10 +5085,13 @@ static GtkWidget *summary_tree_view_create(SummaryView *summaryview)
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_UINT,
+ G_TYPE_STRING,
+
G_TYPE_POINTER,
+
G_TYPE_INT,
G_TYPE_UINT,
- G_TYPE_POINTER,
+
GDK_TYPE_COLOR,
G_TYPE_INT);
@@ -5102,9 +5107,9 @@ static GtkWidget *summary_tree_view_create(SummaryView *summaryview)
SET_SORT(S_COL_DATE, summary_cmp_by_date);
SET_SORT(S_COL_SIZE, summary_cmp_by_size);
SET_SORT(S_COL_NUMBER, summary_cmp_by_num);
+ SET_SORT(S_COL_TO, summary_cmp_by_to);
SET_SORT(S_COL_LABEL, summary_cmp_by_label);
SET_SORT(S_COL_TDATE, summary_cmp_by_thread_date);
- SET_SORT(S_COL_TO, summary_cmp_by_to);
#undef SET_SORT
@@ -5183,6 +5188,8 @@ static GtkWidget *summary_tree_view_create(SummaryView *summaryview)
prefs_common.summary_col_size[S_COL_SIZE], 1.0);
ADD_COLUMN(_("No."), text, S_COL_NUMBER, TRUE,
prefs_common.summary_col_size[S_COL_NUMBER], 1.0);
+ ADD_COLUMN(_("To"), text, S_COL_TO, TRUE,
+ prefs_common.summary_col_size[S_COL_TO], 0.0);
#undef ADD_COLUMN
@@ -5231,7 +5238,8 @@ void summary_set_column_order(SummaryView *summaryview)
g_signal_handlers_block_by_func(summaryview->treeview,
summary_columns_changed, summaryview);
- col_state = prefs_summary_column_get_config();
+ col_state = prefs_summary_column_get_config
+ (FOLDER_ITEM_IS_SENT_FOLDER(summaryview->folder_item));
for (pos = 0; pos < N_SUMMARY_VISIBLE_COLS; pos++) {
summaryview->col_state[pos] = col_state[pos];
@@ -5285,7 +5293,9 @@ void summary_get_column_order(SummaryView *summaryview)
pos, type, visible);
}
- prefs_summary_column_set_config(summaryview->col_state);
+ prefs_summary_column_set_config
+ (summaryview->col_state,
+ FOLDER_ITEM_IS_SENT_FOLDER(summaryview->folder_item));
g_list_free(columns);
}