Re: Marshalling CClosures



On 29 Jul 2001, Havoc Pennington wrote:

> This still makes no sense to me, but perhaps you can ask him to
> explain it, or maybe you can figure it out.

I want to use GClosures like SigC::Slots from the great C++ library
libsigc++: `callback function objects' that I can pass around and call
when I feel like it. So not tied to signals at all.

I see two workarounds to this current limitation:
	1, Creating a dummy GSignal, connecting the closure to it,
emitting the singal and then distroying it
	2, touching the GClosure's marshal field (yes I know this is
evil). 

In the hope of the current situation being only a temporary limitation,
I've decided to go with #2, so the following works currently:

	listener->priv->event_callback->marshal =
		bonobo_marshal_VOID__STRING_BOXED_BOXED;
	
	g_closure_invoke (listener->priv->event_callback,
			  NULL,
			  4,
			  arguments,
			  NULL);

but I feel dirty after using it.

Tim, will we ever get invokeable standalone C closures for GLIB 2?

-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus cactus rulez org =---'
``If the facts don't fit the theory, change the facts.'' -- Albert Einstein





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