add crash.c to translatable files
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Mon, 12 Aug 2002 20:20:45 +0000 (20:20 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Mon, 12 Aug 2002 20:20:45 +0000 (20:20 +0000)
bring in Leandro's dialog

ChangeLog.claws
configure.in
po/POTFILES.in
src/crash.c

index 4a0faece4264b4f88a804a8f138e3f2f84ca4db8..540b708cde3f803d7886436d1288df11e14b442c 100644 (file)
@@ -1,3 +1,10 @@
+2002-08-11 [alfons]    0.8.1claws53
+
+       * po/POTFILES.in
+               add crash.c to translatables
+       * src/crash.c
+               bring in Leandro's crash dialog
+
 2002-08-11 [alfons]    0.8.1claws52
 
        * src/crash.c
index 8a021265bec1c909fba7f95c3a781b51189a8fa9..69ad0c37d05a84d4e666cb30c91c5c71d7c92574 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=8
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws52
+EXTRA_VERSION=claws53
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 1d6e8659605258d8fd4257da4dea2415df1638dd..58cbd571629294bbe871501b2cc3cbf528f40001 100644 (file)
@@ -111,3 +111,4 @@ src/vcard.c
 src/xml.c
 src/xmlprops.c
 src/noticeview.c
+src/crash.c
index 2f6638baf48fd4f533569c2bd51b4398725bc3fb..e19d86090826a2dd3b4d014e3b2c5ea81d6adccc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2002 by the Sylpheed Claws Team and  Hiroyuki Yamamoto
+ * Copyright (C) 2002 by the Sylpheed Claws Team and Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#  include <config.h>
+#      include <config.h>
 #endif
 
 #include <glib.h>
 #include <errno.h>
 #include <fcntl.h>
 
+#if HAVE_SYS_UTSNAME_H
+#      include <sys/utsname.h>
+#endif
+
+#if defined(__GNU_LIBRARY__)
+#      include <gnu/libc-version.h>
+#endif
+
 #include "intl.h"
 #include "crash.h"
 #include "utils.h"
 #include "prefs.h"
+#include "version.h"
+
+#if 0
+#include "gtkutils.h"
+#include "pixmaps/notice_error.xpm"
+#endif
+
+/*
+ * NOTE 1: the crash dialog is called when sylpheed is not 
+ * initialized, so do not assume settings are available.
+ * for example, loading / creating pixmaps seems not 
+ * 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 const gchar *get_compiled_in_features   (void);
+static const gchar *get_lib_version            (void);
+static const gchar *get_operating_system       (void);
+
+/***/
+
 static const gchar *DEBUG_SCRIPT = "bt full\nq";
 
 /***/
 
-GtkWidget *crash_dialog_new (const gchar *text, const gchar *debug_output)
+/*
+ *\brief       (can't get pixmap working, so discarding it)
+ */
+static GtkWidget *crash_dialog_new(const gchar *text, const gchar *debug_output)
 {
        GtkWidget *window1;
        GtkWidget *vbox1;
+       GtkWidget *hbox1;
        GtkWidget *label1;
+       GtkWidget *frame1;
        GtkWidget *scrolledwindow1;
        GtkWidget *text1;
-       GtkWidget *hbuttonbox1;
-       GtkWidget *close;
+       GtkWidget *hbuttonbox3;
+       GtkWidget *hbuttonbox4;
        GtkWidget *button3;
+       GtkWidget *button4;
+       GtkWidget *button5;
+       GtkWidget *pixwid;
+       GdkPixmap *pix;
+       GdkBitmap *msk;
 
        window1 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-       gtk_object_set_data(GTK_OBJECT(window1), "window1", window1);
-       gtk_window_set_title(GTK_WINDOW(window1), _("Sylpheed Claws - It Bites!"));
+       gtk_container_set_border_width(GTK_CONTAINER(window1), 5);
+       gtk_window_set_title(GTK_WINDOW(window1), _("Sylpheed has crashed"));
+       gtk_window_set_position(GTK_WINDOW(window1), GTK_WIN_POS_CENTER);
+       gtk_window_set_modal(GTK_WINDOW(window1), TRUE);
+       gtk_window_set_default_size(GTK_WINDOW(window1), 460, 272);
 
-       vbox1 = gtk_vbox_new(FALSE, 0);
+
+       vbox1 = gtk_vbox_new(FALSE, 2);
        gtk_widget_show(vbox1);
        gtk_container_add(GTK_CONTAINER(window1), vbox1);
-       gtk_container_set_border_width(GTK_CONTAINER (vbox1), 1);
 
-       label1 = gtk_label_new(text);
+       hbox1 = gtk_hbox_new(FALSE, 4);
+       gtk_widget_show(hbox1);
+       gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, TRUE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(hbox1), 4);
+
+#if 0
+       PIXMAP_CREATE(window1, pix, msk, notice_error_xpm);
+       pixwid = gtk_pixmap_new(pix, msk);
+       gtk_widget_show(pixwid);
+       gtk_box_pack_start(GTK_BOX(hbox1), pixwid, TRUE, TRUE, 0);
+#endif 
+
+       label1 = gtk_label_new
+           (g_strdup_printf(_("%s.\n Please file a bug report and include the information below."), text));
        gtk_widget_show(label1);
-       gtk_box_pack_start(GTK_BOX(vbox1), label1, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(hbox1), label1, TRUE, TRUE, 0);
+       gtk_misc_set_alignment(GTK_MISC(label1), 7.45058e-09, 0.5);
+
+       frame1 = gtk_frame_new(_("Debug log"));
+       gtk_widget_show(frame1);
+       gtk_box_pack_start(GTK_BOX(vbox1), frame1, TRUE, TRUE, 0);
 
        scrolledwindow1 = gtk_scrolled_window_new(NULL, NULL);
        gtk_widget_show(scrolledwindow1);
-       gtk_box_pack_start(GTK_BOX(vbox1), scrolledwindow1, TRUE, TRUE, 0);
-       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow1), 
+       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);
 
        text1 = gtk_text_new(NULL, NULL);
-       gtk_text_insert(GTK_TEXT(text1), NULL, NULL, NULL, 
-                       debug_output, strlen(debug_output));
        gtk_widget_show(text1);
-       gtk_container_add(GTK_CONTAINER (scrolledwindow1), text1);
-       
-       hbuttonbox1 = gtk_hbutton_box_new();
-       gtk_widget_show(hbuttonbox1);
-       gtk_box_pack_start(GTK_BOX(vbox1), hbuttonbox1, FALSE, TRUE, 0);
-       gtk_button_box_set_child_ipadding(GTK_BUTTON_BOX (hbuttonbox1), 5, -1);
-
-       close = gtk_button_new_with_label(_("Close"));
-       gtk_widget_show(close);
-       gtk_container_add(GTK_CONTAINER(hbuttonbox1), close);
-       GTK_WIDGET_SET_FLAGS(close, GTK_CAN_DEFAULT);
-
-       button3 = gtk_button_new_with_label(_("Save..."));
+       gtk_container_add(GTK_CONTAINER(scrolledwindow1), text1);
+
+       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);
+
+       hbuttonbox3 = gtk_hbutton_box_new();
+       gtk_widget_show(hbuttonbox3);
+       gtk_box_pack_start(GTK_BOX(vbox1), hbuttonbox3, FALSE, FALSE, 0);
+
+       hbuttonbox4 = gtk_hbutton_box_new();
+       gtk_widget_show(hbuttonbox4);
+       gtk_box_pack_start(GTK_BOX(vbox1), hbuttonbox4, FALSE, FALSE, 0);
+
+       button3 = gtk_button_new_with_label(_("Close"));
        gtk_widget_show(button3);
