* libglabels/libglabels-private.h:
Set G_LOG_DOMAIN
* libglabels/paper.c: (read_papers):
* libglabels/template.c: (read_templates):
Made appropriate warnings critical.
* src/Makefile.am:
* src/critical-error-handler.h:
* src/critical-error-handler.c: (gl_critical_error_handler_init),
(critical_error_handler):
Created critical error handler.
* src/glabels.c: (main):
Register critical error handler.
* src/merge-properties-dialog.c: (gl_merge_properties_dialog_init):
* src/object-editor.c: (gl_object_editor_init):
* src/prefs-dialog.c: (gl_prefs_dialog_init):
* src/template-designer.c: (gl_template_designer_init):
* src/ui-property-bar.c: (gl_ui_property_bar_instance_init):
Made appropriate warnings critical.
git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@563
f5e0f49d-192f-0410-a22d-
a8d8700d0965
+2005-12-08 Jim Evins <evins@snaught.com>
+
+ * libglabels/libglabels-private.h:
+ Set G_LOG_DOMAIN
+ * libglabels/paper.c: (read_papers):
+ * libglabels/template.c: (read_templates):
+ Made appropriate warnings critical.
+ * src/Makefile.am:
+ * src/critical-error-handler.h:
+ * src/critical-error-handler.c: (gl_critical_error_handler_init),
+ (critical_error_handler):
+ Created critical error handler.
+ * src/glabels.c: (main):
+ Register critical error handler.
+ * src/merge-properties-dialog.c: (gl_merge_properties_dialog_init):
+ * src/object-editor.c: (gl_object_editor_init):
+ * src/prefs-dialog.c: (gl_prefs_dialog_init):
+ * src/template-designer.c: (gl_template_designer_init):
+ * src/ui-property-bar.c: (gl_ui_property_bar_instance_init):
+ Made appropriate warnings critical.
+
2005-11-27 Jim Evins <evins@snaught.com>
* src/merge-evolution.c: (gl_merge_evolution_get_key_list),
#define GL_SYSTEM_DATA_DIR g_build_filename (LIBGLABELS_TEMPLATE_DIR, NULL)
#define GL_USER_DATA_DIR g_build_filename (g_get_home_dir (), ".glabels", NULL)
+#undef G_LOG_DOMAIN
+#define G_LOG_DOMAIN "LibGlabels"
+
#endif /* __LIBGLABELS_PRIVATE_H__ */
g_free (data_dir);
if (papers == NULL) {
- g_warning (_("No paper files found!"));
+ g_critical (_("Unable to locate paper size definitions. Libglabels may not be installed correctly!"));
}
return papers;
g_free (data_dir);
if (templates == NULL) {
- g_warning (_("No template files found!"));
+ g_critical (_("Unable to locate any template files. Libglabels may not be installed correctly!"));
}
return templates;
glabels.c \
splash.c \
splash.h \
+ critical-error-handler.c \
+ critical-error-handler.h \
window.c \
window.h \
stock.c \
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * critical-error-handler.c: critical error handler
+ *
+ * Copyright (C) 2005 Jim Evins <evins@snaught.com>.
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+
+#include "critical-error-handler.h"
+
+#include <glib/gmessages.h>
+#include <glib/gi18n.h>
+#include <gtk/gtkmessagedialog.h>
+#include <gtk/gtkstock.h>
+#include <stdlib.h>
+
+static void critical_error_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data);
+
+\f
+/***************************************************************************/
+/* Initialize error handler. */
+/***************************************************************************/
+void
+gl_critical_error_handler_init (void)
+{
+ g_log_set_handler ("LibGlabels",
+ G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
+ critical_error_handler,
+ "libglabels");
+
+ g_log_set_handler (NULL,
+ G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
+ critical_error_handler,
+ "glabels");
+}
+
+/*-------------------------------------------------------------------------*/
+/* PRIVATE. Actual error handler. */
+/*-------------------------------------------------------------------------*/
+static void
+critical_error_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_NONE,
+ _("gLabels Fatal Error!"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ message);
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ GTK_STOCK_QUIT, 0);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ exit (-1);
+}
+
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * critical-error-handler.h: critical error handler header file
+ *
+ * Copyright (C) 2005 Jim Evins <evins@snaught.com>.
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __CRITICAL_ERROR_HANDLER_H__
+#define __CRITICAL_ERROR_HANDLER_H__
+
+#include <glib/gmacros.h>
+
+G_BEGIN_DECLS
+
+void gl_critical_error_handler_init (void);
+
+G_END_DECLS
+
+#endif
#include <libgnomeui/libgnomeui.h>
#include <libgnomeui/gnome-window-icon.h>
+#include "critical-error-handler.h"
#include "splash.h"
#include "stock.h"
#include "merge-init.h"
GNOME_PROGRAM_STANDARD_PROPERTIES,
NULL);
+ /* Install graphical handler for critical errors. */
+ gl_critical_error_handler_init();
+
/* Splash screen */
gl_splash ();
NULL);
if (!dialog->priv->gui) {
- g_warning ("Could not open merge-properties-dialog.glade, reinstall glabels!");
+ g_critical ("Could not open merge-properties-dialog.glade. gLabels may not be installed correctly!");
return;
}
NULL);
if (!editor->priv->gui) {
- g_warning ("Could not open object-editor.glade, reinstall glabels!");
+ g_critical ("Could not open object-editor.glade. gLabels may not be installed correctly!");
return;
}
NULL);
if (!dlg->priv->gui) {
- g_warning ("Could not open prefs-dialog.glade, reinstall glabels!");
+ g_critical ("Could not open prefs-dialog.glade. gLabels may not be installed correctly!");
return;
}
NULL);
if (!dlg->priv->gui) {
- g_warning ("Could not open template-designer.glade, reinstall glabels!");
+ g_critical ("Could not open template-designer.glade. gLabels may not be installed correctly!");
return;
}
NULL);
if (!property_bar->priv->gui) {
- g_warning ("Could not open property-bar.glade, reinstall glabels!");
+ g_critical ("Could not open property-bar.glade. gLabels may not be installed correctly!");
return;
}