diff --git a/lact-gui/src/app/info_row.rs b/lact-gui/src/app/info_row.rs new file mode 100644 index 0000000..426c525 --- /dev/null +++ b/lact-gui/src/app/info_row.rs @@ -0,0 +1,72 @@ +use gtk::glib::{self, Object}; + +glib::wrapper! { + pub struct InfoRow(ObjectSubclass) + @extends gtk::Box, gtk::Widget, + @implements gtk::Orientable, gtk::Accessible, gtk::Buildable; +} + +impl InfoRow { + pub fn new(name: &str, value: &str) -> Self { + Object::builder() + .property("name", name) + .property("value", value) + .build() + } +} + +mod imp { + use glib::Properties; + use gtk::{ + glib::{self, subclass::InitializingObject}, + pango::AttrList, + prelude::*, + subclass::{ + prelude::*, + widget::{CompositeTemplateClass, WidgetImpl}, + }, + CompositeTemplate, Label, TemplateChild, + }; + use std::{cell::RefCell, str::FromStr}; + + #[derive(CompositeTemplate, Default, Properties)] + #[properties(wrapper_type = super::InfoRow)] + #[template(file = "ui/info_row.blp")] + pub struct InfoRow { + #[property(get, set)] + name: RefCell, + #[property(get, set)] + value: RefCell, + + #[template_child] + value_label: TemplateChild