-
-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remnants For Composite Template Support #77
Comments
For this one there is #24 https://github.com/gtk-rs/gtk-rs/issues/173 gtk-rs/gtk3-rs#128 |
I don't think BuilderScope is required. See https://gnome.pages.gitlab.gnome.org/gtk/gtk/GtkWidget.html#gtk-widget-class-bind-template-callback for templates |
That only works for C function callbacks (with pointers and stuff). Bindings should go via |
Ah, I see |
Not sure if something like Vala & Python's possibility to set the path/uri to a UI file with a decorator would be possible in how things are handled from Rust I was thinking of an attribute of CompositeTemplate to automatically generate a class_init with the proper set_template & call to bind_template_children. Vala: [GtkTemplate (ui = "/org/gnome/clocks/ui/alarm-day-picker-row.ui")]
public class DayPickerRow : Hdy.ActionRow {
} Python: @Gtk.Template(resource_path='/com/github/bilelmoussaoui/Authenticator/settings.ui')
class SettingsWindow(Handy.PreferencesWindow):
__gtype_name__ = 'SettingsWindow' |
Something I have noticed while porting some of my code to use templates is that often the id is the same name you give to the field and having to always specify it as an attribute is not great? maybe we should fallback to the field name in case the id attribute wasn't passed |
Sounds like an easy improvement, yes |
What is the blocker in handling |
That's doable but not so easy. At that point the object is not fully constructed and it's generally unsafe to do anything at all with it except for a few limited operations. If someone wants to work on that, go ahead :) But I didn't need that for anything so I didn't spend more time on it when implementing the subclassing support in gtk-rs. From a Rust point of view it should be sufficient to call this in |
One thing that we should do is that every type defined in the UI file should be ensured by calling |
Where do you want to call that and how do you want to find the types to call it on? |
Good question, we can at least do so for the types that were explicitly tagged by |
Yeah but not sure how useful that is :) |
That's taken care of already by |
I was wondering if it would be useful to expose a second method for each major initialization function. Something like |
How would that compose with other (derive, etc) macros producing code for them too? |
Maybe that would become clearer once those are written. I guess those derive macros are supposed to be independent from composite template support? I still can't really imagine how they would look like in that case. Especially |
|
I'm not sure why that wasn't done yet btw. It should just implement
I'm planning a derive macro for properties and that would also have to interfere with the same functions. For that very reason I'm not planning to inject code into those functions there for now until we figure out a solution how to do this in a composable way, and until then require a function call in user code to not paint ourselves into a corner. I don't know what other derive macros there could be. Maybe something for signals, that would also seem useful but I don't know how that could look in practice. And I'm sure you'll find more things in GTK :) |
|
Even with the |
You can use it, you just need to deref it when passing it as an argument. |
Ah, I hadn't though of the That's relatively concise, but it would be nice if that weren't necessary. |
That would need a blanket implementation that can't really exist impl<T: Deref<Target=U>, U: IsA<V>, V: ...> IsA<V> for T { ... }` |
#945 should handle the last remaining part of this issue |
After #51 is merged, there's still some work left to do:
bind_template_children
fnas
klass.bind_template_children()
instance_init()
so thatinit_template()
can be calledfrom it.
The text was updated successfully, but these errors were encountered: