Skip to content
Snippets Groups Projects
Commit 4dd47998 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2467] Search for string longer than 3 fasten addressbook queries

parent c422357e
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,9 @@ void ...@@ -32,6 +32,9 @@ void
addressbook_search(GtkEntry* entry) addressbook_search(GtkEntry* entry)
{ {
gchar* query = gtk_entry_get_text(GTK_ENTRY (entry));
if (strlen(query) >= 3) {
AddressBook_Config *addressbook_config; AddressBook_Config *addressbook_config;
// Activate waiting layer // Activate waiting layer
...@@ -41,8 +44,9 @@ addressbook_search(GtkEntry* entry) ...@@ -41,8 +44,9 @@ addressbook_search(GtkEntry* entry)
addressbook_config_load_parameters(&addressbook_config); addressbook_config_load_parameters(&addressbook_config);
// Start the asynchronous search as soon as we have an entry */ // Start the asynchronous search as soon as we have an entry */
search_async(gtk_entry_get_text(GTK_ENTRY (entry)), addressbook_config->max_results, &handler_async_search, search_async(gtk_entry_get_text(GTK_ENTRY (entry)), addressbook_config->max_results, &handler_async_search, addressbook_config);
addressbook_config);
}
} }
/** /**
...@@ -84,6 +88,7 @@ addressbook_is_active() ...@@ -84,6 +88,7 @@ addressbook_is_active()
static void static void
addressbook_config_books() addressbook_config_books()
{ {
gchar **config_book_uid; gchar **config_book_uid;
book_data_t *book_data; book_data_t *book_data;
gchar **list; gchar **list;
...@@ -91,16 +96,16 @@ addressbook_config_books() ...@@ -91,16 +96,16 @@ addressbook_config_books()
// Retrieve list of books // Retrieve list of books
list = (gchar **) dbus_get_addressbook_list(); list = (gchar **) dbus_get_addressbook_list();
if (list) if (list) {
{
for (config_book_uid = list; *config_book_uid; config_book_uid++) for (config_book_uid = list; *config_book_uid; config_book_uid++) {
{
// Get corresponding book data // Get corresponding book data
book_data = books_get_book_data_by_uid(*config_book_uid); book_data = books_get_book_data_by_uid(*config_book_uid);
// If book_data exists // If book_data exists
if (book_data != NULL) if (book_data != NULL) {
{
book_data->active = TRUE; book_data->active = TRUE;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment