summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock30
-rw-r--r--Cargo.toml5
-rwxr-xr-xbuild.rs9
-rw-r--r--default.nix8
-rw-r--r--icons.toml2
-rw-r--r--icons/bowl.svg28
-rw-r--r--meson.build6
-rw-r--r--src/lib.rs7
-rw-r--r--src/main.rs2
9 files changed, 72 insertions, 25 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 9275f73..9b4b163 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -127,6 +127,7 @@ dependencies = [
  "microformats",
  "relm4",
  "relm4-icons",
+ "relm4-icons-build",
  "serde",
  "serde_json",
  "serde_urlencoded",
@@ -733,17 +734,16 @@ dependencies = [
 
 [[package]]
 name = "gvdb"
-version = "0.6.1"
+version = "0.7.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "acfa8cd2aa58da96876eb6276afe617c414d5846d1229274a821c1f8e8aa9e02"
+checksum = "d5469af05ff2285b41c9e79a2c7f825cb59dff3b22791befe1aec0c8ab987791"
 dependencies = [
- "byteorder",
  "flate2",
  "quick-xml",
- "safe-transmute",
  "serde",
  "serde_json",
  "walkdir",
+ "zerocopy",
  "zvariant",
 ]
 
@@ -1383,9 +1383,9 @@ dependencies = [
 
 [[package]]
 name = "quick-xml"
-version = "0.31.0"
+version = "0.36.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33"
+checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe"
 dependencies = [
  "memchr",
  "serde",
@@ -1494,11 +1494,19 @@ checksum = "1d3b924557df1cddc687b60b313c4b76620fdbf0e463afa4b29f67193ccf37f9"
 
 [[package]]
 name = "relm4-icons"
-version = "0.9.0"
+version = "0.10.0-beta.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15242978b4e65431be4ccd5cf539d3c142518e114b7ecfa72ffd02cd6432e6e3"
+checksum = "929f301d6723d8d1fa443d764b3a1d864b287d3cb0beb889500b39cf714d5e81"
 dependencies = [
  "gtk4",
+]
+
+[[package]]
+name = "relm4-icons-build"
+version = "0.10.0-beta.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11ffa92b81d7b55dc115e5c8555df3e585a8aec3648862e821da81a0ce0cebd3"
+dependencies = [
  "gvdb",
  "serde",
  "toml",
@@ -1543,12 +1551,6 @@ 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"
diff --git a/Cargo.toml b/Cargo.toml
index 71b5b82..d4723d1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,9 @@ edition = "2021"
 smart-summary = []
 default = ["smart-summary"]
 
+[build-dependencies]
+relm4-icons-build = "0.10.0-beta.1"
+
 [dependencies]
 adw = { version = "0.7.0", package = "libadwaita", features = ["v1_6"] }
 futures = "0.3.30"
@@ -22,7 +25,7 @@ libsecret = { version = "0.7.0", features = ["v0_21_2"] }
 log = { version = "0.4.22", features = ["std"] }
 microformats = "0.9.1"
 relm4 = { version = "0.9.0", features = ["gnome_46", "adw", "css", "macros", "libadwaita"] }
-relm4-icons = { version = "0.9.0", features = ["icon-development-kit"] }
+relm4-icons = { version = "0.10.0-beta.1", features = ["icon-development-kit"] }
 serde = { version = "1.0.208", features = ["derive"] }
 serde_json = "1.0.125"
 serde_urlencoded = "0.7.1"
diff --git a/build.rs b/build.rs
index e3491bb..595f395 100755
--- a/build.rs
+++ b/build.rs
@@ -17,4 +17,13 @@ fn main() {
             path
         }.display())
     }
+
+    relm4_icons_build::bundle_icons(
+        "icons.rs",
+        Some("xyz.vikanezrimaya.kittybox.Bowl"),
+        None::<&str>,
+        Some("./icons"),
+        // Stock icons to include
+        ["menu", "magic-wand"],
+    );
 }
diff --git a/default.nix b/default.nix
index 881b656..de622f9 100644
--- a/default.nix
+++ b/default.nix
@@ -9,7 +9,7 @@
 
 let
   src = let
-    suffixes = [ "meson.options" "meson.build" ".sh" ".po" ".pot" ".in" "LINGUAS" ];
+    suffixes = [ "meson.options" "meson.build" ".sh" ".po" ".pot" ".in" "LINGUAS" ".svg" ];
     suffixFilter = name: type: let
       base = baseNameOf (toString name);
     in type == "directory" || lib.any (ext: lib.hasSuffix ext base) suffixes;
@@ -23,12 +23,6 @@ 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;
 
     buildInputs = [
diff --git a/icons.toml b/icons.toml
index 61797c1..ecd2940 100644
--- a/icons.toml
+++ b/icons.toml
@@ -1,5 +1,5 @@
 # Recommended: Specify your app ID *OR* your base resource path for more robust icon loading
-#app_id = "xyz.vikanezrimaya.kittybox.Bowl"
+app_id = "xyz.vikanezrimaya.kittybox.Bowl"
 #base_resource_path = "/xyz/vikanezrimaya/kittybox/Bowl/"
 
 # List of icon names you found (shipped with this crate)
diff --git a/icons/bowl.svg b/icons/bowl.svg
new file mode 100644
index 0000000..d788643
--- /dev/null
+++ b/icons/bowl.svg
@@ -0,0 +1,28 @@
+<svg version="1.1" width="512" height="512" xmlns="http://www.w3.org/2000/svg">
+  <defs>
+    <linearGradient id="outsides">
+      <stop offset="0%" stop-color="#F0F0F0" />
+      <stop offset="20%" stop-color="#C0C0C0" />
+      <stop offset="80%" stop-color="#F0F0F0" />
+      <stop offset="100%" stop-color="lightgray" />
+    </linearGradient>
+    <!-- TODO: could be improved by using SVG filters instead of a gradient? -->
+    <radialGradient id="insides" cy="1">
+      <stop offset="0%" stop-color="#404040" />
+      <stop offset="60%" stop-color="gray" />
+      <stop offset="100%" stop-color="#D2D2D2" />
+    </radialGradient>
+  </defs>
+
+  <g stroke="#202020" stroke-width="16">
+    <!-- The outer border of the bowl: two Bezier curves joined by an arc on the bottom -->
+    <path d="M 58 232
+             Q 34 277 16 328
+             A 240 84 0 0 0 496 328
+             Q 478 277 454 232
+             Z
+             " fill="url(#outsides)" />
+    <!-- top rim of the bowl and its insides -->
+    <ellipse cx="256" cy="232" rx="198" ry="60" fill="url(#insides)" />
+  </g>
+</svg>
diff --git a/meson.build b/meson.build
index cc832f5..1e57bd9 100644
--- a/meson.build
+++ b/meson.build
@@ -61,6 +61,12 @@ subdir('src')
 subdir('po')
 subdir('data')
 
+install_data(
+  meson.project_source_root() / 'icons' / 'bowl.svg',
+  install_dir: iconsdir / 'hicolor' / 'scalable' / 'apps',
+  rename: '@0@.svg'.format(application_id)
+)
+
 gnome.post_install(
   gtk_update_icon_cache: false,
   glib_compile_schemas: true,
diff --git a/src/lib.rs b/src/lib.rs
index 111be23..9e7569f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,6 +3,10 @@ use adw::prelude::*;
 use libsecret::prelude::{RetrievableExtManual, RetrievableExt};
 use relm4::{actions::{RelmAction, RelmActionGroup}, gtk, loading_widgets::LoadingWidgets, prelude::{AsyncComponent, AsyncComponentController, AsyncComponentParts, AsyncController, ComponentController, Controller}, AsyncComponentSender, Component, RelmWidgetExt};
 
+pub mod icons {
+    include!(concat!(env!("OUT_DIR"), "/icons.rs"));
+}
+
 pub mod components {
     pub(crate) mod smart_summary;
     #[cfg(feature = "smart-summary")]
@@ -413,7 +417,7 @@ impl AsyncComponent for App {
                         set_popover = &gtk::PopoverMenu::from_model(Some(&main_menu)) {},
                         #[watch]
                         set_visible: model.micropub.is_some(),
-                        set_icon_name: relm4_icons::icon_names::MENU,
+                        set_icon_name: "menu",
                     },
                     pack_end = &gtk::Button {
                         set_icon_name: "document-send-symbolic",
@@ -550,6 +554,7 @@ impl AsyncComponent for App {
             Input::SubmitButtonPressed => {
                 if self.micropub.is_some() {
                     self.submit_busy_guard = Some(relm4::main_adw_application().mark_busy());
+                    // TODO: too easy to deadlock here, refactor to take a channel
                     self.post_editor.emit(PostEditorInput::Submit);
                 };
             },
diff --git a/src/main.rs b/src/main.rs
index d7dd0a1..59b4bc0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,7 +14,7 @@ fn main() {
     log::set_logger(&GLIB_LOGGER).unwrap();
     log::set_max_level(log::LevelFilter::Debug);
 
-    relm4_icons::initialize_icons();
+    relm4_icons::initialize_icons(bowl::icons::GRESOURCE_BYTES, bowl::icons::RESOURCE_PREFIX);
 
     let app = relm4::RelmApp::new(bowl::APPLICATION_ID);
     relm4::set_global_css(".tag-pill button {