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

[#2382] Move TLS related published address options in security tab

parent 191e6ca0
No related branches found
No related tags found
No related merge requests found
...@@ -66,11 +66,13 @@ GtkWidget * keyExchangeCombo; ...@@ -66,11 +66,13 @@ GtkWidget * keyExchangeCombo;
GtkWidget * useSipTlsCheckBox; GtkWidget * useSipTlsCheckBox;
GtkWidget * publishedAddressEntry; GtkWidget * publishedAddressEntry;
GtkWidget * localAddressLabel;
GtkWidget * localAddressCombo; GtkWidget * localAddressCombo;
GtkWidget * useStunRadioButton; GtkWidget * useStunCheckBox;
GtkWidget * sameAsLocalRadioButton; GtkWidget * sameAsLocalRadioButton;
GtkWidget * publishedAddrRadioButton; GtkWidget * publishedAddrRadioButton;
GtkWidget * publishedPortSpinBox; GtkWidget * publishedPortSpinBox;
GtkWidget * localPortLabel;
GtkWidget * localPortSpinBox; GtkWidget * localPortSpinBox;
GtkWidget * publishedAddressLabel; GtkWidget * publishedAddressLabel;
GtkWidget * publishedPortLabel; GtkWidget * publishedPortLabel;
...@@ -419,6 +421,64 @@ static void use_sip_tls_cb(GtkWidget *widget, gpointer data) ...@@ -419,6 +421,64 @@ static void use_sip_tls_cb(GtkWidget *widget, gpointer data)
} }
} }
static use_stun_cb(GtkWidget * widget, gpointer data UNUSED)
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
DEBUG("Showing stun options");
gtk_widget_set_sensitive(localPortLabel, FALSE);
gtk_widget_set_sensitive(localPortSpinBox, FALSE);
gtk_widget_set_sensitive(localAddressLabel, FALSE);
gtk_widget_set_sensitive(localAddressCombo, FALSE);
gtk_widget_set_sensitive(stunServerLabel, TRUE);
gtk_widget_set_sensitive(stunServerEntry, TRUE);
// gtk_widget_show(stunServerLabel);
// gtk_widget_show(stunServerEntry);
} else {
gtk_widget_set_sensitive(localPortLabel, TRUE);
gtk_widget_set_sensitive(localPortSpinBox, TRUE);
gtk_widget_set_sensitive(localAddressLabel, TRUE);
gtk_widget_set_sensitive(localAddressCombo, TRUE);
gtk_widget_set_sensitive(stunServerLabel, FALSE);
gtk_widget_set_sensitive(stunServerEntry, FALSE);
// gtk_widget_hide(stunServerLabel);
// gtk_widget_hide(stunServerEntry);
}
}
static same_as_local_cb(GtkWidget * widget, gpointer data UNUSED)
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
DEBUG("Same as local");
gchar * ip_address = (gchar *) gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo));
gtk_entry_set_text(GTK_ENTRY(publishedAddressEntry), ip_address);
gchar * local_port = (gchar *) gtk_entry_get_text(GTK_ENTRY(localPortSpinBox));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(publishedPortSpinBox), g_ascii_strtod(local_port, NULL));
}
}
static set_published_addr_manually_cb(GtkWidget * widget, gpointer data UNUSED)
{
DEBUG("set_published_addr_manually_cb");
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
DEBUG("Showing manual options");
gtk_widget_show(publishedPortLabel);
gtk_widget_show(publishedPortSpinBox);
gtk_widget_show(publishedAddressLabel);
gtk_widget_show(publishedAddressEntry);
} else {
DEBUG("Hiding manual options");
gtk_widget_hide(publishedPortLabel);
gtk_widget_hide(publishedPortSpinBox);
gtk_widget_hide(publishedAddressLabel);
gtk_widget_hide(publishedAddressEntry);
}
}
GtkWidget * create_security_tab(account_t **a) GtkWidget * create_security_tab(account_t **a)
{ {
GtkWidget * frame; GtkWidget * frame;
...@@ -442,6 +502,9 @@ GtkWidget * create_security_tab(account_t **a) ...@@ -442,6 +502,9 @@ GtkWidget * create_security_tab(account_t **a)
gchar * curKeyExchange = NULL; gchar * curKeyExchange = NULL;
gchar * curTLSEnabled = NULL; gchar * curTLSEnabled = NULL;
gchar* published_address;
gchar* published_port;
// Load from SIP/IAX/Unknown ? // Load from SIP/IAX/Unknown ?
if(currentAccount) { if(currentAccount) {
curKeyExchange = g_hash_table_lookup(currentAccount->properties, ACCOUNT_KEY_EXCHANGE); curKeyExchange = g_hash_table_lookup(currentAccount->properties, ACCOUNT_KEY_EXCHANGE);
...@@ -459,6 +522,10 @@ GtkWidget * create_security_tab(account_t **a) ...@@ -459,6 +522,10 @@ GtkWidget * create_security_tab(account_t **a)
curTLSEnabled = "false"; curTLSEnabled = "false";
} }
published_address = g_hash_table_lookup(currentAccount->properties, PUBLISHED_ADDRESS);
published_port = g_hash_table_lookup(currentAccount->properties, PUBLISHED_PORT);
DEBUG("TLS is enabled to %s", curTLSEnabled); DEBUG("TLS is enabled to %s", curTLSEnabled);
} }
...@@ -531,13 +598,14 @@ GtkWidget * create_security_tab(account_t **a) ...@@ -531,13 +598,14 @@ GtkWidget * create_security_tab(account_t **a)
g_signal_connect (deleteCredButton, "clicked", G_CALLBACK (delete_credential_cb), treeViewCredential); g_signal_connect (deleteCredButton, "clicked", G_CALLBACK (delete_credential_cb), treeViewCredential);
gtk_box_pack_start(GTK_BOX(hbox), deleteCredButton, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), deleteCredButton, FALSE, FALSE, 0);
/* SRTP Section */ /* Security Section */
gnome_main_section_new_with_table (_("Security"), &frame, &table, 2, 3); gnome_main_section_new_with_table (_("Security"), &frame, &table, 2, 3);
gtk_container_set_border_width (GTK_CONTAINER(table), 10); gtk_container_set_border_width (GTK_CONTAINER(table), 10);
gtk_table_set_row_spacings (GTK_TABLE(table), 10); gtk_table_set_row_spacings (GTK_TABLE(table), 10);
gtk_table_set_col_spacings( GTK_TABLE(table), 10); gtk_table_set_col_spacings( GTK_TABLE(table), 10);
gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
/* TLS Section */
GtkWidget * sipTlsAdvancedButton; GtkWidget * sipTlsAdvancedButton;
sipTlsAdvancedButton = gtk_button_new_from_stock(GTK_STOCK_EDIT); sipTlsAdvancedButton = gtk_button_new_from_stock(GTK_STOCK_EDIT);
gtk_table_attach_defaults(GTK_TABLE(table), sipTlsAdvancedButton, 2, 3, 0, 1); gtk_table_attach_defaults(GTK_TABLE(table), sipTlsAdvancedButton, 2, 3, 0, 1);
...@@ -549,6 +617,35 @@ GtkWidget * create_security_tab(account_t **a) ...@@ -549,6 +617,35 @@ GtkWidget * create_security_tab(account_t **a)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(useSipTlsCheckBox), (g_strcmp0(curTLSEnabled, "true") == 0) ? TRUE:FALSE); 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); gtk_table_attach_defaults(GTK_TABLE(table), useSipTlsCheckBox, 0, 2, 0, 1);
sameAsLocalRadioButton = gtk_radio_button_new_with_mnemonic_from_widget(NULL, _("Same as local parameters"));
gtk_table_attach_defaults(GTK_TABLE(table), sameAsLocalRadioButton, 0, 2, 1, 2);
publishedAddrRadioButton = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(sameAsLocalRadioButton), _("Manually"));
gtk_table_attach_defaults(GTK_TABLE(table), publishedAddrRadioButton, 0, 2, 2, 3);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sameAsLocalRadioButton), TRUE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(publishedAddrRadioButton), FALSE);
g_signal_connect(sameAsLocalRadioButton, "toggled", G_CALLBACK(same_as_local_cb), sameAsLocalRadioButton);
g_signal_connect(publishedAddrRadioButton, "toggled", G_CALLBACK(set_published_addr_manually_cb), publishedAddrRadioButton);
publishedAddressLabel = gtk_label_new_with_mnemonic (_("Published address"));
gtk_table_attach_defaults( GTK_TABLE(table), publishedAddressLabel, 0, 1, 3, 4);
gtk_misc_set_alignment(GTK_MISC (publishedAddressLabel), 0, 0.5);
publishedAddressEntry = gtk_entry_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (publishedAddressLabel), publishedAddressEntry);
gtk_entry_set_text(GTK_ENTRY(publishedAddressEntry), published_address);
gtk_table_attach_defaults( GTK_TABLE(table), publishedAddressEntry, 1, 2, 3, 4);
publishedPortLabel = gtk_label_new_with_mnemonic(_("Published port"));
gtk_table_attach_defaults(GTK_TABLE(table), publishedPortLabel, 0, 1, 4, 5);
gtk_misc_set_alignment(GTK_MISC(publishedPortLabel), 0, 0.5);
publishedPortSpinBox = gtk_spin_button_new_with_range(1, 65535, 1);
gtk_label_set_mnemonic_widget(GTK_LABEL (publishedPortLabel), publishedPortSpinBox);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(publishedPortSpinBox), g_ascii_strtod(published_port, NULL));
gtk_table_attach_defaults(GTK_TABLE(table), publishedPortSpinBox, 1, 2, 4, 5);
/* SRTP Section */
label = gtk_label_new_with_mnemonic (_("SRTP key exchange")); label = gtk_label_new_with_mnemonic (_("SRTP key exchange"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
keyExchangeCombo = gtk_combo_box_new_text(); keyExchangeCombo = gtk_combo_box_new_text();
...@@ -575,9 +672,9 @@ GtkWidget * create_security_tab(account_t **a) ...@@ -575,9 +672,9 @@ GtkWidget * create_security_tab(account_t **a)
g_signal_connect (G_OBJECT (GTK_COMBO_BOX(keyExchangeCombo)), "changed", G_CALLBACK (key_exchange_changed_cb), currentAccount); g_signal_connect (G_OBJECT (GTK_COMBO_BOX(keyExchangeCombo)), "changed", G_CALLBACK (key_exchange_changed_cb), currentAccount);
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 5, 6);
gtk_table_attach_defaults(GTK_TABLE(table), keyExchangeCombo, 1, 2, 1, 2); gtk_table_attach_defaults(GTK_TABLE(table), keyExchangeCombo, 1, 2, 5, 6);
gtk_table_attach_defaults(GTK_TABLE(table), advancedZrtpButton, 2, 3, 1, 2); gtk_table_attach_defaults(GTK_TABLE(table), advancedZrtpButton, 2, 3, 5, 6);
gtk_widget_show_all(table); gtk_widget_show_all(table);
...@@ -590,49 +687,12 @@ GtkWidget * create_security_tab(account_t **a) ...@@ -590,49 +687,12 @@ GtkWidget * create_security_tab(account_t **a)
gtk_widget_show_all(ret); gtk_widget_show_all(ret);
return ret; same_as_local_cb(sameAsLocalRadioButton, NULL);
} set_published_addr_manually_cb(publishedAddrRadioButton, NULL);
static use_stun_cb(GtkWidget * widget, gpointer data UNUSED) return ret;
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
DEBUG("Showing stun options");
gtk_widget_show(stunServerLabel);
gtk_widget_show(stunServerEntry);
} else {
gtk_widget_hide(stunServerLabel);
gtk_widget_hide(stunServerEntry);
}
}
static same_as_local_cb(GtkWidget * widget, gpointer data UNUSED)
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
DEBUG("Same as local");
gchar * ip_address = (gchar *) gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo));
gtk_entry_set_text(GTK_ENTRY(publishedAddressEntry), ip_address);
gchar * local_port = (gchar *) gtk_entry_get_text(GTK_ENTRY(localPortSpinBox));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(publishedPortSpinBox), g_ascii_strtod(local_port, NULL));
}
} }
static set_published_addr_manually_cb(GtkWidget * widget, gpointer data UNUSED)
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
DEBUG("Showing manual options");
gtk_widget_show(publishedPortLabel);
gtk_widget_show(publishedPortSpinBox);
gtk_widget_show(publishedAddressLabel);
gtk_widget_show(publishedAddressEntry);
} else {
gtk_widget_hide(publishedPortLabel);
gtk_widget_hide(publishedPortSpinBox);
gtk_widget_hide(publishedAddressLabel);
gtk_widget_hide(publishedAddressEntry);
}
}
GtkWidget * create_advanced_tab(account_t **a) GtkWidget * create_advanced_tab(account_t **a)
{ {
...@@ -651,8 +711,8 @@ GtkWidget * create_advanced_tab(account_t **a) ...@@ -651,8 +711,8 @@ GtkWidget * create_advanced_tab(account_t **a)
gchar * resolve_once = NULL; gchar * resolve_once = NULL;
gchar * account_expire = NULL; gchar * account_expire = NULL;
gchar * use_tls; gchar * use_tls;
gchar * published_address; // gchar * published_address;
gchar * published_port; // gchar * published_port;
gchar * local_address; gchar * local_address;
gchar * local_port; gchar * local_port;
gchar * stun_enable; gchar * stun_enable;
...@@ -666,8 +726,8 @@ GtkWidget * create_advanced_tab(account_t **a) ...@@ -666,8 +726,8 @@ GtkWidget * create_advanced_tab(account_t **a)
use_tls = g_hash_table_lookup(currentAccount->properties, TLS_ENABLE); use_tls = g_hash_table_lookup(currentAccount->properties, TLS_ENABLE);
local_port = g_hash_table_lookup(currentAccount->properties, LOCAL_PORT); local_port = g_hash_table_lookup(currentAccount->properties, LOCAL_PORT);
local_address = g_hash_table_lookup(currentAccount->properties, LOCAL_ADDRESS); local_address = g_hash_table_lookup(currentAccount->properties, LOCAL_ADDRESS);
published_address = g_hash_table_lookup(currentAccount->properties, PUBLISHED_ADDRESS); // published_address = g_hash_table_lookup(currentAccount->properties, PUBLISHED_ADDRESS);
published_port = g_hash_table_lookup(currentAccount->properties, PUBLISHED_PORT); // published_port = g_hash_table_lookup(currentAccount->properties, PUBLISHED_PORT);
stun_enable = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_STUN_ENABLED); stun_enable = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_STUN_ENABLED);
stun_server = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_STUN_SERVER); stun_server = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_STUN_SERVER);
} }
...@@ -707,9 +767,9 @@ GtkWidget * create_advanced_tab(account_t **a) ...@@ -707,9 +767,9 @@ GtkWidget * create_advanced_tab(account_t **a)
GtkTreeIter iter; GtkTreeIter iter;
ipInterfaceListStore = gtk_list_store_new( 1, G_TYPE_STRING ); ipInterfaceListStore = gtk_list_store_new( 1, G_TYPE_STRING );
label = gtk_label_new_with_mnemonic (_("Local address")); localAddressLabel = gtk_label_new_with_mnemonic (_("Local address"));
gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); 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 (label), 0, 0.5); gtk_misc_set_alignment(GTK_MISC (localAddressLabel), 0, 0.5);
GtkTreeIter current_local_address_iter = iter; GtkTreeIter current_local_address_iter = iter;
gchar ** iface_list = NULL; gchar ** iface_list = NULL;
...@@ -730,7 +790,7 @@ GtkWidget * create_advanced_tab(account_t **a) ...@@ -730,7 +790,7 @@ GtkWidget * create_advanced_tab(account_t **a)
} }
localAddressCombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ipInterfaceListStore)); localAddressCombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(ipInterfaceListStore));
gtk_label_set_mnemonic_widget(GTK_LABEL(label), localAddressCombo); 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); 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)); g_object_unref(G_OBJECT(ipInterfaceListStore));
...@@ -744,32 +804,45 @@ GtkWidget * create_advanced_tab(account_t **a) ...@@ -744,32 +804,45 @@ GtkWidget * create_advanced_tab(account_t **a)
/** /**
* Local port * Local port
*/ */
label = gtk_label_new_with_mnemonic (_("Local port")); localPortLabel = gtk_label_new_with_mnemonic (_("Local port"));
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2); gtk_table_attach_defaults(GTK_TABLE(table), localPortLabel, 0, 1, 1, 2);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); gtk_misc_set_alignment(GTK_MISC (localPortLabel), 0, 0.5);
localPortSpinBox = gtk_spin_button_new_with_range(1, 65535, 1); localPortSpinBox = gtk_spin_button_new_with_range(1, 65535, 1);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), localPortSpinBox); gtk_label_set_mnemonic_widget (GTK_LABEL (localPortLabel), localPortSpinBox);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(localPortSpinBox), g_ascii_strtod(local_port, NULL)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(localPortSpinBox), g_ascii_strtod(local_port, NULL));
gtk_table_attach_defaults(GTK_TABLE(table), localPortSpinBox, 1, 2, 1, 2); gtk_table_attach_defaults(GTK_TABLE(table), localPortSpinBox, 1, 2, 1, 2);
label = gtk_label_new_with_mnemonic (_("Set published address and port:")); // label = gtk_label_new_with_mnemonic (_("Set published address and port:"));
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 2, 2, 3); // gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 2, 2, 3);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); // gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
useStunCheckBox = gtk_check_button_new_with_mnemonic(_("Using STUN "));
gtk_table_attach_defaults(GTK_TABLE(table), useStunCheckBox, 0, 2, 3, 4);
gtk_widget_set_sensitive (GTK_WIDGET(useStunCheckBox), g_strcasecmp(use_tls,"true") == 0 ? FALSE: TRUE);
g_signal_connect(useStunCheckBox, "toggled", G_CALLBACK(use_stun_cb), useStunCheckBox);
useStunRadioButton = gtk_radio_button_new_with_mnemonic(NULL,_("Using STUN ")); stunServerLabel = gtk_label_new_with_mnemonic (_("STUN server URL"));
gtk_table_attach_defaults(GTK_TABLE(table), useStunRadioButton, 0, 2, 3, 4); gtk_table_attach_defaults(GTK_TABLE(table), stunServerLabel, 0, 1, 8, 9);
gtk_widget_set_sensitive (GTK_WIDGET(useStunRadioButton), gtk_misc_set_alignment(GTK_MISC(stunServerLabel), 0, 0.5);
g_strcasecmp(use_tls,"true") == 0 ? FALSE: TRUE); stunServerEntry = gtk_entry_new();
gtk_label_set_mnemonic_widget(GTK_LABEL(stunServerLabel), stunServerEntry);
gtk_entry_set_text(GTK_ENTRY(stunServerEntry), stun_server);
gtk_table_attach_defaults(GTK_TABLE(table), stunServerEntry, 1, 2, 8, 9);
// use_stun_cb (GTK_WIDGET (useStunCheckBox), NULL);
/*
sameAsLocalRadioButton = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(useStunRadioButton), _("Same as local parameters")); 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); gtk_table_attach_defaults(GTK_TABLE(table), sameAsLocalRadioButton, 0, 2, 4, 5);
publishedAddrRadioButton = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(useStunRadioButton), _("Manually")); publishedAddrRadioButton = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(useStunRadioButton), _("Manually"));
gtk_table_attach_defaults(GTK_TABLE(table), publishedAddrRadioButton, 0, 2, 5, 6); gtk_table_attach_defaults(GTK_TABLE(table), publishedAddrRadioButton, 0, 2, 5, 6);
*/
gtk_widget_show_all(ret); gtk_widget_show_all(ret);
use_stun_cb (GTK_WIDGET (useStunCheckBox), NULL);
/*
publishedAddressLabel = gtk_label_new_with_mnemonic (_("Published address")); publishedAddressLabel = gtk_label_new_with_mnemonic (_("Published address"));
gtk_table_attach_defaults( GTK_TABLE(table), publishedAddressLabel, 0, 1, 6, 7); gtk_table_attach_defaults( GTK_TABLE(table), publishedAddressLabel, 0, 1, 6, 7);
gtk_misc_set_alignment(GTK_MISC (publishedAddressLabel), 0, 0.5); gtk_misc_set_alignment(GTK_MISC (publishedAddressLabel), 0, 0.5);
...@@ -785,24 +858,15 @@ GtkWidget * create_advanced_tab(account_t **a) ...@@ -785,24 +858,15 @@ GtkWidget * create_advanced_tab(account_t **a)
gtk_label_set_mnemonic_widget(GTK_LABEL (publishedPortLabel), publishedPortSpinBox); gtk_label_set_mnemonic_widget(GTK_LABEL (publishedPortLabel), publishedPortSpinBox);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(publishedPortSpinBox), g_ascii_strtod(published_port, NULL)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(publishedPortSpinBox), g_ascii_strtod(published_port, NULL));
gtk_table_attach_defaults(GTK_TABLE(table), publishedPortSpinBox, 1, 2, 7, 8); gtk_table_attach_defaults(GTK_TABLE(table), publishedPortSpinBox, 1, 2, 7, 8);
*/
stunServerLabel = gtk_label_new_with_mnemonic (_("STUN server URL"));
gtk_table_attach_defaults(GTK_TABLE(table), stunServerLabel, 0, 1, 8, 9);
gtk_misc_set_alignment(GTK_MISC(stunServerLabel), 0, 0.5);
stunServerEntry = gtk_entry_new();
gtk_label_set_mnemonic_widget(GTK_LABEL(stunServerLabel), stunServerEntry);
gtk_entry_set_text(GTK_ENTRY(stunServerEntry), stun_server);
gtk_table_attach_defaults(GTK_TABLE(table), stunServerEntry, 1, 2, 8, 9);
use_stun_cb (GTK_WIDGET (useStunRadioButton), NULL);
// This will trigger a signal, and the above two // This will trigger a signal, and the above two
// widgets need to be instanciated before that. // widgets need to be instanciated before that.
g_signal_connect(useStunRadioButton, "toggled", G_CALLBACK(use_stun_cb), useStunRadioButton); // g_signal_connect(useStunRadioButton, "toggled", G_CALLBACK(use_stun_cb), useStunRadioButton);
g_signal_connect(sameAsLocalRadioButton, "toggled", G_CALLBACK(same_as_local_cb), sameAsLocalRadioButton); // g_signal_connect(sameAsLocalRadioButton, "toggled", G_CALLBACK(same_as_local_cb), sameAsLocalRadioButton);
g_signal_connect(publishedAddrRadioButton, "toggled", G_CALLBACK(set_published_addr_manually_cb), publishedAddrRadioButton); // g_signal_connect(publishedAddrRadioButton, "toggled", G_CALLBACK(set_published_addr_manually_cb), publishedAddrRadioButton);
/*
if (g_strcasecmp(stun_enable,"true") == 0) { if (g_strcasecmp(stun_enable,"true") == 0) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(useStunRadioButton), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(useStunRadioButton), TRUE);
} else if ((g_strcasecmp(published_address, local_address) == 0) } else if ((g_strcasecmp(published_address, local_address) == 0)
...@@ -811,6 +875,7 @@ GtkWidget * create_advanced_tab(account_t **a) ...@@ -811,6 +875,7 @@ GtkWidget * create_advanced_tab(account_t **a)
} else { } else {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(publishedAddrRadioButton), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(publishedAddrRadioButton), TRUE);
} }
*/
return ret; return ret;
} }
...@@ -955,7 +1020,7 @@ show_account_window (account_t * a) ...@@ -955,7 +1020,7 @@ show_account_window (account_t * a)
if (strcmp(proto, "SIP") == 0) { if (strcmp(proto, "SIP") == 0) {
g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SIP_STUN_ENABLED), g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SIP_STUN_ENABLED),
g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(useStunRadioButton)) ? "true":"false")); g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(useStunCheckBox)) ? "true":"false"));
g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SIP_STUN_SERVER), g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SIP_STUN_SERVER),
g_strdup(gtk_entry_get_text(GTK_ENTRY(stunServerEntry)))); g_strdup(gtk_entry_get_text(GTK_ENTRY(stunServerEntry))));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment