34
34
#include <addressbook-config.h>
37
handler_async_search(GList *, gpointer);
37
handler_async_search (GList *, gpointer);
40
40
* Perform a search on address book
43
addressbook_search(GtkEntry* entry)
43
addressbook_search (GtkEntry* entry)
46
const gchar* query = gtk_entry_get_text(GTK_ENTRY (entry));
47
if (strlen(query) >= 3) {
49
AddressBook_Config *addressbook_config;
51
// Activate waiting layer
52
activateWaitingLayer();
54
// Load the address book parameters
55
addressbook_config_load_parameters(&addressbook_config);
57
// Start the asynchronous search as soon as we have an entry */
58
search_async(gtk_entry_get_text(GTK_ENTRY (entry)), addressbook_config->max_results, &handler_async_search, addressbook_config);
46
const gchar* query = gtk_entry_get_text (GTK_ENTRY (entry));
47
DEBUG ("Addressbook: Search %s", query);
50
AddressBook_Config *addressbook_config;
52
activateWaitingLayer();
54
addressbook_config_load_parameters (&addressbook_config);
57
search_async_by_contacts (gtk_entry_get_text (GTK_ENTRY (entry)), addressbook_config->max_results, &handler_async_search, addressbook_config);
90
88
addressbook_is_active()
92
return books_active();
90
return books_active();
96
* Asynchronous open callback.
97
* Used to handle activation of books.
94
* Get active addressbook from config.
100
97
addressbook_config_books()
103
gchar **config_book_uid;
104
book_data_t *book_data;
107
// Retrieve list of books
108
list = (gchar **) dbus_get_addressbook_list();
112
for (config_book_uid = list; *config_book_uid; config_book_uid++) {
114
// Get corresponding book data
115
book_data = books_get_book_data_by_uid(*config_book_uid);
117
// If book_data exists
118
if (book_data != NULL) {
120
book_data->active = TRUE;
100
gchar **config_book_uid;
101
book_data_t *book_data;
104
// Retrieve list of books
105
list = (gchar **) dbus_get_addressbook_list();
109
for (config_book_uid = list; *config_book_uid; config_book_uid++) {
111
// Get corresponding book data
112
book_data = books_get_book_data_by_uid (*config_book_uid);
114
// If book_data exists
116
ERROR ("Addressbook: Error: Could not open book (%s:%d)", __FILE__, __LINE__);
120
book_data->active = TRUE;
127
// update_actions ();
145
149
addressbook_init()
147
// Call books initialization
148
init(&addressbook_config_books);
151
DEBUG ("Addressbook: Initialize addressbook");
154
addressbook_config_books();
156
// Call books initialization
152
161
* Callback called after all book have been processed
155
handler_async_search(GList *hits, gpointer user_data)
164
handler_async_search (GList *hits, gpointer user_data)
159
GdkPixbuf *photo = NULL;
160
AddressBook_Config *addressbook_config;
164
while ((j = (callable_obj_t *) g_queue_pop_tail(contacts->callQueue)) != NULL)
166
free_callable_obj_t(j);
168
GdkPixbuf *photo = NULL;
169
AddressBook_Config *addressbook_config;
172
DEBUG ("Addressbook: callback async search");
175
while ( (j = (callable_obj_t *) g_queue_pop_tail (contacts->callQueue)) != NULL) {
176
free_callable_obj_t (j);
169
// Retrieve the address book parameters
170
addressbook_config = (AddressBook_Config*) user_data;
172
// reset previous results
173
calltree_reset(contacts);
174
calllist_reset(contacts);
176
for (i = hits; i != NULL; i = i->next)
183
if (addressbook_display(addressbook_config,
184
ADDRESSBOOK_DISPLAY_CONTACT_PHOTO))
185
photo = entry->photo;
186
// Create entry for business phone information
187
if (addressbook_display(addressbook_config,
188
ADDRESSBOOK_DISPLAY_PHONE_BUSINESS))
189
calllist_add_contact(entry->name, entry->phone_business,
190
CONTACT_PHONE_BUSINESS, photo);
191
// Create entry for home phone information
192
if (addressbook_display(addressbook_config,
193
ADDRESSBOOK_DISPLAY_PHONE_HOME))
194
calllist_add_contact(entry->name, entry->phone_home,
195
CONTACT_PHONE_HOME, photo);
196
// Create entry for mobile phone information
197
if (addressbook_display(addressbook_config,
198
ADDRESSBOOK_DISPLAY_PHONE_MOBILE))
199
calllist_add_contact(entry->name, entry->phone_mobile,
200
CONTACT_PHONE_MOBILE, photo);
179
// Retrieve the address book parameters
180
addressbook_config = (AddressBook_Config*) user_data;
182
// reset previous results
183
calltree_reset (contacts);
184
calllist_reset (contacts);
186
for (i = hits; i != NULL; i = i->next) {
193
if (addressbook_display (addressbook_config,
194
ADDRESSBOOK_DISPLAY_CONTACT_PHOTO))
195
photo = entry->photo;
197
// Create entry for business phone information
198
if (addressbook_display (addressbook_config,
199
ADDRESSBOOK_DISPLAY_PHONE_BUSINESS))
200
calllist_add_contact (entry->name, entry->phone_business,
201
CONTACT_PHONE_BUSINESS, photo);
203
// Create entry for home phone information
204
if (addressbook_display (addressbook_config,
205
ADDRESSBOOK_DISPLAY_PHONE_HOME))
206
calllist_add_contact (entry->name, entry->phone_home,
207
CONTACT_PHONE_HOME, photo);
209
// Create entry for mobile phone information
210
if (addressbook_display (addressbook_config,
211
ADDRESSBOOK_DISPLAY_PHONE_MOBILE))
212
calllist_add_contact (entry->name, entry->phone_mobile,
213
CONTACT_PHONE_MOBILE, photo);
206
// Deactivate waiting image
207
deactivateWaitingLayer();
221
// Deactivate waiting image
222
deactivateWaitingLayer();
225
gtk_widget_grab_focus (GTK_WIDGET (contacts->view));