GnuCash
Contact   Instructions
Bug 798135 - GtkEntry text with search list: shows selected entry again for no reason
Summary: GtkEntry text with search list: shows selected entry again for no reason
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: User Interface General (show other bugs)
Version: git-maint
Hardware: PC All
: Normal minor
Target Milestone: ---
Assignee: ui
QA Contact: ui
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-21 07:42 EST by Christopher Lam
Modified: 2021-02-24 07:35 EST (History)
4 users (show)

See Also:


Attachments

Description Christopher Lam 2021-02-21 07:42:42 EST
Pick a commonly used GtkEntry with search e.g. Customer Report, General/Customer option. It has a GtkEntry which allows typeahead search.

Start typing customer name. It will show matched customers on a drop-down. Click on any match to select customer.

EXPECTED:
Clicked customer is chosen for the option.

ACTUAL:
Another drop-down appears with a single choice, the clicked customer. Click it again and it will finally accept customer.

OS: ALL
Comment 1 Christopher Lam 2021-02-21 07:43:52 EST
Also appears on Currency options e.g. Transaction Report's "Report Currency" option.
Comment 2 Bob 2021-02-23 06:59:43 EST
OK, this is an interesting one and is down to setting the completion to be inline.

For the Customer entry, if you look at gnc-general-search.c line 401 you see inline is set to TRUE which allows you to type exact case or not with menu, so...

Customer 1's name is 'Anon Customer'
Customer 2's name is 'Anox Customer'
Customer 3's name is 'My Customer'

Type 'A', the above shows in menu with 'Ano' in the entry with 'no' selected.

To overcome what you are seeing, you can use...
gtk_entry_completion_set_popup_single_match (completion, FALSE);

But if you have only one customer starting with the same case first letter as above then typing 'm' will not show it.

For the Currency, the inline is set in gnc-gtk-utils.c line 181

So in conclusion I think the best option is to not enable inline completion.
What do you think as I do not use this?
Comment 3 Christopher Lam 2021-02-23 10:34:01 EST
Bob, interestingly setting both to FALSE fixes the whole thing completely: still allows type-ahead search, and there's no double dropdown list at all...

Unstaged changes (2)
modified   gnucash/gnome-search/gnc-general-search.c
@@ -398,7 +398,7 @@ create_children (GNCGeneralSearch *gsl,
     completion = gtk_entry_completion_new();
     gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(list_store));
     gtk_entry_completion_set_text_column(completion, 0);
-    gtk_entry_completion_set_inline_completion(completion, TRUE);
+    gtk_entry_completion_set_inline_completion(completion, FALSE);
     gtk_entry_set_completion(GTK_ENTRY(gsl->entry), completion);
 
     g_signal_connect (G_OBJECT (completion), "match_selected",
modified   gnucash/gnome-utils/gnc-gtk-utils.c
@@ -178,7 +178,7 @@ gnc_cbwe_add_completion (GtkComboBox *cbwe)
     model = gtk_combo_box_get_model(GTK_COMBO_BOX(cbwe));
     gtk_entry_completion_set_model(completion, model);
     gtk_entry_completion_set_text_column(completion, 0);
-    gtk_entry_completion_set_inline_completion(completion, TRUE);
+    gtk_entry_completion_set_inline_completion(completion, FALSE);
     gtk_entry_set_completion(entry, completion);
     g_object_unref(completion);
 }
Comment 4 Christopher Lam 2021-02-24 07:35:11 EST
Bob, I've fixed it by removing the "gtk_entry_completion_set_inline_completion(completion, TRUE);" altogether. It fixes it well for me.

Note You need to log in before you can comment on or make changes to this bug.