0.8.10claws70
[claws.git] / src / prefs_account.c
index 0f7f1dade900a2bf1a60b8e213462e85f6392271..a4035c15a8243bfdc8e91d116998b87d5042b939 100644 (file)
@@ -99,6 +99,11 @@ static struct Receive {
        GtkWidget *inbox_btn;
 
        GtkWidget *recvatgetall_chkbtn;
+
+       GtkWidget *frame_maxarticle;
+       GtkWidget *label_maxarticle;
+       GtkWidget *spinbtn_maxarticle;
+       GtkObject *spinbtn_maxarticle_adj;
 } receive;
 
 static struct Send {
@@ -114,7 +119,10 @@ static struct Send {
 } p_send;
 
 static struct Compose {
-       GtkWidget *sigpath_entry;
+       GtkWidget *sigfile_radiobtn;
+       GtkWidget *entry_sigpath;
+       GtkWidget *checkbtn_autosig;
+       GtkWidget *entry_sigsep;
        GtkWidget *autocc_chkbtn;
        GtkWidget *autocc_entry;
        GtkWidget *autobcc_chkbtn;
@@ -199,10 +207,8 @@ static void prefs_account_smtp_auth_type_set_data_from_optmenu
                                                        (PrefParam *pparam);
 static void prefs_account_smtp_auth_type_set_optmenu   (PrefParam *pparam);
 
-#if USE_GPGME || USE_OPENSSL
 static void prefs_account_enum_set_data_from_radiobtn  (PrefParam *pparam);
 static void prefs_account_enum_set_radiobtn            (PrefParam *pparam);
-#endif /* USE_GPGME || USE_OPENSSL */
 
 #if USE_GPGME
 static void prefs_account_gnupg_inline_warning         (GtkWidget *widget);
@@ -268,7 +274,7 @@ static PrefParam param[] = {
        {"user_id", "ENV_USER", &tmp_ac_prefs.userid, P_STRING,
         &basic.uid_entry, prefs_set_data_from_entry, prefs_set_entry},
 
-       {"password", NULL, &tmp_ac_prefs.passwd, P_STRING,
+       {"password", NULL, &tmp_ac_prefs.passwd, P_PASSWORD,
         &basic.pass_entry, prefs_set_data_from_entry, prefs_set_entry},
 
        {"inbox", "inbox", &tmp_ac_prefs.inbox, P_STRING,
@@ -310,6 +316,10 @@ static PrefParam param[] = {
         &receive.recvatgetall_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
+       {"max_news_articles", "300", &tmp_ac_prefs.max_articles, P_INT,
+        &receive.spinbtn_maxarticle,
+        prefs_set_data_from_spinbtn, prefs_set_spinbtn},
+
        /* Send */
        {"add_date", "TRUE", &tmp_ac_prefs.add_date, P_BOOL,
         &p_send.date_chkbtn,
@@ -334,7 +344,7 @@ static PrefParam param[] = {
 
        {"smtp_user_id", NULL, &tmp_ac_prefs.smtp_userid, P_STRING,
         &p_send.smtp_uid_entry, prefs_set_data_from_entry, prefs_set_entry},
-       {"smtp_password", NULL, &tmp_ac_prefs.smtp_passwd, P_STRING,
+       {"smtp_password", NULL, &tmp_ac_prefs.smtp_passwd, P_PASSWORD,
         &p_send.smtp_pass_entry, prefs_set_data_from_entry, prefs_set_entry},
 
        {"pop_before_smtp", "FALSE", &tmp_ac_prefs.pop_before_smtp, P_BOOL,
@@ -346,8 +356,20 @@ static PrefParam param[] = {
         prefs_set_data_from_entry, prefs_set_entry},
 
        /* Compose */
+       {"signature_type", "0", &tmp_ac_prefs.sig_type, P_ENUM,
+        &compose.sigfile_radiobtn,
+        prefs_account_enum_set_data_from_radiobtn,
+        prefs_account_enum_set_radiobtn},
        {"signature_path", "~/"DEFAULT_SIGNATURE, &tmp_ac_prefs.sig_path, P_STRING,
-        &compose.sigpath_entry,
+        &compose.entry_sigpath,
+        prefs_set_data_from_entry, prefs_set_entry},
+
+       {"auto_signature", "TRUE", &tmp_ac_prefs.auto_sig, P_BOOL,
+        &compose.checkbtn_autosig,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+        
+       {"signature_separator", "-- ", &tmp_ac_prefs.sig_sep, P_STRING,
+        &compose.entry_sigsep, 
         prefs_set_data_from_entry, prefs_set_entry},
 
        {"set_autocc", "FALSE", &tmp_ac_prefs.set_autocc, P_BOOL,
@@ -1095,6 +1117,12 @@ static void prefs_account_receive_create(void)
        GtkWidget *inbox_btn;
        GtkWidget *recvatgetall_chkbtn;
 
+       GtkWidget *hbox2;
+       GtkWidget *frame2;
+       GtkWidget *label_maxarticle;
+       GtkWidget *spinbtn_maxarticle;
+       GtkObject *spinbtn_maxarticle_adj;
+
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
        gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
@@ -1212,6 +1240,31 @@ static void prefs_account_receive_create(void)
        gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
        gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
 
+       PACK_FRAME(vbox1, frame2, _("Maximum number of articles to download"));
+
+       hbox2 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox2);
+       gtk_container_add (GTK_CONTAINER (frame2), hbox2);
+       gtk_container_set_border_width (GTK_CONTAINER (hbox2), 8);
+
+       spinbtn_maxarticle_adj =
+               gtk_adjustment_new (300, 0, 10000, 10, 100, 100);
+       spinbtn_maxarticle = gtk_spin_button_new
+               (GTK_ADJUSTMENT (spinbtn_maxarticle_adj), 10, 0);
+       gtk_widget_show (spinbtn_maxarticle);
+       gtk_box_pack_start (GTK_BOX (hbox2), spinbtn_maxarticle,
+                           FALSE, FALSE, 0);
+       gtk_widget_set_usize (spinbtn_maxarticle, 64, -1);
+       gtk_spin_button_set_numeric
+               (GTK_SPIN_BUTTON (spinbtn_maxarticle), TRUE);
+
+       label_maxarticle = gtk_label_new
+               (_("unlimited if 0 is specified"));
+       gtk_widget_show (label_maxarticle);
+       gtk_box_pack_start (GTK_BOX (hbox2), label_maxarticle, FALSE, FALSE, 0);
+       gtk_label_set_justify (GTK_LABEL (label_maxarticle), GTK_JUSTIFY_LEFT);
+
+
        PACK_CHECK_BUTTON
                (vbox1, recvatgetall_chkbtn,
                 _("`Get all' checks for new messages on this account"));
@@ -1230,6 +1283,10 @@ static void prefs_account_receive_create(void)
        receive.inbox_btn                = inbox_btn;
 
        receive.recvatgetall_chkbtn      = recvatgetall_chkbtn;
+
+       receive.frame_maxarticle        = frame2;
+       receive.spinbtn_maxarticle      = spinbtn_maxarticle;
+       receive.spinbtn_maxarticle_adj  = spinbtn_maxarticle_adj;
 }
 
 static void prefs_account_send_create(void)
@@ -1425,9 +1482,18 @@ static void prefs_account_send_create(void)
 static void prefs_account_compose_create(void)
 {
        GtkWidget *vbox1;
-       GtkWidget *hbox;
-       GtkWidget *label;
-       GtkWidget *sigpath_entry;
+       GtkWidget *sig_hbox;
+       GtkWidget *hbox1;
+       GtkWidget *hbox2;
+       GtkWidget *frame_sig;
+       GtkWidget *vbox_sig;
+       GtkWidget *label_sigpath;
+       GtkWidget *entry_sigpath;
+       GtkWidget *checkbtn_autosig;
+       GtkWidget *label_sigsep;
+       GtkWidget *entry_sigsep;
+       GtkWidget *sigfile_radiobtn;
+       GtkWidget *sigcmd_radiobtn;
        GtkWidget *frame;
        GtkWidget *table;
        GtkWidget *autocc_chkbtn;
@@ -1442,17 +1508,58 @@ static void prefs_account_compose_create(void)
        gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
-       hbox = gtk_hbox_new (FALSE, 8);
-       gtk_widget_show (hbox);
-       gtk_box_pack_start (GTK_BOX (vbox1), hbox, FALSE, FALSE, 0);
+       PACK_FRAME(vbox1, frame_sig, _("Signature"));
 
-       label = gtk_label_new (_("Signature file"));
-       gtk_widget_show (label);
-       gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+       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);
+
+       sig_hbox = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (sig_hbox);
+       gtk_box_pack_start (GTK_BOX (vbox_sig), sig_hbox, FALSE, FALSE, 0);
 
-       sigpath_entry = gtk_entry_new ();
-       gtk_widget_show (sigpath_entry);
-       gtk_box_pack_start (GTK_BOX (hbox), sigpath_entry, TRUE, TRUE, 0);
+       sigfile_radiobtn = gtk_radio_button_new_with_label (NULL, _("File"));
+       gtk_widget_show (sigfile_radiobtn);
+       gtk_box_pack_start (GTK_BOX (sig_hbox), sigfile_radiobtn,
+                           FALSE, FALSE, 0);
+       gtk_object_set_user_data (GTK_OBJECT (sigfile_radiobtn),
+                                 GINT_TO_POINTER (SIG_FILE));
+
+       sigcmd_radiobtn = gtk_radio_button_new_with_label_from_widget
+               (GTK_RADIO_BUTTON(sigfile_radiobtn), _("Command output"));
+       gtk_widget_show (sigcmd_radiobtn);
+       gtk_box_pack_start (GTK_BOX (sig_hbox), sigcmd_radiobtn,
+                           FALSE, FALSE, 0);
+       gtk_object_set_user_data (GTK_OBJECT (sigcmd_radiobtn),
+                                 GINT_TO_POINTER (SIG_COMMAND));
+
+       hbox2 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox2);
+       gtk_box_pack_start (GTK_BOX (vbox_sig), hbox2, TRUE, TRUE, 0);
+       label_sigpath = gtk_label_new (_("Signature"));
+       gtk_widget_show (label_sigpath);
+       gtk_box_pack_start (GTK_BOX (hbox2), label_sigpath, FALSE, FALSE, 0);
+
+       entry_sigpath = gtk_entry_new ();
+       gtk_widget_show (entry_sigpath);
+       gtk_box_pack_start (GTK_BOX (hbox2), entry_sigpath, TRUE, TRUE, 0);
 
        PACK_FRAME (vbox1, frame, _("Automatically set the following addresses"));
 
@@ -1502,7 +1609,10 @@ static void prefs_account_compose_create(void)
 
        SET_TOGGLE_SENSITIVITY (autoreplyto_chkbtn, autoreplyto_entry);
 
-       compose.sigpath_entry = sigpath_entry;
+       compose.sigfile_radiobtn = sigfile_radiobtn;
+       compose.entry_sigpath      = entry_sigpath;
+       compose.checkbtn_autosig   = checkbtn_autosig;
+       compose.entry_sigsep       = entry_sigsep;
 
        compose.autocc_chkbtn      = autocc_chkbtn;
        compose.autocc_entry       = autocc_entry;
@@ -1754,7 +1864,7 @@ static void prefs_account_ssl_create(void)
 
        CREATE_RADIO_BUTTONS(vbox5,
                             smtp_nossl_radiobtn,
-                            _("Don't use SSL"),
+                            _("Don't use SSL (but, if necessary, use STARTTLS)"),
                             SSL_NONE,
                             smtp_ssltunnel_radiobtn,
                             _("Use SSL for SMTP connection"),
@@ -2150,7 +2260,6 @@ static void prefs_account_edit_custom_header(void)
        prefs_custom_header_open(&tmp_ac_prefs);
 }
 
-#if USE_GPGME || USE_OPENSSL
 static void prefs_account_enum_set_data_from_radiobtn(PrefParam *pparam)
 {
        GtkRadioButton *radiobtn;
@@ -2189,8 +2298,6 @@ static void prefs_account_enum_set_radiobtn(PrefParam *pparam)
        }
 }
 
-#endif /* USE_GPGME || USE_OPENSSL */
-
 #if USE_GPGME
 static void prefs_account_gnupg_inline_warning(GtkWidget *widget)
 {
@@ -2354,9 +2461,9 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
 
                prefs_account_nntpauth_toggled
                        (GTK_TOGGLE_BUTTON(basic.nntpauth_chkbtn), NULL);
-               gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
+               gtk_widget_hide(receive.pop3_frame);
+               gtk_widget_show(receive.frame_maxarticle);
                gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
-
                /* update pop_before_smtp sensitivity */
                gtk_toggle_button_set_active
                        (GTK_TOGGLE_BUTTON(p_send.pop_bfr_smtp_chkbtn), FALSE);
@@ -2424,8 +2531,9 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_set_sensitive(basic.pass_label, TRUE);
                gtk_widget_set_sensitive(basic.uid_entry,  TRUE);
                gtk_widget_set_sensitive(basic.pass_entry, TRUE);
-               gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
-               gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, FALSE);
+               gtk_widget_hide(receive.pop3_frame);
+               gtk_widget_hide(receive.frame_maxarticle);
+               gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
                prefs_account_mailcmd_toggled
                        (GTK_TOGGLE_BUTTON(basic.mailcmd_chkbtn), NULL);
 
@@ -2499,7 +2607,8 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_set_sensitive(basic.pass_label, TRUE);
                gtk_widget_set_sensitive(basic.uid_entry,  TRUE);
                gtk_widget_set_sensitive(basic.pass_entry, TRUE);
-               gtk_widget_set_sensitive(receive.pop3_frame, FALSE);
+               gtk_widget_hide(receive.pop3_frame);
+               gtk_widget_hide(receive.frame_maxarticle);
                gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
                gtk_widget_set_sensitive(basic.smtpserv_entry, TRUE);
                gtk_widget_set_sensitive(basic.smtpserv_label, TRUE);
@@ -2576,7 +2685,10 @@ static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
                gtk_widget_set_sensitive(basic.uid_entry,  TRUE);
                gtk_widget_set_sensitive(basic.pass_entry, TRUE);
                gtk_widget_set_sensitive(receive.pop3_frame, TRUE);
+               gtk_widget_show(receive.pop3_frame);
+               gtk_widget_hide(receive.frame_maxarticle);
                gtk_widget_set_sensitive(receive.recvatgetall_chkbtn, TRUE);
+
                gtk_widget_set_sensitive(basic.smtpserv_entry, TRUE);
                gtk_widget_set_sensitive(basic.smtpserv_label, TRUE);