From c3d1f4308c727018e8ad754024311bab8c596c05 Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Wed, 10 Feb 2010 10:52:52 +0100 Subject: [PATCH] Aggiunto log per il locking. --- Dizzy/FileTreeView.cs | 14 +++++++++++--- Dizzy/Log.cs | 10 ++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) 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); + } } } -- 2.1.4