Commit 765e320f authored by Sébastien Blin's avatar Sébastien Blin

settings: change UI for accounts with a managerUri

Linking and revoking device, or registering usernames is not
available for accounts with a managerUri.

Change-Id: I5e38869a657c653925fd35e0f93c01decc15f62d
parent ceaa495e
......@@ -66,6 +66,7 @@ struct _NewAccountSettingsViewPrivate
GtkWidget* stack_account;
GtkWidget* general_settings_box;
GtkWidget* box_account;
GtkWidget* sip_account_enabled;
GtkWidget* account_enabled;
GtkWidget* sip_label_status;
......@@ -79,6 +80,7 @@ struct _NewAccountSettingsViewPrivate
GtkWidget* account_options_box;
GtkWidget* type_box;
GtkWidget* label_type_info;
GtkWidget* username_row;
GtkWidget* username_box;
GtkWidget* password_row;
GtkWidget* label_change_password;
......@@ -254,6 +256,7 @@ new_account_settings_view_class_init(NewAccountSettingsViewClass *klass)
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, stack_account);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, general_settings_box);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, box_account);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, account_enabled);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, sip_account_enabled);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, sip_label_status);
......@@ -266,6 +269,7 @@ new_account_settings_view_class_init(NewAccountSettingsViewClass *klass)
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, account_options_box);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, type_box);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, label_type_info);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, username_row);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, username_box);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, password_row);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS(klass), NewAccountSettingsView, label_change_password);
......@@ -2002,6 +2006,8 @@ new_account_settings_view_update(NewAccountSettingsView *view, gboolean reset_vi
return;
}
bool has_account_manager = !priv->currentProp_->managerUri.empty();
auto label_status = priv->label_status;
if ((*priv->accountInfo_)->profileInfo.type != lrc::api::profile::Type::RING) {
label_status = priv->sip_label_status;
......@@ -2111,6 +2117,13 @@ new_account_settings_view_update(NewAccountSettingsView *view, gboolean reset_vi
max_width = std::max(max_width, label_password.size());
if (label_id.size() != max_width)
gtk_label_set_width_chars(GTK_LABEL(priv->label_id), max_width + 1);
gtk_button_set_label(GTK_BUTTON(priv->button_delete_account), has_account_manager? _("Remove account") : _("Delete account"));
if (has_account_manager) {
gtk_widget_hide(priv->button_export_account);
gtk_widget_hide(priv->password_row);
gtk_widget_hide(priv->button_add_device);
}
} else {
gtk_switch_set_active(GTK_SWITCH(priv->sip_account_enabled), (*priv->accountInfo_)->enabled);
......
......@@ -315,7 +315,7 @@
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkBox">
<object class="GtkBox" id="box_account">
<property name="visible">True</property>
<property name="spacing">24</property>
<property name="orientation">horizontal</property>
......@@ -480,7 +480,7 @@
</child>
<child>
<!-- Username -->
<object class="GtkListBoxRow">
<object class="GtkListBoxRow" id="username_row">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">fill</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment