Use AdwEntryRow where possible

This commit is contained in:
Bilal Elmoussaoui 2022-12-25 08:46:06 +01:00
parent 594bf9fcf0
commit d5bd010043
6 changed files with 35 additions and 114 deletions

View file

@ -112,33 +112,15 @@
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="activatable-widget">username_entry</property>
<object class="AdwEntryRow" id="username_entry">
<property name="title" translatable="yes">Account</property>
<child>
<object class="GtkEntry" id="username_entry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="enable-emoji-completion">True</property>
<signal name="changed" handler="input_validate" swapped="true" />
</object>
</child>
<signal name="changed" handler="input_validate" swapped="true" />
</object>
</child>
<child>
<object class="AdwActionRow" id="token_row">
<property name="activatable-widget">token_entry</property>
<object class="AdwPasswordEntryRow" id="token_entry">
<property name="title" translatable="yes">Token</property>
<child>
<object class="GtkPasswordEntry" id="token_entry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="show-peek-icon">True</property>
<signal name="changed" handler="input_validate" swapped="true" />
</object>
</child>
<signal name="changed" handler="input_validate" swapped="true" />
</object>
</child>
<child>
@ -293,8 +275,6 @@
<object class="GtkSizeGroup">
<widgets>
<widget name="provider_entry"/>
<widget name="username_entry"/>
<widget name="token_entry"/>
<widget name="counter_spinbutton"/>
</widgets>
</object>

View file

@ -48,45 +48,21 @@
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwActionRow" id="current_password_row">
<object class="AdwPasswordEntryRow" id="current_password_entry">
<property name="title" translatable="yes">Current Passphrase</property>
<property name="activatable-widget">current_password_entry</property>
<property name="visible" bind-source="PasswordPage" bind-property="has-set-password" bind-flags="sync-create" />
<child>
<object class="GtkPasswordEntry" id="current_password_entry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="show-peek-icon">True</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<object class="AdwPasswordEntryRow" id="password_entry">
<property name="title" translatable="yes">New Passphrase</property>
<property name="activatable-widget">password_entry</property>
<child>
<object class="GtkPasswordEntry" id="password_entry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="show-peek-icon">True</property>
<signal name="changed" handler="validate" swapped="true" />
</object>
</child>
<signal name="changed" handler="validate" swapped="true" />
</object>
</child>
<child>
<object class="AdwActionRow">
<object class="AdwPasswordEntryRow" id="confirm_password_entry">
<property name="title" translatable="yes">Repeat Passphrase</property>
<property name="activatable-widget">confirm_password_entry</property>
<child>
<object class="GtkPasswordEntry" id="confirm_password_entry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="show-peek-icon">True</property>
<signal name="changed" handler="validate" swapped="true" />
</object>
</child>
<signal name="changed" handler="validate" swapped="true" />
</object>
</child>
<style>

View file

@ -20,12 +20,9 @@
</object>
<object class="GtkSizeGroup">
<widgets>
<widget name="digits_spinbutton"/>
<widget name="period_spinbutton"/>
<widget name="default_counter_spinbutton"/>
<widget name="provider_website_entry"/>
<widget name="provider_help_entry"/>
<widget name="name_entry"/>
<widget name="digits_spinbutton" />
<widget name="period_spinbutton" />
<widget name="default_counter_spinbutton" />
</widgets>
</object>
<template parent="GtkBox" class="ProviderPage">
@ -58,7 +55,7 @@
<property name="receives-default">True</property>
<property name="action-name">providers.save</property>
<style>
<class name="suggested-action"/>
<class name="suggested-action" />
</style>
</object>
</child>
@ -101,7 +98,7 @@
<property name="use-underline">True</property>
<property name="action-name">providers.reset_image</property>
<style>
<class name="pill"/>
<class name="pill" />
</style>
</object>
</child>
@ -111,7 +108,7 @@
<property name="use-underline">True</property>
<property name="action-name">providers.select_image</property>
<style>
<class name="pill"/>
<class name="pill" />
</style>
</object>
</child>
@ -129,47 +126,29 @@
<object class="GtkListBox">
<property name="selection-mode">none</property>
<child>
<object class="AdwActionRow">
<property name="activatable-widget">name_entry</property>
<object class="AdwEntryRow" id="name_entry">
<property name="title" translatable="yes">Name</property>
<child>
<object class="GtkEntry" id="name_entry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="enable-emoji-completion">True</property>
<signal name="changed" handler="entry_validate" swapped="true" />
</object>
</child>
<signal name="changed" handler="entry_validate" swapped="true" />
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="activatable-widget">provider_website_entry</property>
<object class="AdwEntryRow" id="provider_website_entry">
<property name="title" translatable="yes">Website</property>
<property name="subtitle" translatable="yes">Used to fetch the provider icon</property>
<child>
<object class="GtkEntry" id="provider_website_entry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="input-purpose">url</property>
<signal name="changed" handler="entry_validate" swapped="true" />
</object>
</child>
<signal name="changed" handler="entry_validate" swapped="true" />
</object>
</child>
<child>
<object class="AdwComboRow" id="method_comborow">
<property name="title" translatable="yes">Computing Method</property>
<signal name="notify::selected-item" handler="on_method_changed" swapped="true" />
<signal name="notify::selected-item" handler="on_method_changed"
swapped="true" />
<property name="model">
<object class="AdwEnumListModel">
<property name="enum-type">OTPMethod</property>
</object>
</property>
<property name="expression">
<lookup type="AdwEnumListItem" name="name"/>
<lookup type="AdwEnumListItem" name="name" />
</property>
</object>
</child>
@ -182,12 +161,12 @@
</object>
</property>
<property name="expression">
<lookup type="AdwEnumListItem" name="name"/>
<lookup type="AdwEnumListItem" name="name" />
</property>
</object>
</child>
<style>
<class name="boxed-list"/>
<class name="boxed-list" />
</style>
<child>
<object class="AdwActionRow" id="period_row">
@ -242,19 +221,9 @@
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="activatable-widget">provider_help_entry</property>
<object class="AdwEntryRow" id="provider_help_entry">
<property name="title" translatable="yes">Help URL</property>
<property name="subtitle" translatable="yes">Provider setup instructions</property>
<child>
<object class="GtkEntry" id="provider_help_entry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="input-purpose">url</property>
<signal name="changed" handler="entry_validate" swapped="true" />
</object>
</child>
<signal name="changed" handler="entry_validate" swapped="true" />
</object>
</child>
</object>

