[Gnucash-changes] r13467 - gnucash/trunk - Convert the account separator from a single character to a character

David Hampton hampton at cvs.gnucash.org
Fri Mar 3 22:04:47 EST 2006


Author: hampton
Date: 2006-03-03 22:04:46 -0500 (Fri, 03 Mar 2006)
New Revision: 13467
Trac: http://svn.gnucash.org/trac/changeset/13467

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/app-utils/gnc-helpers.c
   gnucash/trunk/src/app-utils/gnc-helpers.h
   gnucash/trunk/src/app-utils/gnc-ui-util.c
   gnucash/trunk/src/app-utils/gw-app-utils-spec.scm
   gnucash/trunk/src/engine/Account.c
   gnucash/trunk/src/engine/Account.h
   gnucash/trunk/src/engine/Group.c
   gnucash/trunk/src/engine/gw-engine-spec.scm
   gnucash/trunk/src/gnome-utils/dialog-account.c
   gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c
   gnucash/trunk/src/import-export/qif-import/qif-dialog-utils.scm
   gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm
   gnucash/trunk/src/import-export/qif-import/qif-to-gnc.scm
   gnucash/trunk/src/register/register-core/combocell.h
   gnucash/trunk/src/register/register-gnome/combocell-gnome.c
   gnucash/trunk/src/report/standard-reports/budget.scm
   gnucash/trunk/src/report/standard-reports/cash-flow.scm
Log:
Convert the account separator from a single character to a character
string.  This allows multibyte unicode characters to be the account
separator character. Fixes 333061.  Reworked a couple of routines that
pull account names into their component parts.  Also fixed a bug in
the new account dialog when creating multiple accounts at once.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/ChangeLog	2006-03-04 03:04:46 UTC (rev 13467)
@@ -1,3 +1,12 @@
+2006-03-03  David Hampton  <hampton at employees.org>
+
+	* numerous: Convert the account separator from a single character
+	to a character string.  This allows multibyte unicode characters
+	to be the account separator character. Fixes 333061.  Reworked a
+	couple of routines that pull account names into their component
+	parts.  Also fixed a bug in the new account dialog when creating
+	multiple accounts at once.
+
 2006-03-03  Derek Atkins  <derek at ihtfp.com>
 
 	* configure.in: error out on g-wrap-1.3, gcc4, and error-on-warning.

Modified: gnucash/trunk/src/app-utils/gnc-helpers.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-helpers.c	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/app-utils/gnc-helpers.c	2006-03-04 03:04:46 UTC (rev 13467)
@@ -153,17 +153,6 @@
   return info_scm;
 }
 
-const char *
-gnc_get_account_separator_string (void)
-{
-  static char sep[2];
-
-  sep[0] = gnc_get_account_separator ();
-  sep[1] = '\0';
-
-  return sep;
-}
-
 SCM
 gnc_parse_amount_helper (const char * string, gboolean monetary)
 {

Modified: gnucash/trunk/src/app-utils/gnc-helpers.h
===================================================================
--- gnucash/trunk/src/app-utils/gnc-helpers.h	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/app-utils/gnc-helpers.h	2006-03-04 03:04:46 UTC (rev 13467)
@@ -43,8 +43,6 @@
  */
 SCM  gnc_quoteinfo2scm(gnc_commodity *com);
 
-const char * gnc_get_account_separator_string (void);
-
 SCM gnc_parse_amount_helper (const char * string, gboolean monetary);
 
 #endif

Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c	2006-03-04 03:04:46 UTC (rev 13467)
@@ -61,35 +61,36 @@
 static gboolean reverse_type[NUM_ACCOUNT_TYPES];
 
 /********************************************************************\
- * gnc_get_account_separator                                        *
- *   returns the current account separator character                *
+ * gnc_configure_account_separator                                  *
+ *   updates the current account separator character                *
  *                                                                  *
  * Args: none                                                       *
- * Returns: account separator character                             *
  \*******************************************************************/
 static void
 gnc_configure_account_separator (void)
 {
-  char separator = ':';
+  const gchar *separator;
   char *string;
 
   string = gnc_gconf_get_string(GCONF_GENERAL, KEY_ACCOUNT_SEPARATOR, NULL);
 
   if (!string || safe_strcmp(string, "colon") == 0)
-    separator = ':';
+    separator = ":";
   else if (safe_strcmp(string, "slash") == 0)
-    separator = '/';
+    separator = "/";
   else if (safe_strcmp(string, "backslash") == 0)
-    separator = '\\';
+    separator = "\\";
   else if (safe_strcmp(string, "dash") == 0)
-    separator = '-';
+    separator = "-";
   else if (safe_strcmp(string, "period") == 0)
-    separator = '.';
+    separator = ".";
+  else
+    separator = string;
 
+  gnc_set_account_separator(separator);
+
   if (string != NULL)
     free(string);
-
-  gnc_set_account_separator(separator);
 }
 
 

Modified: gnucash/trunk/src/app-utils/gw-app-utils-spec.scm
===================================================================
--- gnucash/trunk/src/app-utils/gw-app-utils-spec.scm	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/app-utils/gw-app-utils-spec.scm	2006-03-04 03:04:46 UTC (rev 13467)
@@ -414,12 +414,4 @@
    '<gw:int>
    "gnc_accounting_period_fiscal_end"
    '()
-   "Returns the end of the preferred accounting period")
-
-  (gw:wrap-function
-   ws
-   'gnc:account-separator-char
-   '(<gw:mchars> callee-owned const)
-   "gnc_get_account_separator_string"
-   '()
-   "Returns a string with the user-selected account separator"))
+   "Returns the end of the preferred accounting period"))

Modified: gnucash/trunk/src/engine/Account.c
===================================================================
--- gnucash/trunk/src/engine/Account.c	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/engine/Account.c	2006-03-04 03:04:46 UTC (rev 13467)
@@ -41,7 +41,8 @@
 static QofLogModule log_module = GNC_MOD_ACCOUNT;
 
 /* The Canonical Account Separator.  Pre-Initialized. */
-static char account_separator = ':';
+static gchar account_separator[8] = ".";
+gunichar account_uc_separator = ':';
 
 /********************************************************************\
  * Because I can't use C++ for this project, doesn't mean that I    *
@@ -60,16 +61,33 @@
  * Args: none                                                       *
  * Returns: account separator character                             *
  \*******************************************************************/
-char
-gnc_get_account_separator (void)
+const gchar *
+gnc_get_account_separator_string (void)
 {
   return account_separator;
 }
 
+gunichar
+gnc_get_account_separator (void)
+{
+  return account_uc_separator;
+}
+
 void
-gnc_set_account_separator (char separator)
+gnc_set_account_separator (const gchar *separator)
 {
-  account_separator = separator;
+  gunichar uc;
+  gint count;
+
+  uc = g_utf8_get_char_validated(separator, -1);
+  if ((uc == (gunichar)-2) || (uc == (gunichar)-1)) {
+    strcpy(account_separator, ":");
+    return;
+  }
+
+  account_uc_separator = uc;
+  count = g_unichar_to_utf8(uc, account_separator);
+  account_separator[count] = '\0';
 }
 
 /********************************************************************\
@@ -1255,53 +1273,29 @@
 {
   const Account *a;
   char *fullname;
-  const char *name;
-  char *p;
-  int length = 0;
+  gchar **names;
+  int level;
 
   if (account == NULL)
     return g_strdup("");
 
   /* Figure out how much space is needed */
