* libglabels/paper.c: (read_paper_files_from_dir):
* libglabels/template.c: (gl_template_register),
(read_template_files_from_dir):
* libglabels/xml-paper.c: (gl_xml_paper_read_papers_from_file),
(gl_xml_paper_parse_papers_doc):
* libglabels/xml-template.c:
(gl_xml_template_read_templates_from_file),
(gl_xml_template_parse_templates_doc),
(gl_xml_template_parse_template_node),
(xml_parse_label_rectangle_node), (xml_parse_label_round_node),
(xml_parse_label_cd_node), (xml_parse_layout_node),
(xml_parse_markup_margin_node), (xml_parse_markup_line_node),
(xml_parse_markup_circle_node),
(gl_xml_template_write_templates_to_file), (xml_create_label_node):
* libglabels/xml.c: (gl_xml_get_prop_length):
Re-classified g_warnings to g_messages.
* src/Makefile.am:
* src/glabels.c: (main):
* src/warning-handler.c: (gl_warning_handler_init),
(warning_handler):
* src/warning-handler.h:
Added warning message handler to make sure the user is
presented with appropriate non-fatal errors.
* src/critical-error-handler.c: (critical_error_handler):
Changed exit to abort.
* src/bc-gnubarcode.c: (gl_barcode_gnubarcode_new), (render_pass1):
* src/bc-postnet.c: (postnet_code):
* src/bc.c: (id_to_index), (name_to_index):
* src/merge.c: (gl_merge_register_backend), (gl_merge_new):
* src/object-editor.c: (gl_object_notebook_construct_valist):
* src/prefs-dialog.c: (update_locale_page_from_prefs):
* src/prefs.c: (gl_prefs_get_units_per_point),
(gl_prefs_get_units_precision), (gl_prefs_get_units_step_size),
(gl_prefs_get_units_string):
* src/print.c: (draw_outline), (clip_to_outline), (clip_punchouts):
* src/splash.c: (gl_splash):
* src/ui-commands.c: (gl_ui_cmd_help_contents):
* src/view-highlight.c: (gl_view_highlight_new),
(highlight_resizable_box_construct), (object_changed_cb),
(view_scale_changed_cb):
* src/view.c: (draw_label_layer), (draw_bg_fg_layers),
(draw_markup_layer), (draw_markup_margin),
(gl_view_object_create_mode), (canvas_event),
(selection_received_cb):
* src/wdgt-mini-preview.c: (mini_outline_list_new):
* src/wdgt-rotate-label.c: (mini_preview_canvas_update):
* src/xml-label-04.c: (gl_xml_label_04_parse),
(xml04_parse_media_description), (xml04_parse_text_props),
(xml04_parse_barcode_props):
* src/xml-label-191.c: (gl_xml_label_191_parse),
(xml191_parse_objects), (xml191_parse_object),
(xml191_parse_text_props), (xml191_parse_image_props),
(xml191_parse_barcode_props), (xml191_parse_data),
(xml191_parse_sheet), (xml191_parse_label), (xml191_parse_layout),
(xml191_parse_markup):
* src/xml-label.c: (gl_xml_label_open), (gl_xml_label_open_buffer),
(xml_doc_to_label), (xml_parse_label), (xml_parse_objects),
(xml_parse_object_text), (xml_parse_object_image),
(xml_parse_object_barcode), (xml_parse_data),
(xml_parse_toplevel_span), (gl_xml_label_save),
(xml_create_objects):
Re-classified g_warnings to g_messages.
* src/merge-evolution.c: (gl_merge_evolution_open),
(gl_merge_evolution_close), (gl_merge_evolution_get_record):
Use g_warning to output errors encountered while
communicating with the evolution data server
instead of embedding them in the data.
git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@564
f5e0f49d-192f-0410-a22d-
a8d8700d0965
+2005-12-08 Jim Evins <evins@snaught.com>
+
+ * libglabels/paper.c: (read_paper_files_from_dir):
+ * libglabels/template.c: (gl_template_register),
+ (read_template_files_from_dir):
+ * libglabels/xml-paper.c: (gl_xml_paper_read_papers_from_file),
+ (gl_xml_paper_parse_papers_doc):
+ * libglabels/xml-template.c:
+ (gl_xml_template_read_templates_from_file),
+ (gl_xml_template_parse_templates_doc),
+ (gl_xml_template_parse_template_node),
+ (xml_parse_label_rectangle_node), (xml_parse_label_round_node),
+ (xml_parse_label_cd_node), (xml_parse_layout_node),
+ (xml_parse_markup_margin_node), (xml_parse_markup_line_node),
+ (xml_parse_markup_circle_node),
+ (gl_xml_template_write_templates_to_file), (xml_create_label_node):
+ * libglabels/xml.c: (gl_xml_get_prop_length):
+ Re-classified g_warnings to g_messages.
+ * src/Makefile.am:
+ * src/glabels.c: (main):
+ * src/warning-handler.c: (gl_warning_handler_init),
+ (warning_handler):
+ * src/warning-handler.h:
+ Added warning message handler to make sure the user is
+ presented with appropriate non-fatal errors.
+ * src/critical-error-handler.c: (critical_error_handler):
+ Changed exit to abort.
+ * src/bc-gnubarcode.c: (gl_barcode_gnubarcode_new), (render_pass1):
+ * src/bc-postnet.c: (postnet_code):
+ * src/bc.c: (id_to_index), (name_to_index):
+ * src/merge.c: (gl_merge_register_backend), (gl_merge_new):
+ * src/object-editor.c: (gl_object_notebook_construct_valist):
+ * src/prefs-dialog.c: (update_locale_page_from_prefs):
+ * src/prefs.c: (gl_prefs_get_units_per_point),
+ (gl_prefs_get_units_precision), (gl_prefs_get_units_step_size),
+ (gl_prefs_get_units_string):
+ * src/print.c: (draw_outline), (clip_to_outline), (clip_punchouts):
+ * src/splash.c: (gl_splash):
+ * src/ui-commands.c: (gl_ui_cmd_help_contents):
+ * src/view-highlight.c: (gl_view_highlight_new),
+ (highlight_resizable_box_construct), (object_changed_cb),
+ (view_scale_changed_cb):
+ * src/view.c: (draw_label_layer), (draw_bg_fg_layers),
+ (draw_markup_layer), (draw_markup_margin),
+ (gl_view_object_create_mode), (canvas_event),
+ (selection_received_cb):
+ * src/wdgt-mini-preview.c: (mini_outline_list_new):
+ * src/wdgt-rotate-label.c: (mini_preview_canvas_update):
+ * src/xml-label-04.c: (gl_xml_label_04_parse),
+ (xml04_parse_media_description), (xml04_parse_text_props),
+ (xml04_parse_barcode_props):
+ * src/xml-label-191.c: (gl_xml_label_191_parse),
+ (xml191_parse_objects), (xml191_parse_object),
+ (xml191_parse_text_props), (xml191_parse_image_props),
+ (xml191_parse_barcode_props), (xml191_parse_data),
+ (xml191_parse_sheet), (xml191_parse_label), (xml191_parse_layout),
+ (xml191_parse_markup):
+ * src/xml-label.c: (gl_xml_label_open), (gl_xml_label_open_buffer),
+ (xml_doc_to_label), (xml_parse_label), (xml_parse_objects),
+ (xml_parse_object_text), (xml_parse_object_image),
+ (xml_parse_object_barcode), (xml_parse_data),
+ (xml_parse_toplevel_span), (gl_xml_label_save),
+ (xml_create_objects):
+ Re-classified g_warnings to g_messages.
+ * src/merge-evolution.c: (gl_merge_evolution_open),
+ (gl_merge_evolution_close), (gl_merge_evolution_get_record):
+ Use g_warning to output errors encountered while
+ communicating with the evolution data server
+ instead of embedding them in the data.
+
2005-12-08 Jim Evins <evins@snaught.com>
* libglabels/libglabels-private.h:
dp = g_dir_open (dirname, 0, &gerror);
if (gerror != NULL) {
- g_warning ("cannot open data directory: %s", gerror->message );
+ g_message ("cannot open data directory: %s", gerror->message );
return papers;
}
g_free (abs_filename);
} else {
- g_warning ("Cannot register new template with unknown page size.");
+ g_message ("Cannot register new template with unknown page size.");
}
}
dp = g_dir_open (dirname, 0, &gerror);
if (gerror != NULL) {
- g_warning ("cannot open data directory: %s", gerror->message );
+ g_message ("cannot open data directory: %s", gerror->message );
return templates;
}
filename = g_filename_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
if (!filename) {
- g_warning ("Utf8 filename conversion error");
+ g_message ("Utf8 filename conversion error");
return NULL;
}
papers_doc = xmlParseFile (filename);
if (!papers_doc) {
- g_warning ("\"%s\" is not a glabels paper file (not XML)",
+ g_message ("\"%s\" is not a glabels paper file (not XML)",
filename);
return NULL;
}
root = xmlDocGetRootElement (papers_doc);
if (!root || !root->name) {
- g_warning ("\"%s\" is not a glabels paper file (no root node)",
+ g_message ("\"%s\" is not a glabels paper file (no root node)",
papers_doc->name);
xmlFreeDoc (papers_doc);
return papers;
}
if (!gl_xml_is_node (root, "Glabels-paper-sizes")) {
- g_warning ("\"%s\" is not a glabels paper file (wrong root node)",
+ g_message ("\"%s\" is not a glabels paper file (wrong root node)",
papers_doc->name);
xmlFreeDoc (papers_doc);
return papers;
} else {
if ( !xmlNodeIsText(node) ) {
if (!gl_xml_is_node (node, "comment")) {
- g_warning ("bad node = \"%s\"",node->name);
+ g_message ("bad node = \"%s\"",node->name);
}
}
}
filename = g_filename_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
if (!filename) {
- g_warning ("Utf8 filename conversion error");
+ g_message ("Utf8 filename conversion error");
return NULL;
}
templates_doc = xmlParseFile (filename);
if (!templates_doc) {
- g_warning ("\"%s\" is not a glabels template file (not XML)",
+ g_message ("\"%s\" is not a glabels template file (not XML)",
filename);
return templates;
}
root = xmlDocGetRootElement (templates_doc);
if (!root || !root->name) {
- g_warning ("\"%s\" is not a glabels template file (no root node)",
+ g_message ("\"%s\" is not a glabels template file (no root node)",
templates_doc->URL);
return templates;
}
if (!gl_xml_is_node (root, "Glabels-templates")) {
- g_warning ("\"%s\" is not a glabels template file (wrong root node)",
+ g_message ("\"%s\" is not a glabels template file (wrong root node)",
templates_doc->URL);
return templates;
}
} else {
if ( !xmlNodeIsText(node) ) {
if (!gl_xml_is_node (node,"comment")) {
- g_warning ("bad node = \"%s\"",node->name);
+ g_message ("bad node = \"%s\"",node->name);
}
}
}
if (paper == NULL) {
/* This should always be an id, but just in case a name
slips by! */
- g_warning (_("Unknown page size id \"%s\", trying as name"),
+ g_message (_("Unknown page size id \"%s\", trying as name"),
page_size);
paper = gl_paper_from_name (page_size);
g_free (page_size);
page_width = paper->width;
page_height = paper->height;
} else {
- g_warning (_("Unknown page size id or name \"%s\""),
+ g_message (_("Unknown page size id or name \"%s\""),
page_size);
}
gl_paper_free (paper);
} else {
if (!xmlNodeIsText (node)) {
if (!gl_xml_is_node (node,"comment")) {
- g_warning ("bad node = \"%s\"",node->name);
+ g_message ("bad node = \"%s\"",node->name);
}
}
}
xml_parse_markup_circle_node (node, label_type);
} else if (!xmlNodeIsText (node)) {
if (!gl_xml_is_node (node, "comment")) {
- g_warning ("bad node = \"%s\"",node->name);
+ g_message ("bad node = \"%s\"",node->name);
}
}
}
xml_parse_markup_circle_node (node, label_type);
} else if (!xmlNodeIsText (node)) {
if (!gl_xml_is_node (node, "comment")) {
- g_warning ("bad node = \"%s\"",node->name);
+ g_message ("bad node = \"%s\"",node->name);
}
}
}
xml_parse_markup_circle_node (node, label_type);
} else if (!xmlNodeIsText (node)) {
if (!gl_xml_is_node (node, "comment")) {
- g_warning ("bad node = \"%s\"",node->name);
+ g_message ("bad node = \"%s\"",node->name);
}
}
}
node = node->next) {
if (!xmlNodeIsText (node)) {
if (!gl_xml_is_node (node, "comment")) {
- g_warning ("bad node = \"%s\"",node->name);
+ g_message ("bad node = \"%s\"",node->name);
}
}
}
node = node->next) {
if (!xmlNodeIsText (node)) {
if (!gl_xml_is_node (node, "comment")) {
- g_warning ("bad node = \"%s\"",node->name);
+ g_message ("bad node = \"%s\"",node->name);
}
}
}
node = node->next) {
if (!xmlNodeIsText (node)) {
if (!gl_xml_is_node (node, "comment")) {
- g_warning ("bad node = \"%s\"",node->name);
+ g_message ("bad node = \"%s\"",node->name);
}
}
}
node = node->next) {
if (!xmlNodeIsText (node)) {
if (!gl_xml_is_node (node, "comment")) {
- g_warning ("bad node = \"%s\"",node->name);
+ g_message ("bad node = \"%s\"",node->name);
}
}
}
filename = g_filename_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
if (!filename)
- g_warning (_("Utf8 conversion error."));
+ g_message (_("Utf8 conversion error."));
else {
xmlSetDocCompressMode (doc, 0);
xml_ret = xmlSaveFormatFile (filename, doc, TRUE);
xmlFreeDoc (doc);
if (xml_ret == -1) {
- g_warning (_("Problem saving xml file."));
+ g_message (_("Problem saving xml file."));
}
g_free (filename);
break;
default:
- g_warning ("Unknown label style");
+ g_message ("Unknown label style");
return;
break;
xml_create_markup_circle_node (markup, node, ns);
break;
default:
- g_warning ("Unknown markup type");
+ g_message ("Unknown markup type");
break;
}
}
}
}
if (i>GL_UNITS_LAST) {
- g_warning ("Line %d, Node \"%s\", Property \"%s\": Unknown unit \"%s\", assuming points",
+ g_message ("Line %d, Node \"%s\", Property \"%s\": Unknown unit \"%s\", assuming points",
xmlGetLineNo (node), node->name, property,
unit);
}
glabels.c \
splash.c \
splash.h \
+ warning-handler.c \
+ warning-handler.h \
critical-error-handler.c \
critical-error-handler.h \
window.c \
} else if (g_strcasecmp (id, "PLS") == 0) {
flags = BARCODE_PLS;
} else {
- g_warning( "Illegal barcode id %s", id );
+ g_message( "Illegal barcode id %s", id );
flags = BARCODE_ANY;
}
Barcode_Encode (bci, flags);
if (!bci->partial || !bci->textinfo) {
- g_warning ("Barcode Data Invalid");
+ g_message ("Barcode Data Invalid");
Barcode_Delete (bci);
return NULL;
}
continue;
}
if (sscanf (p, "%lf:%lf:%c", &f1, &f2, &c) != 3) {
- g_warning ("impossible data: %s", p);
+ g_message ("impossible data: %s", p);
continue;
}
bchar = g_new0 (glBarcodeChar, 1);
}
}
if ((len != 5) && (len != 9) && (len != 11)) {
- g_warning ("Invalid POSTNET length %d, should be 5(ZIP), 9(ZIP+4), or 11(DPBC)", len);
+ g_message ("Invalid POSTNET length %d, should be 5(ZIP), 9(ZIP+4), or 11(DPBC)", len);
}
/* Create correction character */
}
}
- g_warning( "Unknown barcode id \"%s\"", id );
+ g_message( "Unknown barcode id \"%s\"", id );
return 0;
}
}
}
- g_warning( "Unknown barcode name \"%s\"", name );
+ g_message( "Unknown barcode name \"%s\"", name );
return 0;
}
gtk_dialog_run (GTK_DIALOG (dialog));
- exit (-1);
+ abort ();
}
GNOME_PROGRAM_STANDARD_PROPERTIES,
NULL);
- /* Install graphical handler for critical errors. */
+ /* Install GUI handlers for critical error and warning messages */
gl_critical_error_handler_init();
+ gl_warning_handler_init();
/* Splash screen */
gl_splash ();
ICON_PIXMAP_FILE, FALSE, NULL);
if (!g_file_test (icon_file, G_FILE_TEST_EXISTS))
{
- g_warning ("Could not find %s", ICON_PIXMAP_FILE);
+ g_message ("Could not find %s", ICON_PIXMAP_FILE);
}
else
{
#include "merge-evolution.h"
-#include <libebook/e-book.h>
+#include <libebook/e-book.h>
+#include <glib/gi18n.h>
#include <stdio.h>
#include <string.h>
EBook *book;
GList *contacts;
GList *fields; /* the fields supported by the addressbook */
- GList *error_list; /* list of error strings */
};
enum {
GList *fields, *iter;
EContactField *field_id;
GError *error;
- GList **error_list;
gl_debug (DEBUG_MERGE, "BEGIN");
merge_evolution = GL_MERGE_EVOLUTION (merge);
- error_list = &merge_evolution->private->error_list;
query = e_book_query_from_string(merge_evolution->private->query);
if (!query) {
- merge_evolution->private->error_list =
- g_list_append(merge_evolution->private->error_list,
- g_strdup("Couldn't construct query"));
- g_error_free (error);
+ g_warning (_("Couldn't construct query"));
return;
}
merge_evolution->private->book = e_book_new_system_addressbook(&error);
if (!merge_evolution->private->book) {
- *error_list = g_list_append(*error_list,
- g_strdup_printf("Couldn't open addressbook: %s",
- error->message));
+ g_warning (_("Couldn't open addressbook: %s"), error->message);
e_book_query_unref(query);
g_error_free (error);
return;
}
if (!e_book_open(merge_evolution->private->book, TRUE, &error)) {
- *error_list = g_list_append(*error_list,
- g_strdup_printf("Couldn't open addressbook: %s",
- error->message));
+ g_warning (_("Couldn't open addressbook: %s"), error->message);
g_error_free (error);
e_book_query_unref(query);
g_object_unref(merge_evolution->private->book);
merge_evolution->private->book = NULL;
-
return;
}
status = e_book_get_supported_fields(merge_evolution->private->book,
&fields, &error);
if (status == FALSE) {
- *error_list = g_list_append(*error_list,
- g_strdup_printf("Couldn't list available fields: %s",
- error->message));
+ g_warning (_("Couldn't list available fields: %s"), error->message);
g_error_free (error);
e_book_query_unref(query);
g_object_unref(merge_evolution->private->book);
merge_evolution->private->book = NULL;
-
return;
}
&merge_evolution->private->contacts,
&error);
if (status == FALSE) {
- *error_list = g_list_append(*error_list,
- g_strdup_printf("Couldn't get contacts: %s",
- error->message));
+ g_warning (_("Couldn't get contacts: %s"), error->message);
g_error_free (error);
e_book_query_unref(query);
free_field_list(merge_evolution->private->fields);
}
g_list_free(merge_evolution->private->contacts);
merge_evolution->private->contacts = NULL;
-
- for (iter = merge_evolution->private->error_list;
- iter != NULL;
- iter = g_list_next(iter))
- {
- g_free(iter->data);
- }
- merge_evolution->private->error_list = NULL;
}
/*--------------------------------------------------------------------------*/
merge_evolution = GL_MERGE_EVOLUTION (merge);
- /* we're in an error state */
- if (merge_evolution->private->error_list) {
- head = merge_evolution->private->error_list;
- char *error_str = head->data;
-
- /* a yucky hack to make the errors show up in the record list */
- record = g_new0 (glMergeRecord, 1);
- record->select_flag = TRUE;
-
- field = g_new0 (glMergeField, 1);
- field->key = g_strdup ("full_name");
- field->value = g_strdup (error_str);
-
- record->field_list = g_list_append (record->field_list, field);
-
- /* do a destructive read */
- g_free (error_str);
- merge_evolution->private->error_list =
- g_list_remove_link (merge_evolution->private->error_list, head);
- g_list_free_1 (head);
-
- return record;
- }
-
head = merge_evolution->private->contacts;
if (head == NULL) {
return NULL; /* past the last record */
class = g_type_class_ref (type);
if (class == NULL) {
- g_warning ("%s: unknown object type %d",
+ g_message ("%s: unknown object type %d",
G_STRLOC, type);
break;
}
pspec = g_object_class_find_property (class, pname);
if (pspec == NULL) {
- g_warning ("%s: object class `%s' has no property named `%s'",
+ g_message ("%s: object class `%s' has no property named `%s'",
G_STRLOC, g_type_name (type), pname);
break;
}
g_value_init (¶ms[n_params].value, pspec->value_type);
G_VALUE_COLLECT (¶ms[n_params].value, args, 0, &error);
if (error) {
- g_warning ("%s: %s", G_STRLOC, error);
+ g_message ("%s: %s", G_STRLOC, error);
g_free (error);
break;
}
}
if ( (merge == NULL) && (g_strcasecmp (name, "None") != 0)) {
- g_warning ("Unknown merge backend \"%s\"", name);
+ g_message ("Unknown merge backend \"%s\"", name);
}
gl_debug (DEBUG_MERGE, "END");
break;
default:
- g_warning ("option = %d", option);
+ g_message ("option = %d", option);
g_assert_not_reached ();
}
TRUE);
break;
default:
- g_warning ("Illegal units"); /* Should not happen */
+ g_message ("Illegal units"); /* Should not happen */
break;
}
GTK_TOGGLE_BUTTON(dlg->priv->page_size_a4_radio),
TRUE);
} else {
- g_warning ("Unknown default page size"); /* Shouldn't happen */
+ g_message ("Unknown default page size"); /* Shouldn't happen */
}
g_signal_handlers_unblock_by_func (
case GL_UNITS_MM:
return 0.35277778; /* mm */
default:
- g_warning ("Illegal units"); /* Should not happen */
+ g_message ("Illegal units"); /* Should not happen */
return 1.0;
}
}
case GL_UNITS_MM:
return 1; /* mm */
default:
- g_warning ("Illegal units"); /* Should not happen */
+ g_message ("Illegal units"); /* Should not happen */
return 1.0;
}
}
case GL_UNITS_MM:
return 0.1; /* mm */
default:
- g_warning ("Illegal units"); /* Should not happen */
+ g_message ("Illegal units"); /* Should not happen */
return 1.0;
}
}
case GL_UNITS_MM:
return _("mm");
default:
- g_warning ("Illegal units"); /* Should not happen */
+ g_message ("Illegal units"); /* Should not happen */
return _("points");
}
}
break;
default:
- g_warning ("Unknown template label style");
+ g_message ("Unknown template label style");
break;
}
break;
default:
- g_warning ("Unknown template label style");
+ g_message ("Unknown template label style");
break;
}
break;
default:
- g_warning ("Unknown template label style");
+ g_message ("Unknown template label style");
break;
}
FALSE, NULL);
if (!g_file_test (splash_pixmap_file, G_FILE_TEST_EXISTS)) {
- g_warning ("Could not find %s", SPLASH_PIXMAP_FILE);
+ g_message ("Could not find %s", SPLASH_PIXMAP_FILE);
}
pixbuf = gdk_pixbuf_new_from_file (splash_pixmap_file, &gerror);
if (gerror != NULL) {
- g_warning ("cannot open splash pixbuf: %s", gerror->message );
+ g_message ("cannot open splash pixbuf: %s", gerror->message );
gtk_widget_destroy (splash);
return;
}
if (error != NULL)
{
- g_warning (error->message);
+ g_message (error->message);
g_error_free (error);
}
break;
default:
- g_warning ("Invalid resizable highlight style");
+ g_message ("Invalid resizable highlight style");
}
break;
default:
view_highlight->private->outline = NULL;
- g_warning ("Invalid resizable highlight style");
+ g_message ("Invalid resizable highlight style");
}
#endif
break;
default:
- g_warning ("Invalid resizable highlight style");
+ g_message ("Invalid resizable highlight style");
}
break;
default:
- g_warning ("Invalid resizable highlight style");
+ g_message ("Invalid resizable highlight style");
}
} else {
/* Should not happen! */
view_object = NULL;
- g_warning ("Invalid label object type.");
+ g_message ("Invalid label object type.");
}
}
}
break;
default:
- g_warning ("Unknown template label style");
+ g_message ("Unknown template label style");
break;
}
draw_markup_circle (view, markup);
break;
default:
- g_warning ("Unknown template markup type");
+ g_message ("Unknown template markup type");
break;
}
}
break;
default:
- g_warning ("Unknown template label style");
+ g_message ("Unknown template label style");
break;
}
cursor = gl_view_barcode_get_create_cursor ();
break;
default:
- g_warning ("Invalid label object type.");/*Should not happen!*/
+ g_message ("Invalid label object type.");/*Should not happen!*/
break;
}
break;
default:
/*Should not happen!*/
- g_warning ("Invalid label object type.");
+ g_message ("Invalid label object type.");
return FALSE;
}
default:
- g_warning ("Invalid view state."); /*Should not happen!*/
+ g_message ("Invalid view state."); /*Should not happen!*/
return FALSE;
}
} else {
/* Should not happen! */
view_object = NULL;
- g_warning ("Invalid label object type.");
+ g_message ("Invalid label object type.");
}
gl_view_select_object (view, view_object);
}
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * warning-handler.c: non-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 "warning-handler.h"
+
+#include <glib/gmessages.h>
+#include <glib/gi18n.h>
+#include <gtk/gtkmessagedialog.h>
+#include <gtk/gtkstock.h>
+#include <stdlib.h>
+
+static void warning_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data);
+
+\f
+/***************************************************************************/
+/* Initialize error handler. */
+/***************************************************************************/
+void
+gl_warning_handler_init (void)
+{
+ g_log_set_handler ("LibGlabels",
+ G_LOG_LEVEL_WARNING,
+ warning_handler,
+ "libglabels");
+
+ g_log_set_handler (NULL,
+ G_LOG_LEVEL_WARNING,
+ warning_handler,
+ "glabels");
+}
+
+/*-------------------------------------------------------------------------*/
+/* PRIVATE. Actual error handler. */
+/*-------------------------------------------------------------------------*/
+static void
+warning_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_CLOSE,
+ _("gLabels Error!"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ message);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+}
+
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * warning-handler.h: non-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 __WARNING_HANDLER_H__
+#define __WARNING_HANDLER_H__
+
+#include <glib/gmacros.h>
+
+G_BEGIN_DECLS
+
+void gl_warning_handler_init (void);
+
+G_END_DECLS
+
+#endif
}
break;
default:
- g_warning ("Unknown label style");
+ g_message ("Unknown label style");
return list;
break;
}
}
break;
default:
- g_warning ("Unknown label style");
+ g_message ("Unknown label style");
break;
}
*status = XML_LABEL_OK;
if (!xmlStrEqual (root->name, (xmlChar *)"Label")) {
- g_warning (_("Bad root node = \"%s\""), root->name);
+ g_message (_("Bad root node = \"%s\""), root->name);
*status = XML_LABEL_ERROR_OPEN_PARSE;
return NULL;
}
} else if (xmlStrEqual (node->name, (xmlChar *)"Merge_Properties")) {
xml04_parse_merge_properties (node, label);
} else {
- g_warning (_("bad node = \"%s\""), node->name);
+ g_message (_("bad node = \"%s\""), node->name);
}
}
}
template = gl_template_from_name ((gchar *)template_name);
if (template == NULL) {
- g_warning ("Undefined template \"%s\"", template_name);
+ g_message ("Undefined template \"%s\"", template_name);
/* Get a default */
template = gl_template_from_name (NULL);
ret = FALSE;
nodes =
g_list_append (nodes, node_text);
} else {
- g_warning ("Unexpected Text Line child: \"%s\"",
+ g_message ("Unexpected Text Line child: \"%s\"",
text_node->name);
}
lines = g_list_append (lines, nodes);
} else if (!xmlNodeIsText (line_node)) {
- g_warning ("Unexpected Text child: \"%s\"",
+ g_message ("Unexpected Text child: \"%s\"",
line_node->name);
}
text_node->field_flag = FALSE;
text_node->data = (gchar *)xmlNodeGetContent (child);
} else {
- g_warning ("Unexpected Barcode child: \"%s\"", child->name);
+ g_message ("Unexpected Barcode child: \"%s\"", child->name);
}
gl_label_barcode_set_data (object, text_node);
*status = XML_LABEL_OK;
if (!xmlStrEqual (root->name, (xmlChar *)"Document")) {
- g_warning (_("Bad root node = \"%s\""), root->name);
+ g_message (_("Bad root node = \"%s\""), root->name);
*status = XML_LABEL_ERROR_OPEN_PARSE;
return NULL;
}
/* Handled in pass 1. */
} else {
if (!xmlNodeIsText (node)) {
- g_warning (_("bad node in Document node = \"%s\""),
+ g_message (_("bad node in Document node = \"%s\""),
node->name);
}
}
xml191_parse_object (node, label);
} else {
if (!xmlNodeIsText (node)) {
- g_warning (_("bad node = \"%s\""), node->name);
+ g_message (_("bad node = \"%s\""), node->name);
}
}
}
} else if ( xmlStrEqual (string, (xmlChar *)"Barcode") ) {
object = xml191_parse_barcode_props (object_node, label);
} else {
- g_warning ("Unknown label object type \"%s\"", string);
+ g_message ("Unknown label object type \"%s\"", string);
xmlFree (string);
return;
}
nodes =
g_list_append (nodes, node_text);
} else if (!xmlNodeIsText (text_node)) {
- g_warning ("Unexpected Text Line child: \"%s\"",
+ g_message ("Unexpected Text Line child: \"%s\"",
text_node->name);
}
lines = g_list_append (lines, nodes);
} else if (!xmlNodeIsText (line_node)) {
- g_warning ("Unexpected Text child: \"%s\"",
+ g_message ("Unexpected Text child: \"%s\"",
line_node->name);
}
filename->field_flag = FALSE;
filename->data = (gchar *)xmlGetProp (child, (xmlChar *)"src");
} else if (!xmlNodeIsText (child)) {
- g_warning ("Unexpected Image child: \"%s\"", child->name);
+ g_message ("Unexpected Image child: \"%s\"", child->name);
}
}
text_node->field_flag = FALSE;
text_node->data = (gchar *)xmlNodeGetContent (child);
} else if (!xmlNodeIsText (child)) {
- g_warning ("Unexpected Barcode child: \"%s\"", child->name);
+ g_message ("Unexpected Barcode child: \"%s\"", child->name);
}
}
xml191_parse_pixdata (child, label);
} else {
if (!xmlNodeIsText (child)) {
- g_warning (_("bad node in Data node = \"%s\""),
+ g_message (_("bad node in Data node = \"%s\""),
child->name);
}
}
if (paper == NULL) {
/* This should always be an id, but just in case a name
slips by! */
- g_warning (_("Unknown page size id \"%s\", trying as name"),
+ g_message (_("Unknown page size id \"%s\", trying as name"),
template->page_size);
paper = gl_paper_from_name (template->page_size);
g_free (template->page_size);
page_width = paper->width;
page_height = paper->height;
} else {
- g_warning (_("Unknown page size id or name \"%s\""),
+ g_message (_("Unknown page size id or name \"%s\""),
page_size);
}
gl_paper_free (paper);
xml191_parse_alias (node, template);
} else {
if (!xmlNodeIsText (node)) {
- g_warning ("bad node = \"%s\"", node->name);
+ g_message ("bad node = \"%s\"", node->name);
}
}
}
shape = GL_TEMPLATE_SHAPE_CD;
} else {
shape = GL_TEMPLATE_SHAPE_RECT;
- g_warning ("Unknown label style in template");
+ g_message ("Unknown label style in template");
}
xmlFree (style);
} else if (xmlStrEqual (node->name, (xmlChar *)"Markup")) {
xml191_parse_markup (node, label_type);
} else if (!xmlNodeIsText (node)) {
- g_warning ("bad node = \"%s\"", node->name);
+ g_message ("bad node = \"%s\"", node->name);
}
}
for (node = layout_node->xmlChildrenNode; node != NULL;
node = node->next) {
if (!xmlNodeIsText (node)) {
- g_warning ("bad node = \"%s\"", node->name);
+ g_message ("bad node = \"%s\"", node->name);
}
}
for (node = markup_node->xmlChildrenNode; node != NULL;
node = node->next) {
if (!xmlNodeIsText (node)) {
- g_warning ("bad node = \"%s\"", node->name);
+ g_message ("bad node = \"%s\"", node->name);
}
}
doc = xmlParseFile (filename);
if (!doc) {
- g_warning (_("xmlParseFile error"));
+ g_message (_("xmlParseFile error"));
*status = XML_LABEL_ERROR_OPEN_PARSE;
return NULL;
}
doc = xmlParseDoc ((xmlChar *) buffer);
if (!doc) {
- g_warning (_("xmlParseFile error"));
+ g_message (_("xmlParseFile error"));
*status = XML_LABEL_ERROR_OPEN_PARSE;
return NULL;
}
root = xmlDocGetRootElement (doc);
if (!root || !root->name) {
- g_warning (_("No document root"));
+ g_message (_("No document root"));
*status = XML_LABEL_ERROR_OPEN_PARSE;
return NULL;
}
/* Try compatability mode 0.1 */
ns = xmlSearchNsByHref (doc, root, (xmlChar *)COMPAT01_NAME_SPACE);
if (ns != NULL) {
- g_warning (_("Importing from glabels 0.1 format"));
- g_warning ("TODO");
+ g_message (_("Importing from glabels 0.1 format"));
+ g_message ("TODO");
label = NULL; /* TODO */
} else {
/* Try compatability mode 0.4 */
ns = xmlSearchNsByHref (doc, root,
(xmlChar *)COMPAT04_NAME_SPACE);
if (ns != NULL) {
- g_warning (_("Importing from glabels 0.4 format"));
+ g_message (_("Importing from glabels 0.4 format"));
label = gl_xml_label_04_parse (root, status);
} else {
/* Try compatability mode 1.91 */
ns = xmlSearchNsByHref (doc, root,
(xmlChar *)COMPAT191_NAME_SPACE);
if (ns != NULL) {
- g_warning (_("Importing from glabels 1.91 format"));
+ g_message (_("Importing from glabels 1.91 format"));
label = gl_xml_label_191_parse (root, status);
} else {
- g_warning (_("bad document, unknown glabels Namespace"));
+ g_message (_("bad document, unknown glabels Namespace"));
*status = XML_LABEL_ERROR_OPEN_PARSE;
return NULL;
}
*status = XML_LABEL_OK;
if (!gl_xml_is_node (root, "Glabels-document")) {
- g_warning (_("Bad root node = \"%s\""), root->name);
+ g_message (_("Bad root node = \"%s\""), root->name);
*status = XML_LABEL_ERROR_OPEN_PARSE;
return NULL;
}
/* Handled in pass 1. */
} else {
if (!xmlNodeIsText (child_node)) {
- g_warning (_("bad node in Document node = \"%s\""),
+ g_message (_("bad node in Document node = \"%s\""),
child_node->name);
g_object_unref (label);
*status = XML_LABEL_ERROR_OPEN_PARSE;
xml_parse_object_barcode (child, label);
} else {
if (!xmlNodeIsText (child)) {
- g_warning (_("bad node = \"%s\""), child->name);
+ g_message (_("bad node = \"%s\""), child->name);
break;
}
}
break;
} else {
if (!xmlNodeIsText (child)) {
- g_warning ("Unexpected Object-text child: \"%s\"",
+ g_message ("Unexpected Object-text child: \"%s\"",
child->name);
}
}
gl_text_node_free (&filename);
xmlFree (string);
} else {
- g_warning ("Missing Object-image src or field attr");
+ g_message ("Missing Object-image src or field attr");
}
}
gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node);
gl_text_node_free (&text_node);
} else {
- g_warning ("Missing Object-barcode data or field attr");
+ g_message ("Missing Object-barcode data or field attr");
}
}
xml_parse_pixdata (child, label);
} else {
if (!xmlNodeIsText (child)) {
- g_warning (_("bad node in Data node = \"%s\""),
+ g_message (_("bad node in Data node = \"%s\""),
child->name);
}
}
} else if (gl_xml_is_node (child, "Span")) {
- g_warning ("Unexpected rich text (not supported, yet!)");
+ g_message ("Unexpected rich text (not supported, yet!)");
} else if (gl_xml_is_node (child, "Field")) {
text_nodes = NULL;
} else {
- g_warning ("Unexpected Span child: \"%s\"", child->name);
+ g_message ("Unexpected Span child: \"%s\"", child->name);
}
}
filename = g_filename_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
if (!filename)
- g_warning (_("Utf8 conversion error."));
+ g_message (_("Utf8 conversion error."));
else {
xmlSetDocCompressMode (doc, gl_label_get_compression (label));
xml_ret = xmlSaveFormatFile (filename, doc, TRUE);
xmlFreeDoc (doc);
if (xml_ret == -1) {
- g_warning (_("Problem saving xml file."));
+ g_message (_("Problem saving xml file."));
*status = XML_LABEL_ERROR_SAVE_FILE;
} else {
} else if ( GL_IS_LABEL_BARCODE(object) ) {
xml_create_object_barcode (node, ns, object);
} else {
- g_warning ("Unknown label object");
+ g_message ("Unknown label object");
}
}