Hello all, I'm trying to implement a dynamic system for signals that plays nicely with plain gtk+. My main motivation is that I want to use MVVM pattern but gtkmm doesn't provide data binding and I've wanted to improve this situation for a while. My main goals for this are: 1.- To be able to connect signals directly from glade by name (I already can do this with gtk_builder_connect_signals_full and it works, but I'm improving my approach). 2.- To be able to register signals (can't be done for now) and properties (I think this is correctly handled already by gtkmm) so that custom widgets are editable from glade. 3.- To be able to register types more easily into glade. As I see in this tutorial, it's quite complicated: http://szilard.blogs.balabit.com/en/2012/06/how-to-add-custom-gtkmm-widget-to-glade/ Some constraints I want to apply: 1.- It's a must that it plays well with existing gtkmm. 1.- NonIntrusive. No need to derive your objects from Glib::Object if you want to use them in the GObject type system. It would be nice to be able to register c++ types without touching them. I thought of something like this: template <class T> class GobjectWrappedType : public Glib::Object, public T { //Register type automatically into gobject system. }; template <class T, class...Args> void createObject(Args && args) { return GObjectWrappedType<T>(std::forward<Args>(args)...); } Approach taken for signals (c++11 syntax): class MyClass : public Glib::Object { //Gets registered with g_signal_new function into gobject. Parameters introspected via c++ templates Signal signal{this, makeSigcSignal<void>{"clicked"}}; Questions: 1.- Does Glib::Object register the GType into the type system or it only registers the type name? 2.- Are properties already appropiate for this use? I'm thinking of making a type erasure type that can wrap existing Glib::Property. 3.- Are signals registered into the gobject type system currently and I missed something? When I come up with something usable, I will drop a mail. I won't have too much time until two or three weeks at least. |