diff --git a/sflphone-client-gnome/src/config/accountconfigdialog.c b/sflphone-client-gnome/src/config/accountconfigdialog.c index 74d6837bb2fe2c835324e8ad1cecc4a8239444e5..7588d92c6a0a9426cc0ffbc160f48300c2c0d707 100644 --- a/sflphone-client-gnome/src/config/accountconfigdialog.c +++ b/sflphone-client-gnome/src/config/accountconfigdialog.c @@ -165,8 +165,8 @@ static GtkWidget * create_basic_tab(account_t **a) curMailbox = g_hash_table_lookup(currentAccount->properties, ACCOUNT_MAILBOX); } - DEBUG("-------- Basic parameters from config"); - DEBUG("curAccountID %s, curAccountType %s, curAccountEnabled %s, curAlias %s, curHostname %s, curPassword %s, curUsername %s, curMailbox %s\n", curAccountID, curAccountType, curAccountEnabled, curAlias, curHostname, curPassword, curUsername, curMailbox); + // DEBUG("-------- Basic parameters from config"); + // DEBUG("curAccountID %s, curAccountType %s, curAccountEnabled %s, curAlias %s, curHostname %s, curPassword %s, curUsername %s, curMailbox %s\n", curAccountID, curAccountType, curAccountEnabled, curAlias, curHostname, curPassword, curUsername, curMailbox); gnome_main_section_new (_("Account Parameters"), &frame); @@ -486,11 +486,12 @@ static set_published_addr_manually_cb(GtkWidget * widget, gpointer data UNUSED) static use_stun_cb(GtkWidget * widget, gpointer data UNUSED) { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { - DEBUG("Showing stun options"); + DEBUG("Showing stun options, hiding Local/Published info"); gtk_widget_show(stunServerLabel); gtk_widget_show(stunServerEntry); gtk_widget_set_sensitive(sameAsLocalRadioButton, FALSE); gtk_widget_set_sensitive(publishedAddrRadioButton, FALSE); + DEBUG("Problem occurs here"); gtk_widget_hide(publishedAddressLabel); gtk_widget_hide(publishedPortLabel); gtk_widget_hide(publishedAddressEntry); @@ -702,13 +703,13 @@ GtkWidget * create_security_tab(account_t **a) 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, 120); - - gtk_widget_show_all(ret); - + same_as_local_cb(sameAsLocalRadioButton, NULL); set_published_addr_manually_cb(publishedAddrRadioButton, NULL); + + gtk_widget_show_all(ret); - return ret; + return ret; } @@ -751,8 +752,8 @@ GtkWidget * create_advanced_tab(account_t **a) stun_server = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_STUN_SERVER); published_sameas_local = g_hash_table_lookup(currentAccount->properties, PUBLISHED_SAMEAS_LOCAL); - DEBUG("-------- Advanced parameters from config"); - DEBUG("resolve_once %s, account_expire %s, use_tls %s, published_address %s, published_port %s, local_address %s, local_port %s, stun_enable %s, stun_server %s, published_sameas_local %s\n", resolve_once, account_expire, use_tls, published_address, published_port, local_address, local_port, stun_enable, stun_server, published_sameas_local); + // DEBUG("-------- Advanced parameters from config"); + // DEBUG("resolve_once %s, account_expire %s, use_tls %s, published_address %s, published_port %s, local_address %s, local_port %s, stun_enable %s, stun_server %s, published_sameas_local %s\n", resolve_once, account_expire, use_tls, published_address, published_port, local_address, local_port, stun_enable, stun_server, published_sameas_local); } gnome_main_section_new_with_table (_("Registration"), &frame, &table, 2, 3); @@ -805,6 +806,7 @@ GtkWidget * create_advanced_tab(account_t **a) gtk_list_store_append(ipInterfaceListStore, &iter ); gtk_list_store_set(ipInterfaceListStore, &iter, 0, *iface, -1 ); + current_local_address_iter = iter; if (g_strcmp0(*iface, local_address) == 0) { DEBUG("Setting active local address combo box"); current_local_address_iter = iter; @@ -874,8 +876,6 @@ GtkWidget * create_advanced_tab(account_t **a) } gtk_widget_show_all(ret); - - use_stun_cb (GTK_WIDGET (useStunCheckBox), NULL); publishedAddressLabel = gtk_label_new_with_mnemonic (_("Published address")); gtk_table_attach_defaults( GTK_TABLE(table), publishedAddressLabel, 0, 1, 5, 6); @@ -1078,6 +1078,7 @@ show_account_window (account_t * a) g_hash_table_replace(currentAccount->properties, g_strdup(PUBLISHED_ADDRESS), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(publishedAddressEntry)))); + /* DEBUG("-------- Basic parameters to ne written in config"); DEBUG("curAccountID %s, curAccountType %s, curAlias %s, curHostname %s, curPassword %s, curUsername %s, curMailbox %s\n", (gchar *)currentAccount->accountID, @@ -1088,8 +1089,8 @@ show_account_window (account_t * a) (gchar *)gtk_entry_get_text(GTK_ENTRY(entryUsername)), (gchar *)gtk_entry_get_text(GTK_ENTRY(entryMailbox)) ); - - + */ + /* DEBUG("-------- Advanced parameters to be written"); DEBUG("resolve_once %s, account_expire %s, use_tls %s, published_address %s, published_port %s, local_address %s, local_port %s, stun_enable %s, stun_server %s\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(entryResolveNameOnlyOnce)) ? "false": "true", @@ -1102,7 +1103,7 @@ show_account_window (account_t * a) gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(useStunCheckBox)) ? "true":"false", gtk_entry_get_text(GTK_ENTRY(stunServerEntry)) ); - + */ } diff --git a/sflphone-client-gnome/src/config/preferencesdialog.c b/sflphone-client-gnome/src/config/preferencesdialog.c index 5f9954b68a63d11694eb7113dfe3ec6ca42c140a..70d3bf51238c69613a4fa6dd97f8d62092638a0b 100644 --- a/sflphone-client-gnome/src/config/preferencesdialog.c +++ b/sflphone-client-gnome/src/config/preferencesdialog.c @@ -154,25 +154,40 @@ GtkWidget* create_direct_ip_calls_tab() GtkWidget * table; GtkWidget * label; GtkWidget * explanationLabel; + + GtkWidget * localPortLabel; + GtkWidget * localPortSpinBox; + GtkWidget * localAddressLabel; + GtkWidget * localAddressCombo; + GtkWidget * keyExchangeCombo; GtkWidget * advancedZrtpButton; - GtkWidget * useSipTlsCheckBox; + GtkWidget * useSipTlsCheckBox; gchar * curSRTPEnabled = "false"; gchar * curTlsEnabled = "false"; gchar * curKeyExchange = "0"; gchar * description; + + gchar * local_address; + gchar * local_port; //directIpCallsProperties = sflphone_get_ip2ip_properties(); sflphone_get_ip2ip_properties(&directIpCallsProperties); if(directIpCallsProperties != NULL) { DEBUG("got a directIpCallsProperties"); + local_address = g_hash_table_lookup(directIpCallsProperties, LOCAL_ADDRESS); + local_port = g_hash_table_lookup(directIpCallsProperties, LOCAL_PORT); + DEBUG(" local address = %s", local_address); + DEBUG(" local port = %s", local_port); curSRTPEnabled = g_hash_table_lookup(directIpCallsProperties, ACCOUNT_SRTP_ENABLED); DEBUG(" curSRTPEnabled = %s", curSRTPEnabled); curKeyExchange = g_hash_table_lookup(directIpCallsProperties, ACCOUNT_KEY_EXCHANGE); - curTlsEnabled = g_hash_table_lookup(directIpCallsProperties, TLS_ENABLE); + curTlsEnabled = g_hash_table_lookup(directIpCallsProperties, TLS_ENABLE); } + + GtkWidget * vbox = gtk_vbox_new(FALSE, 10); gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); @@ -183,6 +198,81 @@ GtkWidget* create_direct_ip_calls_tab() gtk_misc_set_alignment(GTK_MISC(explanationLabel), 0, 0.5); gtk_box_pack_start(GTK_BOX(vbox), explanationLabel, FALSE, FALSE, 0); + /** + * Network Interface Section + */ + gnome_main_section_new_with_table (_("Network Interface"), &frame, &table, 2, 2); + gtk_container_set_border_width (GTK_CONTAINER(table), 10); + gtk_table_set_row_spacings (GTK_TABLE(table), 10); + gtk_table_set_col_spacings( GTK_TABLE(table), 10); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); + + /** + * Retreive the list of IP interface from the + * the daemon and build the combo box. + */ + + GtkListStore * ipInterfaceListStore; + GtkTreeIter iter; + + ipInterfaceListStore = gtk_list_store_new( 1, G_TYPE_STRING ); + localAddressLabel = gtk_label_new_with_mnemonic (_("Local address")); + gtk_table_attach ( GTK_TABLE( table ), localAddressLabel, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC (localAddressLabel), 0, 0.5); + + GtkTreeIter current_local_address_iter = iter; + gchar ** iface_list = NULL; + iface_list = (gchar**) dbus_get_all_ip_interface(); + gchar ** iface = NULL; + + if (iface_list != NULL) { + for (iface = iface_list; *iface; iface++) { + DEBUG("Interface %s", *iface); + gtk_list_store_append(ipInterfaceListStore, &iter ); + gtk_list_store_set(ipInterfaceListStore, &iter, 0, *iface, -1 ); + + current_local_address_iter = iter; + if (g_strcmp0(*iface, local_address) == 0) { + DEBUG("Setting active local address combo box"); + current_local_address_iter = iter; + } + } + } + + localAddressCombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ipInterfaceListStore)); + gtk_label_set_mnemonic_widget(GTK_LABEL(localAddressLabel), localAddressCombo); + gtk_table_attach ( GTK_TABLE( table ), localAddressCombo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + g_object_unref(G_OBJECT(ipInterfaceListStore)); + + GtkCellRenderer * ipInterfaceCellRenderer; + ipInterfaceCellRenderer = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(localAddressCombo), ipInterfaceCellRenderer, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(localAddressCombo), ipInterfaceCellRenderer, "text", 0, NULL); + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(localAddressCombo), ¤t_local_address_iter); + + + /** + * Local port + */ + /** SIP port information */ + // int local_port = dbus_get_sip_port(); + + GtkWidget *applySipPortButton = gtk_button_new_from_stock(GTK_STOCK_APPLY); + + localPortLabel = gtk_label_new_with_mnemonic (_("Local port")); + gtk_table_attach_defaults(GTK_TABLE(table), localPortLabel, 0, 1, 1, 2); + + gtk_misc_set_alignment(GTK_MISC (localPortLabel), 0, 0.5); + localPortSpinBox = gtk_spin_button_new_with_range(1, 65535, 1); + gtk_label_set_mnemonic_widget (GTK_LABEL (localPortLabel), localPortSpinBox); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(localPortSpinBox), g_ascii_strtod(local_port, NULL)); + g_signal_connect( G_OBJECT( applySipPortButton) , "clicked" , G_CALLBACK( update_port_cb ) , applySipPortButton); + + gtk_table_attach_defaults(GTK_TABLE(table), localPortSpinBox, 1, 2, 1, 2); + + /** + * Security Section + */ gnome_main_section_new_with_table (_("Security"), &frame, &table, 2, 3); gtk_container_set_border_width (GTK_CONTAINER(table), 10); gtk_table_set_row_spacings (GTK_TABLE(table), 10); @@ -235,7 +325,7 @@ GtkWidget* create_direct_ip_calls_tab() return vbox; } - +/* GtkWidget* create_network_tab() { GtkWidget * frame; @@ -247,7 +337,7 @@ GtkWidget* create_network_tab() ret = gtk_vbox_new(FALSE, 10); gtk_container_set_border_width(GTK_CONTAINER(ret), 10); - /** SIP port information */ + // SIP port information int curPort = dbus_get_sip_port(); if(curPort <= 0 || curPort > 65535) { curPort = 5060; @@ -264,7 +354,7 @@ GtkWidget* create_network_tab() GtkWidget *entryPort; label = gtk_label_new(_("UDP Transport")); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); entryPort = gtk_spin_button_new_with_range(1, 65535, 1); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryPort); gtk_spin_button_set_value(GTK_SPIN_BUTTON(entryPort), curPort); @@ -278,6 +368,7 @@ GtkWidget* create_network_tab() return ret; } +*/ GtkWidget* create_general_settings () @@ -430,12 +521,12 @@ show_preferences_dialog () tab = create_hooks_settings(); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Hooks"))); gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - + /* // Network tab tab = create_network_tab(); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Network"))); gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - + */ // Direct IP calls tab tab = create_direct_ip_calls_tab(); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Direct IP calls"))); diff --git a/sflphone-common/src/dbus/configurationmanager.cpp b/sflphone-common/src/dbus/configurationmanager.cpp index 0a73795acb92384280c0d59a530f6d799d212097..3975ab5dec73294006858723600efd6ae6f27239 100644 --- a/sflphone-common/src/dbus/configurationmanager.cpp +++ b/sflphone-common/src/dbus/configurationmanager.cpp @@ -77,6 +77,9 @@ ConfigurationManager::getIp2IpDetails (void) ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_NOT_SUPP_WARNING, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_NOT_SUPP_WARNING))); ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS_ONCE, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_DISPLAY_SAS_ONCE))); + ip2ipAccountDetails.insert (std::pair<std::string, std::string> (LOCAL_ADDRESS, Manager::instance().getConfigString (IP2IP_PROFILE, LOCAL_ADDRESS))); + ip2ipAccountDetails.insert (std::pair<std::string, std::string> (LOCAL_PORT, Manager::instance().getConfigString (IP2IP_PROFILE, LOCAL_PORT))); + std::map<std::string, std::string> tlsSettings; tlsSettings = getTlsSettings (IP2IP_PROFILE); std::copy (tlsSettings.begin(), tlsSettings.end(), std::inserter (ip2ipAccountDetails, ip2ipAccountDetails.end()));