On Tue, Mar 16, 2010 at 02:53:29PM +0000, Daniel P. Berrange wrote:
GObject is the primary root object, but things don't neccessarily
need
to inherit from GObject. Since you're trying to directly expose libguestfs'
own object(s) you'll probably need to register them as base types using
the GType APIs. This section of the API docs gives a semi-useful intro to
GTypes
http://library.gnome.org/devel/gobject/stable/chapter-gtype.html
Ultimately this comes down to a call to g_type_register_static()
http://library.gnome.org/devel/gobject/stable/gobject-Type-Information.ht...
but it is not very well documented because 99% of apps just inherit
from GObject instead of introducing new base types like libguestfs
would need todo.
Unfortunately this doesn't work. The handle (guestfs_h *) is wrapped
inside a GType:
typedef struct _GuestfsH {
GObject parent;
guestfs_h *h;
} GuestfsH;
I can now register this easily enough, but GObject won't automatically
unpack that handle when it passes it to the other functions. ie. The
other functions would receive a GuestfsH, instead of a guestfs_h *,
and they won't know what to do with the former.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://et.redhat.com/~rjones/libguestfs/
See what it can do:
http://et.redhat.com/~rjones/libguestfs/recipes.html