GtkSharp/gconf/GConf/NotifyWrapper.cs
Rachel Hestilow d33dd8a15f 2002-10-19 Rachel Hestilow <hestilow@ximian.com>
* gconf, sample/gconf: Added.

	* glue/combo.c: This was never added, add it now.

	* configure.in, makefile, sample/Makefile.in: Build new
	gconf bindings if gnome is enabled.

svn path=/trunk/gtk-sharp/; revision=8389
2002-10-19 09:31:20 +00:00

37 lines
942 B
C#

namespace GConf
{
using System;
using System.Collections;
internal delegate void NotifyFuncNative (IntPtr client_ptr, uint id, IntPtr entry_ptr, IntPtr user_data);
internal class NotifyWrapper
{
static ArrayList refs = new ArrayList ();
NotifyEventHandler notify;
NotifyFuncNative native;
void NotifyCB (IntPtr client_ptr, uint id, IntPtr entry_ptr, IntPtr user_data)
{
Client client = new Client (client_ptr);
_Entry entry = new _Entry (entry_ptr);
Value val = new Value (entry.ValuePtr);
val.Managed = false;
notify (client, new NotifyEventArgs (entry.Key, val.Get ()));
}
public NotifyWrapper (NotifyEventHandler notify)
{
this.notify = notify;
this.native = new NotifyFuncNative (this.NotifyCB);
}
public static NotifyFuncNative Wrap (NotifyEventHandler notify)
{
NotifyWrapper wrapper = new NotifyWrapper (notify);
refs.Add (wrapper);
return wrapper.native;
}
}
}