How do we get GTYPE from gobject introspection language bindings
- From: Stefan Salewski <mail ssalewski de>
- To: "gtk-list gnome org" <gtk-list gnome org>
- Subject: How do we get GTYPE from gobject introspection language bindings
- Date: Thu, 28 Sep 2017 22:33:02 +0200
I am just preparing a listview example for the Nim GTK3 mini tutorial.
I followed the Z-Code C example. Was not too difficult. But I got one
problem: For working with listviews, we have to provide GTypes, which
are numerical values. For C we have the macros like G_TYPE_STRING which
for my box gives currently value 64. These values seems to be not
directly supported by gobject-introspection. Seems to be no big
problem, we may query the values by g-type-from-name().
https://developer.gnome.org/gobject/stable/gobject-Type-Information.html#g-type-from-name
For G_TYPE_STRING I assumed that name is "GSTRING" which gives indeed a
non zero result from g-type-from-name(). But it is wrong.
We can get the correct name by using g_type_name(G_TYPE_STRING). This
gives "gchararray".
And indeed, when I provide this name to g-type-from-name() then the Nim
example works fine.
But where should high level users find the corresponding G_TYPE names
or values?
Or is there another way to get G_TYPE values? I assume a static list of
integers would not make much sense?
Maybe you know how this is done in other languages with GTK bindings.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]