From 9e26662eaa578f1d48636e503ceee998f192c8cd Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Fri, 9 Dec 2005 04:55:49 +0000 Subject: [PATCH] 2005-12-08 Jim Evins * 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 --- glabels2/ChangeLog | 70 ++++++++++++++++++++++++ glabels2/libglabels/paper.c | 2 +- glabels2/libglabels/template.c | 4 +- glabels2/libglabels/xml-paper.c | 10 ++-- glabels2/libglabels/xml-template.c | 38 ++++++------- glabels2/libglabels/xml.c | 2 +- glabels2/src/Makefile.am | 2 + glabels2/src/bc-gnubarcode.c | 6 +- glabels2/src/bc-postnet.c | 2 +- glabels2/src/bc.c | 4 +- glabels2/src/critical-error-handler.c | 2 +- glabels2/src/glabels.c | 5 +- glabels2/src/merge-evolution.c | 61 +++------------------ glabels2/src/merge.c | 8 +-- glabels2/src/object-editor.c | 2 +- glabels2/src/prefs-dialog.c | 4 +- glabels2/src/prefs.c | 8 +-- glabels2/src/print.c | 6 +- glabels2/src/splash.c | 4 +- glabels2/src/ui-commands.c | 2 +- glabels2/src/view-highlight.c | 8 +-- glabels2/src/view.c | 16 +++--- glabels2/src/warning-handler.c | 79 +++++++++++++++++++++++++++ glabels2/src/warning-handler.h | 36 ++++++++++++ glabels2/src/wdgt-mini-preview.c | 2 +- glabels2/src/wdgt-rotate-label.c | 2 +- glabels2/src/xml-label-04.c | 12 ++-- glabels2/src/xml-label-191.c | 32 +++++------ glabels2/src/xml-label.c | 40 +++++++------- 29 files changed, 305 insertions(+), 164 deletions(-) create mode 100644 glabels2/src/warning-handler.c create mode 100644 glabels2/src/warning-handler.h diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index 8b3df333..9d1b5ddd 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,73 @@ +2005-12-08 Jim Evins + + * 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 * libglabels/libglabels-private.h: diff --git a/glabels2/libglabels/paper.c b/glabels2/libglabels/paper.c index 88e4b374..e81432ac 100644 --- a/glabels2/libglabels/paper.c +++ b/glabels2/libglabels/paper.c @@ -483,7 +483,7 @@ read_paper_files_from_dir (GList *papers, 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; } diff --git a/glabels2/libglabels/template.c b/glabels2/libglabels/template.c index abadc480..7d584f09 100644 --- a/glabels2/libglabels/template.c +++ b/glabels2/libglabels/template.c @@ -134,7 +134,7 @@ gl_template_register (const glTemplate *template) 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."); } } @@ -928,7 +928,7 @@ read_template_files_from_dir (GList *templates, 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; } diff --git a/glabels2/libglabels/xml-paper.c b/glabels2/libglabels/xml-paper.c index c30cb4df..b0727ef2 100644 --- a/glabels2/libglabels/xml-paper.c +++ b/glabels2/libglabels/xml-paper.c @@ -68,13 +68,13 @@ gl_xml_paper_read_papers_from_file (gchar *utf8_filename) 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; } @@ -108,13 +108,13 @@ gl_xml_paper_parse_papers_doc (xmlDocPtr papers_doc) 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; @@ -128,7 +128,7 @@ gl_xml_paper_parse_papers_doc (xmlDocPtr papers_doc) } 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); } } } diff --git a/glabels2/libglabels/xml-template.c b/glabels2/libglabels/xml-template.c index 339a61b0..64fc2da5 100644 --- a/glabels2/libglabels/xml-template.c +++ b/glabels2/libglabels/xml-template.c @@ -104,13 +104,13 @@ gl_xml_template_read_templates_from_file (const gchar *utf8_filename) 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; } @@ -145,12 +145,12 @@ gl_xml_template_parse_templates_doc (const xmlDocPtr templates_doc) 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; } @@ -163,7 +163,7 @@ gl_xml_template_parse_templates_doc (const xmlDocPtr templates_doc) } 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); } } } @@ -207,7 +207,7 @@ gl_xml_template_parse_template_node (const xmlNodePtr template_node) 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); @@ -217,7 +217,7 @@ gl_xml_template_parse_template_node (const xmlNodePtr template_node) 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); @@ -242,7 +242,7 @@ gl_xml_template_parse_template_node (const xmlNodePtr template_node) } 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); } } } @@ -299,7 +299,7 @@ xml_parse_label_rectangle_node (xmlNodePtr label_node, 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); } } } @@ -339,7 +339,7 @@ xml_parse_label_round_node (xmlNodePtr label_node, 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); } } } @@ -382,7 +382,7 @@ xml_parse_label_cd_node (xmlNodePtr label_node, 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); } } } @@ -417,7 +417,7 @@ xml_parse_layout_node (xmlNodePtr layout_node, 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); } } } @@ -443,7 +443,7 @@ xml_parse_markup_margin_node (xmlNodePtr markup_node, 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); } } } @@ -472,7 +472,7 @@ xml_parse_markup_line_node (xmlNodePtr markup_node, 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); } } } @@ -500,7 +500,7 @@ xml_parse_markup_circle_node (xmlNodePtr markup_node, 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); } } } @@ -555,14 +555,14 @@ gl_xml_template_write_templates_to_file (GList *templates, 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); @@ -685,7 +685,7 @@ xml_create_label_node (const glTemplateLabelType *label_type, break; default: - g_warning ("Unknown label style"); + g_message ("Unknown label style"); return; break; @@ -704,7 +704,7 @@ xml_create_label_node (const glTemplateLabelType *label_type, xml_create_markup_circle_node (markup, node, ns); break; default: - g_warning ("Unknown markup type"); + g_message ("Unknown markup type"); break; } } diff --git a/glabels2/libglabels/xml.c b/glabels2/libglabels/xml.c index eccd26bc..19fab3f9 100644 --- a/glabels2/libglabels/xml.c +++ b/glabels2/libglabels/xml.c @@ -322,7 +322,7 @@ gl_xml_get_prop_length (xmlNodePtr node, } } 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); } diff --git a/glabels2/src/Makefile.am b/glabels2/src/Makefile.am index 51f87a62..7b2ee4f9 100644 --- a/glabels2/src/Makefile.am +++ b/glabels2/src/Makefile.am @@ -41,6 +41,8 @@ glabels_SOURCES = \ glabels.c \ splash.c \ splash.h \ + warning-handler.c \ + warning-handler.h \ critical-error-handler.c \ critical-error-handler.h \ window.c \ diff --git a/glabels2/src/bc-gnubarcode.c b/glabels2/src/bc-gnubarcode.c index b2da4231..40a51fe9 100644 --- a/glabels2/src/bc-gnubarcode.c +++ b/glabels2/src/bc-gnubarcode.c @@ -172,7 +172,7 @@ gl_barcode_gnubarcode_new (const gchar *id, } 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; } @@ -193,7 +193,7 @@ gl_barcode_gnubarcode_new (const gchar *id, Barcode_Encode (bci, flags); if (!bci->partial || !bci->textinfo) { - g_warning ("Barcode Data Invalid"); + g_message ("Barcode Data Invalid"); Barcode_Delete (bci); return NULL; } @@ -352,7 +352,7 @@ render_pass1 (struct Barcode_Item *bci, 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); diff --git a/glabels2/src/bc-postnet.c b/glabels2/src/bc-postnet.c index fec0daab..694069eb 100644 --- a/glabels2/src/bc-postnet.c +++ b/glabels2/src/bc-postnet.c @@ -177,7 +177,7 @@ postnet_code (const gchar *digits) } } 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 */ diff --git a/glabels2/src/bc.c b/glabels2/src/bc.c index cd3f3635..eeb6f964 100644 --- a/glabels2/src/bc.c +++ b/glabels2/src/bc.c @@ -172,7 +172,7 @@ id_to_index (const gchar *id) } } - g_warning( "Unknown barcode id \"%s\"", id ); + g_message( "Unknown barcode id \"%s\"", id ); return 0; } @@ -192,7 +192,7 @@ name_to_index (const gchar *name) } } - g_warning( "Unknown barcode name \"%s\"", name ); + g_message( "Unknown barcode name \"%s\"", name ); return 0; } diff --git a/glabels2/src/critical-error-handler.c b/glabels2/src/critical-error-handler.c index be2c2ed0..21b2c509 100644 --- a/glabels2/src/critical-error-handler.c +++ b/glabels2/src/critical-error-handler.c @@ -78,6 +78,6 @@ critical_error_handler (const gchar *log_domain, gtk_dialog_run (GTK_DIALOG (dialog)); - exit (-1); + abort (); } diff --git a/glabels2/src/glabels.c b/glabels2/src/glabels.c index b1354b0e..b8583f36 100644 --- a/glabels2/src/glabels.c +++ b/glabels2/src/glabels.c @@ -91,8 +91,9 @@ main (int argc, char **argv) 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 (); @@ -102,7 +103,7 @@ main (int argc, char **argv) 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 { diff --git a/glabels2/src/merge-evolution.c b/glabels2/src/merge-evolution.c index 9fc36582..af48eee8 100644 --- a/glabels2/src/merge-evolution.c +++ b/glabels2/src/merge-evolution.c @@ -28,8 +28,9 @@ #include "merge-evolution.h" -#include +#include +#include #include #include @@ -46,7 +47,6 @@ struct _glMergeEvolutionPrivate { EBook *book; GList *contacts; GList *fields; /* the fields supported by the addressbook */ - GList *error_list; /* list of error strings */ }; enum { @@ -295,41 +295,31 @@ gl_merge_evolution_open (glMerge *merge) 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; } @@ -337,14 +327,11 @@ gl_merge_evolution_open (glMerge *merge) 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; } @@ -372,9 +359,7 @@ gl_merge_evolution_open (glMerge *merge) &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); @@ -417,14 +402,6 @@ gl_merge_evolution_close (glMerge *merge) } 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; } /*--------------------------------------------------------------------------*/ @@ -443,30 +420,6 @@ gl_merge_evolution_get_record (glMerge *merge) 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 */ diff --git a/glabels2/src/merge.c b/glabels2/src/merge.c index 744ca257..d902b31b 100644 --- a/glabels2/src/merge.c +++ b/glabels2/src/merge.c @@ -124,13 +124,13 @@ gl_merge_register_backend (GType type, 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; } @@ -143,7 +143,7 @@ gl_merge_register_backend (GType type, 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; } @@ -325,7 +325,7 @@ gl_merge_new (gchar *name) } 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"); diff --git a/glabels2/src/object-editor.c b/glabels2/src/object-editor.c index a7e817d3..2290d764 100644 --- a/glabels2/src/object-editor.c +++ b/glabels2/src/object-editor.c @@ -326,7 +326,7 @@ gl_object_notebook_construct_valist (glObjectEditor *editor, break; default: - g_warning ("option = %d", option); + g_message ("option = %d", option); g_assert_not_reached (); } diff --git a/glabels2/src/prefs-dialog.c b/glabels2/src/prefs-dialog.c index 1ff63d0a..69fe674c 100644 --- a/glabels2/src/prefs-dialog.c +++ b/glabels2/src/prefs-dialog.c @@ -503,7 +503,7 @@ update_locale_page_from_prefs (glPrefsDialog *dlg) TRUE); break; default: - g_warning ("Illegal units"); /* Should not happen */ + g_message ("Illegal units"); /* Should not happen */ break; } @@ -516,7 +516,7 @@ update_locale_page_from_prefs (glPrefsDialog *dlg) 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 ( diff --git a/glabels2/src/prefs.c b/glabels2/src/prefs.c index b5648156..d8141843 100644 --- a/glabels2/src/prefs.c +++ b/glabels2/src/prefs.c @@ -99,7 +99,7 @@ gl_prefs_get_units_per_point (void) 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; } } @@ -119,7 +119,7 @@ gl_prefs_get_units_precision (void) 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; } } @@ -139,7 +139,7 @@ gl_prefs_get_units_step_size (void) 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; } } @@ -159,7 +159,7 @@ gl_prefs_get_units_string (void) case GL_UNITS_MM: return _("mm"); default: - g_warning ("Illegal units"); /* Should not happen */ + g_message ("Illegal units"); /* Should not happen */ return _("points"); } } diff --git a/glabels2/src/print.c b/glabels2/src/print.c index 0ef01675..5f22ba41 100644 --- a/glabels2/src/print.c +++ b/glabels2/src/print.c @@ -1248,7 +1248,7 @@ draw_outline (PrintInfo *pi, break; default: - g_warning ("Unknown template label style"); + g_message ("Unknown template label style"); break; } @@ -1318,7 +1318,7 @@ clip_to_outline (PrintInfo *pi, break; default: - g_warning ("Unknown template label style"); + g_message ("Unknown template label style"); break; } @@ -1361,7 +1361,7 @@ clip_punchouts (PrintInfo *pi, break; default: - g_warning ("Unknown template label style"); + g_message ("Unknown template label style"); break; } diff --git a/glabels2/src/splash.c b/glabels2/src/splash.c index 3c46e445..a47fbfc5 100644 --- a/glabels2/src/splash.c +++ b/glabels2/src/splash.c @@ -71,11 +71,11 @@ gl_splash (void) 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; } diff --git a/glabels2/src/ui-commands.c b/glabels2/src/ui-commands.c index ac93d95c..b2f416ef 100644 --- a/glabels2/src/ui-commands.c +++ b/glabels2/src/ui-commands.c @@ -1054,7 +1054,7 @@ gl_ui_cmd_help_contents (GtkAction *action, if (error != NULL) { - g_warning (error->message); + g_message (error->message); g_error_free (error); } diff --git a/glabels2/src/view-highlight.c b/glabels2/src/view-highlight.c index 0149f208..64e859aa 100644 --- a/glabels2/src/view-highlight.c +++ b/glabels2/src/view-highlight.c @@ -277,7 +277,7 @@ gl_view_highlight_new (glViewObject *view_object, break; default: - g_warning ("Invalid resizable highlight style"); + g_message ("Invalid resizable highlight style"); } @@ -369,7 +369,7 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, break; default: view_highlight->private->outline = NULL; - g_warning ("Invalid resizable highlight style"); + g_message ("Invalid resizable highlight style"); } #endif @@ -740,7 +740,7 @@ object_changed_cb (glLabelObject *object, break; default: - g_warning ("Invalid resizable highlight style"); + g_message ("Invalid resizable highlight style"); } @@ -776,7 +776,7 @@ view_scale_changed_cb (glView *view, break; default: - g_warning ("Invalid resizable highlight style"); + g_message ("Invalid resizable highlight style"); } diff --git a/glabels2/src/view.c b/glabels2/src/view.c index 29f7fc0d..9c0eb9a4 100644 --- a/glabels2/src/view.c +++ b/glabels2/src/view.c @@ -655,7 +655,7 @@ draw_label_layer (glView *view) } else { /* Should not happen! */ view_object = NULL; - g_warning ("Invalid label object type."); + g_message ("Invalid label object type."); } } } @@ -736,7 +736,7 @@ draw_bg_fg_layers (glView *view) break; default: - g_warning ("Unknown template label style"); + g_message ("Unknown template label style"); break; } @@ -1237,7 +1237,7 @@ draw_markup_layer (glView *view) draw_markup_circle (view, markup); break; default: - g_warning ("Unknown template markup type"); + g_message ("Unknown template markup type"); break; } } @@ -1294,7 +1294,7 @@ draw_markup_margin (glView *view, break; default: - g_warning ("Unknown template label style"); + g_message ("Unknown template label style"); break; } @@ -1803,7 +1803,7 @@ gl_view_object_create_mode (glView *view, 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; } @@ -3445,12 +3445,12 @@ canvas_event (GnomeCanvas *canvas, 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; } @@ -3727,7 +3727,7 @@ selection_received_cb (GtkWidget *widget, } 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); } diff --git a/glabels2/src/warning-handler.c b/glabels2/src/warning-handler.c new file mode 100644 index 00000000..6a9e9ee9 --- /dev/null +++ b/glabels2/src/warning-handler.c @@ -0,0 +1,79 @@ +/* -*- 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 . + * + * 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 + +#include "warning-handler.h" + +#include +#include +#include +#include +#include + +static void warning_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer user_data); + + +/***************************************************************************/ +/* 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)); +} + diff --git a/glabels2/src/warning-handler.h b/glabels2/src/warning-handler.h new file mode 100644 index 00000000..911cc16a --- /dev/null +++ b/glabels2/src/warning-handler.h @@ -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 + * + * warning-handler.h: non-critical error handler header file + * + * Copyright (C) 2005 Jim Evins . + * + * 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 + +G_BEGIN_DECLS + +void gl_warning_handler_init (void); + +G_END_DECLS + +#endif diff --git a/glabels2/src/wdgt-mini-preview.c b/glabels2/src/wdgt-mini-preview.c index c05d6d3f..f9a97e9f 100644 --- a/glabels2/src/wdgt-mini-preview.c +++ b/glabels2/src/wdgt-mini-preview.c @@ -425,7 +425,7 @@ mini_outline_list_new (GnomeCanvas *canvas, } break; default: - g_warning ("Unknown label style"); + g_message ("Unknown label style"); return list; break; } diff --git a/glabels2/src/wdgt-rotate-label.c b/glabels2/src/wdgt-rotate-label.c index 71e1bb3b..58a663b5 100644 --- a/glabels2/src/wdgt-rotate-label.c +++ b/glabels2/src/wdgt-rotate-label.c @@ -350,7 +350,7 @@ mini_preview_canvas_update (GnomeCanvas *canvas, } break; default: - g_warning ("Unknown label style"); + g_message ("Unknown label style"); break; } diff --git a/glabels2/src/xml-label-04.c b/glabels2/src/xml-label-04.c index 88b0c26e..c5eb9a76 100644 --- a/glabels2/src/xml-label-04.c +++ b/glabels2/src/xml-label-04.c @@ -73,7 +73,7 @@ glLabel *gl_xml_label_04_parse (xmlNodePtr root, *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; } @@ -121,7 +121,7 @@ glLabel *gl_xml_label_04_parse (xmlNodePtr root, } 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); } } } @@ -148,7 +148,7 @@ xml04_parse_media_description (xmlNodePtr node, 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; @@ -260,7 +260,7 @@ xml04_parse_text_props (xmlNodePtr object_node, 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); } @@ -268,7 +268,7 @@ xml04_parse_text_props (xmlNodePtr object_node, 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); } @@ -462,7 +462,7 @@ xml04_parse_barcode_props (xmlNodePtr node, 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); diff --git a/glabels2/src/xml-label-191.c b/glabels2/src/xml-label-191.c index 5f174c24..0b580b7c 100644 --- a/glabels2/src/xml-label-191.c +++ b/glabels2/src/xml-label-191.c @@ -128,7 +128,7 @@ gl_xml_label_191_parse (xmlNodePtr root, *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; } @@ -162,7 +162,7 @@ gl_xml_label_191_parse (xmlNodePtr root, /* 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); } } @@ -194,7 +194,7 @@ xml191_parse_objects (xmlNodePtr objects_node, xml191_parse_object (node, label); } else { if (!xmlNodeIsText (node)) { - g_warning (_("bad node = \"%s\""), node->name); + g_message (_("bad node = \"%s\""), node->name); } } } @@ -231,7 +231,7 @@ xml191_parse_object (xmlNodePtr object_node, } 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; } @@ -326,7 +326,7 @@ xml191_parse_text_props (xmlNodePtr object_node, 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); } @@ -334,7 +334,7 @@ xml191_parse_text_props (xmlNodePtr object_node, 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); } @@ -501,7 +501,7 @@ xml191_parse_image_props (xmlNodePtr node, 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); } } @@ -555,7 +555,7 @@ xml191_parse_barcode_props (xmlNodePtr node, 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); } } @@ -620,7 +620,7 @@ xml191_parse_data (xmlNodePtr node, 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); } } @@ -696,7 +696,7 @@ xml191_parse_sheet (xmlNodePtr sheet_node) 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); @@ -706,7 +706,7 @@ xml191_parse_sheet (xmlNodePtr sheet_node) 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); @@ -739,7 +739,7 @@ xml191_parse_sheet (xmlNodePtr sheet_node) xml191_parse_alias (node, template); } else { if (!xmlNodeIsText (node)) { - g_warning ("bad node = \"%s\"", node->name); + g_message ("bad node = \"%s\"", node->name); } } } @@ -777,7 +777,7 @@ xml191_parse_label (xmlNodePtr label_node, 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); @@ -820,7 +820,7 @@ xml191_parse_label (xmlNodePtr label_node, } 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); } } @@ -852,7 +852,7 @@ xml191_parse_layout (xmlNodePtr layout_node, 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); } } @@ -899,7 +899,7 @@ xml191_parse_markup (xmlNodePtr markup_node, 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); } } diff --git a/glabels2/src/xml-label.c b/glabels2/src/xml-label.c index 380120a2..3176df40 100644 --- a/glabels2/src/xml-label.c +++ b/glabels2/src/xml-label.c @@ -173,7 +173,7 @@ gl_xml_label_open (const gchar *utf8_filename, doc = xmlParseFile (filename); if (!doc) { - g_warning (_("xmlParseFile error")); + g_message (_("xmlParseFile error")); *status = XML_LABEL_ERROR_OPEN_PARSE; return NULL; } @@ -210,7 +210,7 @@ gl_xml_label_open_buffer (const gchar *buffer, doc = xmlParseDoc ((xmlChar *) buffer); if (!doc) { - g_warning (_("xmlParseFile error")); + g_message (_("xmlParseFile error")); *status = XML_LABEL_ERROR_OPEN_PARSE; return NULL; } @@ -247,7 +247,7 @@ xml_doc_to_label (xmlDocPtr doc, 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; } @@ -261,25 +261,25 @@ xml_doc_to_label (xmlDocPtr doc, /* 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; } @@ -308,7 +308,7 @@ xml_parse_label (xmlNodePtr root, *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; } @@ -345,7 +345,7 @@ xml_parse_label (xmlNodePtr root, /* 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; @@ -390,7 +390,7 @@ xml_parse_objects (xmlNodePtr node, 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; } } @@ -455,7 +455,7 @@ xml_parse_object_text (xmlNodePtr node, break; } else { if (!xmlNodeIsText (child)) { - g_warning ("Unexpected Object-text child: \"%s\"", + g_message ("Unexpected Object-text child: \"%s\"", child->name); } } @@ -702,7 +702,7 @@ xml_parse_object_image (xmlNodePtr node, 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"); } } @@ -793,7 +793,7 @@ xml_parse_object_barcode (xmlNodePtr node, 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"); } } @@ -854,7 +854,7 @@ xml_parse_data (xmlNodePtr node, 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); } } @@ -979,7 +979,7 @@ xml_parse_toplevel_span (xmlNodePtr node, } 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")) { @@ -997,7 +997,7 @@ xml_parse_toplevel_span (xmlNodePtr node, text_nodes = NULL; } else { - g_warning ("Unexpected Span child: \"%s\"", child->name); + g_message ("Unexpected Span child: \"%s\"", child->name); } } @@ -1030,14 +1030,14 @@ gl_xml_label_save (glLabel *label, 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 { @@ -1157,7 +1157,7 @@ xml_create_objects (xmlNodePtr root, } 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"); } } -- 2.39.5