[f-spot: 8/40] Use a closure instead of a method and eventargs.
- From: Stephane Delcroix <sdelcroix src gnome org>
- To: svn-commits-list gnome org
- Subject: [f-spot: 8/40] Use a closure instead of a method and eventargs.
- Date: Wed, 24 Jun 2009 09:48:22 +0000 (UTC)
commit 43e4982e28eabdc4b590d196ad08f5d1d673f55e
Author: Ruben Vermeersch <ruben savanne be>
Date: Fri Jun 19 00:32:20 2009 +0200
Use a closure instead of a method and eventargs.
Less code, same function.
src/ImageLoader.cs | 31 ++++++-------------------------
1 files changed, 6 insertions(+), 25 deletions(-)
---
diff --git a/src/ImageLoader.cs b/src/ImageLoader.cs
index f8f6776..92cd72f 100644
--- a/src/ImageLoader.cs
+++ b/src/ImageLoader.cs
@@ -122,32 +122,13 @@ namespace FSpot {
OnCompleted ();
return;
}
- Gtk.Application.Invoke (this, new ReadDoneEventArgs (byte_read), HandleReadDoneInMainLoop);
- }
-
- void HandleReadDoneInMainLoop (object sender, EventArgs e)
- {
- ReadDoneEventArgs rdea = e as ReadDoneEventArgs;
- int byte_read = rdea.ByteRead;
-
- if (Write (buffer, (ulong)byte_read)) {
- image_stream.BeginRead (buffer, 0, count, HandleReadDone, null);
- } else
- OnWriteError ();
- }
-
- class ReadDoneEventArgs : EventArgs
- {
- int byte_read;
- public int ByteRead {
- get { return byte_read; }
- }
-
- public ReadDoneEventArgs (int byte_read) : base ()
- {
- this.byte_read = byte_read;
- }
+ Gtk.Application.Invoke (this, null, delegate (object sender, EventArgs e) {
+ if (Write (buffer, (ulong)byte_read)) {
+ image_stream.BeginRead (buffer, 0, count, HandleReadDone, null);
+ } else
+ OnWriteError ();
+ });
}
void OnWriteError ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]