r15460 - gnucash/branches/2.0/src - Play nicer with recent releases of glib that have tightened what's

David Hampton hampton at cvs.gnucash.org
Mon Jan 29 00:25:21 EST 2007


Author: hampton
Date: 2007-01-29 00:25:20 -0500 (Mon, 29 Jan 2007)
New Revision: 15460
Trac: http://svn.gnucash.org/trac/changeset/15460

Modified:
   gnucash/branches/2.0/src/app-utils/file-utils.c
   gnucash/branches/2.0/src/business/business-gnome/dialog-invoice.c
   gnucash/branches/2.0/src/core-utils/gnc-gkeyfile-utils.c
   gnucash/branches/2.0/src/core-utils/gnc-gkeyfile-utils.h
   gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c
   gnucash/branches/2.0/src/gnome-utils/gnc-tree-view-account.c
   gnucash/branches/2.0/src/gnome/gnc-plugin-page-budget.c
   gnucash/branches/2.0/src/gnome/gnc-plugin-page-register.c
   gnucash/branches/2.0/src/gnome/top-level.c
   gnucash/branches/2.0/src/report/report-gnome/gnc-plugin-page-report.c
Log:
Play nicer with recent releases of glib that have tightened what's
considered a valid key in a key/value file. This change will allow
gnucash 2.0.x to read either the current (with spaces) keys or the new
(no spaces) keys that were introduced into trunk.


Modified: gnucash/branches/2.0/src/app-utils/file-utils.c
===================================================================
--- gnucash/branches/2.0/src/app-utils/file-utils.c	2007-01-29 00:52:02 UTC (rev 15459)
+++ gnucash/branches/2.0/src/app-utils/file-utils.c	2007-01-29 05:25:20 UTC (rev 15460)
@@ -177,7 +177,6 @@
 {
   gchar *basename, *original = NULL, *filename, *tmp, *file_guid;
   GKeyFile *key_file = NULL;
-  GError *error = NULL;
   gint i;
 
   ENTER("url %s, guid %s", url, guid);
@@ -206,11 +205,11 @@
       break;
     }
 
-    file_guid = g_key_file_get_string(key_file,
+    file_guid = gnc_key_file_get_string(key_file,
 				      STATE_FILE_TOP, STATE_FILE_BOOK_GUID,
-				      &error);
+				      NULL);
     DEBUG("File GUID is %s", file_guid);
