2005-07-16 [colin] 1.9.12cvs65
[claws.git] / src / main.c
index 0e5648a422b63939f42d69857d59cc250011751f..43d5d10704b090ff56f771b7949134101667b5c5 100644 (file)
 #include "prefs_ext_prog.h"
 #include "prefs_fonts.h"
 #include "prefs_image_viewer.h"
+#include "prefs_message.h"
+#include "prefs_receive.h"
 #include "prefs_msg_colors.h"
 #include "prefs_quote.h"
 #include "prefs_spelling.h"
 #include "prefs_summaries.h"
 #include "prefs_themes.h"
+#include "prefs_other.h"
+#include "prefs_send.h"
 #include "prefs_wrapping.h"
 #include "prefs_compose_writing.h"
 #include "prefs_display_header.h"
 #include "imap_gtk.h"
 #include "news_gtk.h"
 #include "matcher.h"
+#ifdef HAVE_LIBETPAN
+#include "imap-thread.h"
+#endif
+#include "stock_pixmap.h"
 
 #if USE_OPENSSL
 #  include "ssl.h"
@@ -223,6 +231,7 @@ int main(int argc, char *argv[])
        gchar *userrc;
        MainWindow *mainwin;
        FolderView *folderview;
+       GdkPixbuf *icon;
 
        if (!sylpheed_init(&argc, &argv)) {
                return 0;
@@ -262,6 +271,9 @@ int main(int argc, char *argv[])
                return 0;
        }
 
+       g_thread_init(NULL);
+       /* gdk_threads_init(); */
+
        gtk_set_locale();
        gtk_init(&argc, &argv);
 
@@ -269,11 +281,8 @@ int main(int argc, char *argv[])
        gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
        gtk_widget_set_default_visual(gdk_rgb_get_visual());
 
-#if USE_THREADS || USE_LDAP
-       g_thread_init(NULL);
        if (!g_thread_supported())
                g_error(_("g_thread is not supported by glib.\n"));
-#endif
 
        /* parse gtkrc files */
        userrc = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, ".gtkrc-2.0",
@@ -308,7 +317,6 @@ int main(int argc, char *argv[])
        set_log_file(RC_DIR G_DIR_SEPARATOR_S "sylpheed.log");
 
        folder_system_init();
-       prefs_common_init();
        prefs_common_read_config();
 
        prefs_themes_init();
@@ -321,13 +329,19 @@ int main(int argc, char *argv[])
        prefs_image_viewer_init();
        prefs_quote_init();
        prefs_summaries_init();
+       prefs_message_init();
+       prefs_other_init();
+       prefs_receive_init();
+       prefs_send_init();
 #ifdef USE_ASPELL
        gtkaspell_checkers_init();
        prefs_spelling_init();
 #endif
        
        sock_set_io_timeout(prefs_common.io_timeout_secs);
-
+#ifdef HAVE_LIBETPAN
+       imap_main_set_timeout(prefs_common.io_timeout_secs);
+#endif
        prefs_actions_read_config();
        prefs_display_header_read_config();
        /* prefs_filtering_read_config(); */
@@ -335,6 +349,8 @@ int main(int argc, char *argv[])
        renderer_read_config();
 
        gtkut_widget_init();
+       stock_pixbuf_gdk(NULL, STOCK_PIXMAP_SYLPHEED_ICON, &icon);
+       gtk_window_set_default_icon(icon);
 
        folderview_initialize();
        mh_gtk_init();
@@ -368,6 +384,9 @@ int main(int argc, char *argv[])
                        exit_sylpheed(mainwin);
        }
 
+#ifdef HAVE_LIBETPAN
+       imap_main_init();
+#endif 
        account_set_missing_folder();
        folder_set_missing_folders();
        folderview_set(folderview);
@@ -460,7 +479,9 @@ static void exit_sylpheed(MainWindow *mainwin)
        gchar *filename;
 
        debug_print("shutting down\n");
-
+#ifdef HAVE_LIBETPAN
+       imap_main_done();
+#endif
        inc_autocheck_timer_remove();
 
        if (prefs_common.clean_on_exit)
@@ -519,6 +540,10 @@ static void exit_sylpheed(MainWindow *mainwin)
        image_viewer_done();
        prefs_quote_done();
        prefs_summaries_done();
+       prefs_message_done();
+       prefs_other_done();
+       prefs_receive_done();
+       prefs_send_done();
 #ifdef USE_ASPELL       
        prefs_spelling_done();
        gtkaspell_checkers_quit();
@@ -674,7 +699,6 @@ static void initial_processing(FolderItem *item, gpointer data)
 static void draft_all_messages(void)
 {
        GList *compose_list = NULL;
-       GList *elem = NULL;
        
        while ((compose_list = compose_get_compose_list()) != NULL) {
                Compose *c = (Compose*)compose_list->data;