Cerchiamo di gestire gli aggiornamenti in maniera più sono.

Leonardo Robol [2010-02-10 13:53]
Cerchiamo di gestire gli aggiornamenti in maniera più sono.
Filename
Dizzy/MainWindow.cs
Dizzy/Protocol.cs
gtk-gui/gui.stetic
diff --git a/Dizzy/MainWindow.cs b/Dizzy/MainWindow.cs
index 59fffae..7a65bb4 100644
--- a/Dizzy/MainWindow.cs
+++ b/Dizzy/MainWindow.cs
@@ -19,9 +19,11 @@ public partial class MainWindow : Gtk.Window

 		// Inizializziamo la vista dei file.
 		files = new Dizzy.FileTreeView (filelist);
+		EventManager.RegisterFileTreeView (ref files);

 		// .. e anche quella dei download
 		tasks = new Dizzy.TaskTreeView (tasklist);
+		EventManager.RegisterTaskTreeView (ref tasks);

 		// Carichiamo qualche impostazione di default
 		string downloadpath = config.GetValue("download_folder");
@@ -70,7 +72,7 @@ public partial class MainWindow : Gtk.Window
 	{
 		this.files.Clear ();
 		EventManager.SearchStarted ();
-		this.protocol.Search (searchBox.Text, ref this.files);
+		this.protocol.Search (searchBox.Text);
 	}

 	protected virtual void OnRowActivated (object o, Gtk.RowActivatedArgs args)
diff --git a/Dizzy/Protocol.cs b/Dizzy/Protocol.cs
index 4d2c812..53ef0b9 100644
--- a/Dizzy/Protocol.cs
+++ b/Dizzy/Protocol.cs
@@ -35,7 +35,6 @@ namespace Dizzy

 		// Dati letti dal thread che cerca per capire cosa cercare
 		string keyword;
-		FileTreeView fileTreeView;

 		GlobalConfig config;

@@ -52,7 +51,7 @@ namespace Dizzy
 			this.UpdateFileList ();
 		}

-		public void Search(string keyword, ref FileTreeView f)
+		public void Search(string keyword)
 		{
 			if (this.finder != null && this.finder.IsAlive)
 			{
@@ -69,7 +68,6 @@ namespace Dizzy
 			{
 				Log.Info ("Avvio la ricerca nel database");
 				this.keyword = keyword;
-				this.fileTreeView = f;
 				this.finder = new Thread(new ThreadStart (this._Search));
 				this.finder.Start ();
 			}
@@ -100,11 +98,13 @@ namespace Dizzy
 				files = new ArrayList ();
 			}

-			this.fileTreeView.Clear ();
+			// this.fileTreeView.Clear ();
+			EventManager.FileTreeViewClear ();

 			foreach(File f in files)
 			{
-				this.fileTreeView.AddFile (f);
+				// this.fileTreeView.AddFile (f);
+				EventManager.FileTreeViewAddFile (f);
 			}
 			EventManager.SearchFinished ();
 			if (files.Count == 0)
diff --git a/gtk-gui/gui.stetic b/gtk-gui/gui.stetic
index b969804..71809dc 100644
--- a/gtk-gui/gui.stetic
+++ b/gtk-gui/gui.stetic
@@ -640,7 +640,7 @@ Libro</property>
       </widget>
     </child>
   </widget>
-  <widget class="Gtk.Dialog" id="Dizzy.ErrorDialog" design-size="210 131">
+  <widget class="Gtk.Dialog" id="Dizzy.ErrorDialog" design-size="400 300">
     <property name="MemberName" />
     <property name="WindowPosition">CenterOnParent</property>
     <property name="Buttons">2</property>
@@ -650,43 +650,7 @@ Libro</property>
         <property name="MemberName" />
         <property name="BorderWidth">2</property>
         <child>
-          <widget class="Gtk.HBox" id="hbox2">
-            <property name="MemberName" />
-            <property name="Spacing">6</property>
-            <child>
-              <widget class="Gtk.Image" id="image1">
-                <property name="MemberName" />
-                <property name="WidthRequest">64</property>
-                <property name="HeightRequest">64</property>
-                <property name="Pixbuf">stock:gtk-dialog-error Menu</property>
-              </widget>
-              <packing>
-                <property name="Position">0</property>
-                <property name="AutoSize">True</property>
-                <property name="Expand">False</property>
-                <property name="Fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="Gtk.Label" id="message">
-                <property name="MemberName" />
-                <property name="LabelProp" translatable="yes">label4</property>
-                <property name="UseMarkup">True</property>
-              </widget>
-              <packing>
-                <property name="Position">1</property>
-                <property name="AutoSize">True</property>
-                <property name="Expand">False</property>
-                <property name="Fill">False</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="Position">0</property>
-            <property name="AutoSize">True</property>
-            <property name="Expand">False</property>
-            <property name="Fill">False</property>
-          </packing>
+          <placeholder />
         </child>
       </widget>
     </child>
ViewGit