[f-spot] Minor clean ups



commit bb4618ff1b2de9d9e93883246a2a899f1bc453c5
Author: Stephen Shaw <sshaw decriptor com>
Date:   Fri Feb 17 17:51:31 2012 -0700

    Minor clean ups
    
    Converted more variables to properties
    and initialized them in the ctor.

 src/Core/FSpot.Core/FSpot.Core/Category.cs |    3 +-
 src/Core/FSpot.Core/FSpot.Core/Tag.cs      |   29 +++++++++------------------
 2 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/src/Core/FSpot.Core/FSpot.Core/Category.cs b/src/Core/FSpot.Core/FSpot.Core/Category.cs
index 399fedb..fe9646c 100644
--- a/src/Core/FSpot.Core/FSpot.Core/Category.cs
+++ b/src/Core/FSpot.Core/FSpot.Core/Category.cs
@@ -34,7 +34,8 @@ using System.Collections.Generic;
 
 namespace FSpot.Core
 {
-	public class Category : Tag {
+	public class Category : Tag
+	{
 		List<Tag> children;
 		bool children_need_sort;
 		public IList<Tag> Children {
diff --git a/src/Core/FSpot.Core/FSpot.Core/Tag.cs b/src/Core/FSpot.Core/FSpot.Core/Tag.cs
index 61a6b4d..912d807 100644
--- a/src/Core/FSpot.Core/FSpot.Core/Tag.cs
+++ b/src/Core/FSpot.Core/FSpot.Core/Tag.cs
@@ -38,6 +38,12 @@ namespace FSpot.Core
 {
 	public class Tag : DbItem, IComparable<Tag>, IDisposable {
 		public string Name { get; set; }
+		public int Popularity { get; set; }
+		public int SortPriority { get; set; }
+		// Icon.  If ThemeIconName is not null, then we save the name of the icon instead
+		// of the actual icon data.
+		public string ThemeIconName { get; set; }
+		public bool IconWasCleared { get; set; }
 
 		Category category;
 		public Category Category {
@@ -52,18 +58,6 @@ namespace FSpot.Core
 			}
 		}
 
-		public int SortPriority { get; set; }
-
-		int popularity = 0;
-		public int Popularity {
-			get { return popularity; }
-			set { popularity = value; }
-		}
-
-		// Icon.  If theme_icon_name is not null, then we save the name of the icon instead
-		// of the actual icon data.
-		public string ThemeIconName { get; set; }
-
 		Pixbuf icon;
 		public Pixbuf Icon {
 			get {
@@ -83,12 +77,6 @@ namespace FSpot.Core
 			}
 		}
 
-		bool icon_was_cleared = false;
-		public bool IconWasCleared {
-			get { return icon_was_cleared; }
-			set { icon_was_cleared = value; }
-		}
-
 		public enum IconSize {
 			Hidden = 0,
 			Small = 16,
@@ -135,16 +123,19 @@ namespace FSpot.Core
 		}
 
 
+		// FIXME: Why does this ctor take one of its derived classes as a parameter?
 		// You are not supposed to invoke these constructors outside of the TagStore class.
 		public Tag (Category category, uint id, string name)
 			: base (id)
 		{
 			Category = category;
 			Name = name;
+			Popularity = 0;
+			IconWasCleared = false;
 		}
 
 
-		// IComparer.
+		// IComparer
 		public int CompareTo (Tag tag)
 		{
 			if (tag == null)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]