[ 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
This commit is contained in:

committed by
Chris Toshok

parent
b69a32f31a
commit
176ee17667
@ -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>
|
2002-12-19 Ettore Perazzoli <ettore@ximian.com>
|
||||||
|
|
||||||
* gui/component/addressbook-config.c
|
* gui/component/addressbook-config.c
|
||||||
|
@ -39,8 +39,6 @@
|
|||||||
#include <addressbook/backend/ebook/e-card-simple.h>
|
#include <addressbook/backend/ebook/e-card-simple.h>
|
||||||
#include <addressbook/backend/ebook/e-card-compare.h>
|
#include <addressbook/backend/ebook/e-card-compare.h>
|
||||||
|
|
||||||
#define MINIMUM_QUERY_LENGTH 3
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EBook *book;
|
EBook *book;
|
||||||
guint book_view_tag;
|
guint book_view_tag;
|
||||||
@ -71,6 +69,8 @@ struct _ESelectNamesCompletionPrivate {
|
|||||||
gboolean primary_only;
|
gboolean primary_only;
|
||||||
|
|
||||||
gboolean can_fail_due_to_too_many_hits; /* like LDAP, for example... */
|
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 *);
|
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) {
|
if (comp->priv->books_not_ready == 0) {
|
||||||
gchar *sexp;
|
gchar *sexp;
|
||||||
|
|
||||||
if (strlen (query_text) < MINIMUM_QUERY_LENGTH)
|
if (strlen (query_text) < comp->priv->minimum_query_length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
g_free (comp->priv->query_text);
|
g_free (comp->priv->query_text);
|
||||||
comp->priv->query_text = g_strdup (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);
|
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
|
gboolean
|
||||||
e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *comp)
|
e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *comp)
|
||||||
{
|
{
|
||||||
|
@ -59,6 +59,7 @@ GType e_select_names_completion_get_type (void);
|
|||||||
ECompletion *e_select_names_completion_new (ESelectNamesTextModel *);
|
ECompletion *e_select_names_completion_new (ESelectNamesTextModel *);
|
||||||
void e_select_names_completion_add_book (ESelectNamesCompletion *, EBook *);
|
void e_select_names_completion_add_book (ESelectNamesCompletion *, EBook *);
|
||||||
void e_select_names_completion_clear_books (ESelectNamesCompletion *);
|
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 *);
|
gboolean e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *);
|
||||||
void e_select_names_completion_set_match_contact_lists (ESelectNamesCompletion *, gboolean);
|
void e_select_names_completion_set_match_contact_lists (ESelectNamesCompletion *, gboolean);
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include "addressbook/gui/component/addressbook.h"
|
#include "addressbook/gui/component/addressbook.h"
|
||||||
#include <bonobo/bonobo-object.h>
|
#include <bonobo/bonobo-object.h>
|
||||||
|
|
||||||
|
#define DEFAULT_MINIMUM_QUERY_LENGTH 3
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
CHANGED,
|
CHANGED,
|
||||||
OK,
|
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_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);
|
e_entry_enable_completion_full (entry->entry, entry->comp, 100, completion_handler);
|
||||||
|
|
||||||
entry->manager = manager;
|
entry->manager = manager;
|
||||||
@ -407,9 +412,10 @@ load_completion_books (ESelectNamesManager *manager)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_completion_books_from_db (ESelectNamesManager *manager, EConfigListener *db)
|
read_completion_settings_from_db (ESelectNamesManager *manager, EConfigListener *db)
|
||||||
{
|
{
|
||||||
char *val;
|
char *val;
|
||||||
|
long ival;
|
||||||
|
|
||||||
val = e_config_listener_get_string (db, "/apps/evolution/addressbook/completion/uris");
|
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;
|
manager->cached_folder_list = val;
|
||||||
load_completion_books(manager);
|
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
|
static void
|
||||||
uris_listener (EConfigListener *db, const char *key,
|
db_listener (EConfigListener *db, const char *key,
|
||||||
ESelectNamesManager *manager)
|
ESelectNamesManager *manager)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
char *val;
|
|
||||||
|
|
||||||
/* return if it's not the key we're interested in */
|
if (!strcmp (key, "/apps/evolution/addressbook/completion/uris")) {
|
||||||
if (strcmp (key, "/apps/evolution/addressbook/completion/uris"))
|
char *val = e_config_listener_get_string (db, key);
|
||||||
return;
|
|
||||||
|
|
||||||
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)) {
|
if (!manager->cached_folder_list || strcmp (val, manager->cached_folder_list)) {
|
||||||
for (l = manager->entries; l; l = l->next) {
|
for (l = manager->entries; l; l = l->next) {
|
||||||
ESelectNamesManagerEntry *entry = l->data;
|
ESelectNamesManagerEntry *entry = l->data;
|
||||||
@ -449,6 +458,20 @@ uris_listener (EConfigListener *db, const char *key,
|
|||||||
load_completion_books (manager);
|
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,
|
manager->listener_id = g_signal_connect (db,
|
||||||
"key_changed",
|
"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;
|
return manager;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ struct _ESelectNamesManager {
|
|||||||
|
|
||||||
GList *completion_books;
|
GList *completion_books;
|
||||||
|
|
||||||
|
int minimum_query_length;
|
||||||
|
|
||||||
gulong listener_id;
|
gulong listener_id;
|
||||||
|
|
||||||
char *cached_folder_list;
|
char *cached_folder_list;
|
||||||
|
Reference in New Issue
Block a user