gnome: TURN server credentials UI
depends on lrc commit 1ec69c9116550c85dce3c7bb9ee45b41cc2cb25d
Issue: #78301
Change-Id: I69a6e58b60921990b75ccf8d312d6b57d315621b
diff --git a/src/accountadvancedtab.cpp b/src/accountadvancedtab.cpp
index 372845f..1aeeaa3 100644
--- a/src/accountadvancedtab.cpp
+++ b/src/accountadvancedtab.cpp
@@ -68,9 +68,14 @@
GtkWidget *spinbutton_published_port;
GtkWidget *adjustment_published_port;
GtkWidget *checkbutton_use_stun;
- GtkWidget *entry_stun_server;
+ GtkWidget *grid_stun;
+ GtkWidget *entry_stunserver;
GtkWidget *checkbutton_use_turn;
- GtkWidget *entry_turn_server;
+ GtkWidget *grid_turn;
+ GtkWidget *entry_turnserver;
+ GtkWidget *entry_turnusername;
+ GtkWidget *entry_turnpassword;
+ GtkWidget *entry_turnrealm;
GtkWidget *adjustment_audio_port_min;
GtkWidget *adjustment_audio_port_max;
GtkWidget *adjustment_video_port_min;
@@ -128,9 +133,14 @@
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, spinbutton_published_port);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, adjustment_published_port);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, checkbutton_use_stun);
- gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, entry_stun_server);
+ gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, grid_stun);
+ gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, entry_stunserver);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, checkbutton_use_turn);
- gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, entry_turn_server);
+ gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, grid_turn);
+ gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, entry_turnserver);
+ gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, entry_turnusername);
+ gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, entry_turnpassword);
+ gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, entry_turnrealm);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, adjustment_audio_port_min);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, adjustment_audio_port_max);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountAdvancedTab, adjustment_video_port_min);
@@ -206,7 +216,7 @@
priv->account->setSipStunEnabled(use_stun);
/* disactivate the stun server entry if stun is disabled */
- gtk_widget_set_sensitive(priv->entry_stun_server, use_stun);
+ gtk_widget_set_sensitive(priv->grid_stun, use_stun);
}
static void
@@ -229,7 +239,7 @@
priv->account->setTurnEnabled(use_turn);
/* disactivate the turn server entry if turn is disabled */
- gtk_widget_set_sensitive(priv->entry_turn_server, use_turn);
+ gtk_widget_set_sensitive(priv->grid_turn, use_turn);
}
static void
@@ -242,6 +252,33 @@
}
static void
+turn_serverusername_changed(GtkEntry *entry, AccountAdvancedTab *self)
+{
+ g_return_if_fail(IS_ACCOUNT_ADVANCED_TAB(self));
+ AccountAdvancedTabPrivate *priv = ACCOUNT_ADVANCED_TAB_GET_PRIVATE(self);
+
+ priv->account->setTurnServerUsername(gtk_entry_get_text(entry));
+}
+
+static void
+turn_serverpassword_changed(GtkEntry *entry, AccountAdvancedTab *self)
+{
+ g_return_if_fail(IS_ACCOUNT_ADVANCED_TAB(self));
+ AccountAdvancedTabPrivate *priv = ACCOUNT_ADVANCED_TAB_GET_PRIVATE(self);
+
+ priv->account->setTurnServerPassword(gtk_entry_get_text(entry));
+}
+
+static void
+turn_serverrealm_changed(GtkEntry *entry, AccountAdvancedTab *self)
+{
+ g_return_if_fail(IS_ACCOUNT_ADVANCED_TAB(self));
+ AccountAdvancedTabPrivate *priv = ACCOUNT_ADVANCED_TAB_GET_PRIVATE(self);
+
+ priv->account->setTurnServerRealm(gtk_entry_get_text(entry));
+}
+
+static void
audio_port_min_changed(GtkAdjustment *adjustment, AccountAdvancedTab *self)
{
g_return_if_fail(IS_ACCOUNT_ADVANCED_TAB(self));
@@ -412,26 +449,38 @@
/* STUN */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_use_stun),
priv->account->isSipStunEnabled());
- gtk_entry_set_text(GTK_ENTRY(priv->entry_stun_server),
+ gtk_entry_set_text(GTK_ENTRY(priv->entry_stunserver),
priv->account->sipStunServer().toUtf8().constData());
- gtk_widget_set_sensitive(priv->entry_stun_server,
+ gtk_widget_set_sensitive(priv->grid_stun,
priv->account->isSipStunEnabled());
g_signal_connect(priv->checkbutton_use_stun,
"toggled", G_CALLBACK(stun_enabled_toggled), self);
- g_signal_connect(priv->entry_stun_server,
+ g_signal_connect(priv->entry_stunserver,
"changed", G_CALLBACK(stun_server_changed), self);
/* TURN */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_use_turn),
priv->account->isTurnEnabled());
- gtk_entry_set_text(GTK_ENTRY(priv->entry_turn_server),
+ gtk_entry_set_text(GTK_ENTRY(priv->entry_turnserver),
priv->account->turnServer().toUtf8().constData());
- gtk_widget_set_sensitive(priv->entry_turn_server,
+ gtk_entry_set_text(GTK_ENTRY(priv->entry_turnusername),
+ priv->account->turnServerUsername().toUtf8().constData());
+ gtk_entry_set_text(GTK_ENTRY(priv->entry_turnpassword),
+ priv->account->turnServerPassword().toUtf8().constData());
+ gtk_entry_set_text(GTK_ENTRY(priv->entry_turnrealm),
+ priv->account->turnServerRealm().toUtf8().constData());
+ gtk_widget_set_sensitive(priv->grid_turn,
priv->account->isTurnEnabled());
g_signal_connect(priv->checkbutton_use_turn,
"toggled", G_CALLBACK(turn_enabled_toggled), self);
- g_signal_connect(priv->entry_turn_server,
+ g_signal_connect(priv->entry_turnserver,
"changed", G_CALLBACK(turn_server_changed), self);
+ g_signal_connect(priv->entry_turnusername,
+ "changed", G_CALLBACK(turn_serverusername_changed), self);
+ g_signal_connect(priv->entry_turnpassword,
+ "changed", G_CALLBACK(turn_serverpassword_changed), self);
+ g_signal_connect(priv->entry_turnrealm,
+ "changed", G_CALLBACK(turn_serverrealm_changed), self);
/* audio/video rtp port range */
gtk_adjustment_set_value(GTK_ADJUSTMENT(priv->adjustment_audio_port_min),
@@ -496,14 +545,22 @@
/* STUN */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_use_stun),
priv->account->isSipStunEnabled());
- gtk_entry_set_text(GTK_ENTRY(priv->entry_stun_server),
+ gtk_widget_set_sensitive(priv->grid_stun, priv->account->isSipStunEnabled());
+ gtk_entry_set_text(GTK_ENTRY(priv->entry_stunserver),
priv->account->sipStunServer().toUtf8().constData());
/* TURN */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_use_turn),
priv->account->isTurnEnabled());
- gtk_entry_set_text(GTK_ENTRY(priv->entry_turn_server),
+ gtk_widget_set_sensitive(priv->grid_turn, priv->account->isTurnEnabled());
+ gtk_entry_set_text(GTK_ENTRY(priv->entry_turnserver),
priv->account->turnServer().toUtf8().constData());
+ gtk_entry_set_text(GTK_ENTRY(priv->entry_turnusername),
+ priv->account->turnServerUsername().toUtf8().constData());
+ gtk_entry_set_text(GTK_ENTRY(priv->entry_turnpassword),
+ priv->account->turnServerPassword().toUtf8().constData());
+ gtk_entry_set_text(GTK_ENTRY(priv->entry_turnrealm),
+ priv->account->turnServerRealm().toUtf8().constData());
/* audio/video rtp port range */
gtk_adjustment_set_value(GTK_ADJUSTMENT(priv->adjustment_audio_port_min),
diff --git a/ui/accountadvancedtab.ui b/ui/accountadvancedtab.ui
index 3130715..577e227 100644
--- a/ui/accountadvancedtab.ui
+++ b/ui/accountadvancedtab.ui
@@ -83,7 +83,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
</packing>
</child>
<child>
@@ -155,7 +154,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
</packing>
</child>
<child>
@@ -201,7 +199,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
</packing>
</child>
<child>
@@ -213,7 +210,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
</packing>
</child>
</object>
@@ -232,7 +228,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
</packing>
</child>
<child>
@@ -262,7 +257,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
</packing>
</child>
<child>
@@ -279,7 +273,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
</packing>
</child>
<child>
@@ -297,7 +290,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
</packing>
</child>
<child>
@@ -308,7 +300,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
</packing>
</child>
<child>
@@ -321,7 +312,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
</packing>
</child>
<child>
@@ -333,93 +323,176 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
</packing>
</child>
<child>
- <object class="GtkBox" id="box_stun">
+ <object class="GtkCheckButton" id="checkbutton_use_stun">
+ <property name="label" translatable="yes">Use STUN</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
<property name="margin_top">20</property>
- <property name="spacing">10</property>
- <child>
- <object class="GtkCheckButton" id="checkbutton_use_stun">
- <property name="label" translatable="yes">Use STUN</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="entry_stun_server">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="placeholder_text" translatable="yes">server URL</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
</packing>
</child>
<child>
- <object class="GtkBox" id="box_turn">
+ <object class="GtkGrid" id="grid_stun">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">10</property>
+ <property name="row_spacing">10</property>
+ <property name="column_spacing">10</property>
+ <property name="margin_left">30</property>
<child>
- <object class="GtkCheckButton" id="checkbutton_use_turn">
- <property name="label" translatable="yes">Use TURN</property>
+ <object class="GtkLabel" id="label_stunserver">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
+ <property name="halign">end</property>
+ <property name="label" translatable="yes">server URL</property>
+ <property name="mnemonic_widget">entry_stunserver</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="entry_turn_server">
+ <object class="GtkEntry" id="entry_stunserver">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="placeholder_text" translatable="yes">server URL</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton_use_turn">
+ <property name="label" translatable="yes">Use TURN</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="margin_top">20</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid_turn">
+ <property name="visible">True</property>
+ <property name="row_spacing">10</property>
+ <property name="column_spacing">10</property>
+ <property name="margin_left">30</property>
+ <child>
+ <object class="GtkLabel" id="label_turnserver">
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <property name="label" translatable="yes">server URL</property>
+ <property name="mnemonic_widget">entry_turnserver</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_turnserver">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_turnusername">
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <property name="label" translatable="yes">username</property>
+ <property name="mnemonic_widget">entry_turnusername</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_turnusername">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_turnpassword">
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <property name="label" translatable="yes">password</property>
+ <property name="mnemonic_widget">entry_turnpassword</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_turnpassword">
+ <property name="visible">True</property>
+ <property name="visibility">False</property>
+ <property name="input_purpose">password</property>
+ <property name="primary-icon-name">dialog-password</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_turnrealm">
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <property name="label" translatable="yes">realm</property>
+ <property name="mnemonic_widget">entry_turnrealm</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_turnrealm">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
</packing>
</child>
</object>
@@ -436,7 +509,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
</packing>
</child>
<child>
@@ -464,7 +536,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
</packing>
</child>
<child>
@@ -489,7 +560,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
</packing>
</child>
<child>
@@ -501,7 +571,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
</packing>
</child>
<child>
@@ -514,7 +583,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
</packing>
</child>
<child>
@@ -526,7 +594,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
</packing>
</child>
</object>
@@ -543,7 +610,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
</packing>
</child>
<child>
@@ -568,7 +634,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
</packing>
</child>
<child>
@@ -580,7 +645,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
</packing>
</child>
<child>
@@ -593,7 +657,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
</packing>
</child>
<child>
@@ -605,7 +668,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
</packing>
</child>
</object>
@@ -622,7 +684,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
</packing>
</child>
</object>
@@ -639,14 +700,12 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
</packing>
</child>
</template>