Update Rust deps

Updates to subclassing and templates.
This commit is contained in:
Christopher Davis 2021-01-30 15:52:32 -08:00
parent b2a15242be
commit 4561b1f4f8
5 changed files with 104 additions and 104 deletions

View file

@ -41,6 +41,7 @@ mod imp {
// For this derive macro, you need to have
// `use gtk::CompositeTemplate` in your code.
#[derive(Debug, CompositeTemplate)]
#[template(resource = "/org/gnome/ImageViewer/gtk/window.ui")]
pub struct IvWindow {
// Template children are used with the
// TemplateChild<T> wrapper, where T is the
@ -61,6 +62,7 @@ mod imp {
const NAME: &'static str = "IvWindow";
type Type = super::IvWindow;
type ParentType = libadwaita::ApplicationWindow;
type Interfaces = ();
type Instance = glib::subclass::simple::InstanceStruct<Self>;
type Class = glib::subclass::simple::ClassStruct<Self>;
@ -78,10 +80,9 @@ mod imp {
}
fn class_init(klass: &mut Self::Class) {
klass.set_template_from_resource("/org/gnome/ImageViewer/gtk/window.ui");
// bind_template_children() is a function generated by the
// bind_template() is a function generated by the
// CompositeTemplate macro to bind all children at once.
Self::bind_template_children(klass);
Self::bind_template(klass);
}
fn instance_init(obj: &glib::subclass::InitializingObject<Self::Type>) {
obj.init_template();