Re: wrapping GObject class



On Mon, 2009-02-16 at 22:11 +0100, Jens Luedicke wrote:
> Hey,
> 
> I started to wrap the Xfce4 libraries and I have a question about
> some basics.
> 
> While browsing the Glibmm/Gtkmm sources I noticed that the wrapper
> code never calls the public constructor functions (just the internal
> gobject init and finalize functions). For example, if a GObject derived
> class provides a public constructor function to initialize certain
> features of that class, do I need to rewrite that function within
> my own C++ class constructor?

*_new() function should never do more than call g_object_new(). If one
does more then it's a bug. This allows language bindings (and derived
classes) to use their own derived GTypes. It also allows RAD tools such
as Glade to instantiate these types without knowing about specific
_new() functions and their parameters.

> I have a GObject class with a pblic constructor function which takes
> an argument list. This argument list is used within the C constructor
> function to add buttons to a GtkDialog.
> 
> Right now my best idea is to rewrite that code in my wrapper class.

You really need to fix or amend the C API. You can see how Gtk::Dialog
does this, allowing you to call add_button() repeatedly instead.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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