Load the widget properties from a key File.
198 GError *key_error =
nullptr;
199 m_load_error =
false;
201 auto group = get_group_prefix() + m_name;
206 m_multi_split = g_key_file_get_boolean (keyfile, group.c_str(), CSV_MULTI_SPLIT, &key_error);
207 m_load_error |= handle_load_error (&key_error, group);
209 gchar *key_char = g_key_file_get_string (keyfile, group.c_str(), CSV_ACCOUNT_GUID, &key_error);
210 if (key_char && *key_char !=
'\0')
212 QofBook* book = gnc_get_current_book ();
218 m_load_error |= handle_load_error (&key_error, group);
222 key_char = g_key_file_get_string (keyfile, group.c_str(), CSV_ACCOUNT, &key_error);
223 if (key_char && *key_char !=
'\0')
225 if (m_base_account ==
nullptr)
233 g_key_file_set_string (keyfile, group.c_str(), CSV_ACCOUNT_GUID, acct_guid);
240 if (g_strcmp0 (key_char, full_name) != 0)
241 g_key_file_set_string (keyfile, group.c_str(), CSV_ACCOUNT, full_name);
245 m_load_error |= handle_load_error (&key_error, group);
250 m_column_types.clear();
251 gchar** col_types_str = g_key_file_get_string_list (keyfile, group.c_str(), CSV_COL_TYPES,
252 &list_len, &key_error);
253 for (uint32_t i = 0; i < list_len; i++)
256 const char *col_type_str = col_types_str[i];
257 if (!g_strcmp0(col_type_str,
"Deposit"))
258 col_type_str = gnc_csv_col_type_strs[GncTransPropType::AMOUNT];
259 if (!g_strcmp0(col_type_str,
"Withdrawal"))
260 col_type_str = gnc_csv_col_type_strs[GncTransPropType::AMOUNT_NEG];
261 if (!g_strcmp0(col_type_str,
"Num"))
262 col_type_str = gnc_csv_col_type_strs[GncTransPropType::NUM];
263 auto col_types_it = std::find_if (gnc_csv_col_type_strs.begin(),
265 auto prop = GncTransPropType::NONE;
266 if (col_types_it != gnc_csv_col_type_strs.end())
270 prop = sanitize_trans_prop (col_types_it->first, m_multi_split);
271 if (prop != col_types_it->first)
272 PWARN(
"Found column type '%s', but this is blacklisted when multi-split mode is %s. " 273 "Inserting column type 'NONE' instead'.",
274 col_types_it->second, m_multi_split ?
"enabled" :
"disabled");
277 PWARN(
"Found invalid column type '%s'. Inserting column type 'NONE' instead'.",
279 m_column_types.push_back(prop);
282 g_strfreev (col_types_str);
gboolean string_to_guid(const gchar *string, GncGUID *guid)
Given a string, replace the given guid with the parsed one unless the given value is null...
gchar * guid_to_string_buff(const GncGUID *guid, gchar *str)
The guid_to_string_buff() routine puts a null-terminated string encoding of the id into the memory po...
GKeyFile * gnc_state_get_current(void)
Returns a pointer to the most recently loaded state.
#define PWARN(format, args...)
Log a warning.
#define xaccAccountGetGUID(X)
gchar * gnc_account_get_full_name(const Account *account)
The gnc_account_get_full_name routine returns the fully qualified name of the account using the given...
bool preset_is_reserved_name(const std::string &name)
Check whether name can be used as a preset name.
Functor to check if the above map has an element of which the value equals name.
#define GUID_ENCODING_LENGTH
Number of characters needed to encode a guid as a string not including the null terminator.
Account * gnc_account_lookup_by_full_name(const Account *any_acc, const gchar *name)
The gnc_account_lookup_full_name() subroutine works like gnc_account_lookup_by_name, but uses fully-qualified names using the given separator.
bool load(void)
Load the widget properties from a key File.
The type used to store guids in C.
Account * xaccAccountLookup(const GncGUID *guid, QofBook *book)
The xaccAccountLookup() subroutine will return the account associated with the given id...