mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Change the way commodity and currency combo's are shown.
Use commodity print name to show in the combo's and use a hidden field to sort the list grouping by namespace. Also alter the way these settings are saved.
This commit is contained in:
parent
b8bbdb2ad5
commit
9debe91e99
@ -419,11 +419,11 @@ GtkTreeModel *get_model (bool all_commodity)
|
||||
|
||||
store = GTK_TREE_MODEL(gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER));
|
||||
model = gtk_tree_model_sort_new_with_model (store);
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
|
||||
0, GTK_SORT_ASCENDING);
|
||||
// set sort to sort on second string, first string will be shown
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), 1, GTK_SORT_ASCENDING);
|
||||
|
||||
gtk_list_store_append (GTK_LIST_STORE(store), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE(store), &iter, 0, " ", 1, nullptr, -1);
|
||||
gtk_list_store_set (GTK_LIST_STORE(store), &iter, 0, " ", 1, " ", 2, nullptr, -1);
|
||||
|
||||
namespace_list = g_list_first (namespace_list);
|
||||
while (namespace_list != nullptr)
|
||||
@ -440,23 +440,20 @@ GtkTreeModel *get_model (bool all_commodity)
|
||||
commodity_list = g_list_first (commodity_list);
|
||||
while (commodity_list != nullptr)
|
||||
{
|
||||
gchar *name_str;
|
||||
gchar *save_str;
|
||||
gchar *settings_str;
|
||||
const gchar *name_str;
|
||||
gchar *sort_str;
|
||||
tmp_commodity = (gnc_commodity*)commodity_list->data;
|
||||
DEBUG("Looking at commodity %s", gnc_commodity_get_fullname (tmp_commodity));
|
||||
|
||||
name_str = g_strconcat (tmp_namespace, " : (", gnc_commodity_get_mnemonic (tmp_commodity),
|
||||
") ", gnc_commodity_get_fullname (tmp_commodity), nullptr);
|
||||
name_str = gnc_commodity_get_printname (tmp_commodity);
|
||||
|
||||
settings_str = g_strconcat (tmp_namespace, "::", gnc_commodity_get_mnemonic (tmp_commodity), nullptr);
|
||||
DEBUG("Name string is %s, Save string is %s", name_str, settings_str);
|
||||
sort_str = g_strconcat (tmp_namespace, "::", gnc_commodity_get_mnemonic (tmp_commodity), nullptr);
|
||||
DEBUG("Name string is %s, Sort string is %s", name_str, sort_str);
|
||||
|
||||
gtk_list_store_append (GTK_LIST_STORE(store), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE(store), &iter, 0, name_str, 1, settings_str, 2, tmp_commodity, -1);
|
||||
gtk_list_store_set (GTK_LIST_STORE(store), &iter, 0, name_str, 1, sort_str, 2, tmp_commodity, -1);
|
||||
|
||||
g_free (name_str);
|
||||
g_free (settings_str);
|
||||
g_free (sort_str);
|
||||
commodity_list = g_list_next (commodity_list);
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ CsvTransSettings::load (void)
|
||||
if (col_types_str)
|
||||
g_strfreev (col_types_str);
|
||||
}
|
||||
|
||||
|
||||
// Price
|
||||
if (m_settings_type.compare("PRICE") == 0)
|
||||
{
|
||||
@ -424,10 +424,20 @@ CsvTransSettings::save (void)
|
||||
if (m_settings_type.compare("PRICE") == 0)
|
||||
{
|
||||
if (m_to_currency)
|
||||
g_key_file_set_string (keyfile, group.c_str(), CSV_TO_CURR, gnc_commodity_get_mnemonic(m_to_currency));
|
||||
{
|
||||
auto unique_name = g_strconcat (gnc_commodity_get_namespace (m_to_currency), "::",
|
||||
gnc_commodity_get_mnemonic (m_to_currency), nullptr);
|
||||
g_key_file_set_string (keyfile, group.c_str(), CSV_TO_CURR, unique_name);
|
||||
g_free (unique_name);
|
||||
}
|
||||
|
||||
if (m_from_commodity)
|
||||
g_key_file_set_string (keyfile, group.c_str(), CSV_FROM_COMM, gnc_commodity_get_mnemonic(m_from_commodity));
|
||||
{
|
||||
auto unique_name = g_strconcat (gnc_commodity_get_namespace (m_from_commodity), "::",
|
||||
gnc_commodity_get_mnemonic (m_from_commodity), nullptr);
|
||||
g_key_file_set_string (keyfile, group.c_str(), CSV_FROM_COMM, unique_name);
|
||||
g_free (unique_name);
|
||||
}
|
||||
|
||||
std::vector<const char*> col_types_str_price;
|
||||
for (auto col_type : m_column_types_price)
|
||||
|
Loading…
Reference in New Issue
Block a user