-    if (strcmp(guid, file_guid) == 0) {
+    if (safe_strcmp(guid, file_guid) == 0) {
       DEBUG("Matched !!!");
       g_free(file_guid);
       break;

Modified: gnucash/branches/2.0/src/business/business-gnome/dialog-invoice.c
===================================================================
--- gnucash/branches/2.0/src/business/business-gnome/dialog-invoice.c	2007-01-29 00:52:02 UTC (rev 15459)
+++ gnucash/branches/2.0/src/business/business-gnome/dialog-invoice.c	2007-01-29 05:25:20 UTC (rev 15460)
@@ -38,6 +38,7 @@
 #include "gnc-component-manager.h"
 #include "gnc-ui.h"
 #include "gnc-gconf-utils.h"
+#include "gnc-gkeyfile-utils.h"
 #include "gnc-gui-query.h"
 #include "gnc-ui-util.h"
 #include "qof.h"
@@ -1703,7 +1704,7 @@
   GncOwner owner = { 0 };
 
   /* Get Invoice Type */
-  tmp_string = g_key_file_get_string(key_file, group_name,
+  tmp_string = gnc_key_file_get_string(key_file, group_name,
 				     KEY_INVOICE_TYPE, &error);
   if (error) {
     g_warning("Error reading group %s key %s: %s.",
@@ -1714,7 +1715,7 @@
   g_free(tmp_string);
 
   /* Get Invoice GUID */
-  tmp_string = g_key_file_get_string(key_file, group_name,
+  tmp_string = gnc_key_file_get_string(key_file, group_name,
 				     KEY_INVOICE_GUID, &error);
   if (error) {
     g_warning("Error reading group %s key %s: %s.",
@@ -1734,7 +1735,7 @@
   g_free(tmp_string);
 
   /* Get Owner Type */
-  owner_type = g_key_file_get_string(key_file, group_name,
+  owner_type = gnc_key_file_get_string(key_file, group_name,
 				     KEY_OWNER_TYPE, &error);
   if (error) {
     g_warning("Error reading group %s key %s: %s.",
@@ -1743,7 +1744,7 @@
   }
 
   /* Get Owner GUID */
-  tmp_string = g_key_file_get_string(key_file, group_name,
+  tmp_string = gnc_key_file_get_string(key_file, group_name,
 				     KEY_OWNER_GUID, &error);
   if (error) {
     g_warning("Error reading group %s key %s: %s.",

Modified: gnucash/branches/2.0/src/core-utils/gnc-gkeyfile-utils.c
===================================================================
--- gnucash/branches/2.0/src/core-utils/gnc-gkeyfile-utils.c	2007-01-29 00:52:02 UTC (rev 15459)
+++ gnucash/branches/2.0/src/core-utils/gnc-gkeyfile-utils.c	2007-01-29 05:25:20 UTC (rev 15460)
@@ -146,5 +146,129 @@
   return success;
 }
 
+
+/* Compatability functions to handle reading key names both with and
+ * without embedded spaces.  The 2.0 release uses names containing
+ * spaces, while 2.2 uses names without spaces. These functions allow
+ * you to fall back to using 2.0 after trying a 2.2 release.  */ 
+
+static gchar *
+gnc_key_file_translate_key (const gchar *key)
+{
+  gchar **parts, *part, *newkey;
+  gint j;
+
+  parts = g_strsplit(key, " ", -1);
+  for (j = 0, part = parts[j++]; part; part = parts[j++])
+    part[0] = g_ascii_toupper(part[0]);
+  newkey = g_strjoinv("", parts);
+  g_strfreev(parts);
+
+  return newkey;
+}
+
+
+gboolean
+gnc_key_file_get_boolean (GKeyFile *key_file,
+			  const gchar *group_name,
+			  const gchar *key,
+			  GError **error)
+{
+  gchar *new_key;
+  gboolean result;
+  GError *local_error = NULL;
+
+  result = g_key_file_get_boolean (key_file, group_name, key, &local_error);
+  if (local_error == NULL)
+    return result;
+  if ((local_error->domain == G_KEY_FILE_ERROR) &&
+      (local_error->code == G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
+    g_clear_error(&local_error);
+    new_key = gnc_key_file_translate_key(key);
+    result = g_key_file_get_boolean (key_file, group_name, new_key, &local_error);
+    g_free(new_key);
+  }
+  if (local_error)
+    g_propagate_error(error, local_error);
+  return result;
+}
+
+gint
+gnc_key_file_get_integer (GKeyFile *key_file,
+			  const gchar *group_name,
+			  const gchar *key,
+			  GError **error)
+{
+  gchar *new_key;
+  gint result;
+  GError *local_error = NULL;
+
+  result = g_key_file_get_integer (key_file, group_name, key, &local_error);
+  if (local_error == NULL)
+    return result;
+  if ((local_error->domain == G_KEY_FILE_ERROR) &&
+      (local_error->code == G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
+    g_clear_error(&local_error);
+    new_key = gnc_key_file_translate_key(key);
+    result = g_key_file_get_integer (key_file, group_name, new_key, &local_error);
+    g_free(new_key);
+  }
+  if (local_error)
+    g_propagate_error(error, local_error);
+  return result;
+}
+
+gint *
+gnc_key_file_get_integer_list (GKeyFile *key_file,
+			       const gchar *group_name,
+			       const gchar *key,
+			       gsize *length,
+			       GError **error)
+{
+  gchar *new_key;
+  gint *result;
+  GError *local_error = NULL;
+
+  result = g_key_file_get_integer_list (key_file, group_name, key, length, &local_error);
+  if (local_error == NULL)
+    return result;
+  if ((local_error->domain == G_KEY_FILE_ERROR) &&
+      (local_error->code == G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
+    g_clear_error(&local_error);
+    new_key = gnc_key_file_translate_key(key);
+    result = g_key_file_get_integer_list (key_file, group_name, new_key, length, &local_error);
+    g_free(new_key);
+  }
+  if (local_error)
+    g_propagate_error(error, local_error);
+  return result;
+}
+
+gchar *
+gnc_key_file_get_string (GKeyFile *key_file,
+			 const gchar *group_name,
+			 const gchar *key,
+			 GError **error)
+{
+  gchar *new_key;
+  gchar *result;
+  GError *local_error = NULL;
+
+  result = g_key_file_get_string (key_file, group_name, key, &local_error);
+  if (local_error == NULL)
+    return result;
+  if ((local_error->domain == G_KEY_FILE_ERROR) &&
+      (local_error->code == G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
+    g_clear_error(&local_error);
+    new_key = gnc_key_file_translate_key(key);
+    result = g_key_file_get_string (key_file, group_name, new_key, &local_error);
+    g_free(new_key);
+  }
+  if (local_error)
+    g_propagate_error(error, local_error);
+  return result;
+}
+
+
 /** @} */
 /** @} */

Modified: gnucash/branches/2.0/src/core-utils/gnc-gkeyfile-utils.h
===================================================================
--- gnucash/branches/2.0/src/core-utils/gnc-gkeyfile-utils.h	2007-01-29 00:52:02 UTC (rev 15459)
+++ gnucash/branches/2.0/src/core-utils/gnc-gkeyfile-utils.h	2007-01-29 05:25:20 UTC (rev 15460)
@@ -77,6 +77,31 @@
 				    GKeyFile *key_file,
 				    GError **error);
 
+
+
+/* Compatability functions to handle reading key names both with and
+ * without embedded spaces.  The 2.0 release uses names containing
+ * spaces, while 2.2 uses names without spaces. These functions allow
+ * you to fall back to using 2.0 after trying a 2.2 release.  */ 
+gboolean gnc_key_file_get_boolean (GKeyFile *key_file,
+				   const gchar *group_name,
+				   const gchar *key,
+				   GError **error);
+gint gnc_key_file_get_integer (GKeyFile *key_file,
+			       const gchar *group_name,
+			       const gchar *key,
+			       GError **error);
+gint *gnc_key_file_get_integer_list (GKeyFile *key_file,
+				     const gchar *group_name,
+				     const gchar *key,
+				     gsize *length,
+				     GError **error);
+gchar *gnc_key_file_get_string (GKeyFile *key_file,
+				const gchar *group_name,
+				const gchar *key,
+				GError **error);
+
+
 #endif /* GNC_GKEYFILE_UTILS_H */
 /** @} */
 /** @} */

Modified: gnucash/branches/2.0/src/gnome/gnc-plugin-page-budget.c
===================================================================
--- gnucash/branches/2.0/src/gnome/gnc-plugin-page-budget.c	2007-01-29 00:52:02 UTC (rev 15459)
+++ gnucash/branches/2.0/src/gnome/gnc-plugin-page-budget.c	2007-01-29 05:25:20 UTC (rev 15460)
@@ -48,6 +48,7 @@
 
 #include "dialog-options.h"
 #include "dialog-utils.h"
+#include "gnc-gkeyfile-utils.h"
 #include "gnc-gnome-utils.h"
 #include "gnc-html.h"
 #include "gnc-icons.h"
@@ -525,7 +526,7 @@
     g_return_val_if_fail(group_name, NULL);
     ENTER("key_file %p, group_name %s", key_file, group_name);
 
-    guid_str = g_key_file_get_string(key_file, group_name, BUDGET_GUID, 
+    guid_str = gnc_key_file_get_string(key_file, group_name, BUDGET_GUID, 
                                      &error);
     if (error) {
         g_warning("error reading group %s key %s: %s",

Modified: gnucash/branches/2.0/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/branches/2.0/src/gnome/gnc-plugin-page-register.c	2007-01-29 00:52:02 UTC (rev 15459)
+++ gnucash/branches/2.0/src/gnome/gnc-plugin-page-register.c	2007-01-29 05:25:20 UTC (rev 15460)
@@ -58,6 +58,7 @@
 #include "gnc-date-edit.h"
 #include "gnc-engine.h"
 #include "gnc-event.h"
+#include "gnc-gkeyfile-utils.h"
 #include "gnc-gnome-utils.h"
 #include "gnc-gobject-utils.h"
 #include "gnc-gui-query.h"
@@ -931,7 +932,7 @@
   priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
 
   /* Convert the style name to an index */
-  style_name = g_key_file_get_string(key_file, group_name,
+  style_name = gnc_key_file_get_string(key_file, group_name,
 				     KEY_REGISTER_STYLE, &error);
   for (i = 0 ; style_names[i]; i++) {
     if (g_ascii_strcasecmp(style_name, style_names[i]) == 0) {
@@ -950,7 +951,7 @@
 
   /* Update the  double line action on this page */
   use_double_line =
-    g_key_file_get_boolean(key_file, group_name, KEY_DOUBLE_LINE, &error);
+    gnc_key_file_get_boolean(key_file, group_name, KEY_DOUBLE_LINE, &error);
   DEBUG("Setting double_line_mode: %d", use_double_line);
   action = gnc_plugin_page_get_action(page, "ViewStyleDoubleLineAction");
   gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), use_double_line);
@@ -985,14 +986,14 @@
   ENTER("key_file %p, group_name %s", key_file, group_name);
 
   /* Create the new page. */
-  reg_type = g_key_file_get_string(key_file, group_name,
+  reg_type = gnc_key_file_get_string(key_file, group_name,
 					 KEY_REGISTER_TYPE, &error);
   DEBUG("Page type: %s", reg_type);
   if ((g_ascii_strcasecmp(reg_type, LABEL_ACCOUNT) == 0) ||
       (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0)) {
     include_subs = (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0);
     DEBUG("Include subs: %d", include_subs);
-    acct_name = g_key_file_get_string(key_file, group_name,
+    acct_name = gnc_key_file_get_string(key_file, group_name,
 				      KEY_ACCOUNT_NAME, &error);
     book = qof_session_get_book(gnc_get_current_session());
     account = xaccGetAccountFromFullName(xaccGetAccountGroup(book),

Modified: gnucash/branches/2.0/src/gnome/top-level.c
===================================================================
--- gnucash/branches/2.0/src/gnome/top-level.c	2007-01-29 00:52:02 UTC (rev 15459)
+++ gnucash/branches/2.0/src/gnome/top-level.c	2007-01-29 05:25:20 UTC (rev 15460)
@@ -271,7 +271,7 @@
 #endif
     
     /* validate top level info */
-    file_guid = g_key_file_get_string(keyfile, STATE_FILE_TOP, 
+    file_guid = gnc_key_file_get_string(keyfile, STATE_FILE_TOP, 
                                       STATE_FILE_BOOK_GUID, &error);
     if (error) {
         g_warning("error reading group %s key %s: %s",

Modified: gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c	2007-01-29 00:52:02 UTC (rev 15459)
+++ gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c	2007-01-29 05:25:20 UTC (rev 15460)
@@ -439,7 +439,7 @@
 
   priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
   page_group = g_strdup_printf(PAGE_STRING, data->page_offset + data->page_num);
-  page_type = g_key_file_get_string(data->key_file, page_group,
+  page_type = gnc_key_file_get_string(data->key_file, page_group,
 				    PAGE_TYPE, &error);
   if (error) {
     g_warning("error reading group %s key %s: %s",
@@ -467,7 +467,7 @@
       }
 
       /* Restore the page name */
-      name = g_key_file_get_string(data->key_file, page_group,
+      name = gnc_key_file_get_string(data->key_file, page_group,
 				       PAGE_NAME, &error);
       if (error) {
 	g_warning("error reading group %s key %s: %s",
@@ -517,7 +517,7 @@
   window_group = g_strdup_printf(WINDOW_STRING, data->window_num + 1);
 
   /* Get this window's notebook info */
-  page_count = g_key_file_get_integer(data->key_file,
+  page_count = gnc_key_file_get_integer(data->key_file,
 				      window_group, WINDOW_PAGECOUNT, &error);
   if (error) {
     g_warning("error reading group %s key %s: %s",
@@ -529,7 +529,7 @@
      * check doesn't hurt anything. */
     goto cleanup;
   }
-  page_start = g_key_file_get_integer(data->key_file,
+  page_start = gnc_key_file_get_integer(data->key_file,
 				      window_group, WINDOW_FIRSTPAGE, &error);
   if (error) {
     g_warning("error reading group %s key %s: %s",
@@ -550,7 +550,7 @@
   priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
 
   /* Get the window coordinates, etc. */
-  pos = g_key_file_get_integer_list(data->key_file, window_group,
+  pos = gnc_key_file_get_integer_list(data->key_file, window_group,
 				    WINDOW_POSITION, &length, &error);
   if (error) {
     g_warning("error reading group %s key %s: %s",
@@ -568,7 +568,7 @@
     g_free(pos);
   }
 
-  geom = g_key_file_get_integer_list(data->key_file, window_group,
+  geom = gnc_key_file_get_integer_list(data->key_file, window_group,
 				     WINDOW_GEOMETRY, &length, &error);
   if (error) {
     g_warning("error reading group %s key %s: %s",
@@ -586,7 +586,7 @@
     g_free(geom);
   }
 
-  max = g_key_file_get_boolean(data->key_file, window_group,
+  max = gnc_key_file_get_boolean(data->key_file, window_group,
 			       WINDOW_MAXIMIZED, &error);
   if (error) {
     g_warning("error reading group %s key %s: %s",
@@ -600,7 +600,7 @@
   /* Common view menu items */
   action = gnc_main_window_find_action(window, "ViewToolbarAction");
   visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-  desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
+  desired_visibility = gnc_key_file_get_boolean(data->key_file, window_group,
 					      TOOLBAR_VISIBLE, &error);
   if (error) {
     g_warning("error reading group %s key %s: %s",
@@ -613,7 +613,7 @@
 
   action = gnc_main_window_find_action(window, "ViewSummaryAction");
   visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-  desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
+  desired_visibility = gnc_key_file_get_boolean(data->key_file, window_group,
 					      SUMMARYBAR_VISIBLE, &error);
   if (error) {
     g_warning("error reading group %s key %s: %s",
@@ -626,7 +626,7 @@
 
   action = gnc_main_window_find_action(window, "ViewStatusbarAction");
   visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
-  desired_visibility = g_key_file_get_boolean(data->key_file, window_group,
+  desired_visibility = gnc_key_file_get_boolean(data->key_file, window_group,
 					      STATUSBAR_VISIBLE, &error);
   if (error) {
     g_warning("error reading group %s key %s: %s",
@@ -651,7 +651,7 @@
   /* Restore page ordering within the notebook. Use +1 notation so the
    * numbers in the page order match the page sections, at least for
    * the one window case. */
-  order = g_key_file_get_integer_list(data->key_file, window_group,
+  order = gnc_key_file_get_integer_list(data->key_file, window_group,
  				      WINDOW_PAGEORDER, &length, &error);
   if (error) {
     g_warning("error reading group %s key %s: %s",
@@ -697,7 +697,7 @@
   /* We use the same struct for reading and for writing, so we cast
      away the const. */
   data.key_file = (GKeyFile *) keyfile;
-  window_count = g_key_file_get_integer(data.key_file, STATE_FILE_TOP, 
+  window_count = gnc_key_file_get_integer(data.key_file, STATE_FILE_TOP, 
                                         WINDOW_COUNT, &error);
   if (error) {
     g_warning("error reading group %s key %s: %s",

Modified: gnucash/branches/2.0/src/gnome-utils/gnc-tree-view-account.c
===================================================================
--- gnucash/branches/2.0/src/gnome-utils/gnc-tree-view-account.c	2007-01-29 00:52:02 UTC (rev 15459)
+++ gnucash/branches/2.0/src/gnome-utils/gnc-tree-view-account.c	2007-01-29 05:25:20 UTC (rev 15460)
@@ -43,6 +43,7 @@
 #include "gnc-commodity.h"
 #include "gnc-component-manager.h"
 #include "gnc-engine.h"
+#include "gnc-gkeyfile-utils.h"
 #include "gnc-glib-utils.h"
 #include "gnc-gobject-utils.h"
 #include "gnc-hooks.h"
@@ -2054,7 +2055,7 @@
     gboolean show;	
 
     /* Filter information. Ignore missing keys. */
-    show = g_key_file_get_boolean(key_file, group_name, SHOW_HIDDEN, &error);
+    show = gnc_key_file_get_boolean(key_file, group_name, SHOW_HIDDEN, &error);
     if (error) {
         g_warning("error reading group %s key %s: %s",
                   group_name, SHOW_HIDDEN, error->message);
@@ -2064,7 +2065,7 @@
     }
     fd->show_hidden = show;
     
-    show = g_key_file_get_boolean(key_file, group_name, SHOW_ZERO, &error);
+    show = gnc_key_file_get_boolean(key_file, group_name, SHOW_ZERO, &error);
     if (error) {
         g_warning("error reading group %s key %s: %s",
                   group_name, SHOW_ZERO, error->message);
@@ -2074,7 +2075,7 @@
     }
     fd->show_zero_total = show;
     
-    i = g_key_file_get_integer(key_file, group_name, ACCT_TYPES, &error);
+    i = gnc_key_file_get_integer(key_file, group_name, ACCT_TYPES, &error);
     if (error) {
         g_warning("error reading group %s key %s: %s",
                   group_name, ACCT_TYPES, error->message);
@@ -2085,11 +2086,11 @@
     fd->visible_types = i;
     
     /* Expanded accounts. Skip if count key missing. */
-    count = g_key_file_get_integer(key_file, group_name, ACCT_COUNT, &error);
+    count = gnc_key_file_get_integer(key_file, group_name, ACCT_COUNT, &error);
     if (error == NULL) {
         for (i = 1; i <= count; i++) {
 	    key = g_strdup_printf(ACCT_OPEN, i);
-	    value = g_key_file_get_string(key_file, group_name, key, &error);
+	    value = gnc_key_file_get_string(key_file, group_name, key, &error);
 	    if (error) {
                 g_warning("error reading group %s key %s: %s",
                           group_name, key, error->message);
@@ -2107,7 +2108,7 @@
     }
     
     /* Selected account (if any) */
-    value = g_key_file_get_string(key_file, group_name, ACCT_SELECTED, NULL);
+    value = gnc_key_file_get_string(key_file, group_name, ACCT_SELECTED, NULL);
     if (value) {
         tree_restore_selected_row(view, value);
         g_free(value);

Modified: gnucash/branches/2.0/src/report/report-gnome/gnc-plugin-page-report.c
===================================================================
--- gnucash/branches/2.0/src/report/report-gnome/gnc-plugin-page-report.c	2007-01-29 00:52:02 UTC (rev 15459)
+++ gnucash/branches/2.0/src/report/report-gnome/gnc-plugin-page-report.c	2007-01-29 05:25:20 UTC (rev 15460)
@@ -58,6 +58,7 @@
 #include "gnc-html-history.h"
 #include "gnc-html.h"
 #include "gnc-file.h"
+#include "gnc-gkeyfile-utils.h"
 #include "gnc-plugin.h"
 #include "gnc-plugin-page-report.h"
 #include "gnc-report.h"
@@ -646,6 +647,7 @@
  *  options. */
 #define SCHEME_OPTIONS   "Scheme Options"
 #define SCHEME_OPTIONS_N "Scheme Options %d"
+#define SCHEME_OPTIONS_NEW "SchemeOptions"
 
 
 /** Save enough information about this report page that it can be
@@ -759,9 +761,10 @@
 	}
 
 	for (i = 0; i < num_keys; i++) {
-	  if (strncmp(keys[i], SCHEME_OPTIONS, strlen(SCHEME_OPTIONS)) != 0)
+	  if ((strncmp(keys[i], SCHEME_OPTIONS, strlen(SCHEME_OPTIONS)) != 0) &&
+	      (strncmp(keys[i], SCHEME_OPTIONS_NEW, strlen(SCHEME_OPTIONS_NEW)) != 0))
 	    continue;
-	  option_string = g_key_file_get_string(key_file, group_name,
+	  option_string = gnc_key_file_get_string(key_file, group_name,
 						keys[i], &error);
 	  if (error) {
 	    g_warning("error reading group %s key %s: %s",
@@ -780,7 +783,8 @@
 	  }
 
 	  if (final_id == SCM_BOOL_F) {
-	    if (strcmp(keys[i], SCHEME_OPTIONS) == 0) {
+	    if ((strcmp(keys[i], SCHEME_OPTIONS) == 0) ||
+		(strcmp(keys[i], SCHEME_OPTIONS_NEW) == 0)) {
 	      final_id = scm_id;
 	    }
 	  }



More information about the gnucash-changes mailing list