public uint AddWatch(int priority, IOCondition condition, IOFunc func) { IOFuncWrapper func_wrapper = null; IntPtr user_data = IntPtr.Zero; DestroyNotify notify = null; if (func != null) { func_wrapper = new IOFuncWrapper(func); user_data = (IntPtr)GCHandle.Alloc(func_wrapper); notify = DestroyHelper.NotifyHandler; } return(g_io_add_watch_full(Handle, priority, (int)condition, func_wrapper.NativeDelegate, user_data, notify)); }
private void AddDestroyNotify (Gst.GLib.Object o) { // This is a bit of an ugly hack. There is no // way of getting a destroy notification // explicitly, so we set some data and ask // for notification when it is removed IntPtr name = Marshaller.StringToPtrGStrdup (String.Format ("_GtkSharpDelegateWrapper_{0}", notify_count)); DestroyNotify destroy = new DestroyNotify (this.OnDestroy); g_object_set_data_full (o.Handle, name, IntPtr.Zero, destroy); Marshaller.Free (name); lock (typeof (DelegateWrapper)) { instances[this] = destroy; notify_count++; } }
private void AddDestroyNotify(GLib.Object o) { // This is a bit of an ugly hack. There is no // way of getting a destroy notification // explicitly, so we set some data and ask // for notification when it is removed IntPtr name = Marshaller.StringToPtrGStrdup(String.Format("_GtkSharpDelegateWrapper_{0}", notify_count)); DestroyNotify destroy = new DestroyNotify(this.OnDestroy); g_object_set_data_full(o.Handle, name, IntPtr.Zero, destroy); Marshaller.Free(name); lock (typeof(DelegateWrapper)) { instances[this] = destroy; notify_count++; } }
protected static extern uint g_io_add_watch_full(IntPtr channel, int priority, IOCondition condition, IOFunc func, IntPtr user_data, DestroyNotify notify);
public static uint AddWatch(IOChannel channel, int priority, IOCondition condition, IOFunc func, DestroyNotify notify) { objs.Add (func); objs.Add (notify); return g_io_add_watch_full (channel.Handle, priority, condition, func, IntPtr.Zero, notify); }
public static uint AddWatch(IOChannel channel, int priority, IOCondition condition, IOFunc func, DestroyNotify notify) { objs.Add(func); objs.Add(notify); return(g_io_add_watch_full(channel, priority, condition, func, IntPtr.Zero, notify)); }
protected static extern uint g_io_add_watch_full(IOChannel channel, int priority, IOCondition condition, IOFunc func, IntPtr user_data, DestroyNotify notify);
private static extern void g_object_set_data_full (IntPtr obj, IntPtr name, IntPtr data, DestroyNotify destroy);
private static extern void g_object_set_data_full(IntPtr obj, IntPtr name, IntPtr data, DestroyNotify destroy);
static extern uint g_idle_add_full(int priority, IdleHandlerInternal d, IntPtr data, DestroyNotify notify);
static extern uint g_timeout_add_seconds_full(int priority, uint interval, TimeoutHandlerInternal d, IntPtr data, DestroyNotify notify);
static extern uint g_timeout_add_full (int priority, uint interval, TimeoutHandlerInternal d, IntPtr data, DestroyNotify notify);
static extern uint g_io_add_watch_full(IntPtr raw, int priority, int condition, IOFuncNative func, IntPtr user_data, DestroyNotify notify);
static extern void g_source_set_callback(IntPtr source, TimeoutFuncNative func, IntPtr user_data, DestroyNotify notify);
static extern uint g_io_add_watch_full (IntPtr raw, int priority, int condition, IOFuncNative func, IntPtr user_data, DestroyNotify notify);