// SPDX-FileCopyrightText: 2022 Agathe Porte // // SPDX-License-Identifier: Apache-2.0 OR MIT use gtk::glib; use gtk::subclass::prelude::*; use gtk::{prelude::*, CompositeTemplate}; #[derive(CompositeTemplate, Default)] #[template(file = "simple.ui")] pub struct Window { #[template_child] pub list_store: TemplateChild, #[template_child] pub tree_view: TemplateChild, } #[glib::object_subclass] impl ObjectSubclass for Window { // `NAME` needs to match `class` attribute of template const NAME: &'static str = "MyGtkAppWindow"; type Type = super::Window; type ParentType = gtk::ApplicationWindow; fn class_init(klass: &mut Self::Class) { Self::bind_template(klass); } fn instance_init(obj: &glib::subclass::InitializingObject) { obj.init_template(); } } impl ObjectImpl for Window { fn constructed(&self, obj: &Self::Type) { obj.init_liststore(); self.parent_constructed(obj); } } impl WidgetImpl for Window {} impl ContainerImpl for Window {} impl BinImpl for Window {} impl WindowImpl for Window {} impl ApplicationWindowImpl for Window {}