Commit 52d9c302 authored by Emmanuel Milou's avatar Emmanuel Milou

Add search fields in configuration

does not work yet
parent f344b6cd
......@@ -33,10 +33,16 @@ void addressbook_load_parameters (AddressBook_Config **settings) {
if (_params == NULL) {
_settings->max_results = 30;
_settings->display_contact_photo = 0;
_settings->search_phone_business = 1;
_settings->search_phone_home = 1;
_settings->search_phone_mobile = 1;
}
else {
_settings->max_results = (guint)(g_hash_table_lookup (_params, "ADDRESSBOOK_MAX_RESULTS"));
_settings->display_contact_photo = (guint) (g_hash_table_lookup (_params, "ADDRESSBOOK_DISPLAY_CONTACT_PHOTO"));
_settings->search_phone_business = (guint) (g_hash_table_lookup (_params, "ADDRESSBOOK_SEARCH_PHONE_BUSINESS"));
_settings->search_phone_home = (guint) (g_hash_table_lookup (_params, "ADDRESSBOOK_SEARCH_PHONE_HOME"));
_settings->search_phone_mobile = (guint) (g_hash_table_lookup (_params, "ADDRESSBOOK_SEARCH_PHONE_MOBILE"));
}
*settings = _settings;
......@@ -54,10 +60,27 @@ static void display_contact_photo_cb (GtkWidget *widget, gpointer user_data) {
settings->display_contact_photo = (guint) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget));
}
static void search_phone_business_cb (GtkWidget *widget, gpointer user_data) {
AddressBook_Config *settings = (AddressBook_Config*)user_data;
settings->search_phone_business = (guint) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget));
}
static void search_phone_home_cb (GtkWidget *widget, gpointer user_data) {
AddressBook_Config *settings = (AddressBook_Config*)user_data;
settings->search_phone_home = (guint) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget));
}
static void search_phone_mobile_cb (GtkWidget *widget, gpointer user_data) {
AddressBook_Config *settings = (AddressBook_Config*)user_data;
settings->search_phone_mobile = (guint) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget));
}
GtkWidget* create_addressbook_settings () {
GtkWidget *ret, *result_frame, *box, *value, *label, *photo;
GtkWidget *ret, *result_frame, *box, *value, *label, *photo, *item;
AddressBook_Config *settings;
// Load the user value
......@@ -91,6 +114,24 @@ GtkWidget* create_addressbook_settings () {
g_signal_connect (G_OBJECT(photo) , "clicked" , G_CALLBACK (display_contact_photo_cb) , settings);
gtk_box_pack_start (GTK_BOX(box) , photo , TRUE , TRUE , 1);
label = gtk_label_new (_("Search for and display: "));
gtk_box_pack_start (GTK_BOX(box) , label , FALSE , FALSE , 1);
item = gtk_check_button_new_with_mnemonic( _("_Business phone"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(item), settings->search_phone_business);
g_signal_connect (G_OBJECT(item) , "clicked" , G_CALLBACK (search_phone_business_cb) , settings);
gtk_box_pack_start (GTK_BOX(box) , item , TRUE , TRUE , 1);
item = gtk_check_button_new_with_mnemonic( _("_Home phone"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(item), settings->search_phone_home);
g_signal_connect (G_OBJECT(item) , "clicked" , G_CALLBACK (search_phone_home_cb) , settings);
gtk_box_pack_start (GTK_BOX(box) , item , TRUE , TRUE , 1);
item = gtk_check_button_new_with_mnemonic( _("_Mobile phone"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(item), settings->search_phone_mobile);
g_signal_connect (G_OBJECT(item) , "clicked" , G_CALLBACK (search_phone_mobile_cb) , settings);
gtk_box_pack_start (GTK_BOX(box) , item , TRUE , TRUE , 1);
gtk_widget_show_all(ret);
return ret;
......
......@@ -30,6 +30,9 @@ G_BEGIN_DECLS
typedef struct _AddressBook_Config {
guint max_results;
guint display_contact_photo;
guint search_phone_home;
guint search_phone_business;
guint search_phone_mobile;
} AddressBook_Config;
void set_addressbook_config (AddressBook_Config);
......
......@@ -1069,6 +1069,9 @@ ManagerImpl::initConfigFile ( bool load_user_value )
section = ADDRESSBOOK;
fill_config_int (ADDRESSBOOK_MAX_RESULTS, "25");
fill_config_int (ADDRESSBOOK_DISPLAY_CONTACT_PHOTO, YES_STR);
fill_config_int (ADDRESSBOOK_DISPLAY_PHONE_BUSINESS, YES_STR);
fill_config_int (ADDRESSBOOK_DISPLAY_PHONE_HOME, YES_STR);
fill_config_int (ADDRESSBOOK_DISPLAY_PHONE_MOBILE, YES_STR);
// Loads config from ~/.sflphone/sflphonedrc or so..
if (createSettingsPath() == 1 && load_user_value) {
......@@ -2388,6 +2391,9 @@ std::map<std::string, int32_t> ManagerImpl::getAddressbookSettings () {
settings.insert (std::pair<std::string, int32_t> ("ADDRESSBOOK_MAX_RESULTS", getConfigInt (ADDRESSBOOK, ADDRESSBOOK_MAX_RESULTS)) );
settings.insert (std::pair<std::string, int32_t> ("ADDRESSBOOK_DISPLAY_CONTACT_PHOTO", getConfigInt (ADDRESSBOOK, ADDRESSBOOK_DISPLAY_CONTACT_PHOTO)));
settings.insert (std::pair<std::string, int32_t> ("ADDRESSBOOK_DISPLAY_PHONE_BUSINESS", getConfigInt (ADDRESSBOOK, ADDRESSBOOK_DISPLAY_PHONE_BUSINESS)));
settings.insert (std::pair<std::string, int32_t> ("ADDRESSBOOK_DISPLAY_PHONE_HOME", getConfigInt (ADDRESSBOOK, ADDRESSBOOK_DISPLAY_PHONE_HOME)));
settings.insert (std::pair<std::string, int32_t> ("ADDRESSBOOK_DISPLAY_PHONE_MOBILE", getConfigInt (ADDRESSBOOK, ADDRESSBOOK_DISPLAY_PHONE_MOBILE)));
return settings;
}
......
......@@ -76,6 +76,9 @@
#define ADDRESSBOOK "Addressbook" /** Address book section */
#define ADDRESSBOOK_MAX_RESULTS "Addressbook.max_results"
#define ADDRESSBOOK_DISPLAY_CONTACT_PHOTO "Addressbook.contact_photo"
#define ADDRESSBOOK_DISPLAY_PHONE_BUSINESS "Addressbook.phone_business"
#define ADDRESSBOOK_DISPLAY_PHONE_HOME "Addressbook.phone_home"
#define ADDRESSBOOK_DISPLAY_PHONE_MOBILE "Addressbook.phone_mobile"
#define EMPTY_FIELD "" /** Default value for empty field */
#define DFT_STUN_SERVER "stun.fwdnet.net:3478" /** Default STUN server address */
......
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