misc: Enable GTK 4.10 APIs

This commit is contained in:
Kévin Commaille 2023-03-16 11:37:51 +01:00 committed by Kévin Commaille
parent 4e1d40d7f2
commit 4ad6907767
4 changed files with 18 additions and 3 deletions

View file

@ -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"

View file

@ -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']
)

View file

@ -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::<gtk::ListItem>() {
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();

View file

@ -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::<gtk::ListItem>() {
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();