sync with sylpheed 0.6.4 release
authorPaul Mangan <paul@claws-mail.org>
Mon, 22 Oct 2001 08:42:36 +0000 (08:42 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 22 Oct 2001 08:42:36 +0000 (08:42 +0000)
16 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
INSTALL
INSTALL.jp
NEWS
configure.in
src/Makefile.am
src/mainwindow.c
src/mainwindow.h
src/prefs_common.c
src/prefs_common.h
src/prefs_summary_column.c [new file with mode: 0644]
src/prefs_summary_column.h [new file with mode: 0644]
src/summaryview.c
src/summaryview.h

index 202ada0..12d4fa7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2001-10-21
+
+       * version 0.6.4
+
+2001-10-21
+
+       * src/prefs_summary_column.[ch]:
+         made prefs_summary_column_get_config() public.
+       * src/summaryview.c: summary_ctree_create(): some code cleanup.
+       * configure.in: moved the position of SSL checking after LDAP
+         for linking problem.
+
+2001-10-21
+
+       * src/mainwindow.c
+         src/summaryview.c: allowed reedit in the outbox.
+       * src/prefs_summary_column.[ch]: new. UI for setting summary
+         columns.
+       * src/mainwindow.[ch]: main_window_set_summary_column(): new.
+         It calls summary_set_column_order().
+       * src/summaryview.[ch]:
+         summary_ctree_create(): new. separated from summary_create().
+         summary_set_column_order(): new. It destroys the current
+         CTree and replaces it with the new one.
+
 2001-10-19
 
        * src/smtp.[ch]: smtp_from(): abort if auth failed.
index 9575878..83018c9 100644 (file)
@@ -1,3 +1,11 @@
+2001-10-22 [paul]      0.6.4claws1
+
+       * sync with sylpheed 0.6.4 release
+               see ChangeLog entries 2001-10-21
+
+       * po/fr.po, po/pt_BR.po
+               updated by Melvin Hadasht and Fabio Junior Beneditto
+
 2001-10-21 [paul]      0.6.3claws30
 
        * src/compose.c
index b1a69b8..9be2add 100644 (file)
@@ -1,3 +1,28 @@
+2001-10-21
+
+       * version 0.6.4
+
+2001-10-21
+
+       * src/prefs_summary_column.[ch]:
+         prefs_summary_column_get_config() ¤ò public ¤Ë¤·¤¿¡£
+       * src/summaryview.c: summary_ctree_create(): ¥³¡¼¥É¤ÎÀ°Íý¡£
+       * configure.in: ¥ê¥ó¥¯»þ¤ÎÌäÂê¤Î¤¿¤á¤Ë SSL ¤Î¥Á¥§¥Ã¥¯¤Î°ÌÃÖ¤ò
+         LDAP ¤Î¸å¤Ë°ÜÆ°¡£
+
+2001-10-21
+
+       * src/mainwindow.c
+         src/summaryview.c: Á÷¿®¹µ¤ÇºÆÊÔ½¸¤Ç¤­¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/prefs_summary_column.[ch]: ¿·µ¬¡£¥µ¥Þ¥ê¤Î¥«¥é¥à¤òÀßÄꤹ¤ë¤¿¤á
+         ¤Î UI ¡£
+       * src/mainwindow.[ch]: main_window_set_summary_column(): ¿·µ¬¡£
+         summary_set_column_order() ¤ò¸Æ¤Ö¡£
+       * src/summaryview.[ch]:
+         summary_ctree_create(): ¿·µ¬¡£summary_create() ¤«¤éʬΥ¡£
+         summary_set_column_order(): ¿·µ¬¡£¸½ºß¤Î CTree ¤òºï½ü¤·¡¢¿·¤¿¤Ê
+         CTree ¤ÇÃÖ¤­´¹¤¨¤ë¡£
+
 2001-10-19
 
        * src/smtp.[ch]: smtp_from(): Ç§¾Ú¤Ë¼ºÇÔ¤·¤¿¾ì¹çÃæÃǤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
diff --git a/INSTALL b/INSTALL
index 53c9471..556d9b4 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -35,6 +35,7 @@ o Linux2000G (Intel / PPC)
 o HOLON Linux 2.0 (Intel / PPC)
 o Linux for PPC Japanese Edition 2.0 (glibc 2.1.x)
 o Linux for PPC Japanese Edition 3.0 (glibc 2.1.x)
+o LinuxPPC Q4 2000 (glibc 2.1.x)
 o Linux MLD4
 o Linux MLD5
 o Plamo Linux 2.0
@@ -55,6 +56,7 @@ o Caldera Workstation 3.1
 o Conectiva Linux 4.0
 o Conectiva Linux 5.0
 o Vector Linux 1.5
+o Yellow Dog Linux 2.0 (glibc 2.2.1)
 o FreeBSD 3.2-RELEASE
 o FreeBSD 3.4-RELEASE
 o FreeBSD 4.0-RELEASE
index 7adcbce..20d88a7 100644 (file)
@@ -34,6 +34,7 @@ o Linux2000G (Intel / PPC)
 o HOLON Linux 2.0 (Intel / PPC)
 o Linux for PPC Japanese Edition 2.0 (glibc 2.1.x)
 o Linux for PPC Japanese Edition 3.0 (glibc 2.1.x)
+o LinuxPPC Q4 2000 (glibc 2.1.x)
 o Linux MLD4
 o Linux MLD5
 o Plamo Linux 2.0
@@ -54,6 +55,7 @@ o Caldera Workstation 3.1
 o Conectiva Linux 4.0
 o Conectiva Linux 5.0
 o Vector Linux 1.5
+o Yellow Dog Linux 2.0 (glibc 2.2.1)
 o FreeBSD 3.2-RELEASE
 o FreeBSD 3.4-RELEASE
 o FreeBSD 4.0-RELEASE
diff --git a/NEWS b/NEWS
index 0ce4a0b..53df349 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,16 @@
 Changes of Sylpheed
 
+* 0.6.4
+
+    * The performance of summary display on large number of messages
+      has been improved.
+    * Columns of the summary view became reorderable.
+    * The default order of the summary view columns has been changed.
+    * Reedit has been enabled in the outbox.
+    * LDIF file import has been implemented.
+    * The crash bug of LDAP has been fixed.
+    * Some other bugs have been fixed.
+
 * 0.6.3
 
     * Message body text search has been implemented.
index 12d5415..497532a 100644 (file)
@@ -5,10 +5,10 @@ PACKAGE=sylpheed
 dnl version number
 MAJOR_VERSION=0
 MINOR_VERSION=6
-MICRO_VERSION=3
+MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws30
+EXTRA_VERSION=claws1
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
@@ -344,9 +344,9 @@ echo ""
 echo "gdk-pixbuf : $ac_cv_enable_gdk_pixbuf"
 echo "gdk_imlib  : $ac_cv_enable_imlib"
 echo "GPGME      : $ac_cv_enable_gpgme"
-echo "OpenSSL    : $ac_cv_enable_ssl"
 echo "JPilot     : $ac_cv_enable_jpilot"
 echo "LDAP       : $ac_cv_enable_ldap"
+echo "OpenSSL    : $ac_cv_enable_ssl"
 echo "compface   : $ac_cv_enable_compface"
 echo "libjconv   : $ac_cv_enable_jconv"
 echo "IPv6       : $ac_cv_enable_ipv6"
index eff1460..e83a5fd 100644 (file)
@@ -30,6 +30,7 @@ sylpheed_SOURCES = \
        prefs_account.c prefs_account.h \
        prefs_display_header.c prefs_display_header.h \
        prefs_customheader.c prefs_customheader.h \
+       prefs_summary_column.c prefs_summary_column.h \
        account.c account.h \
        displayheader.c displayheader.h \
        customheader.c customheader.h \
@@ -42,6 +43,8 @@ sylpheed_SOURCES = \
        addrindex.c addrindex.h \
        mgutils.c mgutils.h \
        vcard.c vcard.h \
+       ldif.c ldif.h \
+       importldif.c importldif.h \
        jpilot.c jpilot.h \
        syldap.c syldap.h \
        editbook.c editbook.h \
@@ -92,8 +95,6 @@ sylpheed_SOURCES = \
        imap.c imap.h \
        xml.c xml.h \
        html.c html.h \
-       ldif.c ldif.h \
-       importldif.c importldif.h \
        procmime.c procmime.h \
        rfc2015.c rfc2015.h \
        passphrase.c passphrase.h \
index 60bd2c4..408e991 100644 (file)
@@ -63,6 +63,7 @@
 #include "prefs_scoring.h"
 #include "prefs_account.h"
 #include "prefs_folder_item.h"
+#include "prefs_summary_column.h"
 #include "account.h"
 #include "addressbook.h"
 #include "headerwindow.h"
@@ -946,13 +947,23 @@ void main_window_reflect_prefs_all(void)
                else
                        gtk_widget_show(mainwin->exec_btn);
 
-               summary_change_display_item(mainwin->summaryview);
                summary_redisplay_msg(mainwin->summaryview);
                headerview_set_visibility(mainwin->messageview->headerview,
                                          prefs_common.display_header_pane);
        }
 }
 
