diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index b1cb7caaf7e7f996c13e849dbe3a5c68092e791a..05a4032c96045f5b283e8ff6d5eec6815776951c 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -222,17 +222,11 @@ void sflphone_fill_account_list (void) array = (gchar **) dbus_account_list(); if (array) { - /* - if(!(*accountID)) - DEBUG("hhhhhhhhhmmmmmmmmmmmm"); - */ for (accountID = array; *accountID; accountID++) { account_t * a = g_new0 (account_t,1); a->accountID = g_strdup (*accountID); - DEBUG ("------------------- Account ID %s", a->accountID); a->credential_information = NULL; - // TODO Clean codec list QUEUE account_list_add (a); } diff --git a/sflphone-client-gnome/src/config/addressbook-config.c b/sflphone-client-gnome/src/config/addressbook-config.c index fd6b13d257cbc68e095d46b3fb4488eebd8d286a..7f0d2256b181db7e19a7e7dfd3cc9508078de522 100644 --- a/sflphone-client-gnome/src/config/addressbook-config.c +++ b/sflphone-client-gnome/src/config/addressbook-config.c @@ -29,6 +29,7 @@ */ #include "addressbook-config.h" +#include "searchbar.h" #include <contacts/addressbook/eds.h> #include <string.h> #include <stdlib.h> @@ -104,6 +105,8 @@ addressbook_config_save_parameters (void) dbus_set_addressbook_settings (params); + update_searchbar_addressbook_list(); + // Decrement the reference count g_hash_table_unref (params); } diff --git a/sflphone-client-gnome/src/config/audioconf.c b/sflphone-client-gnome/src/config/audioconf.c index 95916f25395b301eab08b9aeb04e5d91abb07635..48114e1f1ab4ff891bd52932ae47c537f6e9336a 100644 --- a/sflphone-client-gnome/src/config/audioconf.c +++ b/sflphone-client-gnome/src/config/audioconf.c @@ -910,7 +910,6 @@ GtkWidget* create_audio_configuration() if (SHOW_ALSA_CONF) { // Box for the ALSA configuration - printf ("ALSA Created \n"); alsabox = alsa_box(); gtk_container_add (GTK_CONTAINER (alsa_conf) , alsabox); gtk_widget_hide (alsa_conf); diff --git a/sflphone-client-gnome/src/contacts/addressbook.c b/sflphone-client-gnome/src/contacts/addressbook.c index 9e566daba13113f4f0b133d042f21a597c594682..a6d6a1fe8b4f42e82783e400b425d76cb3361b68 100644 --- a/sflphone-client-gnome/src/contacts/addressbook.c +++ b/sflphone-client-gnome/src/contacts/addressbook.c @@ -218,5 +218,8 @@ handler_async_search (GList *hits, gpointer user_data) // Deactivate waiting image deactivateWaitingLayer(); + + + gtk_widget_grab_focus (GTK_WIDGET (contacts->view)); } diff --git a/sflphone-client-gnome/src/contacts/searchbar.c b/sflphone-client-gnome/src/contacts/searchbar.c index dcc3068b849b4577c94189b8a4781f89795406b7..db416d659c1ebec6a4e7f09033ec88c660cf9397 100644 --- a/sflphone-client-gnome/src/contacts/searchbar.c +++ b/sflphone-client-gnome/src/contacts/searchbar.c @@ -38,6 +38,11 @@ GtkWidget * searchbox; GtkWidget * addressbookentry; +GtkWidget * cbox; +GtkListStore * liststore; + +gint cboxSignalId; + static GtkWidget *menu = NULL; /** @@ -48,6 +53,7 @@ GdkPixbuf *outgoing_pixbuf = NULL; GdkPixbuf *missed_pixbuf = NULL; + void searchbar_addressbook_activated (GtkEntry *entry, gchar *arg1 UNUSED, gpointer data UNUSED) { DEBUG ("Searchbar: Entry activated"); @@ -67,8 +73,6 @@ void searchbar_entry_changed (GtkEntry* entry UNUSED, gchar* arg1 UNUSED, gpoint } } -#if GTK_CHECK_VERSION(2,16,0) - static void cbox_changed_cb (GtkWidget *widget, gpointer user_data UNUSED) { gchar *name; @@ -80,7 +84,56 @@ static void cbox_changed_cb (GtkWidget *widget, gpointer user_data UNUSED) addressbook_search (GTK_ENTRY (addressbookentry)); } -static void select_search_type (GtkWidget *item, GtkEntry *entry) +void update_searchbar_addressbook_list() +{ + gint count; + GtkTreeIter iter, activeIter; + gchar *activeText; + GSList *book_list_iterator; + book_data_t *book_data; + GSList *books_data = addressbook_get_books_data(); + + // we must disconnect signal from teh cbox while updating its content + gtk_signal_disconnect (cbox, cboxSignalId); + + // store the current active text + activeText = g_strdup (gtk_combo_box_get_active_text (GTK_COMBO_BOX (cbox))); + + gtk_list_store_clear (liststore); + + // 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_list_store_append (liststore, &iter); + gtk_list_store_set (liststore, &iter, 0, book_data->name, -1); + + if (strcmp (book_data->name, activeText) == 0) { + activeIter = iter; + activeIsSet = TRUE; + } + + count++; + } + } + + if (activeIsSet) + gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cbox), &activeIter); + else + gtk_combo_box_set_active (GTK_COMBO_BOX (cbox), 0); + + g_free (activeText); + cboxSignalId = gtk_signal_connect (GTK_OBJECT (cbox), "changed", G_CALLBACK (cbox_changed_cb), NULL); +} + + +static void select_search_type (GtkWidget *item, GtkEntry *entry UNUSED) { DEBUG ("Searchbar: %s", gtk_menu_item_get_label (GTK_MENU_ITEM (item))); @@ -174,7 +227,7 @@ static void text_changed_cb (GtkEntry *entry, GParamSpec *pspec UNUSED) gtk_entry_set_icon_sensitive (entry, GTK_ENTRY_ICON_SECONDARY, has_text); } -#endif + GtkWidget *addressbook_menu_new (void) { @@ -308,21 +361,16 @@ GtkWidget* contacts_searchbar_new () { GtkWidget *ret; - GtkWidget *cbox; GtkWidget *align; int count, cbox_height, cbox_width; + GtkTreeIter iter, activeIter; + GtkCellRenderer *cell; ret = gtk_hbox_new (FALSE, 0); - // Create combo box to select current addressbook - cbox = gtk_combo_box_new_text(); - - align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); - gtk_alignment_set_padding (align, 0, 2, 6, 6); - gtk_container_add (GTK_CONTAINER (align), cbox); + liststore = gtk_list_store_new (1,G_TYPE_STRING); - gtk_widget_get_size_request (GTK_WIDGET (cbox), &cbox_width, &cbox_height); - gtk_widget_set_size_request (GTK_WIDGET (cbox), cbox_width, 26); + // Create combo box to select current addressbook GSList *book_list_iterator; book_data_t *book_data; @@ -337,10 +385,12 @@ GtkWidget* contacts_searchbar_new () 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); + + gtk_list_store_append (liststore, &iter); + gtk_list_store_set (liststore, &iter, 0, book_data->name, -1); if (book_data->isdefault) { - gtk_combo_box_set_active (GTK_COMBO_BOX (cbox), count); + activeIter = iter; activeIsSet = TRUE; } @@ -348,10 +398,25 @@ GtkWidget* contacts_searchbar_new () } } - if (!activeIsSet) + cbox = gtk_combo_box_new_with_model ( (GtkTreeModel *) liststore); + + if (activeIsSet) + gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cbox), &activeIter); + else gtk_combo_box_set_active (GTK_COMBO_BOX (cbox), 0); - g_signal_connect (cbox, "changed", G_CALLBACK (cbox_changed_cb), NULL); + align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); + gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 2, 6, 6); + gtk_container_add (GTK_CONTAINER (align), cbox); + + gtk_widget_get_size_request (GTK_WIDGET (cbox), &cbox_width, &cbox_height); + gtk_widget_set_size_request (GTK_WIDGET (cbox), cbox_width, 26); + + cboxSignalId = gtk_signal_connect (GTK_OBJECT (cbox), "changed", G_CALLBACK (cbox_changed_cb), NULL); + + cell = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cbox), cell, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cbox), cell, "text", 0, NULL); #if GTK_CHECK_VERSION(2,16,0) @@ -416,3 +481,4 @@ SearchType get_current_history_search_type (void) { return HistorySearchType; } + diff --git a/sflphone-client-gnome/src/contacts/searchbar.h b/sflphone-client-gnome/src/contacts/searchbar.h index 7a8cad07f0b698ef9ff5247a852f608ea9da2a00..91f32d0f78df364481d5292a96c24af347cf1d48 100644 --- a/sflphone-client-gnome/src/contacts/searchbar.h +++ b/sflphone-client-gnome/src/contacts/searchbar.h @@ -81,6 +81,11 @@ void activateWaitingLayer(); */ void deactivateWaitingLayer(); +/** + * Reload combo box to update list of active addressbook + */ +void update_searchbar_addressbook_list (void); + GtkWidget *addressbook_menu_new (void); #endif diff --git a/sflphone-client-gnome/src/mainwindow.c b/sflphone-client-gnome/src/mainwindow.c index 5dc20a999347bb7e9f04b3299216757a20541a42..812d1e89a59bd0b4030d72bb5d4dea587af78bbd 100644 --- a/sflphone-client-gnome/src/mainwindow.c +++ b/sflphone-client-gnome/src/mainwindow.c @@ -141,7 +141,9 @@ on_key_released (GtkWidget *widget, GdkEventKey *event, gpointer user_data UNUSE event->keyval == 34 || // " event->keyval == 65289 || // tab event->keyval == 65361 || // left arrow + event->keyval == 65362 || // up arrow event->keyval == 65363 || // right arrow + event->keyval == 65364 || // down arrow event->keyval >= 65470 || // F-keys event->keyval == 32 // space ) diff --git a/sflphone-common/src/config/config.cpp b/sflphone-common/src/config/config.cpp index 2c4c68dc45d1f158b4b9e6b5551caa0bd7662c09..f48d396d00481a9fa872f5e292b440d849cd9384 100644 --- a/sflphone-common/src/config/config.cpp +++ b/sflphone-common/src/config/config.cpp @@ -382,7 +382,6 @@ ConfigTree::populateFromFile (const std::string& fileName) val = line.substr (pos + 1, line.length() - pos); if (key.length() > 0 && val.length() > 0) { - _debug ("setconfigtreeitem %s, %s", section.c_str(), val.c_str()); setConfigTreeItem (section, key, val); }