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.
This commit is contained in:
John Ralls 2023-07-20 14:19:48 -07:00
parent 2e76d2f43d
commit 84eb084375

View File

@ -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>())