use gtk::{ gio, glib::{ self, object::IsA, subclass::{ object::{ObjectImpl, ObjectImplExt}, types::ObjectSubclass, InitializingObject, }, }, subclass::{ application_window::ApplicationWindowImpl, widget::{ CompositeTemplateClass, CompositeTemplateInitializingExt, WidgetClassExt, WidgetImpl, }, window::WindowImpl, }, TemplateChild, }; use crate::{ balances_view::SchistBalancesView, categories_view::SchistCategoriesView, category_transfers_view::SchistCategoryTransfersView, transactions_view::SchistTransactionsView, }; gtk::glib::wrapper! { pub struct SchistWindow(ObjectSubclass) @extends gtk::ApplicationWindow, gtk::Window, gtk::Widget, @implements gio::ActionGroup, gio::ActionMap, gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager; } impl SchistWindow { pub fn new>(app: &A) -> Self { glib::Object::builder().property("application", app).build() } } #[derive(gtk::CompositeTemplate, Default)] #[template(resource = "/net/joeac/schist/ui/window.ui")] pub struct SchistWindowSubclass { #[template_child] pub balances_view: TemplateChild, #[template_child] pub categories_view: TemplateChild, #[template_child] pub category_transfers_view: TemplateChild, #[template_child] pub transactions_view: TemplateChild, } #[glib::object_subclass] impl ObjectSubclass for SchistWindowSubclass { const NAME: &'static str = "SchistWindow"; type Type = SchistWindow; type ParentType = gtk::ApplicationWindow; fn class_init(klass: &mut Self::Class) { klass.bind_template(); } fn instance_init(obj: &InitializingObject) { obj.init_template(); } } impl ObjectImpl for SchistWindowSubclass { fn constructed(&self) { self.parent_constructed(); } } impl WidgetImpl for SchistWindowSubclass {} impl WindowImpl for SchistWindowSubclass {} impl ApplicationWindowImpl for SchistWindowSubclass {}