f-spot r4618 - in trunk: . src src/Core



Author: sdelcroix
Date: Mon Nov 24 20:07:24 2008
New Revision: 4618
URL: http://svn.gnome.org/viewvc/f-spot?rev=4618&view=rev

Log:
use generic collection

2008-11-24  Stephane Delcroix  <sdelcroix novell com>

	* src/Core/Category.cs: use a generic collection

	* src/MainWindow.cs:
	* src/Term.cs: changes for the api modifications

Modified:
   trunk/ChangeLog
   trunk/src/Core/Category.cs
   trunk/src/MainWindow.cs
   trunk/src/Term.cs

Modified: trunk/src/Core/Category.cs
==============================================================================
--- trunk/src/Core/Category.cs	(original)
+++ trunk/src/Core/Category.cs	Mon Nov 24 20:07:24 2008
@@ -8,27 +8,27 @@
  * This is free software. See COPYING for details.
  */
 
-using System.Collections;
+using System.Collections.Generic;
 
 namespace FSpot
 {
 	public class Category : Tag {
-		ArrayList children;
+		List<Tag> children;
 		bool children_need_sort;
 		public Tag [] Children {
 			get {
 				if (children_need_sort)
 					children.Sort ();
-				return (Tag []) children.ToArray (typeof (Tag));
+				return children.ToArray ();
 			}
 			set {
-				children = new ArrayList (value);
+				children = new List<Tag> (value);
 				children_need_sort = true;
 			}
 		}
 	
 		// Appends all of this categories descendents to the list
-		public void AddDescendentsTo (ArrayList list)
+		public void AddDescendentsTo (IList<Tag> list)
 		{
 			foreach (Tag tag in children) {
 				if (! list.Contains (tag))
@@ -58,7 +58,7 @@
 		public Category (Category category, uint id, string name)
 			: base (category, id, name)
 		{
-			children = new ArrayList ();
+			children = new List<Tag> ();
 		}
 	}
 }

Modified: trunk/src/MainWindow.cs
==============================================================================
--- trunk/src/MainWindow.cs	(original)
+++ trunk/src/MainWindow.cs	Mon Nov 24 20:07:24 2008
@@ -2062,7 +2062,7 @@
 
 		// If a tag with children tags is selected for merging, we
 		// should also merge its children..
-		ArrayList all_tags = new ArrayList (tags.Length);
+		List<Tag> all_tags = new List<Tag> (tags.Length);
 		foreach (Tag tag in tags) {
 			if (! all_tags.Contains (tag))
 				all_tags.Add (tag);
@@ -2076,7 +2076,7 @@
 		}
 
 		// debug..
-		tags = (Tag []) all_tags.ToArray (typeof (Tag));
+		tags = all_tags.ToArray ();
 		System.Array.Sort (tags, new TagRemoveComparer ());
 
 		foreach (Tag tag in tags) {

Modified: trunk/src/Term.cs
==============================================================================
--- trunk/src/Term.cs	(original)
+++ trunk/src/Term.cs	Mon Nov 24 20:07:24 2008
@@ -6,6 +6,7 @@
 
 using System;
 using System.Collections;
+using System.Collections.Generic;
 using System.Text;
 using Mono.Unix;
 using Gtk;
@@ -636,7 +637,7 @@
 			StringBuilder ids = new StringBuilder (tag.Id.ToString ());
 
 			if (tag is Category) {
-				ArrayList tags = new ArrayList ();
+				List<Tag> tags = new List<Tag> ();
 				(tag as Category).AddDescendentsTo (tags);
 
 				for (int i = 0; i < tags.Count; i++)



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