+void main_window_set_summary_column(void)
+{
+       GList *cur;
+       MainWindow *mainwin;
+
+       for (cur = mainwin_list; cur != NULL; cur = cur->next) {
+               mainwin = (MainWindow *)cur->data;
+               summary_set_column_order(mainwin->summaryview);
+       }
+}
+
 void main_window_set_account_menu(GList *account_list)
 {
        GList *cur, *cur_ac, *cur_item;
@@ -1228,6 +1239,7 @@ static SensitiveCond main_window_get_current_state(MainWindow *mainwin)
 {
        SensitiveCond state = 0;
        SummarySelection selection;
+       FolderItem *item = mainwin->summaryview->folder_item;
 
        selection = summary_get_selection_type(mainwin->summaryview);
 
@@ -1235,8 +1247,8 @@ static SensitiveCond main_window_get_current_state(MainWindow *mainwin)
                state |= M_UNLOCKED;
        if (selection != SUMMARY_NONE)
                state |= M_MSG_EXIST;
-       if (mainwin->summaryview->folder_item) {
-               if (mainwin->summaryview->folder_item->threaded)
+       if (item) {
+               if (item->threaded)
                        state |= M_THREADED;
                else
                        state |= M_UNTHREADED;  
@@ -1246,17 +1258,15 @@ static SensitiveCond main_window_get_current_state(MainWindow *mainwin)
                state |= M_TARGET_EXIST;
        if (selection == SUMMARY_SELECTED_SINGLE)
                state |= M_SINGLE_TARGET_EXIST;
-       if (mainwin->summaryview->folder_item &&
-           mainwin->summaryview->folder_item->folder->type != F_NEWS)
+       if (item && item->folder->type != F_NEWS)
                state |= M_EXEC;
        if (mainwin->summaryview->folder_item &&
            mainwin->summaryview->folder_item->folder->type == F_NEWS)
                state |= M_NEWS;
        if (selection == SUMMARY_SELECTED_SINGLE &&
-           (mainwin->summaryview->folder_item &&
-            (mainwin->summaryview->folder_item->stype == F_DRAFT ||
-             mainwin->summaryview->folder_item->stype == F_OUTBOX ||
-             mainwin->summaryview->folder_item->stype == F_QUEUE)))
+           (item &&
+            (item->stype == F_OUTBOX || item->stype == F_DRAFT ||
+             item->stype == F_QUEUE)))
                state |= M_ALLOW_REEDIT;
        if (cur_account)
                state |= M_HAVE_ACCOUNT;
@@ -2568,7 +2578,7 @@ static void thread_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 static void set_display_item_cb(MainWindow *mainwin, guint action,
                                GtkWidget *widget)
 {
-       prefs_summary_display_item_set();
+       prefs_summary_column_open();
 }
 
 static void sort_summary_cb(MainWindow *mainwin, guint action,
index addd4f0..704592f 100644 (file)
@@ -143,6 +143,7 @@ void main_window_lock                       (MainWindow     *mainwin);
 void main_window_unlock                        (MainWindow     *mainwin);
 
 void main_window_reflect_prefs_all     (void);
+void main_window_set_summary_column    (void);
 void main_window_set_account_menu      (GList          *account_list);
 void main_window_separation_change     (MainWindow     *mainwin,
                                         SeparateType    type);
index 9c1c962..431cf9b 100644 (file)
@@ -38,6 +38,7 @@
 #include "prefs.h"
 #include "prefs_common.h"
 #include "prefs_display_header.h"
+#include "prefs_summary_column.h"
 #include "mainwindow.h"
 #include "summaryview.h"
 #include "messageview.h"
@@ -428,24 +429,62 @@ static PrefParam param[] = {
        {"show_statusbar", "TRUE", &prefs_common.show_statusbar, P_BOOL,
         NULL, NULL, NULL},
 
-       {"show_mark", "TRUE", &prefs_common.show_mark, P_BOOL,
-        NULL, NULL, NULL},
-       {"show_unread", "TRUE", &prefs_common.show_unread, P_BOOL,
-        NULL, NULL, NULL},
-       {"show_mime", "TRUE", &prefs_common.show_mime, P_BOOL,
-        NULL, NULL, NULL},
-       {"show_number", "FALSE", &prefs_common.show_number, P_BOOL,
-        NULL, NULL, NULL},
-       {"show_score", "TRUE", &prefs_common.show_score, P_BOOL,
-        NULL, NULL, NULL},
-       {"show_size", "FALSE", &prefs_common.show_size, P_BOOL,
-        NULL, NULL, NULL},
-       {"show_date", "TRUE", &prefs_common.show_date, P_BOOL,
-        NULL, NULL, NULL},
-       {"show_from", "TRUE", &prefs_common.show_from, P_BOOL,
-        NULL, NULL, NULL},
-       {"show_subject", "TRUE", &prefs_common.show_subject, P_BOOL,
-        NULL, NULL, NULL},
+       {"summary_col_show_mark", "TRUE",
+        &prefs_common.summary_col_visible[S_COL_MARK], P_BOOL, NULL, NULL, NULL},
+       {"summary_col_show_unread", "TRUE",
+        &prefs_common.summary_col_visible[S_COL_UNREAD], P_BOOL, NULL, NULL, NULL},
+       {"summary_col_show_mime", "TRUE",
+        &prefs_common.summary_col_visible[S_COL_MIME], P_BOOL, NULL, NULL, NULL},
+       {"summary_col_show_subject", "TRUE",
+        &prefs_common.summary_col_visible[S_COL_SUBJECT], P_BOOL, NULL, NULL, NULL},
+       {"summary_col_show_from", "TRUE",
+        &prefs_common.summary_col_visible[S_COL_FROM], P_BOOL, NULL, NULL, NULL},
+       {"summary_col_show_date", "TRUE",
+        &prefs_common.summary_col_visible[S_COL_DATE], P_BOOL, NULL, NULL, NULL},
+       {"summary_col_show_size", "TRUE",
+        &prefs_common.summary_col_visible[S_COL_SIZE], P_BOOL, NULL, NULL, NULL},
+       {"summary_col_show_number", "FALSE",
+        &prefs_common.summary_col_visible[S_COL_NUMBER], P_BOOL, NULL, NULL, NULL},
+       {"summary_col_show_score", "FALSE",
+        &prefs_common.summary_col_visible[S_COL_SCORE], P_BOOL, NULL, NULL, NULL},
+
+       {"summary_col_pos_mark", "0",
+         &prefs_common.summary_col_pos[S_COL_MARK], P_INT, NULL, NULL, NULL},
+       {"summary_col_pos_unread", "1",
+         &prefs_common.summary_col_pos[S_COL_UNREAD], P_INT, NULL, NULL, NULL},
+       {"summary_col_pos_mime", "2",
+         &prefs_common.summary_col_pos[S_COL_MIME], P_INT, NULL, NULL, NULL},
+       {"summary_col_pos_subject", "3",
+         &prefs_common.summary_col_pos[S_COL_SUBJECT], P_INT, NULL, NULL, NULL},
+       {"summary_col_pos_from", "4",
+         &prefs_common.summary_col_pos[S_COL_FROM], P_INT, NULL, NULL, NULL},
+       {"summary_col_pos_date", "5",
+         &prefs_common.summary_col_pos[S_COL_DATE], P_INT, NULL, NULL, NULL},
+       {"summary_col_pos_size", "6",
+         &prefs_common.summary_col_pos[S_COL_SIZE], P_INT, NULL, NULL, NULL},
+       {"summary_col_pos_number", "7",
+         &prefs_common.summary_col_pos[S_COL_NUMBER], P_INT, NULL, NULL, NULL},
+       {"summary_col_pos_score", "8",
+        &prefs_common.summary_col_pos[S_COL_SCORE], P_INT, NULL, NULL, NULL},
+
+       {"summary_col_size_mark", "10",
+        &prefs_common.summary_col_size[S_COL_MARK], P_INT, NULL, NULL, NULL},
+       {"summary_col_size_unread", "13",
+        &prefs_common.summary_col_size[S_COL_UNREAD], P_INT, NULL, NULL, NULL},
+       {"summary_col_size_mime", "10",
+        &prefs_common.summary_col_size[S_COL_MIME], P_INT, NULL, NULL, NULL},
+       {"summary_col_size_subject", "200",
+        &prefs_common.summary_col_size[S_COL_SUBJECT], P_INT, NULL, NULL, NULL},
+       {"summary_col_size_from", "120",
+        &prefs_common.summary_col_size[S_COL_FROM], P_INT, NULL, NULL, NULL},
+       {"summary_col_size_date", "118",
+        &prefs_common.summary_col_size[S_COL_DATE], P_INT, NULL, NULL, NULL},
+       {"summary_col_size_size", "45",
+        &prefs_common.summary_col_size[S_COL_SIZE], P_INT, NULL, NULL, NULL},
+       {"summary_col_size_number", "40",
+        &prefs_common.summary_col_size[S_COL_NUMBER], P_INT, NULL, NULL, NULL},
+       {"summary_col_size_score", "40",
+        &prefs_common.summary_col_size[S_COL_SCORE], P_INT, NULL, NULL, NULL},
 
        /* Widget size */
        {"folderview_width", "179", &prefs_common.folderview_width, P_INT,
@@ -460,28 +499,12 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"folder_col_total", "32", &prefs_common.folder_col_total, P_INT,
         NULL, NULL, NULL},
+
        {"summaryview_width", "600", &prefs_common.summaryview_width, P_INT,
         NULL, NULL, NULL},
        {"summaryview_height", "173", &prefs_common.summaryview_height, P_INT,
         NULL, NULL, NULL},
-       {"summary_col_mark", "10", &prefs_common.summary_col_mark, P_INT,
-        NULL, NULL, NULL},
-       {"summary_col_unread", "13", &prefs_common.summary_col_unread, P_INT,
-        NULL, NULL, NULL},
-       {"summary_col_mime", "10", &prefs_common.summary_col_mime, P_INT,
-        NULL, NULL, NULL},
-       {"summary_col_number", "40", &prefs_common.summary_col_number, P_INT,
-        NULL, NULL, NULL},
-       {"summary_col_score", "40", &prefs_common.summary_col_score,
-        P_INT, NULL, NULL, NULL},
-       {"summary_col_size", "48", &prefs_common.summary_col_size, P_INT,
-        NULL, NULL, NULL},
-       {"summary_col_date", "120", &prefs_common.summary_col_date, P_INT,
-        NULL, NULL, NULL},
-       {"summary_col_from", "140", &prefs_common.summary_col_from, P_INT,
-        NULL, NULL, NULL},
-       {"summary_col_subject", "200", &prefs_common.summary_col_subject,
-        P_INT, NULL, NULL, NULL},
+
        {"mainview_x", "64", &prefs_common.mainview_x, P_INT,
         NULL, NULL, NULL},
        {"mainview_y", "64", &prefs_common.mainview_y, P_INT,
@@ -714,20 +737,6 @@ static void set_button_bg_color                    (GtkWidget      *widget,
 static void prefs_enable_message_color_toggled (void);
 static void prefs_recycle_colors_toggled       (GtkWidget      *widget);
 
-/* functions for setting items of SummaryView */
-static void prefs_summary_display_item_dialog_create
-                                       (gboolean       *cancelled);
-static void display_item_ok            (GtkWidget      *widget,
-                                        gboolean       *cancelled);
-static void display_item_cancel                (GtkWidget      *widget,
-                                        gboolean       *cancelled);
-static gint display_item_delete_event  (GtkWidget      *widget,
-                                        GdkEventAny    *event,
-                                        gboolean       *cancelled);
-static void display_item_key_pressed   (GtkWidget      *widget,
-                                        GdkEventKey    *event,
-                                        gboolean       *cancelled);
-
 static void prefs_font_select  (GtkButton *button, GtkEntry *entry);
 
 static void prefs_font_selection_key_pressed   (GtkWidget      *widget,
@@ -1736,7 +1745,7 @@ static void prefs_display_create(void)
        gtk_widget_show (button_dispitem);
        gtk_box_pack_start (GTK_BOX (hbox1), button_dispitem, FALSE, TRUE, 0);
        gtk_signal_connect (GTK_OBJECT (button_dispitem), "clicked",
-                           GTK_SIGNAL_FUNC (prefs_summary_display_item_set),
+                           GTK_SIGNAL_FUNC (prefs_summary_column_open),
                            NULL);
 
        display.entry_textfont  = entry_textfont;
@@ -3022,163 +3031,6 @@ static void prefs_quote_description_create(void)
        gtk_widget_show_all(vbox);
 }
 
-/* functions for setting items of SummaryView */
-
-static struct _SummaryDisplayItem
-{
-       GtkWidget *window;
-
-       GtkWidget *chkbtn[N_SUMMARY_COLS];
-
-       GtkWidget *ok_btn;
-       GtkWidget *cancel_btn;
-} summarydispitem;
-
-#define SET_ACTIVE(column, var) \
-       gtk_toggle_button_set_active \
-               (GTK_TOGGLE_BUTTON(summarydispitem.chkbtn[column]), \
-                prefs_common.var)
-#define GET_ACTIVE(column, var) \
-       prefs_common.var = gtk_toggle_button_get_active \
-               (GTK_TOGGLE_BUTTON(summarydispitem.chkbtn[column]))
-
-void prefs_summary_display_item_set(void)
-{
-       static gboolean cancelled;
-
-       if (!summarydispitem.window)
-               prefs_summary_display_item_dialog_create(&cancelled);
-       gtk_widget_grab_focus(summarydispitem.ok_btn);
-       gtk_widget_show(summarydispitem.window);
-       manage_window_set_transient(GTK_WINDOW(summarydispitem.window));
-
-       SET_ACTIVE(S_COL_MARK, show_mark);
-       SET_ACTIVE(S_COL_UNREAD, show_unread);
-       SET_ACTIVE(S_COL_MIME, show_mime);
-       SET_ACTIVE(S_COL_NUMBER, show_number);
-       SET_ACTIVE(S_COL_SCORE, show_score);
-       SET_ACTIVE(S_COL_SIZE, show_size);
-       SET_ACTIVE(S_COL_DATE, show_date);
-       SET_ACTIVE(S_COL_FROM, show_from);
-       SET_ACTIVE(S_COL_SUBJECT, show_subject);
-
-       gtk_main();
-       gtk_widget_hide(summarydispitem.window);
-
-       if (cancelled != TRUE) {
-               GET_ACTIVE(S_COL_MARK, show_mark);
-               GET_ACTIVE(S_COL_UNREAD, show_unread);
-               GET_ACTIVE(S_COL_MIME, show_mime);
-               GET_ACTIVE(S_COL_NUMBER, show_number);
-               GET_ACTIVE(S_COL_SCORE, show_score);
-               GET_ACTIVE(S_COL_SIZE, show_size);
-               GET_ACTIVE(S_COL_DATE, show_date);
-               GET_ACTIVE(S_COL_FROM, show_from);
-               GET_ACTIVE(S_COL_SUBJECT, show_subject);
-
-               main_window_reflect_prefs_all();
-       }
-}
-
-#undef SET_ACTIVE
-#undef GET_ACTIVE
-
-#define SET_CHECK_BUTTON(column, label) \
-{ \
-       summarydispitem.chkbtn[column] = \
-               gtk_check_button_new_with_label(label); \
-       gtk_box_pack_start(GTK_BOX(chkbtn_vbox), \
-                          summarydispitem.chkbtn[column], \
-                          FALSE, FALSE, 0); \
-}
-
-static void prefs_summary_display_item_dialog_create(gboolean *cancelled)
-{
-       GtkWidget *window;
-       GtkWidget *vbox;
-       GtkWidget *chkbtn_vbox;
-       GtkWidget *hbbox;
-       GtkWidget *ok_btn;
-       GtkWidget *cancel_btn;
-
-       window = gtk_window_new(GTK_WINDOW_DIALOG);
-       gtk_container_set_border_width(GTK_CONTAINER(window), 8);
-       gtk_window_set_title(GTK_WINDOW(window), _("Set display item"));
-       gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
-       gtk_window_set_modal(GTK_WINDOW(window), TRUE);
-       gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
-       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
-                          GTK_SIGNAL_FUNC(display_item_delete_event),
-                          cancelled);
-       gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
-                          GTK_SIGNAL_FUNC(display_item_key_pressed),
-                          cancelled);
-
-       vbox = gtk_vbox_new(FALSE, 8);
-       gtk_container_add(GTK_CONTAINER(window), vbox);
-
-       chkbtn_vbox = gtk_vbox_new(FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(vbox), chkbtn_vbox, FALSE, FALSE, 0);
-
-       SET_CHECK_BUTTON(S_COL_MARK, _("Mark"));
-       SET_CHECK_BUTTON(S_COL_UNREAD, _("Unread"));
-       SET_CHECK_BUTTON(S_COL_MIME, _("MIME"));
-       SET_CHECK_BUTTON(S_COL_NUMBER, _("Number"));
-       SET_CHECK_BUTTON(S_COL_SCORE, _("Score"));
-       SET_CHECK_BUTTON(S_COL_SIZE, _("Size"));
-       SET_CHECK_BUTTON(S_COL_DATE, _("Date"));
-       SET_CHECK_BUTTON(S_COL_FROM, _("From"));
-       SET_CHECK_BUTTON(S_COL_SUBJECT, _("Subject"));
-
-       gtkut_button_set_create(&hbbox, &ok_btn, _("OK"),
-                               &cancel_btn, _("Cancel"), NULL, NULL);
-       gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
-       gtk_widget_grab_default(ok_btn);
-
-       gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
-                          GTK_SIGNAL_FUNC(display_item_ok), cancelled);
-       gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked",
-                          GTK_SIGNAL_FUNC(display_item_cancel), cancelled);
-
-       gtk_widget_show_all(vbox);
-
-       summarydispitem.window = window;
-       summarydispitem.ok_btn = ok_btn;
-       summarydispitem.cancel_btn = cancel_btn;
-}
-
-#undef SET_CHECK_BUTTON
-
-static void display_item_ok(GtkWidget *widget, gboolean *cancelled)
-{
-       *cancelled = FALSE;
-       gtk_main_quit();
-}
-
-static void display_item_cancel(GtkWidget *widget, gboolean *cancelled)
-{
-       *cancelled = TRUE;
-       gtk_main_quit();
-}
-
-static gint display_item_delete_event(GtkWidget *widget, GdkEventAny *event,
-                                     gboolean *cancelled)
-{
-       *cancelled = TRUE;
-       gtk_main_quit();
-
-       return TRUE;
-}
-
-static void display_item_key_pressed(GtkWidget *widget, GdkEventKey *event,
-                                    gboolean *cancelled)
-{
-       if (event && event->keyval == GDK_Escape) {
-               *cancelled = TRUE;
-               gtk_main_quit();
-       }
-}
-
 static void prefs_font_select(GtkButton *button, GtkEntry *entry)
 {
        gchar *font_name;
index c1766e6..edf80c2 100644 (file)
@@ -27,6 +27,7 @@
 #include <glib.h>
 
 #include "mainwindow.h"
+#include "summaryview.h"
 #include "codeconv.h"
 #include "textview.h"
 
@@ -116,15 +117,10 @@ struct _PrefsCommon
        gint kill_score;
        gint important_score;
 
-       gboolean show_mark;
-       gboolean show_unread;
-       gboolean show_mime;
-       gboolean show_number;
-       gboolean show_score;
-       gboolean show_size;
-       gboolean show_date;
-       gboolean show_from;
-       gboolean show_subject;
+       /* Summary columns visibility, position and size */
+       gboolean summary_col_visible[N_SUMMARY_COLS];
+       gint summary_col_pos[N_SUMMARY_COLS];
+       gint summary_col_size[N_SUMMARY_COLS];
 
        /* Widget size */
        gint folderview_x;
@@ -138,15 +134,6 @@ struct _PrefsCommon
 
        gint summaryview_width;
        gint summaryview_height;
-       gint summary_col_mark;
-       gint summary_col_unread;
-       gint summary_col_mime;
-       gint summary_col_number;
-       gint summary_col_size;
-       gint summary_col_date;
-       gint summary_col_from;
-       gint summary_col_subject;
-       gint summary_col_score;
 
        gint mainview_x;
        gint mainview_y;
diff --git a/src/prefs_summary_column.c b/src/prefs_summary_column.c
new file mode 100644 (file)
index 0000000..100004d
--- /dev/null
@@ -0,0 +1,541 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2001 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "defs.h"
+
+#include <glib.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtkwindow.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtkclist.h>
+#include <gtk/gtkbutton.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "intl.h"
+#include "prefs.h"
+#include "prefs_common.h"
+#include "prefs_summary_column.h"
+#include "manage_window.h"
+#include "summaryview.h"
+#include "mainwindow.h"
+#include "inc.h"
+#include "gtkutils.h"
+#include "utils.h"
+
+static struct _SummaryColumnDialog
+{
+       GtkWidget *window;
+
+       GtkWidget *stock_clist;
+       GtkWidget *shown_clist;
+
+       GtkWidget *add_btn;
+       GtkWidget *remove_btn;
+       GtkWidget *up_btn;
+       GtkWidget *down_btn;
+
+       GtkWidget *default_btn;
+
+       GtkWidget *ok_btn;
+       GtkWidget *cancel_btn;
+
+       gboolean finished;
+} summary_col;
+
+static const gchar *const col_name[N_SUMMARY_COLS] = {
+       N_("Mark"),             /* S_COL_MARK    */
+       N_("Unread"),           /* S_COL_UNREAD  */
+       N_("Attachment"),       /* S_COL_MIME    */
+       N_("Subject"),          /* S_COL_SUBJECT */
+       N_("From"),             /* S_COL_FROM    */
+       N_("Date"),             /* S_COL_DATE    */
+       N_("Size"),             /* S_COL_SIZE    */
+       N_("Number"),           /* S_COL_NUMBER  */
+        N_("Score")            /* S_COL_SCORE   */
+};
+
+static SummaryColumnState default_state[N_SUMMARY_COLS] = {
+       { S_COL_MARK   , TRUE  },
+       { S_COL_UNREAD , TRUE  },
+       { S_COL_MIME   , TRUE  },
+       { S_COL_SUBJECT, TRUE  },
+       { S_COL_FROM   , TRUE  },
+       { S_COL_DATE   , TRUE  },
+       { S_COL_SIZE   , TRUE  },
+       { S_COL_NUMBER , FALSE },
+        { S_COL_SCORE  , FALSE }
+};
+
+static void prefs_summary_column_create        (void);
+
+static void prefs_summary_column_set_dialog    (SummaryColumnState *state);
+static void prefs_summary_column_set_view      (void);
+
+/* callback functions */
+static void prefs_summary_column_add   (void);
+static void prefs_summary_column_remove        (void);
+
+static void prefs_summary_column_up    (void);
+static void prefs_summary_column_down  (void);
+
+static void prefs_summary_column_set_to_default        (void);
+
+static void prefs_summary_column_ok    (void);
+static void prefs_summary_column_cancel        (void);
+
+static gint prefs_summary_column_delete_event  (GtkWidget      *widget,
+                                                GdkEventAny    *event,
+                                                gpointer        data);
+static void prefs_summary_column_key_pressed   (GtkWidget      *widget,
+                                                GdkEventKey    *event,
+                                                gpointer        data);
+
+void prefs_summary_column_open(void)
+{
+       inc_lock();
+
+       if (!summary_col.window)
+               prefs_summary_column_create();
+
+       manage_window_set_transient(GTK_WINDOW(summary_col.window));
+       gtk_widget_grab_focus(summary_col.ok_btn);
+
+       prefs_summary_column_set_dialog(NULL);
+
+       gtk_widget_show(summary_col.window);
+
+       summary_col.finished = FALSE;
+       while (summary_col.finished == FALSE)
+               gtk_main_iteration();
+
+       gtk_widget_hide(summary_col.window);
+
+       inc_unlock();
+}
+
+static void prefs_summary_column_create(void)
+{
+       GtkWidget *window;
+       GtkWidget *vbox;
+
+       GtkWidget *label_hbox;
+       GtkWidget *label;
+
+       GtkWidget *vbox1;
+
+       GtkWidget *hbox1;
+       GtkWidget *clist_hbox;
+       GtkWidget *scrolledwin;
+       GtkWidget *stock_clist;
+       GtkWidget *shown_clist;
+
+       GtkWidget *btn_vbox;
+       GtkWidget *btn_vbox1;
+       GtkWidget *add_btn;
+       GtkWidget *remove_btn;
+       GtkWidget *up_btn;
+       GtkWidget *down_btn;
+
+       GtkWidget *btn_hbox;
+       GtkWidget *default_btn;
+       GtkWidget *confirm_area;
+       GtkWidget *ok_btn;
+       GtkWidget *cancel_btn;
+
+       gchar *title[1];
+
+       debug_print(_("Creating summary column setting window...\n"));
+
+       window = gtk_window_new(GTK_WINDOW_DIALOG);
+       gtk_container_set_border_width(GTK_CONTAINER(window), 8);
+       gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+       gtk_window_set_modal(GTK_WINDOW(window), TRUE);
+       gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
+       gtk_window_set_title(GTK_WINDOW(window),
+                            _("Summary display item setting"));
+       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
+                          GTK_SIGNAL_FUNC(prefs_summary_column_delete_event),
+                          NULL);
+       gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
+                          GTK_SIGNAL_FUNC(prefs_summary_column_key_pressed),
+                          NULL);
+
+       vbox = gtk_vbox_new(FALSE, 6);
+       gtk_widget_show(vbox);
+       gtk_container_add(GTK_CONTAINER(window), vbox);
+
+       label_hbox = gtk_hbox_new(FALSE, 0);
+       gtk_widget_show(label_hbox);
+       gtk_box_pack_start(GTK_BOX(vbox), label_hbox, FALSE, FALSE, 4);
+
+       label = gtk_label_new
+               (_("Select items to be displayed on the summary view.\n"
+                  "You can modify the order by Up / Down button, or dragging the items."));
+       gtk_widget_show(label);
+       gtk_box_pack_start(GTK_BOX(label_hbox), label, FALSE, FALSE, 4);
+       gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+
+       vbox1 = gtk_vbox_new(FALSE, VSPACING);
+       gtk_widget_show(vbox1);
+       gtk_box_pack_start(GTK_BOX(vbox), vbox1, TRUE, TRUE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(vbox1), 2);
+
+       hbox1 = gtk_hbox_new(FALSE, 8);
+       gtk_widget_show(hbox1);
+       gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, TRUE, 0);
+
+       clist_hbox = gtk_hbox_new(FALSE, 8);
+       gtk_widget_show(clist_hbox);
+       gtk_box_pack_start(GTK_BOX(hbox1), clist_hbox, TRUE, TRUE, 0);
+
+       scrolledwin = gtk_scrolled_window_new(NULL, NULL);
+       gtk_widget_set_usize(scrolledwin, 180, 210);
+       gtk_widget_show(scrolledwin);
+       gtk_box_pack_start(GTK_BOX(clist_hbox), scrolledwin, TRUE, TRUE, 0);
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
+                                      GTK_POLICY_AUTOMATIC,
+                                      GTK_POLICY_AUTOMATIC);
+
+       title[0] = _("Available items");
+       stock_clist = gtk_clist_new_with_titles(1, title);
+       gtk_widget_show(stock_clist);
+       gtk_container_add(GTK_CONTAINER(scrolledwin), stock_clist);
+       gtk_clist_set_selection_mode(GTK_CLIST(stock_clist),
+                                    GTK_SELECTION_BROWSE);
+       GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(stock_clist)->column[0].button,
+                              GTK_CAN_FOCUS);
+
+       /* add/remove button */
+       btn_vbox = gtk_vbox_new(FALSE, 0);
+       gtk_widget_show(btn_vbox);
+       gtk_box_pack_start(GTK_BOX(hbox1), btn_vbox, FALSE, FALSE, 0);
+
+       btn_vbox1 = gtk_vbox_new(FALSE, 8);
+       gtk_widget_show(btn_vbox1);
+       gtk_box_pack_start(GTK_BOX(btn_vbox), btn_vbox1, TRUE, FALSE, 0);
+
+       add_btn = gtk_button_new_with_label(_("  ->  "));
+       gtk_widget_show(add_btn);
+       gtk_box_pack_start(GTK_BOX(btn_vbox1), add_btn, FALSE, FALSE, 0);
+
+       remove_btn = gtk_button_new_with_label(_("  <-  "));
+       gtk_widget_show(remove_btn);
+       gtk_box_pack_start(GTK_BOX(btn_vbox1), remove_btn, FALSE, FALSE, 0);
+
+       gtk_signal_connect(GTK_OBJECT(add_btn), "clicked",
+                          GTK_SIGNAL_FUNC(prefs_summary_column_add), NULL);
+       gtk_signal_connect(GTK_OBJECT(remove_btn), "clicked",
+                          GTK_SIGNAL_FUNC(prefs_summary_column_remove), NULL);
+
+       clist_hbox = gtk_hbox_new(FALSE, 8);
+       gtk_widget_show(clist_hbox);
+       gtk_box_pack_start(GTK_BOX(hbox1), clist_hbox, TRUE, TRUE, 0);
+
+       scrolledwin = gtk_scrolled_window_new(NULL, NULL);
+       gtk_widget_set_usize(scrolledwin, 180, 210);
+       gtk_widget_show(scrolledwin);
+       gtk_box_pack_start(GTK_BOX(clist_hbox), scrolledwin, TRUE, TRUE, 0);
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
+                                      GTK_POLICY_AUTOMATIC,
+                                      GTK_POLICY_AUTOMATIC);
+
+       title[0] = _("Displayed items");
+       shown_clist = gtk_clist_new_with_titles(1, title);
+       gtk_widget_show(shown_clist);
+       gtk_container_add(GTK_CONTAINER(scrolledwin), shown_clist);
+       gtk_clist_set_selection_mode(GTK_CLIST(shown_clist),
+                                    GTK_SELECTION_BROWSE);
+       gtk_clist_set_reorderable(GTK_CLIST(shown_clist), TRUE);
+       gtk_clist_set_use_drag_icons(GTK_CLIST(shown_clist), FALSE);
+       GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(shown_clist)->column[0].button,
+                              GTK_CAN_FOCUS);
+
+       /* up/down button */
+       btn_vbox = gtk_vbox_new(FALSE, 0);
+       gtk_widget_show(btn_vbox);
+       gtk_box_pack_start(GTK_BOX(hbox1), btn_vbox, FALSE, FALSE, 0);
+
+       btn_vbox1 = gtk_vbox_new(FALSE, 8);
+       gtk_widget_show(btn_vbox1);
+       gtk_box_pack_start(GTK_BOX(btn_vbox), btn_vbox1, TRUE, FALSE, 0);
+
+       up_btn = gtk_button_new_with_label(_("Up"));
+       gtk_widget_show(up_btn);
+       gtk_box_pack_start(GTK_BOX(btn_vbox1), up_btn, FALSE, FALSE, 0);
+
+       down_btn = gtk_button_new_with_label(_("Down"));
+       gtk_widget_show(down_btn);
+       gtk_box_pack_start(GTK_BOX(btn_vbox1), down_btn, FALSE, FALSE, 0);
+
+       gtk_signal_connect(GTK_OBJECT(up_btn), "clicked",
+                          GTK_SIGNAL_FUNC(prefs_summary_column_up), NULL);
+       gtk_signal_connect(GTK_OBJECT(down_btn), "clicked",
+                          GTK_SIGNAL_FUNC(prefs_summary_column_down), NULL);
+
+       btn_hbox = gtk_hbox_new(FALSE, 8);
+       gtk_widget_show(btn_hbox);
+       gtk_box_pack_end(GTK_BOX(vbox), btn_hbox, FALSE, FALSE, 0);
+
+       btn_vbox = gtk_vbox_new(FALSE, 0);
+       gtk_widget_show(btn_vbox);
+       gtk_box_pack_start(GTK_BOX(btn_hbox), btn_vbox, FALSE, FALSE, 0);
+
+       default_btn = gtk_button_new_with_label(_(" Revert to default "));
+       gtk_widget_show(default_btn);
+       gtk_box_pack_start(GTK_BOX(btn_vbox), default_btn, TRUE, FALSE, 0);
+       gtk_signal_connect(GTK_OBJECT(default_btn), "clicked",
+                          GTK_SIGNAL_FUNC(prefs_summary_column_set_to_default),
+                          NULL);
+
+       gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
+                               &cancel_btn, _("Cancel"), NULL, NULL);
+       gtk_widget_show(confirm_area);
+       gtk_box_pack_end(GTK_BOX(btn_hbox), confirm_area, FALSE, FALSE, 0);
+       gtk_widget_grab_default(ok_btn);
+
+       gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
+                          GTK_SIGNAL_FUNC(prefs_summary_column_ok), NULL);
+       gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked",
+                          GTK_SIGNAL_FUNC(prefs_summary_column_cancel), NULL);
+
+       summary_col.window      = window;
+       summary_col.stock_clist = stock_clist;
+       summary_col.shown_clist = shown_clist;
+       summary_col.add_btn     = add_btn;
+       summary_col.remove_btn  = remove_btn;
+       summary_col.up_btn      = up_btn;
+       summary_col.down_btn    = down_btn;
+       summary_col.ok_btn      = ok_btn;
+       summary_col.cancel_btn  = cancel_btn;
+}
+
+SummaryColumnState *prefs_summary_column_get_config(void)
+{
+       static SummaryColumnState state[N_SUMMARY_COLS];
+       SummaryColumnType type;
+       gint pos;
+
+       for (pos = 0; pos < N_SUMMARY_COLS; pos++)
+               state[pos].type = -1;
+
+       for (type = 0; type < N_SUMMARY_COLS; type++) {
+               pos = prefs_common.summary_col_pos[type];
+               if (pos < 0 || pos >= N_SUMMARY_COLS ||
+                   state[pos].type != -1) {
+                       g_warning("Wrong column position\n");
+                       prefs_summary_column_set_config(default_state);
+                       return default_state;
+               }
+
+               state[pos].type = type;
+               state[pos].visible = prefs_common.summary_col_visible[type];
+       }
+
+       return state;
+}
+
+void prefs_summary_column_set_config(SummaryColumnState *state)
+{
+       SummaryColumnType type;
+       gint pos;
+
+       for (pos = 0; pos < N_SUMMARY_COLS; pos++) {
+               type = state[pos].type;
+               prefs_common.summary_col_visible[type] = state[pos].visible;
+               prefs_common.summary_col_pos[type] = pos;
+       }
+}
+
+static void prefs_summary_column_set_dialog(SummaryColumnState *state)
+{
+       GtkCList *stock_clist = GTK_CLIST(summary_col.stock_clist);
+       GtkCList *shown_clist = GTK_CLIST(summary_col.shown_clist);
+       gint pos;
+       SummaryColumnType type;
+       gchar *name;
+
+       gtk_clist_clear(stock_clist);
+       gtk_clist_clear(shown_clist);
+
+       if (!state)
+               state = prefs_summary_column_get_config();
+
+       for (pos = 0; pos < N_SUMMARY_COLS; pos++) {
+               gint row;
+               type = state[pos].type;
+               name = gettext(col_name[type]);
+
+               if (state[pos].visible) {
+                       row = gtk_clist_append(shown_clist, (gchar **)&name);
+                       gtk_clist_set_row_data(shown_clist, row,
+                                              GINT_TO_POINTER(type));
+               } else {
+                       row = gtk_clist_append(stock_clist, (gchar **)&name);
+                       gtk_clist_set_row_data(stock_clist, row,
+                                              GINT_TO_POINTER(type));
+               }
+       }
+}
+
+static void prefs_summary_column_set_view(void)
+{
+       GtkCList *stock_clist = GTK_CLIST(summary_col.stock_clist);
+       GtkCList *shown_clist = GTK_CLIST(summary_col.shown_clist);
+       SummaryColumnState state[N_SUMMARY_COLS];
+       SummaryColumnType type;
+       gint row, pos = 0;
+
+       g_return_if_fail
+               (stock_clist->rows + shown_clist->rows == N_SUMMARY_COLS);
+
+       for (row = 0; row < stock_clist->rows; row++) {
+               type = GPOINTER_TO_INT
+                       (gtk_clist_get_row_data(stock_clist, row));
+               state[row].type = type;
+               state[row].visible = FALSE;
+       }
+
+       pos = row;
+       for (row = 0; row < shown_clist->rows; row++) {
+               type = GPOINTER_TO_INT
+                       (gtk_clist_get_row_data(shown_clist, row));
+               state[pos + row].type = type;
+               state[pos + row].visible = TRUE;
+       }
+
+       prefs_summary_column_set_config(state);
+       main_window_set_summary_column();
+}
+
+static void prefs_summary_column_add(void)
+{
+       GtkCList *stock_clist = GTK_CLIST(summary_col.stock_clist);
+       GtkCList *shown_clist = GTK_CLIST(summary_col.shown_clist);
+       gint row;
+       SummaryColumnType type;
+       gchar *name;
+
+       if (!stock_clist->selection) return;
+
+       row = GPOINTER_TO_INT(stock_clist->selection->data);
+       type = GPOINTER_TO_INT(gtk_clist_get_row_data(stock_clist, row));
+       gtk_clist_remove(stock_clist, row);
+       if (stock_clist->rows == row)
+               gtk_clist_select_row(stock_clist, row - 1, -1);
+
+       if (!shown_clist->selection)
+               row = 0;
+       else
+               row = GPOINTER_TO_INT(shown_clist->selection->data) + 1;
+
+       name = gettext(col_name[type]);
+       row = gtk_clist_insert(shown_clist, row, (gchar **)&name);
+       gtk_clist_set_row_data(shown_clist, row, GINT_TO_POINTER(type));
+       gtk_clist_select_row(shown_clist, row, -1);
+}
+
+static void prefs_summary_column_remove(void)
+{
+       GtkCList *stock_clist = GTK_CLIST(summary_col.stock_clist);
+       GtkCList *shown_clist = GTK_CLIST(summary_col.shown_clist);
+       gint row;
+       SummaryColumnType type;
+       gchar *name;
+
+       if (!shown_clist->selection) return;
+
+       row = GPOINTER_TO_INT(shown_clist->selection->data);
+       type = GPOINTER_TO_INT(gtk_clist_get_row_data(shown_clist, row));
+       gtk_clist_remove(shown_clist, row);
+       if (shown_clist->rows == row)
+               gtk_clist_select_row(shown_clist, row - 1, -1);
+
+       if (!stock_clist->selection)
+               row = 0;
+       else
+               row = GPOINTER_TO_INT(stock_clist->selection->data) + 1;
+
+       name = gettext(col_name[type]);
+       row = gtk_clist_insert(stock_clist, row, (gchar **)&name);
+       gtk_clist_set_row_data(stock_clist, row, GINT_TO_POINTER(type));
+       gtk_clist_select_row(stock_clist, row, -1);
+}
+
+static void prefs_summary_column_up(void)
+{
+       GtkCList *clist = GTK_CLIST(summary_col.shown_clist);
+       gint row;
+
+       if (!clist->selection) return;
+
+       row = GPOINTER_TO_INT(clist->selection->data);
+       if (row > 0)
+               gtk_clist_row_move(clist, row, row - 1);
+}
+
+static void prefs_summary_column_down(void)
+{
+       GtkCList *clist = GTK_CLIST(summary_col.shown_clist);
+       gint row;
+
+       if (!clist->selection) return;
+
+       row = GPOINTER_TO_INT(clist->selection->data);
+       if (row >= 0 && row < clist->rows - 1)
+               gtk_clist_row_move(clist, row, row + 1);
+}
+
+static void prefs_summary_column_set_to_default(void)
+{
+       prefs_summary_column_set_dialog(default_state);
+}
+
+static void prefs_summary_column_ok(void)
+{
+       if (!summary_col.finished) {
+               summary_col.finished = TRUE;
+               prefs_summary_column_set_view();
+       }
+}
+
+static void prefs_summary_column_cancel(void)
+{
+       summary_col.finished = TRUE;
+}
+
+static gint prefs_summary_column_delete_event(GtkWidget *widget,
+                                             GdkEventAny *event,
+                                             gpointer data)
+{
+       summary_col.finished = TRUE;
+       return TRUE;
+}
+
+static void prefs_summary_column_key_pressed(GtkWidget *widget,
+                                            GdkEventKey *event,
+                                            gpointer data)
+{
+       if (event && event->keyval == GDK_Escape)
+               summary_col.finished = TRUE;
+}
diff --git a/src/prefs_summary_column.h b/src/prefs_summary_column.h
new file mode 100644 (file)
index 0000000..3ea9101
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2001 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PREFS_SUMMARY_COLUMN_H__
+#define __PREFS_SUMMARY_COLUMN_H__
+
+#include "summaryview.h"
+
+void prefs_summary_column_open(void);
+
+SummaryColumnState *prefs_summary_column_get_config(void);
+void prefs_summary_column_set_config(SummaryColumnState *state);
+
+#endif /* __PREFS_SUMMARY_COLUMN_H__ */
index 6769e22..906b308 100644 (file)
@@ -60,6 +60,7 @@
 #include "headerwindow.h"
 #include "sourcewindow.h"
 #include "prefs_common.h"
