Commit 0b998639 authored by Rafaël Carré's avatar Rafaël Carré

* #5695: addressbook : remove AddrBookHandle from plugin

parent 02d1e694
......@@ -81,10 +81,6 @@ void abookfactory_load_module(AddrBookFactory *factory)
if(ab->is_ready == NULL)
ERROR("AddressbookFactory: Error: Could not load addressbook addressbook_is_ready function");
ab->is_enabled = dlsym(handle, "addressbook_is_enabled");
if(ab->is_enabled == NULL)
ERROR("AddressbookFactory: Error: Could not load addressbook addressbook_is_enabled function");
ab->is_active = dlsym(handle, "addressbook_is_active");
if(ab->is_active == NULL)
ERROR("AddressbookFactory: Error: Could not load addressbook addressbook_is_active function");
......
......@@ -80,9 +80,8 @@ typedef struct AddrBookHandle AddrBookHandle;
struct AddrBookHandle {
void (*init) (gchar **);
gboolean (*is_ready) (void);
gboolean (*is_enabled) (void);
gboolean (*is_active) (void);
void (*search) (AddrBookHandle *, GtkEntry *, AddressBook_Config *);
void (*search) (void (*search_cb)(GList *, gpointer), GtkEntry *, AddressBook_Config *);
GSList *(*get_books_data)(gchar **);
book_data_t *(*get_book_data_by_uid)(gchar *);
void (*set_current_book)(gchar *);
......
......@@ -64,7 +64,7 @@ void searchbar_addressbook_activated (GtkEntry *entry, gchar *arg1 UNUSED, gpoin
AddrBookFactory *factory = abookfactory_get_factory();
AddressBook_Config *addressbook_config;
addressbook_config_load_parameters(&addressbook_config);
factory->addrbook->search(factory->addrbook, entry, addressbook_config);
factory->addrbook->search(factory->addrbook->search_cb, entry, addressbook_config);
}
}
......@@ -88,7 +88,7 @@ static void cbox_changed_cb (GtkWidget *widget, gpointer user_data UNUSED)
factory->addrbook->set_current_book (gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget)));
AddressBook_Config *addressbook_config;
addressbook_config_load_parameters(&addressbook_config);
factory->addrbook->search(factory->addrbook, GTK_ENTRY(addressbookentry), addressbook_config);
factory->addrbook->search(factory->addrbook->search_cb, GTK_ENTRY(addressbookentry), addressbook_config);
}
}
......@@ -190,7 +190,7 @@ static void select_search_type (GtkWidget *item, GtkEntry *entry UNUSED)
AddressBook_Config *addressbook_config;
addressbook_config_load_parameters(&addressbook_config);
factory->addrbook->search (factory->addrbook, GTK_ENTRY (addressbookentry), addressbook_config);
factory->addrbook->search (factory->addrbook->search_cb, GTK_ENTRY (addressbookentry), addressbook_config);
}
}
......
......@@ -37,22 +37,12 @@
* Perform a search on address book
*/
void
addressbook_search (AddrBookHandle *handle, GtkEntry* entry, AddressBook_Config *addressbook_config)
addressbook_search (void (*search_cb)(GList *, gpointer), GtkEntry* entry, AddressBook_Config *addressbook_config)
{
const gchar* query = gtk_entry_get_text (GTK_ENTRY (entry));
printf("Addressbook: Search %s\n", query);
search_async_by_contacts (gtk_entry_get_text (GTK_ENTRY (entry)), addressbook_config->max_results, handle->search_cb, addressbook_config);
}
/**
* Return addressbook state
*/
gboolean
addressbook_is_enabled()
{
return TRUE;
search_async_by_contacts (gtk_entry_get_text (GTK_ENTRY (entry)), addressbook_config->max_results, search_cb, addressbook_config);
}
/**
......
......@@ -39,10 +39,6 @@
#define __ADDRESSBOOK_H__
#include <gtk/gtk.h>
// #include <addressbook/eds.h>
#define EMPTY_ENTRY "empty"
typedef enum {ABOOK_QUERY_IS, ABOOK_QUERY_BEGINS_WITH, ABOOK_QUERY_CONTAINS} AddrbookSearchType;
......@@ -79,21 +75,6 @@ typedef struct _AddressBook_Config {
gint search_phone_mobile;
} AddressBook_Config;
typedef struct AddrBookHandle AddrBookHandle;
struct AddrBookHandle {
void (*init) (gchar **);
gboolean (*is_ready) (void);
gboolean (*is_enabled) (void);
gboolean (*is_active) (void);
void (*search) (AddrBookHandle *, GtkEntry *, AddressBook_Config *);
GSList *(*get_books_data)(gchar **);
book_data_t *(*get_book_data_by_uid)(gchar *);
void (*set_current_book)(gchar *);
void (*set_search_type)(AddrbookSearchType);
void (*search_cb)(GList *, gpointer);
};
/**
* Initialize addressbook
*/
......@@ -118,7 +99,7 @@ gboolean addressbook_is_active();
/**
* Perform a search in addressbook
*/
void addressbook_search (AddrBookHandle *, GtkEntry *, AddressBook_Config *);
void addressbook_search (void (*search_cb)(GList *, gpointer), GtkEntry *, AddressBook_Config *);
/**
* Get a list of addressbook book
......
......@@ -737,7 +737,7 @@ fetch_information_from_contact (EContact *contact, EContactField field, gchar **
to_fetch = g_strdup ( (char*) e_contact_get_const (contact, field));
if (!to_fetch) {
to_fetch = g_strdup (EMPTY_ENTRY);
to_fetch = g_strdup ("empty");
}
*info = g_strdup (to_fetch);
......
......@@ -43,11 +43,8 @@
#include <libebook/e-book.h>
#include "addressbook.h"
// #include "sflphone_const.h"
#define EMPTY_ENTRY "empty"
G_BEGIN_DECLS
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment