[f-spot/backend-cleanup: 2/8] Add SetDefaultVersion to IBrowsableItemVersionable
- From: Mike Gemünde <mgemuende src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot/backend-cleanup: 2/8] Add SetDefaultVersion to IBrowsableItemVersionable
- Date: Wed, 7 Jul 2010 06:44:54 +0000 (UTC)
commit 750ec1545ecbe445050f3d706580b0db9cdaab08
Author: Mike Gemünde <mike gemuende de>
Date: Tue Jul 6 14:40:36 2010 +0200
Add SetDefaultVersion to IBrowsableItemVersionable
This commit starts adding the behavior to IBrowsableItemVersionable
which is related to an item with different versions where versions
can be changed.
src/Core/IBrowsableItemVersionable.cs | 26 ++++++++++++++++++++++++--
src/Core/Photo.cs | 10 ++++++++++
2 files changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/IBrowsableItemVersionable.cs b/src/Core/IBrowsableItemVersionable.cs
index 039763a..03c9cb4 100644
--- a/src/Core/IBrowsableItemVersionable.cs
+++ b/src/Core/IBrowsableItemVersionable.cs
@@ -1,8 +1,30 @@
+/*
+ * IBrowsableItemVersion.cs
+ *
+ * Author(s):
+ * Ruben Vermeersch <ruben savanne be>
+ * Mike Gemuende <mike gemuende de>
+ *
+ * This is free software. See COPYING for details.
+ */
+
using System.Collections.Generic;
namespace FSpot
{
- public interface IBrowsableItemVersionable {
- IEnumerable<IBrowsableItemVersion> Versions { get; }
+ /// <summary>
+ /// The interface adds functionality which is related to items where
+ /// versions can be added or removed.
+ /// </summary>
+ public interface IBrowsableItemVersionable : IBrowsableItem{
+
+ /// <summary>
+ /// Sets the default version of a the item.
+ /// </summary>
+ /// <param name="version">
+ /// A <see cref="IBrowsableItemVersion"/> which will be the new
+ /// default version.
+ /// </param>
+ void SetDefaultVersion (IBrowsableItemVersion version);
}
}
diff --git a/src/Core/Photo.cs b/src/Core/Photo.cs
index 7c1784b..8352fe9 100644
--- a/src/Core/Photo.cs
+++ b/src/Core/Photo.cs
@@ -213,6 +213,16 @@ namespace FSpot
}
}
+ public void SetDefaultVersion (IBrowsableItemVersion version)
+ {
+ PhotoVersion photo_version = version as PhotoVersion;
+ if (photo_version == null)
+ throw new ArgumentException ("Not a valid version for this photo");
+
+ DefaultVersionId = photo_version.VersionId;
+ }
+
+
//FIXME: won't work on non file uris
public uint SaveVersion (Gdk.Pixbuf buffer, bool create_version)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]