mirror of
https://github.com/13hannes11/toolbx-tuner.git
synced 2024-09-03 23:21:00 +02:00
add unsupported dialogue to be shown if not all prerequisits are fulfilled
This commit is contained in:
173
Cargo.lock
generated
173
Cargo.lock
generated
@@ -82,6 +82,12 @@ version = "3.15.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "cairo-rs"
|
||||
version = "0.17.10"
|
||||
@@ -129,6 +135,15 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
@@ -145,6 +160,16 @@ dependencies = [
|
||||
"rustc_version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flume"
|
||||
version = "0.10.14"
|
||||
@@ -555,6 +580,24 @@ dependencies = [
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gvdb"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7139233c0ecb66f285c47a3c1c02b35c8d52a42ca4c7448d0163e5637bb4bd3"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"flate2",
|
||||
"lazy_static",
|
||||
"memmap2",
|
||||
"quick-xml",
|
||||
"safe-transmute",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"walkdir",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.3"
|
||||
@@ -583,6 +626,12 @@ dependencies = [
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.68"
|
||||
@@ -681,6 +730,15 @@ version = "2.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.9.0"
|
||||
@@ -885,6 +943,16 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.35"
|
||||
@@ -941,6 +1009,16 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "relm4-icons"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e28bcc718a587bcfa31b034e0b8f4efe5b70e945b7de9d7d154b45357a0dadc"
|
||||
dependencies = [
|
||||
"gtk4",
|
||||
"gvdb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "relm4-macros"
|
||||
version = "0.6.2"
|
||||
@@ -967,6 +1045,27 @@ dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
|
||||
|
||||
[[package]]
|
||||
name = "safe-transmute"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98a01dab6acf992653be49205bdd549f32f17cb2803e8eacf1560bf97259aae8"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
@@ -999,6 +1098,17 @@ dependencies = [
|
||||
"syn 2.0.51",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.114"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "0.6.5"
|
||||
@@ -1041,6 +1151,12 @@ dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
@@ -1180,6 +1296,7 @@ version = "0.0.1"
|
||||
dependencies = [
|
||||
"gettext-rs",
|
||||
"relm4",
|
||||
"relm4-icons",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
@@ -1265,6 +1382,16 @@ version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
@@ -1341,6 +1468,15 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
@@ -1364,3 +1500,40 @@ checksum = "7a4191c47f15cc3ec71fcb4913cb83d58def65dd3787610213c649283b5ce178"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zvariant"
|
||||
version = "3.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4eef2be88ba09b358d3b58aca6e41cd853631d44787f319a1383ca83424fb2db"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"libc",
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"zvariant_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zvariant_derive"
|
||||
version = "3.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37c24dc0bed72f5f90d1f8bb5b07228cbf63b3c6e9f82d82559d4bae666e7ed9"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
"zvariant_utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zvariant_utils"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
@@ -13,3 +13,4 @@ gettext-rs = { version = "0.7", features = ["gettext-system"] }
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = "0.3"
|
||||
relm4 = { version = "0.6.0", features = ["libadwaita", "gnome_44"] }
|
||||
relm4-icons = { version = "0.6.0", features = ["issue"] }
|
||||
|
||||
15
src/app.rs
15
src/app.rs
@@ -11,8 +11,10 @@ use gtk::{gio, glib};
|
||||
|
||||
use crate::config::{APP_ID, PROFILE};
|
||||
use crate::modals::about::AboutDialog;
|
||||
use crate::modals::unsupported::UnsupportedDialog;
|
||||
|
||||
pub(super) struct App {
|
||||
unsupported_dialog: Controller<UnsupportedDialog>,
|
||||
about_dialog: Controller<AboutDialog>,
|
||||
}
|
||||
|
||||
@@ -96,7 +98,15 @@ impl SimpleComponent for App {
|
||||
.launch(())
|
||||
.detach();
|
||||
|
||||
let model = Self { about_dialog };
|
||||
let unsupported_dialog = UnsupportedDialog::builder()
|
||||
.transient_for(root)
|
||||
.launch(())
|
||||
.detach();
|
||||
|
||||
let model = Self {
|
||||
about_dialog,
|
||||
unsupported_dialog,
|
||||
};
|
||||
|
||||
let widgets = view_output!();
|
||||
|
||||
@@ -116,6 +126,9 @@ impl SimpleComponent for App {
|
||||
})
|
||||
};
|
||||
|
||||
let sender = model.unsupported_dialog.sender().clone();
|
||||
sender.send(()).unwrap();
|
||||
|
||||
actions.add_action(shortcuts_action);
|
||||
actions.add_action(about_action);
|
||||
actions.register_for_widget(&widgets.main_window);
|
||||
|
||||
@@ -42,6 +42,7 @@ fn main() {
|
||||
app.set_accelerators_for_action::<QuitAction>(&["<Control>q"]);
|
||||
|
||||
let app = RelmApp::from_app(app);
|
||||
relm4_icons::initialize_icons();
|
||||
|
||||
app.run::<App>(());
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
pub mod about;
|
||||
pub mod unsupported;
|
||||
|
||||
49
src/modals/unsupported.rs
Normal file
49
src/modals/unsupported.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
use adw::StatusPage;
|
||||
use gtk::prelude::GtkWindowExt;
|
||||
use relm4::view;
|
||||
use relm4::{adw, gtk, ComponentParts, ComponentSender, SimpleComponent};
|
||||
use relm4_icons::icon_name;
|
||||
pub struct UnsupportedDialog {}
|
||||
|
||||
impl SimpleComponent for UnsupportedDialog {
|
||||
type Init = ();
|
||||
type Widgets = adw::Window;
|
||||
type Input = ();
|
||||
type Output = ();
|
||||
type Root = adw::Window;
|
||||
|
||||
fn init_root() -> Self::Root {
|
||||
adw::Window::builder().build()
|
||||
}
|
||||
|
||||
fn init(
|
||||
_: Self::Init,
|
||||
root: &Self::Root,
|
||||
_sender: ComponentSender<Self>,
|
||||
) -> ComponentParts<Self> {
|
||||
let model = Self {};
|
||||
|
||||
view! {
|
||||
widgets = root.clone() {
|
||||
set_hide_on_close: true,
|
||||
set_modal: true,
|
||||
set_resizable: false,
|
||||
set_default_width: 400,
|
||||
|
||||
StatusPage::new() {
|
||||
set_icon_name: Some(icon_name::ISSUE),
|
||||
set_title: "Missing requirements",
|
||||
set_description: Some("Make sure Toolbx and Gnome Terminal are installed."),
|
||||
set_child: Some(>k::Button::with_label("Goodbye!")),
|
||||
},
|
||||
}
|
||||
}
|
||||
// TODO: when dialgue closes close application
|
||||
// TODO: close application on button press
|
||||
ComponentParts { model, widgets }
|
||||
}
|
||||
|
||||
fn update_view(&self, dialog: &mut Self::Widgets, _sender: ComponentSender<Self>) {
|
||||
dialog.present();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user