On Sat, 15 Jun 2019 12:37:05 +0200, Mike Wey wrote:
On 15-06-2019 11:37, Alex X wrote:
auto Builder = new Builder(); Builder.addFromString(import(GladeFile); auto os = Builder.getObjects();
os will contain all the objects but the ID's, Name's, etc will all be empty! The objects are loaded but one has no idea what is what. Not sure if this is an issue with gtkD or gtk itself. The children and all others should be filled out properly but are not.
That does not seem to be correct behavior!
You can get a glade file here, but note that glade is picky and will crap out if there is space at the end of the file:
https://stackoverflow.com/questions/33191245/cannot-load-glade-file-with-gtk-builder-gtk3/48903791
Which names an ID's are we talking about here?
You should be able to get the name of a object with:
gobject.Type.name
.
I've tried that and couldn't find any member in any way called Type.
auto os = Builder.getObjects();
This is what is returned.
[gtk.Window.Window] 0x000001f70be32d00 {gObject=0x000001f70ce9e9b0 {gTypeInstance={gClass=0x000001f70c24c310 {gType=2160572222320}}, ...}, ...} gtk.Window.Window
gObject 0x000001f70ce9e9b0 {gTypeInstance={gClass=0x000001f70c24c310 {gType=2160572222320}}, refCount=4, qdata=0x000001f70c2fbe21} gobject.c.types.GObject*
gTypeInstance {gClass=0x000001f70c24c310 {gType=2160572222320}} gobject.c.types.GTypeInstance
refCount 4 uint
qdata 0x000001f70c2fbe21 {} glib.c.types.GData*
ownedRef false bool
isGcRoot true bool
signals 0x0000000000000000 gobject.DClosure.DClosure[uint]
gtkWidget 0x000001f70ce9e9b0 {parentInstance={gTypeInstance={gClass=0x000001f70c24c310 {gType=2160572222320}}, refCount=4, qdata=0x000001f70c2fbe21}, ...} gtk.c.types.GtkWidget*
parentInstance {gTypeInstance={gClass=0x000001f70c24c310 {gType=2160572222320}}, refCount=4, qdata=0x000001f70c2fbe21 {}} gobject.c.types.GObject
priv 0x000001f70ce9e8c0 {} gtk.c.types.GtkWidgetPrivate*
tickCallbackListeners {length=0 ptr=0x0000000000000000} delegate[]
gtkContainer 0x000001f70ce9e9b0 {widget={parentInstance={gTypeInstance={gClass=0x000001f70c24c310 {gType=2160572222320}}, refCount=4, qdata=0x000001f70c2fbe21}, ...}, ...} gtk.c.types.GtkContainer*
widget {parentInstance={gTypeInstance={gClass=0x000001f70c24c310 {gType=2160572222320}}, refCount=4, qdata=0x000001f70c2fbe21 {}}, ...} gtk.c.types.GtkWidget
priv 0x000001f70ce9e8a0 {} gtk.c.types.GtkContainerPrivate*
children {length=0 ptr=0x0000000000000000} gtk.Widget.Widget[]
gtkBin 0x000001f70ce9e9b0 {container={widget={parentInstance={gTypeInstance={gClass=0x000001f70c24c310 {gType=2160572222320}}, refCount=4, qdata=0x000001f70c2fbe21}, ...}, ...}, ...} gtk.c.types.GtkBin*
container {widget={parentInstance={gTypeInstance={gClass=0x000001f70c24c310 {gType=2160572222320}}, refCount=4, qdata=0x000001f70c2fbe21 {}}, ...}, ...} gtk.c.types.GtkContainer
priv 0x000001f70ce9e890 {} gtk.c.types.GtkBinPrivate*
gtkWindow 0x000001f70ce9e9b0 {bin={container={widget={parentInstance={gTypeInstance={gClass=0x000001f70c24c310 {gType=2160572222320}}, refCount=4, qdata=0x000001f70c2fbe21}, ...}, ...}, ...}, ...} gtk.c.types.GtkWindow*
bin {container={widget={parentInstance={gTypeInstance={gClass=0x000001f70c24c310 {gType=2160572222320}}, refCount=4, qdata=0x000001f70c2fbe21 {}}, ...}, ...}, ...} gtk.c.types.GtkBin
priv 0x000001f70ce9e750 {} gtk.c.types.GtkWindowPrivate*
gObject 0x000001f70ce9e9b0 {gTypeInstance={gClass=0x000001f70c24c310 {gType=2160572222320}}, refCount=4, qdata=0x000001f70c2fbe21} gobject.c.types.GObject*
gTypeInstance {gClass=0x000001f70c24c310 {gType=2160572222320}} gobject.c.types.GTypeInstance
refCount 4 uint
qdata 0x000001f70c2fbe21 {} glib.c.types.GData*
ownedRef false bool
isGcRoot true bool
signals 0x0000000000000000 gobject.DClosure.DClosure[uint]
That is what I see when I look at the members of the object... which is utterly useless for me ;/ At most I can check the right type but it is not very helpful.
That is just one object in the list.
getObjects flattens the list and I'd like to retain the hierarchy as presented in the xml file. There ar children fields and parent fields but I can't really make heads or tells of what is what.
Hence getting the names and id's and other info would help.
I've tried to use various things like getProperty('name', value) but nothing works...
The idea is to be able to see the hierarchy of the objects. The gtk inspector shows it so it's there somewhere.