/*! *\brief show crash dialog * *\param text Description *\param debug_output Output text by gdb * *\return GtkWidget * Dialog widget */ static GtkWidget *crash_dialog_show(const gchar *text, const gchar *debug_output) { GtkWidget *window1; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *label1; GtkWidget *frame1; GtkWidget *scrolledwindow1; GtkWidget *text1; GtkWidget *hbuttonbox3; GtkWidget *hbuttonbox4; GtkWidget *button3; GtkWidget *button4; GtkWidget *button5; gchar *crash_report; window1 = gtk_window_new(GTK_WINDOW_TOPLEVEL); 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, 2); gtk_widget_show(vbox1); gtk_container_add(GTK_CONTAINER(window1), vbox1); 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); label1 = gtk_label_new (g_strdup_printf(_("%s.\nPlease file a bug report and include the information below."), text)); gtk_widget_show(label1); 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_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_set_editable(GTK_TEXT(text1), FALSE); 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, crash_report, -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(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(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); gtk_widget_show(window1); gtk_main(); return window1; }
/*! *\brief show crash dialog * *\param text Description *\param debug_output Output text by gdb * *\return GtkWidget * Dialog widget */ static GtkWidget *crash_dialog_show(const gchar *text, const gchar *debug_output) { GtkWidget *window1; GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *label1; GtkWidget *frame1; GtkWidget *scrolledwindow1; GtkWidget *text1; GtkWidget *hbuttonbox3; GtkWidget *hbuttonbox4; GtkWidget *button3; GtkWidget *button4; GtkWidget *button5; gchar *crash_report; GtkTextBuffer *buffer; GtkTextIter iter; window1 = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "crash"); gtk_container_set_border_width(GTK_CONTAINER(window1), 5); gtk_window_set_title(GTK_WINDOW(window1), _("Claws Mail 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, 2); gtk_widget_show(vbox1); gtk_container_add(GTK_CONTAINER(window1), vbox1); 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); label1 = gtk_label_new (g_strdup_printf(_("%s.\nPlease file a bug report and include the information below."), text)); gtk_widget_show(label1); 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_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_AUTOMATIC); text1 = gtk_text_view_new(); gtk_text_view_set_editable(GTK_TEXT_VIEW(text1), FALSE); gtk_widget_show(text1); gtk_container_add(GTK_CONTAINER(scrolledwindow1), text1); crash_report = g_strdup_printf( "Claws Mail version %s\n" "GTK+ version %d.%d.%d / GLib %d.%d.%d\n" "Locale: %s (charset: %s)\n" "Features:%s\n" "Operating system: %s\n" "C Library: %s\n--\n%s", VERSION, gtk_major_version, gtk_minor_version, gtk_micro_version, glib_major_version, glib_minor_version, glib_micro_version, conv_get_current_locale(), conv_get_locale_charset_str(), get_compiled_in_features(), get_operating_system(), get_lib_version(), debug_output); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text1)); gtk_text_buffer_get_start_iter(buffer, &iter); gtk_text_buffer_insert(buffer, &iter, crash_report, -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(hbuttonbox4), button3); gtkut_widget_set_can_default(button3, TRUE); button4 = gtk_button_new_with_label(_("Save...")); gtk_widget_show(button4); gtk_container_add(GTK_CONTAINER(hbuttonbox4), button4); gtkut_widget_set_can_default(button4, TRUE); button5 = gtk_button_new_with_label(_("Create bug report")); gtk_widget_show(button5); gtk_container_add(GTK_CONTAINER(hbuttonbox4), button5); gtkut_widget_set_can_default(button5, TRUE); 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); MANAGE_WINDOW_SIGNALS_CONNECT(window1); gtk_widget_show(window1); gtk_main(); return window1; }