+#include "prefs_summary_column.h"
 #include "account.h"
 #include "compose.h"
 #include "utils.h"
@@ -234,8 +235,8 @@ static void summary_execute_delete_func     (GtkCTree               *ctree,
                                         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,
@@ -254,6 +255,8 @@ static void summary_colorlabel_menu_item_activate_item_cb
                                           gpointer      data);
 static void summary_colorlabel_menu_create(SummaryView *summaryview);
 
+static GtkWidget *summary_ctree_create (SummaryView    *summaryview);
+
 /* callback functions */
 static void summary_toggle_pressed     (GtkWidget              *eventbox,
                                         GdkEventButton         *event,
@@ -315,6 +318,8 @@ static void summary_from_clicked    (GtkWidget              *button,
                                         SummaryView            *summaryview);
 static void summary_subject_clicked    (GtkWidget              *button,
                                         SummaryView            *summaryview);
+static void summary_score_clicked      (GtkWidget              *button,
+                                        SummaryView            *summaryview);
 
 static void summary_start_drag         (GtkWidget        *widget, 
                                         int button,
@@ -417,31 +422,17 @@ static const gchar *const col_label[N_SUMMARY_COLS] = {
        N_("M"),        /* S_COL_MARK    */
        N_("U"),        /* S_COL_UNREAD  */
        "",             /* S_COL_MIME    */
-       N_("No."),      /* S_COL_NUMBER  */
-       N_("Score"),    /* S_COL_SCORE   */
-       N_("Size"),     /* S_COL_SIZE    */
-       N_("Date"),     /* S_COL_DATE    */
+       N_("Subject"),  /* S_COL_SUBJECT */
        N_("From"),     /* S_COL_FROM    */
-       N_("Subject")   /* S_COL_SUBJECT */
+       N_("Date"),     /* S_COL_DATE    */
+       N_("Size"),     /* S_COL_SIZE    */
+       N_("No."),      /* S_COL_NUMBER  */
+       N_("Score")     /* S_COL_SCORE   */
 };
 
 SummaryView *summary_create(void)
 {
        SummaryView *summaryview;
-       SummaryColumnState *col_state;
-       gint *col_pos;
-       SummaryColumnType col_default[N_SUMMARY_COLS] = {
-               S_COL_MARK,
-               S_COL_UNREAD,
-               S_COL_MIME,
-               S_COL_NUMBER,
-               S_COL_SCORE,
-               S_COL_SIZE,
-               S_COL_DATE,
-               S_COL_FROM,
-               S_COL_SUBJECT
-       };
-       const gchar *titles[N_SUMMARY_COLS];
        GtkWidget *vbox;
        GtkWidget *scrolledwin;
        GtkWidget *ctree;
@@ -454,7 +445,6 @@ SummaryView *summary_create(void)
        GtkWidget *popupmenu;
        GtkItemFactory *popupfactory;
        gint n_entries;
-       gint i;
 
        debug_print(_("Creating summary view...\n"));
        summaryview = g_new0(SummaryView, 1);
@@ -470,105 +460,13 @@ SummaryView *summary_create(void)
                             prefs_common.summaryview_width,
                             prefs_common.summaryview_height);
 
-       col_state = summaryview->col_state;
-       col_pos = summaryview->col_pos;
-
-       for (i = 0; i < N_SUMMARY_COLS; i++) {
-               SummaryColumnType type;
-
-               type = col_state[i].type = col_default[i];
-               col_state[i].visible = TRUE;
-               col_pos[i] = i;
-               switch (type) {
-               case S_COL_SCORE:
-               case S_COL_SIZE:
-               case S_COL_NUMBER:
-               case S_COL_DATE:
-               case S_COL_FROM:
-               case S_COL_SUBJECT:
-                       if (prefs_common.trans_hdr)
-                               titles[i] = gettext(col_label[type]);
-                       else
-                               titles[i] = col_label[type];
-                       break;
-               default:
-                       titles[i] = gettext(col_label[type]);
-               }
-       }
+       ctree = summary_ctree_create(summaryview);
 
-       ctree = gtk_sctree_new_with_titles
-               (N_SUMMARY_COLS, col_pos[S_COL_SUBJECT], (gchar **)titles);
        gtk_scrolled_window_set_hadjustment(GTK_SCROLLED_WINDOW(scrolledwin),
                                            GTK_CLIST(ctree)->hadjustment);
        gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(scrolledwin),
                                            GTK_CLIST(ctree)->vadjustment);
        gtk_container_add(GTK_CONTAINER(scrolledwin), ctree);
-       gtk_clist_set_selection_mode(GTK_CLIST(ctree), GTK_SELECTION_EXTENDED);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_MARK],
-                                          GTK_JUSTIFY_CENTER);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_UNREAD],
-                                          GTK_JUSTIFY_CENTER);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_MIME],
-                                          GTK_JUSTIFY_CENTER);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_NUMBER],
-                                          GTK_JUSTIFY_RIGHT);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_SCORE],
-                                          GTK_JUSTIFY_RIGHT);
-       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_SIZE],
-                                          GTK_JUSTIFY_RIGHT);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_MARK],
-                                  SUMMARY_COL_MARK_WIDTH);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_UNREAD],
-                                  SUMMARY_COL_UNREAD_WIDTH);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_MIME],
-                                  SUMMARY_COL_MIME_WIDTH);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_NUMBER],
-                                  prefs_common.summary_col_number);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_SCORE],
-                                  prefs_common.summary_col_score);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_SIZE],
-                                  prefs_common.summary_col_size);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_DATE],
-                                  prefs_common.summary_col_date);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_FROM],
-                                  prefs_common.summary_col_from);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_SUBJECT],
-                                  prefs_common.summary_col_subject);
-       gtk_ctree_set_line_style(GTK_CTREE(ctree), GTK_CTREE_LINES_DOTTED);
-       gtk_ctree_set_expander_style(GTK_CTREE(ctree),
-                                    GTK_CTREE_EXPANDER_SQUARE);
-#if 0
-       gtk_ctree_set_line_style(GTK_CTREE(ctree), GTK_CTREE_LINES_NONE);
-       gtk_ctree_set_expander_style(GTK_CTREE(ctree),
-                                    GTK_CTREE_EXPANDER_TRIANGLE);
-#endif
-       gtk_ctree_set_indent(GTK_CTREE(ctree), 18);
-       gtk_object_set_user_data(GTK_OBJECT(ctree), summaryview);
-
-       /* don't let title buttons take key focus */
-       for (i = 0; i < N_SUMMARY_COLS; i++)
-               GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(ctree)->column[i].button,
-                                      GTK_CAN_FOCUS);
-
-       /* connect signal to the buttons for sorting */
-#define CLIST_BUTTON_SIGNAL_CONNECT(col, func) \
-       gtk_signal_connect \
-               (GTK_OBJECT(GTK_CLIST(ctree)->column[col_pos[col]].button), \
-                "clicked", \
-                GTK_SIGNAL_FUNC(func), \
-                summaryview)
-
-       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_MARK   , summary_mark_clicked);
-       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_UNREAD , summary_unread_clicked);
-       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_MIME   , summary_mime_clicked);
-       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_NUMBER , summary_num_clicked);
-       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_SCORE  , summary_score_clicked);
-       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_SIZE   , summary_size_clicked);
-       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_DATE   , summary_date_clicked);
-       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_FROM   , summary_from_clicked);
-       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_SUBJECT, summary_subject_clicked);
-
-#undef CLIST_BUTTON_SIGNAL_CONNECT
 
        /* create status label */
        hbox = gtk_hbox_new(FALSE, 0);
