diff --git a/src/application.rs b/src/application.rs index 2a96189..42dff31 100644 --- a/src/application.rs +++ b/src/application.rs @@ -91,7 +91,7 @@ mod imp { let preferences_action = gio::ActionEntry::builder("preferences") .activate(|app: &Self::Type, _, _| { let window = app.active_window(); - let preferences = PreferencesWindow::new(); + let preferences = PreferencesWindow::default(); preferences.set_has_set_password(app.can_be_locked()); preferences.connect_has_set_password_notify(clone!( #[weak] diff --git a/src/models/keyring.rs b/src/models/keyring.rs index 2bf6915..ee86c4f 100644 --- a/src/models/keyring.rs +++ b/src/models/keyring.rs @@ -83,7 +83,7 @@ pub async fn has_set_password() -> anyhow::Result { .search_items(&attributes) .await { - Ok(items) => Ok(items.first().is_some()), + Ok(items) => Ok(!items.is_empty()), _ => Ok(false), } } diff --git a/src/models/otp.rs b/src/models/otp.rs index 4c954fa..fb4afc3 100644 --- a/src/models/otp.rs +++ b/src/models/otp.rs @@ -118,7 +118,6 @@ impl OTP { /// Code graciously taken from the rust-otp crate. /// - /// Decodes a secret (given as an RFC4648 base32-encoded ASCII string) /// into a byte string. It fails if secret is not a valid Base32 string. fn decode_secret(secret: &str) -> Result> { diff --git a/src/widgets/preferences/window.rs b/src/widgets/preferences/window.rs index ca482be..2424bb7 100644 --- a/src/widgets/preferences/window.rs +++ b/src/widgets/preferences/window.rs @@ -83,10 +83,6 @@ glib::wrapper! { } impl PreferencesWindow { - pub fn new() -> Self { - glib::Object::new() - } - fn setup_widget(&self) { let imp = self.imp(); @@ -137,3 +133,9 @@ impl PreferencesWindow { self.insert_action_group("preferences", Some(&imp.actions)); } } + +impl Default for PreferencesWindow { + fn default() -> Self { + glib::Object::new() + } +}