Aggiunto log per il locking.

Leonardo Robol [2010-02-10 09:52]
Aggiunto log per il locking.
Filename
Dizzy/FileTreeView.cs
Dizzy/Log.cs
diff --git a/Dizzy/FileTreeView.cs b/Dizzy/FileTreeView.cs
index 4fd33aa..b06fd2a 100644
--- a/Dizzy/FileTreeView.cs
+++ b/Dizzy/FileTreeView.cs
@@ -22,6 +22,8 @@ namespace Dizzy

 		public FileTreeView (Gtk.TreeView tree)
 		{
+			Log.Lock ("FileTreeView() locking");
+			lock (this) {
 			// Costruisco la ListStore e popolo di colonne
 			// la TreeView
 			this.tree = tree;
@@ -46,13 +48,15 @@ namespace Dizzy
 			                                        typeof(string));// Dimensione

 			this.tree.Model = fileListStore;
-			CellSetup ();

+			CellSetup ();
+			}
+			Log.Lock ("FileTreeView() unlocking");
 		}

 		protected void CellSetup()
 		{
-			lock (this) {
+			// lock (this) {
 				// Filename
 				Gtk.CellRendererText filenameRenderer = new Gtk.CellRendererText ();
 				filenameColumn.Resizable = true;
@@ -69,24 +73,28 @@ namespace Dizzy
 				userColumn.Resizable = true;
 				userColumn.PackStart (userRenderer, true);
 				userColumn.AddAttribute (userRenderer, "text", 1);
-			}
+			// }
 		}

 		public void AddFile(Dizzy.File file)
 		{
 			lock (this) {
+				Log.Lock ("AddFile() locking");
 				// Aggiungo i valori effettivi nel liststore.
 				fileListStore.AppendValues(	file.name,
 			                           		file.user,
 			                           		file.path,
 				                           	file.SizeToString ());
+				Log.Lock ("AddFile() unlocking");
 			}
 		}

 		public void Clear ()
 		{
 			lock (this) {
+				Log.Lock ("Clear() locking");
 				fileListStore.Clear ();
+				Log.Lock ("Clear() unlocking");
 			}
 		}

diff --git a/Dizzy/Log.cs b/Dizzy/Log.cs
index 77d045f..1d14b09 100644
--- a/Dizzy/Log.cs
+++ b/Dizzy/Log.cs
@@ -48,5 +48,15 @@ namespace Dizzy

 			StatusBarUpdate(message);
 		}
+
+		public static void Lock (string message)
+		{
+
+			ConsoleColor initial = Console.ForegroundColor;
+			Console.ForegroundColor = ConsoleColor.DarkGray;
+			Console.Write (" ==> ");
+			Console.ForegroundColor = initial;
+			Console.WriteLine (message);
+		}
 	}
 }
ViewGit