@@ -584,6 +482,9 @@ SummaryView *summary_create(void)
        gtk_box_pack_end(GTK_BOX(hbox), toggle_eventbox, FALSE, FALSE, 4);
        toggle_arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
        gtk_container_add(GTK_CONTAINER(toggle_eventbox), toggle_arrow);
+       gtk_signal_connect(GTK_OBJECT(toggle_eventbox), "button_press_event",
+                          GTK_SIGNAL_FUNC(summary_toggle_pressed),
+                          summaryview);
 
        statlabel_msgs = gtk_label_new("");
        gtk_box_pack_end(GTK_BOX(hbox), statlabel_msgs, FALSE, FALSE, 4);
@@ -595,40 +496,6 @@ SummaryView *summary_create(void)
                                      "<SummaryView>", &popupfactory,
                                      summaryview);
 
-       /* connect signals */
-       gtk_signal_connect(GTK_OBJECT(ctree), "tree_select_row",
-                          GTK_SIGNAL_FUNC(summary_selected), summaryview);
-       gtk_signal_connect(GTK_OBJECT(ctree), "button_press_event",
-                          GTK_SIGNAL_FUNC(summary_button_pressed),
-                          summaryview);
-       gtk_signal_connect(GTK_OBJECT(ctree), "button_release_event",
-                          GTK_SIGNAL_FUNC(summary_button_released),
-                          summaryview);
-       gtk_signal_connect(GTK_OBJECT(ctree), "key_press_event",
-                          GTK_SIGNAL_FUNC(summary_key_pressed), summaryview);
-       gtk_signal_connect(GTK_OBJECT(ctree), "resize_column",
-                          GTK_SIGNAL_FUNC(summary_col_resized), summaryview);
-        gtk_signal_connect(GTK_OBJECT(ctree), "open_row",
-                          GTK_SIGNAL_FUNC(summary_open_row), summaryview);
-
-       gtk_signal_connect_after(GTK_OBJECT(ctree), "tree_expand",
-                                GTK_SIGNAL_FUNC(summary_tree_expanded),
-                                summaryview);
-       gtk_signal_connect_after(GTK_OBJECT(ctree), "tree_collapse",
-                                GTK_SIGNAL_FUNC(summary_tree_collapsed),
-                                summaryview);
-
-       gtk_signal_connect(GTK_OBJECT(ctree), "start_drag",
-                          GTK_SIGNAL_FUNC(summary_start_drag),
-                          summaryview);
-       gtk_signal_connect(GTK_OBJECT(ctree), "drag_data_get",
-                          GTK_SIGNAL_FUNC(summary_drag_data_get),
-                          summaryview);
-
-       gtk_signal_connect(GTK_OBJECT(toggle_eventbox), "button_press_event",
-                          GTK_SIGNAL_FUNC(summary_toggle_pressed),
-                          summaryview);
-
        summaryview->vbox = vbox;
        summaryview->scrolledwin = scrolledwin;
        summaryview->ctree = ctree;
@@ -645,8 +512,6 @@ SummaryView *summary_create(void)
        summaryview->sort_mode = SORT_BY_NONE;
        summaryview->sort_type = GTK_SORT_ASCENDING;
 
-       summary_change_display_item(summaryview);
-
        gtk_widget_show_all(vbox);
 
        return summaryview;
@@ -1150,9 +1015,9 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
        menu_set_sensitive(ifactory, "/View/Open in new window", sens);
        menu_set_sensitive(ifactory, "/View/Source", sens);
        menu_set_sensitive(ifactory, "/View/All header", sens);
-       if ((summaryview->folder_item->stype == F_DRAFT) ||
-           (summaryview->folder_item->stype == F_OUTBOX) ||
-           (summaryview->folder_item->stype == F_QUEUE))
+       if (summaryview->folder_item->stype == F_OUTBOX ||
+           summaryview->folder_item->stype == F_DRAFT  ||
+           summaryview->folder_item->stype == F_QUEUE)
                menu_set_sensitive(ifactory, "/Re-edit", sens);
 
        menu_set_sensitive(ifactory, "/Save as...", sens);
@@ -2212,7 +2077,7 @@ static void summary_set_header(SummaryView *summaryview, gchar *text[],
        else
                text[col_pos[S_COL_DATE]] = _("(No Date)");
 
-       text[S_COL_FROM] = msginfo->fromname ? msginfo->fromname :
+       text[col_pos[S_COL_FROM]] = msginfo->fromname ? msginfo->fromname :
                _("(No From)");
        if (prefs_common.swap_from && msginfo->from && msginfo->to &&
            !MSG_IS_NEWS(msginfo->flags)) {
@@ -2362,10 +2227,10 @@ void summary_reedit(SummaryView *summaryview)
        MsgInfo *msginfo;
 
        if (!summaryview->selected) return;
-       if (!summaryview->folder_item ||
-           (summaryview->folder_item->stype != F_DRAFT &&
-            summaryview->folder_item->stype != F_OUTBOX &&
-            summaryview->folder_item->stype != F_QUEUE)) 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;
 
        msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
                                              summaryview->selected);
@@ -3826,6 +3691,169 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview)
        summaryview->colorlabel_menu = menu;
 }
 
+static GtkWidget *summary_ctree_create(SummaryView *summaryview)
+{
+       GtkWidget *ctree;
+       gint *col_pos = summaryview->col_pos;
+       SummaryColumnState *col_state;
+       const gchar *titles[N_SUMMARY_COLS];
+       SummaryColumnType type;
+       gint pos;
+
+       col_state = prefs_summary_column_get_config();
+       for (pos = 0; pos < N_SUMMARY_COLS; pos++) {
+               summaryview->col_state[pos] = col_state[pos];
+               type = col_state[pos].type;
+               col_pos[type] = pos;
+
+               switch (type) {
+               case S_COL_NUMBER:
+               case S_COL_DATE:
+               case S_COL_FROM:
+               case S_COL_SUBJECT:
+               case S_COL_SCORE:
+                       if (prefs_common.trans_hdr)
+                               titles[pos] = gettext(col_label[type]);
+                       else
+                               titles[pos] = col_label[type];
+                       break;
+               default:
+                       titles[pos] = gettext(col_label[type]);
+               }
+       }
+       col_state = summaryview->col_state;
+
+       ctree = gtk_sctree_new_with_titles
+               (N_SUMMARY_COLS, col_pos[S_COL_SUBJECT], (gchar **)titles);
+
+       gtk_clist_set_selection_mode(GTK_CLIST(ctree), GTK_SELECTION_EXTENDED);
+       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_MARK],
+                                          GTK_JUSTIFY_CENTER);
+       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_UNREAD],
+                                          GTK_JUSTIFY_CENTER);
+       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_MIME],
+                                          GTK_JUSTIFY_CENTER);
+       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_SIZE],
+                                          GTK_JUSTIFY_RIGHT);
+       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_NUMBER],
+                                          GTK_JUSTIFY_RIGHT);
+       gtk_clist_set_column_justification(GTK_CLIST(ctree), col_pos[S_COL_SCORE],
+                                          GTK_JUSTIFY_RIGHT);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_MARK],
+                                  SUMMARY_COL_MARK_WIDTH);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_UNREAD],
+                                  SUMMARY_COL_UNREAD_WIDTH);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_MIME],
+                                  SUMMARY_COL_MIME_WIDTH);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_SUBJECT],
+                                  prefs_common.summary_col_size[S_COL_SUBJECT]);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_FROM],
+                                  prefs_common.summary_col_size[S_COL_FROM]);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_DATE],
+                                  prefs_common.summary_col_size[S_COL_DATE]);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_SIZE],
+                                  prefs_common.summary_col_size[S_COL_SIZE]);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_NUMBER],
+                                  prefs_common.summary_col_size[S_COL_NUMBER]);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), col_pos[S_COL_SCORE],
+                                  prefs_common.summary_col_size[S_COL_SCORE]);
+       gtk_ctree_set_line_style(GTK_CTREE(ctree), GTK_CTREE_LINES_DOTTED);
+       gtk_ctree_set_expander_style(GTK_CTREE(ctree),
+                                    GTK_CTREE_EXPANDER_SQUARE);
+#if 0
+       gtk_ctree_set_line_style(GTK_CTREE(ctree), GTK_CTREE_LINES_NONE);
+       gtk_ctree_set_expander_style(GTK_CTREE(ctree),
+                                    GTK_CTREE_EXPANDER_TRIANGLE);
+#endif
+       gtk_ctree_set_indent(GTK_CTREE(ctree), 18);
+       gtk_object_set_user_data(GTK_OBJECT(ctree), summaryview);
+
+       for (pos = 0; pos < N_SUMMARY_COLS; pos++) {
+               GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(ctree)->column[pos].button,
+                                      GTK_CAN_FOCUS);
+               gtk_clist_set_column_visibility
+                       (GTK_CLIST(ctree), pos, col_state[pos].visible);
+       }
+
+       /* connect signal to the buttons for sorting */
+#define CLIST_BUTTON_SIGNAL_CONNECT(col, func) \
+       gtk_signal_connect \
+               (GTK_OBJECT(GTK_CLIST(ctree)->column[col_pos[col]].button), \
+                "clicked", \
+                GTK_SIGNAL_FUNC(func), \
+                summaryview)
+
+       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_MARK   , summary_mark_clicked);
+       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_UNREAD , summary_unread_clicked);
+       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_MIME   , summary_mime_clicked);
+       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_NUMBER , summary_num_clicked);
+       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_SIZE   , summary_size_clicked);
+       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_DATE   , summary_date_clicked);
+       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_FROM   , summary_from_clicked);
+       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_SUBJECT, summary_subject_clicked);
+       CLIST_BUTTON_SIGNAL_CONNECT(S_COL_SCORE,   summary_score_clicked);
+
+#undef CLIST_BUTTON_SIGNAL_CONNECT
+
+       gtk_signal_connect(GTK_OBJECT(ctree), "tree_select_row",
+                          GTK_SIGNAL_FUNC(summary_selected), summaryview);
+       gtk_signal_connect(GTK_OBJECT(ctree), "button_press_event",
+                          GTK_SIGNAL_FUNC(summary_button_pressed),
+                          summaryview);
+       gtk_signal_connect(GTK_OBJECT(ctree), "button_release_event",
+                          GTK_SIGNAL_FUNC(summary_button_released),
+                          summaryview);
+       gtk_signal_connect(GTK_OBJECT(ctree), "key_press_event",
+                          GTK_SIGNAL_FUNC(summary_key_pressed), summaryview);
+       gtk_signal_connect(GTK_OBJECT(ctree), "resize_column",
+                          GTK_SIGNAL_FUNC(summary_col_resized), summaryview);
+        gtk_signal_connect(GTK_OBJECT(ctree), "open_row",
+                          GTK_SIGNAL_FUNC(summary_open_row), summaryview);
+
+       gtk_signal_connect_after(GTK_OBJECT(ctree), "tree_expand",
+                                GTK_SIGNAL_FUNC(summary_tree_expanded),
+                                summaryview);
+       gtk_signal_connect_after(GTK_OBJECT(ctree), "tree_collapse",
+                                GTK_SIGNAL_FUNC(summary_tree_collapsed),
+                                summaryview);
+
+       gtk_signal_connect(GTK_OBJECT(ctree), "start_drag",
+                          GTK_SIGNAL_FUNC(summary_start_drag),
+                          summaryview);
+       gtk_signal_connect(GTK_OBJECT(ctree), "drag_data_get",
+                          GTK_SIGNAL_FUNC(summary_drag_data_get),
+                          summaryview);
+
+       return ctree;
+}
+
+void summary_set_column_order(SummaryView *summaryview)
+{
+       GtkWidget *ctree;
+       GtkWidget *scrolledwin = summaryview->scrolledwin;
+       GtkWidget *pixmap;
+       FolderItem *item;
+
+       item = summaryview->folder_item;
+       summary_clear_all(summaryview);
+       gtk_widget_destroy(summaryview->ctree);
+
+       summaryview->ctree = ctree = summary_ctree_create(summaryview);
+       pixmap = gtk_pixmap_new(clipxpm, clipxpmmask);
+       gtk_clist_set_column_widget(GTK_CLIST(ctree),
+                                   summaryview->col_pos[S_COL_MIME], pixmap);
+       gtk_widget_show(pixmap);
+       gtk_scrolled_window_set_hadjustment(GTK_SCROLLED_WINDOW(scrolledwin),
+                                           GTK_CLIST(ctree)->hadjustment);
+       gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(scrolledwin),
+                                           GTK_CLIST(ctree)->vadjustment);
+       gtk_container_add(GTK_CONTAINER(scrolledwin), ctree);
+       gtk_widget_show(ctree);
+
+       summary_show(summaryview, item, FALSE);
+}
+
+
 /* callback functions */
 
 static void summary_toggle_pressed(GtkWidget *eventbox, GdkEventButton *event,
@@ -3846,8 +3874,7 @@ static void summary_button_pressed(GtkWidget *ctree, GdkEventButton *event,
        if (!event) return;
 
        if (event->button == 3) {
-               /* Right button clicked */
-               /* summary_set_add_sender_menu(summaryview); */
+               /* right clicked */
                gtk_menu_popup(GTK_MENU(summaryview->popupmenu), NULL, NULL,
                               NULL, NULL, event->button, event->time);
        } else if (event->button == 2) {
@@ -4064,9 +4091,9 @@ static void summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
 
 static void summary_open_row(GtkSCTree *sctree, SummaryView *summaryview)
 {
-       if (summaryview->folder_item->stype == F_DRAFT  ||
-           summaryview->folder_item->stype == F_OUTBOX ||
-            summaryview->folder_item->stype == F_QUEUE)
+       if (summaryview->folder_item->stype == F_OUTBOX ||
+           summaryview->folder_item->stype == F_DRAFT  ||
+           summaryview->folder_item->stype == F_QUEUE)
                summary_reedit(summaryview);
        else
                summary_open_msg(summaryview);
@@ -4136,37 +4163,9 @@ static void summary_selected(GtkCTree *ctree, GtkCTreeNode *row,
 static void summary_col_resized(GtkCList *clist, gint column, gint width,
                                SummaryView *summaryview)
 {
-       switch (summaryview->col_state[column].type) {
-       case S_COL_MARK:
-               prefs_common.summary_col_mark = width;
-               break;
-       case S_COL_UNREAD:
-               prefs_common.summary_col_unread = width;
-               break;
-       case S_COL_MIME:
-               prefs_common.summary_col_mime = width;
-               break;
-       case S_COL_NUMBER:
-               prefs_common.summary_col_number = width;
-               break;
-       case S_COL_SCORE:
-               prefs_common.summary_col_score = width;
-               break;
-       case S_COL_SIZE:
-               prefs_common.summary_col_size = width;
-               break;
-       case S_COL_DATE:
-               prefs_common.summary_col_date = width;
-               break;
-       case S_COL_FROM:
-               prefs_common.summary_col_from = width;
-               break;
-       case S_COL_SUBJECT:
-               prefs_common.summary_col_subject = width;
-               break;
-       default:
-               break;
-       }
+       SummaryColumnType type = summaryview->col_state[column].type;
+
+       prefs_common.summary_col_size[type] = width;
 }
 
 static void summary_reply_cb(SummaryView *summaryview, guint action,
@@ -4304,27 +4303,6 @@ static void summary_subject_clicked(GtkWidget *button,
        summary_sort(summaryview, SORT_BY_SUBJECT);
 }
 
-void summary_change_display_item(SummaryView *summaryview)
-{
-       GtkCList *clist = GTK_CLIST(summaryview->ctree);
-
-#define SET_VISIBLE(col, visible) \
-       gtk_clist_set_column_visibility(clist, summaryview->col_pos[col], \
-                                       prefs_common.visible)
-
-       SET_VISIBLE(S_COL_MARK   , show_mark);
-       SET_VISIBLE(S_COL_UNREAD , show_unread);
-       SET_VISIBLE(S_COL_MIME   , show_mime);
-       SET_VISIBLE(S_COL_NUMBER , show_number);
-       SET_VISIBLE(S_COL_SCORE  , show_score);
-       SET_VISIBLE(S_COL_SIZE   , show_size);
-       SET_VISIBLE(S_COL_DATE   , show_date);
-       SET_VISIBLE(S_COL_FROM   , show_from);
-       SET_VISIBLE(S_COL_SUBJECT, show_subject);
-
-#undef SET_VISIBLE
-}
-
 static void summary_start_drag(GtkWidget *widget, gint button, GdkEvent *event,
                               SummaryView *summaryview)
 {
index af10f12..69e9dd4 100644 (file)
@@ -43,12 +43,12 @@ typedef enum
        S_COL_MARK,
        S_COL_UNREAD,
        S_COL_MIME,
-       S_COL_NUMBER,
-       S_COL_SCORE,
-       S_COL_SIZE,
-       S_COL_DATE,
-       S_COL_FROM,
        S_COL_SUBJECT,
+       S_COL_FROM,
+       S_COL_DATE,
+       S_COL_SIZE,
+       S_COL_NUMBER,
+       S_COL_SCORE
 } SummaryColumnType;
 
 #define N_SUMMARY_COLS 9
@@ -191,20 +191,26 @@ guint summary_get_current_msgnum  (SummaryView            *summaryview);
 void summary_select_node         (SummaryView          *summaryview,
                                   GtkCTreeNode         *node,
                                   gboolean              display_msg);
+
 void summary_thread_build        (SummaryView          *summaryview);
 void summary_unthread            (SummaryView          *summaryview);
+
 void summary_filter              (SummaryView          *summaryview);
 void summary_sort                (SummaryView          *summaryview,
                                   SummarySortType       type);
 
 void summary_delete              (SummaryView          *summaryview);
 void summary_delete_duplicated   (SummaryView          *summaryview);
+
 gboolean summary_execute         (SummaryView          *summaryview);
+
 void summary_attract_by_subject          (SummaryView          *summaryview);
+
 gint summary_write_cache         (SummaryView          *summaryview);
+
 void summary_pass_key_press_event (SummaryView         *summaryview,
                                   GdkEventKey          *event);
-void summary_change_display_item  (SummaryView         *summaryview);
+
 void summary_redisplay_msg       (SummaryView          *summaryview);
 void summary_open_msg            (SummaryView          *summaryview);
 void summary_view_source         (SummaryView          *summaryview);
@@ -237,4 +243,6 @@ void summary_set_colorlabel_color (GtkCTree         *ctree,
                                   GtkCTreeNode         *node,
                                   guint                 labelcolor);
 
+void summary_set_column_order    (SummaryView          *summaryview);
+
 #endif /* __SUMMARY_H__ */