gnucash master: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Mon May 18 15:44:47 EDT 2020
Updated via https://github.com/Gnucash/gnucash/commit/07325f79 (commit)
via https://github.com/Gnucash/gnucash/commit/9b028a7f (commit)
via https://github.com/Gnucash/gnucash/commit/2d6953e9 (commit)
from https://github.com/Gnucash/gnucash/commit/2ef1dc43 (commit)
commit 07325f796c6dd05f18732ae6ed64259ccc43c155
Author: John Ralls <jralls at ceridwen.us>
Date: Mon May 18 12:42:29 2020 -0700
combocell_gnome: Prevent starting off in type-ahead mode on entry
By ensuring that the list_store is set to the default and tmp_list
is empty.
diff --git a/gnucash/register/register-gnome/combocell-gnome.c b/gnucash/register/register-gnome/combocell-gnome.c
index 50238f748..f36376009 100644
--- a/gnucash/register/register-gnome/combocell-gnome.c
+++ b/gnucash/register/register-gnome/combocell-gnome.c
@@ -960,6 +960,9 @@ gnc_combo_cell_enter (BasicCell* bcell,
popup_get_width, box);
block_list_signals (cell);
+ // Clear the temp store to ensure we don't start in type-ahead mode.
+ gnc_item_list_set_temp_store (box->item_list, NULL);
+ gtk_list_store_clear (box->tmp_store);
gnc_item_list_select (box->item_list, bcell->value);
unblock_list_signals (cell);
commit 9b028a7f5862a416efcd588809d079a649c38f49
Author: John Ralls <jralls at ceridwen.us>
Date: Mon May 18 12:40:14 2020 -0700
combocell_gnome: Block signals for all list deletes.
Otherwise gnc_combo_cell_modify_verify is called once for every deleted
line in the gtk_list_store.
diff --git a/gnucash/register/register-gnome/combocell-gnome.c b/gnucash/register/register-gnome/combocell-gnome.c
index ddc5fa0e7..50238f748 100644
--- a/gnucash/register/register-gnome/combocell-gnome.c
+++ b/gnucash/register/register-gnome/combocell-gnome.c
@@ -523,9 +523,10 @@ list_store_append (GtkListStore *store, char* string)
*/
static gchar*
gnc_combo_cell_type_ahead_search (const gchar* newval,
- GtkListStore* full_store, PopBox* box)
+ GtkListStore* full_store, ComboCell *cell)
{
GtkTreeIter iter;
+ PopBox* box = cell->cell.gui_private;
int num_found = 0;
gchar* match_str = NULL;
const char* sep = gnc_get_account_separator_string ();
@@ -547,7 +548,9 @@ gnc_combo_cell_type_ahead_search (const gchar* newval,
g_free (newval_rep);
g_regex_unref (regex0);
+ block_list_signals (cell); //Prevent recursion from gtk_tree_view signals.
gtk_list_store_clear (box->tmp_store);
+ unblock_list_signals (cell);
while (valid && num_found < MAX_NUM_MATCHES)
{
@@ -640,7 +643,7 @@ gnc_combo_cell_modify_verify (BasicCell* _cell,
{
// No start-of-name match, try type-ahead search, we match any substring of the full account name.
GtkListStore *store = cell->shared_store;
- match_str = gnc_combo_cell_type_ahead_search (newval, store, box);
+ match_str = gnc_combo_cell_type_ahead_search (newval, store, cell);
*start_selection = newval_chars;
*end_selection = -1;
*cursor_position = newval_chars;
@@ -652,8 +655,10 @@ gnc_combo_cell_modify_verify (BasicCell* _cell,
{
if (gnc_item_list_using_temp (box->item_list))
{
+ block_list_signals (cell); //Prevent recursion
gnc_item_list_set_temp_store (box->item_list, NULL);
gtk_list_store_clear (box->tmp_store);
+ unblock_list_signals (cell);
}
gnc_basic_cell_set_value_internal (_cell, newval);
block_list_signals (cell);
commit 2d6953e9f4e2e20cc2148585fe31fcc3546986a6
Author: John Ralls <jralls at ceridwen.us>
Date: Mon May 18 12:38:22 2020 -0700
combocell-gnome: Process deletes and inserts before performing matching.
diff --git a/gnucash/register/register-gnome/combocell-gnome.c b/gnucash/register/register-gnome/combocell-gnome.c
index 9d798302d..ddc5fa0e7 100644
--- a/gnucash/register/register-gnome/combocell-gnome.c
+++ b/gnucash/register/register-gnome/combocell-gnome.c
@@ -616,21 +616,21 @@ gnc_combo_cell_modify_verify (BasicCell* _cell,
return;
}
+ // If we were deleting or inserting in the middle, just accept.
+ if (change == NULL || *cursor_position < _cell->value_chars)
+ {
+ gnc_basic_cell_set_value_internal (_cell, newval);
+ return;
+ }
+
/* If item_list is using temp then we're already partly matched by
* type-ahead and a quickfill_match won't work.
*/
if (!gnc_item_list_using_temp (box->item_list))
match_str = quickfill_match (box->qf, newval);
+
if (match_str != NULL)
{
- /* We have a match, but if we were deleting or inserting in the middle,
- * just accept.
- */
- if (change == NULL || *cursor_position < _cell->value_chars)
- {
- gnc_basic_cell_set_value_internal (_cell, newval);
- return;
- }
*start_selection = newval_chars;
*end_selection = -1;
*cursor_position += change_chars;
Summary of changes:
gnucash/register/register-gnome/combocell-gnome.c | 28 +++++++++++++++--------
1 file changed, 18 insertions(+), 10 deletions(-)
More information about the gnucash-changes
mailing list