-       gtk_container_add(GTK_CONTAINER(hbuttonbox1), button3);
+       gtk_container_add(GTK_CONTAINER(hbuttonbox4), button3);
        GTK_WIDGET_SET_FLAGS(button3, GTK_CAN_DEFAULT);
 
+       button4 = gtk_button_new_with_label(_("Save..."));
+       gtk_widget_show(button4);
+       gtk_container_add(GTK_CONTAINER(hbuttonbox4), button4);
+       GTK_WIDGET_SET_FLAGS(button4, GTK_CAN_DEFAULT);
+
+       button5 = gtk_button_new_with_label(_("Create bug report"));
+       gtk_widget_show(button5);
+       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(close),   "clicked",
+       gtk_signal_connect(GTK_OBJECT(button3),   "clicked",
                           GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
 
        gtk_widget_show(window1);
+
        gtk_main();
        return window1;
 }
 
 /***/
 
+/*
+ *\brief       install crash handlers
+ */
 void crash_install_handlers(void)
 {
 #if HAVE_GDB
@@ -157,10 +237,10 @@ void crash_main(const char *arg)
        tokens = g_strsplit(arg, ",", 0);
 
        pid = atol(tokens[0]);
-       text = g_strdup_printf("Sylpheed process (%lx) received signal %ld",
+       text = g_strdup_printf(_("Sylpheed process (%ld) received signal %ld"),
                               pid, atol(tokens[1]));
 
-       output = g_string_new("DEBUG LOG\n");     
+       output = g_string_new("");     
        crash_debug(pid, output);
        crash_dialog_new(text, output->str);
        g_string_free(output, TRUE);
@@ -258,6 +338,81 @@ static void crash_debug(unsigned long crash_pid, GString *string)
        }
 }
 
+/***/
+
+/*
+ *\brief       features
+ */
+static const gchar *get_compiled_in_features(void)
+{
+       return g_strdup_printf(
+                  _("Compiled-in features:%s"),
+#if HAVE_GDK_IMLIB
+                  " gdk_imlib"
+#endif
+#if HAVE_GDK_PIXBUF
+                  " gdk-pixbuf"
+#endif
+#if USE_THREADS
+                  " gthread"
+#endif
+#if INET6
+                  " IPv6"
+#endif
+#if HAVE_LIBCOMPFACE
+                  " libcompface"
+#endif
+#if HAVE_LIBJCONV
+                  " libjconv"
+#endif
+#if USE_GPGME
+                  " GPGME"
+#endif
+#if USE_SSL
+                  " SSL"
+#endif
+#if USE_LDAP
+                  " LDAP"
+#endif
+#if USE_JPILOT
+                  " JPilot"
+#endif
+#if USE_PSPELL
+                  " pspell"
+#endif
+       "");
+}
+
+/***/
+
+static const gchar *get_lib_version(void)
+{
+#if defined(__GNU_LIBRARY__)
+       return g_strdup_printf("GNU libc %s", gnu_get_libc_version());
+#else
+       return g_strdup(_("Unknown"));
+#endif
+}
+
+/***/
+
+static const gchar *get_operating_system(void)
+{
+#if HAVE_SYS_UTSNAME_H
+       struct utsname utsbuf;
+       uname(&utsbuf);
+       return g_strdup_printf("%s %s (%s)",
+                              utsbuf.sysname,
+                              utsbuf.release,
+                              utsbuf.machine);
+#else
+       return g_strdup(_("Unknown"));
+       
+#endif
+}
+
+/***/
+
 /*
  *\brief       checks KDE, GNOME and Sylpheed specific variables
  *             to see if the crash dialog is allowed (because some
@@ -310,7 +465,7 @@ static void crash_handler(int sig)
 
                setgid(getgid());
                setuid(getuid());
-#if 0          
+#if 0
                execvp("/alfons/Projects/sylpheed-claws/src/sylpheed", args);
 #else
                execvp("sylpheed", args);