2008-09-24 [colin] 3.5.0cvs125
[claws.git] / src / wizard.c
index 07bdd1aa2471b36b812c32cffc3c6ba0f3a7a91b..031e565a6ad4aed6d57513efe73920fcfe0a194e 100644 (file)
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtknotebook.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkcheckbutton.h>
 #include <gtk/gtk.h>
 
 #include <stdio.h>
 #include "setup.h"
 #include "folder.h"
 #include "alertpanel.h"
-#ifdef USE_OPENSSL                     
+#include "filesel.h"
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
 #include "ssl.h"
 #endif
 #include "prefs_common.h"
+#include "combobox.h"
+
+#ifdef MAEMO
+#include <libgnomevfs/gnome-vfs-volume.h>
+#include <libgnomevfs/gnome-vfs-volume-monitor.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
+#endif
 
 typedef enum
 {
@@ -90,6 +89,7 @@ typedef struct
        GtkWidget *organization;
 
        GtkWidget *mailbox_name;
+       GtkWidget *mailbox_label;
        
        GtkWidget *smtp_server;
        GtkWidget *smtp_auth;
@@ -109,13 +109,29 @@ typedef struct
        GtkWidget *recv_imap_subdir;
        GtkWidget *subsonly_checkbtn;
        GtkWidget *no_imap_warning;
-#ifdef USE_OPENSSL
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
        GtkWidget *smtp_use_ssl;
        GtkWidget *recv_use_ssl;
        GtkWidget *smtp_use_tls;
        GtkWidget *recv_use_tls;
+       GtkWidget *smtp_ssl_cert_file;
+       GtkWidget *recv_ssl_cert_file;
+       GtkWidget *smtp_ssl_cert_pass;
+       GtkWidget *recv_ssl_cert_pass;
+       GtkWidget *smtp_cert_table;
+       GtkWidget *recv_cert_table;
 #endif
-       
+
+#ifdef MAEMO
+       GtkWidget *data_root_nokia_radiobtn;
+       GtkWidget *data_root_mmc1_radiobtn;
+       GtkWidget *data_root_mmc2_radiobtn;
+       GnomeVFSVolumeMonitor *volmon;
+       gulong volmon_mount_sigid;
+       gulong volmon_unmount_sigid;
+       GnomeVFSVolume *vol_mmc1;
+       GnomeVFSVolume *vol_mmc2;
+#endif 
        gboolean create_mailbox;
        gboolean finished;
        gboolean result;
@@ -141,6 +157,10 @@ typedef struct _AccountTemplate {
        gchar *mailbox;
        gboolean smtpssl;
        gboolean recvssl;
+       gchar *smtpssl_cert;
+       gchar *recvssl_cert;
+       gchar *smtpssl_cert_pass;
+       gchar *recvssl_cert_pass;
 } AccountTemplate;
 
 static AccountTemplate tmpl;
@@ -182,6 +202,14 @@ static PrefParam template_params[] = {
         &tmpl.smtpssl, P_INT, NULL, NULL, NULL},
        {"recvssl", "0",
         &tmpl.recvssl, P_INT, NULL, NULL, NULL},
+       {"smtpssl_cert", "",
+        &tmpl.smtpssl_cert, P_STRING, NULL, NULL, NULL},
+       {"recvssl_cert", "",
+        &tmpl.recvssl_cert, P_STRING, NULL, NULL, NULL},
+       {"smtpssl_cert_pass", "",
+        &tmpl.smtpssl_cert, P_STRING, NULL, NULL, NULL},
+       {"recvssl_cert_pass", "",
+        &tmpl.recvssl_cert, P_STRING, NULL, NULL, NULL},
        {NULL, NULL, NULL, P_INT, NULL, NULL, NULL}
 };
 
@@ -207,7 +235,7 @@ static gchar *accountrc_tmpl =
        "#organization=\n"
        "\n"
        "#you can use $DOMAIN here \n"
-       "#the default is stmp.$DOMAIN\n"
+       "#the default is smtp.$DOMAIN\n"
        "#smtpserver=\n"
        "\n"
        "#Whether to use smtp authentication\n"
@@ -258,13 +286,30 @@ static gchar *accountrc_tmpl =
        "#default is \"Mail\"\n"
        "#mailbox=\n"
        "\n"
-       "#whether to use ssl on STMP connections\n"
+       "#whether to use ssl on smtp connections\n"
        "#default is 0, 1 is ssl, 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"
