Re: How class deriving from GInitiallyUnowned should be wrapped?



On Thu, 2010-12-02 at 20:47 +0100, Krzesimir Nowak wrote:
> On Thu, 2010-12-02 at 14:48 +0100, Murray Cumming wrote:
> > On Tue, 2010-11-30 at 19:38 +0100, Krzesimir Nowak wrote:
> > > Hi,
> > > 
> > > I'm looking at Gtk::CellRenderer and Gtk::FileFilter. Both C types
> > > derives GInitiallyUnowned, but in gtkmm the former derives from
> > > Gtk::Object and the latter - from Glib::Object. So first one can be
> > > handled as a pointer, the second - as Glib::RefPtr only.
> > 
> > Yes, our Gtk::Object lets us avoid forcing use of RefPtr for many more
> > types now that GtkObject is dead. I thought that using RefPtr for
> > CellRenderer would be a step too far. I could change my mind though.
> 
> I was doing a Gsv::SourceGutterRenderer wrapper, so I too decided to
> derive it from Gtk::Object instead of Glib::Object.

OK, if that feels right. Our new Gtk::Object is rather experimental
though - but it seems to be working.

>  Which leads me to
> another question: how to wrap a function taking GType as a parameter?
> Said function is:
> 
> GtkSourceGutterRenderer *
> gtk_source_gutter_insertv (GtkSourceGutter *gutter,
>                            GType            gtype,
>                            gint             position,
>                            guint            num_parameters,
>                            GParameter      *parameters);
> 
> where gtype must be a GType deriving from GtkSourceGutterRenderer.
[snip]

I would strongly suggest that they change the C API. Why can't it just
take an already-instantiated object? This is not at all friendly to
language bindings.


> Well, if the difference between Gtk::Object and Glib::Object is the same
> as the one between GInitiallyUnowned and GObject

No, I don't think it's that simple.

I'm just using Gtk::Object where i think people would be angry to see
RefPtr everywhere, and I could still change my mind about that.

>  (that is - both
> primarily are used to have floating reference, or in other words - being
> not owned by any portion of code) then I'm wondering if
> GInitiallyUnowned should also be wrapped as Gtk::Object - constructor
> will sink it anyway.


-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



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