From 40b6ac23745563bcfc1c704348d60648926422bb Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Thu, 10 Oct 2024 05:45:43 +0300 Subject: [PATCH 1/2] Switch to GTK 4.14 feature level --- Cargo.toml | 2 +- src/frontend.rs | 13 +++++++------ src/frontend/widgets/progress_circle.rs | 1 + 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 53f50b8c..0b580886 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,7 @@ frame-system = { git = "https://github.com/subspace/polkadot-sdk", rev = "587181 fs4 = "0.10.0" futures = "0.3.31" futures-timer = "3.0.3" -gtk = { version = "0.7.3", package = "gtk4" } +gtk = { version = "0.7.3", package = "gtk4", features = ["v4_14"] } hex = "0.4.3" image = { version = "0.25.2", default-features = false, features = ["png"] } mimalloc = "0.1.43" diff --git a/src/frontend.rs b/src/frontend.rs index 0f30dcb2..e08c477b 100644 --- a/src/frontend.rs +++ b/src/frontend.rs @@ -99,8 +99,9 @@ impl NotificationExt for Notification { } #[thread_local] -static PIXBUF_ABOUT_IMG: LazyCell = LazyCell::new(|| { - gtk::gdk_pixbuf::Pixbuf::from_read(ABOUT_IMAGE).expect("Statically correct image; qed") +static PIXBUF_ABOUT_IMG: LazyCell = LazyCell::new(|| { + gtk::gdk::Texture::from_bytes(&glib::Bytes::from_static(ABOUT_IMAGE)) + .expect("Statically correct image; qed") }); #[derive(Debug)] @@ -329,7 +330,7 @@ impl AsyncComponent for App { gtk::Image { set_height_request: 256, - set_from_pixbuf: Some(&*PIXBUF_ABOUT_IMG), + set_from_paintable: Some(&*PIXBUF_ABOUT_IMG), }, gtk::Label { @@ -359,7 +360,7 @@ impl AsyncComponent for App { gtk::Image { set_height_request: 256, - set_from_pixbuf: Some(&*PIXBUF_ABOUT_IMG), + set_from_paintable: Some(&*PIXBUF_ABOUT_IMG), }, gtk::Label { @@ -567,7 +568,7 @@ impl AsyncComponent for App { .website(env!("CARGO_PKG_REPOSITORY")) .website_label("GitHub") .comments(env!("CARGO_PKG_DESCRIPTION")) - .logo(>k::gdk::Texture::for_pixbuf(&PIXBUF_ABOUT_IMG)) + .logo(&*PIXBUF_ABOUT_IMG) .system_information({ let config_directory = dirs::config_local_dir() .map(|config_local_dir| { @@ -768,7 +769,7 @@ impl AsyncComponent for App { } } AppInput::ShowAboutDialog => { - self.about_dialog.show(); + self.about_dialog.present(); } AppInput::InitialConfiguration => { self.set_current_view(View::Configuration); diff --git a/src/frontend/widgets/progress_circle.rs b/src/frontend/widgets/progress_circle.rs index 04ff3b28..1400e245 100644 --- a/src/frontend/widgets/progress_circle.rs +++ b/src/frontend/widgets/progress_circle.rs @@ -49,6 +49,7 @@ impl Component for ProgressCircle { move |drawing_area, cr, width, height| { let progress = *progress.borrow(); + #[allow(deprecated, reason = "Not clear what is the replacement, see https://discourse.gnome.org/t/replacement-for-gtk-style-context-get-color/23026?u=nazar-pc")] let color = drawing_area.style_context().color(); // Center coordinates From 74b8ce7cde4fe0977a96f27df8a1cb62f2680fad Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Thu, 10 Oct 2024 05:50:18 +0300 Subject: [PATCH 2/2] Update version for MSI to be able to build pre-release package --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4928395..0fb3c36b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11892,7 +11892,7 @@ dependencies = [ [[package]] name = "space-acres" -version = "0.2.0-pre-release" +version = "0.2.0-pre-release.0" dependencies = [ "anyhow", "arc-swap", diff --git a/Cargo.toml b/Cargo.toml index 0b580886..65e4aee3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "space-acres" description = "Space Acres is an opinionated GUI application for farming on Autonomys Network" license = "0BSD" -version = "0.2.0-pre-release" +version = "0.2.0-pre-release.0" authors = ["Nazar Mokrynskyi "] repository = "https://github.com/autonomys/space-acres" edition = "2021"