* src/folderview.[ch]
[claws.git] / src / prefs_common.c
index b31199ed2b2c6b6f46d3c95fa1ee4f936ec4cfd5..aad3b5c409ced5d58e05b6333fac1831ff7d2920 100644 (file)
@@ -51,6 +51,7 @@
 #include "gtkutils.h"
 #include "alertpanel.h"
 #include "folder.h"
+#include "socket.h"
 #include "filesel.h"
 #include "folderview.h"
 #include "stock_pixmap.h"
@@ -224,6 +225,7 @@ static struct Other {
        GtkWidget *printcmd_entry;
        GtkWidget *exteditor_combo;
        GtkWidget *exteditor_entry;
+
        GtkWidget *checkbtn_addaddrbyclick;
        GtkWidget *checkbtn_confonexit;
        GtkWidget *checkbtn_cleanonexit;
@@ -237,6 +239,8 @@ static struct Other {
 #endif
 #endif
 
+       GtkWidget *spinbtn_iotimeout;
+       GtkObject *spinbtn_iotimeout_adj;
 } other;
 
 static struct MessageColorButtons {
@@ -523,6 +527,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"bold_unread", "TRUE", &prefs_common.bold_unread, P_BOOL,
         NULL, NULL, NULL},
+       {"thread_by_subject_max_age", "10", &prefs_common.thread_by_subject_max_age,
+       P_INT, NULL, NULL, NULL },
 
        {"enable_thread", "TRUE", &prefs_common.enable_thread, P_BOOL,
         NULL, NULL, NULL},
@@ -770,6 +776,9 @@ static PrefParam param[] = {
        {"pixmap_theme_path", DEFAULT_PIXMAP_THEME, 
         &prefs_common.pixmap_theme_path, P_STRING,
         &interface.entry_pixmap_theme, prefs_set_data_from_entry, prefs_set_entry},
+
+       {"hover_timeout", "500", &prefs_common.hover_timeout, P_INT,
+        NULL, NULL, NULL},
        
        /* Other */
        {"uri_open_command", DEFAULT_BROWSER_CMD,
@@ -809,6 +818,9 @@ static PrefParam param[] = {
        {"summary_quicksearch_type", "0", &prefs_common.summary_quicksearch_type, P_INT,
         NULL, NULL, NULL},
 
+       {"io_timeout_secs", "60", &prefs_common.io_timeout_secs,
+        P_INT, &other.spinbtn_iotimeout,
+        prefs_set_data_from_spinbtn, prefs_set_spinbtn},
        {"hide_score", "-9999", &prefs_common.kill_score, P_INT,
         NULL, NULL, NULL},
        {"important_score", "1", &prefs_common.important_score, P_INT,
@@ -914,7 +926,8 @@ static void prefs_common_ok         (void);
 static void prefs_common_apply         (void);
 static void prefs_common_cancel                (void);
 
-void prefs_common_init() {
+void prefs_common_init(void) 
+{
        prefs_common.disphdr_list = NULL;
 }
 
@@ -2823,6 +2836,11 @@ static void prefs_other_create(void)
        GtkWidget *checkbtn_cleanonexit;
        GtkWidget *checkbtn_askonclean;
        GtkWidget *checkbtn_warnqueued;
+
+       GtkWidget *label_iotimeout;
+       GtkWidget *spinbtn_iotimeout;
+       GtkObject *spinbtn_iotimeout_adj;
+
 #if 0
 #ifdef USE_OPENSSL
        GtkWidget *frame_ssl;
@@ -2982,6 +3000,27 @@ static void prefs_other_create(void)
        PACK_CHECK_BUTTON (vbox_exit, checkbtn_warnqueued,
                           _("Warn if there are queued messages"));
 
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
+
+       label_iotimeout = gtk_label_new (_("Socket I/O timeout:"));
+       gtk_widget_show (label_iotimeout);
+       gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
+
+       spinbtn_iotimeout_adj = gtk_adjustment_new (60, 0, 1000, 1, 10, 10);
+       spinbtn_iotimeout = gtk_spin_button_new
+               (GTK_ADJUSTMENT (spinbtn_iotimeout_adj), 1, 0);
+       gtk_widget_show (spinbtn_iotimeout);
+       gtk_box_pack_start (GTK_BOX (hbox1), spinbtn_iotimeout,
+                           FALSE, FALSE, 0);
+       gtk_widget_set_usize (spinbtn_iotimeout, 64, -1);
+       gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_iotimeout), TRUE);
+
+       label_iotimeout = gtk_label_new (_("second(s)"));
+       gtk_widget_show (label_iotimeout);
+       gtk_box_pack_start (GTK_BOX (hbox1), label_iotimeout, FALSE, FALSE, 0);
+
        other.uri_combo = uri_combo;
        other.uri_entry = uri_entry;
        other.printcmd_entry = printcmd_entry;
@@ -2998,6 +3037,9 @@ static void prefs_other_create(void)
        other.checkbtn_cleanonexit = checkbtn_cleanonexit;
        other.checkbtn_askonclean  = checkbtn_askonclean;
        other.checkbtn_warnqueued  = checkbtn_warnqueued;
+
+       other.spinbtn_iotimeout     = spinbtn_iotimeout;
+       other.spinbtn_iotimeout_adj = spinbtn_iotimeout_adj;
        
 #if 0
 #ifdef USE_OPENSSL
@@ -4194,6 +4236,7 @@ static void prefs_common_apply(void)
 {
        gchar *entry_pixmap_theme_str;
        gboolean update_pixmap_theme;
+       gchar *backup_theme_path;
        
        entry_pixmap_theme_str = gtk_entry_get_text(GTK_ENTRY(interface.entry_pixmap_theme));
        if (entry_pixmap_theme_str && 
@@ -4201,15 +4244,25 @@ static void prefs_common_apply(void)
                update_pixmap_theme = TRUE;
        else
                update_pixmap_theme = FALSE;
-       
+
+       /*!< FIXME: prefs_set_data_from_dialog() clears and frees all strings, 
+        * but prefs_common.pixmap_theme_path is stored in the StockPixmapData
+        * in stock_pixmap.c::pixmaps[].icon_path, and used when reflecting
+        * the pixmap changes. Work around by saving the old one and freeing 
+        * it later. */
+       backup_theme_path = prefs_common.pixmap_theme_path;
+       prefs_common.pixmap_theme_path = g_strdup(backup_theme_path);
        prefs_set_data_from_dialog(param);
+       sock_set_io_timeout(prefs_common.io_timeout_secs);
        
-       if (update_pixmap_theme)
-       {
+       if (update_pixmap_theme) {
                main_window_reflect_prefs_all_real(TRUE);
                compose_reflect_prefs_pixmap_theme();
        } else
                main_window_reflect_prefs_all_real(FALSE);
+
+       /*!< FIXME: Now it's safe to delete the backup path */
+       g_free(backup_theme_path);
        
        prefs_common_save_config();