Qualche correzione di bug sul percorso dei file.

Leonardo Robol [2010-02-02 10:02]
Qualche correzione di bug sul percorso dei file.
Filename
Dizzy.make
MainWindow.cs
Protocol.cs
gtk-gui/MainWindow.cs
gtk-gui/gui.stetic
diff --git a/Dizzy.make b/Dizzy.make
index c7aa275..a114bd2 100644
--- a/Dizzy.make
+++ b/Dizzy.make
@@ -64,12 +64,16 @@ FILES = \
 	File.cs \
 	FileTreeView.cs \
 	TaskTreeView.cs \
-	Protocol.cs
+	Protocol.cs \
+	StartupDialog.cs \
+	gtk-gui/Dizzy.StartupDialog.cs \
+	GlobalConfig.cs

 DATA_FILES =

 RESOURCES = \
-	gtk-gui/gui.stetic
+	gtk-gui/gui.stetic \
+	resources/logo.png,Dizzy.logo.png

 EXTRAS = \
 	app.desktop \
diff --git a/MainWindow.cs b/MainWindow.cs
index c487111..fc085f8 100644
--- a/MainWindow.cs
+++ b/MainWindow.cs
@@ -41,7 +41,9 @@ public partial class MainWindow : Gtk.Window
 		Console.WriteLine("row_activated called");
 		File f = this.files.GetFileFromPath (args.Path);
 		//	this.tasks.AddTask (f.name, 24);
-		this.protocol.Download(f, ref tasks);
+		string download_folder = this.downloadpathchooser.Filename;
+		this.protocol.Download(f, ref tasks, download_folder);
+
 	}

 }
diff --git a/Protocol.cs b/Protocol.cs
index 9b20b2d..adddd1c 100644
--- a/Protocol.cs
+++ b/Protocol.cs
@@ -3,6 +3,7 @@ using System;
 using System.Collections;
 using System.Threading;
 using System.Text.RegularExpressions;
+using System.IO;
 using Tamir.SharpSsh;

 namespace Dizzy
@@ -111,11 +112,12 @@ namespace Dizzy
 		}


-		public void Download(File f, ref TaskTreeView tasks)
+		public void Download(File f, ref TaskTreeView tasks, string downloadFolder)
 		{
 			ArrayList args = new ArrayList ();
 			args.Add (f);
 			args.Add (tasks);
+			args.Add (downloadFolder);
 			Thread t = new Thread (new ParameterizedThreadStart(_Download));
 			t.Start (args);
 			this.threads.Add (t);
@@ -128,9 +130,9 @@ namespace Dizzy
 			// mi riesce di fare.
 			File f = (File) ((ArrayList) args)[0];
 			TaskTreeView tasks = (TaskTreeView) ((ArrayList) args)[1];
-
+			string downloadFolder = (string) ((ArrayList) args)[2];
 			Console.WriteLine (" => Download starting");
-			FileTransfer transfer = new FileTransfer (f, ref tasks, this.user, this.password);
+			FileTransfer transfer = new FileTransfer (f, ref tasks, this.user, this.password, downloadFolder);
 			this.transfers.Add (transfer);
 		}

@@ -235,13 +237,13 @@ namespace Dizzy
 			return matches;
 		}

-		public void Download(File f)
+		public void Download(File f, string downloadFolder)
 		{
 			Console.WriteLine (" => Getting {0}", f.name);
 			try
 			{
 				Console.WriteLine (f.path);
-				this.sftp.Get (f.path, "/home/leonardo/" + f.name);
+				this.sftp.Get (f.path, downloadFolder + Path.DirectorySeparatorChar +  f.name);
 			}
 			catch(Exception e)
 			{
@@ -268,7 +270,7 @@ namespace Dizzy
 		public delegate void Handler(string src, string dest, int transferredBytes,
 		                             int totalBytes, string message);

-		public FileTransfer (File f, ref TaskTreeView tasks, string user, string password)
+		public FileTransfer (File f, ref TaskTreeView tasks, string user, string password, string downloadFolder)
 		{
 			// Connessione al server
 			this.sftp = new SFTPConnection (user, password);
@@ -282,7 +284,7 @@ namespace Dizzy
 			sftp.TransferStopped += new SFTPConnection.SFTPEvent(OnTransferStopped);

 			Console.WriteLine(" => Starting sftp command");
-			sftp.Download (this.file);
+			sftp.Download (this.file, downloadFolder);
 		}

 		public void Stop ()
@@ -300,8 +302,8 @@ namespace Dizzy
 		public void OnTransferProgress(string src, string dest, int transferredBytes,
 		                               int totalBytes, string message)
 		{
-			if(message != "")
-				Console.WriteLine(message);
+			// if(message != "")
+				// Console.WriteLine(message);
 			int perc = transferredBytes / (totalBytes / 100);
 			this.tasks.SetProgress(this.iter, perc);
 		}
diff --git a/gtk-gui/MainWindow.cs b/gtk-gui/MainWindow.cs
index b2df7e0..6c97ee0 100644
--- a/gtk-gui/MainWindow.cs
+++ b/gtk-gui/MainWindow.cs
@@ -76,7 +76,7 @@ public partial class MainWindow {
         this.notebook1 = new Gtk.Notebook();
         this.notebook1.CanFocus = true;
         this.notebook1.Name = "notebook1";
-        this.notebook1.CurrentPage = 0;
+        this.notebook1.CurrentPage = 1;
         // Container child notebook1.Gtk.Notebook+NotebookChild
         this.vbox3 = new Gtk.VBox();
         this.vbox3.Name = "vbox3";
diff --git a/gtk-gui/gui.stetic b/gtk-gui/gui.stetic
index 86d9e7b..bf8c5bc 100644
--- a/gtk-gui/gui.stetic
+++ b/gtk-gui/gui.stetic
@@ -36,7 +36,7 @@
           <widget class="Gtk.Notebook" id="notebook1">
             <property name="MemberName" />
             <property name="CanFocus">True</property>
-            <property name="CurrentPage">0</property>
+            <property name="CurrentPage">1</property>
             <child>
               <widget class="Gtk.VBox" id="vbox3">
                 <property name="MemberName" />
ViewGit