Re: making g_object_connect() virtual



On 11/8/05, Tim Janik <timj imendio com> wrote:
> On Wed, 2 Nov 2005, Robert Staudinger wrote:
>
> > Hi,
> >
> > in the process of wrapping parts of the c++ mozilla API into gobjects
> > [1] i came across the limitation of g_object_connect() being not
> > virtual.
> > Mozilla heavily uses listener classes that have to be derived from and
> > handed over to the event source for receiving callbacks. In order to
> > have the gobject wrapper use signals instead of callbacks it would be
> > very helpful being able to override g_object_connect(). So the gobject
> > wrapper would know which signals are expected by the user and can
> > create the required listeners in a transparent manner.
> > Or am i missing something and it's already possible to get some kind
> > of notification when a signal is connected on a GObject subclass?
>
> g_object_connect() is just a convenience wrapper around the
> g_signal_connect*() familay and that doesn't necessarily operate
> on only GObject types.
> so adding a virtual funciton for g_signal_connect*() is not possible
> and adding a virtual funciton for g_object_connect() would have little
> use, since connections could always be bypassed via the g_signal*() API.
> if you can make sure that this won't happen in your application, implementing
> your own rober_object_connect() with a virtualized method might be
> an option though.

Yeah, i have been resorting to that in the meantime.

Thanks,
Rob



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