mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-09-18 17:35:24 +00:00
sip-account-widget: Use adwaita rows for server settings
Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/738>
This commit is contained in:
parent
17325b3104
commit
e35c15ad7d
2 changed files with 35 additions and 72 deletions
|
@ -65,18 +65,18 @@ struct _CallsSipAccountWidget {
|
||||||
GtkWidget *delete_btn;
|
GtkWidget *delete_btn;
|
||||||
|
|
||||||
/* widgets for editing account credentials */
|
/* widgets for editing account credentials */
|
||||||
GtkEntry *host;
|
AdwEntryRow *host;
|
||||||
GtkEntry *display_name;
|
AdwEntryRow *display_name;
|
||||||
GtkEntry *user;
|
AdwEntryRow *user;
|
||||||
GtkEntry *password;
|
AdwEntryRow *password;
|
||||||
GtkEntry *port;
|
AdwEntryRow *port;
|
||||||
char *last_port;
|
char *last_port;
|
||||||
AdwComboRow *protocol;
|
AdwComboRow *protocol;
|
||||||
GtkStringList *protocols_store; /* bound model for protocol AdwComboRow */
|
GtkStringList *protocols_store; /* bound model for protocol AdwComboRow */
|
||||||
AdwComboRow *media_encryption;
|
AdwComboRow *media_encryption;
|
||||||
GListStore *media_encryption_store;
|
GListStore *media_encryption_store;
|
||||||
GtkSwitch *tel_switch;
|
AdwSwitchRow *tel_switch;
|
||||||
GtkSwitch *auto_connect_switch;
|
AdwSwitchRow *auto_connect_switch;
|
||||||
|
|
||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
|
@ -188,13 +188,13 @@ on_port_entry_insert_text (CallsSipAccountWidget *self,
|
||||||
char *new_text,
|
char *new_text,
|
||||||
int new_text_length,
|
int new_text_length,
|
||||||
gpointer position,
|
gpointer position,
|
||||||
GtkEntry *entry)
|
AdwEntryRow *entry)
|
||||||
{
|
{
|
||||||
size_t digit_end, len;
|
size_t digit_end, len;
|
||||||
int *pos;
|
int *pos;
|
||||||
|
|
||||||
g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self));
|
g_assert (CALLS_IS_SIP_ACCOUNT_WIDGET (self));
|
||||||
g_assert (GTK_IS_ENTRY (entry));
|
g_assert (ADW_IS_ENTRY_ROW (entry));
|
||||||
|
|
||||||
if (!new_text || !*new_text || self->port_self_change)
|
if (!new_text || !*new_text || self->port_self_change)
|
||||||
return;
|
return;
|
||||||
|
@ -223,7 +223,7 @@ on_port_entry_insert_text (CallsSipAccountWidget *self,
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
update_port_cursor_position (GtkEntry *entry)
|
update_port_cursor_position (AdwEntryRow *entry)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ on_port_entry_after_insert_text (CallsSipAccountWidget *self,
|
||||||
char *new_text,
|
char *new_text,
|
||||||
int new_text_length,
|
int new_text_length,
|
||||||
gpointer position,
|
gpointer position,
|
||||||
GtkEntry *entry)
|
AdwEntryRow *entry)
|
||||||
{
|
{
|
||||||
int port = get_port (self);
|
int port = get_port (self);
|
||||||
|
|
||||||
|
@ -357,8 +357,8 @@ clear_form (CallsSipAccountWidget *self)
|
||||||
adw_combo_row_set_selected (self->protocol, 0);
|
adw_combo_row_set_selected (self->protocol, 0);
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (self->media_encryption), FALSE);
|
gtk_widget_set_sensitive (GTK_WIDGET (self->media_encryption), FALSE);
|
||||||
adw_combo_row_set_selected (self->media_encryption, 0);
|
adw_combo_row_set_selected (self->media_encryption, 0);
|
||||||
gtk_switch_set_state (self->tel_switch, FALSE);
|
adw_switch_row_set_active (self->tel_switch, FALSE);
|
||||||
gtk_switch_set_state (self->auto_connect_switch, TRUE);
|
adw_switch_row_set_active (self->auto_connect_switch, TRUE);
|
||||||
|
|
||||||
self->origin = NULL;
|
self->origin = NULL;
|
||||||
|
|
||||||
|
@ -429,8 +429,8 @@ edit_form (CallsSipAccountWidget *self,
|
||||||
gtk_editable_set_text (GTK_EDITABLE (self->port), port_str);
|
gtk_editable_set_text (GTK_EDITABLE (self->port), port_str);
|
||||||
adw_combo_row_set_selected (self->protocol, protocol_index);
|
adw_combo_row_set_selected (self->protocol, protocol_index);
|
||||||
adw_combo_row_set_selected (self->media_encryption, encryption_index);
|
adw_combo_row_set_selected (self->media_encryption, encryption_index);
|
||||||
gtk_switch_set_state (self->tel_switch, can_tel);
|
adw_switch_row_set_active (self->tel_switch, can_tel);
|
||||||
gtk_switch_set_state (self->auto_connect_switch, auto_connect);
|
adw_switch_row_set_active (self->auto_connect_switch, auto_connect);
|
||||||
|
|
||||||
gtk_widget_set_sensitive (self->apply_btn, FALSE);
|
gtk_widget_set_sensitive (self->apply_btn, FALSE);
|
||||||
|
|
||||||
|
@ -492,8 +492,8 @@ on_apply_clicked (CallsSipAccountWidget *self)
|
||||||
get_selected_protocol (self),
|
get_selected_protocol (self),
|
||||||
get_port (self),
|
get_port (self),
|
||||||
get_selected_media_encryption (self),
|
get_selected_media_encryption (self),
|
||||||
gtk_switch_get_state (self->tel_switch),
|
adw_switch_row_get_active (self->tel_switch),
|
||||||
gtk_switch_get_state (self->auto_connect_switch));
|
adw_switch_row_get_active (self->auto_connect_switch));
|
||||||
|
|
||||||
update_header (self);
|
update_header (self);
|
||||||
calls_sip_provider_save_accounts_to_disk (self->provider);
|
calls_sip_provider_save_accounts_to_disk (self->provider);
|
||||||
|
|
|
@ -52,14 +52,9 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwPreferencesGroup">
|
<object class="AdwPreferencesGroup">
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwActionRow">
|
<object class="AdwEntryRow" id="host">
|
||||||
<property name="title" translatable="yes">Server</property>
|
<property name="title" translatable="yes">Server</property>
|
||||||
<child>
|
<signal name="changed" handler="on_user_changed" swapped="yes"/>
|
||||||
<object class="GtkEntry" id="host">
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<signal name="changed" handler="on_user_changed" swapped="yes"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -67,15 +62,9 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwPreferencesGroup">
|
<object class="AdwPreferencesGroup">
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwActionRow">
|
<object class="AdwEntryRow" id="display_name">
|
||||||
<property name="title" translatable="yes">Display Name</property>
|
<property name="title" translatable="yes">Display Name (Optional)</property>
|
||||||
<property name="subtitle" translatable="yes">Optional</property>
|
<signal name="changed" handler="on_user_changed" swapped="yes"/>
|
||||||
<child>
|
|
||||||
<object class="GtkEntry" id="display_name">
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<signal name="changed" handler="on_user_changed" swapped="yes"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -83,26 +72,15 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwPreferencesGroup">
|
<object class="AdwPreferencesGroup">
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwActionRow">
|
<object class="AdwEntryRow" id="user">
|
||||||
<property name="title" translatable="yes">User ID</property>
|
<property name="title" translatable="yes">User ID</property>
|
||||||
<child>
|
<signal name="changed" handler="on_user_changed" swapped="yes"/>
|
||||||
<object class="GtkEntry" id="user">
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<signal name="changed" handler="on_user_changed" swapped="yes"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwActionRow">
|
<object class="AdwPasswordEntryRow" id="password">
|
||||||
<property name="title" translatable="yes">Password</property>
|
<property name="title" translatable="yes">Password</property>
|
||||||
<child>
|
<signal name="changed" handler="on_user_changed" swapped="yes"/>
|
||||||
<object class="GtkPasswordEntry" id="password">
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<property name="show-peek-icon">True</property>
|
|
||||||
<signal name="changed" handler="on_user_changed" swapped="yes"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -110,17 +88,12 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwPreferencesGroup">
|
<object class="AdwPreferencesGroup">
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwActionRow">
|
<object class="AdwEntryRow" id="port">
|
||||||
<property name="title" translatable="yes">Port</property>
|
<property name="title" translatable="yes">Port</property>
|
||||||
<child>
|
<property name="input-purpose">digits</property>
|
||||||
<object class="GtkEntry" id="port">
|
<signal name="changed" handler="on_user_changed" swapped="yes"/>
|
||||||
<property name="valign">center</property>
|
<signal name="insert-text" handler="on_port_entry_insert_text" swapped="yes"/>
|
||||||
<property name="input-purpose">digits</property>
|
<signal name="insert-text" handler="on_port_entry_after_insert_text" swapped="yes" after="yes"/>
|
||||||
<signal name="changed" handler="on_user_changed" swapped="yes"/>
|
|
||||||
<signal name="insert-text" handler="on_port_entry_insert_text" swapped="yes"/>
|
|
||||||
<signal name="insert-text" handler="on_port_entry_after_insert_text" swapped="yes" after="yes"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -140,25 +113,15 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwPreferencesGroup">
|
<object class="AdwPreferencesGroup">
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwActionRow">
|
<object class="AdwSwitchRow" id="tel_switch">
|
||||||
<property name="title" translatable="yes">Use for Phone Calls</property>
|
<property name="title" translatable="yes">Use for Phone Calls</property>
|
||||||
<child>
|
<signal name="notify::active" handler="on_user_changed" swapped="yes"/>
|
||||||
<object class="GtkSwitch" id="tel_switch">
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<signal name="notify::active" handler="on_user_changed" swapped="yes"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="AdwActionRow">
|
<object class="AdwSwitchRow" id="auto_connect_switch">
|
||||||
<property name="title" translatable="yes">Automatically Connect</property>
|
<property name="title" translatable="yes">Automatically Connect</property>
|
||||||
<child>
|
<signal name="notify::active" handler="on_user_changed" swapped="yes"/>
|
||||||
<object class="GtkSwitch" id="auto_connect_switch">
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<signal name="notify::active" handler="on_user_changed" swapped="yes"/>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
Loading…
Reference in a new issue