-  a = account;
-  while (a != NULL)
-  {
-    name = a->accountName;
-
-    length += strlen(name) + 1; /* plus one for the separator */
-
-    a = xaccAccountGetParentAccount(a);
+  level = 0;
+  for (a = account; a; a = xaccAccountGetParentAccount(a)) {
+    level++;
   }
 
-  /* length has one extra separator in it, that's ok, because it will
-   * hold the null character at the end. */
-
-  /* allocate the memory */
-  fullname = g_new(char, length);
-
-  /* go to end of string */
-  p = fullname + length - 1;
-
-  /* put in the null character and move to the previous char */
-  *p-- = 0;
-
-  a = account;
-  while (a != NULL)
-  {
-    name = a->accountName;
-    length = strlen(name);
-
-    /* copy the characters going backwards */
-    while (length > 0)
-      *p-- = name[--length];
-
-    a = xaccAccountGetParentAccount(a);
-
-    /* if we're not at the root, add another separator */
-    if (a != NULL)
-      *p-- = account_separator;
+  /* Get all the pointers in the right order. */
+  names = g_malloc((level+1) * sizeof(gchar *));
+  names[level] = NULL;
+  for (a = account; a; a = xaccAccountGetParentAccount(a)) {
+    names[--level] = a->accountName;
   }
 
+  /* Build it */
+  fullname =  g_strjoinv(account_separator, names);
+  g_free(names);
+
   return fullname;
 }
 

Modified: gnucash/trunk/src/engine/Account.h
===================================================================
--- gnucash/trunk/src/engine/Account.h	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/engine/Account.h	2006-03-04 03:04:46 UTC (rev 13467)
@@ -183,8 +183,9 @@
  *
  *  @return The character to use.
  */
-char gnc_get_account_separator (void);
-void gnc_set_account_separator (char separator);
+const gchar *gnc_get_account_separator_string (void);
+gunichar gnc_get_account_separator (void);
+void gnc_set_account_separator (const gchar *separator);
 
 /** @deprecated */
 #define xaccAccountGetBook(X)     qof_instance_get_book(QOF_INSTANCE(X))

Modified: gnucash/trunk/src/engine/Group.c
===================================================================
--- gnucash/trunk/src/engine/Group.c	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/engine/Group.c	2006-03-04 03:04:46 UTC (rev 13467)
@@ -498,79 +498,56 @@
  * Fetch an account, given its full name                            *
 \********************************************************************/
 
-Account *
-xaccGetAccountFromFullName (const AccountGroup *grp,
-                            const char *name)
+static Account *
+xaccGetAccountFromFullNameHelper (const AccountGroup *grp,
+				  gchar **names)
 {
-  GList *node;
   Account *found;
-  char *p;
-  char separator;
+  GList *node;
 
-  if (!grp) return NULL;
-  if (!name) return NULL;
+  g_return_val_if_fail(grp, NULL);
+  g_return_val_if_fail(names, NULL);
 
-  p = (char *) name;
-  found = NULL;
+  /* Look for the first name in the children. */
+  for (node = grp->accounts; node; node = node->next) {
+    Account *account = node->data;
 
-  separator = gnc_get_account_separator();
+    if (safe_strcmp(xaccAccountGetName (account), names[0]) == 0) {
+      /* We found an account.  If the next entry is NULL, there is
+       * nothing left in the name, so just return the account. */
+      if (names[1] == NULL)
+	return account;
 
-  while (1)
-  {
-    /* Look for the first separator. */
-    p = strchr(p, separator);
+      /* No children?  We're done. */
+      if (!account->children)
+	return NULL;
 
-    /* If found, switch it to the null char. */
-    if (p != NULL)
-      *p = 0;
-
-    /* Now look for that name in the children. */
-    for (node = grp->accounts; node; node = node->next)
-    {
-      Account *account = node->data;
-
-      if (safe_strcmp(xaccAccountGetName (account), name) == 0)
-      {
-        /* We found an account.
-         * If p == NULL, there is nothing left
-         * in the name, so just return the account.
-         * We don't need to put back the separator,
-         * because it was never erased (p == NULL). */
-        if (p == NULL)
-          return account;
-
-        /* There's stuff left to search for.
-         * Search recursively after the separator. */
-        found = xaccGetAccountFromFullName(account->children, p + 1);
-
-        /* If we found the account, break out. */
-        if (found != NULL)
-          break;
+      /* There's stuff left to search for.  Search recursively. */
+      found = xaccGetAccountFromFullNameHelper(account->children, &names[1]);
+      if (found != NULL) {
+	return found;
       }
     }
+  }
 
-    /* If found != NULL, an account was found. */
-    /* If p == NULL, there are no more separators left. */
+  return NULL;
+}
 
-    /* Put back the separator. */
-    if (p != NULL)
-      *p = separator;
 
-    /* If we found the account, return it. */
-    if (found != NULL)
-      return found;
+Account *
+xaccGetAccountFromFullName (const AccountGroup *grp,
+			    const char *name)
+{
+  Account *found;
+  gchar **names;
 
-    /* We didn't find the account. If there
-     * are no more separators, return NULL. */
-    if (p == NULL)
-      return NULL;
+  if (!grp) return NULL;
+  if (!name) return NULL;
 
-    /* If we are here, we didn't find anything and there
-     * must be more separators. So, continue looking with
-     * a longer name, in case there is a name with the
-     * separator character in it. */
-    p++;
-  }
+  names = g_strsplit(name, gnc_get_account_separator_string(), -1);
+  found = xaccGetAccountFromFullNameHelper(grp, names);
+  g_strfreev(names);
+  return found;
 }
 
 /********************************************************************\

Modified: gnucash/trunk/src/engine/gw-engine-spec.scm
===================================================================
--- gnucash/trunk/src/engine/gw-engine-spec.scm	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/engine/gw-engine-spec.scm	2006-03-04 03:04:46 UTC (rev 13467)
@@ -381,8 +381,17 @@
  '((<gnc:Split*> s))
  "Return split's value.")
 
+
 (gw:wrap-function
  ws
+ 'gnc:account-separator-string
+ '(<gw:mchars> callee-owned const)
+ "gnc_get_account_separator_string"
+ '()
+ "Returns a string with the user-selected account separator")
+
+(gw:wrap-function
+ ws
  'gnc:split-get-account
  '<gnc:Account*>
  "xaccSplitGetAccount"

Modified: gnucash/trunk/src/gnome-utils/dialog-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-account.c	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/gnome-utils/dialog-account.c	2006-03-04 03:04:46 UTC (rev 13467)
@@ -68,7 +68,8 @@
   Account *top_level_account; /* owned by the model */
   Account *created_account;
 
-  GList *subaccount_names;
+  gchar **subaccount_names;
+  gchar **next_name;
 
   GNCAccountType type;
 
@@ -416,12 +417,11 @@
   gnc_resume_gui_refresh ();
 
   /* do it all again, if needed */
-  if (aw->dialog_type == NEW_ACCOUNT && aw->subaccount_names)
+  if ((aw->dialog_type == NEW_ACCOUNT) && aw->next_name && *aw->next_name)
   {
     gnc_commodity *commodity;
     Account *parent;
     Account *account;
-    GList *node;
 
     gnc_suspend_gui_refresh ();
 
@@ -430,13 +430,9 @@
     aw->account = *xaccAccountGetGUID (account);
     aw->type = xaccAccountGetType (parent);
 
-    xaccAccountSetName (account, aw->subaccount_names->data);
+    xaccAccountSetName (account, *aw->next_name);
+    aw->next_name++;
 
-    node = aw->subaccount_names;
-    aw->subaccount_names = g_list_remove_link (aw->subaccount_names, node);
-    g_free (node->data);
-    g_list_free_1 (node);
-
     gnc_account_to_ui (aw);
 
     gnc_account_window_set_name (aw);
@@ -446,8 +442,8 @@
                                       commodity);
     gnc_account_commodity_from_type (aw, FALSE);
 
-    /*gnc_account_tree_select_account (GNC_ACCOUNT_TREE(aw->parent_tree),
-                                     parent, TRUE);*/
+    gnc_tree_view_account_set_selected_account
+      (GNC_TREE_VIEW_ACCOUNT (aw->parent_tree), parent);
 
     gnc_resume_gui_refresh ();
     LEAVE("1");
@@ -722,14 +718,13 @@
   Account *account, *parent;
   AccountGroup *group;
   gnc_commodity * commodity;
-  gchar separator, sep_string[2];
   gchar *fullname, *fullname_parent;
-  const gchar *name;
+  const gchar *name, *separator;
 
   ENTER("aw %p", aw);
   group = gnc_get_current_group ();
 
-  separator = gnc_get_account_separator();
+  separator = gnc_get_account_separator_string();
 
   /* check for valid name */
   name = gtk_entry_get_text(GTK_ENTRY(aw->name_entry));
@@ -746,11 +741,8 @@
   if (parent == NULL) {
     account = xaccGetAccountFromFullName(group, name);
   } else {
-    sep_string[0] = separator;
-    sep_string[1] = '\0';
-
     fullname_parent = xaccAccountGetFullName(parent);
-    fullname = g_strconcat(fullname_parent, sep_string, name, NULL);
+    fullname = g_strconcat(fullname_parent, separator, name, NULL);
 
     account = xaccGetAccountFromFullName(group, fullname);
 
@@ -1032,13 +1024,10 @@
 
   gnc_resume_gui_refresh ();
 
-  if (aw->subaccount_names)
-  {
-    GList *node;
-    for (node = aw->subaccount_names; node; node = node->next)
-      g_free (node->data);
-    g_list_free (aw->subaccount_names);
+  if (aw->subaccount_names) {
+    g_strfreev(aw->subaccount_names);
     aw->subaccount_names = NULL;
+    aw->next_name = NULL;
   }
 
   g_list_free (aw->valid_types);
@@ -1347,15 +1336,13 @@
   if (parent_account)
   {
     char *parent_name;
-    char sep_string[2];
+    const gchar *separator;
 
     parent_name = xaccAccountGetFullName (parent_account);
 
-    sep_string[0] = gnc_get_account_separator ();
-    sep_string[1] = '\0';
+    separator = gnc_get_account_separator_string ();
+    fullname = g_strconcat (parent_name, separator, name, NULL);
 
-    fullname = g_strconcat (parent_name, sep_string, name, NULL);
-
     g_free (parent_name);
   }
   else 
@@ -1369,6 +1356,7 @@
 {
   char *fullname;
   char *title;
+  gint length;
 
   if (!aw || !aw->parent_tree)
     return;
@@ -1377,13 +1365,12 @@
 
   if (aw->dialog_type == EDIT_ACCOUNT)
     title = g_strconcat(_("Edit Account"), " - ", fullname, NULL);
-  else if (g_list_length (aw->subaccount_names) > 0)
+  else if ((length = g_strv_length (aw->next_name)) > 0)
   {
     const char *format = _("(%d) New Accounts");
     char *prefix;
 
-    prefix = g_strdup_printf (format,
-                              g_list_length (aw->subaccount_names) + 1);
+    prefix = g_strdup_printf (format, length + 1);
 
     title = g_strconcat (prefix, " - ", fullname, " ...", NULL);
 
@@ -1461,7 +1448,7 @@
 
 static AccountWindow *
 gnc_ui_new_account_window_internal (Account *base_account,
-                                    GList *subaccount_names,
+                                    gchar **subaccount_names,
 				    GList *valid_types,
 				    gnc_commodity * default_commodity,
 				    gboolean modal)
@@ -1486,15 +1473,11 @@
 
   gnc_suspend_gui_refresh ();
 
-  if (subaccount_names)
+  if (subaccount_names && *subaccount_names)
   {
-    GList *node;
-
-    xaccAccountSetName (account, subaccount_names->data);
-
-    aw->subaccount_names = g_list_copy (subaccount_names->next);
-    for (node = aw->subaccount_names; node; node = node->next)
-      node->data = g_strdup (node->data);
+    xaccAccountSetName (account, subaccount_names[0]);
+    aw->subaccount_names = subaccount_names;
+    aw->next_name = subaccount_names + 1;
   }
 
   gnc_account_window_create (aw);
@@ -1540,59 +1523,43 @@
 }
 
 
-static GList *
+static gchar **
 gnc_split_account_name (const char *in_name, Account **base_account)
 {
   AccountGroup *group;
-  GList *names;
-  char separator;
-  char *name;
+  Account *account;
+  gchar **names, **ptr, **out_names;
+  GList *list, *node;
 
-  names = NULL;
-  name = g_strdup (in_name);
-  *base_account = NULL;
   group = gnc_get_current_group ();
+  list = xaccGroupGetAccountList (group);
+  names = g_strsplit(in_name, gnc_get_account_separator_string(), -1);
 
-  separator = gnc_get_account_separator ();
+  for (ptr = names; *ptr; ptr++) {
+    /* Look for the first name in the children. */
+    for (node = list; node; node = g_list_next(node)) {
+      account = node->data;
 
-  while (name && *name != '\0')
-  {
-    Account *account;
-    char *p;
+      if (safe_strcmp(xaccAccountGetName (account), *ptr) == 0) {
+	/* We found an account. */
+	*base_account = account;
+	break;
+      }
+    }
 
-    account = xaccGetAccountFromFullName (group, name);
-    if (account)
-    {
-      *base_account = account;
+    /* Was there a match?  If no, stop the traversal. */
+    if (node == NULL)
       break;
-    }
 
-    p = strrchr (name, separator);
-    if (p)
-    {
-      *p++ = '\0';
-
-      if (*p == '\0')
-      {
-        GList *node;
-        for (node = names; node; node = node->next)
-          g_free (node->data);
-        g_list_free (names);
-        return NULL;
-      }
-
-      names = g_list_prepend (names, g_strdup (p));
-    }
-    else
-    {
-      names = g_list_prepend (names, g_strdup (name));
+    group = xaccAccountGetChildren (account);
+    if (group == NULL)
       break;
-    }
+    list = xaccGroupGetAccountList (group);
   }
 
-  g_free (name);
-
-  return names;
+  out_names = g_strdupv(ptr);
+  g_strfreev(names);
+  return out_names;
 }
 
 
@@ -1619,11 +1586,11 @@
 						       Account * parent)
 {
   AccountWindow *aw;
-  Account *base_account;
+  Account *base_account = NULL;
   Account *created_account = NULL;
-  GList * subaccount_names;
-  GList * node;
+  gchar ** subaccount_names;
   gint response;
+  gboolean done = FALSE;
 
   ENTER("name %s, valid %p, commodity %p, account %p",
 	name, valid_types, default_commodity, parent);
@@ -1643,20 +1610,28 @@
 					   valid_types, default_commodity,
 					   TRUE);
 
-  for (node = subaccount_names; node; node = node->next)
-    g_free (node->data);
-  g_list_free (subaccount_names);
-
-  do {
+  while (!done) {
     response = gtk_dialog_run (GTK_DIALOG(aw->dialog));
 
     /* This can destroy the dialog */
     gnc_account_window_response_cb (GTK_DIALOG(aw->dialog), response, (gpointer)aw);
 
-    if (response == GTK_RESPONSE_OK)
-      created_account = aw->created_account;
-  } while ((response == GTK_RESPONSE_HELP) || (response == GNC_RESPONSE_NEW));
+    switch (response) {
+      case GTK_RESPONSE_OK:
+	created_account = aw->created_account;
+	done = (created_account != NULL);
+	break;
 
+      case GTK_RESPONSE_HELP:
+	done = FALSE;
+	break;
+
+      default:
+	done = TRUE;
+	break;
+    }
+  }
+
   close_handler(aw);
   LEAVE("created %s (%p)", xaccAccountGetName(created_account), created_account);
   return created_account;

Modified: gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c
===================================================================
--- gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c	2006-03-04 03:04:46 UTC (rev 13467)
@@ -53,12 +53,10 @@
 {
   char         * acctinfo[2];
   char         * acctname;
-  char         sep[2] = " ";
   GtkCTreeNode * node; 
   gboolean     leafnode;
   SCM          current;
   
-  sep[0] = gnc_get_account_separator();
   acctinfo[1] = "";
 
   while(!SCM_NULLP(accts)) {
@@ -92,7 +90,8 @@
 
     /* set some row data */ 
     if(base_name && (strlen(base_name) > 0)) {
-      acctname =  g_strjoin(sep, base_name, acctinfo[0], (char *)NULL);
+      acctname =  g_strjoin(gnc_get_account_separator_string(),
+			    base_name, acctinfo[0], (char *)NULL);
     }
     else {
       acctname = g_strdup(acctinfo[0]);
@@ -154,7 +153,6 @@
   QIFAccountPickerDialog * wind = user_data;
   SCM name_setter = scm_c_eval_string("qif-map-entry:set-gnc-name!");
   const char *name;
-  char sep[2] = " ";
   int  response;
   char * fullname;
   GtkWidget *dlg, *entry;
@@ -174,8 +172,8 @@
   if (response == GTK_RESPONSE_OK) {
     name = gtk_entry_get_text(GTK_ENTRY(entry));
     if(wind->selected_name && (strlen(wind->selected_name) > 0)) {
-      sep[0] = gnc_get_account_separator();
-      fullname = g_strjoin(sep, wind->selected_name, name, (char *)NULL);
+      fullname = g_strjoin(gnc_get_account_separator_string(),
+			   wind->selected_name, name, (char *)NULL);
     }
     else {
       fullname = g_strdup(name);

Modified: gnucash/trunk/src/import-export/qif-import/qif-dialog-utils.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-dialog-utils.scm	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/import-export/qif-import/qif-dialog-utils.scm	2006-03-04 03:04:46 UTC (rev 13467)
@@ -9,39 +9,39 @@
 (use-modules (ice-9 regex))
 
 (define (default-stock-acct brokerage security)
-  (string-append brokerage (gnc:account-separator-char) security))
+  (string-append brokerage (gnc:account-separator-string) security))
 
 (define (default-dividend-acct brokerage security)
-  (string-append (_ "Dividends") (gnc:account-separator-char) 
-                 brokerage (gnc:account-separator-char) 
+  (string-append (_ "Dividends") (gnc:account-separator-string) 
+                 brokerage (gnc:account-separator-string) 
                  security))
 
 (define (default-interest-acct brokerage security) 
-  (string-append (_ "Interest") (gnc:account-separator-char) 
+  (string-append (_ "Interest") (gnc:account-separator-string) 
                  brokerage
 		 (if (string=? security "")
 		  ""
-		  (string-append (gnc:account-separator-char)  
+		  (string-append (gnc:account-separator-string)  
 				  security))))
 
 (define (default-capital-return-acct brokerage security) 
-  (string-append (_ "Cap Return") (gnc:account-separator-char) 
-                 brokerage (gnc:account-separator-char)  
+  (string-append (_ "Cap Return") (gnc:account-separator-string) 
+                 brokerage (gnc:account-separator-string)  
                  security))
 
 (define (default-cglong-acct brokerage security)
-  (string-append (_ "Cap. gain (long)") (gnc:account-separator-char) 
-                 brokerage (gnc:account-separator-char) 
+  (string-append (_ "Cap. gain (long)") (gnc:account-separator-string) 
+                 brokerage (gnc:account-separator-string) 
                  security))
 
 (define (default-cgmid-acct brokerage security)
-  (string-append (_ "Cap. gain (mid)") (gnc:account-separator-char) 
-                 brokerage (gnc:account-separator-char) 
+  (string-append (_ "Cap. gain (mid)") (gnc:account-separator-string) 
+                 brokerage (gnc:account-separator-string) 
                  security))
 
 (define (default-cgshort-acct brokerage security)
-  (string-append (_ "Cap. gain (short)") (gnc:account-separator-char) 
-                 brokerage (gnc:account-separator-char) 
+  (string-append (_ "Cap. gain (short)") (gnc:account-separator-string) 
+                 brokerage (gnc:account-separator-string) 
                  security))
 
 (define (default-equity-holding security) (_ "Retained Earnings"))
@@ -49,11 +49,11 @@
 (define (default-equity-account) (_ "Retained Earnings"))  
 
 (define (default-commission-acct brokerage) 
-  (string-append (_ "Commissions") (gnc:account-separator-char) 
+  (string-append (_ "Commissions") (gnc:account-separator-string) 
                  brokerage))
 
 (define (default-margin-interest-acct brokerage) 
-  (string-append (_ "Margin Interest") (gnc:account-separator-char) 
+  (string-append (_ "Margin Interest") (gnc:account-separator-string) 
                  brokerage))
 
 (define (default-unspec-acct)
@@ -567,7 +567,7 @@
   (if (not qif-import:account-name-regexp)
       (let* ((rstr ":([^:]+)$|^([^:]+)$")
              (newstr (regexp-substitute/global 
-                      #f ":" rstr 'pre (gnc:account-separator-char) 'post)))
+                      #f ":" rstr 'pre (gnc:account-separator-string) 'post)))
         
         (set! qif-import:account-name-regexp (make-regexp newstr))))
   
@@ -604,7 +604,7 @@
                   (memv GNC-MUTUAL-TYPE 
                         (qif-map-entry:allowed-types map-entry)))
               (not (hash-ref stock-hash stock-name)))
-             (let* ((separator (string-ref (gnc:account-separator-char) 0))
+             (let* ((separator (string-ref (gnc:account-separator-string) 0))
                     (existing-gnc-acct 
                      (gnc:get-account-from-full-name 
                       (gnc:get-current-group)
@@ -686,7 +686,7 @@
 
   (let ((accts '())
         (acct-tree '())
-        (separator (string-ref (gnc:account-separator-char) 0)))
+        (separator (string-ref (gnc:account-separator-string) 0)))
     ;; get the new accounts from the account map
     (for-each 
      (lambda (acctmap)

Modified: gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm	2006-03-04 03:04:46 UTC (rev 13467)
@@ -38,7 +38,7 @@
                     (fullname 
                      (if (string? root-name)
                          (string-append root-name 
-                                        (gnc:account-separator-char)
+                                        (gnc:account-separator-string)
                                         name)
                          name)))
                (set! names 

Modified: gnucash/trunk/src/import-export/qif-import/qif-to-gnc.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-to-gnc.scm	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/import-export/qif-import/qif-to-gnc.scm	2006-03-04 03:04:46 UTC (rev 13467)
@@ -15,7 +15,7 @@
 (define (qif-import:find-or-make-acct acct-info check-types? commodity
 				      check-commodity? default-currency
                                       gnc-acct-hash old-group new-group)
-  (let* ((separator (string-ref (gnc:account-separator-char) 0))
+  (let* ((separator (string-ref (gnc:account-separator-string) 0))
          (gnc-name (qif-map-entry:gnc-name acct-info))
          (existing-account (hash-ref gnc-acct-hash gnc-name))
          (same-gnc-account 
@@ -180,7 +180,7 @@
      (let* ((old-group (gnc:get-current-group))
             (new-group (gnc:malloc-account-group (gnc:get-current-book)))
             (gnc-acct-hash (make-hash-table 20))
-            (separator (string-ref (gnc:account-separator-char) 0))
+            (separator (string-ref (gnc:account-separator-string) 0))
             (default-currency 
               (gnc:commodity-table-find-full 
                (gnc:book-get-commodity-table (gnc:get-current-book))

Modified: gnucash/trunk/src/register/register-core/combocell.h
===================================================================
--- gnucash/trunk/src/register/register-core/combocell.h	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/register/register-core/combocell.h	2006-03-04 03:04:46 UTC (rev 13467)
@@ -74,7 +74,7 @@
 
 /** Sets a character used for special completion processing. */
 void         gnc_combo_cell_set_complete_char (ComboCell *cell,
-                                               char complete_char);
+                                               gunichar complete_char);
 
 /** Add a string to a list of strings which, if the cell has that value,
  * will cause the cell to be uneditable on 'enter'. */

Modified: gnucash/trunk/src/register/register-gnome/combocell-gnome.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/combocell-gnome.c	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/register/register-gnome/combocell-gnome.c	2006-03-04 03:04:46 UTC (rev 13467)
@@ -70,7 +70,7 @@
 
         gboolean strict;
 
-        unsigned char complete_char; /* char to be used for auto-completion */
+        gunichar complete_char; /* char to be used for auto-completion */
 
         GList *ignore_strings;
 } PopBox;
@@ -628,6 +628,7 @@
         GdkEventKey *event = gui_data;
         gboolean keep_on_going = FALSE;
         gboolean extra_colon;
+	gunichar unicode_value;
         QuickFill *match;
         const char *match_str;
         int prefix_len;
@@ -637,11 +638,12 @@
         if (event->type != GDK_KEY_PRESS)
                 return FALSE;
 
+	unicode_value = gdk_keyval_to_unicode(event->keyval);
         switch (event->keyval) {
                 case GDK_slash:
                         if (!(event->state & GDK_MOD1_MASK))
                         {
-                                if (event->keyval == box->complete_char)
+                                if (unicode_value == box->complete_char)
                                         break;
 
                                 return FALSE;
@@ -690,7 +692,7 @@
         if (box->complete_char == 0)
                 return FALSE;
 
-        if (event->keyval != box->complete_char)
+        if (unicode_value != box->complete_char)
                 return FALSE;
 
         if (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))
@@ -951,7 +953,7 @@
 }
 
 void
-gnc_combo_cell_set_complete_char (ComboCell *cell, char complete_char)
+gnc_combo_cell_set_complete_char (ComboCell *cell, gunichar complete_char)
 {
 	PopBox *box;
 

Modified: gnucash/trunk/src/report/standard-reports/budget.scm
===================================================================
--- gnucash/trunk/src/report/standard-reports/budget.scm	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/report/standard-reports/budget.scm	2006-03-04 03:04:46 UTC (rev 13467)
@@ -242,8 +242,6 @@
          ;;                             optname-report-currency))
          (show-full-names? (get-option gnc:pagename-general
                                        optname-show-full-names))
-         (separator (gnc:account-separator-char))
-
          (doc (gnc:make-html-document))
          ;;(table (gnc:make-html-table))
          ;;(txt (gnc:make-html-text))

Modified: gnucash/trunk/src/report/standard-reports/cash-flow.scm
===================================================================
--- gnucash/trunk/src/report/standard-reports/cash-flow.scm	2006-03-04 02:42:49 UTC (rev 13466)
+++ gnucash/trunk/src/report/standard-reports/cash-flow.scm	2006-03-04 03:04:46 UTC (rev 13467)
@@ -144,8 +144,6 @@
          (exchange-fn (gnc:case-exchange-fn
                        price-source report-currency to-date-tp))
 
-         (separator (gnc:account-separator-char))
-
          (doc (gnc:make-html-document))
          (table (gnc:make-html-table))
          (txt (gnc:make-html-text)))



More information about the gnucash-changes mailing list