Re: GSignal convenience functions



On 7 Dec 2000, Havoc Pennington wrote:

> 
> James Henstridge <james daa com au> writes:
> > It seems that one of the things that is holding up use of GObject is that
> > it is more difficult to use the GSignal functions than the old GtkSignal
> > ones.  To try and get things moving a bit, I put together a patch that
> > adds g_signal_new, g_signal_emit, g_signal_emitv and
> > g_signal_connect_cclosure functions that make signals more convenient to
> > use from C.
> >
> 
> Crap, I did this yesterday too. ;-) 

I guess that means the functionality is needed then :)

>  
> > I have done a little testing of these functions, and they seem to work
> > well.  One bit of ugly code is putting the instance variable in the GValue
> > array.  At the moment, I misuse the collect_value function for the type
> > (if it is available) to set the value, or just set it as a G_TYPE_POINTER
> > value.  This could probably be cleaned up a bit more.
> 
> I handled this by giving up on g_signal_emit() and doing
> g_object_emit_signal().
> 
> Not before I was sitting their wondering why we support emitting a
> signal on an unclassed object though. ;-)

As I understand it, GSignal was designed to work with types (that are 
instantiatable/classed) other than GObjects.  So I tried to preserve this
when implementing g_signal_emit.

It would have been easier to implement if there was a
g_value_set_as_pointer() (opposite of get_as_pointer) function to set the
instance GValue.

James.





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