diff --git a/sflphone-client-gnome/src/accountlist.h b/sflphone-client-gnome/src/accountlist.h index bb96970cb827052979a15ea8b732ca27700635c3..51f3c878e71c8fcb9d829d4f2f30fdff693b2143 100644 --- a/sflphone-client-gnome/src/accountlist.h +++ b/sflphone-client-gnome/src/accountlist.h @@ -65,9 +65,10 @@ typedef enum typedef struct { gchar * accountID; - account_state_t state; + account_state_t state; + gchar * protocol_state_description; + guint * protocol_state_code; GHashTable * properties; - GHashTable * tlsSettings; GPtrArray * credential_information; } account_t; diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 35aeb1a761328b7252ee78effcd6a98d808c73c9..25bb9b11a4b6a547adff7fb59d35a4e5cf793e41 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -186,11 +186,7 @@ sflphone_fill_account_list(gboolean toolbarInitialized) if( details == NULL ) break; a->properties = details; - - GHashTable * tlsSettings = NULL; - tlsSettings = dbus_get_tls_settings(a->accountID); - a->tlsSettings = tlsSettings; - + /* As this function might be called numberous time, we should free the * previously allocated space to avoid memory leaks. */ @@ -210,7 +206,7 @@ sflphone_fill_account_list(gboolean toolbarInitialized) g_ptr_array_add(a->credential_information, credential_information); } - gchar * status = g_hash_table_lookup(details, "Status"); + gchar * status = g_hash_table_lookup(details, REGISTRATION_STATUS); if(strcmp(status, "REGISTERED") == 0) { a->state = ACCOUNT_STATE_REGISTERED; @@ -252,6 +248,13 @@ sflphone_fill_account_list(gboolean toolbarInitialized) a->state = ACCOUNT_STATE_INVALID; } + gchar * code = NULL; + code = g_hash_table_lookup(details, REGISTRATION_STATE_CODE); + if (code != NULL) { + a->protocol_state_code = atoi(code); + } + g_free(a->protocol_state_description); + a->protocol_state_description = g_hash_table_lookup(details, REGISTRATION_STATE_DESCRIPTION); } // Prevent update being called when toolbar is not yet initialized diff --git a/sflphone-client-gnome/src/config/Makefile.am b/sflphone-client-gnome/src/config/Makefile.am index e910f9400733260e61fad5baad35640ce553cc6b..2c7f3e7b613c99e0470382f03e1ee45ffd6b51be 100644 --- a/sflphone-client-gnome/src/config/Makefile.am +++ b/sflphone-client-gnome/src/config/Makefile.am @@ -4,10 +4,10 @@ noinst_LTLIBRARIES = libconfig.la libconfig_la_SOURCES = \ addressbook-config.c \ - configwindow.c \ + preferencesdialog.c \ + accountlistconfigdialog.c \ zrtpadvanceddialog.c \ tlsadvanceddialog.c \ - ip2ipdialog.c \ accountwindow.c \ hooks-config.c \ audioconf.c \ diff --git a/sflphone-client-gnome/src/config/accountwindow.c b/sflphone-client-gnome/src/config/accountwindow.c index 1c4df513f227bddc948161c24198913307f77ae4..e54593ce4b1ea7653d383adc65fe4154007be83d 100644 --- a/sflphone-client-gnome/src/config/accountwindow.c +++ b/sflphone-client-gnome/src/config/accountwindow.c @@ -287,7 +287,6 @@ static void fill_treeview_with_credential(GtkListStore * credentialStore, accoun } if((authentication_name == NULL) || (g_strcmp0(authentication_name, "") == 0)) { - DEBUG("DEFAULT"); gtk_list_store_set(credentialStore, &iter, COLUMN_CREDENTIAL_REALM, realm, COLUMN_CREDENTIAL_USERNAME, gtk_entry_get_text(GTK_ENTRY(entryUsername)), @@ -453,8 +452,6 @@ GtkWidget * create_security_tab(account_t **a) GtkCellRenderer * renderer; GtkTreeViewColumn * treeViewColumn; GtkTreeSelection * treeSelection; - GtkRequisition requisitionTable; - GtkRequisition requisitionTreeView; ret = gtk_vbox_new(FALSE, 10); gtk_container_set_border_width(GTK_CONTAINER(ret), 10); @@ -481,7 +478,9 @@ GtkWidget * create_security_tab(account_t **a) curTLSEnabled = g_hash_table_lookup(currentAccount->properties, TLS_ENABLE); if (curTLSEnabled == NULL) { curTLSEnabled = "false"; - } + } + + DEBUG("TLS is enabled to %s", curTLSEnabled); } /* Credentials tree view */ @@ -540,11 +539,7 @@ GtkWidget * create_security_tab(account_t **a) gtk_container_add(GTK_CONTAINER(scrolledWindowCredential), treeViewCredential); fill_treeview_with_credential(credentialStore, *a); - - /* Dynamically resize the window to fit the scrolled window */ - gtk_widget_size_request(GTK_WIDGET(treeViewCredential), &requisitionTreeView); - gtk_widget_set_size_request(GTK_WIDGET(scrolledWindowCredential), requisitionTreeView.width, requisitionTreeView.height + 20); - + /* Credential Buttons */ hbox = gtk_hbox_new(FALSE, 10); gtk_table_attach_defaults(GTK_TABLE(table), hbox, 0, 2, 1, 2); @@ -572,7 +567,7 @@ GtkWidget * create_security_tab(account_t **a) useSipTlsCheckBox = gtk_check_button_new_with_mnemonic(_("Use TLS transport (sips)")); g_signal_connect (useSipTlsCheckBox, "toggled", G_CALLBACK(use_sip_tls_cb), sipTlsAdvancedButton); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(useSipTlsCheckBox), (g_strcmp0(curTLSEnabled, "false") == 0) ? FALSE:TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(useSipTlsCheckBox), (g_strcmp0(curTLSEnabled, "true") == 0) ? TRUE:FALSE); gtk_table_attach_defaults(GTK_TABLE(table), useSipTlsCheckBox, 0, 2, 0, 1); label = gtk_label_new_with_mnemonic (_("SRTP key exchange")); @@ -604,7 +599,16 @@ GtkWidget * create_security_tab(account_t **a) gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); gtk_table_attach_defaults(GTK_TABLE(table), keyExchangeCombo, 1, 2, 1, 2); gtk_table_attach_defaults(GTK_TABLE(table), advancedZrtpButton, 2, 3, 1, 2); - + + gtk_widget_show_all(table); + + /* Dynamically resize the window to fit the scrolled window */ + GtkRequisition requisitionTable; + GtkRequisition requisitionTreeView; + gtk_widget_size_request(GTK_WIDGET(treeViewCredential), &requisitionTreeView); + gtk_widget_size_request(GTK_WIDGET(table), &requisitionTable); + gtk_widget_set_size_request(GTK_WIDGET(scrolledWindowCredential), requisitionTable.width, requisitionTreeView.height + 20); + gtk_widget_show_all(ret); return ret; @@ -774,7 +778,7 @@ GtkWidget * create_advanced_tab(account_t **a) useStunRadioButton = gtk_radio_button_new_with_mnemonic(NULL,_("Using STUN ")); gtk_table_attach_defaults(GTK_TABLE(table), useStunRadioButton, 0, 2, 3, 4); gtk_widget_set_sensitive(GTK_TOGGLE_BUTTON(useStunRadioButton), - g_strcasecmp(use_tls,"false") == 0 ? TRUE: FALSE); + g_strcasecmp(use_tls,"true") == 0 ? FALSE: TRUE); sameAsLocalRadioButton = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(useStunRadioButton), _("Same as local parameters")); gtk_table_attach_defaults(GTK_TABLE(table), sameAsLocalRadioButton, 0, 2, 4, 5); @@ -1021,7 +1025,7 @@ show_account_window (account_t * a) g_strdup(PUBLISHED_ADDRESS), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(publishedAddressEntry)))); - config_window_set_stun_visible(); + preferences_dialog_set_stun_visible(); } /* Set new credentials if any */ diff --git a/sflphone-client-gnome/src/config/accountwindow.h b/sflphone-client-gnome/src/config/accountwindow.h index c7e5e53e0b2e412855eff5247a5c4988001b6f67..50e6f760f65213b69f56b26f2d5507dc580c29fe 100644 --- a/sflphone-client-gnome/src/config/accountwindow.h +++ b/sflphone-client-gnome/src/config/accountwindow.h @@ -25,7 +25,7 @@ */ #include "utils.h" -#include "configwindow.h" +#include "preferencesdialog.h" /** * Display the main account widget diff --git a/sflphone-client-gnome/src/config/audioconf.c b/sflphone-client-gnome/src/config/audioconf.c index e4f9294bb97fea2c04f0ef1bdb21df6e4b0001b5..ce85d94dea9343190aa00e5360259c7221f3c088 100644 --- a/sflphone-client-gnome/src/config/audioconf.c +++ b/sflphone-client-gnome/src/config/audioconf.c @@ -51,7 +51,7 @@ enum { * Fills the tree list with supported codecs */ void -config_window_fill_codec_list() +preferences_dialog_fill_codec_list() { GtkListStore *codecStore; GtkTreeIter iter; @@ -84,7 +84,7 @@ config_window_fill_codec_list() * Fill store with output audio plugins */ void -config_window_fill_output_audio_plugin_list() +preferences_dialog_fill_output_audio_plugin_list() { GtkTreeIter iter; gchar** list; @@ -112,7 +112,7 @@ config_window_fill_output_audio_plugin_list() * Fill output audio device store */ void -config_window_fill_output_audio_device_list() +preferences_dialog_fill_output_audio_device_list() { GtkTreeIter iter; @@ -179,7 +179,7 @@ select_active_output_audio_device() * Fill input audio device store */ void -config_window_fill_input_audio_device_list() +preferences_dialog_fill_input_audio_device_list() { GtkTreeIter iter; @@ -611,7 +611,7 @@ GtkWidget* codecs_box() gtk_box_pack_start(GTK_BOX(buttonBox), codecMoveDownButton, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(codecMoveDownButton), "clicked", G_CALLBACK(codec_move_down), codecTreeView); - config_window_fill_codec_list(); + preferences_dialog_fill_codec_list(); return ret; } @@ -667,7 +667,7 @@ GtkWidget* alsa_box() gtk_widget_show( item ); // Set choices of audio managers pluginlist = gtk_list_store_new(1, G_TYPE_STRING); - config_window_fill_output_audio_plugin_list(); + preferences_dialog_fill_output_audio_plugin_list(); plugin = gtk_combo_box_new_with_model(GTK_TREE_MODEL(pluginlist)); select_active_output_audio_plugin(); gtk_label_set_mnemonic_widget(GTK_LABEL(item), plugin); @@ -689,7 +689,7 @@ GtkWidget* alsa_box() gtk_widget_show(item); // Set choices of output devices outputlist = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); - config_window_fill_output_audio_device_list(); + preferences_dialog_fill_output_audio_device_list(); output = gtk_combo_box_new_with_model(GTK_TREE_MODEL(outputlist)); select_active_output_audio_device(); gtk_label_set_mnemonic_widget(GTK_LABEL(item), output); @@ -712,7 +712,7 @@ GtkWidget* alsa_box() // Set choices of output devices inputlist = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); - config_window_fill_input_audio_device_list(); + preferences_dialog_fill_input_audio_device_list(); input = gtk_combo_box_new_with_model(GTK_TREE_MODEL(inputlist)); select_active_input_audio_device(); gtk_label_set_mnemonic_widget(GTK_LABEL(item), input); diff --git a/sflphone-client-gnome/src/config/configwindow.c b/sflphone-client-gnome/src/config/configwindow.c index 05f904296c13a35e7c62c80ea96af9e6a52a5251..697dc3eaf61f3ab367acf62c56574d49663d1963 100644 --- a/sflphone-client-gnome/src/config/configwindow.c +++ b/sflphone-client-gnome/src/config/configwindow.c @@ -33,7 +33,6 @@ #include <addressbook-config.h> #include <hooks-config.h> #include <utils.h> -#include <ip2ipdialog.h> #include <stdlib.h> #include <stdio.h> @@ -71,7 +70,9 @@ static gboolean history_enabled = TRUE; account_t * selectedAccount = NULL; GHashTable * directIpCallsProperties = NULL; - + +GtkDialog * accountListDialog; + // Account properties enum { COLUMN_ACCOUNT_ALIAS, @@ -106,7 +107,7 @@ config_window_fill_account_list() if (a) { gtk_list_store_append (accountStore, &iter); - DEBUG("Filling accounts: Account is enabled :%s\n", g_hash_table_lookup(a->properties, ACCOUNT_ENABLED)); + DEBUG("Filling accounts: Account is enabled :%s", g_hash_table_lookup(a->properties, ACCOUNT_ENABLED)); gtk_list_store_set(accountStore, &iter, COLUMN_ACCOUNT_ALIAS, g_hash_table_lookup(a->properties, ACCOUNT_ALIAS), // Name @@ -377,6 +378,30 @@ static void update_port_cb ( GtkSpinButton *button UNUSED, void *ptr ) dbus_set_sip_port(gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr))); } +static void +help_contents_cb (GtkWidget * widget, + gpointer data UNUSED) +{ + GError *error = NULL; + + gboolean success = gtk_show_uri (NULL, "ghelp: sflphone.xml", GDK_CURRENT_TIME, &error); + + if (error != NULL) + { + g_warning ("%s", error->message); + + g_error_free (error); + } +} + +static void +close_dialog_cb (GtkWidget * widget, + gpointer data UNUSED) +{ + gtk_dialog_response(GTK_DIALOG(accountListDialog), GTK_RESPONSE_ACCEPT); + +} + /** * Account settings tab */ @@ -395,9 +420,9 @@ create_accounts_tab(GtkDialog * dialog) selectedAccount = NULL; table = gtk_table_new (1, 2, FALSE/* homogeneous */); - gtk_table_set_col_spacings( GTK_TABLE(table), 10); - gtk_container_set_border_width(GTK_CONTAINER (table), 10); - + gtk_table_set_col_spacings(GTK_TABLE(table), 10); + gtk_container_set_border_width(GTK_TABLE(table), 10); + scrolledWindow = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledWindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledWindow), GTK_SHADOW_IN); @@ -452,10 +477,9 @@ create_accounts_tab(GtkDialog * dialog) /* The buttons to press! */ buttonBox = gtk_vbutton_box_new(); - gtk_box_set_spacing(GTK_BOX(buttonBox), 10); //GAIM_HIG_BOX_SPACE + gtk_box_set_spacing(GTK_BOX(buttonBox), 10); gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_START); gtk_table_attach (GTK_TABLE(table), buttonBox, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_widget_show (buttonBox); accountMoveUpButton = gtk_button_new_from_stock(GTK_STOCK_GO_UP); gtk_widget_set_sensitive(GTK_WIDGET(accountMoveUpButton), FALSE); @@ -471,27 +495,43 @@ create_accounts_tab(GtkDialog * dialog) g_signal_connect_swapped(G_OBJECT(addButton), "clicked", G_CALLBACK(add_account), NULL); gtk_box_pack_start(GTK_BOX(buttonBox), addButton, FALSE, FALSE, 0); - gtk_widget_show(addButton); editButton = gtk_button_new_from_stock (GTK_STOCK_EDIT); gtk_widget_set_sensitive(GTK_WIDGET(editButton), FALSE); g_signal_connect_swapped(G_OBJECT(editButton), "clicked", G_CALLBACK(edit_account), NULL); gtk_box_pack_start(GTK_BOX(buttonBox), editButton, FALSE, FALSE, 0); - gtk_widget_show(editButton); deleteButton = gtk_button_new_from_stock (GTK_STOCK_REMOVE); gtk_widget_set_sensitive(GTK_WIDGET(deleteButton), FALSE); g_signal_connect_swapped(G_OBJECT(deleteButton), "clicked", G_CALLBACK(delete_account), stunFrame); gtk_box_pack_start(GTK_BOX(buttonBox), deleteButton, FALSE, FALSE, 0); - gtk_widget_show(deleteButton); + + /* help and close buttons */ + GtkWidget * buttonHbox = gtk_hbutton_box_new(); + gtk_table_attach(GTK_TABLE(table), buttonHbox, 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 10); + + GtkWidget * helpButton = gtk_button_new_from_stock (GTK_STOCK_HELP); + g_signal_connect_swapped(G_OBJECT(helpButton), "clicked", + G_CALLBACK(help_contents_cb), NULL); + gtk_box_pack_start(GTK_BOX(buttonHbox), helpButton, FALSE, FALSE, 0); + GtkWidget * closeButton = gtk_button_new_from_stock (GTK_STOCK_CLOSE); + g_signal_connect_swapped(G_OBJECT(closeButton), "clicked", G_CALLBACK(close_dialog_cb), NULL); + gtk_box_pack_start(GTK_BOX(buttonHbox), closeButton, FALSE, FALSE, 0); + + gtk_widget_show_all(table); config_window_fill_account_list(); + /* Resize the scrolledWindow for a better view */ gtk_widget_size_request(GTK_WIDGET(treeView), &requisition); gtk_widget_set_size_request(GTK_WIDGET(scrolledWindow), requisition.width + 20, requisition.height); - + GtkRequisition requisitionButton; + gtk_widget_size_request(GTK_WIDGET(deleteButton), &requisitionButton); + gtk_widget_set_size_request(GTK_WIDGET(closeButton), requisitionButton.width, -1); + gtk_widget_set_size_request(GTK_WIDGET(helpButton), requisitionButton.width, -1); + gtk_widget_show_all(table); return table; @@ -920,40 +960,36 @@ show_config_window () void show_accounts_window( void ) { - GtkDialog * dialog; GtkWidget * accountFrame; GtkWidget * tab; accDialogOpen = TRUE; - dialog = GTK_DIALOG(gtk_dialog_new_with_buttons (_("Accounts"), + accountListDialog = GTK_DIALOG(gtk_dialog_new_with_buttons (_("Accounts"), GTK_WINDOW(get_main_window()), GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_HELP, GTK_RESPONSE_HELP, - GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT, NULL)); // Set window properties - gtk_dialog_set_has_separator(dialog, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(dialog), 0); + gtk_dialog_set_has_separator(accountListDialog, FALSE); + gtk_container_set_border_width(GTK_CONTAINER(accountListDialog), 0); gnome_main_section_new (_("Configured Accounts"), &accountFrame); - gtk_box_pack_start( GTK_BOX( dialog->vbox ), accountFrame , TRUE, TRUE, 0); - gtk_container_set_border_width(GTK_CONTAINER(accountFrame), 10); + gtk_box_pack_start( GTK_BOX( accountListDialog->vbox ), accountFrame , TRUE, TRUE, 0); gtk_widget_show(accountFrame); // Accounts tab - tab = create_accounts_tab(dialog); - - gtk_container_add(GTK_CONTAINER(accountFrame) , tab); - - gtk_dialog_run( dialog ); + tab = create_accounts_tab(accountListDialog); + gtk_widget_show(tab); + gtk_container_add(GTK_CONTAINER(accountFrame), tab); + + gtk_dialog_run(accountListDialog); status_bar_display_account (); accDialogOpen=FALSE; - gtk_widget_destroy(GTK_WIDGET(dialog)); + gtk_widget_destroy(GTK_WIDGET(accountListDialog)); toolbar_update_buttons(); } diff --git a/sflphone-client-gnome/src/config/ip2ipdialog.c b/sflphone-client-gnome/src/config/ip2ipdialog.c deleted file mode 100644 index 8d6f961a629da390e2686be3fee6c81c9a8d9a97..0000000000000000000000000000000000000000 --- a/sflphone-client-gnome/src/config/ip2ipdialog.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 2009 Savoir-Faire Linux inc. - * Author: Pierre-Luc Bacon <pierre-luc.bacon@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. - */ - -#include <zrtpadvanceddialog.h> -#include <sflphone_const.h> -#include <utils.h> - -#include <gtk/gtk.h> - -static void key_exchange_changed_cb(GtkWidget *widget, gpointer data) -{ - DEBUG("Key exchange changed"); - if (g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget)), (gchar *) "ZRTP") == 0) { - gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); - } else { - gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); - - } -} - -static void show_advanced_zrtp_options_cb(GtkWidget *widget UNUSED, gpointer data) -{ - DEBUG("Advanced options for ZRTP"); - show_advanced_zrtp_options((GHashTable *) data); -} - -void show_ip2ip_dialog(GHashTable * properties) -{ - GtkDialog * ip2ipDialog; - - GtkWidget * frame; - GtkWidget * table; - GtkWidget * label; - GtkWidget * enableHelloHash; - GtkWidget * enableSASConfirm; - GtkWidget * enableZrtpNotSuppOther; - GtkWidget * displaySasOnce; - GtkWidget * advancedOptions; - GtkWidget * keyExchangeCombo; - - gchar * curSasConfirm = "true"; - gchar * curHelloEnabled = "true"; - gchar * curZrtpNotSuppOther = "true"; - gchar * curDisplaySasOnce = "false"; - gchar * curSRTPEnabled = "false"; - gchar * curKeyExchange = "0"; - gchar * description; - - if(properties != NULL) { - curSRTPEnabled = g_hash_table_lookup(properties, ACCOUNT_SRTP_ENABLED); - curKeyExchange = g_hash_table_lookup(properties, ACCOUNT_KEY_EXCHANGE); - curHelloEnabled = g_hash_table_lookup(properties, ACCOUNT_ZRTP_HELLO_HASH); - curSasConfirm = g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS); - curZrtpNotSuppOther = g_hash_table_lookup(properties, ACCOUNT_ZRTP_NOT_SUPP_WARNING); - curDisplaySasOnce = g_hash_table_lookup(properties, ACCOUNT_DISPLAY_SAS_ONCE); - } - - ip2ipDialog = GTK_DIALOG(gtk_dialog_new_with_buttons (_("Direct peer to peer calls"), - GTK_WINDOW(get_main_window()), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_HELP, - GTK_RESPONSE_HELP, - GTK_STOCK_CANCEL, - GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE, - GTK_RESPONSE_ACCEPT, - NULL)); - - gtk_window_set_policy( GTK_WINDOW(ip2ipDialog), FALSE, FALSE, FALSE ); - gtk_dialog_set_has_separator(ip2ipDialog, TRUE); - gtk_container_set_border_width (GTK_CONTAINER(ip2ipDialog), 0); - - GtkWidget * vbox = gtk_vbox_new(FALSE, 10); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); - - gtk_box_pack_start(GTK_BOX(ip2ipDialog->vbox), vbox, FALSE, FALSE, 0); - - description = g_markup_printf_escaped(_("This profile is used when you want to reach a remote peer\nby simply typing <b>sip:remotepeer</b> without having to go throught\nan external server. The settings here defined will also apply\nin case no account could be matched to the incoming or\noutgoing call.")); - label = gtk_label_new(NULL); - gtk_label_set_markup(GTK_LABEL(label), description); - gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_FILL); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - - /* SRTP Section */ - gnome_main_section_new_with_table (_("Security"), &frame, &table, 1, 3); - gtk_container_set_border_width (GTK_CONTAINER(table), 10); - gtk_table_set_row_spacings (GTK_TABLE(table), 10); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); - - label = gtk_label_new_with_mnemonic (_("SRTP key exchange")); - keyExchangeCombo = gtk_combo_box_new_text(); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), keyExchangeCombo); - gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "ZRTP"); - //gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES"); - gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), _("Disabled")); - - advancedOptions = gtk_button_new_with_label(_("Advanced options")); - g_signal_connect(G_OBJECT(advancedOptions), "clicked", G_CALLBACK(show_advanced_zrtp_options_cb), properties); - - DEBUG("curSRTPEnabled = %s\n", curSRTPEnabled); - - if (g_strcasecmp(curSRTPEnabled, "false") == 0) - { - gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); - gtk_widget_set_sensitive(GTK_WIDGET(advancedOptions), FALSE); - } else { - DEBUG("curKeyExchange %s \n", curKeyExchange); - if (strcmp(curKeyExchange, ZRTP) == 0) { - gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),0); - } else { - gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); - gtk_widget_set_sensitive(GTK_WIDGET(advancedOptions), FALSE); - } - } - - g_signal_connect (G_OBJECT (GTK_COMBO_BOX(keyExchangeCombo)), "changed", G_CALLBACK (key_exchange_changed_cb), advancedOptions); - - gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); - gtk_table_attach_defaults(GTK_TABLE(table), keyExchangeCombo, 1, 2, 0, 1); - gtk_table_attach_defaults(GTK_TABLE(table), advancedOptions, 2, 3, 0, 1); - - gtk_widget_show_all(vbox); - - if(gtk_dialog_run(GTK_DIALOG(ip2ipDialog)) == GTK_RESPONSE_ACCEPT) { - gchar* keyExchange = (gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(keyExchangeCombo)); - DEBUG("Active text %s\n", keyExchange); - if (g_strcmp0(keyExchange, "ZRTP") == 0) { - g_hash_table_replace(properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true")); - } else { - g_hash_table_replace(properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("false")); - } - dbus_set_ip2ip_details(properties); - } - - gtk_widget_destroy (GTK_WIDGET(ip2ipDialog)); -} diff --git a/sflphone-client-gnome/src/config/ip2ipdialog.h b/sflphone-client-gnome/src/config/ip2ipdialog.h deleted file mode 100644 index e1e6de0af71a0755e05d393a06cc15d6fb1426cb..0000000000000000000000000000000000000000 --- a/sflphone-client-gnome/src/config/ip2ipdialog.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2009 Savoir-Faire Linux inc. - * Author: Pierre-Luc Bacon <pierre-luc.bacon@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. - */ - -#ifndef __SFL_IP2IP_DIALOG__ -#define __SFL_IP2IP_DIALOG__ -/** @file zrtpadvanceddialog.h - * @brief Display the advanced options window for zrtp - */ - -#include <glib.h> - -/** - * Display the advanced options window for zrtp - */ - -void show_ip2ip_dialog(GHashTable * properties); - -#endif diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index 3700b2308c1d2818dae76ee44a7ec79de4ca1243..0d39a1553fa8875513c6e15099ea01044dadfef5 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -24,7 +24,8 @@ #include <callmanager-glue.h> #include <configurationmanager-glue.h> #include <instance-glue.h> -#include <configwindow.h> +#include <preferencesdialog.h> +#include <accountlistconfigdialog.h> #include <mainwindow.h> #include <marshaller.h> #include <sliders.h> @@ -227,7 +228,7 @@ accounts_changed_cb (DBusGProxy *proxy UNUSED, DEBUG ("Accounts changed"); sflphone_fill_account_list(TRUE); sflphone_fill_ip2ip_profile(); - config_window_fill_account_list(); + account_list_config_dialog_fill(); // Update the status bar in case something happened // Should fix ticket #1215 @@ -328,7 +329,7 @@ sip_call_state_cb (DBusGProxy *proxy UNUSED, { callable_obj_t * c = NULL; c = calllist_get(current_calls, callID); - DEBUG("sip_call_state_cb received code %d callID %s", code, callID); + if(c != NULL) { DEBUG("sip_call_state_cb received code %d", code); sflphone_call_state_changed(c, description, code); @@ -502,11 +503,12 @@ dbus_connect () /* VOID STRING STRING INT */ dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING_STRING_INT, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); + dbus_g_proxy_add_signal (callManagerProxy, "sipCallStateChanged", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INVALID); dbus_g_proxy_connect_signal (callManagerProxy, "sipCallStateChanged", G_CALLBACK(sip_call_state_cb), NULL, NULL); - + configurationManagerProxy = dbus_g_proxy_new_for_name (connection, "org.sflphone.SFLphone", "/org/sflphone/SFLphone/ConfigurationManager", @@ -2152,34 +2154,6 @@ GHashTable* dbus_get_tls_settings_default(void) return results; } -GHashTable* dbus_get_tls_settings(const gchar * accountID) -{ - GError *error = NULL; - GHashTable *results = NULL; - - org_sflphone_SFLphone_ConfigurationManager_get_tls_settings(configurationManagerProxy, accountID, &results, &error); - if (error != NULL){ - ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_tls_settings_default"); - g_error_free (error); - } - return results; -} - -void dbus_set_tls_settings (account_t *a) -{ - GError *error = NULL; - org_sflphone_SFLphone_ConfigurationManager_set_tls_settings ( - configurationManagerProxy, - a->accountID, - a->tlsSettings, - &error); - if (error) { - ERROR ("Failed to call set_tls_settings() on ConfigurationManager: %s", - error->message); - g_error_free (error); - } -} - gchar ** dbus_get_all_ip_interface(void) { GError *error = NULL; diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h index 73305b489f35da47c06ce28d0727f57545cc4aa7..52dab180c1f77b5284d635ec628a4f5f169ff947 100644 --- a/sflphone-client-gnome/src/dbus/dbus.h +++ b/sflphone-client-gnome/src/dbus/dbus.h @@ -601,20 +601,6 @@ void dbus_set_confirm_go_clear (const callable_obj_t * c); */ gchar** dbus_get_supported_tls_method(); -/** - * CallManager - Get default values for TLS. - * @return a GHashTable object containing those default - * TLS settings. - * - */ -GHashTable* dbus_get_tls_settings_default(void); -/** - * CallManager - Get TLS settings for that account - * @return a GHashTable object containing those default - * TLS settings. - * - */ -GHashTable* dbus_get_tls_settings(const gchar * accountID); #endif diff --git a/sflphone-client-gnome/src/mainwindow.c b/sflphone-client-gnome/src/mainwindow.c index 766821e9c8df3fc2a91eae60c0bf614744741c16..71377ff085a958373eac254bb83c757abed1e055 100644 --- a/sflphone-client-gnome/src/mainwindow.c +++ b/sflphone-client-gnome/src/mainwindow.c @@ -24,7 +24,7 @@ #include <actions.h> #include <calltree.h> #include <calltab.h> -#include <configwindow.h> +#include <preferencesdialog.h> #include <dialpad.h> #include <mainwindow.h> #include <menus.h> @@ -106,7 +106,7 @@ main_window_ask_quit(){ static gboolean on_key_released (GtkWidget *widget, GdkEventKey *event, gpointer user_data UNUSED) { - DEBUG("On key released from Main Window : %s\n", gtk_widget_get_name(widget)); + DEBUG("On key released from Main Window : %s", gtk_widget_get_name(widget)); if (focus_is_on_searchbar == FALSE) { // If a modifier key is pressed, it's a shortcut, pass along @@ -257,7 +257,7 @@ create_main_window () if (response == GTK_RESPONSE_YES) { - show_config_window(); + show_preferences_dialog(); } #endif } diff --git a/sflphone-client-gnome/src/menus.c b/sflphone-client-gnome/src/menus.c index 76e9552c7c751053c02b15594aed7a650907e923..3556b5d4e8b9230a99351310c4d1a266d5d40585 100644 --- a/sflphone-client-gnome/src/menus.c +++ b/sflphone-client-gnome/src/menus.c @@ -20,7 +20,8 @@ #include <menus.h> #include <config.h> -#include <configwindow.h> +#include <preferencesdialog.h> +#include <accountlistconfigdialog.h> #include <dbus/dbus.h> #include <mainwindow.h> #include <assistant.h> @@ -393,13 +394,13 @@ create_call_menu() static void edit_preferences ( void * foo UNUSED) { - show_config_window(); + show_preferences_dialog(); } static void edit_accounts ( void * foo UNUSED) { - show_accounts_window(); + show_account_list_config_dialog(); } // The menu Edit/Copy should copy the current selected call's number diff --git a/sflphone-client-gnome/src/sflphone_const.h b/sflphone-client-gnome/src/sflphone_const.h index 627e4f919e50be7dd9ba2a161489f30749056841..4997eea888d8dcb5791524ae9e33f5023947b818 100644 --- a/sflphone-client-gnome/src/sflphone_const.h +++ b/sflphone-client-gnome/src/sflphone_const.h @@ -88,6 +88,10 @@ #define PUBLISHED_PORT "Account.publishedPort" #define PUBLISHED_ADDRESS "Account.publishedAddress" +#define REGISTRATION_STATUS "Status" +#define REGISTRATION_STATE_CODE "Registration.code" +#define REGISTRATION_STATE_DESCRIPTION "Registration.description" + /** * Global logger */ diff --git a/sflphone-client-gnome/src/uimanager.c b/sflphone-client-gnome/src/uimanager.c index a7bad0f178d93e5a8203f8cdedfe88facda86b0f..51ab183ac79f7365edbf1e9cfc3ce7cf5ba84383 100644 --- a/sflphone-client-gnome/src/uimanager.c +++ b/sflphone-client-gnome/src/uimanager.c @@ -19,7 +19,7 @@ #include <menus.h> #include <config.h> -#include <configwindow.h> +#include <preferencesdialog.h> #include <dbus/dbus.h> #include <mainwindow.h> #include <assistant.h> diff --git a/sflphone-common/src/account.h b/sflphone-common/src/account.h index 6a37fe01347c0a1e2be32cc978a00a77bd520a45..723efeb4c277028429922eb9f75c5d4578081a74 100644 --- a/sflphone-common/src/account.h +++ b/sflphone-common/src/account.h @@ -106,7 +106,11 @@ typedef enum RegistrationState { #define TLS_REQUIRE_CLIENT_CERTIFICATE "TLS.requireClientCertificate" #define TLS_NEGOTIATION_TIMEOUT_SEC "TLS.negotiationTimeoutSec" #define TLS_NEGOTIATION_TIMEOUT_MSEC "TLS.negotiationTimemoutMsec" - + +#define REGISTRATION_STATUS "Status" +#define REGISTRATION_STATE_CODE "Registration.code" +#define REGISTRATION_STATE_DESCRIPTION "Registration.description" + class Account{ public: @@ -162,7 +166,30 @@ class Account{ */ inline RegistrationState getRegistrationState() { return _registrationState; } + /** + * Set the registration state of the specified link + * @param state The registration state of underlying VoIPLink + */ void setRegistrationState( RegistrationState state ); + + /** + * Set the latest up-to-date state code + * for that account. These codes are + * those used in SIP and IAX (eg. 200, 500 ...) + * @param state The Code:Description state + * @return void + */ + void setRegistrationStateDetailed(std::pair<int, std::string> state) { _registrationStateDetailed = state; } + + /** + * Get the latest up-to-date state code + * for that account. These codes are + * those used in SIP and IAX (eg. 200, 500 ...) + * @param void + * @return std::pair<int, std::string> A Code:Description state + */ + std::pair<int, std::string> getRegistrationStateDetailed(void) { return _registrationStateDetailed; } + /* inline functions */ /* They should be treated like macro definitions by the C++ compiler */ @@ -233,9 +260,16 @@ class Account{ std::string _type; /* - * The registration state of the account + * The general, protocol neutral registration + * state of the account */ RegistrationState _registrationState; + + /* + * Details about the registration state. + * This is a protocol Code:Description pair. + */ + std::pair<int, std::string> _registrationStateDetailed; }; diff --git a/sflphone-common/src/dbus/callmanager-introspec.xml b/sflphone-common/src/dbus/callmanager-introspec.xml index 16384ae1edfcf36272f7e977d15a5a819d15214f..743dd70f3e1d5803e27b8cbb09ea5cbaec26fe1a 100644 --- a/sflphone-common/src/dbus/callmanager-introspec.xml +++ b/sflphone-common/src/dbus/callmanager-introspec.xml @@ -106,7 +106,13 @@ <arg type="s" name="state" direction="out"/> <arg type="i" name="code" direction="out"/> </signal> - + + <signal name="registrationStateChanged"> + <arg type="s" name="accountID" direction="out"/> + <arg type="s" name="state" direction="out"/> + <arg type="i" name="code" direction="out"/> + </signal> + <signal name="voiceMailNotify"> <arg type="s" name="accountID" direction="out"/> <arg type="i" name="count" direction="out"/> diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 0f19bbd35d064ded0a3e9ee1485362a9017bf896..ff613b2300e9b9d32a0fa7118eb2cd8b070c10f5 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -1012,8 +1012,9 @@ ManagerImpl::startVoiceMessageNotification (const AccountID& accountId, int nb_m void ManagerImpl::connectionStatusNotification() { - if (_dbus) + if (_dbus != NULL) { _dbus->getConfigurationManager()->accountsChanged(); + } } /** @@ -2560,13 +2561,22 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou a.insert(std::pair<std::string, std::string> (STUN_ENABLE, getConfigString(accountID, STUN_ENABLE))); a.insert(std::pair<std::string, std::string> (STUN_SERVER, getConfigString(accountID, STUN_SERVER))); - RegistrationState state; + RegistrationState state; + std::string registrationStateCode; + std::string registrationStateDescription; if (account != NULL) { - state = account->getRegistrationState(); + state = account->getRegistrationState(); + int code = account->getRegistrationStateDetailed().first; + std::stringstream out; + out << code; + registrationStateCode = out.str(); + registrationStateDescription = account->getRegistrationStateDetailed().second; } else { state = Unregistered; } - a.insert(std::pair<std::string, std::string> ("Status", mapStateNumberToString (state))); + a.insert(std::pair<std::string, std::string> (REGISTRATION_STATUS, mapStateNumberToString (state))); + a.insert(std::pair<std::string, std::string> (REGISTRATION_STATE_CODE, registrationStateCode)); + a.insert(std::pair<std::string, std::string> (REGISTRATION_STATE_DESCRIPTION, registrationStateDescription)); a.insert(std::pair<std::string, std::string> (SRTP_KEY_EXCHANGE, getConfigString(accountID, SRTP_KEY_EXCHANGE))); a.insert(std::pair<std::string, std::string> (SRTP_ENABLE, getConfigString(accountID, SRTP_ENABLE))); a.insert(std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS, getConfigString(accountID, ZRTP_DISPLAY_SAS))); @@ -2697,6 +2707,7 @@ void ManagerImpl::setCredential (const std::string& accountID, const int32_t& in //TODO: tidy this up. Make a macro or inline // method to reduce the if/else mess. +// Even better, switch to XML ! void ManagerImpl::setAccountDetails (const std::string& accountID, const std::map< std::string, std::string >& details) { @@ -2810,7 +2821,6 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma if((iter = map_cpy.find(TLS_NEGOTIATION_TIMEOUT_SEC)) != map_cpy.end()) { tlsNegotiationTimeoutSec = iter->second; } if((iter = map_cpy.find(TLS_NEGOTIATION_TIMEOUT_MSEC)) != map_cpy.end()) { tlsNegotiationTimeoutMsec = iter->second; } - _debug("Enable account %s\n", accountEnable.c_str()); setConfig(accountID, HOSTNAME, hostname); setConfig(accountID, LOCAL_ADDRESS, localAddress); setConfig(accountID, PUBLISHED_ADDRESS, publishedAddress); diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index efa812bb3b056ac19fde5a1a738c7f45427cbe35..b21e4c58377b4e2a27952df2c609a4022fb8d05c 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -2478,7 +2478,9 @@ void regc_cb (struct pjsip_regc_cbparam *param) assert(param); const pj_str_t * description = pjsip_get_status_text(param->code); if (param->code) { - DBusManager::instance().getCallManager()->sipCallStateChanged(account->getAccountID(), std::string(description->ptr, description->slen), param->code); + DBusManager::instance().getCallManager()->registrationStateChanged(account->getAccountID(), std::string(description->ptr, description->slen), param->code); + std::pair<int, std::string> details(param->code, std::string(description->ptr, description->slen)); + account->setRegistrationStateDetailed(details); } if (param->status == PJ_SUCCESS) { @@ -2489,25 +2491,18 @@ void regc_cb (struct pjsip_regc_cbparam *param) _debug ("UserAgent: The error is: %d\n", param->code); switch (param->code) { - case 606: account->setRegistrationState (ErrorConfStun); break; - case 503: - case 408: account->setRegistrationState (ErrorHost); break; - case 401: - case 403: - case 404: account->setRegistrationState (ErrorAuth); break; - default: account->setRegistrationState (Error); break; @@ -2516,7 +2511,6 @@ void regc_cb (struct pjsip_regc_cbparam *param) account->setRegister (false); } else { // Registration/Unregistration is success - if (account->isRegister()) account->setRegistrationState (Registered); else {