diff --git a/Cargo.lock b/Cargo.lock
index 07d04cb..635f7f1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -222,6 +222,7 @@ dependencies = [
"bindgen",
"chrono",
"event-listener",
+ "futures",
"gettext-rs",
"glib-build-tools",
"gtk4",
@@ -634,6 +635,21 @@ dependencies = [
"percent-encoding",
]
+[[package]]
+name = "futures"
+version = "0.3.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "futures-util",
+]
+
[[package]]
name = "futures-channel"
version = "0.3.31"
@@ -641,6 +657,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
+ "futures-sink",
]
[[package]]
@@ -708,6 +725,7 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
dependencies = [
+ "futures-channel",
"futures-core",
"futures-io",
"futures-macro",
diff --git a/Cargo.toml b/Cargo.toml
index 2ce638b..f08ba96 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,7 @@ async-channel = "2.3.1"
base16ct = { version = "0.2.0", features = ["std"] }
chrono = { version = "0.4.38", features = ["serde"] }
event-listener = "5.3.1"
+futures = "0.3.31"
gettext-rs = { version = "0.7.2", features = ["gettext-system"] }
gtk = { version = "0.9.2", package = "gtk4", features = ["v4_16"] }
md-5 = { version = "0.10.6", features = ["asm"] }
diff --git a/src/ui/setup.rs b/src/ui/setup.rs
index ee80ab4..b719518 100644
--- a/src/ui/setup.rs
+++ b/src/ui/setup.rs
@@ -139,42 +139,36 @@ impl Default for Setup {
}
impl Setup {
- pub fn load(&self) {
- glib::spawn_future_local(glib::clone!(
- #[weak(rename_to = self_)]
- self,
- async move {
- self_.set_server_url("");
- self_.set_username("");
- self_.set_password("");
- self_.set_authn_can_edit(false);
- self_.set_authn_can_validate(false);
+ pub async fn load(&self) {
+ self.set_server_url("");
+ self.set_username("");
+ self.set_password("");
+ self.set_authn_can_edit(false);
+ self.set_authn_can_validate(false);
- // TODO remove unwraps, make sure authn_can_edit is set back to true
- let keyring = oo7::Keyring::new().await.unwrap();
- let attributes = vec![("xdg:schema", crate::APP_ID)];
- let items = keyring.search_items(&attributes).await.unwrap();
+ // TODO remove unwraps, make sure authn_can_edit is set back to true
+ let keyring = oo7::Keyring::new().await.unwrap();
+ let attributes = vec![("xdg:schema", crate::APP_ID)];
+ let items = keyring.search_items(&attributes).await.unwrap();
- if items.is_empty() {
- // didn't find shit, leave all empty
- // TODO: onboarding
- self_.set_authn_can_edit(true);
- self_.set_authn_can_validate(true);
- } else {
- let item = &items[0];
- let attributes = item.attributes().await.unwrap();
+ if items.is_empty() {
+ // didn't find shit, leave all empty
+ // TODO: onboarding
+ self.set_authn_can_edit(true);
+ self.set_authn_can_validate(true);
+ } 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());
- // strip non-utf8 elements from the pw, i guess
- self_.set_password(String::from_utf8_lossy(&item.secret().await.unwrap()));
+ self.set_server_url(attributes["server-url"].clone());
+ self.set_username(attributes["username"].clone());
+ // strip non-utf8 elements from the pw, i guess
+ self.set_password(String::from_utf8_lossy(&item.secret().await.unwrap()));
- // first connection
- self_.set_authn_can_edit(true); // act as if the user had inputted this
- self_.set_authn_can_validate(true);
- self_.imp().on_authn_validate_activated().await;
- }
- }
- ));
+ // first connection
+ self.set_authn_can_edit(true); // act as if the user had inputted this
+ self.set_authn_can_validate(true);
+ self.imp().on_authn_validate_activated().await;
+ }
}
}
diff --git a/src/ui/window.rs b/src/ui/window.rs
index c088ff0..6323456 100644
--- a/src/ui/window.rs
+++ b/src/ui/window.rs
@@ -56,6 +56,7 @@ mod imp {
pub(super) queued_seek: Cell