1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
4 * (GLABELS) Label and Business Card Creation program for GNOME
6 * critical-error-handler.c: critical error handler
8 * Copyright (C) 2005 Jim Evins <evins@snaught.com>.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include "critical-error-handler.h"
29 #include <glib/gmessages.h>
30 #include <glib/gi18n.h>
31 #include <gtk/gtkmessagedialog.h>
32 #include <gtk/gtkstock.h>
35 static void critical_error_handler (const gchar *log_domain,
36 GLogLevelFlags log_level,
41 /***************************************************************************/
42 /* Initialize error handler. */
43 /***************************************************************************/
45 gl_critical_error_handler_init (void)
47 g_log_set_handler ("LibGlabels",
48 G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
49 critical_error_handler,
52 g_log_set_handler (G_LOG_DOMAIN,
53 G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
54 critical_error_handler,
58 /*-------------------------------------------------------------------------*/
59 /* PRIVATE. Actual error handler. */
60 /*-------------------------------------------------------------------------*/
62 critical_error_handler (const gchar *log_domain,
63 GLogLevelFlags log_level,
69 dialog = gtk_message_dialog_new (NULL,
73 _("gLabels Fatal Error!"));
74 gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
76 gtk_dialog_add_button (GTK_DIALOG (dialog),
79 gtk_dialog_run (GTK_DIALOG (dialog));