GNOME Bugzilla – Bug 787546
gtkbuilder: should allow values of type GType
Last modified: 2018-05-02 19:05:05 UTC
Created attachment 359524 [details] code snipped allowing GType values parsing GType values allows e.g. objects with GType properties or GtkListStore with GType column. this would get rid of error "Unsupported GType 'GType'" I can get it working on my system using the attached snipped which looks like a naive hack to me. I assume this is not true on all systems? g_assert(G_TYPE_FUNDAMENTAL(G_TYPE_GTYPE) == G_TYPE_POINTER); Maybe someone can point out a fancy #ifdef, the correct approach or give me a hint why this is a bad idea at all.
What is the use case for specfying a column of type GType ? Seems a bit specialized to me...
Yes indeed this may be a bit specialized. First of all I was surprised by the funny error message, that was what got me interested. I can imagine any kind of factory use case, creating widgets according to a given type. Maybe something like a "navigation link" class with a GType property constructing pages/panels on the fly. Or data tuples requiring a special class to be processed which can be created on the fly with this, allowing the class to be part of the tuple. I'm pretty sure everything can be achieved on other ways. If not in a totally different approach at least by storing the type as string and resolving it manually. My thought was it would be more elegant, maybe I'm wrong. The first question I tried to answer was, maybe for educational reasons, what would it take to allow this, and which impact has it on the existing code base.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/907.