Author: miguel
Date: 2005-09-02 18:39:17 -0400 (Fri, 02 Sep 2005)
New Revision: 49379
Modified:
trunk/gtk-sharp/ChangeLog
trunk/gtk-sharp/gtk/Application.cs
Log:
i2005-09-02 Miguel de Icaza <[EMAIL PROTECTED]>
* gtk/Application.cs (Invoke): Add new overloads to easily invoke
methods on the executing thread.
Modified: trunk/gtk-sharp/ChangeLog
===================================================================
--- trunk/gtk-sharp/ChangeLog 2005-09-02 22:32:46 UTC (rev 49378)
+++ trunk/gtk-sharp/ChangeLog 2005-09-02 22:39:17 UTC (rev 49379)
@@ -1,3 +1,13 @@
+2005-09-02 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * gtk/Application.cs (Invoke): Add new overloads to easily invoke
+ methods on the executing thread.
+
+2005-09-01 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * gtk/Application.cs (Invoke): Add sugar to invoke a method on the
+ main thread.
+
2005-09-02 Ben Maurer <[EMAIL PROTECTED]>
* sample/NodeViewDemo.cs: take advantage of the stuff below
Modified: trunk/gtk-sharp/gtk/Application.cs
===================================================================
--- trunk/gtk-sharp/gtk/Application.cs 2005-09-02 22:32:46 UTC (rev 49378)
+++ trunk/gtk-sharp/gtk/Application.cs 2005-09-02 22:39:17 UTC (rev 49379)
@@ -141,5 +141,45 @@
return new Gdk.Event (gtk_get_current_event ());
}
}
+
+ internal class InvokeCB {
+ EventHandler d;
+ object sender;
+ EventArgs args;
+
+ internal InvokeCB (EventHandler d)
+ {
+ this.d = d;
+ args = EventArgs.Empty;
+ sender = this;
+ }
+
+ internal InvokeCB (EventHandler d, object sender,
EventArgs args)
+ {
+ this.d = d;
+ this.args = args;
+ this.sender = sender;
+ }
+
+ internal bool Invoke ()
+ {
+ d (sender, args);
+ return false;
+ }
+ }
+
+ public static void Invoke (EventHandler d)
+ {
+ InvokeCB icb = new InvokeCB (d);
+
+ GLib.Idle.Add (new GLib.IdleHandler (icb.Invoke));
+ }
+
+ public static void Invoke (object sender, EventArgs args,
EventHandler d)
+ {
+ InvokeCB icb = new InvokeCB (d);
+
+ GLib.Idle.Add (new GLib.IdleHandler (icb.Invoke));
+ }
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches