-
-
Notifications
You must be signed in to change notification settings - Fork 82
Conversation
The biggest current problem is the fact we can't convert an object into another one. For example, converting a trait GObject {
pub fn cast_to<T: GObject>(&self) -> T;
pub fn cast_from<T: GObject>(object: &T) -> Self;
} Your solution seems to allow such a thing in a better way. I'll test your example by the end of the week but I think I'll appreciate it. Very nice job ! |
I've now changed the |
I've started implementing the conversion. The progress can be reviewed here: https://github.com/gkoz/rust-gnome-gtk/tree/object_reform |
Okay, I'll look it this week-end. Thanks for your work ! =D |
What's the status of this? |
I've been somewhat distracted by other stuff including rustdoc (gtk-rs/gdk#49) but this is in progress. |
What do you think of merging just the object.rs file and letting any new widgets I add use the new framework? I think that works better than me adding new objects using the old framework or sending pull requests to your work in progress branch. There would be a bit of inconsistency between previous and new widgets, but I don't think that's a big deal. |
We could merge that file but without cooperation from numerous traits that may not be enough. You can't use the widget unless it implements |
Hey @gkoz, any update on how this is going? I saw the work going on with GIR and generating bindings, any update on that? |
The implementation is at #221. |
c_type tweaks
Do not merge!
Here's my latest and likely final (modulo small improvements) version of the
GObject
wrapper framework first proposed at jeremyletang/rgtk#197 that's supposed to replace the current approach of using macros and a C glue module.Objectives:
GtkTreeModel
is an interface implemented byGtkTreeStore
, it shouldn't be represented as a separate widget);libvte
);gtk_glue.c
and build complications it brings;The
glib::translate
module shows all its power now: you can have a string, a widget, a nullable widget or aGList
of widgets, doesn't matter, it just works, all applicable asserts included:The
basic
example (not present in this PR) demonstrates the use of the only two widgets supported in this proof of concept -Window
andButton
each implementing its own trait as well asWidgetTrait
andContainerTrait
, and downcasting fromWidget
toButton
.The changes touch almost all crates, you can find the principal changes here: glib, gtk, examples but for the example to build other crates need patching too.
If you want to run the code I suggest using the git-repo tool: