mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-23 18:35:28 +00:00
2009-05-06 Mike Kestner <mkestner@novell.com>
* glib/Idle.cs: add a Remove overload for consistency. * glib/Timeout.cs: add a Remove overload for consistency. [Fixes #356138] svn path=/trunk/gtk-sharp/; revision=133702
This commit is contained in:
parent
60618ca6f0
commit
e91a71949a
|
@ -1,3 +1,9 @@
|
|||
2009-05-06 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* glib/Idle.cs: add a Remove overload for consistency.
|
||||
* glib/Timeout.cs: add a Remove overload for consistency.
|
||||
[Fixes #356138]
|
||||
|
||||
2009-05-06 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* generator/EnumGen.cs: support 1L long values or explicit types.
|
||||
|
|
|
@ -94,6 +94,11 @@ namespace GLib {
|
|||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern bool g_source_remove_by_funcs_user_data (Delegate d, IntPtr data);
|
||||
|
||||
public static void Remove (uint id)
|
||||
{
|
||||
Source.Remove (id);
|
||||
}
|
||||
|
||||
public static bool Remove (IdleHandler hndlr)
|
||||
{
|
||||
bool result = false;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
namespace GLib {
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public delegate bool TimeoutHandler ();
|
||||
|
@ -99,6 +100,36 @@ namespace GLib {
|
|||
|
||||
return p.ID;
|
||||
}
|
||||
|
||||
public static void Remove (uint id)
|
||||
{
|
||||
Source.Remove (id);
|
||||
}
|
||||
|
||||
[DllImport("libglib-2.0-0.dll")]
|
||||
static extern bool g_source_remove_by_funcs_user_data (Delegate d, IntPtr data);
|
||||
|
||||
public static bool Remove (TimeoutHandler hndlr)
|
||||
{
|
||||
bool result = false;
|
||||
ArrayList keys = new ArrayList ();
|
||||
|
||||
lock (Source.source_handlers) {
|
||||
foreach (uint code in Source.source_handlers.Keys) {
|
||||
TimeoutProxy p = Source.source_handlers [code] as TimeoutProxy;
|
||||
|
||||
if (p != null && p.real_handler == hndlr) {
|
||||
keys.Add (code);
|
||||
result = g_source_remove_by_funcs_user_data (p.proxy_handler, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (object key in keys)
|
||||
Source.source_handlers.Remove (key);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue