save crash log button works; some other minor tweaks
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Tue, 13 Aug 2002 19:43:47 +0000 (19:43 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Tue, 13 Aug 2002 19:43:47 +0000 (19:43 +0000)
ChangeLog.claws
configure.in
src/crash.c

index 4cee15ae181db24fb750d44f08d291d91e086c97..e06410a55f1933da0a58722c6ca16cbba71b4230 100644 (file)
@@ -1,3 +1,9 @@
+2002-08-13 [alfons]    0.8.1claws56
+
+       * src/claws.c
+               o implement 'save crash log'
+               o some tweaks
+
 2002-08-11 [melvin]    0.8.1claws55
 
        * src/main.c
 2002-08-11 [melvin]    0.8.1claws55
 
        * src/main.c
index faf033a38c4bc6b5fb965e84b68f8ab97a2c8655..2d7f5c36bd0937b7c6552ab4a186ba6f53a9ca7e 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=8
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws55
+EXTRA_VERSION=claws56
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index e19d86090826a2dd3b4d014e3b2c5ea81d6adccc..c1f51e37bd6448adf3491e1d8168c3f676818796 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
+#include <time.h>
 
 #include <errno.h>
 #include <fcntl.h>
 
 #include <errno.h>
 #include <fcntl.h>
@@ -42,6 +43,7 @@
 #include "crash.h"
 #include "utils.h"
 #include "prefs.h"
 #include "crash.h"
 #include "utils.h"
 #include "prefs.h"
+#include "filesel.h"
 #include "version.h"
 
 #if 0
 #include "version.h"
 
 #if 0
  * to be possible.
  */
 
  * to be possible.
  */
 
-static void crash_handler                      (int sig);
-static gboolean is_crash_dialog_allowed                (void);
-static void crash_debug                                (unsigned long crash_pid, GString *string);
-static gboolean crash_create_debugger_file     (void);
+static void             crash_handler                  (int sig);
+static gboolean                 is_crash_dialog_allowed        (void);
+static void             crash_debug                    (unsigned long crash_pid, GString *string);
+static gboolean                 crash_create_debugger_file     (void);
+static void             crash_save_crash_log           (GtkButton *, const gchar *);
+
+static const gchar     *get_compiled_in_features       (void);
+static const gchar     *get_lib_version                (void);
+static const gchar     *get_operating_system           (void);
 
 
-static const gchar *get_compiled_in_features   (void);
-static const gchar *get_lib_version            (void);
-static const gchar *get_operating_system       (void);
 
 /***/
 
 
 /***/
 
@@ -91,6 +95,7 @@ static GtkWidget *crash_dialog_new(const gchar *text, const gchar *debug_output)
        GtkWidget *pixwid;
        GdkPixmap *pix;
        GdkBitmap *msk;
        GtkWidget *pixwid;
        GdkPixmap *pix;
        GdkBitmap *msk;
+       gchar     *crash_report;
 
        window1 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_container_set_border_width(GTK_CONTAINER(window1), 5);
 
        window1 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_container_set_border_width(GTK_CONTAINER(window1), 5);
@@ -134,19 +139,20 @@ static GtkWidget *crash_dialog_new(const gchar *text, const gchar *debug_output)
                                       GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
 
        text1 = gtk_text_new(NULL, NULL);
                                       GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
 
        text1 = gtk_text_new(NULL, NULL);
+       gtk_text_set_editable(GTK_TEXT(text1), FALSE);
        gtk_widget_show(text1);
        gtk_container_add(GTK_CONTAINER(scrolledwindow1), text1);
        gtk_widget_show(text1);
        gtk_container_add(GTK_CONTAINER(scrolledwindow1), text1);
+       
+       crash_report = g_strdup_printf(
+               _("Sylpheed version %s\nGTK+ version %d.%d.%d\nFeatures:%s\nOperating system: %s\nC Library: %s\n--\n%s"),
+               VERSION,
+               gtk_major_version, gtk_minor_version, gtk_micro_version,
+               get_compiled_in_features(),
+               get_operating_system(),
+               get_lib_version(),
+               debug_output);
 
 
-       gtk_text_insert(GTK_TEXT(text1), NULL, NULL, NULL,
-                       g_strdup_printf(
-                               _("Sylpheed version %s\nGTK+ version %d.%d.%d\nFeatures: %s\nOperating system: %s\nC Library: %s\n--\n%s"),
-                               VERSION,
-                               gtk_major_version, gtk_minor_version, gtk_micro_version,
-                               get_compiled_in_features(),
-                               get_operating_system(),
-                               get_lib_version(),
-                               debug_output),
-                       -1);
+       gtk_text_insert(GTK_TEXT(text1), NULL, NULL, NULL, crash_report, -1);
 
        hbuttonbox3 = gtk_hbutton_box_new();
        gtk_widget_show(hbuttonbox3);
 
        hbuttonbox3 = gtk_hbutton_box_new();
        gtk_widget_show(hbuttonbox3);
@@ -175,6 +181,9 @@ static GtkWidget *crash_dialog_new(const gchar *text, const gchar *debug_output)
                           GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
        gtk_signal_connect(GTK_OBJECT(button3),   "clicked",
                           GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
                           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_widget_show(window1);
 
 
        gtk_widget_show(window1);
 
@@ -266,6 +275,25 @@ static gboolean crash_create_debugger_file(void)
        prefs_write_close(pf);  
 }
 
        prefs_write_close(pf);  
 }
 
+/*
+ *\brief       saves crash log to a file
+ */
+static void crash_save_crash_log(GtkButton *button, const gchar *text)
+{
+       time_t timer;
+       struct tm *lt;
+       char buf[100];
+       gchar *filename;
+
+       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))
+       &&  *filename)
+               str_write_to_file(text, filename);
+       g_free(filename);       
+}
+
 /*
  *\brief       launches debugger and attaches it to crashed sylpheed
  */
 /*
  *\brief       launches debugger and attaches it to crashed sylpheed
  */
@@ -345,8 +373,7 @@ static void crash_debug(unsigned long crash_pid, GString *string)
  */
 static const gchar *get_compiled_in_features(void)
 {
  */
 static const gchar *get_compiled_in_features(void)
 {
-       return g_strdup_printf(
-                  _("Compiled-in features:%s"),
+       return g_strdup_printf("%s",
 #if HAVE_GDK_IMLIB
                   " gdk_imlib"
 #endif
 #if HAVE_GDK_IMLIB
                   " gdk_imlib"
 #endif
@@ -385,6 +412,9 @@ static const gchar *get_compiled_in_features(void)
 
 /***/
 
 
 /***/
 
+/*
+ *\brief       library version
+ */
 static const gchar *get_lib_version(void)
 {
 #if defined(__GNU_LIBRARY__)
 static const gchar *get_lib_version(void)
 {
 #if defined(__GNU_LIBRARY__)
@@ -396,6 +426,9 @@ static const gchar *get_lib_version(void)
 
 /***/
 
 
 /***/
 
+/*
+ *\brief       operating system
+ */
 static const gchar *get_operating_system(void)
 {
 #if HAVE_SYS_UTSNAME_H
 static const gchar *get_operating_system(void)
 {
 #if HAVE_SYS_UTSNAME_H
@@ -420,9 +453,7 @@ static const gchar *get_operating_system(void)
  */
 static gboolean is_crash_dialog_allowed(void)
 {
  */
 static gboolean is_crash_dialog_allowed(void)
 {
-       return getenv("KDE_DEBUG") || 
-              !getenv("GNOME_DISABLE_CRASH_DIALOG") ||
-              !getenv("SYLPHEED_NO_CRASH");
+       return !getenv("SYLPHEED_NO_CRASH");
 }
 
 /*
 }
 
 /*
@@ -465,7 +496,7 @@ static void crash_handler(int sig)
 
                setgid(getgid());
                setuid(getuid());
 
                setgid(getgid());
                setuid(getuid());
-#if 0
+#if 0 
                execvp("/alfons/Projects/sylpheed-claws/src/sylpheed", args);
 #else
                execvp("sylpheed", args);
                execvp("/alfons/Projects/sylpheed-claws/src/sylpheed", args);
 #else
                execvp("sylpheed", args);