diff options
author | Chris Toshok <toshok@ximian.com> | 2003-01-02 05:15:18 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2003-01-02 05:15:18 +0800 |
commit | 176ee176678618d647af68036550e9d05a3babab (patch) | |
tree | b696f772293d1d59868217ed33493c8ea87f96fc /addressbook/gui/component/select-names/e-select-names-manager.c | |
parent | b69a32f31aa15a670f90496e8a000c2bfaae802b (diff) | |
download | gsoc2013-evolution-176ee176678618d647af68036550e9d05a3babab.tar gsoc2013-evolution-176ee176678618d647af68036550e9d05a3babab.tar.gz gsoc2013-evolution-176ee176678618d647af68036550e9d05a3babab.tar.bz2 gsoc2013-evolution-176ee176678618d647af68036550e9d05a3babab.tar.lz gsoc2013-evolution-176ee176678618d647af68036550e9d05a3babab.tar.xz gsoc2013-evolution-176ee176678618d647af68036550e9d05a3babab.tar.zst gsoc2013-evolution-176ee176678618d647af68036550e9d05a3babab.zip |
[ fixes the non-ui portion of #36183 ] use the entry's
2003-01-01 Chris Toshok <toshok@ximian.com>
[ fixes the non-ui portion of #36183 ]
* gui/component/select-names/e-select-names-completion.c
(e_select_names_completion_start_query): use the entry's
minimum_query_length instead of a constant here.
(e_select_names_completion_set_minimum_query_length): new
function, set the entry's minimum_query_length.
* gui/component/select-names/e-select-names-manager.c
(e_select_names_manager_entry_new): set the minimum_query length
after setting the completion books.
(read_completion_settings_from_db): rename
read_completion_books_from_db to this, and read the
minimum_query_length too.
(db_listener): rename uris_listener to this, and listen for
changes on both the uris and minimum_query_length settings.
* gui/component/select-names/e-select-names-completion.h: add
prototype for e_select_names_completion_set_minimum_query_length.
* gui/component/select-names/e-select-names-manager.h: add
minimum_query_length to struct _ESelectNamesManager.
svn path=/trunk/; revision=19199
Diffstat (limited to 'addressbook/gui/component/select-names/e-select-names-manager.c')
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-manager.c | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c index 4ac995d191..7d9ce8ab81 100644 --- a/addressbook/gui/component/select-names/e-select-names-manager.c +++ b/addressbook/gui/component/select-names/e-select-names-manager.c @@ -29,6 +29,8 @@ #include "addressbook/gui/component/addressbook.h" #include <bonobo/bonobo-object.h> +#define DEFAULT_MINIMUM_QUERY_LENGTH 3 + enum { CHANGED, OK, @@ -270,6 +272,9 @@ e_select_names_manager_entry_new (ESelectNamesManager *manager, ESelectNamesMode e_select_names_completion_add_book (E_SELECT_NAMES_COMPLETION(entry->comp), book); } + e_select_names_completion_set_minimum_query_length (E_SELECT_NAMES_COMPLETION(entry->comp), + manager->minimum_query_length); + e_entry_enable_completion_full (entry->entry, entry->comp, 100, completion_handler); entry->manager = manager; @@ -407,9 +412,10 @@ load_completion_books (ESelectNamesManager *manager) } static void -read_completion_books_from_db (ESelectNamesManager *manager, EConfigListener *db) +read_completion_settings_from_db (ESelectNamesManager *manager, EConfigListener *db) { char *val; + long ival; val = e_config_listener_get_string (db, "/apps/evolution/addressbook/completion/uris"); @@ -418,22 +424,25 @@ read_completion_books_from_db (ESelectNamesManager *manager, EConfigListener *db manager->cached_folder_list = val; load_completion_books(manager); } + + ival = e_config_listener_get_long (db, "/apps/evolution/addressbook/completion/minimum_query_length"); + if (ival <= 0) ival = DEFAULT_MINIMUM_QUERY_LENGTH; + + manager->minimum_query_length = ival; } static void -uris_listener (EConfigListener *db, const char *key, - ESelectNamesManager *manager) +db_listener (EConfigListener *db, const char *key, + ESelectNamesManager *manager) { GList *l; - char *val; - /* return if it's not the key we're interested in */ - if (strcmp (key, "/apps/evolution/addressbook/completion/uris")) - return; + if (!strcmp (key, "/apps/evolution/addressbook/completion/uris")) { + char *val = e_config_listener_get_string (db, key); - val = e_config_listener_get_string (db, "/apps/evolution/addressbook/completion/uris"); + if (!val) + return; - if (val) { if (!manager->cached_folder_list || strcmp (val, manager->cached_folder_list)) { for (l = manager->entries; l; l = l->next) { ESelectNamesManagerEntry *entry = l->data; @@ -449,6 +458,20 @@ uris_listener (EConfigListener *db, const char *key, load_completion_books (manager); } } + else if (!strcmp (key, "/apps/evolution/addressbook/completion/minimum_query_length")) { + long ival = e_config_listener_get_long (db, key); + + if (ival <= 0) + ival = DEFAULT_MINIMUM_QUERY_LENGTH; + + manager->minimum_query_length = ival; + + for (l = manager->entries; l; l = l->next) { + ESelectNamesManagerEntry *entry = l->data; + e_select_names_completion_set_minimum_query_length (E_SELECT_NAMES_COMPLETION(entry->comp), + manager->minimum_query_length); + } + } } /** @@ -467,9 +490,9 @@ e_select_names_manager_new (void) manager->listener_id = g_signal_connect (db, "key_changed", - G_CALLBACK (uris_listener), manager); + G_CALLBACK (db_listener), manager); - read_completion_books_from_db (manager, db); + read_completion_settings_from_db (manager, db); return manager; } |