replace adw::ActionRow with custom gtk::Box implementation

This commit is contained in:
yggverse 2024-11-20 16:06:33 +02:00
parent 0091175d2a
commit 22f0e59479

View File

@ -1,14 +1,13 @@
mod item;
use item::Item;
use adw::ActionRow;
use gtk::{
gio::{
prelude::{Cast, CastNone},
ListStore,
},
prelude::ListItemExt,
DropDown, ListItem, SignalListItemFactory,
prelude::{BoxExt, ListItemExt},
Align, Box, DropDown, Label, ListItem, SignalListItemFactory,
};
pub struct List {
@ -33,13 +32,27 @@ impl List {
let list_item = gobject.downcast_ref::<ListItem>().unwrap();
let item = list_item.item().and_downcast::<Item>().unwrap();
// Update menu item
list_item.set_child(Some(
&ActionRow::builder()
.title(item.title())
.subtitle(item.subtitle())
// Build row widget
let child = Box::builder()
.orientation(gtk::Orientation::Vertical)
.build();
child.append(
&Label::builder()
.halign(Align::Start)
.label(item.title())
.build(),
));
);
child.append(
&Label::builder()
.halign(Align::Start)
.label(item.subtitle())
.css_classes(["caption", "dim-label"])
.build(),
);
// Update menu item
list_item.set_child(Some(&child));
});
// Init list `GObject`