[gnumeric] Show all warnings in ODF import.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Show all warnings in ODF import.
- Date: Tue, 24 Aug 2010 22:41:57 +0000 (UTC)
commit 914b45c325ba2e0888652c014f3897a57d40e54a
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Tue Aug 24 16:41:00 2010 -0600
Show all warnings in ODF import.
2010-08-24 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/gui-util.h (gnumeric_go_error_info_list_dialog_new): new
(gnumeric_go_error_info_list_dialog_show): new
* src/gui-util.c (gnumeric_go_error_info_list_dialog_new): new
(gnumeric_go_error_info_list_dialog_show): new, maily code from
gnumeric_go_error_info_dialog_new
(gnumeric_go_error_info_dialog_new): use
gnumeric_go_error_info_list_dialog_show
* src/io-context-gtk.c (icg_error_error_info_list): new
(icg_set_num_files): connect icg_error_error_info_list
* src/wbc-gtk.c (wbcg_error_error_info_list): new
(wbcg_gnm_cmd_context_init): connect wbcg_error_error_info_list
* src/workbook-control.c (wbc_cmd_context_init): insert reminder stub
2010-08-24 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c: minor adjustments to oo_warning error strings.
ChangeLog | 15 ++++++++++
NEWS | 2 +-
plugins/openoffice/ChangeLog | 4 +++
plugins/openoffice/openoffice-read.c | 6 ++--
src/gui-util.c | 48 ++++++++++++++++++++++++++++-----
src/gui-util.h | 3 ++
src/io-context-gtk.c | 14 ++++++++++
src/wbc-gtk.c | 9 ++++++
src/workbook-control.c | 1 +
9 files changed, 90 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index dc4698e..bbe50dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-08-24 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/gui-util.h (gnumeric_go_error_info_list_dialog_new): new
+ (gnumeric_go_error_info_list_dialog_show): new
+ * src/gui-util.c (gnumeric_go_error_info_list_dialog_new): new
+ (gnumeric_go_error_info_list_dialog_show): new, maily code from
+ gnumeric_go_error_info_dialog_new
+ (gnumeric_go_error_info_dialog_new): use
+ gnumeric_go_error_info_list_dialog_show
+ * src/io-context-gtk.c (icg_error_error_info_list): new
+ (icg_set_num_files): connect icg_error_error_info_list
+ * src/wbc-gtk.c (wbcg_error_error_info_list): new
+ (wbcg_gnm_cmd_context_init): connect wbcg_error_error_info_list
+ * src/workbook-control.c (wbc_cmd_context_init): insert reminder stub
+
2010-08-24 Morten Welinder <terra gnome org>
* src/gnm-plugin.c (plugin_service_function_group_read_xml)
diff --git a/NEWS b/NEWS
index 824ed8d..4d72c5a 100644
--- a/NEWS
+++ b/NEWS
@@ -7,7 +7,7 @@ Andreas:
* Improve handling of corrupted ODF files.
* Fix percentage style import from ODF. [#627517]
* Fix INTERPOLATION documentation. [#627461]
- * Provide progress info in ODF export.
+ * Provide progress info in ODF export and show all warnings.
Jean:
* Fix some interpolation and periodogram issues.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 1aec450..d9e5297 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,7 @@
+2010-08-24 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-read.c: minor adjustments to oo_warning error strings.
+
2010-08-23 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_warning): assuming a new goffice, all
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 6e1124c..0c63343 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -397,7 +397,7 @@ oo_attr_int_range (GsfXMLIn *xin, xmlChar const * const *attrs,
if (!oo_attr_int (xin, attrs, ns_id, name, &tmp))
return FALSE;
if (tmp < min || tmp > max) {
- oo_warning (xin, _("Possible corrupted integer '%s', for '%s'"),
+ oo_warning (xin, _("Possible corrupted integer '%s' for '%s'"),
attrs[1], name);
*res = (tmp < min) ? min : max;
return TRUE;
@@ -843,7 +843,7 @@ oo_expr_parse_str (GsfXMLIn *xin, char const *str,
texpr = gnm_expr_parse_str (str, pp, flags,
state->convs[type], &perr);
if (texpr == NULL) {
- oo_warning (xin, _("Unable to parse\n\t'%s'\nbecause '%s'"),
+ oo_warning (xin, _("Unable to parse '%s' ('%s')"),
str, perr.err->message);
parse_error_free (&perr);
}
@@ -2204,7 +2204,7 @@ oo_date_style_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
g_string_free (state->cur_format.accum, TRUE);
state->cur_format.accum = NULL;
}
- oo_warning (xin, _("Corrupted file: unnamed date style ignored."));
+ oo_warning (xin, _("Unnamed date style ignored."));
} else {
if (state->cur_format.magic != GO_FORMAT_MAGIC_NONE)
g_hash_table_insert (state->formats, state->cur_format.name,
diff --git a/src/gui-util.c b/src/gui-util.c
index 45ac225..3292515 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -70,26 +70,36 @@ insert_error_info (GtkTextBuffer* text, GOErrorInfo *error, gint level)
* SHOULD BE IN GOFFICE
*/
GtkWidget *
-gnumeric_go_error_info_dialog_new (GOErrorInfo *error)
+gnumeric_go_error_info_list_dialog_new (GSList *errs)
{
GtkWidget *dialog;
GtkWidget *scrolled_window;
GtkTextView *view;
GtkTextBuffer *text;
GtkMessageType mtype;
- gchar *message;
gint bf_lim = 1;
gint i;
GdkScreen *screen;
+ GSList *l, *lf;
+ int severity = 0, this_severity;
+ gboolean message_null = TRUE;
+
+ for (l = errs; l != NULL; l = l->next) {
+ GOErrorInfo *err = l->data;
+ if (go_error_info_peek_message (err)!= NULL)
+ message_null = FALSE;
+ this_severity = go_error_info_peek_severity (err);
+ if (this_severity > severity)
+ severity = this_severity;
+ }
+ lf = g_slist_copy (errs);
+ lf = g_slist_reverse (lf);
- g_return_val_if_fail (error != NULL, NULL);
-
- message = (gchar *) go_error_info_peek_message (error);
- if (message == NULL)
+ if (message_null)
bf_lim++;
mtype = GTK_MESSAGE_ERROR;
- if (go_error_info_peek_severity (error) < GO_ERROR)
+ if (severity < GO_ERROR)
mtype = GTK_MESSAGE_WARNING;
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
mtype, GTK_BUTTONS_CLOSE, " ");
@@ -124,7 +134,11 @@ gnumeric_go_error_info_dialog_new (GOErrorInfo *error)
NULL);
g_free (tag_name);
}
- insert_error_info (text, error, 0);
+ for (l = lf; l != NULL; l = l->next) {
+ GOErrorInfo *err = l->data;
+ insert_error_info (text, err, 0);
+ }
+ g_slist_free (lf);
gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (view));
gtk_widget_show_all (GTK_WIDGET (scrolled_window));
@@ -134,6 +148,15 @@ gnumeric_go_error_info_dialog_new (GOErrorInfo *error)
return dialog;
}
+GtkWidget *
+gnumeric_go_error_info_dialog_new (GOErrorInfo *error)
+{
+ GSList *l = g_slist_append (NULL, error);
+ GtkWidget *w = gnumeric_go_error_info_list_dialog_new (l);
+ g_slist_free (l);
+ return w;
+}
+
/**
* gnumeric_go_error_info_dialog_show
*
@@ -145,6 +168,15 @@ gnumeric_go_error_info_dialog_show (GtkWindow *parent, GOErrorInfo *error)
go_gtk_dialog_run (GTK_DIALOG (dialog), parent);
}
+void
+gnumeric_go_error_info_list_dialog_show (GtkWindow *parent,
+ GSList *errs)
+{
+ GtkWidget *dialog = gnumeric_go_error_info_list_dialog_new (errs);
+ go_gtk_dialog_run (GTK_DIALOG (dialog), parent);
+}
+
+
typedef struct {
WBCGtk *wbcg;
GtkWidget *dialog;
diff --git a/src/gui-util.h b/src/gui-util.h
index 2c929ee..f5af754 100644
--- a/src/gui-util.h
+++ b/src/gui-util.h
@@ -17,8 +17,11 @@ G_BEGIN_DECLS
void name (GtkAction *a, WBCGtk *wbcg)
GtkWidget* gnumeric_go_error_info_dialog_new (GOErrorInfo *error);
+GtkWidget* gnumeric_go_error_info_list_dialog_new (GSList *errs);
void gnumeric_go_error_info_dialog_show (GtkWindow *parent,
GOErrorInfo *error);
+void gnumeric_go_error_info_list_dialog_show (GtkWindow *parent,
+ GSList *errs);
void gnumeric_restore_window_geometry (GtkWindow *dialog,
const char *key);
void gnumeric_keyed_dialog (WBCGtk *wbcg,
diff --git a/src/io-context-gtk.c b/src/io-context-gtk.c
index a7b5415..d811f54 100644
--- a/src/io-context-gtk.c
+++ b/src/io-context-gtk.c
@@ -271,6 +271,19 @@ icg_error_error_info (GOCmdContext *cc, GOErrorInfo *error)
}
static void
+icg_error_error_info_list (GOCmdContext *cc, GSList *error)
+{
+ IOContextGtk *icg = IO_CONTEXT_GTK (cc);
+ if (icg->show_warnings && error != NULL && error->data != NULL) {
+ GtkWidget *dialog = gnumeric_go_error_info_dialog_new
+ (error->data);
+ gtk_widget_show_all (GTK_WIDGET (dialog));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+}
+
+static void
icg_set_num_files (GOIOContext *icg, guint files_total)
{
IO_CONTEXT_GTK (icg)->files_total = files_total;
@@ -369,6 +382,7 @@ icg_gnm_cmd_context_init (GOCmdContextClass *cc_class)
cc_class->progress_set = icg_progress_set;
cc_class->progress_message_set = icg_progress_message_set;
cc_class->error.error_info = icg_error_error_info;
+ cc_class->error_info_list = icg_error_error_info_list;
}
static void
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index a55c5d9..fa77e60 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -5494,6 +5494,14 @@ wbcg_error_error_info (GOCmdContext *cc, GOErrorInfo *error)
gnumeric_go_error_info_dialog_show (
wbcg_toplevel (WBC_GTK (cc)), error);
}
+
+static void
+wbcg_error_error_info_list (GOCmdContext *cc, GSList *errs)
+{
+ gnumeric_go_error_info_list_dialog_show
+ (wbcg_toplevel (WBC_GTK (cc)), errs);
+}
+
static void
wbcg_progress_set (GOCmdContext *cc, double val)
{
@@ -5513,6 +5521,7 @@ wbcg_gnm_cmd_context_init (GOCmdContextClass *iface)
iface->set_sensitive = wbcg_set_sensitive;
iface->error.error = wbcg_error_error;
iface->error.error_info = wbcg_error_error_info;
+ iface->error_info_list = wbcg_error_error_info_list;
iface->progress_set = wbcg_progress_set;
iface->progress_message_set = wbcg_progress_message_set;
}
diff --git a/src/workbook-control.c b/src/workbook-control.c
index 5b3cdba..55abad8 100644
--- a/src/workbook-control.c
+++ b/src/workbook-control.c
@@ -457,6 +457,7 @@ wbc_cmd_context_init (GOCmdContextClass *iface)
iface->set_sensitive = ;
iface->error.error = ;
iface->error.error_info = ;
+ iface->error.error_info_list= ;
iface->progress_set = ;
iface->progress_message_set = ;
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]