DBusGProxy as parent gobject

Robert McQueen robert.mcqueen at collabora.co.uk
Mon Jan 2 12:05:59 PST 2006

Gary Kramlich wrote:
> For what it's worth, you can man a GObject derivable without exposing
> any of it's members by adding a "Private" member to the public struct
> and only define that structure in the source file, and not the header as
> well.  Basically, how it's defined now, but instead of the whole
> structure being defined in the C file, only the private structure would
> be defined in the C file.

This is orthogonal to the question at hand - at the moment the
definition of the real DBusGProxy struct (the struct that at the very
least would contain GObject as it's first member) is not publically
available to include in the struct for your object, so you can't inherit
from it at all.

The question is, why? In this Telepathy project, Riccardo and I want to
extend DBusGProxy with our own types to add utility functions to do
things like caching some data or creating other DBusGProxy objects for
you, but also allow you to have all the automatically generated methods
for invoking all the methods on the dbus object itself. At the moment
we're unable to.

As an aside, a neater way to do the Private members of your GObjects is
to use g_type_class_add_private in your class_init. If you do this then
glib allocates space for your private data when the gobject is created,
so even the address of it is kept opaque from other users, and you don't
get foo->private members in your struct. Works for me...

> --
> Gary Kramlich <grim at reaperworld.com>


More information about the dbus mailing list