-       "#recvssl=\n";
+       "#recvssl=\n"
+       "\n"
+       "#SSL client certificate path for SMTP\n"
+       "#default is empty (no certificate)\n"
+       "#smtpssl_cert=\n"
+       "\n"
+       "#SSL client certificate path for POP/IMAP\n"
+       "#default is empty (no certificate)\n"
+       "#recvssl_cert=\n"
+       "\n"
+       "#SSL 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"
+       "#default is empty (no password)\n"
+       "#recvssl_cert_pass=\n"
+       ;
 
 static gchar *wizard_get_default_domain_name(void)
 {
@@ -284,10 +329,10 @@ static gchar *wizard_get_default_domain_name(void)
 
 static gchar *get_name_for_mail(void)
 {
-       gchar *name = g_strdup(tmpl.name);
-       if (name == NULL)
+       gchar *name = NULL;
+       if (tmpl.name == NULL)
                return NULL;
-       g_strdown(name);
+       name = g_utf8_strdown(tmpl.name, -1);
        while(strstr(name, " "))
                *strstr(name, " ")='.';
        
@@ -391,7 +436,7 @@ static void wizard_read_defaults(void)
        PARSE_DEFAULT(tmpl.mboxfile);
        PARSE_DEFAULT(tmpl.mailbox);
 /*
-       printf("defaults:"
+       g_print("defaults:"
        "%s, %s, %s, %s, %s, %d, %s, %s, %s, %s, %s, %s, %d, %d\n",
        tmpl.name,tmpl.domain,tmpl.email,tmpl.organization,tmpl.smtpserver,
        tmpl.recvtype,tmpl.recvserver,tmpl.recvuser,tmpl.recvpass,
@@ -407,7 +452,20 @@ static void initialize_fonts(WizardWindow *wizard)
                        widget->style->font_desc)
                      /PANGO_SCALE;
        gchar *tmp, *new;
-       
+#ifdef G_OS_WIN32
+       PangoFontDescription *bold_desc;
+       gchar *curfont = pango_font_description_to_string(widget->style->font_desc);
+       g_free(prefs_common.smallfont);
+       g_free(prefs_common.normalfont);
+       g_free(prefs_common.boldfont);
+       prefs_common.smallfont = g_strdup(curfont);
+       prefs_common.normalfont = g_strdup(curfont);
+       bold_desc = pango_font_description_from_string(curfont);
+       pango_font_description_set_weight(bold_desc, PANGO_WEIGHT_BOLD);
+       prefs_common.boldfont = pango_font_description_to_string(bold_desc);
+       pango_font_description_free(bold_desc);
+       g_free(curfont);
+#endif 
        tmp = g_strdup(prefs_common.textfont);
        if (strrchr(tmp, ' ')) {
                *(strrchr(tmp, ' ')) = '\0';
@@ -434,6 +492,15 @@ static void initialize_fonts(WizardWindow *wizard)
                prefs_common.normalfont = new;
        }
        g_free(tmp);
+
+       tmp = g_strdup(prefs_common.boldfont);
+       if (strrchr(tmp, ' ')) {
+               *(strrchr(tmp, ' ')) = '\0';
+               new = g_strdup_printf("%s %d", tmp, size);
+               g_free(prefs_common.boldfont);
+               prefs_common.boldfont = new;
+       }
+       g_free(tmp);
 }
 
 #define XFACE "+}Axz@~a,-Yx?0Ysa|q}CLRH=89Y]\"')DSX^<6p\"d)'81yx5%G#u^o*7JG&[aPU0h1Ux.vb2yIjH83{5`/bVo|~nn/i83vE^E)qk-4W)_E.4Y=D*qvf/,Ci_=P<iY<M6"
@@ -545,7 +612,7 @@ static void write_welcome_email(WizardWindow *wizard)
        g_free(head);
        g_free(body);
        g_free(msg);
-       g_unlink(file);
+       claws_unlink(file);
 }
 #undef XFACE
 
@@ -554,19 +621,14 @@ static gboolean wizard_write_config(WizardWindow *wizard)
        static gboolean mailbox_ok = FALSE;
        PrefsAccount *prefs_account = prefs_account_new();
        GList *account_list = NULL;
-       GtkWidget *menu, *menuitem;
        gchar *smtp_server, *recv_server;
-       gchar *tmp;
        gint smtp_port, recv_port;
-#ifdef USE_OPENSSL                     
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
        SSLType smtp_ssl_type, recv_ssl_type;
 #endif
 
-       menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(wizard->recv_type));
-       menuitem = gtk_menu_get_active(GTK_MENU(menu));
-       prefs_account->protocol = GPOINTER_TO_INT
-                       (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
-       
+       prefs_account->protocol = combobox_get_active_data(
+                                       GTK_COMBO_BOX(wizard->recv_type));
        
        if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4 && 
            !strlen(gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name)))) {
@@ -578,6 +640,21 @@ static gboolean wizard_write_config(WizardWindow *wizard)
                return FALSE;
        }
 
+#ifdef MAEMO
+       if (wizard->create_mailbox) {
+               g_free(prefs_common.data_root);
+               if (gtk_toggle_button_get_active(
+                       GTK_TOGGLE_BUTTON(wizard->data_root_nokia_radiobtn)))
+                       prefs_common.data_root = NULL;
+               else if (gtk_toggle_button_get_active(
+                       GTK_TOGGLE_BUTTON(wizard->data_root_mmc1_radiobtn)))
+                       prefs_common.data_root = g_strdup(MMC1_PATH);
+               else if (gtk_toggle_button_get_active(
+                       GTK_TOGGLE_BUTTON(wizard->data_root_mmc2_radiobtn)))
+                       prefs_common.data_root = g_strdup(MMC2_PATH);
+       }
+#endif
+
        if (!mailbox_ok) {
                if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4) {
                        mailbox_ok = setup_write_mailbox_path(wizard->mainwin, 
@@ -686,12 +763,19 @@ static gboolean wizard_write_config(WizardWindow *wizard)
                                gtk_entry_get_text(GTK_ENTRY(wizard->organization)));
        prefs_account->smtp_server = g_strdup(smtp_server);
 
-       tmp = g_path_get_basename(gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name)));
-       prefs_account->inbox = g_strdup_printf("#mh/%s/inbox",
+       if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4) {
+               gchar *tmp;
+               tmp = g_path_get_basename(gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name)));
+               prefs_account->inbox = g_strdup_printf("#mh/%s/inbox",
                        (!strcmp("Mail", gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name))))
                                ?_("Mailbox"):tmp);
-       g_free(tmp);
-       prefs_account->local_inbox = g_strdup(prefs_account->inbox);
+               g_free(tmp);
+               prefs_account->local_inbox = g_strdup(prefs_account->inbox);
+       } else if (prefs_account->protocol != A_IMAP4) {
+               if (folder_get_default_inbox())
+                       prefs_account->local_inbox = 
+                               folder_item_get_identifier(folder_get_default_inbox());
+       }
 
        if (prefs_account->protocol != A_LOCAL)
                prefs_account->recv_server = g_strdup(recv_server);
@@ -714,7 +798,7 @@ static gboolean wizard_write_config(WizardWindow *wizard)
                prefs_account->use_smtp_auth = TRUE;
        }
 
-#ifdef USE_OPENSSL
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
        smtp_ssl_type = SSL_NONE;
        recv_ssl_type = SSL_NONE;       
 
@@ -738,6 +822,14 @@ static gboolean wizard_write_config(WizardWindow *wizard)
        else
                prefs_account->ssl_pop = recv_ssl_type;
 
+       prefs_account->out_ssl_client_cert_file = g_strdup(
+                               gtk_entry_get_text(GTK_ENTRY(wizard->smtp_ssl_cert_file)));
+       prefs_account->out_ssl_client_cert_pass = g_strdup(
+                               gtk_entry_get_text(GTK_ENTRY(wizard->smtp_ssl_cert_pass)));
+       prefs_account->in_ssl_client_cert_file = g_strdup(
+                               gtk_entry_get_text(GTK_ENTRY(wizard->recv_ssl_cert_file)));
+       prefs_account->in_ssl_client_cert_pass = g_strdup(
+                               gtk_entry_get_text(GTK_ENTRY(wizard->recv_ssl_cert_pass)));
 #endif
        if (prefs_account->protocol == A_IMAP4) {
                gchar *directory = gtk_editable_get_chars(
@@ -759,7 +851,18 @@ static gboolean wizard_write_config(WizardWindow *wizard)
        initialize_fonts(wizard);
        if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4)
                write_welcome_email(wizard);
-       
+
+#ifdef MAEMO
+       if (wizard->volmon_mount_sigid)
+               g_signal_handler_disconnect(
+                                       G_OBJECT(wizard->volmon),
+                                       wizard->volmon_mount_sigid);
+       if (wizard->volmon_unmount_sigid)
+               g_signal_handler_disconnect(
+                                       G_OBJECT(wizard->volmon),
+                                       wizard->volmon_unmount_sigid);
+#endif
+
 #ifndef G_OS_WIN32 
        plugin_load_standard_plugins();
 #endif
@@ -860,8 +963,7 @@ static void wizard_email_changed(GtkWidget *widget, gpointer data)
        WizardWindow *wizard = (WizardWindow *)data;
        RecvProtocol protocol;
        gchar *text;
-       protocol = GPOINTER_TO_INT
-               (g_object_get_data(G_OBJECT(wizard->recv_type), MENU_VAL_ID));
+       protocol = combobox_get_active_data(GTK_COMBO_BOX(wizard->recv_type));
        
        text = get_default_server(wizard, "smtp");
        gtk_entry_set_text(GTK_ENTRY(wizard->smtp_server), text);
@@ -926,12 +1028,87 @@ static GtkWidget* user_page (WizardWindow * wizard)
        return table;
 }
 
+#ifdef MAEMO
+static void wizard_vol_mount_cb(GnomeVFSVolumeMonitor *vfs, GnomeVFSVolume *vol, WizardWindow *wizard)
+{
+       gchar *uri = gnome_vfs_volume_get_activation_uri (vol);
+       gchar *mount_path = uri?gnome_vfs_get_local_path_from_uri (uri):NULL;
+       g_free (uri);
+       if (mount_path) {
+               if(!strcmp(mount_path, MMC1_PATH)) {
+                       gtk_widget_set_sensitive(wizard->data_root_mmc1_radiobtn, TRUE);
+               }
+               if(!strcmp(mount_path, MMC2_PATH)) {
+                       gtk_widget_set_sensitive(wizard->data_root_mmc2_radiobtn, TRUE);
+               }
+       }
+       g_free(mount_path);
+}
+static void wizard_vol_unmount_cb(GnomeVFSVolumeMonitor *vfs, GnomeVFSVolume *vol, WizardWindow *wizard)
+{
+       gchar *uri = gnome_vfs_volume_get_activation_uri (vol);
+       gchar *mount_path = uri?gnome_vfs_get_local_path_from_uri (uri):NULL;
+       g_free (uri);
+       if (mount_path) {
+               if(!strcmp(mount_path, MMC1_PATH)) {
+                       gtk_widget_set_sensitive(wizard->data_root_mmc1_radiobtn, FALSE);
+                       if (gtk_toggle_button_get_active(
+                               GTK_TOGGLE_BUTTON(wizard->data_root_mmc1_radiobtn))) {
+                               gtk_toggle_button_set_active(
+                                       GTK_TOGGLE_BUTTON(wizard->data_root_nokia_radiobtn), TRUE);
+                       }
+               }
+               if(!strcmp(mount_path, MMC2_PATH)) {
+                       gtk_widget_set_sensitive(wizard->data_root_mmc2_radiobtn, FALSE);
+                       if (gtk_toggle_button_get_active(
+                               GTK_TOGGLE_BUTTON(wizard->data_root_mmc2_radiobtn))) {
+                               gtk_toggle_button_set_active(
+                                       GTK_TOGGLE_BUTTON(wizard->data_root_nokia_radiobtn), TRUE);
+                       }
+               }
+       }
+       g_free(mount_path);
+}
+
+void data_root_changed         (GtkToggleButton        *toggle_btn,
+                                WizardWindow *wizard)
+{
+       gchar *name = g_path_get_basename(gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name)));
+       gchar *path = NULL;
+       if (gtk_toggle_button_get_active(
+               GTK_TOGGLE_BUTTON(wizard->data_root_nokia_radiobtn)))
+               gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), name);
+       else if (gtk_toggle_button_get_active(
+               GTK_TOGGLE_BUTTON(wizard->data_root_mmc1_radiobtn))) {
+               path = g_strconcat(MMC1_PATH, G_DIR_SEPARATOR_S, 
+                                 "Claws", G_DIR_SEPARATOR_S, 
+                                 g_get_user_name(), G_DIR_SEPARATOR_S,
+                                 name, NULL);
+               gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), path);
+               g_free(path);
+       } else if (gtk_toggle_button_get_active(
+               GTK_TOGGLE_BUTTON(wizard->data_root_mmc2_radiobtn))) {
+               path = g_strconcat(MMC2_PATH, G_DIR_SEPARATOR_S, 
+                                 "Claws", G_DIR_SEPARATOR_S, 
+                                 g_get_user_name(), G_DIR_SEPARATOR_S,
+                                 name, NULL);
+               gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), path);
+               g_free(path);
+       }
+       g_free(name);
+}
+#endif
+
 static GtkWidget* mailbox_page (WizardWindow * wizard)
 {
        GtkWidget *table = gtk_table_new(1,1, FALSE);
        GtkWidget *vbox;
+#ifdef MAEMO
+       GtkWidget *vbox2;
+       gchar *uri, *mount_path;
+#endif
        GtkWidget *hbox;
-       GtkTooltips *tips = gtk_tooltips_new();
+       CLAWS_TIP_DECL();
 
        gtk_table_set_row_spacings(GTK_TABLE(table), 4);
        gtk_table_set_col_spacings(GTK_TABLE(table), 8);
@@ -944,17 +1121,83 @@ static GtkWidget* mailbox_page (WizardWindow * wizard)
 
        hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
        gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+
+       wizard->mailbox_label = gtk_label_new(_("<span weight=\"bold\">Mailbox name:</span>"));
+       gtk_label_set_use_markup(GTK_LABEL(wizard->mailbox_label), TRUE);
+       if (GTK_IS_MISC(wizard->mailbox_label))                                               
+               gtk_misc_set_alignment(GTK_MISC(wizard->mailbox_label), 1, 0.5);              
        wizard->mailbox_name = gtk_entry_new();
-       gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), tmpl.mailbox?tmpl.mailbox:"");
 
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), wizard->mailbox_name,
-                            _("You can also specify an absolute path, for example: "
-                              "\"/home/john/Documents/Mail\""),
-                            NULL);
+       gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), tmpl.mailbox?tmpl.mailbox:"");
 
-       PACK_BOX(hbox, _("<span weight=\"bold\">Mailbox name:</span>"),
-                wizard->mailbox_name);
+       CLAWS_SET_TIP(wizard->mailbox_name, _("You can also specify an absolute path, for example: "
+                              "\"/home/john/Documents/Mail\""));
+
+       gtk_box_pack_start(GTK_BOX(hbox), wizard->mailbox_label, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(hbox), wizard->mailbox_name, TRUE, TRUE, 0);
+
+#ifdef MAEMO
+       wizard->data_root_nokia_radiobtn = gtk_radio_button_new_with_label(NULL,
+               _("on internal memory"));
+       wizard->data_root_mmc1_radiobtn = gtk_radio_button_new_with_label_from_widget(
+               GTK_RADIO_BUTTON(wizard->data_root_nokia_radiobtn),
+               _("on external memory card"));
+       wizard->data_root_mmc2_radiobtn = gtk_radio_button_new_with_label_from_widget(
+               GTK_RADIO_BUTTON(wizard->data_root_nokia_radiobtn),
+               _("on internal memory card"));
+               
+       g_signal_connect(G_OBJECT(wizard->data_root_nokia_radiobtn), "toggled",
+                        G_CALLBACK(data_root_changed), wizard);
+       g_signal_connect(G_OBJECT(wizard->data_root_mmc1_radiobtn), "toggled",
+                        G_CALLBACK(data_root_changed), wizard);
+       g_signal_connect(G_OBJECT(wizard->data_root_mmc2_radiobtn), "toggled",
+                        G_CALLBACK(data_root_changed), wizard);
+
+       wizard->volmon = gnome_vfs_get_volume_monitor();
+       wizard->vol_mmc1 = gnome_vfs_volume_monitor_get_volume_for_path(wizard->volmon, MMC1_PATH);
+       wizard->vol_mmc2 = gnome_vfs_volume_monitor_get_volume_for_path(wizard->volmon, MMC2_PATH);
+
+       uri = gnome_vfs_volume_get_activation_uri (wizard->vol_mmc1);
+       mount_path = uri?gnome_vfs_get_local_path_from_uri (uri):NULL;
+       g_free(uri);
+       if (wizard->vol_mmc1 == NULL || !gnome_vfs_volume_is_mounted(wizard->vol_mmc1)
+           || strcmp(mount_path, MMC1_PATH)) {
+               gtk_widget_set_sensitive(wizard->data_root_mmc1_radiobtn, FALSE);
+       }
+       g_free(mount_path);
+
+       uri = gnome_vfs_volume_get_activation_uri (wizard->vol_mmc2);
+       mount_path = uri?gnome_vfs_get_local_path_from_uri (uri):NULL;
+       g_free(uri);
+       if (wizard->vol_mmc2 == NULL || !gnome_vfs_volume_is_mounted(wizard->vol_mmc2)
+           || strcmp(mount_path, MMC2_PATH)) {
+               gtk_widget_set_sensitive(wizard->data_root_mmc2_radiobtn, FALSE);
+       } else {
+               gtk_toggle_button_set_active(wizard->data_root_mmc2_radiobtn, TRUE);
+       }
+       g_free(mount_path);
        
+       gnome_vfs_volume_unref(wizard->vol_mmc1);
+       gnome_vfs_volume_unref(wizard->vol_mmc2);
+       wizard->vol_mmc1 = NULL;
+       wizard->vol_mmc2 = NULL;
+
+       wizard->volmon_mount_sigid = g_signal_connect(G_OBJECT(wizard->volmon), 
+                                       "volume-mounted", G_CALLBACK(wizard_vol_mount_cb), wizard);
+       wizard->volmon_unmount_sigid = g_signal_connect(G_OBJECT(wizard->volmon), 
+                                       "volume-unmounted", G_CALLBACK(wizard_vol_unmount_cb), wizard);
+
+       vbox2 = gtk_vbox_new(FALSE, VSPACING_NARROW);
+       gtk_box_pack_start (GTK_BOX(vbox2), wizard->data_root_nokia_radiobtn, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX(vbox2), wizard->data_root_mmc1_radiobtn, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX(vbox2), wizard->data_root_mmc2_radiobtn, FALSE, FALSE, 0);
+
+       hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
+       gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+       PACK_BOX(hbox, _("<span weight=\"bold\">Store data</span>"),
+                vbox2);
+#endif
+
        return table;
 }
 
@@ -969,13 +1212,38 @@ static void smtp_auth_changed (GtkWidget *btn, gpointer data)
        gtk_widget_set_sensitive(wizard->smtp_password_label, do_auth);
 }
 
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
+static void cert_browse_cb(GtkWidget *widget, gpointer data)
+{
+       GtkEntry *dest = GTK_ENTRY(data);
+       gchar *filename;
+       gchar *utf8_filename;
+
+       filename = filesel_select_file_open(_("Select certificate file"), NULL);
+       if (!filename) return;
+
+       utf8_filename = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
+       if (!utf8_filename) {
+               g_warning("cert_browse_cb(): failed to convert character set.");
+               utf8_filename = g_strdup(filename);
+       }
+       gtk_entry_set_text(dest, utf8_filename);
+       g_free(utf8_filename);
+}
+#endif
+
 static GtkWidget* smtp_page (WizardWindow * wizard)
 {
        GtkWidget *table = gtk_table_new(1, 1, FALSE);
        GtkWidget *vbox;
        GtkWidget *hbox;
-       GtkTooltips *tips = gtk_tooltips_new();
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
+       GtkWidget *label;
+       GtkWidget *button;
+       GtkWidget *smtp_cert_table;
+#endif
        gchar *text;
+       CLAWS_TIP_DECL();
        
        gtk_table_set_row_spacings(GTK_TABLE(table), 4);
        gtk_table_set_col_spacings(GTK_TABLE(table), 8);
@@ -993,10 +1261,9 @@ static GtkWidget* smtp_page (WizardWindow * wizard)
        gtk_entry_set_text(GTK_ENTRY(wizard->smtp_server), text);
        g_free(text);
 
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), wizard->smtp_server,
+       CLAWS_SET_TIP(wizard->smtp_server,
                             _("You can specify the port number by appending it at the end: "
-                              "\"mail.example.com:25\""),
-                            NULL);
+                              "\"mail.example.com:25\""));
 
        PACK_BOX(hbox, _("<span weight=\"bold\">SMTP server address:</span>"),
                 wizard->smtp_server);
@@ -1033,6 +1300,10 @@ static GtkWidget* smtp_page (WizardWindow * wizard)
        wizard->smtp_password = gtk_entry_new();
        gtk_entry_set_text(GTK_ENTRY(wizard->smtp_password), tmpl.smtppass?tmpl.smtppass:""); 
        gtk_entry_set_visibility(GTK_ENTRY(wizard->smtp_password), FALSE);
+#ifdef MAEMO
+       hildon_gtk_entry_set_input_mode(GTK_ENTRY(wizard->smtp_password), 
+               HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE);
+#endif
        wizard->smtp_password_label = gtk_label_new(_("SMTP password:\n"
                                        "<span size=\"small\">(empty to use the same as receive)</span>"));
        gtk_label_set_use_markup(GTK_LABEL(wizard->smtp_password_label), TRUE);
@@ -1040,7 +1311,7 @@ static GtkWidget* smtp_page (WizardWindow * wizard)
                gtk_misc_set_alignment(GTK_MISC(wizard->smtp_password_label), 1, 0.5);        
        gtk_box_pack_start(GTK_BOX(hbox), wizard->smtp_password_label, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), wizard->smtp_password, TRUE, TRUE, 0);
-#ifdef USE_OPENSSL
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
        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(
@@ -1057,6 +1328,39 @@ static GtkWidget* smtp_page (WizardWindow * wizard)
                        tmpl.smtpssl == 2);
        gtk_box_pack_start(GTK_BOX(hbox), wizard->smtp_use_tls, FALSE, FALSE, 0);
        SET_TOGGLE_SENSITIVITY (wizard->smtp_use_ssl, wizard->smtp_use_tls);
+       
+       smtp_cert_table = gtk_table_new(3,3, FALSE);
+       gtk_container_set_border_width(GTK_CONTAINER(smtp_cert_table), 8);
+       gtk_box_pack_start (GTK_BOX(vbox), smtp_cert_table, FALSE, FALSE, 0);
+       label = gtk_label_new(_("Client SSL certificate (optional)"));
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+       gtk_table_attach(GTK_TABLE(smtp_cert_table), label, 0, 3, 0, 1, GTK_FILL, 0, 0, 0);
+       label = gtk_label_new(_("File"));
+       gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
+       gtk_table_attach(GTK_TABLE(smtp_cert_table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
+       wizard->smtp_ssl_cert_file = gtk_entry_new();
+       gtk_entry_set_text(GTK_ENTRY(wizard->smtp_ssl_cert_file), tmpl.smtpssl_cert?tmpl.smtpssl_cert:"");
+       gtk_table_attach(GTK_TABLE(smtp_cert_table), wizard->smtp_ssl_cert_file, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
+       button = gtkut_get_browse_file_btn(_("Browse"));
+       gtk_table_attach(GTK_TABLE(smtp_cert_table), button, 2, 3, 1, 2, GTK_FILL, 0, 0, 0);
+       SET_TOGGLE_SENSITIVITY (wizard->smtp_use_ssl, label);
+       SET_TOGGLE_SENSITIVITY (wizard->smtp_use_ssl, wizard->smtp_ssl_cert_file);
+       SET_TOGGLE_SENSITIVITY (wizard->smtp_use_ssl, button);
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(cert_browse_cb), wizard->smtp_ssl_cert_file);
+
+       hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
+       gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+       label = gtk_label_new(_("Password"));
+       gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
+       gtk_table_attach(GTK_TABLE(smtp_cert_table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
+       wizard->smtp_ssl_cert_pass = gtk_entry_new();
+       gtk_entry_set_visibility(GTK_ENTRY(wizard->smtp_ssl_cert_pass), FALSE);
+       gtk_entry_set_text(GTK_ENTRY(wizard->smtp_ssl_cert_pass), tmpl.smtpssl_cert_pass?tmpl.smtpssl_cert_pass:"");
+       gtk_table_attach(GTK_TABLE(smtp_cert_table), wizard->smtp_ssl_cert_pass, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
+       SET_TOGGLE_SENSITIVITY (wizard->smtp_use_ssl, label);
+       SET_TOGGLE_SENSITIVITY (wizard->smtp_use_ssl, wizard->smtp_ssl_cert_pass);
+       wizard->smtp_cert_table = smtp_cert_table;
 #endif
        smtp_auth_changed(NULL, wizard);
        return table;
@@ -1077,14 +1381,19 @@ static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
                gtk_widget_show(wizard->recv_username_label);
                gtk_widget_show(wizard->recv_password_label);
                gtk_widget_hide(wizard->no_imap_warning);
-#ifdef USE_OPENSSL
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
                gtk_widget_show(wizard->recv_use_ssl);
                gtk_widget_show(wizard->recv_use_tls);
+               gtk_widget_show(wizard->recv_cert_table);
 #endif
                gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Server address:</span>"));
                gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
                gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
                g_free(text);
+               if (wizard->create_mailbox) {
+                       gtk_widget_show(wizard->mailbox_label);
+                       gtk_widget_show(wizard->mailbox_name);
+               }
        } else if (protocol == A_IMAP4) {
 #ifdef HAVE_LIBETPAN
                text = get_default_server(wizard, "imap");
@@ -1097,14 +1406,19 @@ static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
                gtk_widget_show(wizard->recv_username_label);
                gtk_widget_show(wizard->recv_password_label);
                gtk_widget_hide(wizard->no_imap_warning);
-#ifdef USE_OPENSSL
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
                gtk_widget_show(wizard->recv_use_ssl);
                gtk_widget_show(wizard->recv_use_tls);
+               gtk_widget_show(wizard->recv_cert_table);
 #endif
                gtk_label_set_text(GTK_LABEL(wizard->recv_label), _("<span weight=\"bold\">Server address:</span>"));
                gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
                gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
                g_free(text);
+               if (wizard->create_mailbox) {
+                       gtk_widget_hide(wizard->mailbox_label);
+                       gtk_widget_hide(wizard->mailbox_name);
+               }
 #else
                gtk_widget_hide(wizard->recv_imap_label);
                gtk_widget_hide(wizard->recv_imap_subdir);
@@ -1114,9 +1428,14 @@ static void wizard_protocol_change(WizardWindow *wizard, RecvProtocol protocol)
                gtk_widget_hide(wizard->recv_username_label);
                gtk_widget_hide(wizard->recv_password_label);
                gtk_widget_show(wizard->no_imap_warning);
-#ifdef USE_OPENSSL
+               if (wizard->create_mailbox) {
+                       gtk_widget_hide(wizard->mailbox_label);
+                       gtk_widget_hide(wizard->mailbox_name);
+               }
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
                gtk_widget_hide(wizard->recv_use_ssl);
                gtk_widget_hide(wizard->recv_use_tls);
+               gtk_widget_hide(wizard->recv_cert_table);
 #endif
                gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, FALSE);
 #endif
@@ -1132,20 +1451,23 @@ 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);
-#ifdef USE_OPENSSL
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
                gtk_widget_hide(wizard->recv_use_ssl);
                gtk_widget_hide(wizard->recv_use_tls);
+               gtk_widget_hide(wizard->recv_cert_table);
 #endif
+               if (wizard->create_mailbox) {
+                       gtk_widget_show(wizard->mailbox_label);
+                       gtk_widget_show(wizard->mailbox_name);
+               }
                gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
        }
 }
 
-static void wizard_protocol_changed(GtkMenuItem *menuitem, gpointer data)
+static void wizard_protocol_changed(GtkComboBox *combo, gpointer data)
 {
        WizardWindow *wizard = (WizardWindow *)data;
-       RecvProtocol protocol;
-       protocol = GPOINTER_TO_INT
-               (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
+       RecvProtocol protocol = combobox_get_active_data(combo);
 
        wizard_protocol_change(wizard, protocol);       
 }
@@ -1153,13 +1475,18 @@ static void wizard_protocol_changed(GtkMenuItem *menuitem, gpointer data)
 static GtkWidget* recv_page (WizardWindow * wizard)
 {
        GtkWidget *table = gtk_table_new(1,1, FALSE);
-       GtkWidget *menu = gtk_menu_new();
-       GtkWidget *menuitem;
-       GtkTooltips *tips = gtk_tooltips_new();
        GtkWidget *vbox;
        GtkWidget *hbox;
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
+       GtkWidget *label;
+       GtkWidget *button;
+       GtkWidget *recv_cert_table;
+#endif
+       GtkListStore *store;
+       GtkTreeIter iter;
        gchar *text;
        gint index = 0;
+       CLAWS_TIP_DECL();
 
        gtk_table_set_row_spacings(GTK_TABLE(table), 4);
        gtk_table_set_col_spacings(GTK_TABLE(table), 8);
@@ -1172,24 +1499,14 @@ 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_type = gtk_option_menu_new();
-       
-       MENUITEM_ADD (menu, menuitem, _("POP3"), A_POP3);
-       g_signal_connect(G_OBJECT(menuitem), "activate",
-                        G_CALLBACK(wizard_protocol_changed),
-                        wizard);
+       wizard->recv_type = gtkut_sc_combobox_create(NULL, FALSE);
+       store = GTK_LIST_STORE(gtk_combo_box_get_model(
+                       GTK_COMBO_BOX(wizard->recv_type)));
 
-       MENUITEM_ADD (menu, menuitem, _("IMAP"), A_IMAP4);
-       g_signal_connect(G_OBJECT(menuitem), "activate",
-                        G_CALLBACK(wizard_protocol_changed),
-                        wizard);
-
-       MENUITEM_ADD (menu, menuitem, _("Local mbox file"), A_LOCAL);
-       g_signal_connect(G_OBJECT(menuitem), "activate",
-                        G_CALLBACK(wizard_protocol_changed),
-                        wizard);
+       COMBOBOX_ADD(store, _("POP3"), A_POP3);
+       COMBOBOX_ADD(store, _("IMAP"), A_IMAP4);
+       COMBOBOX_ADD(store, _("Local mbox file"), A_LOCAL);
 
-       gtk_option_menu_set_menu (GTK_OPTION_MENU (wizard->recv_type), menu);
        switch(tmpl.recvtype) {
        case A_POP3: 
                index = 0;
@@ -1203,7 +1520,10 @@ static GtkWidget* recv_page (WizardWindow * wizard)
        default:
                index = 0;
        }
-       gtk_option_menu_set_history(GTK_OPTION_MENU (wizard->recv_type), index);
+       gtk_combo_box_set_active(GTK_COMBO_BOX (wizard->recv_type), index);
+       g_signal_connect(G_OBJECT(wizard->recv_type), "changed",
+                        G_CALLBACK(wizard_protocol_changed),
+                        wizard);
        PACK_BOX(hbox, _("<span weight=\"bold\">Server type:</span>"),
                 wizard->recv_type);
 
@@ -1214,10 +1534,9 @@ static GtkWidget* recv_page (WizardWindow * wizard)
        gtk_entry_set_text(GTK_ENTRY(wizard->recv_server), text);
        g_free(text);
        
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), wizard->recv_server,
+       CLAWS_SET_TIP(wizard->recv_server,
                             _("You can specify the port number by appending it at the end: "
-                              "\"mail.example.com:110\""),
-                            NULL);
+                              "\"mail.example.com:110\""));
 
        wizard->recv_label = gtk_label_new(_("<span weight=\"bold\">Server address:</span>"));
        gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
@@ -1248,10 +1567,14 @@ static GtkWidget* recv_page (WizardWindow * wizard)
        if (GTK_IS_MISC(wizard->recv_password_label))                                                 
                gtk_misc_set_alignment(GTK_MISC(wizard->recv_password_label), 1, 0.5);        
        gtk_entry_set_visibility(GTK_ENTRY(wizard->recv_password), FALSE);
+#ifdef MAEMO
+       hildon_gtk_entry_set_input_mode(GTK_ENTRY(wizard->recv_password), 
+               HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE);
+#endif
        gtk_box_pack_start(GTK_BOX(hbox), wizard->recv_password_label, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), wizard->recv_password, TRUE, TRUE, 0);
        
-#ifdef USE_OPENSSL
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
        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(
@@ -1268,6 +1591,39 @@ static GtkWidget* recv_page (WizardWindow * wizard)
                        tmpl.recvssl == 2);
        gtk_box_pack_start(GTK_BOX(hbox), wizard->recv_use_tls, FALSE, FALSE, 0);
        SET_TOGGLE_SENSITIVITY (wizard->recv_use_ssl, wizard->recv_use_tls);
+
+       recv_cert_table = gtk_table_new(3,3, FALSE);
+       gtk_container_set_border_width(GTK_CONTAINER(recv_cert_table), 8);
+       gtk_box_pack_start (GTK_BOX(vbox), recv_cert_table, FALSE, FALSE, 0);
+       label = gtk_label_new(_("Client SSL certificate (optional)"));
+       gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+       gtk_table_attach(GTK_TABLE(recv_cert_table), label, 0, 3, 0, 1, GTK_FILL, 0, 0, 0);
+       label = gtk_label_new(_("File"));
+       gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
+       gtk_table_attach(GTK_TABLE(recv_cert_table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
+       wizard->recv_ssl_cert_file = gtk_entry_new();
+       gtk_entry_set_text(GTK_ENTRY(wizard->recv_ssl_cert_file), tmpl.recvssl_cert?tmpl.recvssl_cert:"");
+       gtk_table_attach(GTK_TABLE(recv_cert_table), wizard->recv_ssl_cert_file, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
+       button = gtkut_get_browse_file_btn(_("Browse"));
+       gtk_table_attach(GTK_TABLE(recv_cert_table), button, 2, 3, 1, 2, GTK_FILL, 0, 0, 0);
+       SET_TOGGLE_SENSITIVITY (wizard->recv_use_ssl, label);
+       SET_TOGGLE_SENSITIVITY (wizard->recv_use_ssl, wizard->recv_ssl_cert_file);
+       SET_TOGGLE_SENSITIVITY (wizard->recv_use_ssl, button);
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(cert_browse_cb), wizard->recv_ssl_cert_file);
+
+       hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
+       gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+       label = gtk_label_new(_("Password"));
+       gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
+       gtk_table_attach(GTK_TABLE(recv_cert_table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
+       wizard->recv_ssl_cert_pass = gtk_entry_new();
+       gtk_entry_set_visibility(GTK_ENTRY(wizard->recv_ssl_cert_pass), FALSE);
+       gtk_entry_set_text(GTK_ENTRY(wizard->recv_ssl_cert_pass), tmpl.recvssl_cert_pass?tmpl.recvssl_cert_pass:"");
+       gtk_table_attach(GTK_TABLE(recv_cert_table), wizard->recv_ssl_cert_pass, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
+       SET_TOGGLE_SENSITIVITY (wizard->recv_use_ssl, label);
+       SET_TOGGLE_SENSITIVITY (wizard->recv_use_ssl, wizard->recv_ssl_cert_pass);
+       wizard->recv_cert_table = recv_cert_table;
 #endif 
        hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
        gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
@@ -1303,16 +1659,15 @@ wizard_response_cb (GtkDialog * dialog, int response, gpointer data)
 {
        WizardWindow * wizard = (WizardWindow *)data;
        int current_page, num_pages;
-       GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(wizard->recv_type));
-       GtkWidget *menuitem = gtk_menu_get_active(GTK_MENU(menu));
-       gint protocol = GPOINTER_TO_INT
-                       (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
        gboolean skip_mailbox_page = FALSE;
-       
+#ifndef MAEMO
+       gint protocol = combobox_get_active_data(GTK_COMBO_BOX(wizard->recv_type));
+
        if (protocol == A_IMAP4) {
                skip_mailbox_page = TRUE;
        }
-       
+#endif
+
        num_pages = g_slist_length(wizard->pages);
 
        current_page = gtk_notebook_get_current_page (
@@ -1418,6 +1773,7 @@ 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);
 
        g_signal_connect(wizard->window, "response", 
                          G_CALLBACK(wizard_response_cb), wizard);
@@ -1458,7 +1814,17 @@ gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) {
                          "Claws Mail in less than five minutes."));
        widget = gtk_label_new(text);
        gtk_label_set_line_wrap(GTK_LABEL(widget), TRUE);
+#ifndef MAEMO
        gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);
+#else
+       scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
+                                        GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+       gtk_box_pack_start(GTK_BOX(page), scrolled_window, TRUE, TRUE, 0);
+
+       gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),
+                                             widget);
+#endif
        g_free(text);
 
 /* user page: 1 */