0.8.6claws68
[claws.git] / src / main.c
index c2d2c09a8b99cbc9dc1395b41228f2592cd27850..a5c63a2870c29ffa08d7bfe9c08832223c646670 100644 (file)
@@ -73,6 +73,7 @@
 #include "setup.h"
 #include "utils.h"
 #include "gtkutils.h"
+#include "log.h"
 
 #if USE_GPGME
 #  include "rfc2015.h"
@@ -88,7 +89,6 @@
 gchar *prog_version;
 gchar *startup_dir;
 gchar *argv0;
-gboolean debug_mode = FALSE;
 
 static gint lock_socket = -1;
 static gint lock_socket_tag = 0;
@@ -175,6 +175,15 @@ int main(int argc, char *argv[])
 
        parse_cmd_opt(argc, argv);
 
+       /* check and create unix domain socket */
+       lock_socket = prohibit_duplicate_launch();
+       if (lock_socket < 0) return 0;
+
+       if (cmd.status) {
+               puts("0 Sylpheed not running.");
+               return 0;
+       }
+
        gtk_set_locale();
        gtk_init(&argc, &argv);
 
@@ -225,15 +234,6 @@ int main(int argc, char *argv[])
 
        CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), 1);
 
-       /* check and create unix domain socket */
-       lock_socket = prohibit_duplicate_launch();
-       if (lock_socket < 0) return 0;
-
-       if (cmd.status) {
-               puts("0 Sylpheed not running.");
-               return 0;
-       }
-
        /* backup if old rc file exists */
        if (is_file_exist(RC_DIR)) {
                if (rename(RC_DIR, RC_DIR ".bak") < 0)
@@ -258,7 +258,8 @@ int main(int argc, char *argv[])
 
 #if USE_GPGME
        gpg_started = FALSE;
-       if (gpgme_check_engine()) {  /* Also does some gpgme init */
+       if (gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP) != 
+                       GPGME_No_Error) {  /* Also does some gpgme init */
                rfc2015_disable_all();
                debug_print("gpgme_engine_version:\n%s\n",
                            gpgme_get_engine_info());
@@ -329,8 +330,8 @@ int main(int argc, char *argv[])
 
        /* if Sylpheed crashed, rebuild caches */
        if (!cmd.crash && is_file_exist(get_crashfile_name())) {
-               debug_print("Sylpheed crashed, checking for new messages\n");
-               folderview_check_new_all();
+               debug_print("Sylpheed crashed, checking for new messages in local folders\n");
+               folderview_check_new(NULL);
        }
        /* make the crash-indicator file */
        str_write_to_file("foo", get_crashfile_name());
@@ -365,7 +366,9 @@ int main(int argc, char *argv[])
                main_window_toggle_work_offline(mainwin, FALSE);
        
        static_mainwindow = mainwin;
+       statusbar_puts_all("Ready");
        gtk_main();
+       statusbar_pop_all();
 
        addressbook_destroy();
 
@@ -382,7 +385,7 @@ static void parse_cmd_opt(int argc, char *argv[])
 
        for (i = 1; i < argc; i++) {
                if (!strncmp(argv[i], "--debug", 7))
-                       debug_mode = TRUE;
+                       debug_set_mode(TRUE);
                else if (!strncmp(argv[i], "--receive-all", 13))
                        cmd.receive_all = TRUE;
                else if (!strncmp(argv[i], "--receive", 9))