gnucash master: Revert visible changes to File->Properties for Book Currency from master in order to do further work in feature branch.
J.Alex Aycinena
alex.aycinena at code.gnucash.org
Sat Jul 22 16:16:37 EDT 2017
Updated via https://github.com/Gnucash/gnucash/commit/cb5e311a (commit)
from https://github.com/Gnucash/gnucash/commit/2ceaba37 (commit)
commit cb5e311a3f88769845e1b58b6f4b249d8622b2c9
Author: Alex Aycinena <alex.aycinena at gmail.com>
Date: Sat Jul 22 12:53:54 2017 -0700
Revert visible changes to File->Properties for Book Currency from master in order to do further work in feature branch.
diff --git a/src/app-utils/business-prefs.scm b/src/app-utils/business-prefs.scm
index 93d10ca..de7362e 100644
--- a/src/app-utils/business-prefs.scm
+++ b/src/app-utils/business-prefs.scm
@@ -144,28 +144,11 @@
"b" (N_ "Check to have split action field used in registers for 'Num' field in place of transaction number; transaction number shown as 'T-Num' on second line of register. Has corresponding effect on business features, reporting and imports/exports.")
#f))
- (reg-option
- (gnc:make-currency-accounting-option
- gnc:*option-section-accounts* gnc:*option-name-currency-accounting*
- "c"
- (N_ "Select the currency accounting method to use for transactions involving more than one currency or commodity.")
- 'neither
- (list
- (vector 'neither
- (N_ "Use neither Trading Accounts nor a Book Currency")
- (N_ "Check to use neither trading accounts nor a book-currency for transactions involving more than one currency or commodity."))
- (vector 'trading
- (N_ "Use Trading Accounts")
- (N_ "Check to have trading accounts used for transactions involving more than one currency or commodity."))
- (vector 'book-currency
- (N_ "Use a Book Currency")
- (N_ "Check to use a book-currency for transactions involving more than one currency or commodity.")))
- (N_ "Select the book-currency which is to be used to track costs of transactions involving currencies or commodities other than the book-currency.")
- (gnc-default-currency)
- (N_ "Select the default gains policy; this policy will be used unless over-ridden at the account level.")
- 'fifo
- (N_ "Select the default gains/loss account (income or expense account, in book-currency, neither placeholder nor hidden); this account will be used unless over-ridden at the account level. If one is not selected, an account will be created as needed."))
- )
+ (reg-option
+ (gnc:make-simple-boolean-option
+ gnc:*option-section-accounts* gnc:*option-name-trading-accounts*
+ "a" (N_ "Check to have trading accounts used for transactions involving more than one currency or commodity.")
+ #f))
;; Budgeting Tab
diff --git a/src/app-utils/test/test-option-util.cpp b/src/app-utils/test/test-option-util.cpp
index 2c3413a..480d024 100644
--- a/src/app-utils/test/test-option-util.cpp
+++ b/src/app-utils/test/test-option-util.cpp
@@ -75,20 +75,6 @@ setup_kvp (Fixture *fixture, gconstpointer pData)
}
static void
-setup_kvp_book_currency (Fixture *fixture, gconstpointer pData)
-{
- QofBook *book;
- setup (fixture, pData);
- book = fixture->book;
- qof_begin_edit (QOF_INSTANCE (book));
- qof_instance_set (QOF_INSTANCE (book),
- "book-currency", "GTQ",
- "default-gains-policy", "fifo",
- NULL);
- qof_commit_edit (QOF_INSTANCE (book));
-}
-
-static void
teardown (Fixture *fixture, gconstpointer pData)
{
qof_book_destroy (fixture->book);
@@ -105,22 +91,7 @@ test_option_load (Fixture *fixture, gconstpointer pData)
GNCOptionDB *odb = gnc_option_db_new_for_type (QOF_ID_BOOK);
qof_book_load_options (book, gnc_option_db_load, odb);
- symbol_value = gnc_currency_accounting_option_value_get_method (
- gnc_option_db_lookup_option (odb,
- OPTION_SECTION_ACCOUNTS,
- OPTION_NAME_CURRENCY_ACCOUNTING,
- SCM_BOOL_F));
- if (scm_is_symbol(symbol_value))
- {
- SCM string_value = scm_symbol_to_string (symbol_value);
- if (scm_is_string (string_value))
- {
- str = scm_to_utf8_string (string_value);
- }
- }
- g_assert_cmpstr (str, ==, "trading");
- if (str)
- g_free (str);
+ g_assert (gnc_option_db_lookup_boolean_option (odb, OPTION_SECTION_ACCOUNTS, OPTION_NAME_TRADING_ACCOUNTS, FALSE));
g_assert (gnc_option_db_lookup_boolean_option (odb,
OPTION_SECTION_ACCOUNTS,
OPTION_NAME_NUM_FIELD_SOURCE, FALSE));
@@ -131,101 +102,15 @@ test_option_load (Fixture *fixture, gconstpointer pData)
}
static void
-test_option_load_book_currency (Fixture *fixture, gconstpointer pData)
-{
- gchar *str = NULL;
- SCM symbol_value;
- const gchar *curr = NULL;
- SCM curr_scm;
-/* SCM acct_guid_scm = NULL; */
- gnc_commodity *commodity;
- QofBook *book = fixture->book;
- GNCOptionDB *odb = gnc_option_db_new_for_type (QOF_ID_BOOK);
-/* Account *acct, *acc;
-
- qof_book_begin_edit (book);
- acc = get_random_account( book );
- qof_instance_set (QOF_INSTANCE (book),
- "default-gain-loss-account-guid", qof_entity_get_guid(QOF_INSTANCE(acc)),
- NULL);
- qof_book_commit_edit (book); */
-
- qof_book_load_options (book, gnc_option_db_load, odb);
- symbol_value = gnc_currency_accounting_option_value_get_method (
- gnc_option_db_lookup_option (odb,
- OPTION_SECTION_ACCOUNTS,
- OPTION_NAME_CURRENCY_ACCOUNTING,
- SCM_BOOL_F));
- if (scm_is_symbol(symbol_value))
- {
- SCM string_value = scm_symbol_to_string (symbol_value);
- if (scm_is_string (string_value))
- {
- str = scm_to_utf8_string (string_value);
- }
- }
- g_assert_cmpstr (str, ==, "book-currency");
- if (str)
- g_free (str);
-/* acct_guid_scm = gnc_currency_accounting_option_value_get_default_account (
- gnc_option_db_lookup_option (odb,
- OPTION_SECTION_ACCOUNTS,
- OPTION_NAME_CURRENCY_ACCOUNTING,
- SCM_BOOL_F));
- if (acct_guid_scm && (scm_is_string(acct_guid_scm)))
- {
-
- GncGUID *guid = g_new (GncGUID, 1);
-
- str = scm_to_utf8_string (acct_guid_scm);
- if (string_to_guid (str, guid))
- acct = xaccAccountLookup( guid, book );
- g_free (guid);
- }
- g_assert ( xaccAccountEqual(acct, acc, TRUE) );
- if (str)
- g_free (str); */
- symbol_value = gnc_currency_accounting_option_value_get_default_policy (
- gnc_option_db_lookup_option (odb,
- OPTION_SECTION_ACCOUNTS,
- OPTION_NAME_CURRENCY_ACCOUNTING,
- SCM_BOOL_F));
- if (scm_is_symbol(symbol_value))
- {
- SCM string_value = scm_symbol_to_string (symbol_value);
- if (scm_is_string (string_value))
- {
- str = scm_to_utf8_string (string_value);
- }
- }
- g_assert_cmpstr (str, ==, "fifo");
- if (str)
- g_free (str);
- curr_scm = gnc_currency_accounting_option_value_get_book_currency(
- gnc_option_db_lookup_option(odb,
- OPTION_SECTION_ACCOUNTS,
- OPTION_NAME_CURRENCY_ACCOUNTING,
- SCM_BOOL_F));
- commodity = gnc_scm_to_commodity (curr_scm);
- if (commodity)
- {
- curr = gnc_commodity_get_mnemonic (commodity);
- }
- g_assert_cmpstr (curr, ==, "GTQ");
-
- gnc_option_db_destroy (odb);
-}
-
-static void
test_option_save (Fixture *fixture, gconstpointer pData)
{
QofBook *book = fixture->book;
GNCOptionDB *odb = gnc_option_db_new_for_type (QOF_ID_BOOK);
KvpFrame *slots = qof_instance_get_slots (QOF_INSTANCE (book));
- g_assert (gnc_option_db_set_option (odb, OPTION_SECTION_ACCOUNTS,
- OPTION_NAME_CURRENCY_ACCOUNTING,
- scm_cons (scm_from_locale_symbol("trading"), SCM_EOL)));
+ g_assert (gnc_option_db_set_boolean_option (odb, OPTION_SECTION_ACCOUNTS,
+ OPTION_NAME_TRADING_ACCOUNTS,
+ TRUE));
g_assert (gnc_option_db_set_boolean_option (odb, OPTION_SECTION_ACCOUNTS,
OPTION_NAME_NUM_FIELD_SOURCE,
TRUE));
@@ -243,47 +128,9 @@ test_option_save (Fixture *fixture, gconstpointer pData)
gnc_option_db_destroy (odb);
}
-static void
-test_option_save_book_currency (Fixture *fixture, gconstpointer pData)
-{
- QofBook *book = fixture->book;
- GNCOptionDB *odb = gnc_option_db_new_for_type (QOF_ID_BOOK);
- KvpFrame *slots = qof_instance_get_slots (QOF_INSTANCE (book));
- Account *acct, *acc;
- gchar *gain_loss_account_guid_str = NULL;
- gchar *gain_loss_account_guid_str2 = NULL;
- GncGUID *gain_loss_account_guid;
- SCM val = NULL;
-
- acc = get_random_account( book );
- gain_loss_account_guid_str = guid_to_string (xaccAccountGetGUID (acc));
- val = scm_from_utf8_string (gain_loss_account_guid_str);
-/* g_assert (gnc_option_db_set_option (odb, OPTION_SECTION_ACCOUNTS,
- OPTION_NAME_CURRENCY_ACCOUNTING,
- scm_cons (scm_from_locale_symbol("book-currency"),
- scm_cons (scm_from_utf8_string("GTQ"),
- scm_cons (scm_from_locale_symbol("fifo"),
- scm_cons (val, SCM_EOL))))));
- qof_book_save_options (book, gnc_option_db_save, odb, TRUE);
- g_assert_cmpstr (slots->get_slot("options/Accounts/Book Currency")->get<const char*>(), == , "GTQ");
- g_assert_cmpstr (slots->get_slot("options/Accounts/Default Gains Policy")->get<const char*>(), == , "fifo");
- gain_loss_account_guid =
- slots->get_slot("options/Accounts/Default Gain or Loss Account")->get<GncGUID*>();
- gain_loss_account_guid_str2 = guid_to_string (gain_loss_account_guid);
- g_assert_cmpstr (gain_loss_account_guid_str2, == , gain_loss_account_guid_str);
- if (gain_loss_account_guid_str)
- g_free (gain_loss_account_guid_str);
- if (gain_loss_account_guid_str2)
- g_free (gain_loss_account_guid_str2); */
-
- gnc_option_db_destroy (odb);
-}
-
extern "C" void
test_suite_option_util (void)
{
GNC_TEST_ADD (suitename, "Option DB Load", Fixture, NULL, setup_kvp, test_option_load, teardown);
- GNC_TEST_ADD (suitename, "Option DB Load - Book Currency", Fixture, NULL, setup_kvp_book_currency, test_option_load_book_currency, teardown);
GNC_TEST_ADD (suitename, "Option DB Save", Fixture, NULL, setup, test_option_save, teardown);
- GNC_TEST_ADD (suitename, "Option DB Save - Book Currency", Fixture, NULL, setup, test_option_save_book_currency, teardown);
}
diff --git a/src/gnome-utils/dialog-options.c b/src/gnome-utils/dialog-options.c
index a3ac41f..25903e6 100644
--- a/src/gnome-utils/dialog-options.c
+++ b/src/gnome-utils/dialog-options.c
@@ -2100,7 +2100,7 @@ refresh_handler (GHashTable *changes, gpointer user_data)
/* The default_gain_loss_account_widget needs to be refreshed if any
changes have been made via account maintenance, if it exists and
if the book currency widget has a selection */
- if (book_currency_data->default_gain_loss_account_widget &&
+/* if (book_currency_data->default_gain_loss_account_widget &&
gtk_combo_box_get_active_iter(
GTK_COMBO_BOX(book_currency_data->book_currency_widget), &iter))
{
@@ -2109,7 +2109,7 @@ refresh_handler (GHashTable *changes, gpointer user_data)
book_currency_data->book_currency_widget));
gnc_set_default_gain_loss_account_widget(commodity);
gtk_widget_show_all(book_currency_data->book_currency_vbox);
- }
+ } */
}
/* gnc_options_dialog_new:
diff --git a/src/gnome-utils/gtkbuilder/dialog-options.glade b/src/gnome-utils/gtkbuilder/dialog-options.glade
index 313dceb..ba4853c 100644
--- a/src/gnome-utils/gtkbuilder/dialog-options.glade
+++ b/src/gnome-utils/gtkbuilder/dialog-options.glade
@@ -6,7 +6,7 @@
<property name="can_focus">False</property>
<property name="title" translatable="yes">GnuCash Options</property>
<property name="default_width">400</property>
- <property name="default_height">625</property>
+ <property name="default_height">400</property>
<property name="type_hint">dialog</property>
<signal name="response" handler="gnc_options_dialog_response_cb" swapped="no"/>
<child internal-child="vbox">
diff --git a/src/gnome/gtkbuilder/assistant-hierarchy.glade b/src/gnome/gtkbuilder/assistant-hierarchy.glade
index f0d4aad..497c7fd 100644
--- a/src/gnome/gtkbuilder/assistant-hierarchy.glade
+++ b/src/gnome/gtkbuilder/assistant-hierarchy.glade
@@ -6,7 +6,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
- <property name="default_height">800</property>
+ <property name="default_height">550</property>
<signal name="cancel" handler="on_cancel" swapped="no"/>
<signal name="close" handler="on_finish" swapped="no"/>
<signal name="prepare" handler="on_prepare" swapped="no"/>
Summary of changes:
src/app-utils/business-prefs.scm | 27 +---
src/app-utils/test/test-option-util.cpp | 161 +-----------------------
src/gnome-utils/dialog-options.c | 4 +-
src/gnome-utils/gtkbuilder/dialog-options.glade | 2 +-
src/gnome/gtkbuilder/assistant-hierarchy.glade | 2 +-
5 files changed, 13 insertions(+), 183 deletions(-)
More information about the gnucash-changes
mailing list