Switched to tinyfiledialogs

Because rfd somehow froze the app on macOS. This behaviour is new,
but based on some reading tinyfiledialogs doesn't exhibit it.
pull/4/head
Benedikt Terhechte 3 years ago
parent 1ab79c5060
commit fd29cd9c7a

290
Cargo.lock generated

@ -87,12 +87,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "anyhow"
version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1"
[[package]]
name = "arrayvec"
version = "0.4.12"
@ -102,18 +96,6 @@ dependencies = [
"nodrop",
]
[[package]]
name = "atk-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "badcf670157c84bb8b1cf6b5f70b650fed78da2033c9eed84c4e49b11cbe83ea"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
]
[[package]]
name = "atomic_refcell"
version = "0.1.8"
@ -177,16 +159,6 @@ version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cairo-sys-rs"
version = "0.14.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b448b876970834fda82ba3aeaccadbd760206b75388fc5c1b02f1e343b697570"
dependencies = [
"libc",
"system-deps",
]
[[package]]
name = "calloop"
version = "0.6.5"
@ -203,15 +175,6 @@ version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0"
[[package]]
name = "cfg-expr"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b412e83326147c2bb881f8b40edfbf9905b9b8abaebd0e47ca190ba62fda8f0e"
dependencies = [
"smallvec",
]
[[package]]
name = "cfg-if"
version = "0.1.10"
@ -466,12 +429,6 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "cty"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
[[package]]
name = "darling"
version = "0.10.2"
@ -750,36 +707,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "gdk-pixbuf-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f097c0704201fbc8f69c1762dc58c6947c8bb188b8ed0bc7e65259f1894fe590"
dependencies = [
"gio-sys",
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
]
[[package]]
name = "gdk-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e091b3d3d6696949ac3b3fb3c62090e5bfd7bd6850bef5c3c5ea701de1b1f1e"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"libc",
"pango-sys",
"pkg-config",
"system-deps",
]
[[package]]
name = "getrandom"
version = "0.2.3"
@ -797,19 +724,6 @@ version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7"
[[package]]
name = "gio-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0a41df66e57fcc287c4bcf74fc26b884f31901ea9792ec75607289b456f48fa"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
"winapi",
]
[[package]]
name = "gl_generator"
version = "0.14.0"
@ -821,16 +735,6 @@ dependencies = [
"xml-rs",
]
[[package]]
name = "glib-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c1d60554a212445e2a858e42a0e48cece1bd57b311a19a9468f70376cf554ae"
dependencies = [
"libc",
"system-deps",
]
[[package]]
name = "glium"
version = "0.30.2"
@ -919,35 +823,6 @@ dependencies = [
"gl_generator",
]
[[package]]
name = "gobject-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa92cae29759dae34ab5921d73fff5ad54b3d794ab842c117e36cafc7994c3f5"
dependencies = [
"glib-sys",
"libc",
"system-deps",
]
[[package]]
name = "gtk-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c14c8d3da0545785a7c5a120345b3abb534010fb8ae0f2ef3f47c027fba303e"
dependencies = [
"atk-sys",
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gdk-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"libc",
"pango-sys",
"system-deps",
]
[[package]]
name = "hashbrown"
version = "0.11.2"
@ -1030,15 +905,6 @@ dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "itertools"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "0.4.8"
@ -1526,18 +1392,6 @@ dependencies = [
"ttf-parser 0.12.3",
]
[[package]]
name = "pango-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2367099ca5e761546ba1d501955079f097caa186bb53ce0f718dca99ac1942fe"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps",
]
[[package]]
name = "parking_lot"
version = "0.11.2"
@ -1672,15 +1526,15 @@ dependencies = [
"rand",
"rayon",
"regex",
"rfd",
"rsql_builder",
"rusqlite",
"serde",
"serde_json",
"shellexpand",
"strum 0.22.0",
"strum_macros 0.22.0",
"strum",
"strum_macros",
"thiserror",
"tinyfiledialogs",
"tracing",
"tracing-subscriber",
"treemap",
@ -1785,15 +1639,6 @@ dependencies = [
"libc",
]
[[package]]
name = "raw-window-handle"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fba75eee94a9d5273a68c9e1e105d9cffe1ef700532325788389e5a83e2522b7"
dependencies = [
"cty",
]
[[package]]
name = "rayon"
version = "1.5.1"
@ -1855,29 +1700,6 @@ version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "rfd"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df102be679ae47c269a6393851bc2cff8760173e7e67a2f1e8110d6578b7c555"
dependencies = [
"block",
"dispatch",
"glib-sys",
"gobject-sys",
"gtk-sys",
"js-sys",
"lazy_static",
"objc",
"objc-foundation",
"objc_id",
"raw-window-handle 0.4.2",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"windows",
]
[[package]]
name = "rsql_builder"
version = "0.1.2"
@ -2077,30 +1899,12 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
[[package]]
name = "strum"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2"
[[package]]
name = "strum"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e"
[[package]]
name = "strum_macros"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "strum_macros"
version = "0.22.0"
@ -2124,24 +1928,6 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "system-deps"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6"
dependencies = [
"anyhow",
"cfg-expr",
"heck",
"itertools",
"pkg-config",
"strum 0.21.0",
"strum_macros 0.21.1",
"thiserror",
"toml",
"version-compare",
]
[[package]]
name = "takeable-option"
version = "0.5.0"
@ -2203,6 +1989,16 @@ dependencies = [
"phf",
]
[[package]]
name = "tinyfiledialogs"
version = "3.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9545b2375cbcb7a7d70cca5e92fbaa096fd89bebd2fbc54a3da7f37d15a54e6b"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "toml"
version = "0.5.8"
@ -2305,12 +2101,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version-compare"
version = "0.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b"
[[package]]
name = "version_check"
version = "0.9.3"
@ -2541,58 +2331,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "054d31561409bbf7e1ee4a4f0a1233ac2bb79cfadf2a398438a04d8dda69225f"
dependencies = [
"windows-sys",
]
[[package]]
name = "windows-sys"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82ca39602d5cbfa692c4b67e3bcbb2751477355141c1ed434c94da4186836ff6"
dependencies = [
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_msvc"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52695a41e536859d5308cc613b4a022261a274390b25bd29dfff4bf08505f3c2"
[[package]]
name = "windows_i686_gnu"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f54725ac23affef038fecb177de6c9bf065787c2f432f79e3c373da92f3e1d8a"
[[package]]
name = "windows_i686_msvc"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d5158a43cc43623c0729d1ad6647e62fa384a3d135fd15108d37c683461f64"
[[package]]
name = "windows_x86_64_gnu"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc31f409f565611535130cfe7ee8e6655d3fa99c1c61013981e491921b5ce954"
[[package]]
name = "windows_x86_64_msvc"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f2b8c7cbd3bfdddd9ab98769f9746a7fad1bca236554cd032b78d768bc0e89f"
[[package]]
name = "winit"
version = "0.25.0"
@ -2617,7 +2355,7 @@ dependencies = [
"objc",
"parking_lot",
"percent-encoding",
"raw-window-handle 0.3.3",
"raw-window-handle",
"scopeguard",
"smithay-client-toolkit 0.12.3",
"wayland-client",

@ -45,7 +45,7 @@ lru = { version = "0.7.0", optional = true }
emlx = { git = "https://github.com/terhechte/emlx", features = []}
walkdir = "2.3.2"
mbox-reader = "0.2.0"
rfd = "0.6.1"
tinyfiledialogs = "3.0"
rand = "0.8.4"
shellexpand = "2.1.0"
image = { version = "0.23", default-features = false, features = ["png"] }

@ -1,9 +1,9 @@
//! The startup form to configure what and how to import
use eframe::egui::epaint::Shadow;
use eframe::egui::{self, vec2, Color32, Pos2, Rect, Response, Stroke, TextStyle, Vec2};
use rfd;
use std::path::PathBuf;
use std::str::FromStr;
use super::super::platform::platform_colors;
use super::super::widgets::background::{shadow_background, AnimatedBackground};
@ -303,14 +303,19 @@ impl StartupUI {
}
fn open_email_folder_dialog(&mut self) {
let fallback = shellexpand::tilde("~/");
let default_path = self
.format
.default_path()
.unwrap_or(std::path::Path::new("~/").to_path_buf());
.unwrap_or(std::path::Path::new(&fallback.to_string()).to_path_buf());
let folder = rfd::FileDialog::new()
.set_directory(default_path)
.pick_folder();
let folder = match tinyfiledialogs::select_folder_dialog(
"Select folder",
default_path.to_str().unwrap_or(""),
) {
Some(result) => PathBuf::from_str(&result).ok(),
None => return,
};
let path = match folder {
Some(path) => path,
@ -326,10 +331,12 @@ impl StartupUI {
#[cfg(target_os = "windows")]
let default_path = "C:\\Users";
let filename = rfd::FileDialog::new()
.add_filter("sqlite", &["sqlite"])
.set_directory(default_path)
.save_file();
let fallback = shellexpand::tilde(default_path).to_string();
let filename = match tinyfiledialogs::save_file_dialog("Select output file", &fallback) {
Some(result) => PathBuf::from_str(&result).ok(),
None => return,
};
let path = match filename {
Some(path) => path,
@ -346,10 +353,16 @@ impl StartupUI {
#[cfg(target_os = "windows")]
let default_path = "C:\\Users";
let filename = rfd::FileDialog::new()
.add_filter("sqlite", &["sqlite"])
.set_directory(default_path)
.pick_file();
let fallback = shellexpand::tilde(default_path).to_string();
let filename = match tinyfiledialogs::open_file_dialog(
"SQlite Database",
&fallback,
Some((&["*.sqlite"], "SQLite")),
) {
Some(n) => PathBuf::from_str(&n).ok(),
None => return None,
};
let path = match filename {
Some(path) => path,

Loading…
Cancel
Save