From ba0957e98740ecbd7ce4c6829a272fb26aeea7b6 Mon Sep 17 00:00:00 2001 From: Aaron Erhardt Date: Fri, 11 Oct 2024 10:54:51 +0200 Subject: [PATCH] Update relm4 to 0.9.1 --- Cargo.lock | 143 ++++++++---------- Cargo.toml | 4 +- ...om.belmoussaoui.GtkRustTemplate.Devel.json | 6 +- src/app.rs | 17 +-- src/main.rs | 2 +- src/modals/about.rs | 17 +-- 6 files changed, 81 insertions(+), 108 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6dcdbbd..f252498 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,22 +67,21 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "cairo-rs" -version = "0.19.4" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ac2a4d0e69036cf0062976f6efcba1aaee3e448594e6514bb2ddf87acce562" +checksum = "e8a0ea147c94108c9613235388f540e4d14c327f7081c9e471fc8ee8a2533e69" dependencies = [ "bitflags", "cairo-sys-rs", "glib", "libc", - "thiserror", ] [[package]] name = "cairo-sys-rs" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3bb3119664efbd78b5e6c93957447944f16bdbced84c17a9f41c7829b81e64" +checksum = "428290f914b9b86089f60f5d8a9f6e440508e1bcff23b25afd51502b0a2da88f" dependencies = [ "glib-sys", "libc", @@ -97,9 +96,9 @@ checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" [[package]] name = "cfg-expr" -version = "0.15.8" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +checksum = "d0890061c4d3223e7267f3bad2ec40b997d64faac1c2815a4a9d95018e2b9e9c" dependencies = [ "smallvec", "target-lexicon", @@ -236,9 +235,9 @@ dependencies = [ [[package]] name = "gdk-pixbuf" -version = "0.19.8" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624eaba126021103c7339b2e179ae4ee8cdab842daab419040710f38ed9f8699" +checksum = "c4c29071a9e92337d8270a85cb0510cda4ac478be26d09ad027cc1d081911b19" dependencies = [ "gdk-pixbuf-sys", "gio", @@ -248,9 +247,9 @@ dependencies = [ [[package]] name = "gdk-pixbuf-sys" -version = "0.19.8" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4efa05a4f83c8cc50eb4d883787b919b85e5f1d8dd10b5a1df53bf5689782379" +checksum = "687343b059b91df5f3fbd87b4307038fa9e647fcc0461d0d3f93e94fee20bf3d" dependencies = [ "gio-sys", "glib-sys", @@ -261,9 +260,9 @@ dependencies = [ [[package]] name = "gdk4" -version = "0.8.2" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db265c9dd42d6a371e09e52deab3a84808427198b86ac792d75fd35c07990a07" +checksum = "c121aeeb0cf7545877ae615dac6bfd088b739d8abee4d55e7143b06927d16a31" dependencies = [ "cairo-rs", "gdk-pixbuf", @@ -276,9 +275,9 @@ dependencies = [ [[package]] name = "gdk4-sys" -version = "0.8.2" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9418fb4e8a67074919fe7604429c45aa74eb9df82e7ca529767c6d4e9dc66dd" +checksum = "7d3c03d1ea9d5199f14f060890fde68a3b5ec5699144773d1fa6abf337bfbc9c" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", @@ -332,9 +331,9 @@ checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "gio" -version = "0.19.8" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c49f117d373ffcc98a35d114db5478bc223341cff53e39a5d6feced9e2ddffe" +checksum = "b8d999e8fb09583e96080867e364bc1e701284ad206c76a5af480d63833ad43c" dependencies = [ "futures-channel", "futures-core", @@ -345,14 +344,13 @@ dependencies = [ "libc", "pin-project-lite", "smallvec", - "thiserror", ] [[package]] name = "gio-sys" -version = "0.19.8" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cd743ba4714d671ad6b6234e8ab2a13b42304d0e13ab7eba1dcdd78a7d6d4ef" +checksum = "4f7efc368de04755344f0084104835b6bb71df2c1d41e37d863947392a894779" dependencies = [ "glib-sys", "gobject-sys", @@ -363,9 +361,9 @@ dependencies = [ [[package]] name = "glib" -version = "0.19.9" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39650279f135469465018daae0ba53357942a5212137515777d5fdca74984a44" +checksum = "adcf1ec6d3650bf9fdbc6cee242d4fcebc6f6bfd9bea5b929b6a8b7344eb85ff" dependencies = [ "bitflags", "futures-channel", @@ -380,14 +378,13 @@ dependencies = [ "libc", "memchr", "smallvec", - "thiserror", ] [[package]] name = "glib-macros" -version = "0.19.9" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4429b0277a14ae9751350ad9b658b1be0abb5b54faa5bcdf6e74a3372582fad7" +checksum = "a6bf88f70cd5720a6197639dcabcb378dd528d0cb68cb1f45e3b358bcb841cd7" dependencies = [ "heck", "proc-macro-crate", @@ -398,9 +395,9 @@ dependencies = [ [[package]] name = "glib-sys" -version = "0.19.8" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c2dc18d3a82b0006d470b13304fbbb3e0a9bd4884cf985a60a7ed733ac2c4a5" +checksum = "5f9eca5d88cfa6a453b00d203287c34a2b7cac3a7831779aa2bb0b3c7233752b" dependencies = [ "libc", "system-deps", @@ -408,9 +405,9 @@ dependencies = [ [[package]] name = "gobject-sys" -version = "0.19.8" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e697e252d6e0416fd1d9e169bda51c0f1c926026c39ca21fbe8b1bb5c3b8b9e" +checksum = "a4c674d2ff8478cf0ec29d2be730ed779fef54415a2fb4b565c52def62696462" dependencies = [ "glib-sys", "libc", @@ -419,9 +416,9 @@ dependencies = [ [[package]] name = "graphene-rs" -version = "0.19.8" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fb86031d24d9ec0a2a15978fc7a65d545a2549642cf1eb7c3dda358da42bcf" +checksum = "1f53144c7fe78292705ff23935f1477d511366fb2f73c43d63b37be89076d2fe" dependencies = [ "glib", "graphene-sys", @@ -430,9 +427,9 @@ dependencies = [ [[package]] name = "graphene-sys" -version = "0.19.8" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f530e0944bccba4b55065e9c69f4975ad691609191ebac16e13ab8e1f27af05" +checksum = "e741797dc5081e59877a4d72c442c72d61efdd99161a0b1c1b29b6b988934b99" dependencies = [ "glib-sys", "libc", @@ -442,9 +439,9 @@ dependencies = [ [[package]] name = "gsk4" -version = "0.8.2" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7563884bf6939f4468e5d94654945bdd9afcaf8c3ba4c5dd17b5342b747221be" +checksum = "aa21a2f7c51ee1c6cc1242c2faf3aae2b7566138f182696759987bde8219e922" dependencies = [ "cairo-rs", "gdk4", @@ -457,9 +454,9 @@ dependencies = [ [[package]] name = "gsk4-sys" -version = "0.8.2" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23024bf2636c38bbd1f822f58acc9d1c25b28da896ff0f291a1a232d4272b3dc" +checksum = "0f9fb607554f9f4e8829eb7ea301b0fde051e1dbfd5d16b143a8a9c2fac6c01b" dependencies = [ "cairo-sys-rs", "gdk4-sys", @@ -483,9 +480,9 @@ dependencies = [ [[package]] name = "gtk4" -version = "0.8.2" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b04e11319b08af11358ab543105a9e49b0c491faca35e2b8e7e36bfba8b671ab" +checksum = "31e2d105ce672f5cdcb5af2602e91c2901e91c72da15ab76f613ad57ecf04c6d" dependencies = [ "cairo-rs", "field-offset", @@ -504,9 +501,9 @@ dependencies = [ [[package]] name = "gtk4-macros" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec655a7ef88d8ce9592899deb8b2d0fa50bab1e6dd69182deb764e643c522408" +checksum = "e9e7b362c8fccd2712297903717d65d30defdab2b509bc9d209cbe5ffb9fabaf" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -516,9 +513,9 @@ dependencies = [ [[package]] name = "gtk4-sys" -version = "0.8.2" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c8aa86b7f85ea71d66ea88c1d4bae1cfacf51ca4856274565133838d77e57b5" +checksum = "cbe4325908b1c1642dbb48e9f49c07a73185babf43e8b2065b0f881a589f55b8" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", @@ -578,11 +575,10 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libadwaita" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91b4990248b9e1ec5e72094a2ccaea70ec3809f88f6fd52192f2af306b87c5d9" +checksum = "2ff9c222b5c783729de45185f07b2fec2d43a7f9c63961e777d3667e20443878" dependencies = [ - "gdk-pixbuf", "gdk4", "gio", "glib", @@ -594,9 +590,9 @@ dependencies = [ [[package]] name = "libadwaita-sys" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a748e4e92be1265cd9e93d569c0b5dfc7814107985aa6743d670ab281ea1a8" +checksum = "1c44d8bdbad31d6639e1f20cc9c1424f1a8e02d751fc28d44659bf743fb9eca6" dependencies = [ "gdk4-sys", "gio-sys", @@ -757,9 +753,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "pango" -version = "0.19.8" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f0d328648058085cfd6897c9ae4272884098a926f3a833cd50c8c73e6eccecd" +checksum = "aa26aa54b11094d72141a754901cd71d9356432bb8147f9cace8d9c7ba95f356" dependencies = [ "gio", "glib", @@ -769,9 +765,9 @@ dependencies = [ [[package]] name = "pango-sys" -version = "0.19.8" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff03da4fa086c0b244d4a4587d3e20622a3ecdb21daea9edf66597224c634ba0" +checksum = "84fd65917bf12f06544ae2bbc200abf9fc0a513a5a88a0fa81013893aef2b838" dependencies = [ "glib-sys", "gobject-sys", @@ -855,9 +851,9 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "relm4" -version = "0.8.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e0e187b58db367305e8486d3228158251da1c8ba1e18baa9de61894e822649" +checksum = "30837553c1a8cfea1a404c83ec387c5c8ff9358e1060b057c274c5daa5035ad1" dependencies = [ "flume", "fragile", @@ -865,16 +861,23 @@ dependencies = [ "gtk4", "libadwaita", "once_cell", + "relm4-css", "relm4-macros", "tokio", "tracing", ] +[[package]] +name = "relm4-css" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d3b924557df1cddc687b60b313c4b76620fdbf0e463afa4b29f67193ccf37f9" + [[package]] name = "relm4-macros" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0774e846889823aa5766f5b62cface3189a5b36280e65b2faaa6df0319da1726" +checksum = "fc5885640821d60062497737dd42fd04248d13c7ecccee620caaa4b210fe9905" dependencies = [ "proc-macro2", "quote", @@ -983,9 +986,9 @@ dependencies = [ [[package]] name = "system-deps" -version = "6.2.2" +version = "7.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +checksum = "66d23aaf9f331227789a99e8de4c91bf46703add012bdfd45fdecdfb2975a005" dependencies = [ "cfg-expr", "heck", @@ -996,9 +999,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.15" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4873307b7c257eddcb50c9bedf158eb669578359fb28428bef438fec8e6ba7c2" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "temp-dir" @@ -1006,26 +1009,6 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f227968ec00f0e5322f9b8173c7a0cbcff6181a0a5b28e9892491c286277231" -[[package]] -name = "thiserror" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "thread_local" version = "1.1.8" diff --git a/Cargo.toml b/Cargo.toml index 562ad94..be50f58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,6 @@ lto = true [dependencies] gettext-rs = { version = "0.7", features = ["gettext-system"] } -relm4 = { version = "0.8.1", features = ["libadwaita", "gnome_46"] } -tracing = "0.1.37" +relm4 = { version = "0.9.1", features = ["libadwaita", "gnome_47"] } +tracing = "0.1.40" tracing-subscriber = "0.3" diff --git a/build-aux/com.belmoussaoui.GtkRustTemplate.Devel.json b/build-aux/com.belmoussaoui.GtkRustTemplate.Devel.json index 3af56d5..9d37692 100644 --- a/build-aux/com.belmoussaoui.GtkRustTemplate.Devel.json +++ b/build-aux/com.belmoussaoui.GtkRustTemplate.Devel.json @@ -1,11 +1,11 @@ { "id": "com.belmoussaoui.GtkRustTemplate.Devel", "runtime": "org.gnome.Platform", - "runtime-version": "46", + "runtime-version": "47", "sdk": "org.gnome.Sdk", "sdk-extensions": [ "org.freedesktop.Sdk.Extension.rust-stable", - "org.freedesktop.Sdk.Extension.llvm16" + "org.freedesktop.Sdk.Extension.llvm18" ], "command": "gtk-rust-template", "finish-args": [ @@ -18,7 +18,7 @@ "--env=RUST_BACKTRACE=1" ], "build-options": { - "append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm16/bin", + "append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm18/bin", "build-args": [ "--share=network" ], diff --git a/src/app.rs b/src/app.rs index b4568b8..b1ed786 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,7 +1,6 @@ use relm4::{ actions::{RelmAction, RelmActionGroup}, - adw, gtk, main_application, Component, ComponentController, ComponentParts, ComponentSender, - Controller, SimpleComponent, + adw, gtk, main_application, Component, ComponentParts, ComponentSender, SimpleComponent, }; use gtk::prelude::{ @@ -12,9 +11,7 @@ use gtk::{gio, glib}; use crate::config::{APP_ID, PROFILE}; use crate::modals::about::AboutDialog; -pub(super) struct App { - about_dialog: Controller, -} +pub(super) struct App {} #[derive(Debug)] pub(super) enum AppMsg { @@ -93,12 +90,7 @@ impl SimpleComponent for App { root: Self::Root, sender: ComponentSender, ) -> ComponentParts { - let about_dialog = AboutDialog::builder() - .transient_for(&root) - .launch(()) - .detach(); - - let model = Self { about_dialog }; + let model = Self {}; let widgets = view_output!(); @@ -112,9 +104,8 @@ impl SimpleComponent for App { }; let about_action = { - let sender = model.about_dialog.sender().clone(); RelmAction::::new_stateless(move |_| { - sender.send(()).unwrap(); + AboutDialog::builder().launch(()).detach(); }) }; diff --git a/src/main.rs b/src/main.rs index af6a7a8..b103b1e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,6 +62,6 @@ fn main() { gio::ResourceLookupFlags::NONE, ) .unwrap(); - app.set_global_css(&glib::GString::from_utf8_checked(data.to_vec()).unwrap()); + relm4::set_global_css(&glib::GString::from_utf8_checked(data.to_vec()).unwrap()); app.visible_on_activate(false).run::(()); } diff --git a/src/modals/about.rs b/src/modals/about.rs index 8d46fa7..ed6129e 100644 --- a/src/modals/about.rs +++ b/src/modals/about.rs @@ -1,4 +1,5 @@ -use gtk::prelude::GtkWindowExt; +use adw::prelude::AdwDialogExt; +use gtk::prelude::GtkApplicationExt; use relm4::{adw, gtk, ComponentParts, ComponentSender, SimpleComponent}; use crate::config::{APP_ID, VERSION}; @@ -7,13 +8,13 @@ pub struct AboutDialog {} impl SimpleComponent for AboutDialog { type Init = (); - type Widgets = adw::AboutWindow; + type Widgets = adw::AboutDialog; type Input = (); type Output = (); - type Root = adw::AboutWindow; + type Root = adw::AboutDialog; fn init_root() -> Self::Root { - adw::AboutWindow::builder() + adw::AboutDialog::builder() .application_icon(APP_ID) // Insert your license of choice here // .license_type(gtk::License::MitX11) @@ -25,10 +26,9 @@ impl SimpleComponent for AboutDialog { .application_name("Relm4-template") .version(VERSION) .translator_credits("translator-credits") - .copyright("© 2023 Bilal Elmoussaoui") + .copyright("© 2024 Bilal Elmoussaoui") .developers(vec!["Bilal Elmoussaoui"]) .designers(vec!["Bilal Elmoussaoui"]) - .hide_on_close(true) .build() } @@ -40,11 +40,10 @@ impl SimpleComponent for AboutDialog { let model = Self {}; let widgets = root.clone(); + widgets.present(Some(&relm4::main_application().windows()[0])); ComponentParts { model, widgets } } - fn update_view(&self, dialog: &mut Self::Widgets, _sender: ComponentSender) { - dialog.present(); - } + fn update_view(&self, _dialog: &mut Self::Widgets, _sender: ComponentSender) {} }