From 4ad690776753db8e53fb0c54a1060ee2d6863440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Thu, 16 Mar 2023 11:37:51 +0100 Subject: [PATCH] misc: Enable GTK 4.10 APIs --- Cargo.toml | 2 +- meson.build | 4 ++-- src/session/content/room_history/mod.rs | 7 +++++++ src/session/sidebar/mod.rs | 8 ++++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 41063fc5..1c952df2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,7 +73,7 @@ features = ["v1_3"] [dependencies.gtk] package = "gtk4" version = "0.6" -features = ["v4_6"] +features = ["v4_10"] [dependencies.matrix-sdk] git = "https://github.com/matrix-org/matrix-rust-sdk.git" diff --git a/meson.build b/meson.build index 28a9528a..dcecc0e5 100644 --- a/meson.build +++ b/meson.build @@ -11,9 +11,9 @@ base_id = 'org.gnome.Fractal' dependency('glib-2.0', version: '>= 2.66') dependency('gio-2.0', version: '>= 2.66') -dependency('gtk4', version: '>= 4.6.0') +dependency('gtk4', version: '>= 4.10.0') dependency( - 'libadwaita-1', version: '>= 1.2.0', + 'libadwaita-1', version: '>= 1.3.0', fallback: ['libadwaita', 'libadwaita_dep'], default_options: ['tests=false', 'examples=false', 'vapi=false'] ) diff --git a/src/session/content/room_history/mod.rs b/src/session/content/room_history/mod.rs index ad4c0483..fb658c9f 100644 --- a/src/session/content/room_history/mod.rs +++ b/src/session/content/room_history/mod.rs @@ -310,6 +310,13 @@ mod imp { let factory = gtk::SignalListItemFactory::new(); factory.connect_setup(clone!(@weak obj => move |_, item| { + let item = match item.downcast_ref::() { + Some(item) => item, + None => { + error!("List item factory did not receive a list item: {item:?}"); + return; + } + }; let row = ItemRow::new(&obj); item.set_child(Some(&row)); item.bind_property("item", &row, "item").build(); diff --git a/src/session/sidebar/mod.rs b/src/session/sidebar/mod.rs index 41002515..6cb85f8b 100644 --- a/src/session/sidebar/mod.rs +++ b/src/session/sidebar/mod.rs @@ -17,6 +17,7 @@ use gtk::{ glib::{clone, closure}, CompositeTemplate, }; +use log::error; pub use self::{ category::Category, @@ -187,6 +188,13 @@ mod imp { let factory = gtk::SignalListItemFactory::new(); factory.connect_setup(clone!(@weak obj => move |_, item| { + let item = match item.downcast_ref::() { + Some(item) => item, + None => { + error!("List item factory did not receive a list item: {item:?}"); + return; + } + }; let row = Row::new(&obj); item.set_child(Some(&row)); item.bind_property("item", &row, "list-row").build();