account_add: Use property class in action rows

This commit is contained in:
Maximiliano Sandoval 2024-12-31 12:53:14 +01:00 committed by Bilal Elmoussaoui
parent bc6cd9daaf
commit 4414718ebe
2 changed files with 21 additions and 39 deletions

View file

@ -155,51 +155,35 @@
<child>
<object class="AdwActionRow" id="algorithm_row">
<property name="title" translatable="yes">Algorithm</property>
<child>
<object class="GtkLabel" id="algorithm_label">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
</object>
</child>
<style>
<class name="property"/>
</style>
</object>
</child>
<child>
<object class="AdwActionRow" id="method_row">
<property name="title" translatable="yes">Computing Method</property>
<child>
<object class="GtkLabel" id="method_label">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
</object>
</child>
<style>
<class name="property"/>
</style>
</object>
</child>
<child>
<object class="AdwActionRow" id="period_row">
<property name="title" translatable="yes">Period</property>
<property name="subtitle" translatable="yes">Duration in seconds until the next password update</property>
<child>
<object class="GtkLabel" id="period_label">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
</object>
</child>
<style>
<class name="property"/>
</style>
</object>
</child>
<child>
<object class="AdwActionRow" id="digits_row">
<property name="title" translatable="yes">Digits</property>
<property name="subtitle" translatable="yes">Length of the generated code</property>
<child>
<object class="GtkLabel" id="digits_label">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
</object>
</child>
<style>
<class name="property"/>
</style>
</object>
</child>
<child>

View file

@ -46,15 +46,13 @@ mod imp {
#[template_child]
pub more_list: TemplateChild<gtk::ListBox>,
#[template_child]
pub period_label: TemplateChild<gtk::Label>,
#[template_child]
pub digits_label: TemplateChild<gtk::Label>,
pub digits_row: TemplateChild<adw::ActionRow>,
#[template_child]
pub provider_entry: TemplateChild<gtk::Entry>,
#[template_child]
pub method_label: TemplateChild<gtk::Label>,
pub method_row: TemplateChild<adw::ActionRow>,
#[template_child]
pub algorithm_label: TemplateChild<gtk::Label>,
pub algorithm_row: TemplateChild<adw::ActionRow>,
#[template_child]
pub counter_spinbutton: TemplateChild<adw::SpinRow>,
#[template_child]
@ -315,17 +313,17 @@ impl AccountAddDialog {
if let Some(provider) = provider {
imp.more_list.set_visible(true);
imp.provider_entry.set_text(&provider.name());
imp.period_label.set_text(&provider.period().to_string());
imp.period_row.set_subtitle(&provider.period().to_string());
imp.image.set_provider(Some(&provider));
imp.method_label
.set_text(&provider.method().to_locale_string());
imp.method_row
.set_subtitle(&provider.method().to_locale_string());
imp.algorithm_label
.set_text(&provider.algorithm().to_locale_string());
imp.algorithm_row
.set_subtitle(&provider.algorithm().to_locale_string());
imp.digits_label.set_text(&provider.digits().to_string());
imp.digits_row.set_subtitle(&provider.digits().to_string());
if provider.method().is_time_based() {
imp.counter_spinbutton.set_visible(false);