option to disable threading by subject
[claws.git] / src / prefs_common.c
index aa4162a2374063253e8b507437dcb1d88c175624..ffd921fb96035bb4bb100af08c1f674d04d7b16b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2002 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2003 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
@@ -36,7 +36,7 @@
 
 #include "intl.h"
 #include "main.h"
-#include "prefs.h"
+#include "prefs_gtk.h"
 #include "prefs_common.h"
 #include "prefs_display_header.h"
 #include "prefs_summary_column.h"
@@ -99,6 +99,7 @@ static struct Send {
        GtkWidget *checkbtn_queuemsg;
 
        GtkWidget *optmenu_charset;
+       GtkWidget *optmenu_encoding_method;
 } p_send;
 
 static struct Compose {
@@ -173,7 +174,7 @@ static struct Display {
 
        GtkWidget *chkbtn_swapfrom;
        GtkWidget *chkbtn_useaddrbook;
-       GtkWidget *chkbtn_expand_thread;
+       GtkWidget *chkbtn_threadsubj;
        GtkWidget *entry_datefmt;
 } display;
 
@@ -237,9 +238,12 @@ static struct Other {
        GtkWidget *checkbtn_warnqueued;
         GtkWidget *checkbtn_cliplog;
         GtkWidget *loglength_entry;
-#ifdef USE_SSL
+#if 0
+#ifdef USE_OPENSSL
        GtkWidget *checkbtn_ssl_ask_unknown_valid;
 #endif
+#endif
+
 } other;
 
 static struct MessageColorButtons {
@@ -261,8 +265,12 @@ static guint font_sel_conn_id;
 static GtkWidget *quote_color_win;
 static GtkWidget *color_dialog;
 
-static void prefs_common_charset_set_data_from_optmenu(PrefParam *pparam);
-static void prefs_common_charset_set_optmenu         (PrefParam *pparam);
+static void prefs_common_charset_set_data_from_optmenu    (PrefParam *pparam);
+static void prefs_common_charset_set_optmenu              (PrefParam *pparam);
+static void prefs_common_encoding_set_data_from_optmenu    (PrefParam *pparam);
+static void prefs_common_encoding_set_optmenu             (PrefParam *pparam);
+static void prefs_common_recv_dialog_set_data_from_optmenu (PrefParam *pparam);
+static void prefs_common_recv_dialog_set_optmenu          (PrefParam *pparam);
 static void prefs_common_recv_dialog_newmail_notify_toggle_cb  (GtkWidget *w,
                                                                 gpointer data);
 static void prefs_common_recv_dialog_set_data_from_optmenu(PrefParam *pparam);
@@ -299,7 +307,7 @@ static PrefParam param[] = {
        {"inc_local", "TRUE", &prefs_common.inc_local, P_BOOL,
         &receive.checkbtn_local,
         prefs_set_data_from_toggle, prefs_set_toggle},
-       {"filter_on_inc_local", "FALSE", &prefs_common.filter_on_inc, P_BOOL,
+       {"filter_on_inc_local", "TRUE", &prefs_common.filter_on_inc, P_BOOL,
         &receive.checkbtn_filter_on_inc,
         prefs_set_data_from_toggle, prefs_set_toggle},
        {"spool_path", DEFAULT_SPOOL_PATH, &prefs_common.spool_path, P_STRING,
@@ -350,6 +358,10 @@ static PrefParam param[] = {
         &p_send.optmenu_charset,
         prefs_common_charset_set_data_from_optmenu,
         prefs_common_charset_set_optmenu},
+       {"encoding_method", "0", &prefs_common.encoding_method, P_ENUM,
+        &p_send.optmenu_encoding_method,
+        prefs_common_encoding_set_data_from_optmenu,
+        prefs_common_encoding_set_optmenu},
 
        /* Compose */
        {"auto_signature", "TRUE", &prefs_common.auto_sig, P_BOOL,
@@ -503,12 +515,12 @@ static PrefParam param[] = {
        {"use_address_book", "TRUE", &prefs_common.use_addr_book, P_BOOL,
         &display.chkbtn_useaddrbook,
         prefs_set_data_from_toggle, prefs_set_toggle},
+       {"thread_by_subject", "TRUE", &prefs_common.thread_by_subject, P_BOOL,
+        &display.chkbtn_threadsubj,
+        prefs_set_data_from_toggle, prefs_set_toggle},
        {"date_format", "%y/%m/%d(%a) %H:%M", &prefs_common.date_format,
         P_STRING, &display.entry_datefmt,
         prefs_set_data_from_entry, prefs_set_entry},
-       {"expand_thread", "TRUE", &prefs_common.expand_thread, P_BOOL,
-        &display.chkbtn_expand_thread,
-        prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"enable_hscrollbar", "TRUE", &prefs_common.enable_hscrollbar, P_BOOL,
         NULL, NULL, NULL},
@@ -531,7 +543,7 @@ static PrefParam param[] = {
        {"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},
+        &prefs_common.summary_col_visible[S_COL_STATUS], 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",
@@ -552,7 +564,7 @@ static PrefParam param[] = {
        {"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},
+         &prefs_common.summary_col_pos[S_COL_STATUS], 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",
@@ -573,7 +585,7 @@ static PrefParam param[] = {
        {"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},
+        &prefs_common.summary_col_size[S_COL_STATUS], 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",
@@ -776,7 +788,7 @@ static PrefParam param[] = {
         &interface.entry_pixmap_theme, prefs_set_data_from_entry, prefs_set_entry},
        
        /* Other */
-       {"uri_open_command", "netscape -remote 'openURL(%s,raise)'",
+       {"uri_open_command", DEFAULT_BROWSER_CMD,
         &prefs_common.uri_cmd, P_STRING,
         &other.uri_entry, prefs_set_data_from_entry, prefs_set_entry},
        {"print_command", "lpr %s", &prefs_common.print_cmd, P_STRING,
@@ -801,13 +813,17 @@ static PrefParam param[] = {
        {"warn_queued_on_exit", "TRUE", &prefs_common.warn_queued_on_exit,
         P_BOOL, &other.checkbtn_warnqueued,
         prefs_set_data_from_toggle, prefs_set_toggle},
-#ifdef USE_SSL
+#if 0
+#ifdef USE_OPENSSL
        {"ssl_ask_unknown_valid", "TRUE", &prefs_common.ssl_ask_unknown_valid,
         P_BOOL, &other.checkbtn_ssl_ask_unknown_valid,
         prefs_set_data_from_toggle, prefs_set_toggle},
+#endif
 #endif
        {"work_offline", "FALSE", &prefs_common.work_offline, P_BOOL,
         NULL, NULL, NULL},
+       {"summary_quicksearch_type", "0", &prefs_common.summary_quicksearch_type, P_INT,
+        NULL, NULL, NULL},
 
        {"hide_score", "-9999", &prefs_common.kill_score, P_INT,
         NULL, NULL, NULL},
@@ -1290,10 +1306,13 @@ static void prefs_send_create(void)
        GtkWidget *checkbtn_savemsg;
        GtkWidget *checkbtn_queuemsg;
        GtkWidget *label_outcharset;
-       GtkWidget *optmenu;
+       GtkWidget *optmenu_charset;
        GtkWidget *optmenu_menu;
        GtkWidget *menuitem;
        GtkWidget *label_charset_desc;
+       GtkWidget *optmenu_encoding;
+       GtkWidget *label_encoding;
+       GtkWidget *label_encoding_desc;
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
@@ -1346,20 +1365,20 @@ static void prefs_send_create(void)
        gtk_widget_show (label_outcharset);
        gtk_box_pack_start (GTK_BOX (hbox1), label_outcharset, FALSE, FALSE, 0);
 
-       optmenu = gtk_option_menu_new ();
-       gtk_widget_show (optmenu);
-       gtk_box_pack_start (GTK_BOX (hbox1), optmenu, FALSE, FALSE, 0);
+       optmenu_charset = gtk_option_menu_new ();
+       gtk_widget_show (optmenu_charset);
+       gtk_box_pack_start (GTK_BOX (hbox1), optmenu_charset, FALSE, FALSE, 0);
 
        optmenu_menu = gtk_menu_new ();
 
-#define SET_MENUITEM(str, charset) \
+#define SET_MENUITEM(str, data) \
 { \
-       MENUITEM_ADD(optmenu_menu, menuitem, str, charset); \
+       MENUITEM_ADD(optmenu_menu, menuitem, str, data); \
 }
 
        SET_MENUITEM(_("Automatic (Recommended)"),       CS_AUTO);
        SET_MENUITEM(_("7bit ascii (US-ASCII)"),         CS_US_ASCII);
-#if HAVE_LIBJCONV
+#if HAVE_ICONV
        SET_MENUITEM(_("Unicode (UTF-8)"),               CS_UTF_8);
 #endif
        SET_MENUITEM(_("Western European (ISO-8859-1)"),  CS_ISO_8859_1);
@@ -1369,11 +1388,11 @@ static void prefs_send_create(void)
        SET_MENUITEM(_("Baltic (ISO-8859-4)"),            CS_ISO_8859_4);
        SET_MENUITEM(_("Greek (ISO-8859-7)"),             CS_ISO_8859_7);
        SET_MENUITEM(_("Turkish (ISO-8859-9)"),           CS_ISO_8859_9);
-#if HAVE_LIBJCONV
+#if HAVE_ICONV
        SET_MENUITEM(_("Cyrillic (ISO-8859-5)"),          CS_ISO_8859_5);
 #endif
        SET_MENUITEM(_("Cyrillic (KOI8-R)"),             CS_KOI8_R);
-#if HAVE_LIBJCONV
+#if HAVE_ICONV
        SET_MENUITEM(_("Cyrillic (Windows-1251)"),       CS_WINDOWS_1251);
        SET_MENUITEM(_("Cyrillic (KOI8-U)"),             CS_KOI8_U);
 #endif
@@ -1392,7 +1411,8 @@ static void prefs_send_create(void)
        SET_MENUITEM(_("Thai (TIS-620)"),                CS_TIS_620);
        SET_MENUITEM(_("Thai (Windows-874)"),            CS_WINDOWS_874);
 
-       gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu), optmenu_menu);
+       gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_charset),
+                                 optmenu_menu);
 
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox1);
@@ -1404,7 +1424,43 @@ static void prefs_send_create(void)
        gtk_widget_show (label_charset_desc);
        gtk_box_pack_start (GTK_BOX (hbox1), label_charset_desc,
                            FALSE, FALSE, 0);
-       gtk_label_set_justify(GTK_LABEL (label_charset_desc), GTK_JUSTIFY_LEFT);
+       gtk_label_set_justify (GTK_LABEL (label_charset_desc),
+                              GTK_JUSTIFY_LEFT);
+
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
+
+       label_encoding = gtk_label_new (_("Transfer encoding"));
+       gtk_widget_show (label_encoding);
+       gtk_box_pack_start (GTK_BOX (hbox1), label_encoding, FALSE, FALSE, 0);
+
+       optmenu_encoding = gtk_option_menu_new ();
+       gtk_widget_show (optmenu_encoding);
+       gtk_box_pack_start (GTK_BOX (hbox1), optmenu_encoding, FALSE, FALSE, 0);
+
+       optmenu_menu = gtk_menu_new ();
+
+       SET_MENUITEM(_("Automatic"),     CTE_AUTO);
+       SET_MENUITEM("base64",           CTE_BASE64);
+       SET_MENUITEM("quoted-printable", CTE_QUOTED_PRINTABLE);
+       SET_MENUITEM("8bit",             CTE_8BIT);
+
+       gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu_encoding),
+                                 optmenu_menu);
+
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
+
+       label_encoding_desc = gtk_label_new
+               (_("Specify Content-Transfer-Encoding used when\n"
+                  "message body contains non-ASCII characters."));
+       gtk_widget_show (label_encoding_desc);
+       gtk_box_pack_start (GTK_BOX (hbox1), label_encoding_desc,
+                           FALSE, FALSE, 0);
+       gtk_label_set_justify (GTK_LABEL (label_encoding_desc),
+                              GTK_JUSTIFY_LEFT);
 
        p_send.checkbtn_extsend = checkbtn_extsend;
        p_send.entry_extsend    = entry_extsend;
@@ -1413,7 +1469,8 @@ static void prefs_send_create(void)
        p_send.checkbtn_savemsg  = checkbtn_savemsg;
        p_send.checkbtn_queuemsg = checkbtn_queuemsg;
 
-       p_send.optmenu_charset = optmenu;
+       p_send.optmenu_charset = optmenu_charset;
+       p_send.optmenu_encoding_method = optmenu_encoding;
 }
 
 static void prefs_common_recv_dialog_newmail_notify_toggle_cb(GtkWidget *w, gpointer data)
@@ -2116,7 +2173,7 @@ static void prefs_display_create(void)
        GtkWidget *vbox2;
        GtkWidget *chkbtn_swapfrom;
        GtkWidget *chkbtn_useaddrbook;
-       GtkWidget *chkbtn_expand_thread;
+       GtkWidget *chkbtn_threadsubj;
        GtkWidget *vbox3;
        GtkWidget *label_datefmt;
        GtkWidget *button_datefmt;
@@ -2263,12 +2320,13 @@ static void prefs_display_create(void)
 
        PACK_CHECK_BUTTON
                (vbox2, chkbtn_swapfrom,
-                _("Display recipient on `From' column if sender is yourself"));
+                _("Display recipient in `From' column if sender is yourself"));
        PACK_CHECK_BUTTON
                (vbox2, chkbtn_useaddrbook,
                 _("Display sender using address book"));
        PACK_CHECK_BUTTON
-               (vbox2, chkbtn_expand_thread, _("Expand threads"));
+               (vbox2, chkbtn_threadsubj,
+                _("Thread using subject in addition to standard headers"));
 
        PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2);
 
@@ -2314,8 +2372,8 @@ static void prefs_display_create(void)
        display.spinbtn_ng_abbrev_len_adj = spinbtn_ng_abbrev_len_adj;
 
        display.chkbtn_swapfrom      = chkbtn_swapfrom;
-       display.chkbtn_expand_thread = chkbtn_expand_thread;
        display.chkbtn_useaddrbook   = chkbtn_useaddrbook;
+       display.chkbtn_threadsubj    = chkbtn_threadsubj;
        display.entry_datefmt        = entry_datefmt;
 }
 
@@ -2378,7 +2436,7 @@ static void prefs_message_create(void)
 
        PACK_CHECK_BUTTON
                (vbox2, chkbtn_mbalnum,
-                _("Display multi-byte alphabet and numeric as\n"
+                _("Display multi-byte alphanumeric as\n"
                   "ASCII character (Japanese only)"));
        gtk_label_set_justify (GTK_LABEL (GTK_BIN(chkbtn_mbalnum)->child),
                               GTK_JUSTIFY_LEFT);
@@ -2632,10 +2690,7 @@ static void prefs_interface_create(void)
 
        GtkWidget *button_keybind;
 
-       GtkWidget *hbox2;
        GtkWidget *optmenu_nextunreadmsgdialog;
-       GtkWidget *optmenu_nextunreadmsgdialog_menu;
-       GtkWidget *nextunreadmsgdialog_menuitem;
 
        GtkWidget *frame_pixmap_theme;
        GtkWidget *vbox_pixmap_theme;
@@ -2852,11 +2907,13 @@ static void prefs_other_create(void)
        GtkWidget *checkbtn_cleanonexit;
        GtkWidget *checkbtn_askonclean;
        GtkWidget *checkbtn_warnqueued;
-#ifdef USE_SSL 
+#if 0
+#ifdef USE_OPENSSL
        GtkWidget *frame_ssl;
        GtkWidget *vbox_ssl;
        GtkWidget *hbox_ssl;
        GtkWidget *checkbtn_ssl_ask_unknown_valid;
+#endif
 #endif
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
@@ -2884,11 +2941,13 @@ static void prefs_other_create(void)
        gtk_table_attach (GTK_TABLE (ext_table), uri_combo, 1, 2, 0, 1,
                          GTK_EXPAND | GTK_FILL, 0, 0, 0);
        gtkut_combo_set_items (GTK_COMBO (uri_combo),
+                              DEFAULT_BROWSER_CMD,
+                              "galeon --new-tab '%s'",
                               "galeon '%s'",
                               "mozilla -remote 'openurl(%s,new-window)'",
-                              "netscape -remote 'openURL(%s,raise)'",
+                              "netscape -remote 'openURL(%s, new-window)'",
                               "netscape '%s'",
-                              "gnome-moz-remote --raise --newwin '%s'",
+                              "gnome-moz-remote --newwin '%s'",
                               "kfmclient openURL '%s'",
                               "opera -newwindow '%s'",
                               "kterm -e w3m '%s'",
@@ -2966,7 +3025,8 @@ static void prefs_other_create(void)
                            FALSE, TRUE, 0);
        SET_TOGGLE_SENSITIVITY(checkbtn_cliplog, loglength_entry);
 
-#ifdef USE_SSL
+#if 0
+#ifdef USE_OPENSSL
        /* SSL */
        PACK_FRAME (vbox1, frame_ssl, _("Security"));
 
@@ -2979,6 +3039,7 @@ static void prefs_other_create(void)
        hbox_ssl = gtk_hbox_new (FALSE, 3);
        gtk_container_add (GTK_CONTAINER (vbox_ssl), hbox_ssl);
        gtk_widget_show (hbox_ssl);
+#endif
 #endif
        
        /* On Exit */
@@ -3022,9 +3083,11 @@ static void prefs_other_create(void)
        other.checkbtn_askonclean  = checkbtn_askonclean;
        other.checkbtn_warnqueued  = checkbtn_warnqueued;
        
-#ifdef USE_SSL
+#if 0
+#ifdef USE_OPENSSL
        other.checkbtn_ssl_ask_unknown_valid = checkbtn_ssl_ask_unknown_valid;
 #endif
+#endif
 }
 
 static void date_format_ok_btn_clicked(GtkButton *button, GtkWidget **widget)
@@ -4145,6 +4208,36 @@ static void prefs_common_charset_set_optmenu(PrefParam *pparam)
        }
 }
 
+static void prefs_common_encoding_set_data_from_optmenu(PrefParam *pparam)
+{
+       GtkWidget *menu;
+       GtkWidget *menuitem;
+
+       menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget));
+       menuitem = gtk_menu_get_active(GTK_MENU(menu));
+       *((TransferEncodingMethod *)pparam->data) = GPOINTER_TO_INT
+               (gtk_object_get_user_data(GTK_OBJECT(menuitem)));
+}
+
+static void prefs_common_encoding_set_optmenu(PrefParam *pparam)
+{
+       TransferEncodingMethod method =
+               *((TransferEncodingMethod *)pparam->data);
+       GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
+       gint index;
+
+       g_return_if_fail(optmenu != NULL);
+
+       index = menu_find_option_menu_index(optmenu, GINT_TO_POINTER(method),
+                                           NULL);
+       if (index >= 0)
+               gtk_option_menu_set_history(optmenu, index);
+       else {
+               gtk_option_menu_set_history(optmenu, 0);
+               prefs_common_encoding_set_data_from_optmenu(pparam);
+       }
+}
+
 static void prefs_common_recv_dialog_set_data_from_optmenu(PrefParam *pparam)
 {
        GtkWidget *menu;
@@ -4162,19 +4255,15 @@ static void prefs_common_recv_dialog_set_optmenu(PrefParam *pparam)
        GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
        GtkWidget *menu;
        GtkWidget *menuitem;
+       gint index;
 
-       switch (mode) {
-       case RECV_DIALOG_ALWAYS:
+       index = menu_find_option_menu_index(optmenu, GINT_TO_POINTER(mode),
+                                           NULL);
+       if (index >= 0)
+               gtk_option_menu_set_history(optmenu, index);
+       else {
                gtk_option_menu_set_history(optmenu, 0);
-               break;
-       case RECV_DIALOG_ACTIVE:
-               gtk_option_menu_set_history(optmenu, 1);
-               break;
-       case RECV_DIALOG_NEVER:
-               gtk_option_menu_set_history(optmenu, 2);
-               break;
-       default:
-               break;
+               prefs_common_recv_dialog_set_data_from_optmenu(pparam);
        }
 
        menu = gtk_option_menu_get_menu(optmenu);