move signature settings to Account Prefs
[claws.git] / src / prefs_common.c
index f246894e695cdf18f05707d3bd21496a5b7d8743..e59327cc09c20cfae7972764e2d617338f1c2580 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,12 +99,10 @@ static struct Send {
        GtkWidget *checkbtn_queuemsg;
 
        GtkWidget *optmenu_charset;
+       GtkWidget *optmenu_encoding_method;
 } p_send;
 
 static struct Compose {
-       GtkWidget *checkbtn_autosig;
-       GtkWidget *entry_sigsep;
-
        GtkWidget *entry_fw_quotemark;
        GtkWidget *text_fw_quotefmt;
 
@@ -173,7 +171,7 @@ static struct Display {
 
        GtkWidget *chkbtn_swapfrom;
        GtkWidget *chkbtn_useaddrbook;
-       GtkWidget *chkbtn_expand_thread;
+       GtkWidget *chkbtn_threadsubj;
        GtkWidget *entry_datefmt;
 } display;
 
@@ -264,8 +262,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);
@@ -302,7 +304,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,
@@ -353,14 +355,12 @@ 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,
-        &compose.checkbtn_autosig,
-        prefs_set_data_from_toggle, prefs_set_toggle},
-       {"signature_separator", "-- ", &prefs_common.sig_sep, P_STRING,
-        &compose.entry_sigsep, prefs_set_data_from_entry, prefs_set_entry},
-
        {"auto_ext_editor", "FALSE", &prefs_common.auto_exteditor, P_BOOL,
         &compose.checkbtn_autoextedit,
         prefs_set_data_from_toggle, prefs_set_toggle},
@@ -506,12 +506,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},
@@ -534,7 +534,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",
@@ -555,7 +555,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",
@@ -576,7 +576,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",
@@ -779,7 +779,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,
@@ -813,6 +813,8 @@ static PrefParam param[] = {
 #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},
@@ -1295,10 +1297,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);
@@ -1351,20 +1356,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);
@@ -1374,11 +1379,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
@@ -1397,7 +1402,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);
@@ -1409,7 +1415,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;
@@ -1418,7 +1460,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)
@@ -1724,12 +1767,6 @@ static void prefs_compose_create(void)
        GtkWidget *vbox2;
        GtkWidget *hbox1;
 
-       GtkWidget *frame_sig;
-       GtkWidget *vbox_sig;
-       GtkWidget *checkbtn_autosig;
-       GtkWidget *label_sigsep;
-       GtkWidget *entry_sigsep;
-
        GtkWidget *checkbtn_autoextedit;
 
        GtkWidget *frame_autosel;
@@ -1773,29 +1810,6 @@ static void prefs_compose_create(void)
        gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
-       PACK_FRAME(vbox1, frame_sig, _("Signature"));
-
-       vbox_sig = gtk_vbox_new (FALSE, VSPACING_NARROW);
-       gtk_widget_show (vbox_sig);
-       gtk_container_add (GTK_CONTAINER (frame_sig), vbox_sig);
-       gtk_container_set_border_width (GTK_CONTAINER (vbox_sig), 8);
-
-       PACK_CHECK_BUTTON (vbox_sig, checkbtn_autosig,
-                          _("Insert signature automatically"));
-
-       hbox1 = gtk_hbox_new (FALSE, 8);
-       gtk_widget_show (hbox1);
-       gtk_box_pack_start (GTK_BOX (vbox_sig), hbox1, TRUE, TRUE, 0);
-       label_sigsep = gtk_label_new (_("Signature separator"));
-       gtk_widget_show (label_sigsep);
-       gtk_box_pack_start (GTK_BOX (hbox1), label_sigsep, FALSE, FALSE, 0);
-
-       entry_sigsep = gtk_entry_new ();
-       gtk_widget_show (entry_sigsep);
-       gtk_box_pack_start (GTK_BOX (hbox1), entry_sigsep, FALSE, FALSE, 0);
-
-       gtk_widget_set_usize (entry_sigsep, 64, -1);
-
         /* Account autoselection */
        PACK_FRAME(vbox1, frame_autosel, _("Automatic account selection"));
 
@@ -1915,8 +1929,6 @@ static void prefs_compose_create(void)
        compose.entry_quotemark  = entry_quotemark;
        compose.text_quotefmt    = text_quotefmt;
        */
-       compose.checkbtn_autosig = checkbtn_autosig;
-       compose.entry_sigsep     = entry_sigsep;
 
        compose.checkbtn_autoextedit = checkbtn_autoextedit;
 
@@ -2121,7 +2133,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;
@@ -2268,12 +2280,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);
 
@@ -2319,8 +2332,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;
 }
 
@@ -2888,11 +2901,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'",
@@ -4153,6 +4168,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;
@@ -4170,19 +4215,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);