aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog24
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c14
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.h1
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.c45
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.h2
5 files changed, 71 insertions, 15 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index d1e63a80bc..cb9c2dfdc8 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,27 @@
+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.
+
2002-12-19 Ettore Perazzoli <ettore@ximian.com>
* gui/component/addressbook-config.c
diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c
index 602d6521b0..32d0be9268 100644
--- a/addressbook/gui/component/select-names/e-select-names-completion.c
+++ b/addressbook/gui/component/select-names/e-select-names-completion.c
@@ -39,8 +39,6 @@
#include <addressbook/backend/ebook/e-card-simple.h>
#include <addressbook/backend/ebook/e-card-compare.h>
-#define MINIMUM_QUERY_LENGTH 3
-
typedef struct {
EBook *book;
guint book_view_tag;
@@ -71,6 +69,8 @@ struct _ESelectNamesCompletionPrivate {
gboolean primary_only;
gboolean can_fail_due_to_too_many_hits; /* like LDAP, for example... */
+
+ gint minimum_query_length;
};
static void e_select_names_completion_class_init (ESelectNamesCompletionClass *);
@@ -1022,10 +1022,9 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar
if (comp->priv->books_not_ready == 0) {
gchar *sexp;
- if (strlen (query_text) < MINIMUM_QUERY_LENGTH)
+ if (strlen (query_text) < comp->priv->minimum_query_length)
return;
-
g_free (comp->priv->query_text);
comp->priv->query_text = g_strdup (query_text);
@@ -1317,6 +1316,13 @@ e_select_names_completion_clear_books (ESelectNamesCompletion *comp)
e_select_names_completion_clear_book_data (comp);
}
+void
+e_select_names_completion_set_minimum_query_length (ESelectNamesCompletion *comp, int query_length)
+{
+ g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp));
+ comp->priv->minimum_query_length = query_length;
+}
+
gboolean
e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *comp)
{
diff --git a/addressbook/gui/component/select-names/e-select-names-completion.h b/addressbook/gui/component/select-names/e-select-names-completion.h
index 40417841d7..6565208378 100644
--- a/addressbook/gui/component/select-names/e-select-names-completion.h
+++ b/addressbook/gui/component/select-names/e-select-names-completion.h
@@ -59,6 +59,7 @@ GType e_select_names_completion_get_type (void);
ECompletion *e_select_names_completion_new (ESelectNamesTextModel *);
void e_select_names_completion_add_book (ESelectNamesCompletion *, EBook *);
void e_select_names_completion_clear_books (ESelectNamesCompletion *);
+void e_select_names_completion_set_minimum_query_length (ESelectNamesCompletion *, int);
gboolean e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *);
void e_select_names_completion_set_match_contact_lists (ESelectNamesCompletion *, gboolean);
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;
}
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.h b/addressbook/gui/component/select-names/e-select-names-manager.h
index 55242629a4..f5fb4aa451 100644
--- a/addressbook/gui/component/select-names/e-select-names-manager.h
+++ b/addressbook/gui/component/select-names/e-select-names-manager.h
@@ -34,6 +34,8 @@ struct _ESelectNamesManager {
GList *completion_books;
+ int minimum_query_length;
+
gulong listener_id;
char *cached_folder_list;