Skip to content
Snippets Groups Projects
Commit 5536345c authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3854] Use SFLphone's addressbook preferences

parent 61c63727
No related branches found
No related tags found
No related merge requests found
......@@ -91,8 +91,7 @@ addressbook_is_active()
}
/**
* Asynchronous open callback.
* Used to handle activation of books.
* Get active addressbook from config.
*/
static void
addressbook_config_books()
......@@ -115,13 +114,15 @@ addressbook_config_books()
// If book_data exists
if (!book_data)
ERROR ("Addressbook: Error: Could not open book");
book_data->active = TRUE;
}
g_strfreev (list);
}
// Update buttons
update_actions ();
// update_actions ();
}
/**
......@@ -132,8 +133,9 @@ addressbook_get_books_data()
{
DEBUG ("Addressboook: Get books data");
// addressbook_config_books();
fill_books_data();
addressbook_config_books();
return books_data;
}
......@@ -147,9 +149,10 @@ addressbook_init()
DEBUG ("Addressbook: Initialize addressbook");
fill_books_data();
addressbook_config_books();
// Call books initialization
init (&addressbook_config_books);
init ();
}
/**
......
......@@ -41,7 +41,7 @@
#include <string.h>
#include <pango/pango.h>
#include "eds.h"
#include <addressbook-config.h>
/**
* Structure used to store search callback and data
......@@ -149,7 +149,7 @@ books_get_book_data_by_uid (gchar *uid)
* nick name.
*/
static EBookQuery*
create_query (const char* s, EBookQueryTest test)
create_query (const char* s, EBookQueryTest test, AddressBook_Config *conf)
{
EBookQuery *equery;
......@@ -160,8 +160,14 @@ create_query (const char* s, EBookQueryTest test)
// We could also use E_BOOK_QUERY_IS or E_BOOK_QUERY_BEGINS_WITH instead of E_BOOK_QUERY_CONTAINS
queries[cpt++] = e_book_query_field_test (E_CONTACT_FULL_NAME, test, s);
if (conf->search_phone_home)
queries[cpt++] = e_book_query_field_test (E_CONTACT_PHONE_HOME, test, s);
if (conf->search_phone_business)
queries[cpt++] = e_book_query_field_test (E_CONTACT_PHONE_BUSINESS, test, s);
if (conf->search_phone_mobile)
queries[cpt++] = e_book_query_field_test (E_CONTACT_PHONE_MOBILE, test, s);
equery = e_book_query_or (cpt, queries, TRUE);
......@@ -433,7 +439,7 @@ eds_async_open_callback (EBook *book, EBookStatus status, gpointer closure)
* Initialize address book
*/
void
init (OpenAsyncHandler callback UNUSED)
init ()
{
GError *err = NULL;
gchar *absuri, *reluri;
......@@ -538,7 +544,7 @@ fill_books_data ()
ESource *source = m->data;
book_data_t *book_data = g_new (book_data_t, 1);
book_data->active = TRUE;
book_data->active = FALSE;
book_data->name = g_strdup (e_source_peek_name (source));
book_data->uid = g_strdup (e_source_peek_uid (source));
......@@ -588,7 +594,7 @@ 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->equery = create_query (query, current_test);
had->equery = create_query (query, current_test, (AddressBook_Config *) (user_data));
if (!current_uri)
ERROR ("Addressbook: Error: Current addressbook uri not specified uri");
......
......@@ -101,7 +101,7 @@ typedef void
* Connection to evolution data server
*/
void
init (OpenAsyncHandler);
init ();
/**
* Fill list of addressbooks
......
......@@ -330,17 +330,26 @@ GtkWidget* contacts_searchbar_new ()
// Populate menu
count = 0;
gboolean activeIsSet = FALSE;
for (book_list_iterator = books_data; book_list_iterator != NULL; book_list_iterator
= book_list_iterator->next) {
book_data = (book_data_t *) book_list_iterator->data;
if (book_data->active) {
gtk_combo_box_append_text (GTK_COMBO_BOX (cbox), book_data->name);
if (book_data->isdefault)
if (book_data->isdefault) {
gtk_combo_box_set_active (GTK_COMBO_BOX (cbox), count);
activeIsSet = TRUE;
}
count++;
}
}
if (!activeIsSet)
gtk_combo_box_set_active (GTK_COMBO_BOX (cbox), 0);
g_signal_connect (cbox, "changed", G_CALLBACK (cbox_changed_cb), NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment