f-spot r4589 - in trunk/src: . Core Editors Extensions Platform/Gnome Platform/Null Utils Widgets
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4589 - in trunk/src: . Core Editors Extensions Platform/Gnome Platform/Null Utils Widgets
- Date: Sun, 16 Nov 2008 19:43:52 +0000 (UTC)
Author: sdelcroix
Date: Sun Nov 16 19:43:52 2008
New Revision: 4589
URL: http://svn.gnome.org/viewvc/f-spot?rev=4589&view=rev
Log:
do not redefine a delegate where EventHandler<T> is suitable
Modified:
trunk/src/AsyncPixbufLoader.cs
trunk/src/Core/DbItem.cs
trunk/src/Db.cs
trunk/src/Editors/Editor.cs
trunk/src/Extensions/ViewModeCondition.cs
trunk/src/IOChannel.cs
trunk/src/ImageView.cs
trunk/src/MainWindow.cs
trunk/src/PhotoImageView.cs
trunk/src/PhotoStore.cs
trunk/src/PhotoView.cs
trunk/src/Platform/Gnome/PreferenceBackend.cs
trunk/src/Platform/Null/PreferenceBackend.cs
trunk/src/Preferences.cs
trunk/src/Utils/Log.cs
trunk/src/Widgets/IconView.cs
Modified: trunk/src/AsyncPixbufLoader.cs
==============================================================================
--- trunk/src/AsyncPixbufLoader.cs (original)
+++ trunk/src/AsyncPixbufLoader.cs Sun Nov 16 19:43:52 2008
@@ -5,30 +5,27 @@
using FSpot.Utils;
namespace FSpot {
- public delegate void AreaUpdatedHandler (object sender, AreaUpdatedArgs area);
- public delegate void AreaPreparedHandler (object sender, AreaPreparedArgs args);
-
- public class AreaPreparedArgs : System.EventArgs {
+ public class AreaPreparedEventArgs : System.EventArgs {
bool reduced_resolution;
public bool ReducedResolution {
get { return reduced_resolution; }
}
- public AreaPreparedArgs (bool reduced_resolution)
+ public AreaPreparedEventArgs (bool reduced_resolution)
{
this.reduced_resolution = reduced_resolution;
}
}
- public class AreaUpdatedArgs : System.EventArgs {
+ public class AreaUpdatedEventArgs : System.EventArgs {
Gdk.Rectangle area;
public Gdk.Rectangle Area {
get { return area; }
}
- public AreaUpdatedArgs (Gdk.Rectangle area)
+ public AreaUpdatedEventArgs (Gdk.Rectangle area)
{
this.area = area;
}
@@ -51,8 +48,8 @@
//byte [] buffer = new byte [8192];
byte [] buffer = new byte [1 << 15];
- public event AreaUpdatedHandler AreaUpdated;
- public event AreaPreparedHandler AreaPrepared;
+ public event EventHandler<AreaUpdatedEventArgs> AreaUpdated;
+ public event EventHandler<AreaPreparedEventArgs> AreaPrepared;
public event System.EventHandler Done;
// If the photo we just loaded has an out of date
@@ -150,7 +147,7 @@
if (AreaPrepared != null && thumb != null) {
pixbuf = thumb;
- AreaPrepared (this, new AreaPreparedArgs (true));
+ AreaPrepared (this, new AreaPreparedEventArgs (true));
}
ThumbnailGenerator.Default.PushBlock ();
@@ -219,7 +216,7 @@
area = PixbufUtils.TransformAndCopy (loader.Pixbuf, pixbuf, orientation, damage);
if (area.Width != 0 && area.Height != 0 && AreaUpdated != null)
- AreaUpdated (this, new AreaUpdatedArgs (area));
+ AreaUpdated (this, new AreaUpdatedEventArgs (area));
//System.Console.WriteLine ("orig {0} tform {1}", damage.ToString (), area.ToString ());
damage = Gdk.Rectangle.Zero;
@@ -401,7 +398,7 @@
area_prepared = true;
if (AreaUpdated != null)
- AreaPrepared (this, new AreaPreparedArgs (false));
+ AreaPrepared (this, new AreaPreparedEventArgs (false));
if (thumb != null)
thumb.Dispose ();
Modified: trunk/src/Core/DbItem.cs
==============================================================================
--- trunk/src/Core/DbItem.cs (original)
+++ trunk/src/Core/DbItem.cs Sun Nov 16 19:43:52 2008
@@ -8,6 +8,8 @@
* This is free software. See COPYING for details.
*/
+using System;
+
namespace FSpot
{
public class DbItem {
@@ -21,19 +23,19 @@
}
}
- public class DbItemEventArgs {
+ public class DbItemEventArgs : EventArgs {
private DbItem [] items;
public DbItem [] Items {
get { return items; }
}
- public DbItemEventArgs (DbItem [] items)
+ public DbItemEventArgs (DbItem [] items) : base ()
{
this.items = items;
}
- public DbItemEventArgs (DbItem item)
+ public DbItemEventArgs (DbItem item) : base ()
{
this.items = new DbItem [] { item };
}
Modified: trunk/src/Db.cs
==============================================================================
--- trunk/src/Db.cs (original)
+++ trunk/src/Db.cs Sun Nov 16 19:43:52 2008
@@ -9,10 +9,6 @@
// A Store maps to a SQL table. We have separate stores (i.e. SQL tables) for tags, photos and imports.
-public delegate void ItemsAddedHandler (object sender, DbItemEventArgs args);
-public delegate void ItemsRemovedHandler (object sender, DbItemEventArgs args);
-public delegate void ItemsChangedHandler (object sender, DbItemEventArgs args);
-
public class DbException : ApplicationException {
public DbException(string msg) : base(msg)
{
@@ -22,9 +18,9 @@
public abstract class DbStore {
// DbItem cache.
- public event ItemsAddedHandler ItemsAdded;
- public event ItemsRemovedHandler ItemsRemoved;
- public event ItemsChangedHandler ItemsChanged;
+ public event EventHandler<DbItemEventArgs> ItemsAdded;
+ public event EventHandler<DbItemEventArgs> ItemsRemoved;
+ public event EventHandler<DbItemEventArgs> ItemsChanged;
protected Hashtable item_cache;
bool cache_is_immortal;
Modified: trunk/src/Editors/Editor.cs
==============================================================================
--- trunk/src/Editors/Editor.cs (original)
+++ trunk/src/Editors/Editor.cs Sun Nov 16 19:43:52 2008
@@ -269,8 +269,8 @@
return new EditorState ();
}
- public event InitializedHandler Initialized;
public delegate void InitializedHandler ();
+ public event InitializedHandler Initialized;
public void Initialize (EditorState state) {
State = state;
Modified: trunk/src/Extensions/ViewModeCondition.cs
==============================================================================
--- trunk/src/Extensions/ViewModeCondition.cs (original)
+++ trunk/src/Extensions/ViewModeCondition.cs Sun Nov 16 19:43:52 2008
@@ -30,8 +30,8 @@
// because there is no way to get hold of a reference to the current window.
public class ViewModeCondition : ConditionType
{
- private static event ViewModeChangedHandler ViewModeChanged;
private delegate void ViewModeChangedHandler ();
+ private static event ViewModeChangedHandler ViewModeChanged;
private static ViewMode mode = ViewMode.Unknown;
public static ViewMode Mode {
Modified: trunk/src/IOChannel.cs
==============================================================================
--- trunk/src/IOChannel.cs (original)
+++ trunk/src/IOChannel.cs Sun Nov 16 19:43:52 2008
@@ -49,8 +49,6 @@
}
}
- public delegate void IOChannelDataReadyEvent (object sender, DataReadEventArgs args);
-
public class IOChannel : System.IO.Stream {
private HandleRef handle;
@@ -199,9 +197,9 @@
// FIXME this should hold more than one source in a table
// but I am lazy
uint data_ready_source;
- private IOChannelDataReadyEvent data_ready;
+ private EventHandler<DataReadEventArgs> data_ready;
private IOFunc func;
- public event IOChannelDataReadyEvent DataReady {
+ public event EventHandler<DataReadEventArgs> DataReady {
add {
data_ready += value;
func = new IOFunc (DataReadyHandler);
Modified: trunk/src/ImageView.cs
==============================================================================
--- trunk/src/ImageView.cs (original)
+++ trunk/src/ImageView.cs Sun Nov 16 19:43:52 2008
@@ -324,7 +324,6 @@
if (view.ZoomChanged != null)
view.ZoomChanged (view, System.EventArgs.Empty);
}
- public delegate void ZoomChangedHandler (object sender, System.EventArgs args);
- public event ZoomChangedHandler ZoomChanged;
+ public event EventHandler ZoomChanged;
}
}
Modified: trunk/src/MainWindow.cs
==============================================================================
--- trunk/src/MainWindow.cs (original)
+++ trunk/src/MainWindow.cs Sun Nov 16 19:43:52 2008
@@ -1415,8 +1415,12 @@
// IconView event handlers
//
- void HandleDoubleClicked (Widget widget, BrowsableEventArgs args)
+ void HandleDoubleClicked (object sender, BrowsableEventArgs args)
{
+ Widget widget = sender as Widget;
+ if (widget == null)
+ return;
+
switch (ViewMode) {
case ModeType.IconView:
icon_view.FocusCell = args.Items[0];
Modified: trunk/src/PhotoImageView.cs
==============================================================================
--- trunk/src/PhotoImageView.cs (original)
+++ trunk/src/PhotoImageView.cs Sun Nov 16 19:43:52 2008
@@ -151,7 +151,7 @@
}
// Display.
- private void HandlePixbufAreaUpdated (object sender, AreaUpdatedArgs args)
+ private void HandlePixbufAreaUpdated (object sender, AreaUpdatedEventArgs args)
{
if (!ShowProgress)
return;
@@ -161,7 +161,7 @@
}
- private void HandlePixbufPrepared (object sender, AreaPreparedArgs args)
+ private void HandlePixbufPrepared (object sender, AreaPreparedEventArgs args)
{
if (!ShowProgress)
return;
Modified: trunk/src/PhotoStore.cs
==============================================================================
--- trunk/src/PhotoStore.cs (original)
+++ trunk/src/PhotoStore.cs Sun Nov 16 19:43:52 2008
@@ -637,8 +637,8 @@
}
// Dbus
- public event ItemsAddedHandler ItemsAddedOverDBus;
- public event ItemsRemovedHandler ItemsRemovedOverDBus;
+ public event EventHandler<DbItemEventArgs> ItemsAddedOverDBus;
+ public event EventHandler<DbItemEventArgs> ItemsRemovedOverDBus;
public Photo CreateOverDBus (string new_path, string orig_path, uint roll_id, out Gdk.Pixbuf pixbuf) {
Photo photo = Create (new_path, orig_path, roll_id, out pixbuf);
Modified: trunk/src/PhotoView.cs
==============================================================================
--- trunk/src/PhotoView.cs (original)
+++ trunk/src/PhotoView.cs Sun Nov 16 19:43:52 2008
@@ -52,8 +52,7 @@
public delegate void UpdateFinishedHandler (PhotoView view);
public event UpdateFinishedHandler UpdateFinished;
- public delegate void DoubleClickedHandler (Widget widget, BrowsableEventArgs args);
- public event DoubleClickedHandler DoubleClicked;
+ public event EventHandler<BrowsableEventArgs> DoubleClicked;
public FSpot.PhotoImageView View {
get { return photo_view; }
Modified: trunk/src/Platform/Gnome/PreferenceBackend.cs
==============================================================================
--- trunk/src/Platform/Gnome/PreferenceBackend.cs (original)
+++ trunk/src/Platform/Gnome/PreferenceBackend.cs Sun Nov 16 19:43:52 2008
@@ -51,8 +51,6 @@
{
}
}
-
- public delegate void NotifyChangedHandler (object sender, NotifyEventArgs args);
}
namespace FSpot.Platform
@@ -86,7 +84,7 @@
Client.Set (key, o);
}
- public void AddNotify (string key, NotifyChangedHandler handler)
+ public void AddNotify (string key, EventHandler<NotifyEventArgs> handler)
{
Client.AddNotify (key, delegate (object sender, GConf.NotifyEventArgs args) {handler (sender, new NotifyEventArgs (args.Key, args.Value));});
}
Modified: trunk/src/Platform/Null/PreferenceBackend.cs
==============================================================================
--- trunk/src/Platform/Null/PreferenceBackend.cs (original)
+++ trunk/src/Platform/Null/PreferenceBackend.cs Sun Nov 16 19:43:52 2008
@@ -46,8 +46,6 @@
{
}
}
-
- public delegate void NotifyChangedHandler (object sender, NotifyEventArgs args);
}
namespace FSpot.Platform
@@ -63,7 +61,7 @@
{
}
- public void AddNotify (string key, NotifyChangedHandler handler)
+ public void AddNotify (string key, EventHandler<NotifyEventArgs> handler)
{
}
}
Modified: trunk/src/Preferences.cs
==============================================================================
--- trunk/src/Preferences.cs (original)
+++ trunk/src/Preferences.cs Sun Nov 16 19:43:52 2008
@@ -88,12 +88,12 @@
private static PreferenceBackend backend;
- private static NotifyChangedHandler changed_handler;
+ private static EventHandler<NotifyEventArgs> changed_handler;
private static PreferenceBackend Backend {
get {
if (backend == null) {
backend = new PreferenceBackend ();
- changed_handler = new NotifyChangedHandler (OnSettingChanged);
+ changed_handler = new EventHandler<NotifyEventArgs> (OnSettingChanged);
backend.AddNotify ("/apps/f-spot", changed_handler);
backend.AddNotify ("/apps/gnome-screensaver/themes", changed_handler);
backend.AddNotify ("/apps/gnome-screensaver/mode", changed_handler);
@@ -244,7 +244,7 @@
}
}
- public static event NotifyChangedHandler SettingChanged;
+ public static event EventHandler<NotifyEventArgs> SettingChanged;
static void OnSettingChanged (object sender, NotifyEventArgs args)
{
Modified: trunk/src/Utils/Log.cs
==============================================================================
--- trunk/src/Utils/Log.cs (original)
+++ trunk/src/Utils/Log.cs Sun Nov 16 19:43:52 2008
@@ -32,8 +32,6 @@
namespace FSpot.Utils
{
- public delegate void LogNotifyHandler (LogNotifyEventArgs args);
-
public class LogNotifyEventArgs : EventArgs
{
private LogEntry entry;
@@ -90,7 +88,7 @@
public static class Log
{
- public static event LogNotifyHandler Notify;
+ public static event EventHandler<LogNotifyEventArgs> Notify;
private static Dictionary<uint, DateTime> timers = new Dictionary<uint, DateTime> ();
private static uint next_timer_id = 1;
@@ -145,9 +143,9 @@
private static void OnNotify (LogEntry entry)
{
- LogNotifyHandler handler = Notify;
+ EventHandler<LogNotifyEventArgs> handler = Notify;
if (handler != null) {
- handler (new LogNotifyEventArgs (entry));
+ handler (null, new LogNotifyEventArgs (entry));
}
}
Modified: trunk/src/Widgets/IconView.cs
==============================================================================
--- trunk/src/Widgets/IconView.cs (original)
+++ trunk/src/Widgets/IconView.cs Sun Nov 16 19:43:52 2008
@@ -193,11 +193,8 @@
private int click_count;
// Public events.
- public delegate void DoubleClickedHandler (Widget widget, BrowsableEventArgs args);
- public event DoubleClickedHandler DoubleClicked;
-
- public delegate void ZoomChangedHandler (object sender, System.EventArgs args);
- public event ZoomChangedHandler ZoomChanged;
+ public event EventHandler<BrowsableEventArgs> DoubleClicked;
+ public event EventHandler ZoomChanged;
// Public API.
public IconView (IntPtr raw) : base (raw) {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]