From 82c308a798bf2418934740a7b14a1337c4fddebd Mon Sep 17 00:00:00 2001
From: Alexandre Savard <asavard@asavard.(none)>
Date: Wed, 8 Jun 2011 09:46:49 -0400
Subject: [PATCH] #5994: Implement set current addressbook name and search type
 in addressbook plugin

---
 sflphone-client-gnome/src/contacts/searchbar.c  |  3 ++-
 .../plugin/addressbook/addressbook.c            | 17 +++++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/sflphone-client-gnome/src/contacts/searchbar.c b/sflphone-client-gnome/src/contacts/searchbar.c
index 533c37eb71..3392223e26 100644
--- a/sflphone-client-gnome/src/contacts/searchbar.c
+++ b/sflphone-client-gnome/src/contacts/searchbar.c
@@ -84,11 +84,12 @@ static void cbox_changed_cb (GtkWidget *widget, gpointer user_data UNUSED)
 {
     gchar *name;
 
-    DEBUG ("Searchbar: CBOX changed callback");
+    DEBUG ("Searchbar: Addressbook changed callback");
 
     name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
 
     if(abookfactory_is_addressbook_loaded()) {
+        DEBUG("Searchbar: Set new addressbook");
         AddrBookFactory *factory = abookfactory_get_factory();
         factory->addrbook->set_current_book (name);
         AddressBook_Config *addressbook_config;
diff --git a/sflphone-plugins/plugin/addressbook/addressbook.c b/sflphone-plugins/plugin/addressbook/addressbook.c
index 96f5c2e5a7..68f3ea50d7 100644
--- a/sflphone-plugins/plugin/addressbook/addressbook.c
+++ b/sflphone-plugins/plugin/addressbook/addressbook.c
@@ -235,9 +235,22 @@ handler_async_search (GList *hits, gpointer user_data)
 */
 
 void addressbook_set_search_type(AddrbookSearchType searchType) {
-
+    switch(searchType) {
+    case ABOOK_QUERY_IS:
+	set_current_addressbook_test(E_BOOK_QUERY_IS);
+	break;
+    case ABOOK_QUERY_BEGINS_WITH:
+	set_current_addressbook_test(E_BOOK_QUERY_BEGINS_WITH);
+	break;
+    case ABOOK_QUERY_CONTAINS:
+	set_current_addresbook_test(E_BOOK_QUERY_CONTAINS);
+	break;
+    default:
+	printf("Addressbook: Error: Unsupported search type");
+    	break;
+    }
 }
 
 void addressbook_set_current_book(gchar *current) {
-
+    set_current_addressbook(current);
 }
-- 
GitLab