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.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13467 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton
2006-03-04 03:04:46 +00:00
parent 7921695276
commit 22ee7eb47f
18 changed files with 214 additions and 273 deletions

View File

@@ -1,3 +1,12 @@
2006-03-03 David Hampton <hampton@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@ihtfp.com>
* configure.in: error out on g-wrap-1.3, gcc4, and error-on-warning.

View File

@@ -153,17 +153,6 @@ gnc_quoteinfo2scm(gnc_commodity *comm)
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)
{

View File

@@ -43,8 +43,6 @@ int gnc_printinfo_p(SCM info_scm);
*/
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

View File

@@ -61,35 +61,36 @@ static gboolean reverse_balance_inited = FALSE;
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);
}

View File

@@ -414,12 +414,4 @@ determines formatting details.")
'<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"))

View File

@@ -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 @@ static void xaccAccountBringUpToDate (Account *acc);
* Args: none *
* Returns: account separator character *
\*******************************************************************/
char
gnc_get_account_separator (void)
const gchar *
gnc_get_account_separator_string (void)
{
return account_separator;
}
void
gnc_set_account_separator (char separator)
gunichar
gnc_get_account_separator (void)
{
account_separator = separator;
return account_uc_separator;
}
void
gnc_set_account_separator (const gchar *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 @@ xaccAccountGetFullName(const Account *account)
{
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;
}

View File

@@ -183,8 +183,9 @@ int xaccAccountOrder (const Account **account_1, const Account **account_2);
*
* @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))

View File

@@ -498,79 +498,56 @@ xaccGetAccountFromName (const AccountGroup *grp, const char * name)
* Fetch an account, given its full name *
\********************************************************************/
static Account *
xaccGetAccountFromFullNameHelper (const AccountGroup *grp,
gchar **names)
{
Account *found;
GList *node;
g_return_val_if_fail(grp, NULL);
g_return_val_if_fail(names, NULL);
/* Look for the first name in the children. */
for (node = grp->accounts; node; node = node->next) {
Account *account = node->data;
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;
/* No children? We're done. */
if (!account->children)
return NULL;
/* There's stuff left to search for. Search recursively. */
found = xaccGetAccountFromFullNameHelper(account->children, &names[1]);
if (found != NULL) {
return found;
}
}
}
return NULL;
}
Account *
xaccGetAccountFromFullName (const AccountGroup *grp,
const char *name)
const char *name)
{
GList *node;
Account *found;
char *p;
char separator;
gchar **names;
if (!grp) return NULL;
if (!name) return NULL;
p = (char *) name;
found = NULL;
separator = gnc_get_account_separator();
while (1)
{
/* Look for the first separator. */
p = strchr(p, separator);
/* 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;
}
}
/* If found != NULL, an account was found. */
/* If p == NULL, there are no more separators left. */
/* Put back the separator. */
if (p != NULL)
*p = separator;
/* If we found the account, return it. */
if (found != NULL)
return found;
/* We didn't find the account. If there
* are no more separators, return NULL. */
if (p == NULL)
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;
}
/********************************************************************\

View File

@@ -381,6 +381,15 @@
'((<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

View File

@@ -68,7 +68,8 @@ typedef struct _AccountWindow
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_finish_ok (AccountWindow *aw,
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,12 +430,8 @@ gnc_finish_ok (AccountWindow *aw,
aw->account = *xaccAccountGetGUID (account);
aw->type = xaccAccountGetType (parent);
xaccAccountSetName (account, aw->subaccount_names->data);
node = aw->subaccount_names;
aw->subaccount_names = g_list_remove_link (aw->subaccount_names, node);
g_free (node->data);
g_list_free_1 (node);
xaccAccountSetName (account, *aw->next_name);
aw->next_name++;
gnc_account_to_ui (aw);
@@ -446,8 +442,8 @@ gnc_finish_ok (AccountWindow *aw,
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 @@ gnc_common_ok (AccountWindow *aw)
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 @@ gnc_common_ok (AccountWindow *aw)
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_account_window_destroy_cb (GtkObject *object, gpointer data)
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,14 +1336,12 @@ get_ui_fullname (AccountWindow *aw)
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';
fullname = g_strconcat (parent_name, sep_string, name, NULL);
separator = gnc_get_account_separator_string ();
fullname = g_strconcat (parent_name, separator, name, NULL);
g_free (parent_name);
}
@@ -1369,6 +1356,7 @@ gnc_account_window_set_name (AccountWindow *aw)
{
char *fullname;
char *title;
gint length;
if (!aw || !aw->parent_tree)
return;
@@ -1377,13 +1365,12 @@ gnc_account_window_set_name (AccountWindow *aw)
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 @@ refresh_handler (GHashTable *changes, gpointer user_data)
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_ui_new_account_window_internal (Account *base_account,
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 @@ gnc_ui_new_account_window_internal (Account *base_account,
}
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;
account = xaccGetAccountFromFullName (group, name);
if (account)
{
*base_account = account;
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;
if (safe_strcmp(xaccAccountGetName (account), *ptr) == 0) {
/* We found an account. */
*base_account = account;
break;
}
}
names = g_list_prepend (names, g_strdup (p));
}
else
{
names = g_list_prepend (names, g_strdup (name));
/* Was there a match? If no, stop the traversal. */
if (node == NULL)
break;
}
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 * gnc_ui_new_accounts_from_name_with_defaults (const char *name,
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,19 +1610,27 @@ Account * gnc_ui_new_accounts_from_name_with_defaults (const char *name,
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);

View File

@@ -53,12 +53,10 @@ acct_tree_add_accts(SCM accts, GtkCTree * tree, GtkCTreeNode * parent,
{
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 @@ acct_tree_add_accts(SCM accts, GtkCTree * tree, GtkCTreeNode * parent,
/* 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 @@ gnc_ui_qif_account_picker_new_cb(GtkButton * w, gpointer user_data)
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 @@ gnc_ui_qif_account_picker_new_cb(GtkButton * w, gpointer user_data)
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);

View File

@@ -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)

View File

@@ -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

View File

@@ -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))

View File

@@ -74,7 +74,7 @@ void gnc_combo_cell_set_strict (ComboCell *cell, gboolean strict);
/** 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'. */

View File

@@ -70,7 +70,7 @@ typedef struct _PopBox
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 @@ gnc_combo_cell_direct_update (BasicCell *bcell,
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 @@ gnc_combo_cell_direct_update (BasicCell *bcell,
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 @@ gnc_combo_cell_direct_update (BasicCell *bcell,
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 @@ gnc_combo_cell_set_strict (ComboCell *cell, gboolean strict)
}
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;

View File

@@ -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))

View File

@@ -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)))