View file

@ -36,9 +36,9 @@ mod imp {
#[template_child]
pub provider_help_row: TemplateChild<UrlRow>,
#[template_child]
pub username_entry: TemplateChild<gtk::Entry>,
pub username_entry: TemplateChild<adw::EntryRow>,
#[template_child]
pub token_entry: TemplateChild<gtk::PasswordEntry>,
pub token_entry: TemplateChild<adw::PasswordEntryRow>,
#[template_child]
pub more_list: TemplateChild<gtk::ListBox>,
#[template_child]
@ -185,7 +185,6 @@ impl AccountAddDialog {
let name_entry = imp.provider_page.name_entry();
name_entry.set_text(&entry.text());
name_entry.grab_focus_without_selecting();
name_entry.set_position(entry.cursor_position());
}
@ -217,7 +216,6 @@ impl AccountAddDialog {
imp.provider_completion
.set_model(Some(&model.completion_model()));
self.set_provider(Some(provider));
imp.username_entry.grab_focus_without_selecting();
imp.deck.set_visible_child_name("main");
}

View file

@ -22,15 +22,13 @@ mod imp {
pub actions: OnceCell<gio::SimpleActionGroup>,
pub has_set_password: Cell<bool>,
#[template_child]
pub current_password_entry: TemplateChild<gtk::PasswordEntry>,
pub current_password_entry: TemplateChild<adw::PasswordEntryRow>,
#[template_child]
pub error_revealer: TemplateChild<ErrorRevealer>,
#[template_child]
pub password_entry: TemplateChild<gtk::PasswordEntry>,
pub password_entry: TemplateChild<adw::PasswordEntryRow>,
#[template_child]
pub confirm_password_entry: TemplateChild<gtk::PasswordEntry>,
#[template_child]
pub current_password_row: TemplateChild<adw::ActionRow>,
pub confirm_password_entry: TemplateChild<adw::PasswordEntryRow>,
#[template_child]
pub status_page: TemplateChild<adw::StatusPage>,
pub default_password_signal: RefCell<Option<glib::SignalHandlerId>>,

View file

@ -29,7 +29,7 @@ mod imp {
#[template_child]
pub image: TemplateChild<ProviderImage>,
#[template_child]
pub name_entry: TemplateChild<gtk::Entry>,
pub name_entry: TemplateChild<adw::EntryRow>,
#[template_child]
pub period_spinbutton: TemplateChild<gtk::SpinButton>,
#[template_child]
@ -37,9 +37,9 @@ mod imp {
#[template_child]
pub default_counter_spinbutton: TemplateChild<gtk::SpinButton>,
#[template_child]
pub provider_website_entry: TemplateChild<gtk::Entry>,
pub provider_website_entry: TemplateChild<adw::EntryRow>,
#[template_child]
pub provider_help_entry: TemplateChild<gtk::Entry>,
pub provider_help_entry: TemplateChild<adw::EntryRow>,
#[template_child]
pub method_comborow: TemplateChild<adw::ComboRow>,
#[template_child]
@ -230,7 +230,7 @@ impl ProviderPage {
}
}
pub fn name_entry(&self) -> gtk::Entry {
pub fn name_entry(&self) -> adw::EntryRow {
self.imp().name_entry.clone()
}