]> git.sur5r.net Git - glabels/commitdiff
2005-12-08 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Fri, 9 Dec 2005 00:15:33 +0000 (00:15 +0000)
committerJim Evins <evins@snaught.com>
Fri, 9 Dec 2005 00:15:33 +0000 (00:15 +0000)
* 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

13 files changed:
glabels2/ChangeLog
glabels2/libglabels/libglabels-private.h
glabels2/libglabels/paper.c
glabels2/libglabels/template.c
glabels2/src/Makefile.am
glabels2/src/critical-error-handler.c [new file with mode: 0644]
glabels2/src/critical-error-handler.h [new file with mode: 0644]
glabels2/src/glabels.c
glabels2/src/merge-properties-dialog.c
glabels2/src/object-editor.c
glabels2/src/prefs-dialog.c
glabels2/src/template-designer.c
glabels2/src/ui-property-bar.c

index 61333fdbff9990081cc629eb351aec0aa37d155b..8b3df3331e774a95a13c623ea29a4fa1d9822a0d 100644 (file)
@@ -1,3 +1,24 @@
+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),
index e5011b2fa5777d0769bd58e419a4a91273897453..a6a78e73df604e13f35904602d6d6d27d85c1bda 100644 (file)
@@ -33,4 +33,7 @@
 #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__ */
index 26063a642fc7295eba842723e8a640735ebbc246..88e4b3742bfd1b83a3f554646993e16d172011b1 100644 (file)
@@ -454,7 +454,7 @@ read_papers (void)
        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;
index a91306cb05d7214a7d06ad7d0d15b9cec263e7cf..abadc48057fd386faf18e317e04c7118fa5a1b3b 100644 (file)
@@ -900,7 +900,7 @@ read_templates (void)
        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;
index fb4cf2f18f33bd0ea52dcd841678bf1e73466cc3..51f87a62a384ed0056012733fe4c3ca3fcd6ae8e 100644 (file)
@@ -41,6 +41,8 @@ glabels_SOURCES =                     \
        glabels.c                       \
        splash.c                        \
        splash.h                        \
+       critical-error-handler.c        \
+       critical-error-handler.h        \
        window.c                        \
        window.h                        \
        stock.c                         \
diff --git a/glabels2/src/critical-error-handler.c b/glabels2/src/critical-error-handler.c
new file mode 100644 (file)
index 0000000..be2c2ed
--- /dev/null
@@ -0,0 +1,83 @@
+/* -*- 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);
+}
+
diff --git a/glabels2/src/critical-error-handler.h b/glabels2/src/critical-error-handler.h
new file mode 100644 (file)
index 0000000..890db9b
--- /dev/null
@@ -0,0 +1,36 @@
+/* -*- 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
index 8cb329d3701cc4577a6f2399d639c1be60413d1e..b1354b0e2c69c301712db909138a93613fe486b0 100644 (file)
@@ -29,6 +29,7 @@
 #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"
@@ -90,6 +91,9 @@ main (int argc, char **argv)
                                      GNOME_PROGRAM_STANDARD_PROPERTIES,
                                      NULL);
 
+       /* Install graphical handler for critical errors. */
+       gl_critical_error_handler_init();
+
        /* Splash screen */
        gl_splash ();
 
index 7f4c34fecfdccf609af9a8ac16c675bd3ddc7ffe..d7e22e33a9e35182625c26e63c575ebd670c268b 100644 (file)
@@ -176,7 +176,7 @@ gl_merge_properties_dialog_init (glMergePropertiesDialog *dialog)
                                           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;
        }
 
index 3b2cf9ba93830cb3e220e86c2d7ba1fb416c3a9b..a7e817d3d983d7d1986d3d8ef581780f0b4d5412 100644 (file)
@@ -152,7 +152,7 @@ gl_object_editor_init (glObjectEditor *editor)
                                           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;
        }
 
index f2d47336b4406d0a3d527798c7e916121276d6fc..1ff63d0a4867b3e5ef15c428ef7e71cb12ef4f1d 100644 (file)
@@ -171,7 +171,7 @@ gl_prefs_dialog_init (glPrefsDialog *dlg)
                                        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;
        }
 
index 8b15d3b3e8f07d04767be1119b4346d80ad7b342..236c75f29a717e53537a8d79d9b2e0126261549f 100644 (file)
@@ -344,7 +344,7 @@ gl_template_designer_init (glTemplateDesigner *dlg)
                                        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;
        }
 
index 8d9de525712fe099ba4bdc2f8434f414ca35a50d..6af07594a96fe8766684d44989135a50dc844e36 100644 (file)
@@ -212,7 +212,7 @@ gl_ui_property_bar_instance_init (glUIPropertyBar *property_bar)
                                                 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;
        }