2005-01-23 [colin] 1.0.0cvs9.1
[claws.git] / src / crash.c
index e33915dfc29b8273fa97ea1262821f75aed49cfe..2e239afa83113333a029d50322da4be9ce0ba353 100644 (file)
@@ -23,6 +23,8 @@
 
 #ifdef CRASH_DIALOG
 
+#include "defs.h"
+
 #include <glib.h>
 #include <gtk/gtk.h>
 #include <stdio.h>
@@ -46,6 +48,7 @@
 #ifdef SIGTERM
 #include "main.h"
 #endif
+#include "sylpheed.h"
 #include "intl.h"
 #include "crash.h"
 #include "utils.h"
@@ -115,11 +118,6 @@ void crash_install_handlers(void)
        sigaddset(&mask, SIGABRT);
 #endif
 
-#ifdef SIGTERM
-       signal(SIGTERM, crash_handler);
-       sigaddset(&mask, SIGTERM);
-#endif
-
        sigprocmask(SIG_UNBLOCK, &mask, 0);
 #endif /* CRASH_DIALOG */      
 }
@@ -216,10 +214,10 @@ static GtkWidget *crash_dialog_show(const gchar *text, const gchar *debug_output
        gtk_container_add(GTK_CONTAINER(frame1), scrolledwindow1);
        gtk_container_set_border_width(GTK_CONTAINER(scrolledwindow1), 3);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow1),
-                                      GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+                                      GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
 
        text1 = gtk_text_new(NULL, NULL);
-       gtk_text_set_editable(GTK_TEXT(text1), FALSE);
+       gtk_text_set_editable((text1), FALSE);
        gtk_widget_show(text1);
        gtk_container_add(GTK_CONTAINER(scrolledwindow1), text1);
        
@@ -232,7 +230,7 @@ static GtkWidget *crash_dialog_show(const gchar *text, const gchar *debug_output
                get_lib_version(),
                debug_output);
 
-       gtk_text_insert(GTK_TEXT(text1), NULL, NULL, NULL, crash_report, -1);
+       gtk_text_insert((text1), NULL, NULL, NULL, crash_report, -1);
 
        hbuttonbox3 = gtk_hbutton_box_new();
        gtk_widget_show(hbuttonbox3);
@@ -257,16 +255,14 @@ static GtkWidget *crash_dialog_show(const gchar *text, const gchar *debug_output
        gtk_container_add(GTK_CONTAINER(hbuttonbox4), button5);
        GTK_WIDGET_SET_FLAGS(button5, GTK_CAN_DEFAULT);
        
-       gtk_signal_connect(GTK_OBJECT(window1), "delete_event",
-                          GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
-       gtk_signal_connect(GTK_OBJECT(button3),   "clicked",
-                          GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
-       gtk_signal_connect(GTK_OBJECT(button4), "clicked",
-                          GTK_SIGNAL_FUNC(crash_save_crash_log),
-                          crash_report);
-       gtk_signal_connect(GTK_OBJECT(button5), "clicked",
-                          GTK_SIGNAL_FUNC(crash_create_bug_report),
-                          NULL);
+       g_signal_connect(G_OBJECT(window1), "delete_event",
+                        G_CALLBACK(gtk_main_quit), NULL);
+       g_signal_connect(G_OBJECT(button3),   "clicked",
+                        G_CALLBACK(gtk_main_quit), NULL);
+       g_signal_connect(G_OBJECT(button4), "clicked",
+                        G_CALLBACK(crash_save_crash_log), crash_report);
+       g_signal_connect(G_OBJECT(button5), "clicked",
+                        G_CALLBACK(crash_create_bug_report), NULL);
 
        gtk_widget_show(window1);
 
@@ -301,7 +297,7 @@ static void crash_save_crash_log(GtkButton *button, const gchar *text)
        timer = time(NULL);
        lt = localtime(&timer);
        strftime(buf, sizeof buf, "sylpheed-crash-log-%Y-%m-%d-%H-%M-%S.txt", lt);
-       if (NULL != (filename = filesel_select_file(_("Save crash information"), buf))
+       if (NULL != (filename = filesel_select_file_save(_("Save crash information"), buf))
        &&  *filename)
                str_write_to_file(text, filename);
        g_free(filename);       
@@ -312,8 +308,7 @@ static void crash_save_crash_log(GtkButton *button, const gchar *text)
  */
 static void crash_create_bug_report(GtkButton *button, const gchar *data)
 {
-       open_uri("http://sylpheed-claws.sourceforge.net/cgi-bin/bugzilla/enter_bug.cgi",
-                prefs_common.uri_cmd);
+       open_uri(CLAWS_BUGZILLA_URI, prefs_common.uri_cmd);
 }
 
 /*!
@@ -417,9 +412,6 @@ static const gchar *get_compiled_in_features(void)
 #if HAVE_LIBJCONV
                   " libjconv"
 #endif
-#if USE_GPGME
-                  " GPGME"
-#endif
 #if USE_OPENSSL
                   " OpenSSL"
 #endif
@@ -490,10 +482,9 @@ static void crash_handler(int sig)
        static volatile unsigned long crashed_ = 0;
 
        /*
-        * let's hope startup_dir and argv0 aren't trashed.
+        * let's hope argv0 aren't trashed.
         * both are defined in main.c.
         */
-       extern gchar *startup_dir;
        extern gchar *argv0;
 
 
@@ -507,7 +498,7 @@ static void crash_handler(int sig)
 
 #ifdef SIGTERM
        if (sig == SIGTERM) 
-               clean_quit();
+               clean_quit(NULL);
 #endif
 
        /*
@@ -533,7 +524,7 @@ static void crash_handler(int sig)
                args[3] = buf;
                args[4] = NULL;
 
-               chdir(startup_dir);
+               chdir(sylpheed_get_startup_dir());
                setgid(getgid());
                setuid(getuid());
                execvp(argv0, args);