From 18ceffed07f680f092ea9b07b002a1b18d37070f Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 25 Aug 2024 21:30:54 +0300 Subject: Proper main menu icon --- Cargo.lock | 157 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 1 + default.nix | 10 +++- icons.toml | 7 +++ src/lib.rs | 1 + src/main.rs | 2 + 6 files changed, 175 insertions(+), 3 deletions(-) create mode 100644 icons.toml diff --git a/Cargo.lock b/Cargo.lock index 95b4e9b..284100d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,6 +27,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aho-corasick" version = "1.1.3" @@ -86,7 +92,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] @@ -130,6 +136,7 @@ dependencies = [ "log", "microformats", "relm4", + "relm4-icons", "serde_json", "serde_urlencoded", "soup3", @@ -224,6 +231,15 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -266,6 +282,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "endi" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" + [[package]] name = "equivalent" version = "1.0.1" @@ -282,6 +304,16 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "flate2" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +dependencies = [ + "crc32fast", + "miniz_oxide 0.8.0", +] + [[package]] name = "flume" version = "0.11.0" @@ -774,6 +806,22 @@ dependencies = [ "system-deps 7.0.2", ] +[[package]] +name = "gvdb" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acfa8cd2aa58da96876eb6276afe617c414d5846d1229274a821c1f8e8aa9e02" +dependencies = [ + "byteorder", + "flate2", + "quick-xml", + "safe-transmute", + "serde", + "serde_json", + "walkdir", + "zvariant", +] + [[package]] name = "hashbrown" version = "0.14.5" @@ -1056,6 +1104,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" version = "1.0.2" @@ -1254,6 +1311,16 @@ dependencies = [ "unicode-ident", ] +[[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 = "quote" version = "1.0.36" @@ -1356,6 +1423,18 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d3b924557df1cddc687b60b313c4b76620fdbf0e463afa4b29f67193ccf37f9" +[[package]] +name = "relm4-icons" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15242978b4e65431be4ccd5cf539d3c142518e114b7ecfa72ffd02cd6432e6e3" +dependencies = [ + "gtk4", + "gvdb", + "serde", + "toml", +] + [[package]] name = "relm4-macros" version = "0.9.0" @@ -1394,6 +1473,21 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[package]] +name = "safe-transmute" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3944826ff8fa8093089aba3acb4ef44b9446a99a16f3bf4e74af3f77d340ab7d" + +[[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 = "scoped-tls" version = "1.0.1" @@ -1563,6 +1657,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "string_enum" version = "0.4.4" @@ -2054,6 +2154,16 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2115,6 +2225,15 @@ version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -2226,3 +2345,39 @@ dependencies = [ "quote", "syn", ] + +[[package]] +name = "zvariant" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe" +dependencies = [ + "endi", + "serde", + "static_assertions", + "zvariant_derive", +] + +[[package]] +name = "zvariant_derive" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73e2ba546bda683a90652bac4a279bc146adad1386f25379cf73200d2002c449" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index 1ef4990..79bae5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ libsecret = { version = "0.5.0", features = ["v0_21_2"] } log = { version = "0.4.22", features = ["std"] } microformats = "0.9.1" relm4 = { version = "0.9.0", features = ["all", "gnome_46", "libpanel"] } +relm4-icons = { version = "0.9.0", features = ["icon-development-kit"] } serde_json = "1.0.125" serde_urlencoded = "0.7.1" soup3 = "0.7.0" diff --git a/default.nix b/default.nix index c129b56..a1d2a80 100644 --- a/default.nix +++ b/default.nix @@ -5,7 +5,7 @@ let src = let - suffixes = [ ]; + suffixes = []; suffixFilter = name: type: let base = baseNameOf (toString name); in type == "directory" || lib.any (ext: lib.hasSuffix ext base) suffixes; @@ -19,6 +19,12 @@ let args = { # pname and version are read from Cargo.toml inherit src; + dummySrc = craneLib.mkDummySrc { + inherit src; + extraDummyScript = '' + cp -r ${./icons.toml} $out/icons.toml + ''; + }; strictDeps = true; # cargoExtraArgs can be used to inject features @@ -38,7 +44,7 @@ let in craneLib.buildPackage (args' // { passthru = { - inherit cargoArtifacts; + inherit src cargoArtifacts; clippy = craneLib.cargoClippy args'; }; }) diff --git a/icons.toml b/icons.toml new file mode 100644 index 0000000..e594704 --- /dev/null +++ b/icons.toml @@ -0,0 +1,7 @@ +# Recommended: Specify your app ID *OR* your base resource path for more robust icon loading +#app_id = "xyz.vikanezrimaya.kittybox.Bowl" +#base_resource_path = "/xyz/vikanezrimaya/kittybox/Bowl/" + +# List of icon names you found (shipped with this crate) +# Note: the file ending `-symbolic.svg` isn't part of the icon name. +icons = ["menu"] diff --git a/src/lib.rs b/src/lib.rs index f684847..530eab6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -193,6 +193,7 @@ impl AsyncComponent for App { set_popover = >k::PopoverMenu::from_model(Some(&main_menu)) {}, #[watch] set_visible: model.micropub.is_some(), + set_icon_name: relm4_icons::icon_names::MENU, }, pack_end = >k::Button { set_icon_name: "document-send-symbolic", diff --git a/src/main.rs b/src/main.rs index a12fe60..11963b0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,6 +7,8 @@ fn main() { log::set_logger(&GLIB_LOGGER).unwrap(); log::set_max_level(log::LevelFilter::Debug); + relm4_icons::initialize_icons(); + let app = relm4::RelmApp::new(bowl::APPLICATION_ID); app.run_async::(()); -- cgit 1.4.1