diff --git a/Cargo.lock b/Cargo.lock index b54da81..5e5afc2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,6 +53,18 @@ dependencies = [ "aes", ] +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.4" @@ -1278,6 +1290,18 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + [[package]] name = "fastrand" version = "2.4.1" @@ -1793,12 +1817,30 @@ dependencies = [ "system-deps", ] +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +[[package]] +name = "hashlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +dependencies = [ + "hashbrown 0.14.5", +] + [[package]] name = "heck" version = "0.5.0" @@ -2117,7 +2159,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.17.1", ] [[package]] @@ -2345,6 +2387,17 @@ dependencies = [ "libc", ] +[[package]] +name = "libsqlite3-sys" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -2793,6 +2846,7 @@ dependencies = [ "keyring", "proton-drive-rs", "proton-sdk", + "rusqlite", "serde", "serde_json", "sha2 0.10.9", @@ -3406,6 +3460,20 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "rusqlite" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" +dependencies = [ + "bitflags 2.13.0", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", +] + [[package]] name = "rustc-hash" version = "2.1.2" @@ -4347,6 +4415,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "vec_map" version = "0.8.2" diff --git a/Cargo.toml b/Cargo.toml index 298bce7..13df4fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } directories = "5" sha2 = "0.10" +rusqlite = { version = "0.32", features = ["bundled"] } keyring = { version = "3", features = ["sync-secret-service", "crypto-rust"] } clap = { version = "4", features = ["derive"] } rpassword = "7" diff --git a/crates/pdfs-gui/src/app.rs b/crates/pdfs-gui/src/app.rs index 5d9662e..e02a094 100644 --- a/crates/pdfs-gui/src/app.rs +++ b/crates/pdfs-gui/src/app.rs @@ -1633,8 +1633,8 @@ fn wire_gallery(ui: &Rc, grid: >k4::GridView) { let ui = ui_upload.clone(); let parent_win = ui.stack.root().and_downcast::(); dialog.open(parent_win.as_ref(), gio::Cancellable::NONE, move |res| { - if let Ok(file) = res { - if let Some(path) = file.path() { + if let Ok(file) = res + && let Some(path) = file.path() { let name = path .file_name() .and_then(|n| n.to_str()) @@ -1698,7 +1698,6 @@ fn wire_gallery(ui: &Rc, grid: >k4::GridView) { } }); } - } }); }); } @@ -1715,13 +1714,11 @@ fn show_error_dialog(ui: &Rc, message: &str) { fn find_photo_index(model: &gio::ListStore, uid: &str) -> Option { for i in 0..model.n_items() { - if let Some(obj) = model.item(i) { - if let Some(boxed) = obj.downcast_ref::() { - if boxed.borrow::().uid == uid { + if let Some(obj) = model.item(i) + && let Some(boxed) = obj.downcast_ref::() + && boxed.borrow::().uid == uid { return Some(i); } - } - } } None } @@ -1792,15 +1789,14 @@ fn save_photo_to_disk(window: >k4::Window, source_path: &str, original_name: & .build(); let source_path_str = source_path.to_string(); dialog.save(Some(window), gio::Cancellable::NONE, move |res| { - if let Ok(file) = res { - if let Some(dest_path) = file.path() { + if let Ok(file) = res + && let Some(dest_path) = file.path() { if let Err(e) = std::fs::copy(&source_path_str, &dest_path) { tracing::error!("Failed to copy file to {:?}: {}", dest_path, e); } else { tracing::info!("Saved photo to {:?}", dest_path); } } - } }); } @@ -1961,11 +1957,10 @@ fn open_photo_viewer(ui: &Rc, initial_uid: String) { next_btn.set_sensitive(initial_idx < n - 1); let mut initial_capture_time = 0; - if let Some(obj) = ui.gallery_model.item(initial_idx) { - if let Some(boxed) = obj.downcast_ref::() { + if let Some(obj) = ui.gallery_model.item(initial_idx) + && let Some(boxed) = obj.downcast_ref::() { initial_capture_time = boxed.borrow::().capture_time; } - } let date_str = format_capture_time(initial_capture_time); title_label.set_label(&format!( "Photo {} of {} • {}", diff --git a/packaging/PKGBUILD b/packaging/PKGBUILD index d4b8ef8..1db0f3a 100644 --- a/packaging/PKGBUILD +++ b/packaging/PKGBUILD @@ -8,7 +8,7 @@ # Build + install: cd packaging && makepkg -fi pkgname=proton-drive-linux -pkgver=0.1.2 +pkgver=0.2.0 pkgrel=1 pkgdesc="Proton Drive client for Linux: FUSE files-on-demand mount, CLI, GTK4 app + tray" arch=('x86_64')