100
100
static GtkWidget *audio_port_min_spin_box;
101
101
static GtkWidget *audio_port_max_spin_box;
103
static GtkWidget *enable_video_button;
103
104
static GtkWidget *video_port_min_spin_box;
104
105
static GtkWidget *video_port_max_spin_box;
145
146
gtk_toggle_button_get_active(widget) ? "true" : "false");
150
user_agent_checkbox_cb(GtkToggleButton *widget, account_t *account)
152
const gboolean is_active = gtk_toggle_button_get_active(widget);
153
account_replace(account, CONFIG_ACCOUNT_HAS_CUSTOM_USERAGENT,
154
is_active ? "true" : "false");
155
gtk_widget_set_sensitive(entry_user_agent, is_active);
149
159
* Display / Hide the password
244
254
return auto_answer_checkbox;
258
create_user_agent_checkbox(const account_t *account)
260
GtkWidget *user_agent_checkbox = gtk_check_button_new_with_mnemonic(_("_Use custom user-agent"));
261
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user_agent_checkbox), account_has_custom_user_agent(account));
262
g_signal_connect(user_agent_checkbox, "toggled", G_CALLBACK(user_agent_checkbox_cb), (gpointer) account);
263
return user_agent_checkbox;
248
267
alias_changed_cb(GtkEditable *editable, gpointer data)
250
269
const gchar *alias = gtk_entry_get_text(GTK_ENTRY(editable));
251
270
GtkDialog *dialog = GTK_DIALOG(data);
252
gtk_dialog_set_response_sensitive(dialog, GTK_RESPONSE_APPLY, strlen(alias));
271
gtk_dialog_set_response_sensitive(dialog, GTK_RESPONSE_APPLY, !!strlen(alias));
358
377
gtk_grid_attach(GTK_GRID(grid), label, 0, row, 1, 1);
359
378
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
360
379
entry_password = gtk_entry_new();
361
gtk_entry_set_icon_from_stock(GTK_ENTRY(entry_password),
362
GTK_ENTRY_ICON_PRIMARY,
363
GTK_STOCK_DIALOG_AUTHENTICATION);
380
gtk_entry_set_icon_from_icon_name(GTK_ENTRY(entry_password),
381
GTK_ENTRY_ICON_PRIMARY, "dialog-password");
364
383
gtk_entry_set_visibility(GTK_ENTRY(entry_password), FALSE);
365
384
gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry_password);
366
385
password = password ? password : "";
408
427
gtk_entry_set_text(GTK_ENTRY(entry_user_agent), user_agent);
409
428
gtk_grid_attach(GTK_GRID(grid), entry_user_agent, 1, row, 1, 1);
430
gtk_widget_set_sensitive(entry_user_agent, account_has_custom_user_agent(account));
433
GtkWidget *user_agent_checkbox = create_user_agent_checkbox(account);
434
gtk_grid_attach(GTK_GRID(grid), user_agent_checkbox, 0, row, 1, 1);
412
437
GtkWidget *auto_answer_checkbox = create_auto_answer_checkbox(account);
413
438
gtk_grid_attach(GTK_GRID(grid), auto_answer_checkbox, 0, row, 1, 1);
707
static void use_stun_cb(GtkWidget *widget, G_GNUC_UNUSED gpointer data)
733
use_stun_cb(GtkWidget *widget, G_GNUC_UNUSED gpointer data)
709
735
/* Widgets have not been created yet */
710
if (!stun_server_label)
736
g_return_if_fail(stun_server_label || stun_server_entry ||
737
same_as_local_radio_button ||
738
published_addr_radio_button || published_address_label ||
739
published_port_label || published_address_entry ||
740
published_port_spin_box);
713
742
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
714
743
g_debug("Showing stun options, hiding Local/Published info");
815
844
gtk_grid_attach(GTK_GRID(grid), hbox, 0, 1, 2, 1);
817
GtkWidget *addButton = gtk_button_new_from_stock(GTK_STOCK_ADD);
846
GtkWidget *addButton = gtk_button_new_with_label(_("Add"));
818
847
g_signal_connect(addButton, "clicked", G_CALLBACK(add_credential_cb), credential_store);
819
848
gtk_box_pack_start(GTK_BOX(hbox), addButton, FALSE, FALSE, 0);
821
delete_cred_button = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
850
delete_cred_button = gtk_button_new_with_label(_("Remove"));
822
851
g_signal_connect(delete_cred_button, "clicked", G_CALLBACK(delete_credential_cb), treeview_credential);
823
852
gtk_box_pack_start(GTK_BOX(hbox), delete_cred_button, FALSE, FALSE, 0);
862
891
OptionsData *options = g_new0(OptionsData, 1);
863
892
options->account = account;
864
893
options->client = client;
865
GtkWidget *sip_tls_advanced_button = gtk_button_new_from_stock(GTK_STOCK_EDIT);
894
GtkWidget *sip_tls_advanced_button = gtk_button_new_with_label(_("Edit"));
866
895
gtk_grid_attach(GTK_GRID(grid), sip_tls_advanced_button, 2, 0, 1, 1);
867
896
gtk_widget_set_sensitive(sip_tls_advanced_button, FALSE);
868
897
g_signal_connect(G_OBJECT(sip_tls_advanced_button), "clicked",
885
914
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(key_exchange_combo), "SDES");
886
915
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(key_exchange_combo), _("Disabled"));
888
zrtp_button = gtk_button_new_from_stock(GTK_STOCK_PREFERENCES);
917
zrtp_button = gtk_button_new_with_label(_("Preferences"));
889
918
g_signal_connect(G_OBJECT(zrtp_button), "clicked",
890
919
G_CALLBACK(show_advanced_zrtp_options_cb),
923
952
GtkWidget * ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);
924
953
gtk_container_set_border_width(GTK_CONTAINER(ret), 10);
927
GtkWidget * frame = create_credential_widget(account);
928
gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
957
if (!account_is_IP2IP(account)) {
959
frame = create_credential_widget(account);
960
gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
930
963
// Security frame
931
964
frame = create_security_widget(account, client);
1065
1098
use_stun_check_box = gtk_check_button_new_with_mnemonic(_("Using STUN"));
1066
1099
gtk_grid_attach(GTK_GRID(grid), use_stun_check_box, 0, 0, 1, 1);
1067
1100
g_signal_connect(use_stun_check_box, "toggled", G_CALLBACK(use_stun_cb), NULL);
1068
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(use_stun_check_box),
1069
utf8_case_equal(stun_enable, "true"));
1070
gtk_widget_set_sensitive(use_stun_check_box, !utf8_case_equal(use_tls, "true"));
1072
1102
stun_server_label = gtk_label_new_with_mnemonic(_("STUN server URL"));
1073
1103
gtk_grid_attach(GTK_GRID(grid), stun_server_label, 0, 1, 1, 1);
1117
1147
g_signal_connect(same_as_local_radio_button, "toggled", G_CALLBACK(same_as_local_cb), same_as_local_radio_button);
1118
1148
g_signal_connect(published_addr_radio_button, "toggled", G_CALLBACK(set_published_addr_manually_cb), published_addr_radio_button);
1150
/* Now that widgets have been initialized it's safe to invoke this signal */
1151
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(use_stun_check_box),
1152
utf8_case_equal(stun_enable, "true"));
1153
gtk_widget_set_sensitive(use_stun_check_box, !utf8_case_equal(use_tls, "true"));
1120
1155
set_published_addr_manually_cb(published_addr_radio_button, NULL);
1166
1201
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
1168
GtkWidget *frame = create_registration_expire(account);
1169
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
1205
if (!account_is_IP2IP(account)) {
1206
frame = create_registration_expire(account);
1207
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
1171
1210
frame = create_network(account);
1172
1211
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
1314
1353
gtk_widget_show(videocodecs);
1315
1354
gtk_container_add(GTK_CONTAINER (videocodecs), box);
1356
/* Check button to enable/disable video for an account */
1357
gpointer ptr = account_lookup(a, CONFIG_VIDEO_ENABLED);
1358
enable_video_button = gtk_check_button_new_with_mnemonic(_("_Enable video"));
1359
const gboolean video_enabled = g_strcmp0(ptr, "true") == 0;
1360
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_video_button), video_enabled);
1361
gtk_box_pack_start(GTK_BOX(vbox), enable_video_button, FALSE, FALSE, 0);
1317
1363
gtk_widget_show_all(vbox);
1338
1384
gtk_widget_set_size_request(label, 350, -1);
1339
1385
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
1341
GtkWidget *frame = create_network(account);
1342
gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
1344
1387
GtkWidget *auto_answer_checkbox = create_auto_answer_checkbox(account);
1345
1388
gtk_box_pack_start(GTK_BOX(vbox), auto_answer_checkbox, FALSE, FALSE, 0);
1363
1408
proto = g_strdup("SIP");
1365
1410
if (g_strcmp0(proto, "SIP") == 0) {
1366
account_replace(account, CONFIG_ACCOUNT_REGISTRATION_EXPIRE,
1367
gtk_entry_get_text(GTK_ENTRY(expire_spin_box)));
1369
account_replace(account, CONFIG_ACCOUNT_ROUTESET,
1370
gtk_entry_get_text(GTK_ENTRY(entry_route_set)));
1413
account_replace(account, CONFIG_ACCOUNT_REGISTRATION_EXPIRE,
1414
gtk_entry_get_text(GTK_ENTRY(expire_spin_box)));
1416
account_replace(account, CONFIG_ACCOUNT_ROUTESET,
1417
gtk_entry_get_text(GTK_ENTRY(entry_route_set)));
1372
1420
gboolean v = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(use_stun_check_box));
1373
1421
account_replace(account, CONFIG_STUN_ENABLE,
1393
1441
#ifdef SFL_PRESENCE
1394
v = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(presence_check_box));
1395
account_replace(account, CONFIG_PRESENCE_ENABLED, bool_to_string(v));
1396
// TODO enable/disable the presence window view
1443
v = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(presence_check_box));
1444
account_replace(account, CONFIG_PRESENCE_ENABLED, bool_to_string(v));
1445
// TODO enable/disable the presence window view
1399
1449
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(overrtp))) {
1432
1482
account_replace(account, CONFIG_ACCOUNT_USERAGENT,
1433
gtk_entry_get_text(GTK_ENTRY(entry_user_agent)));
1434
account_replace(account, CONFIG_ACCOUNT_ALIAS, gtk_entry_get_text(GTK_ENTRY(entry_alias)));
1435
account_replace(account, CONFIG_ACCOUNT_TYPE, proto);
1436
account_replace(account, CONFIG_ACCOUNT_HOSTNAME, gtk_entry_get_text(GTK_ENTRY(entry_hostname)));
1437
account_replace(account, CONFIG_ACCOUNT_USERNAME, gtk_entry_get_text(GTK_ENTRY(entry_username)));
1438
account_replace(account, CONFIG_ACCOUNT_PASSWORD, gtk_entry_get_text(GTK_ENTRY(entry_password)));
1439
account_replace(account, CONFIG_ACCOUNT_MAILBOX, gtk_entry_get_text(GTK_ENTRY(entry_mailbox)));
1483
gtk_entry_get_text(GTK_ENTRY(entry_user_agent)));
1486
account_replace(account, CONFIG_ACCOUNT_ALIAS, gtk_entry_get_text(GTK_ENTRY(entry_alias)));
1487
account_replace(account, CONFIG_ACCOUNT_TYPE, proto);
1488
account_replace(account, CONFIG_ACCOUNT_HOSTNAME, gtk_entry_get_text(GTK_ENTRY(entry_hostname)));
1489
account_replace(account, CONFIG_ACCOUNT_USERNAME, gtk_entry_get_text(GTK_ENTRY(entry_username)));
1490
account_replace(account, CONFIG_ACCOUNT_PASSWORD, gtk_entry_get_text(GTK_ENTRY(entry_password)));
1491
account_replace(account, CONFIG_ACCOUNT_MAILBOX, gtk_entry_get_text(GTK_ENTRY(entry_mailbox)));
1478
1531
const gboolean tone_enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enable_tone));
1479
1532
account_replace(account, CONFIG_RINGTONE_ENABLED, bool_to_string(tone_enabled));
1535
const gboolean video_enabled =
1536
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enable_video_button));
1537
account_replace(account, CONFIG_VIDEO_ENABLED, bool_to_string(video_enabled));
1481
1540
gchar *ringtone_path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_chooser));
1482
1541
account_replace(account, CONFIG_RINGTONE_PATH, ringtone_path);
1483
1542
g_free(ringtone_path);
1557
1616
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), videocodecs_tab, gtk_label_new(_("Video")));
1560
// Do not need advanced or security one for the IP2IP account
1563
advanced_tab = create_advanced_tab(account);
1564
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advanced_tab, gtk_label_new(_("Advanced")));
1567
security_tab = create_security_tab(account, client);
1568
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), security_tab, gtk_label_new(_("Security")));
1570
1620
/* Custom tab for the IP to IP profile */
1571
1621
GtkWidget *ip_tab = create_direct_ip_calls_tab(account);
1572
gtk_notebook_prepend_page(GTK_NOTEBOOK(notebook), ip_tab, gtk_label_new(_("Network")));
1622
gtk_notebook_prepend_page(GTK_NOTEBOOK(notebook), ip_tab, gtk_label_new(_("General")));
1626
advanced_tab = create_advanced_tab(account);
1627
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advanced_tab, gtk_label_new(_("Advanced")));
1630
security_tab = create_security_tab(account, client);
1631
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), security_tab, gtk_label_new(_("Security")));
1575
1633
// Emit signal to hide advanced and security tabs in case of IAX
1576
1634
if (protocol_combo)
1577
1635
g_signal_emit_by_name(protocol_combo, "changed", NULL);