Code cleanup around glib version check (2.28 minimum).
[claws.git] / src / wizard.c
index 6517b31b1046aeab2692e611e77e8e1aa43054b3..68da688139033b46c826472ad1defe50b365e6d8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2015 Colin Leroy <colin@colino.net>
+ * Copyright (C) 1999-2016 Colin Leroy <colin@colino.net>
  * and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
@@ -112,7 +112,7 @@ typedef struct
        GtkWidget *smtp_cert_table;
        GtkWidget *recv_cert_table;
 #endif
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        GtkWidget *auto_configure_lbl;
        GtkWidget *auto_configure_btn;
        GtkWidget *auto_configure_cancel_btn;
@@ -271,27 +271,27 @@ static gchar *accountrc_tmpl =
        "#default is \"Mail\"\n"
        "#mailbox=\n"
        "\n"
-       "#whether to use ssl on smtp connections\n"
-       "#default is 0, 1 is ssl, 2 is starttls\n"
+       "#whether to use encryption on SMTP connections\n"
+       "#default is 0, 1 is SSL/TLS, 2 is STARTTLS\n"
        "#smtpssl=\n"
        "\n"
-       "#whether to use ssl on pop or imap connections\n"
-       "#default is 0, 1 is ssl, 2 is starttls\n"
+       "#whether to use encryption on POP3 or IMAP connections\n"
+       "#default is 0, 1 is SSL/TLS, 2 is STARTTLS\n"
        "#recvssl=\n"
        "\n"
-       "#SSL client certificate path for SMTP\n"
+       "#SSL/TLS client certificate path for SMTP\n"
        "#default is empty (no certificate)\n"
        "#smtpssl_cert=\n"
        "\n"
-       "#SSL client certificate path for POP/IMAP\n"
+       "#SSL/TLS client certificate path for POP/IMAP\n"
        "#default is empty (no certificate)\n"
        "#recvssl_cert=\n"
        "\n"
-       "#SSL client certificate password for SMTP\n"
+       "#SSL/TLS client certificate password for SMTP\n"
        "#default is empty (no password)\n"
        "#smtpssl_cert_pass=\n"
        "\n"
-       "#SSL client certificate password for POP/IMAP\n"
+       "#SSL/TLS client certificate password for POP/IMAP\n"
        "#default is empty (no password)\n"
        "#recvssl_cert_pass=\n"
        ;
@@ -439,7 +439,8 @@ static void initialize_fonts(WizardWindow *wizard)
        gchar *tmp, *new;
 #ifdef G_OS_WIN32
        PangoFontDescription *bold_desc;
-       gchar *curfont = pango_font_description_to_string(widget->style->font_desc);
+       gchar *curfont = pango_font_description_to_string(
+                       gtk_widget_get_style(widget)->font_desc);
        g_free(prefs_common.smallfont);
        g_free(prefs_common.normalfont);
        g_free(prefs_common.boldfont);
@@ -505,7 +506,7 @@ static void initialize_fonts(WizardWindow *wizard)
 
 static void write_welcome_email(WizardWindow *wizard)
 {
-       gchar buf_date[64];
+       gchar date[RFC822_DATE_BUFFSIZE];
        gchar *head=NULL;
        gchar *body=NULL;
        gchar *msg=NULL;
@@ -515,7 +516,7 @@ static void write_welcome_email(WizardWindow *wizard)
        gchar *file = get_tmp_file();
        gchar enc_from_name[BUFFSIZE], enc_to_name[BUFFSIZE], enc_subject[BUFFSIZE];
        
-       get_rfc822_date(buf_date, sizeof(buf_date));
+       get_rfc822_date(date, sizeof(date));
 
        conv_encode_header_full(enc_subject, sizeof(enc_subject), 
                        C_("Welcome Mail Subject", "Welcome to Claws Mail"),
@@ -539,7 +540,7 @@ static void write_welcome_email(WizardWindow *wizard)
                USERS_ML_ADDR,
                enc_to_name,
                gtk_entry_get_text(GTK_ENTRY(wizard->email)),
-               buf_date, enc_subject, XFACE, FACE);
+               date, enc_subject, XFACE, FACE);
        body = g_strdup_printf(
                _("\n"
                "Welcome to Claws Mail\n"
@@ -568,7 +569,7 @@ static void write_welcome_email(WizardWindow *wizard)
                "-----------\n"
                "Homepage:      <%s>\n"
                "Manual:        <%s>\n"
-               "FAQ:          <%s>\n"
+               "FAQ:           <%s>\n"
                "Themes:        <%s>\n"
                "Mailing Lists: <%s>\n"
                "\n"
@@ -576,9 +577,8 @@ static void write_welcome_email(WizardWindow *wizard)
                "-------\n"
                "Claws Mail is free software, released under the terms\n"
                "of the GNU General Public License, version 3 or later, as\n"
-               "published by the Free Software Foundation, 51 Franklin Street,\n"
-               "Fifth Floor, Boston, MA 02110-1301, USA. The license can be\n"
-               "found at <%s>.\n"
+               "published by the Free Software Foundation. The license can\n"
+               "be found at <%s>.\n"
                "\n"
                "DONATIONS\n"
                "---------\n"
@@ -848,8 +848,7 @@ static GtkWidget* create_page (WizardWindow *wizard, const char * title)
 
        /* create the titlebar */
        hbox = gtk_hbox_new (FALSE, 12);
-       image = stock_pixmap_widget(wizard->window, 
-                               STOCK_PIXMAP_CLAWS_MAIL_ICON);
+       image = stock_pixmap_widget(STOCK_PIXMAP_CLAWS_MAIL_ICON);
        gtk_box_pack_start (GTK_BOX(hbox), image, FALSE, FALSE, 0);
        title_string = g_strconcat ("<span size=\"xx-large\" weight=\"ultrabold\">", title ? title : "", "</span>", NULL);
        w = gtk_label_new (title_string);
@@ -1164,7 +1163,7 @@ static GtkWidget* smtp_page (WizardWindow * wizard)
        hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
        gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
        wizard->smtp_use_ssl = gtk_check_button_new_with_label(
-                                       _("Use SSL to connect to SMTP server"));
+                                       _("Use SSL/TLS to connect to SMTP server"));
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_ssl),
                        tmpl.smtpssl != 0);
        gtk_box_pack_start(GTK_BOX(hbox), wizard->smtp_use_ssl, FALSE, FALSE, 0);
@@ -1175,7 +1174,7 @@ static GtkWidget* smtp_page (WizardWindow * wizard)
        gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
        gtk_widget_set_size_request (hbox_spc, 12, -1);
        wizard->smtp_use_tls = gtk_check_button_new_with_label(
-                                       _("Use SSL via STARTTLS"));
+                                       _("Use STARTTLS command to start encryption"));
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->smtp_use_tls),
                        tmpl.smtpssl == 2);
        gtk_box_pack_start(GTK_BOX(hbox), wizard->smtp_use_tls, FALSE, FALSE, 0);
@@ -1187,7 +1186,7 @@ static GtkWidget* smtp_page (WizardWindow * wizard)
        hbox_spc = gtk_hbox_new (FALSE, 0);
        gtk_widget_set_size_request (hbox_spc, 12, -1);
        gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
-       label = gtk_label_new(_("Client SSL certificate (optional)"));
+       label = gtk_label_new(_("Client SSL/TLS certificate (optional)"));
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
        gtk_table_attach(GTK_TABLE(smtp_cert_table), hbox, 0, 3, 0, 1, GTK_FILL, 0, 0, 0);
@@ -1249,7 +1248,7 @@ static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
                gtk_widget_show(wizard->recv_use_tls);
                gtk_widget_show(wizard->recv_cert_table);
 #endif
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
                gtk_widget_show(wizard->auto_configure_btn);
                gtk_widget_hide(wizard->auto_configure_cancel_btn);
                gtk_widget_show(wizard->auto_configure_lbl);
@@ -1281,7 +1280,7 @@ static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
                gtk_widget_show(wizard->recv_use_tls);
                gtk_widget_show(wizard->recv_cert_table);
 #endif
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
                gtk_widget_show(wizard->auto_configure_btn);
                gtk_widget_hide(wizard->auto_configure_cancel_btn);
                gtk_widget_show(wizard->auto_configure_lbl);
@@ -1330,7 +1329,7 @@ static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
                gtk_widget_hide(wizard->recv_password);
                gtk_widget_hide(wizard->recv_username_label);
                gtk_widget_hide(wizard->recv_password_label);
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
                gtk_widget_hide(wizard->auto_configure_btn);
                gtk_widget_hide(wizard->auto_configure_cancel_btn);
                gtk_widget_hide(wizard->auto_configure_lbl);
@@ -1356,7 +1355,7 @@ static void wizard_protocol_changed(GtkComboBox *combo, gpointer data)
        wizard_protocol_change(wizard, protocol);       
 }
 
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
 static void auto_configure_cb (GtkWidget *widget, gpointer data)
 {
        gchar *address = NULL;
@@ -1465,7 +1464,7 @@ static GtkWidget* recv_page (WizardWindow * wizard)
        GtkWidget *button;
        GtkWidget *recv_cert_table;
 #endif
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        GtkWidget *auto_configure_btn;
        GtkWidget *auto_configure_cancel_btn;
        GtkWidget *auto_configure_lbl;
@@ -1521,7 +1520,7 @@ static GtkWidget* recv_page (WizardWindow * wizard)
        gtk_table_attach(GTK_TABLE(recv_table), wizard->recv_type, 1,2,0,1, 
                         GTK_EXPAND|GTK_FILL, 0, 0, 0);
 
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        auto_configure_btn = gtk_button_new_with_label(_("Auto-configure"));
        auto_configure_cancel_btn = gtk_button_new_with_label(_("Cancel"));
        gtk_table_attach(GTK_TABLE(recv_table), auto_configure_btn, 0,1,1,2,
@@ -1584,7 +1583,7 @@ static GtkWidget* recv_page (WizardWindow * wizard)
        hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
        gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
        wizard->recv_use_ssl = gtk_check_button_new_with_label(
-                                       _("Use SSL to connect to receiving server"));
+                                       _("Use SSL/TLS to connect to receiving server"));
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->recv_use_ssl),
                        tmpl.recvssl != 0);
        gtk_box_pack_start(GTK_BOX(hbox), wizard->recv_use_ssl, FALSE, FALSE, 0);
@@ -1595,7 +1594,7 @@ static GtkWidget* recv_page (WizardWindow * wizard)
        gtk_widget_set_size_request (hbox_spc, 12, -1);
        gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0); 
        wizard->recv_use_tls = gtk_check_button_new_with_label(
-                                       _("Use SSL via STARTTLS"));
+                                       _("Use STARTTLS command to start encryption"));
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(wizard->recv_use_tls),
                        tmpl.recvssl == 2);
        gtk_box_pack_start(GTK_BOX(hbox), wizard->recv_use_tls, FALSE, FALSE, 0);
@@ -1607,7 +1606,7 @@ static GtkWidget* recv_page (WizardWindow * wizard)
        hbox_spc = gtk_hbox_new (FALSE, 0);
        gtk_widget_set_size_request (hbox_spc, 12, -1);
        gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
-       label = gtk_label_new(_("Client SSL certificate (optional)"));
+       label = gtk_label_new(_("Client SSL/TLS certificate (optional)"));
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);    
        gtk_table_attach(GTK_TABLE(recv_cert_table), hbox, 0, 3, 0, 1, GTK_FILL, 0, 0, 0);
@@ -1793,7 +1792,6 @@ gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) {
                        GTK_STOCK_SAVE, FINISHED,
                        GTK_STOCK_CANCEL, CANCEL,
                        NULL);
-       gtk_widget_set_size_request(wizard->window, -1, 480);
        gtk_window_set_position(GTK_WINDOW(wizard->window), GTK_WIN_POS_CENTER);
 
        g_signal_connect(wizard->window, "response", 
@@ -1823,8 +1821,7 @@ gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) {
        page = create_page(wizard, _("Welcome to Claws Mail"));
        
        wizard->pages = g_slist_append(wizard->pages, page);
-       widget = stock_pixmap_widget(wizard->window, 
-                               STOCK_PIXMAP_CLAWS_MAIL_LOGO);
+       widget = stock_pixmap_widget(STOCK_PIXMAP_CLAWS_MAIL_LOGO);
 
        gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
        
@@ -1906,8 +1903,7 @@ gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) {
        page = create_page(wizard, _("Configuration finished"));
        
        wizard->pages = g_slist_append(wizard->pages, page);
-       widget = stock_pixmap_widget(wizard->window, 
-                               STOCK_PIXMAP_CLAWS_MAIL_LOGO);
+       widget = stock_pixmap_widget(STOCK_PIXMAP_CLAWS_MAIL_LOGO);
 
        gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
        
@@ -1930,7 +1926,7 @@ gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) {
        gtk_widget_hide(wizard->recv_imap_label);
        gtk_widget_hide(wizard->recv_imap_subdir);
        gtk_widget_hide(wizard->subsonly_checkbtn);
-#if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
+#if defined USE_GNUTLS
        gtk_widget_hide(wizard->auto_configure_cancel_btn);
 #endif
        wizard_protocol_change(wizard, tmpl.recvtype);