Re: How do we get GTYPE from gobject introspection language bindings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As a side note, STRING probably refers to https://developer.gnome.org/glib/stable/glib-Strings.html which is a more OO string implementation. G_TYPE_STRING being gchararray is of more close relation with C strings (except it consists of gchars instead of chars.)


On Thu, Sep 28, 2017, 22:34 Stefan Salewski <mail@xxxxxxxxxxxx> wrote:
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.
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux