diff --git a/Cargo.lock b/Cargo.lock index 7f1c1c77..63d92148 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3975,6 +3975,22 @@ dependencies = [ "system-deps", ] +[[package]] +name = "gvdb" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb9136c388a1e7b3017d18fe7c2f263b0a2b13f215c48e8eb44935d413ce0f9" +dependencies = [ + "byteorder", + "flate2", + "quick-xml", + "safe-transmute", + "serde", + "serde_json", + "walkdir", + "zvariant", +] + [[package]] name = "h2" version = "0.3.22" @@ -7590,6 +7606,16 @@ dependencies = [ "unsigned-varint 0.8.0", ] +[[package]] +name = "quick-xml" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "quicksink" version = "0.1.2" @@ -7965,6 +7991,16 @@ dependencies = [ "tracker", ] +[[package]] +name = "relm4-icons" +version = "0.7.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d2413577ec528e0a4de8d05e7b1f6840e60f2cf14a70b16dfd8d862654c06c" +dependencies = [ + "gtk4", + "gvdb", +] + [[package]] name = "relm4-macros" version = "0.7.0-beta.2" @@ -8303,6 +8339,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +[[package]] +name = "safe-transmute" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98a01dab6acf992653be49205bdd549f32f17cb2803e8eacf1560bf97259aae8" + [[package]] name = "safe_arch" version = "0.7.1" @@ -10561,6 +10603,7 @@ dependencies = [ "parking_lot 0.12.1", "relm4", "relm4-components", + "relm4-icons", "sc-client-api", "sc-client-db", "sc-consensus-slots", diff --git a/Cargo.toml b/Cargo.toml index 8f33a748..82ef4869 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,6 +50,7 @@ mimalloc = "0.1.39" names = "0.14.0" parking_lot = "0.12.1" relm4 = { version = "0.7.0-beta.2", git = "https://github.com/Relm4/Relm4", rev = "f216c7f5ba1324413cb16e45c37e0b9297473ec2" } +relm4-icons = { version = "0.7.0-alpha.2", features = ["checkmark", "cross", "menu-large", "size-horizontally", "ssd", "wallet2"] } relm4-components = { version = "0.7.0-beta.2", git = "https://github.com/Relm4/Relm4", rev = "f216c7f5ba1324413cb16e45c37e0b9297473ec2", default-features = false } sc-client-api = { git = "https://github.com/subspace/polkadot-sdk", rev = "c63a8b28a9fd26d42116b0dcef1f2a5cefb9cd1c", default-features = false } sc-client-db = { git = "https://github.com/subspace/polkadot-sdk", rev = "c63a8b28a9fd26d42116b0dcef1f2a5cefb9cd1c", default-features = false } diff --git a/src/frontend/configuration.rs b/src/frontend/configuration.rs index 0e69deba..f55cd9eb 100644 --- a/src/frontend/configuration.rs +++ b/src/frontend/configuration.rs @@ -5,6 +5,7 @@ use relm4::prelude::*; use relm4_components::open_dialog::{ OpenDialog, OpenDialogMsg, OpenDialogResponse, OpenDialogSettings, }; +use relm4_icons::icon_name; use std::ops::Deref; use std::path::PathBuf; use std::str::FromStr; @@ -79,8 +80,8 @@ impl MaybeValid { fn icon(&self) -> Option<&'static str> { match self { MaybeValid::Unknown(_) => None, - MaybeValid::Valid(_) => Some("emblem-ok-symbolic"), - MaybeValid::Invalid(_) => Some("window-close-symbolic"), + MaybeValid::Valid(_) => Some(icon_name::CHECKMARK), + MaybeValid::Invalid(_) => Some(icon_name::CROSS), } } } @@ -150,6 +151,9 @@ impl Component for ConfigurationView { set_placeholder_text: Some( "stB4S14whneyomiEa22Fu2PzVoibMB7n5PvBFUwafbCbRkC1K", ), + set_primary_icon_name: Some(icon_name::WALLET2), + set_primary_icon_activatable: false, + set_primary_icon_sensitive: false, #[watch] set_secondary_icon_name: model.reward_address.icon(), set_secondary_icon_activatable: false, @@ -193,6 +197,9 @@ impl Component for ConfigurationView { "/media/subspace-node" }, ), + set_primary_icon_name: Some(icon_name::SSD), + set_primary_icon_activatable: false, + set_primary_icon_sensitive: false, #[watch] set_secondary_icon_name: model.node_path.icon(), set_secondary_icon_activatable: false, @@ -210,18 +217,7 @@ impl Component for ConfigurationView { connect_clicked => ConfigurationInput::OpenDirectory( DirectoryKind::NodePath ), - - gtk::Box { - set_spacing: 10, - - gtk::Image { - set_icon_name: Some("folder-new-symbolic"), - }, - - gtk::Label { - set_label: "Select", - }, - }, + set_label: "Select", }, }, }, @@ -259,6 +255,9 @@ impl Component for ConfigurationView { "/media/subspace-farm" }, ), + set_primary_icon_name: Some(icon_name::SSD), + set_primary_icon_activatable: false, + set_primary_icon_sensitive: false, #[watch] set_secondary_icon_name: model.farms.get(0).map(|farm| farm.path.icon()).unwrap_or_default(), set_secondary_icon_activatable: false, @@ -275,18 +274,7 @@ impl Component for ConfigurationView { connect_clicked => ConfigurationInput::OpenDirectory( DirectoryKind::FarmPath(0) ), - - gtk::Box { - set_spacing: 10, - - gtk::Image { - set_icon_name: Some("folder-new-symbolic"), - }, - - gtk::Label { - set_label: "Select", - }, - }, + set_label: "Select", }, }, @@ -306,6 +294,9 @@ impl Component for ConfigurationView { set_placeholder_text: Some( "4T, 2.5TB, 500GiB, etc.", ), + set_primary_icon_name: Some(icon_name::SIZE_HORIZONTALLY), + set_primary_icon_activatable: false, + set_primary_icon_sensitive: false, #[watch] set_secondary_icon_name: model.farms.get(0).map(|farm| farm.size.icon()).unwrap_or_default(), set_secondary_icon_activatable: false, diff --git a/src/main.rs b/src/main.rs index b915a590..caf30b22 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,7 @@ use futures::{select, FutureExt, SinkExt, StreamExt}; use gtk::prelude::*; use relm4::prelude::*; use relm4::RELM_THREADS; +use relm4_icons::icon_name; use std::future::Future; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; @@ -194,7 +195,7 @@ impl AsyncComponent for App { gtk::HeaderBar { pack_end = >k::MenuButton { set_direction: gtk::ArrowType::None, - set_icon_name: "open-menu-symbolic", + set_icon_name: icon_name::MENU_LARGE, #[wrap(Some)] set_popover: menu_popover = >k::Popover { set_halign: gtk::Align::End, @@ -616,6 +617,7 @@ impl Cli { }); app.set_global_css(GLOBAL_CSS); + relm4_icons::initialize_icons(); // Prefer dark theme in cross-platform way if environment is configured that way if let Some(settings) = gtk::Settings::default() {