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: <https://gitlab.gnome.org/World/Phosh/squeekboard/-/merge_requests/620>
This commit is contained in:
committed by
Marge Bot
parent
86674507e1
commit
078f58be26
@ -99,7 +99,12 @@ fn get_theme_name(settings: >k::Settings) -> GtkTheme {
|
|||||||
}).ok();
|
}).ok();
|
||||||
|
|
||||||
#[cfg(feature = "glib_v0_14")]
|
#[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"))]
|
#[cfg(not(feature = "glib_v0_14"))]
|
||||||
let prop = |s: >k::Settings, name| s.get_property(name);
|
let prop = |s: >k::Settings, name| s.get_property(name);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user