Excellent. Thanks!
On 9/10/20 6:23 PM, John Ralls wrote:
On Sep 10, 2020, at 1:37 PM, Dean Jagels <dpj-gc...@mhtsa.us> wrote:
To get myself oriented with the code and my development setup, I decided I'd
look at bug 102787 (https://bugs.gnucash.org/show_bug.cgi?id=102787).
It turns out that gnc-currency-edit has everything needed underneath it. However, it
short-circuits the machinery. It listens for a "changed" signal, which fires as soon as
the user types into the combo box. The handler (gnc_currency_edit_active_changed()) calls
gnc_currency_edit_get_currency() expecting the currency selection to be complete. However, in that
routine, gtk_combo_box_get_active_iter() returns "false", so
gnc_currency_edit_get_currency() returns the locale default currency,
gnc_currency_edit_active_changed() pushes the locale default's mnemonic into the combo box, and GTK
entry completion never has a chance to offer options.
If instead, gnc_currency_edit_get_currency() returns NULL and
gnc_currency_edit_active_changed() simply returns if it gets NULL, then the
entry completion goes ahead and works.
I see roughly 15 references to gnc_currency_edit_get_currency(). I haven't
visited each to teach them how to deal with a NULL return from that function,
so I don't have a patch set yet. Before doing so, I wanted to check that others
agree with this change.
Some other uses of gnc_currency_edit_get_currency() check
gtk_combo_box_get_active() != -1 first to make sure that there's an active
selection. Doing so in gnc_currency_edit_active_changed() would be less
invasive and save you having to figure out how to correctly handle a NULL
currency* in the other 14 uses of gnc_currency_edit_get_currency().
Regards,
John Ralls
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel