preferences: Replace GtkSwitch with AdwSwitchRow

This commit is contained in:
Bilal Elmoussaoui 2023-07-08 12:41:34 +02:00
parent f490ff1d4d
commit 16d198e556
2 changed files with 7 additions and 25 deletions

View file

@ -32,17 +32,11 @@
</object>
</child>
<child>
<object class="AdwActionRow">
<object class="AdwSwitchRow" id="auto_lock_switch">
<property name="title" translatable="yes">_Auto Lock the Application</property>
<property name="use-underline">True</property>
<property name="activatable-widget">auto_lock_switch</property>
<property name="subtitle" translatable="yes">Whether to automatically lock the application</property>
<child>
<object class="GtkSwitch" id="auto_lock_switch">
<property name="valign">center</property>
<property name="sensitive" bind-source="PreferencesWindow" bind-property="has-set-password" bind-flags="sync-create" />
</object>
</child>
<property name="sensitive" bind-source="PreferencesWindow" bind-property="has-set-password" bind-flags="sync-create" />
</object>
</child>
<child>
@ -63,29 +57,17 @@
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Network</property>
<child>
<object class="AdwActionRow">
<object class="AdwSwitchRow" id="download_favicons_switch">
<property name="title" translatable="yes">_Download Favicons</property>
<property name="use-underline">True</property>
<property name="activatable-widget">download_favicons_switch</property>
<property name="subtitle" translatable="yes">Automatically attempt fetching a website icon</property>
<child>
<object class="GtkSwitch" id="download_favicons_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<object class="AdwSwitchRow" id="download_favicons_metered_switch">
<property name="title" translatable="yes">_Metered Connection</property>
<property name="use-underline">True</property>
<property name="activatable-widget">download_favicons_metered_switch</property>
<property name="subtitle" translatable="yes">Fetch a website icon on a metered connection</property>
<child>
<object class="GtkSwitch" id="download_favicons_metered_switch">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>

View file

@ -49,11 +49,11 @@ mod imp {
#[template_child]
pub restore_group: TemplateChild<adw::PreferencesGroup>,
#[template_child(id = "auto_lock_switch")]
pub auto_lock: TemplateChild<gtk::Switch>,
pub auto_lock: TemplateChild<adw::SwitchRow>,
#[template_child(id = "download_favicons_switch")]
pub download_favicons: TemplateChild<gtk::Switch>,
pub download_favicons: TemplateChild<adw::SwitchRow>,
#[template_child(id = "download_favicons_metered_switch")]
pub download_favicons_metered: TemplateChild<gtk::Switch>,
pub download_favicons_metered: TemplateChild<adw::SwitchRow>,
#[template_child(id = "lock_timeout_spin_btn")]
pub lock_timeout: TemplateChild<adw::SpinRow>,
pub key_entries: RefCell<HashMap<String, adw::PasswordEntryRow>>,