[f-spot/icon-view-cleanup: 6/24] Rename IBrowsableItemExtensions to IPhotoExtensions.
- From: Mike Gemünde <mgemuende src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot/icon-view-cleanup: 6/24] Rename IBrowsableItemExtensions to IPhotoExtensions.
- Date: Tue, 17 Aug 2010 19:20:33 +0000 (UTC)
commit 56c446116ab1c8e071f8f9899fb6e092413fa574
Author: Ruben Vermeersch <ruben savanne be>
Date: Fri Aug 13 18:11:16 2010 +0200
Rename IBrowsableItemExtensions to IPhotoExtensions.
src/Core/FSpot.Core/FSpot.Core.csproj | 2 +-
.../FSpot.Core/IBrowsableItemExtensions.cs | 37 -------------------
src/Core/FSpot.Core/FSpot.Core/IPhotoExtensions.cs | 38 ++++++++++++++++++++
src/Core/FSpot.Core/Makefile.am | 2 +-
4 files changed, 40 insertions(+), 39 deletions(-)
---
diff --git a/src/Core/FSpot.Core/FSpot.Core.csproj b/src/Core/FSpot.Core/FSpot.Core.csproj
index c8bfaa0..c7e6e24 100644
--- a/src/Core/FSpot.Core/FSpot.Core.csproj
+++ b/src/Core/FSpot.Core/FSpot.Core.csproj
@@ -34,7 +34,6 @@
<Compile Include="FSpot.Core\FileBrowsableItem.cs" />
<Compile Include="FSpot.Core\IBrowsableItemChanges.cs" />
<Compile Include="FSpot.Core\IBrowsableItemComparer.cs" />
- <Compile Include="FSpot.Core\IBrowsableItemExtensions.cs" />
<Compile Include="FSpot.Core\IBrowsableItemVersion.cs" />
<Compile Include="FSpot.Core\IBrowsableItemVersionable.cs" />
<Compile Include="FSpot.Core\IBrowsableCollection.cs" />
@@ -44,6 +43,7 @@
<Compile Include="FSpot.Core\Roll.cs" />
<Compile Include="FSpot.Core\Defines.cs" />
<Compile Include="FSpot.Core\IPhoto.cs" />
+ <Compile Include="FSpot.Core\IPhotoExtensions.cs" />
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
diff --git a/src/Core/FSpot.Core/FSpot.Core/IPhotoExtensions.cs b/src/Core/FSpot.Core/FSpot.Core/IPhotoExtensions.cs
new file mode 100644
index 0000000..b3219ef
--- /dev/null
+++ b/src/Core/FSpot.Core/FSpot.Core/IPhotoExtensions.cs
@@ -0,0 +1,38 @@
+using System;
+using System.IO;
+
+namespace FSpot.Core
+{
+ public static class IPhotoExtensions
+ {
+ public static int CompareDate (this IPhoto photo1, IPhoto photo2)
+ {
+ return DateTime.Compare (photo1.Time, photo2.Time);
+ }
+
+ public static int CompareName (this IPhoto photo1, IPhoto photo2)
+ {
+ return string.Compare (photo1.Name, photo2.Name);
+ }
+
+ public static int Compare (this IPhoto photo1, IPhoto photo2)
+ {
+ int result = photo1.CompareDate (photo2);
+
+ if (result == 0)
+ result = CompareDefaultVersionUri (photo1, photo2);
+
+ if (result == 0)
+ result = photo1.CompareName (photo2);
+
+ return result;
+ }
+
+ public static int CompareDefaultVersionUri (this IPhoto photo1, IPhoto photo2)
+ {
+ var photo1_uri = Path.Combine (photo1.DefaultVersion.BaseUri, photo1.DefaultVersion.Filename);
+ var photo2_uri = Path.Combine (photo2.DefaultVersion.BaseUri, photo2.DefaultVersion.Filename);
+ return string.Compare (photo1_uri, photo2_uri);
+ }
+ }
+}
diff --git a/src/Core/FSpot.Core/Makefile.am b/src/Core/FSpot.Core/Makefile.am
index 4122375..c68f775 100644
--- a/src/Core/FSpot.Core/Makefile.am
+++ b/src/Core/FSpot.Core/Makefile.am
@@ -16,11 +16,11 @@ SOURCES = \
FSpot.Core/IBrowsableCollection.cs \
FSpot.Core/IBrowsableItemChanges.cs \
FSpot.Core/IBrowsableItemComparer.cs \
- FSpot.Core/IBrowsableItemExtensions.cs \
FSpot.Core/IBrowsableItemVersion.cs \
FSpot.Core/IBrowsableItemVersionable.cs \
FSpot.Core/ILoadable.cs \
FSpot.Core/IPhoto.cs \
+ FSpot.Core/IPhotoExtensions.cs \
FSpot.Core/PhotoChanges.cs \
FSpot.Core/PhotosChanges.cs \
FSpot.Core/Roll.cs \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]