diff options
author | Jb Evain <jbevain@gmail.com> | 2008-12-17 15:21:32 +0300 |
---|---|---|
committer | Jb Evain <jbevain@gmail.com> | 2008-12-17 15:21:32 +0300 |
commit | 70fdde405ff4e0a7aa5b8f7e8857abee4ef56955 (patch) | |
tree | abb02dfc7108ca8b7e68918f85d468c38b940656 /gui-compare | |
parent | 2707e6f383837ce5d03bafc507f804c675df8466 (diff) |
2008-12-17 Jb Evain <jbevain@novell.com>
* MainWindow.cs
* InfoManager.cs
* CompareContext.cs:
Avoid defining our own delegate when we can use Func and Action.
svn path=/trunk/mono-tools/; revision=121679
Diffstat (limited to 'gui-compare')
-rw-r--r-- | gui-compare/ChangeLog | 7 | ||||
-rw-r--r-- | gui-compare/CompareContext.cs | 11 | ||||
-rw-r--r-- | gui-compare/InfoManager.cs | 6 | ||||
-rw-r--r-- | gui-compare/MainWindow.cs | 6 |
4 files changed, 16 insertions, 14 deletions
diff --git a/gui-compare/ChangeLog b/gui-compare/ChangeLog index 1e5d12d4..a85ffe98 100644 --- a/gui-compare/ChangeLog +++ b/gui-compare/ChangeLog @@ -1,6 +1,13 @@ 2008-12-17 Jb Evain <jbevain@novell.com> * MainWindow.cs + * InfoManager.cs + * CompareContext.cs: + Avoid defining our own delegate when we can use Func and Action. + +2008-12-17 Jb Evain <jbevain@novell.com> + + * MainWindow.cs * Metadata.cs * Comparison.cs * CompareContext.cs: diff --git a/gui-compare/CompareContext.cs b/gui-compare/CompareContext.cs index 364b2ef0..b30e4dfc 100644 --- a/gui-compare/CompareContext.cs +++ b/gui-compare/CompareContext.cs @@ -28,15 +28,12 @@ using System.Collections.Generic; using System.Threading; namespace GuiCompare { - - // A delegate used to load a CompAssembly - public delegate CompAssembly LoadCompAssembly (); - + public class CompareContext { - LoadCompAssembly reference_loader, target_loader; + Func<CompAssembly> reference_loader, target_loader; - public CompareContext (LoadCompAssembly reference, LoadCompAssembly target) + public CompareContext (Func<CompAssembly> reference, Func<CompAssembly> target) { reference_loader = reference; target_loader = target; @@ -59,7 +56,7 @@ namespace GuiCompare { { } - bool TryLoad (ref CompAssembly assembly, LoadCompAssembly loader) + bool TryLoad (ref CompAssembly assembly, Func<CompAssembly> loader) { try { assembly = loader (); diff --git a/gui-compare/InfoManager.cs b/gui-compare/InfoManager.cs index 9ab7148a..ef4a2830 100644 --- a/gui-compare/InfoManager.cs +++ b/gui-compare/InfoManager.cs @@ -211,14 +211,12 @@ namespace GuiCompare infos = Path.Combine (xdg_data_home, "mono-gui-compare"); Directory.CreateDirectory (infos); } - - public delegate void MasterInfoLoaded (string path); - + // // Ensures that masterinfo file for assembly name @file in @prof profile // is downloaded; On success, executes the given callback // - public void Ensure (string prof, string assemblyname, MasterInfoLoaded done) + public void Ensure (string prof, string assemblyname, Action<string> done) { string pdir = Path.Combine (infos, prof); if (!Directory.Exists (pdir)){ diff --git a/gui-compare/MainWindow.cs b/gui-compare/MainWindow.cs index e4b411e0..ffd390f9 100644 --- a/gui-compare/MainWindow.cs +++ b/gui-compare/MainWindow.cs @@ -34,7 +34,7 @@ using GuiCompare; public partial class MainWindow: Gtk.Window { InfoManager info_manager; - LoadCompAssembly reference_loader, target_loader; + Func<CompAssembly> reference_loader, target_loader; CompareContext context; static Gdk.Pixbuf classPixbuf, delegatePixbuf, enumPixbuf; @@ -259,12 +259,12 @@ public partial class MainWindow: Gtk.Window } } - public void SetTarget (LoadCompAssembly target) + public void SetTarget (Func<CompAssembly> target) { target_loader = target; } - public void SetReference (LoadCompAssembly reference) + public void SetReference (Func<CompAssembly> reference) { reference_loader = reference; } |