mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-29 20:44:25 +00:00
replace adw::ActionRow with custom gtk::Box implementation
This commit is contained in:
parent
0091175d2a
commit
22f0e59479
@ -1,14 +1,13 @@
|
|||||||
mod item;
|
mod item;
|
||||||
use item::Item;
|
use item::Item;
|
||||||
|
|
||||||
use adw::ActionRow;
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
gio::{
|
gio::{
|
||||||
prelude::{Cast, CastNone},
|
prelude::{Cast, CastNone},
|
||||||
ListStore,
|
ListStore,
|
||||||
},
|
},
|
||||||
prelude::ListItemExt,
|
prelude::{BoxExt, ListItemExt},
|
||||||
DropDown, ListItem, SignalListItemFactory,
|
Align, Box, DropDown, Label, ListItem, SignalListItemFactory,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct List {
|
pub struct List {
|
||||||
@ -33,13 +32,27 @@ impl List {
|
|||||||
let list_item = gobject.downcast_ref::<ListItem>().unwrap();
|
let list_item = gobject.downcast_ref::<ListItem>().unwrap();
|
||||||
let item = list_item.item().and_downcast::<Item>().unwrap();
|
let item = list_item.item().and_downcast::<Item>().unwrap();
|
||||||
|
|
||||||
// Update menu item
|
// Build row widget
|
||||||
list_item.set_child(Some(
|
let child = Box::builder()
|
||||||
&ActionRow::builder()
|
.orientation(gtk::Orientation::Vertical)
|
||||||
.title(item.title())
|
.build();
|
||||||
.subtitle(item.subtitle())
|
|
||||||
|
child.append(
|
||||||
|
&Label::builder()
|
||||||
|
.halign(Align::Start)
|
||||||
|
.label(item.title())
|
||||||
.build(),
|
.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`
|
// Init list `GObject`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user