Commit 8d745116 authored by Alexandre Savard's avatar Alexandre Savard

#5979: Implement addressbook factory and plugin

parent cb57b888
......@@ -61,15 +61,6 @@ PKG_CHECK_MODULES([LIBEDATASERVER], [libedataserver-1.2 >= 2.32], [AC_DEFINE([LI
PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0)
PKG_CHECK_MODULES(GNOMEDOCUTILS, gnome-doc-utils)
AC_SUBST(SFLGTK_CFLAGS)
AC_SUBST(SFLGLIB_CFLAGS)
AC_SUBST(WEBKIT_CFLAGS)
AC_SUBST(LIBEBOOK_CFLAGS)
AC_SUBST(LIBEDATASERVER_CFLAGS)
AC_SUBST(LIBEDATASERVERUI_CFLAGS)
AC_SUBST(LIBGNOMEUI_CFLAGS)
AC_SUBST(GNOMEDOCUTILS)
AC_SUBST(SFLGTK_LIBS)
AC_SUBST(SFLGLIB_LIBS)
AC_SUBST(WEBKIT_LIBS)
......
......@@ -317,11 +317,15 @@ void sflphone_fill_account_list (void)
gboolean sflphone_init (GError **error)
{
if (!dbus_connect (error))
if (!dbus_connect (error)) {
return FALSE;
}
if (!dbus_register (getpid (), "Gtk+ Client", error))
if (!dbus_register (getpid (), "Gtk+ Client", error)) {
return FALSE;
}
abookfactory_init_factory();
// Init icons factory
init_icon_factory ();
......
......@@ -15,17 +15,17 @@ libconfig_la_SOURCES = \
audioconf.c \
utils.c
libconfig_la_LDFLAGS = @DBUSGLIB_LDFLAGS@ @LIBNOTIFY_LDFLAGS@ \
@SFLGTK_LDFLAGS@ @SFLGLIB_LDFLAGS@ @WEBKIT_LDFLAGS@ @LIBEBOOK_LDFLAGS@ \
@LIBEDATASERVER_LDFLAGS@ @LIBEDATASERVERUI_LDFLAGS@ @LIBGNOMEUI_LDFLAGS@ \
@GNOMEDOCUTILS_LDFLAGS@
libconfig_la_LDFLAGS = $(DBUSGLIB_LDFLAGS) $(LIBNOTIFY_LDFLAGS) \
$(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBEBOOK_LDFLAGS) \
$(LIBEDATASERVER_LDFLAGS) $(LIBEDATASERVERUI_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \
$(GNOMEDOCUTILS_LDFLAGS)
libconfig_la_LIBADD = @DBUSGLIB_LIBS@ @LIBNOTIFY_LIBSI@ \
@SFLGTK_LIBS@ @SFLGLIB_LIBS@ @WEBKIT_LIBS@ @LIBEBOOK_LIBS@ \
@LIBEDATASERVER_LIBS@ @LIBEDATASERVERUI_LIBS@ @LIBGNOMEUI_LIBS@ \
@GNOMEDOCUTILS_LIBS@
libconfig_la_LIBADD = $(DBUSGLIB_LIBS) $(LIBNOTIFY_LIBSI) \
$(SFLGTK_LIBS) $(SFLGLIB_LIBS) $(WEBKIT_LIBS) $(LIBEBOOK_LIBS) \
$(LIBEDATASERVER_LIBS) $(LIBEDATASERVERUI_LIBS) $(LIBGNOMEUI_LIBS) \
$(GNOMEDOCUTILS_LIBS)
libconfig_la_CFLAGS = @DBUSGLIB_CFLAGS@ @LIBNOTIFY_CFLAGS@ \
@SFLGTK_CFLAGS@ @SFLGLIB_CFLAGS@ @WEBKIT_CFLAGS@ @LIBEBOOK_CFLAGS@ \
@LIBEDATASERVER_CFLAGS@ @LIBEDATASERVERUI_CFLAGS@ @LIBGNOMEUI_CFLAGS@ \
@GNOMEDOCUTILS_CFLAGS@
libconfig_la_CFLAGS = $(DBUSGLIB_CFLAGS) $(LIBNOTIFY_CFLAGS) \
$(SFLGTK_CFLAGS) $(SFLGLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBEBOOK_CFLAGS) \
$(LIBEDATASERVER_CFLAGS) $(LIBEDATASERVERUI_CFLAGS) $(LIBGNOMEUI_CFLAGS) \
$(GNOMEDOCUTILS_CFLAGS)
......@@ -30,7 +30,8 @@
#include "addressbook-config.h"
#include "searchbar.h"
#include <contacts/addressbook/eds.h>
#include "contacts/addrbookfactory.h"
#include "contacts/addressbook/eds.h"
#include <string.h>
#include <stdlib.h>
......@@ -209,6 +210,10 @@ addressbook_config_book_active_toggled (
gchar* name;
gchar* uid;
if(!abookfactory_is_addressbook_loaded()) {
return;
}
// Get path of clicked book active toggle box
treePath = gtk_tree_path_new_from_string (path);
......@@ -217,6 +222,8 @@ addressbook_config_book_active_toggled (
return;
}
AddrBookFactory *factory = abookfactory_get_factory();
gtk_tree_model_get_iter (model, &iter, treePath);
// Get active value at iteration
......@@ -232,7 +239,7 @@ addressbook_config_book_active_toggled (
gtk_tree_path_free (treePath);
// Update current memory stored books data
books_get_book_data_by_uid (uid)->active = active;
// factory->addrbook->get_book_data_by_uid (uid)->active = active;
// Save data
......@@ -279,7 +286,14 @@ addressbook_config_fill_book_list()
GSList *book_list_iterator;
GtkListStore *store;
book_data_t *book_data;
GSList *books_data = addressbook_get_books_data();
if(!abookfactory_is_addressbook_loaded()) {
return;
}
AddrBookFactory *factory = abookfactory_get_factory();
GSList *books_data = factory->addrbook->get_books_data();
if (!books_data) {
DEBUG ("Addressbook: No valid books data (%s:%d)", __FILE__, __LINE__);
......
......@@ -35,7 +35,7 @@
#include <glib/gtypes.h>
#include "actions.h"
#include <utils.h>
#include "utils.h"
G_BEGIN_DECLS
......
......@@ -37,6 +37,7 @@
#include <string.h>
#include "eel-gconf-extensions.h"
#include "addrbookfactory.h"
#include "accountconfigdialog.h"
#include "addressbook-config.h"
#include "shortcuts-config.h"
......@@ -282,9 +283,11 @@ create_general_settings ()
void
save_configuration_parameters (void)
{
if(abookfactory_is_addressbook_loaded()) {
// Address book config
addressbook_config_save_parameters ();
}
// Address book config
addressbook_config_save_parameters ();
hooks_save_parameters ();
// History config
......@@ -389,26 +392,17 @@ show_preferences_dialog ()
// General settings tab
tab = create_general_settings ();
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), tab, gtk_label_new (
_ ("General")));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), tab, gtk_label_new (_ ("General")));
gtk_notebook_page_num (GTK_NOTEBOOK (notebook), tab);
// Audio tab
tab = create_audio_configuration ();
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), tab, gtk_label_new (
_ ("Audio")));
gtk_notebook_page_num (GTK_NOTEBOOK (notebook), tab);
// Addressbook tab
tab = create_addressbook_settings ();
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), tab, gtk_label_new (
_ ("Address Book")));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), tab, gtk_label_new (_ ("Audio")));
gtk_notebook_page_num (GTK_NOTEBOOK (notebook), tab);
// Hooks tab
tab = create_hooks_settings ();
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), tab, gtk_label_new (
_ ("Hooks")));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), tab, gtk_label_new (_ ("Hooks")));
gtk_notebook_page_num (GTK_NOTEBOOK (notebook), tab);
// Shortcuts tab
......@@ -416,6 +410,13 @@ show_preferences_dialog ()
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), tab, gtk_label_new (_ ("Shortcuts")));
gtk_notebook_page_num (GTK_NOTEBOOK (notebook), tab);
if(abookfactory_is_addressbook_loaded()) {
// Addressbook tab
tab = create_addressbook_settings ();
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), tab, gtk_label_new (_ ("Address Book")));
gtk_notebook_page_num (GTK_NOTEBOOK (notebook), tab);
}
// By default, general settings
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 0);
// Highlight the corresponding icon
......@@ -432,37 +433,40 @@ show_preferences_dialog ()
return result;
}
#define NB_MAX_ENTRIES 5
GtkTreeModel* createModel()
{
browser_t browser_entries[5] = {
{
browser_t browser_entries_full[NB_MAX_ENTRIES] = {
{_ ("General"), "preferences-system", 0},
{_ ("Audio"), "multimedia-volume-control", 1},
{_ ("Address Book"), "address-book-new", 2},
{_ ("Hooks"), "gnome-globe", 3},
{_ ("Shortcuts"), "preferences-desktop-keyboard", 4}
{_ ("Hooks"), "gnome-globe", 2},
{_ ("Shortcuts"), "preferences-desktop-keyboard", 3},
{_ ("Address Book"), "address-book-new", 4},
};
GdkPixbuf *pixbuf;
GtkTreeIter iter;
GtkListStore *store;
GError *error = NULL;
gint i;
gint i, nb_entries;
nb_entries = abookfactory_is_addressbook_loaded() ? 5 : 4;
store = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT);
GtkIconTheme* theme = gtk_icon_theme_get_default();
for (i = 0; i < 5; i++) {
for (i = 0; i < nb_entries; i++) {
gtk_list_store_append (store, &iter);
pixbuf = gtk_icon_theme_load_icon (theme, browser_entries[i].icon_name, 48, 0, &error);
pixbuf = gtk_icon_theme_load_icon (theme, browser_entries_full[i].icon_name, 48, 0, &error);
gtk_list_store_set (store, &iter,
PIXBUF_COL, pixbuf,
TEXT_COL, browser_entries[i].icon_descr,
PAGE_NUMBER, browser_entries[i].page_number,
TEXT_COL, browser_entries_full[i].icon_descr,
PAGE_NUMBER, browser_entries_full[i].page_number,
-1);
if (pixbuf != NULL) {
......
......@@ -10,17 +10,17 @@ libcontacts_la_SOURCES = \
calltab.c \
calltree.c \
history.c \
addressbook.c \
addrbookfactory.c \
conferencelist.c
libcontacts_la_LDFLAGS = @DBUSGLIB_LDFLAGS@ @LIBNOTIFY_LDFLAGS@ \
@SFLGTK_LDFLAGS@ @SFLGLIB_LDFLAGS@ @WEBKIT_LDFLAGS@ @LIBEBOOK_LDFLAGS@ \
@LIBEDATASERVER_LDFLAGS@ @LIBEDATASERVERUI_LDFLAGS@ @LIBGNOMEUI_LDFLAGS@ \
@GNOMEDOCUTILS_LDFLAGS@
libcontacts_la_LDFLAGS = $(DBUSGLIB_LDFLAGS) $(LIBNOTIFY_LDFLAGS) \
$(SFLGTK_LDFLAGS) $(SFLGLIB_LDFLAGS) $(WEBKIT_LDFLAGS) $(LIBEBOOK_LDFLAGS) \
$(LIBEDATASERVER_LDFLAGS) $(LIBEDATASERVERUI_LDFLAGS) $(LIBGNOMEUI_LDFLAGS) \
$(GNOMEDOCUTILS_LDFLAGS)
libcontacts_la_CFLAGS = @DBUSGLIB_CFLAGS@ @LIBNOTIFY_CFLAGS@ \
@SFLGTK_CFLAGS@ @SFLGLIB_CFLAGS@ @WEBKIT_CFLAGS@ @LIBEBOOK_CFLAGS@ \
@LIBEDATASERVER_CFLAGS@ @LIBEDATASERVERUI_CFLAGS@ @LIBGNOMEUI_CFLAGS@ \
@GNOMEDOCUTILS_CFLAGS@
libcontacts_la_CFLAGS = $(DBUSGLIB_CFLAGS) $(LIBNOTIFY_CFLAGS) \
$(SFLGTK_CFLAGS) $(SFLGLIB_CFLAGS) $(WEBKIT_CFLAGS) $(LIBEBOOK_CFLAGS) \
$(LIBEDATASERVER_CFLAGS) $(LIBEDATASERVERUI_CFLAGS) $(LIBGNOMEUI_CFLAGS) \
$(GNOMEDOCUTILS_CFLAGS)
libcontacts_la_LIBADD = ./addressbook/libaddressbook.la
libcontacts_la_LIBADD = ./addressbook/libevladdrbook.so
/*
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include "addrbookfactory.h"
#include <glib.h>
#include <dlfcn.h>
AddrBookFactory addressbookFactory = {NULL};
AddrBookFactory *abookfactory_get_factory(void) {
return &addressbookFactory;
}
gboolean abookfactory_is_addressbook_loaded(void) {
return (addressbookFactory.addrbook != NULL) ? TRUE : FALSE;
}
void abookfactory_init_factory() {
abookfactory_load_module(&addressbookFactory);
}
void abookfactory_scan_directory(AddrBookFactory *factory) {
}
void abookfactory_load_module(AddrBookFactory *factory) {
AddrBookHandle *ab;
void *handle;
DEBUG("AddressbookFactory: Loading addressbook");
ab = g_malloc(sizeof(AddrBookHandle));
handle = dlopen("./src/contacts/addressbook/libevladdrbook.so", RTLD_LAZY);
if(handle == NULL) {
ERROR("AddressbookFactory: Error: Could not load addressbook");
return;
}
ab->init = dlsym(handle, "addressbook_init");
if(ab->init == NULL) {
ERROR("AddressbookFactory: Error: Could not load addressbook_init function");
}
ab->is_ready = dlsym(handle, "addressbook_is_ready");
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");
}
ab->search = dlsym(handle, "addressbook_search");
if(ab->search == NULL) {
ERROR("AddressbookFactory: Error: Could not load addressbook addressbook_search function");
}
ab->get_books_data = dlsym(handle, "addressbook_get_books_data");
if(ab->get_books_data == NULL) {
ERROR("AddressbookFactory: Error: Could not load addressbook addressbook_get_books_data function");
}
ab->get_book_data_by_uid = dlsym(handle, "addressbook_get_book_data_by_uid");
if(ab->get_book_data_by_uid == NULL) {
ERROR("AddressbookFactory: Error: Could not load addressbook addressbook_get_books_data_by_uid function");
}
ab->set_current_book = dlsym(handle, "addressbook_set_current_book");
if(ab->set_current_book == NULL) {
ERROR("AddressbookFactory: Error: Could not load addressbook addressbook_ser_current_book");
}
ab->set_search_type = dlsym(handle, "addressbook_set_search_type");
if(ab->set_search_type == NULL) {
ERROR("AddressbookFactory: Error: Could not load addressbook addressbook_set_search_type");
}
DEBUG("AddressbookFactory: Loading done");
factory->addrbook = ab;
}
/*
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef __ADDRBOOKFACTORY_H__
#define __ADDRBOOKFACTORY_H__
#include <dlfcn.h>
#include <gtk/gtk.h>
#include "addressbook.h"
typedef struct _addrbookfactory {
gboolean is_loaded;
AddrBookHandle *addrbook;
} AddrBookFactory;
void abookfactory_init_factory();
AddrBookFactory *abookfactory_get_factory(void);
gboolean abookfactory_is_addressbook_loaded(void);
void abookfactory_scan_directory(AddrBookFactory *);
void abookfactory_load_module(AddrBookFactory *);
#endif
/*
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -40,35 +41,55 @@
#include <gtk/gtk.h>
#include <addressbook/eds.h>
typedef enum {ABOOK_QUERY_IS, ABOOK_QUERY_BEGINS_WITH, ABOOK_QUERY_CONTAINS} AddrbookSearchType;
typedef struct _addrbookhandle {
void (*init) (void);
gboolean (*is_ready) (void);
gboolean (*is_enabled) (void);
gboolean (*is_active) (void);
void (*search) (GtkEntry*);
GSList *(*get_books_data)(void);
GSList *(*get_book_data_by_uid)(gchar *);
void (*set_current_book)(gchar *);
void (*set_search_type)(AddrbookSearchType);
} AddrBookHandle;
/**
* Initialize addressbook
*/
void addressbook_init();
/**
* Return addressbook state
*/
gboolean
addressbook_is_ready();
gboolean addressbook_is_ready();
/**
* Return addressbook state
*/
gboolean
addressbook_is_enabled();
gboolean addressbook_is_enabled();
/**
* Return if at least one addressbook is active
*/
gboolean
addressbook_is_active();
gboolean addressbook_is_active();
/**
* Perform a search in addressbook
*/
void
addressbook_search (GtkEntry*);
void addressbook_search (GtkEntry*);
/**
* Initialize addressbook
* Get a list of addressbook
*/
void
addressbook_init();
GSList *addressbook_get_books_data(void);
GSList *addressbook_get_book_data_by_uid(gchar *);
void addressbook_set_current_book(void);
void addressbook_set_search_type(AddrbookSearchType);
#endif
include ../../../globals.mak
noinst_LTLIBRARIES = libaddressbook.la
noinst_PROGRAMS = libevladdrbook.so
libaddressbook_la_SOURCES = eds.c
libevladdrbook_so_SOURCES = eds.c addressbook.c
libaddressbook_la_LDFLAGS = @DBUSGLIB_LDFLAGS@ @LIBNOTIFY_LDFLAGS@ \
@SFLGTK_LDFLAGS@ @SFLGLIB_LDFLAGS@ @WEBKIT_LDFLAGS@ @LIBEBOOK_LDFLAGS@ \
@LIBEDATASERVER_LDFLAGS@ @LIBEDATASERVERUI_LDFLAGS@ @LIBGNOMEUI_LDFLAGS@ \
@GNOMEDOCUTILS_LDFLAGS@
libevladdrbook_so_LDFLAGS = --shared $(SFLGLIB_LDFLAGS) $(SFLGTK_CFLAGS) $(LIBEDATASERVER_LDFLAGS) $(LIBEDATASERVERUI_LDFLAGS) $(DBUSGLIB_LDFLAGS)
# @DBUSGLIB_LDFLAGS@ @LIBNOTIFY_LDFLAGS@ \
# @SFLGTK_LDFLAGS@ @SFLGLIB_LDFLAGS@ @WEBKIT_LDFLAGS@ @LIBEBOOK_LDFLAGS@ \
# @LIBEDATASERVER_LDFLAGS@ @LIBEDATASERVERUI_LDFLAGS@ @LIBGNOMEUI_LDFLAGS@ \
# @GNOMEDOCUTILS_LDFLAGS@
libaddressbook_la_CFLAGS = @DBUSGLIB_CFLAGS@ @LIBNOTIFY_CFLAGS@ \
@SFLGTK_CFLAGS@ @SFLGLIB_CFLAGS@ @WEBKIT_CFLAGS@ @LIBEBOOK_CFLAGS@ \
@LIBEDATASERVER_CFLAGS@ @LIBEDATASERVERUI_CFLAGS@ @LIBGNOMEUI_CFLAGS@ \
@GNOMEDOCUTILS_CFLAGS@
libevladdrbook_so_CFLAGS = -fPIC -g -Wall $(SFLGLIB_CFLAGS) $(SFLGTK_CFLAGS) $(LIBEDATASERVER_CFLAGS) $(LIBEDATASERVERUI_CFLAGS) $(DBUSGLIB_CFLAGS)
# @DBUSGLIB_CFLAGS@ @LIBNOTIFY_CFLAGS@ \
# @SFLGTK_CFLAGS@ @SFLGLIB_CFLAGS@ @WEBKIT_CFLAGS@ @LIBEBOOK_CFLAGS@ \
# @LIBEDATASERVER_CFLAGS@ @LIBEDATASERVERUI_CFLAGS@ @LIBGNOMEUI_CFLAGS@ \
# @GNOMEDOCUTILS_CFLAGS@
......@@ -27,11 +27,12 @@
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include <addressbook.h>
#include <searchbar.h>
#include <string.h>
#include <addressbook-config.h>
#include <stdio.h>
#include "addressbook.h"
#include "searchbar.h"
#include "addressbook-config.h"
static void
handler_async_search (GList *, gpointer);
......@@ -44,15 +45,13 @@ addressbook_search (GtkEntry* entry)
{
const gchar* query = gtk_entry_get_text (GTK_ENTRY (entry));
DEBUG ("Addressbook: Search %s", query);
printf("Addressbook: Search %s\n", query);
AddressBook_Config *addressbook_config;
activateWaitingLayer();
addressbook_config_load_parameters (&addressbook_config);
// addressbook_config_load_parameters (&addressbook_config);
search_async_by_contacts (gtk_entry_get_text (GTK_ENTRY (entry)), addressbook_config->max_results, &handler_async_search, addressbook_config);
......@@ -66,8 +65,10 @@ addressbook_is_enabled()
{
AddressBook_Config *addressbook_config;
printf("Addresbook: is enabled\n");
// Load the address book parameters
addressbook_config_load_parameters (&addressbook_config);
// addressbook_config_load_parameters (&addressbook_config);
return (guint) addressbook_config->enable;
}
......@@ -78,6 +79,8 @@ addressbook_is_enabled()
gboolean
addressbook_is_ready()
{
printf("Addressbook: is ready\n");
return books_ready();
}
......@@ -87,6 +90,7 @@ addressbook_is_ready()
gboolean
addressbook_is_active()
{
printf("Addressbook: is active\n");
return books_active();
}
......@@ -100,8 +104,12 @@ addressbook_config_books()
book_data_t *book_data;
gchar **list;
// Retrieve list of books
list = (gchar **) dbus_get_addressbook_list();
// list = (gchar **) dbus_get_addressbook_list();
list = NULL;
if (list == NULL)
return;
......@@ -113,7 +121,7 @@ addressbook_config_books()
// If book_data exists
if (book_data == NULL) {
ERROR ("Addressbook: Error: Could not open book (%s:%d)", __FILE__, __LINE__);
printf("Addressbook: Error: Could not open book (%s:%d)\n", __FILE__, __LINE__);
} else {
book_data->active = TRUE;
}
......@@ -128,7 +136,7 @@ addressbook_config_books()
GSList *
addressbook_get_books_data()
{
DEBUG ("Addressboook: Get books data");
printf("Addressbook: Get books data\n");
fill_books_data();
addressbook_config_books();
......@@ -137,6 +145,11 @@ addressbook_get_books_data()
return get_books_data();
}
GSList *
addressbook_get_book_data_by_uid(gchar *uid)
{
}
/**
* Initialize books.
* Set active/inactive status depending on config.
......@@ -144,7 +157,7 @@ addressbook_get_books_data()
void
addressbook_init()
{
DEBUG ("Addressbook: Initialize addressbook");
printf("Addressbook: Initialize addressbook\n");
init_eds_mutex();
......@@ -168,7 +181,7 @@ handler_async_search (GList *hits, gpointer user_data)
AddressBook_Config *addressbook_config;
callable_obj_t *j;
DEBUG ("Addressbook: callback async search");
printf("Addressbook: callback async search\n");
// freeing calls
while ( (j = (callable_obj_t *) g_queue_pop_tail (contacts->callQueue)) != NULL) {
......@@ -205,7 +218,7 @@ handler_async_search (GList *hits, gpointer user_data)
calllist_add_contact (entry->name, entry->phone_home,
CONTACT_PHONE_HOME, photo);
// Create entry for mobile phone information
// Create entry for mobile phone iddnformation
if (addressbook_display (addressbook_config,
ADDRESSBOOK_DISPLAY_PHONE_MOBILE))
calllist_add_contact (entry->name, entry->phone_mobile,
......@@ -224,3 +237,6 @@ handler_async_search (GList *hits, gpointer user_data)
gtk_widget_grab_focus (GTK_WIDGET (contacts->view));
}
void addressbook_set_search_type(AddrbookSearchType searchType) {
}
......@@ -143,7 +143,7 @@ books_active()
g_mutex_lock(books_data_mutex);
if (books_data == NULL) {
DEBUG ("Addressbook: No books data (%s:%d)", __FILE__, __LINE__);
printf("Addressbook: No books data (%s:%d)\n", __FILE__, __LINE__);
g_mutex_unlock(books_data_mutex);
return FALSE;
}
......@@ -176,12 +176,12 @@ books_get_book_data_by_uid (gchar *uid)
g_mutex_lock(books_data_mutex);
if (books_data == NULL) {
DEBUG ("Addressbook: No books data (%s:%d)", __FILE__, __LINE__);
printf("Addressbook: No books data (%s:%d)\n", __FILE__, __LINE__);
g_mutex_unlock(books_data_mutex);
return NULL;
}
DEBUG ("Addressbook: Get book data by uid: %s", uid);
printf("Addressbook: Get book data by uid: %s\n", uid);
// Iterate throw the list
for (book_list_iterator = books_data; book_list_iterator != NULL; book_list_iterator
......@@ -189,7 +189,7 @@ books_get_book_data_by_uid (gchar *uid)
book_data = (book_data_t *) book_list_iterator->data;
if (strcmp (book_data->uid, uid) == 0) {
DEBUG ("Addressbook: Book %s found", uid);
printf("Addressbook: Book %s found\n", uid);
g_mutex_unlock(books_data_mutex);
return book_data;