[Gnucash-changes] r13896 - gnucash/trunk - Use the parent commodity
and account type when creating new accounts.
David Hampton
hampton at cvs.gnucash.org
Mon May 1 23:48:22 EDT 2006
Author: hampton
Date: 2006-05-01 23:48:21 -0400 (Mon, 01 May 2006)
New Revision: 13896
Trac: http://svn.gnucash.org/trac/changeset/13896
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/gnome-utils/dialog-account.c
Log:
Use the parent commodity and account type when creating new accounts.
Fixes #337189 and #340242.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-05-02 02:32:49 UTC (rev 13895)
+++ gnucash/trunk/ChangeLog 2006-05-02 03:48:21 UTC (rev 13896)
@@ -1,5 +1,9 @@
2006-05-01 David Hampton <hampton at employees.org>
+ * src/gnome-utils/dialog-account.c: Use the parent commodity and
+ account type when creating new accounts. Fixes #337189 and
+ #340242.
+
* src/gnome-utils/gnc-file.c:
* src/engine/TransLog.[ch]: Start a new log file after a save.
Fixes #173056.
Modified: gnucash/trunk/src/gnome-utils/dialog-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-account.c 2006-05-02 02:32:49 UTC (rev 13895)
+++ gnucash/trunk/src/gnome-utils/dialog-account.c 2006-05-02 03:48:21 UTC (rev 13896)
@@ -1098,9 +1098,8 @@
static GNCAccountType
gnc_account_choose_new_acct_type (AccountWindow *aw)
{
-
- if (aw->valid_types == NULL)
- return last_used_account_type;
+ if (g_list_index (aw->valid_types, GINT_TO_POINTER(aw->type)) != -1)
+ return aw->type;
if (g_list_index (aw->valid_types, GINT_TO_POINTER(last_used_account_type)) != -1)
return last_used_account_type;
@@ -1118,14 +1117,8 @@
GList *list;
guint32 types = 0;
- switch (aw->dialog_type) {
- case NEW_ACCOUNT:
- aw->type = gnc_account_choose_new_acct_type (aw);
- break;
- case EDIT_ACCOUNT:
- aw->type = xaccAccountGetType (aw_get_account (aw));
- break;
- }
+ if ((aw->dialog_type == NEW_ACCOUNT) && aw->valid_types)
+ aw->type = gnc_account_choose_new_acct_type (aw);
if (aw->valid_types == NULL)
types = xaccAccountTypesValid () | (1 << aw->type);
@@ -1480,7 +1473,7 @@
gnc_commodity * default_commodity,
gboolean modal)
{
- gnc_commodity *commodity;
+ gnc_commodity *commodity, *parent_commodity;
AccountWindow *aw;
Account *account;
@@ -1493,10 +1486,13 @@
account = xaccMallocAccount (gnc_get_current_book ());
aw->account = *xaccAccountGetGUID (account);
- if (base_account)
+ if (base_account) {
aw->type = xaccAccountGetType (base_account);
- else
+ parent_commodity = xaccAccountGetCommodity (base_account);
+ } else {
aw->type = last_used_account_type;
+ parent_commodity = gnc_default_currency ();
+ }
gnc_suspend_gui_refresh ();
@@ -1515,7 +1511,7 @@
if (default_commodity != NULL) {
commodity = default_commodity;
} else if ((aw->type != STOCK) && (aw->type != MUTUAL)) {
- commodity = gnc_default_currency ();
+ commodity = parent_commodity;
} else {
commodity = NULL;
}
@@ -1708,6 +1704,7 @@
aw->dialog_type = EDIT_ACCOUNT;
aw->account = *xaccAccountGetGUID (account);
aw->subaccount_names = NULL;
+ aw->type = xaccAccountGetType (account);
gnc_suspend_gui_refresh ();
More information about the gnucash-changes
mailing list