mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add a function to combocell to set the search behaviour
When searching for entered text, the combocell search starts from the front till the entered text is not found and then changes to find the entered text any where. This function sets the combocell to use only the second option, type ahead search.
This commit is contained in:
parent
46c2e44988
commit
91486a7318
@ -862,6 +862,8 @@ gnc_split_register_load_desc_cells (SplitRegister* reg)
|
||||
cell = (ComboCell*)
|
||||
gnc_table_layout_get_cell (reg->table->layout, DESC_CELL);
|
||||
|
||||
gnc_combo_cell_use_type_ahead_only (cell);
|
||||
|
||||
gnc_combo_cell_use_list_store_cache (cell, store);
|
||||
}
|
||||
/* ====================== END OF FILE ================================== */
|
||||
|
@ -108,5 +108,9 @@ void gnc_combo_cell_use_quickfill_cache (ComboCell* cell,
|
||||
QuickFill* shared_qf);
|
||||
void gnc_combo_cell_use_list_store_cache (ComboCell* cell, gpointer data);
|
||||
|
||||
/** Set the combocell to use only type ahead search. This will make the
|
||||
* search to be more like a modified entry completion. */
|
||||
void gnc_combo_cell_use_type_ahead_only (ComboCell* cell);
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
|
@ -75,6 +75,8 @@ typedef struct _PopBox
|
||||
GList* ignore_strings;
|
||||
|
||||
GHashTable *item_hash;
|
||||
|
||||
gboolean use_type_ahead_only;
|
||||
} PopBox;
|
||||
|
||||
|
||||
@ -167,6 +169,8 @@ gnc_combo_cell_init (ComboCell* cell)
|
||||
box->ignore_strings = NULL;
|
||||
|
||||
box->item_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
|
||||
box->use_type_ahead_only = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -694,7 +698,7 @@ gnc_combo_cell_modify_verify (BasicCell* _cell,
|
||||
/* 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))
|
||||
if (!gnc_item_list_using_temp (box->item_list) && !box->use_type_ahead_only)
|
||||
{
|
||||
// If we were deleting or inserting in the middle, just accept.
|
||||
if (change == NULL || *cursor_position < _cell->value_chars)
|
||||
@ -926,6 +930,19 @@ gnc_combo_cell_direct_update (BasicCell* bcell,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_combo_cell_use_type_ahead_only (ComboCell* cell)
|
||||
{
|
||||
PopBox* box;
|
||||
|
||||
if (cell == NULL) return;
|
||||
|
||||
box = cell->cell.gui_private;
|
||||
|
||||
box->use_type_ahead_only = TRUE;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_combo_cell_gui_realize (BasicCell* bcell, gpointer data)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user