mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Finish removing preference, re-nice the code
This commit is contained in:
parent
bc8428c80e
commit
a934c41ef4
@ -54,8 +54,8 @@ typedef struct
|
||||
QuickFill *qf;
|
||||
gboolean load_list_store;
|
||||
GtkListStore *list_store;
|
||||
// For the type-ahead search, we need two lists, list_store contains the accounts that
|
||||
// match the search. list_store_full contain the original full list of accounts.
|
||||
/* For the type-ahead search, we need two lists, list_store contains the accounts that
|
||||
match the search. list_store_full contain the original full list of accounts. */
|
||||
GtkListStore *list_store_full;
|
||||
QofBook *book;
|
||||
Account *root;
|
||||
@ -124,7 +124,6 @@ load_shared_qf_cb (Account *account, gpointer data)
|
||||
char *name;
|
||||
GtkTreeIter iter;
|
||||
|
||||
// A callback to disable adding the account
|
||||
if (qfb->dont_add_cb)
|
||||
{
|
||||
gboolean skip = (qfb->dont_add_cb) (account, qfb->dont_add_data);
|
||||
|
@ -217,7 +217,7 @@ load_xfer_type_cells (GncEntryLedger *ledger)
|
||||
store = gnc_get_shared_account_name_list_store (root, IKEY,
|
||||
skip_expense_acct_cb, NULL);
|
||||
store_full = gnc_get_shared_account_name_list_store_full (root, IKEY,
|
||||
skip_expense_acct_cb, NULL);
|
||||
skip_expense_acct_cb, NULL);
|
||||
break;
|
||||
|
||||
case GNCENTRY_BILL_ENTRY:
|
||||
@ -234,7 +234,7 @@ load_xfer_type_cells (GncEntryLedger *ledger)
|
||||
store = gnc_get_shared_account_name_list_store (root, EKEY,
|
||||
skip_income_acct_cb, NULL);
|
||||
store_full = gnc_get_shared_account_name_list_store_full (root, EKEY,
|
||||
skip_income_acct_cb, NULL);
|
||||
skip_income_acct_cb, NULL);
|
||||
break;
|
||||
default:
|
||||
PWARN ("Bad GncEntryLedgerType");
|
||||
|
@ -90,7 +90,6 @@ static GOnce auto_pop_init_once = G_ONCE_INIT;
|
||||
static gboolean auto_pop_combos = FALSE;
|
||||
|
||||
|
||||
// Two Callbacks called when the user changes preferences
|
||||
static void
|
||||
gnc_combo_cell_set_autopop (gpointer prefs, gchar *pref, gpointer user_data)
|
||||
{
|
||||
@ -104,12 +103,12 @@ gnc_combo_cell_autopop_init (gpointer unused)
|
||||
gulong id;
|
||||
auto_pop_combos = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
|
||||
GNC_PREF_AUTO_RAISE_LISTS);
|
||||
|
||||
// Register callbacks for when the user changes preferences.
|
||||
|
||||
id = gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL_REGISTER,
|
||||
GNC_PREF_AUTO_RAISE_LISTS,
|
||||
gnc_combo_cell_set_autopop,
|
||||
NULL);
|
||||
GNC_PREF_AUTO_RAISE_LISTS,
|
||||
gnc_combo_cell_set_autopop,
|
||||
NULL);
|
||||
|
||||
gnc_prefs_set_reg_auto_raise_lists_id (id);
|
||||
return NULL;
|
||||
}
|
||||
@ -519,10 +518,13 @@ gnc_combo_cell_type_ahead_search(const gchar* newval, GtkListStore* full_store,
|
||||
GMatchInfo *match_info = NULL;
|
||||
GRegex *regex = NULL;
|
||||
gchar *rep_str = NULL;
|
||||
gchar *newval_rep = NULL;
|
||||
GRegex *regex0 = g_regex_new (gnc_get_account_separator_string(), 0, 0, &gerror);
|
||||
|
||||
// Replace ":" in newval with ".*:.*" so we can use regexp to match.
|
||||
rep_str = g_regex_replace (regex0,newval,-1,0,".*:.*",0,&gerror);
|
||||
newval_rep = g_strconcat (".*", gnc_get_account_separator_string(), ".*",
|
||||
NULL);
|
||||
rep_str = g_regex_replace (regex0, newval, -1, 0, newval_rep, 0, &gerror);
|
||||
// Then compile the regular expression based on rep_str.
|
||||
regex = g_regex_new (rep_str, G_REGEX_CASELESS, 0, &gerror);
|
||||
|
||||
@ -555,6 +557,7 @@ gnc_combo_cell_type_ahead_search(const gchar* newval, GtkListStore* full_store,
|
||||
g_regex_unref(regex);
|
||||
g_regex_unref(regex0);
|
||||
g_free(rep_str);
|
||||
g_free(newval_rep);
|
||||
return match_str;
|
||||
}
|
||||
|
||||
@ -589,8 +592,6 @@ gnc_combo_cell_modify_verify (BasicCell *_cell,
|
||||
return;
|
||||
}
|
||||
|
||||
// JEAN: If change == ":" do an autocompletion: if there's only 1 account that is currently matched
|
||||
|
||||
// Try the start-of-name match using the quickfill
|
||||
match = gnc_quickfill_get_string_match (box->qf, newval);
|
||||
match_str = g_strdup(gnc_quickfill_string (match));
|
||||
@ -736,7 +737,6 @@ gnc_combo_cell_direct_update (BasicCell *bcell,
|
||||
(*end_selection < bcell->value_chars))
|
||||
return FALSE;
|
||||
|
||||
// JEAN: WHERE : IS MATCHED
|
||||
find_pos = -1;
|
||||
if (*start_selection < bcell->value_chars)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user