From 078f58be26fdc04ae20a2b2cbb4528ff161dd848 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Tue, 27 Jun 2023 13:52:17 +0200 Subject: [PATCH] src: style: fix build with newer gtk-rs `gtk::Settings::property()` no longer returns a `Result` but instead panics if the property doesn't exist. In order to work around this change without affecting the surrounding code too much, this patch modifies the `prop` function so we can avoid panics and wrap the property value into a `Result` as was previously the case. Part-of: --- src/style.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/style.rs b/src/style.rs index fce40598..3f615b36 100644 --- a/src/style.rs +++ b/src/style.rs @@ -99,7 +99,12 @@ fn get_theme_name(settings: >k::Settings) -> GtkTheme { }).ok(); #[cfg(feature = "glib_v0_14")] - let prop = |s: >k::Settings, name| s.property(name); + let prop = |s: >k::Settings, name| { + if s.has_property(name, None) { + return Ok(s.property_value(name)); + } + return Err("Key not found in settings"); + }; #[cfg(not(feature = "glib_v0_14"))] let prop = |s: >k::Settings, name| s.get_property(name);