gnucash stable: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Thu Jul 20 17:25:41 EDT 2023
Updated via https://github.com/Gnucash/gnucash/commit/9891a68f (commit)
via https://github.com/Gnucash/gnucash/commit/84eb0843 (commit)
via https://github.com/Gnucash/gnucash/commit/2e76d2f4 (commit)
from https://github.com/Gnucash/gnucash/commit/7e0c87aa (commit)
commit 9891a68f443fd2021876cd7e34ea2710ef742825
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Jul 20 14:22:42 2023 -0700
GncGtkListUIItem::set_option_from_ui_item: Iterate over selected items
Instead of all possible items.
diff --git a/gnucash/gnome-utils/gnc-option-gtk-ui.cpp b/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
index 086faf2b4a..747d646051 100644
--- a/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
+++ b/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
@@ -1168,20 +1168,20 @@ public:
}
g_signal_handlers_unblock_by_func(selection, (gpointer)list_changed_cb, &option);
}
+
void set_option_from_ui_item(GncOption& option) noexcept override
{
auto widget{GTK_TREE_VIEW(get_widget())};
auto selection{gtk_tree_view_get_selection(widget)};
- auto rows{option.num_permissible_values()};
+ auto selected_rows{gtk_tree_selection_get_selected_rows(selection, nullptr)};
GncMultichoiceOptionIndexVec vec;
- for (size_t row = 0; row < rows; ++row)
+ for (auto row = selected_rows; row; row = g_list_next(row))
{
- auto path{gtk_tree_path_new_from_indices(row, -1)};
- auto selected{gtk_tree_selection_path_is_selected(selection, path)};
- gtk_tree_path_free(path);
- if (selected)
- vec.push_back(row);
+ auto path{static_cast<GtkTreePath*>(row->data)};
+ auto indices{gtk_tree_path_get_indices(path)};
+ vec.push_back(*indices);
}
+ g_list_free_full(selected_rows, (GDestroyNotify)gtk_tree_path_free);
option.set_value(vec);
}
};
commit 84eb0843756b0714aca2d7300c9dbf01b5a86558
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Jul 20 14:19:48 2023 -0700
Bug 799020 - widget of gnc-register-list-option disregards user's clicks
If the GtkTreeSelection's mode isn't set to GTK_SELECTION_MULTIPLE
then each call to gtk_tree_selection_select_path overrides the
previous one and only one item is selected.
diff --git a/gnucash/gnome-utils/gnc-option-gtk-ui.cpp b/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
index d766398211..086faf2b4a 100644
--- a/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
+++ b/gnucash/gnome-utils/gnc-option-gtk-ui.cpp
@@ -1152,10 +1152,12 @@ class GncGtkListUIItem : public GncOptionGtkUIItem
public:
GncGtkListUIItem(GtkWidget* widget) :
GncOptionGtkUIItem{widget, GncOptionUIType::LIST} {}
+
void set_ui_item_from_option(GncOption& option) noexcept override
{
auto widget{GTK_TREE_VIEW(get_widget())};
auto selection{gtk_tree_view_get_selection(widget)};
+ gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
g_signal_handlers_block_by_func(selection, (gpointer)list_changed_cb, &option);
gtk_tree_selection_unselect_all(selection);
for (auto index : option.get_value<GncMultichoiceOptionIndexVec>())
commit 2e76d2f43d32894947763f9ab821ed93f07684a9
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Jul 20 14:14:50 2023 -0700
Bug 799021 - Saved report renders default of gnc-register-list-option
save_scm_value was trying too hard to handle the different possible
types that Scheme can set options to and in the process converting
lists to single symobls (e.g. ('good 'ugly) became #{good ugly}#.
That not being one of the possible values it was ignored and the
default value was used.
diff --git a/bindings/guile/gnc-optiondb.i b/bindings/guile/gnc-optiondb.i
index d757f66c55..4e3874bc51 100644
--- a/bindings/guile/gnc-optiondb.i
+++ b/bindings/guile/gnc-optiondb.i
@@ -1287,29 +1287,9 @@ inline SCM return_scm_value(ValueType value)
if constexpr (is_same_decayed_v<decltype(option),
GncOptionMultichoiceValue>)
{
- auto serial{option.serialize()};
- if (serial.empty())
- {
- return scm_simple_format(SCM_BOOL_F, list_format_str,
- scm_list_1(no_value));
- }
- else
- {
- auto keytype{option.get_keytype(option.get_index())};
- auto scm_str{scm_from_utf8_string(serial.c_str())};
- switch (keytype)
- {
- case GncOptionMultichoiceKeyType::SYMBOL:
- return scm_simple_format(SCM_BOOL_F, list_format_str,
- scm_list_1(scm_string_to_symbol(scm_str)));
- case GncOptionMultichoiceKeyType::STRING:
- return scm_simple_format(SCM_BOOL_F, list_format_str,
- scm_list_1((scm_str)));
- case GncOptionMultichoiceKeyType::NUMBER:
- return scm_simple_format(SCM_BOOL_F, ticked_format_str,
- scm_list_1(scm_str));
- }
- }
+ auto scm_val{get_scm_value(option)};
+ return scm_simple_format(SCM_BOOL_F, list_format_str,
+ scm_list_1(scm_val));
}
if constexpr (is_same_decayed_v<decltype(option),
GncOptionRangeValue<int>> ||
Summary of changes:
bindings/guile/gnc-optiondb.i | 26 +++-----------------------
gnucash/gnome-utils/gnc-option-gtk-ui.cpp | 16 +++++++++-------
2 files changed, 12 insertions(+), 30 deletions(-)
More information about the gnucash-changes
mailing list