From f7bfd0bcf8dea7f8e0510cde98acf3a266404efc Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sun, 28 May 2023 14:07:23 +0100 Subject: [PATCH] Add a don't complete entry to the top of the list --- gnucash/register/register-gnome/completioncell-gnome.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gnucash/register/register-gnome/completioncell-gnome.c b/gnucash/register/register-gnome/completioncell-gnome.c index 57d63cc2cf..3fdf827f06 100644 --- a/gnucash/register/register-gnome/completioncell-gnome.c +++ b/gnucash/register/register-gnome/completioncell-gnome.c @@ -71,6 +71,8 @@ typedef struct _PopBox } PopBox; +#define DONT_TEXT N_("Don't autocomplete") + /** Enumeration for the list-store */ enum GncCompletionColumn { @@ -599,6 +601,11 @@ populate_list_store (CompletionCell* cell, const gchar* str) gtk_list_store_clear (box->item_store); + // add the don't first entry + gchar *markup = g_markup_printf_escaped ("%s", DONT_TEXT); + list_store_append (box->item_store, DONT_TEXT, markup, 0); + g_free (markup); + // add to the list store g_hash_table_foreach (box->item_hash, add_item, box); @@ -642,6 +649,8 @@ gnc_completion_cell_modify_verify (BasicCell* bcell, if (box->in_list_select) { + if (g_strcmp0 (newval, DONT_TEXT) == 0) + return; gnc_basic_cell_set_value_internal (bcell, newval); *cursor_position = -1; *start_selection = 0;