[gnumeric] XML read: Fix minor problem with old .gnumeric files.



commit 111ce2a6f3302bbc6c77da37cb28f79957572311
Author: Morten Welinder <terra gnome org>
Date:   Sun Jun 14 09:33:21 2009 -0400

    XML read: Fix minor problem with old .gnumeric files.

 ChangeLog           |    5 +++++
 NEWS                |    1 +
 src/workbook-view.c |   19 ++++++++++++++-----
 3 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 65e6fb7..be479d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-14  Morten Welinder  <terra gnome org>
+
+	* src/workbook-view.c (wb_view_set_attribute): Handle problem with
+	old .gnumeric files.
+
 2009-06-12  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* schemas/gnumeric-general.schemas.in: remove sort header default
diff --git a/NEWS b/NEWS
index 304887e..3e6bd04 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,7 @@ Morten:
 	* Change x^y^z into x^(y^z) to indicate parsing.
 	* Parse x^y^z as (x^y)^z from ODF files.  [#585277]
 	* Fix text import problem.  [#135523]
+	* Fix problem loading very old .gnumeric files.
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.8
diff --git a/src/workbook-view.c b/src/workbook-view.c
index a858f12..aea74d0 100644
--- a/src/workbook-view.c
+++ b/src/workbook-view.c
@@ -206,6 +206,7 @@ wb_view_set_attribute (WorkbookView *wbv, char const *name, char const *value)
 {
 	gboolean res;
 	GObject *obj;
+	const char *tname;
 
 	g_return_if_fail (IS_WORKBOOK_VIEW (wbv));
 	g_return_if_fail (name != NULL);
@@ -214,15 +215,23 @@ wb_view_set_attribute (WorkbookView *wbv, char const *name, char const *value)
 	obj = G_OBJECT (wbv);
 	res = !g_ascii_strcasecmp (value, "TRUE");
 
-	if (!strcmp (name , "WorkbookView::show_horizontal_scrollbar"))
+	if (strncmp (name, "WorkbookView::", 14) == 0)
+		tname = name + 14;
+	else if (strncmp (name, "Workbook::", 10) == 0)
+		/* Some old files have this.  */
+		tname = name + 10;
+	else
+		tname = "nope";
+
+	if (!strcmp (tname , "show_horizontal_scrollbar"))
 		g_object_set (obj, "show_horizontal_scrollbar", res, NULL);
-	else if (!strcmp (name , "WorkbookView::show_vertical_scrollbar"))
+	else if (!strcmp (tname , "show_vertical_scrollbar"))
 		g_object_set (obj, "show_vertical_scrollbar", res, NULL);
-	else if (!strcmp (name , "WorkbookView::show_notebook_tabs"))
+	else if (!strcmp (tname , "show_notebook_tabs"))
 		g_object_set (obj, "show_notebook_tabs", res, NULL);
-	else if (!strcmp (name , "WorkbookView::do_auto_completion"))
+	else if (!strcmp (tname , "do_auto_completion"))
 		g_object_set (obj, "do_auto_completion", res, NULL);
-	else if (!strcmp (name , "WorkbookView::is_protected"))
+	else if (!strcmp (tname , "is_protected"))
 		g_object_set (obj, "protected", res, NULL);
 	else
 		g_warning ("WorkbookView unknown arg '%s'", name);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]