You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
every class needs this tiny bit of boilerplate (from the book):
// The central trait for subclassing a GObject
#[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) {
klass.bind_template();
klass.bind_template_callbacks();
}
fn instance_init(obj: &InitializingObject<Self>) {
obj.init_template();
}
}
from what I understand we need that because in some cases we may or may not want to call klass.bind_template_callbacks(). every single widget I have contains this much boilerplate... and most of them do nothing interesting besides that.
suggestions:
klass.bind_template() could call klass.bind_template_callbacks() always, with a default empty function for bind_template_callbacks
default implementation of the whole thing when deriving CompositeTemplate with impl ... for T where T : <has derived CompositeTemplate?> or something
other ideas?
The text was updated successfully, but these errors were encountered:
this is by far the most annoying bit of the boilerplate. I always get it wrong. I always forget something. with this we could just have impl ObjectSubclass for DewYtItemList {} or something just like we have for everything else.
every class needs this tiny bit of boilerplate (from the book):
from what I understand we need that because in some cases we may or may not want to call
klass.bind_template_callbacks()
. every single widget I have contains this much boilerplate... and most of them do nothing interesting besides that.suggestions:
klass.bind_template()
could callklass.bind_template_callbacks()
always, with a default empty function forbind_template_callbacks
CompositeTemplate
withimpl ... for T where T : <has derived CompositeTemplate?>
or somethingThe text was updated successfully, but these errors were encountered: