mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-11-02 09:49:06 -06:00
Merge branch 'c++options'
This commit is contained in:
commit
abd1a0b3f1
106 files changed
+15978
-13848
No files matched your search
@@ -70,22 +70,7 @@ enum
|
||||
PROP_0,
|
||||
// PROP_ROOT_ACCOUNT, /* Table */
|
||||
// PROP_ROOT_TEMPLATE, /* Table */
|
||||
/* keep trading accounts property, while adding book-currency, default gains
|
||||
policy and default gains account properties, so that files prior to 2.7 can
|
||||
be read/processed; GUI changed to use all four properties as of 2.7.
|
||||
Trading accounts, on the one hand, and book-currency plus default-gains-
|
||||
policy, and optionally, default gains account, on the other, are mutually
|
||||
exclusive */
|
||||
PROP_OPT_TRADING_ACCOUNTS, /* KVP */
|
||||
/* Book currency and default gains policy properties only apply if currency
|
||||
accounting method selected in GUI is 'book-currency'; both required and
|
||||
both are exclusive with trading accounts */
|
||||
PROP_OPT_BOOK_CURRENCY, /* KVP */
|
||||
PROP_OPT_DEFAULT_GAINS_POLICY, /* KVP */
|
||||
/* Default gains account property only applies if currency accounting method
|
||||
selected in GUI is 'book-currency'; its use is optional but exclusive with
|
||||
trading accounts */
|
||||
PROP_OPT_DEFAULT_GAINS_ACCOUNT_GUID, /* KVP */
|
||||
PROP_OPT_AUTO_READONLY_DAYS, /* KVP */
|
||||
PROP_OPT_NUM_FIELD_SOURCE, /* KVP */
|
||||
PROP_OPT_DEFAULT_BUDGET, /* KVP */
|
||||
@@ -186,18 +171,6 @@ qof_book_get_property (GObject* object,
|
||||
qof_instance_get_path_kvp (QOF_INSTANCE (book), value, {str_KVP_OPTION_PATH,
|
||||
str_OPTION_SECTION_ACCOUNTS, str_OPTION_NAME_TRADING_ACCOUNTS});
|
||||
break;
|
||||
case PROP_OPT_BOOK_CURRENCY:
|
||||
qof_instance_get_path_kvp (QOF_INSTANCE (book), value, {str_KVP_OPTION_PATH,
|
||||
str_OPTION_SECTION_ACCOUNTS, OPTION_NAME_BOOK_CURRENCY});
|
||||
break;
|
||||
case PROP_OPT_DEFAULT_GAINS_POLICY:
|
||||
qof_instance_get_path_kvp (QOF_INSTANCE (book), value, {str_KVP_OPTION_PATH,
|
||||
str_OPTION_SECTION_ACCOUNTS, OPTION_NAME_DEFAULT_GAINS_POLICY});
|
||||
break;
|
||||
case PROP_OPT_DEFAULT_GAINS_ACCOUNT_GUID:
|
||||
qof_instance_get_path_kvp (QOF_INSTANCE (book), value, {str_KVP_OPTION_PATH,
|
||||
str_OPTION_SECTION_ACCOUNTS, OPTION_NAME_DEFAULT_GAINS_LOSS_ACCT_GUID});
|
||||
break;
|
||||
case PROP_OPT_AUTO_READONLY_DAYS:
|
||||
qof_instance_get_path_kvp (QOF_INSTANCE (book), value, {str_KVP_OPTION_PATH,
|
||||
str_OPTION_SECTION_ACCOUNTS, str_OPTION_NAME_AUTO_READONLY_DAYS});
|
||||
@@ -241,18 +214,6 @@ qof_book_set_property (GObject *object,
|
||||
qof_instance_set_path_kvp (QOF_INSTANCE (book), value, {str_KVP_OPTION_PATH,
|
||||
str_OPTION_SECTION_ACCOUNTS, str_OPTION_NAME_TRADING_ACCOUNTS});
|
||||
break;
|
||||
case PROP_OPT_BOOK_CURRENCY:
|
||||
qof_instance_set_path_kvp (QOF_INSTANCE (book), value, {str_KVP_OPTION_PATH,
|
||||
str_OPTION_SECTION_ACCOUNTS, OPTION_NAME_BOOK_CURRENCY});
|
||||
break;
|
||||
case PROP_OPT_DEFAULT_GAINS_POLICY:
|
||||
qof_instance_set_path_kvp (QOF_INSTANCE (book), value, {str_KVP_OPTION_PATH,
|
||||
str_OPTION_SECTION_ACCOUNTS, OPTION_NAME_DEFAULT_GAINS_POLICY});
|
||||
break;
|
||||
case PROP_OPT_DEFAULT_GAINS_ACCOUNT_GUID:
|
||||
qof_instance_set_path_kvp (QOF_INSTANCE (book), value, {str_KVP_OPTION_PATH,
|
||||
str_OPTION_SECTION_ACCOUNTS, OPTION_NAME_DEFAULT_GAINS_LOSS_ACCT_GUID});
|
||||
break;
|
||||
case PROP_OPT_AUTO_READONLY_DAYS:
|
||||
qof_instance_set_path_kvp (QOF_INSTANCE (book), value, {str_KVP_OPTION_PATH,
|
||||
str_OPTION_SECTION_ACCOUNTS, str_OPTION_NAME_AUTO_READONLY_DAYS});
|
||||
@@ -297,41 +258,6 @@ qof_book_class_init (QofBookClass *klass)
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
(gobject_class,
|
||||
PROP_OPT_BOOK_CURRENCY,
|
||||
g_param_spec_string("book-currency",
|
||||
"Select Book Currency",
|
||||
"The reference currency used to manage multiple-currency "
|
||||
"transactions when 'book-currency' currency accounting method "
|
||||
"selected; requires valid default gains/loss policy.",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
(gobject_class,
|
||||
PROP_OPT_DEFAULT_GAINS_POLICY,
|
||||
g_param_spec_string("default-gains-policy",
|
||||
"Select Default Gains Policy",
|
||||
"The default policy to be used to calculate gains/losses on "
|
||||
"dispositions of currencies/commodities other than "
|
||||
"'book-currency' when 'book-currency' currency accounting "
|
||||
"method selected; requires valid book-currency.",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
(gobject_class,
|
||||
PROP_OPT_DEFAULT_GAINS_ACCOUNT_GUID,
|
||||
g_param_spec_boxed("default-gain-loss-account-guid",
|
||||
"Select Default Gain/Loss Account",
|
||||
"The default account to be used for calculated gains/losses on "
|
||||
"dispositions of currencies/commodities other than "
|
||||
"'book-currency' when 'book-currency' currency accounting "
|
||||
"method selected; requires valid book-currency.",
|
||||
GNC_TYPE_GUID,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
(gobject_class,
|
||||
PROP_OPT_NUM_FIELD_SOURCE,
|
||||
@@ -982,52 +908,6 @@ qof_book_normalize_counter_format_internal(const gchar *p,
|
||||
return normalized_str;
|
||||
}
|
||||
|
||||
/** Returns pointer to book-currency name for book, if one exists in the
|
||||
* KVP, or NULL; does not validate contents nor determine if there is a valid
|
||||
* default gain/loss policy, both of which are required, for the
|
||||
* 'book-currency' currency accounting method to apply. Use instead
|
||||
* 'gnc_book_get_book_currency_name' which does these validations. */
|
||||
const gchar *
|
||||
qof_book_get_book_currency_name (QofBook *book)
|
||||
{
|
||||
const gchar *opt = NULL;
|
||||
qof_instance_get (QOF_INSTANCE (book),
|
||||
"book-currency", &opt,
|
||||
NULL);
|
||||
return opt;
|
||||
}
|
||||
|
||||
/** Returns pointer to default gain/loss policy for book, if one exists in the
|
||||
* KVP, or NULL; does not validate contents nor determine if there is a valid
|
||||
* book-currency, both of which are required, for the 'book-currency'
|
||||
* currency accounting method to apply. Use instead
|
||||
* 'gnc_book_get_default_gains_policy' which does these validations. */
|
||||
const gchar *
|
||||
qof_book_get_default_gains_policy (QofBook *book)
|
||||
{
|
||||
const gchar *opt = NULL;
|
||||
qof_instance_get (QOF_INSTANCE (book),
|
||||
"default-gains-policy", &opt,
|
||||
NULL);
|
||||
return opt;
|
||||
}
|
||||
|
||||
/** Returns pointer to default gain/loss account GUID for book, if one exists in
|
||||
* the KVP, or NULL; does not validate contents nor determine if there is a
|
||||
* valid book-currency, both of which are required, for the 'book-currency'
|
||||
* currency accounting method to apply. Use instead
|
||||
* 'gnc_book_get_default_gain_loss_acct' which does these validations. */
|
||||
GncGUID *
|
||||
qof_book_get_default_gain_loss_acct_guid (QofBook *book)
|
||||
{
|
||||
GncGUID *guid = NULL;
|
||||
qof_instance_get (QOF_INSTANCE (book),
|
||||
"default-gain-loss-account-guid", &guid,
|
||||
NULL);
|
||||
return guid;
|
||||
|
||||
}
|
||||
|
||||
/* Determine whether this book uses trading accounts */
|
||||
gboolean
|
||||
qof_book_use_trading_accounts (const QofBook *book)
|
||||
@@ -1277,14 +1157,14 @@ qof_book_unset_feature (QofBook *book, const gchar *key, const gchar *descr)
|
||||
}
|
||||
|
||||
void
|
||||
qof_book_load_options (QofBook *book, GNCOptionLoad load_cb, GNCOptionDB *odb)
|
||||
qof_book_load_options (QofBook *book, GncOptionLoad load_cb, GncOptionDB *odb)
|
||||
{
|
||||
load_cb (odb, book);
|
||||
}
|
||||
|
||||
void
|
||||
qof_book_save_options (QofBook *book, GNCOptionSave save_cb,
|
||||
GNCOptionDB* odb, gboolean clear)
|
||||
qof_book_save_options (QofBook *book, GncOptionSave save_cb,
|
||||
GncOptionDB* odb, gboolean clear)
|
||||
{
|
||||
/* Wrap this in begin/commit so that it commits only once instead of doing
|
||||
* so for every option. Qof_book_set_option will take care of dirtying the
|
||||
|
||||
Reference in new issue
Block a user