Re: gobject introspection in runtime possible?

Le jeudi 07 avril 2011 à 12:22 +0200, Andrea a écrit :
> Hello list,
>  Just a flash question about introspection (I'm a newbye).
> Is it possible to get introspection data from a GObject in runtime?
> I was wondering if it would be convenient to create a special
> introspectable parent object to declare d-bus interfaces of derived,
> simply listing properties and class initialized methods.
> As I see gobject-introspection do it offline reading .c file

Indeed gobject-introspection generates metadata at build-time. Though
GType/GObject have facilities to do simple introspection at runtime.
Those facilities precluded gir and only provide informations about
signals and properties of a "living" instance.

Have a look at:
* g_signal_list_ids
lists all signals for a specified GType

* g_signal_query
gives info about a specified signal

* g_object_class_list_properties
 returns a list of GParamSpec* describing properties (type, name,

Also, you might want to do that introspection for all the type hierachy
for a specific instance. To climb up the tree, use


and g_type_interface_peek/g_type_interface_peek_parent

Hope this helps, Happy Coding !

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