Use instance_init() for composite templates

Drops the incorrect use of instance_init() within
constructed.
This commit is contained in:
Christopher Davis 2021-01-13 23:05:45 -08:00
parent 5d8c6756e2
commit f1fa94fca7
2 changed files with 7 additions and 2 deletions

View file

@ -119,11 +119,14 @@ mod imp {
klass.set_template_from_resource("/org/gnome/ImageViewer/gtk/image_view.ui"); klass.set_template_from_resource("/org/gnome/ImageViewer/gtk/image_view.ui");
Self::bind_template_children(klass); Self::bind_template_children(klass);
} }
fn instance_init(obj: &glib::subclass::InitializingObject<Self::Type>) {
obj.init_template();
}
} }
impl ObjectImpl for IvImageView { impl ObjectImpl for IvImageView {
fn constructed(&self, obj: &Self::Type) { fn constructed(&self, obj: &Self::Type) {
obj.init_template();
self.parent_constructed(obj); self.parent_constructed(obj);
obj.bind_property("header-visible", &self.headerbar.get(), "visible") obj.bind_property("header-visible", &self.headerbar.get(), "visible")

View file

@ -83,11 +83,13 @@ mod imp {
// CompositeTemplate macro to bind all children at once. // CompositeTemplate macro to bind all children at once.
Self::bind_template_children(klass); Self::bind_template_children(klass);
} }
fn instance_init(obj: &glib::subclass::InitializingObject<Self::Type>) {
obj.init_template();
}
} }
impl ObjectImpl for IvWindow { impl ObjectImpl for IvWindow {
fn constructed(&self, obj: &Self::Type) { fn constructed(&self, obj: &Self::Type) {
obj.init_template();
self.parent_constructed(obj); self.parent_constructed(obj);
if config::PROFILE == ".Devel" { if config::PROFILE == ".Devel" {