diff --git a/src/ui/setup.rs b/src/ui/setup.rs index b719518..f09f8af 100644 --- a/src/ui/setup.rs +++ b/src/ui/setup.rs @@ -125,6 +125,7 @@ mod imp { use adw::subclass::prelude::*; use gtk::glib; +use tracing::{event, Level}; glib::wrapper! { pub struct Setup(ObjectSubclass) @@ -148,6 +149,8 @@ impl Setup { // TODO remove unwraps, make sure authn_can_edit is set back to true let keyring = oo7::Keyring::new().await.unwrap(); + // make sure the keyring is unlocked + keyring.unlock().await.unwrap(); let attributes = vec![("xdg:schema", crate::APP_ID)]; let items = keyring.search_items(&attributes).await.unwrap(); @@ -156,12 +159,19 @@ impl Setup { // TODO: onboarding self.set_authn_can_edit(true); self.set_authn_can_validate(true); + + event!(Level::DEBUG, "TODO: setup onboarding"); } else { let item = &items[0]; let attributes = item.attributes().await.unwrap(); - self.set_server_url(attributes["server-url"].clone()); - self.set_username(attributes["username"].clone()); + let server_url = &attributes["server-url"]; + let username = &attributes["username"]; + + event!(Level::DEBUG, "logging in as {} at {}", username, server_url); + + self.set_server_url(server_url.clone()); + self.set_username(username.clone()); // strip non-utf8 elements from the pw, i guess self.set_password(String::from_utf8_lossy(&item.secret().await.unwrap())); diff --git a/src/ui/window.rs b/src/ui/window.rs index 046ca50..8cf20ac 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -613,7 +613,7 @@ mod imp { }; match perform.await { - Ok(()) => {}, + Ok(()) => {} Err(err) => event!(Level::ERROR, "could not refresh album list: {err}"), } @@ -702,7 +702,7 @@ impl Window { self.set_can_click_shuffle_all(true); let window = self.clone(); - glib::spawn_future_local(async move {window.imp().on_refresh_albums_clicked().await}); + glib::spawn_future_local(async move { window.imp().on_refresh_albums_clicked().await }); } pub fn playlist_next(&self) {