mirror of
https://gitlab.gnome.org/World/Authenticator.git
synced 2025-03-04 00:34:40 +01:00
Switch to using AdwSpinRow
This commit is contained in:
parent
6513c238a5
commit
9877014e82
8 changed files with 47 additions and 110 deletions
|
@ -137,20 +137,12 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="counter_row">
|
||||
<property name="activatable-widget">counter_spinbutton</property>
|
||||
<object class="AdwSpinRow" id="counter_spinbutton">
|
||||
<property name="title" translatable="yes">Counter</property>
|
||||
<property name="visible">False</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="counter_spinbutton">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">counter_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">counter_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
|
|
|
@ -134,20 +134,12 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="counter_row">
|
||||
<property name="activatable-widget">counter_spinbutton</property>
|
||||
<object class="AdwSpinRow" id="counter_spinbutton">
|
||||
<property name="title" translatable="yes">Counter</property>
|
||||
<property name="visible">False</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="counter_spinbutton">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">counter_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">counter_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
|
|
@ -46,22 +46,15 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow">
|
||||
<object class="AdwSpinRow" id="lock_timeout_spin_btn">
|
||||
<property name="title" translatable="yes">Auto Lock _Timeout</property>
|
||||
<property name="subtitle" translatable="yes">The time in minutes</property>
|
||||
<property name="activatable-widget">lock_timeout_spin_btn</property>
|
||||
<property name="use-underline">True</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="lock_timeout_spin_btn">
|
||||
<property name="valign">center</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="sensitive" bind-source="auto_lock_switch" bind-property="sensitive" bind-flags="sync-create" />
|
||||
<property name="adjustment">auto_lock_adjustment</property>
|
||||
<property name="climb-rate">1</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="update-policy">if-valid</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="sensitive" bind-source="auto_lock_switch" bind-property="sensitive" bind-flags="sync-create" />
|
||||
<property name="adjustment">auto_lock_adjustment</property>
|
||||
<property name="climb-rate">1</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="update-policy">if-valid</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -18,13 +18,6 @@
|
|||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">10</property>
|
||||
</object>
|
||||
<object class="GtkSizeGroup">
|
||||
<widgets>
|
||||
<widget name="digits_spinbutton" />
|
||||
<widget name="period_spinbutton" />
|
||||
<widget name="default_counter_spinbutton" />
|
||||
</widgets>
|
||||
</object>
|
||||
<template parent="AdwNavigationPage" class="ProviderPage">
|
||||
<child>
|
||||
<object class="AdwToolbarView">
|
||||
|
@ -151,55 +144,31 @@
|
|||
<class name="boxed-list" />
|
||||
</style>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="period_row">
|
||||
<property name="activatable-widget">period_spinbutton</property>
|
||||
<object class="AdwSpinRow" id="period_spinbutton">
|
||||
<property name="title" translatable="yes">Period</property>
|
||||
<property name="subtitle" translatable="yes">Duration in seconds until the next password update</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="period_spinbutton">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">period_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">period_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="default_counter_row">
|
||||
<property name="activatable-widget">default_counter_spinbutton</property>
|
||||
<object class="AdwSpinRow" id="default_counter_spinbutton">
|
||||
<property name="title" translatable="yes">Counter</property>
|
||||
<property name="subtitle" translatable="yes">The by default value for counter-based computing method</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="default_counter_spinbutton">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">default_counter_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">default_counter_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwActionRow" id="digits_row">
|
||||
<property name="activatable-widget">digits_spinbutton</property>
|
||||
<object class="AdwSpinRow" id="digits_spinbutton">
|
||||
<property name="title" translatable="yes">Digits</property>
|
||||
<property name="subtitle" translatable="yes">Length of the generated code</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="digits_spinbutton">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="value">6</property>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">digits_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="value">6</property>
|
||||
<property name="text">0</property>
|
||||
<property name="adjustment">digits_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
|
|
@ -55,7 +55,7 @@ mod imp {
|
|||
#[template_child]
|
||||
pub algorithm_label: TemplateChild<gtk::Label>,
|
||||
#[template_child]
|
||||
pub counter_row: TemplateChild<adw::ActionRow>,
|
||||
pub counter_spinbutton: TemplateChild<adw::SpinRow>,
|
||||
#[template_child]
|
||||
pub period_row: TemplateChild<adw::ActionRow>,
|
||||
#[template_child]
|
||||
|
@ -340,10 +340,10 @@ impl AccountAddDialog {
|
|||
imp.digits_label.set_text(&provider.digits().to_string());
|
||||
|
||||
if provider.method().is_time_based() {
|
||||
imp.counter_row.set_visible(false);
|
||||
imp.counter_spinbutton.set_visible(false);
|
||||
imp.period_row.set_visible(true);
|
||||
} else {
|
||||
imp.counter_row.set_visible(true);
|
||||
imp.counter_spinbutton.set_visible(true);
|
||||
imp.period_row.set_visible(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,14 +35,12 @@ mod imp {
|
|||
#[template_child]
|
||||
pub method_label: TemplateChild<gtk::Label>,
|
||||
#[template_child]
|
||||
pub counter_spinbutton: TemplateChild<gtk::SpinButton>,
|
||||
pub counter_spinbutton: TemplateChild<adw::SpinRow>,
|
||||
#[template_child]
|
||||
pub period_label: TemplateChild<gtk::Label>,
|
||||
#[template_child]
|
||||
pub digits_label: TemplateChild<gtk::Label>,
|
||||
#[template_child]
|
||||
pub counter_row: TemplateChild<adw::ActionRow>,
|
||||
#[template_child]
|
||||
pub period_row: TemplateChild<adw::ActionRow>,
|
||||
#[template_child]
|
||||
pub help_row: TemplateChild<UrlRow>,
|
||||
|
@ -176,10 +174,10 @@ impl AccountDetailsPage {
|
|||
imp.method_label
|
||||
.set_text(&provider.method().to_locale_string());
|
||||
if provider.method().is_event_based() {
|
||||
imp.counter_row.set_visible(true);
|
||||
imp.counter_spinbutton.set_visible(true);
|
||||
imp.period_row.set_visible(false);
|
||||
} else {
|
||||
imp.counter_row.set_visible(false);
|
||||
imp.counter_spinbutton.set_visible(false);
|
||||
imp.period_row.set_visible(true);
|
||||
imp.period_label.set_text(&provider.period().to_string());
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ mod imp {
|
|||
#[template_child(id = "download_favicons_metered_switch")]
|
||||
pub download_favicons_metered: TemplateChild<gtk::Switch>,
|
||||
#[template_child(id = "lock_timeout_spin_btn")]
|
||||
pub lock_timeout: TemplateChild<gtk::SpinButton>,
|
||||
pub lock_timeout: TemplateChild<adw::SpinRow>,
|
||||
pub key_entries: RefCell<HashMap<String, adw::PasswordEntryRow>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -33,11 +33,11 @@ mod imp {
|
|||
#[template_child]
|
||||
pub name_entry: TemplateChild<adw::EntryRow>,
|
||||
#[template_child]
|
||||
pub period_spinbutton: TemplateChild<gtk::SpinButton>,
|
||||
pub period_spinbutton: TemplateChild<adw::SpinRow>,
|
||||
#[template_child]
|
||||
pub digits_spinbutton: TemplateChild<gtk::SpinButton>,
|
||||
pub digits_spinbutton: TemplateChild<adw::SpinRow>,
|
||||
#[template_child]
|
||||
pub default_counter_spinbutton: TemplateChild<gtk::SpinButton>,
|
||||
pub default_counter_spinbutton: TemplateChild<adw::SpinRow>,
|
||||
#[template_child]
|
||||
pub provider_website_entry: TemplateChild<adw::EntryRow>,
|
||||
#[template_child]
|
||||
|
@ -47,12 +47,6 @@ mod imp {
|
|||
#[template_child]
|
||||
pub algorithm_comborow: TemplateChild<adw::ComboRow>,
|
||||
#[template_child]
|
||||
pub period_row: TemplateChild<adw::ActionRow>,
|
||||
#[template_child]
|
||||
pub digits_row: TemplateChild<adw::ActionRow>,
|
||||
#[template_child]
|
||||
pub default_counter_row: TemplateChild<adw::ActionRow>,
|
||||
#[template_child]
|
||||
pub delete_button: TemplateChild<gtk::Button>,
|
||||
pub selected_provider: RefCell<Option<Provider>>,
|
||||
pub selected_image: RefCell<Option<gio::File>>,
|
||||
|
@ -80,9 +74,6 @@ mod imp {
|
|||
provider_help_entry: TemplateChild::default(),
|
||||
method_comborow: TemplateChild::default(),
|
||||
algorithm_comborow: TemplateChild::default(),
|
||||
period_row: TemplateChild::default(),
|
||||
digits_row: TemplateChild::default(),
|
||||
default_counter_row: TemplateChild::default(),
|
||||
delete_button: TemplateChild::default(),
|
||||
methods_model,
|
||||
algorithms_model,
|
||||
|
@ -367,21 +358,21 @@ impl ProviderPage {
|
|||
let selected = Method::from(combo_row.selected());
|
||||
match selected {
|
||||
Method::TOTP => {
|
||||
imp.default_counter_row.set_visible(false);
|
||||
imp.period_row.set_visible(true);
|
||||
imp.default_counter_spinbutton.set_visible(false);
|
||||
imp.period_spinbutton.set_visible(true);
|
||||
imp.digits_spinbutton.set_value(OTP::DEFAULT_DIGITS as f64);
|
||||
imp.period_spinbutton.set_value(OTP::DEFAULT_PERIOD as f64);
|
||||
}
|
||||
Method::HOTP => {
|
||||
imp.default_counter_row.set_visible(true);
|
||||
imp.period_row.set_visible(false);
|
||||
imp.default_counter_spinbutton.set_visible(true);
|
||||
imp.period_spinbutton.set_visible(false);
|
||||
imp.default_counter_spinbutton
|
||||
.set_value(OTP::DEFAULT_COUNTER as f64);
|
||||
imp.digits_spinbutton.set_value(OTP::DEFAULT_DIGITS as f64);
|
||||
}
|
||||
Method::Steam => {
|
||||
imp.default_counter_row.set_visible(false);
|
||||
imp.period_row.set_visible(true);
|
||||
imp.default_counter_spinbutton.set_visible(false);
|
||||
imp.period_spinbutton.set_visible(true);
|
||||
imp.digits_spinbutton
|
||||
.set_value(OTP::STEAM_DEFAULT_DIGITS as f64);
|
||||
imp.period_spinbutton
|
||||
|
@ -393,8 +384,10 @@ impl ProviderPage {
|
|||
|
||||
imp.algorithm_comborow
|
||||
.set_sensitive(selected != Method::Steam);
|
||||
imp.period_row.set_sensitive(selected != Method::Steam);
|
||||
imp.digits_row.set_sensitive(selected != Method::Steam);
|
||||
imp.period_spinbutton
|
||||
.set_sensitive(selected != Method::Steam);
|
||||
imp.digits_spinbutton
|
||||
.set_sensitive(selected != Method::Steam);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue