From 8ac64bc150eb3f9117478be0e8c97a8cd2084b9c Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
Date: Fri, 13 Aug 2010 12:08:11 -0400
Subject: [PATCH] [#3854] Cleanup treeview on search returning no contacts

---
 sflphone-client-gnome/src/contacts/addressbook/eds.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sflphone-client-gnome/src/contacts/addressbook/eds.c b/sflphone-client-gnome/src/contacts/addressbook/eds.c
index 73f48942b8..c4b89b5ac3 100644
--- a/sflphone-client-gnome/src/contacts/addressbook/eds.c
+++ b/sflphone-client-gnome/src/contacts/addressbook/eds.c
@@ -47,11 +47,9 @@
  */
 typedef struct _Search_Handler_And_Data {
     SearchAsyncHandler search_handler;
-    OpenAsyncHandler open_handler;
     gpointer user_data;
     GList *hits;
     int max_results_remaining;
-    int book_views_remaining;
     EBookQuery *equery;
 } Search_Handler_And_Data;
 
@@ -247,8 +245,11 @@ eds_query_result_cb (EBook *book, EBookStatus status, GList *contacts, gpointer
 
     DEBUG ("Addressbook: Search Result callback called");
 
+    Search_Handler_And_Data *had = (Search_Handler_And_Data *) user_data;
+
     if (!contacts) {
-        DEBUG ("Addressbook: Error: Contact is NULL");
+        DEBUG ("Addressbook: No contact found");
+        had->search_handler (NULL, user_data);
         return;
     }
 
@@ -258,8 +259,6 @@ eds_query_result_cb (EBook *book, EBookStatus status, GList *contacts, gpointer
 
         gchar *number;
 
-        Search_Handler_And_Data *had = (Search_Handler_And_Data *) user_data;
-
         // make sure we have a new list of hits
         had->hits = NULL;
 
@@ -552,7 +551,6 @@ search_async_by_contacts (const char *query, int max_results, SearchAsyncHandler
     had->user_data = user_data;
     had->hits = NULL;
     had->max_results_remaining = max_results;
-    had->book_views_remaining = 0;
     had->equery = create_query (query);
 
     if (!current_uri)
-- 
GitLab