diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs deleted file mode 100644 index 99ef281..0000000 --- a/AssemblyInfo.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("Dizzy")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion("1.0.*")] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] diff --git a/AuthDialog.cs b/AuthDialog.cs deleted file mode 100644 index 0885129..0000000 --- a/AuthDialog.cs +++ /dev/null @@ -1,24 +0,0 @@ - -using System; - -namespace Dizzy -{ - - - public partial class AuthDialog : Gtk.Dialog - { - GlobalConfig config; - - protected virtual void OnOkClicked (object sender, System.EventArgs e) - { - this.config.password = passwordEntry.Text; - this.config.InsertValue("user", userEntry.Text); - } - - public AuthDialog (ref GlobalConfig config) - { - this.config = config; - this.Build (); - } - } -} diff --git a/Dizzy.csproj b/Dizzy.csproj index 1ef8bed..85e0a4e 100644 --- a/Dizzy.csproj +++ b/Dizzy.csproj @@ -77,28 +77,31 @@ <EmbeddedResource Include="gtk-gui\gui.stetic"> <LogicalName>gui.stetic</LogicalName> </EmbeddedResource> - <EmbeddedResource Include="sqlite3.dll"> + <EmbeddedResource Include="Dizzy\sqlite3.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </EmbeddedResource> </ItemGroup> <ItemGroup> <Compile Include="gtk-gui\generated.cs" /> - <Compile Include="MainWindow.cs" /> <Compile Include="gtk-gui\MainWindow.cs" /> - <Compile Include="Main.cs" /> - <Compile Include="AssemblyInfo.cs" /> - <Compile Include="File.cs" /> - <Compile Include="FileTreeView.cs" /> - <Compile Include="TaskTreeView.cs" /> - <Compile Include="Protocol.cs" /> - <Compile Include="GlobalConfig.cs" /> - <Compile Include="AuthDialog.cs" /> <Compile Include="gtk-gui\Dizzy.AuthDialog.cs" /> + <Compile Include="Dizzy\AuthDialog.cs" /> + <Compile Include="Dizzy\File.cs" /> + <Compile Include="Dizzy\FileTreeView.cs" /> + <Compile Include="Dizzy\GlobalConfig.cs" /> + <Compile Include="Dizzy\Main.cs" /> + <Compile Include="Dizzy\MainWindow.cs" /> + <Compile Include="Dizzy\Protocol.cs" /> + <Compile Include="Dizzy\TaskTreeView.cs" /> + <Compile Include="Dizzy\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> - <Content Include="app.desktop"> + <Content Include="Dizzy\app.desktop"> <DeployService-TargetDirectoryId>Linux.DesktopApplications</DeployService-TargetDirectoryId> </Content> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <ItemGroup> + <Folder Include="Dizzy\" /> + </ItemGroup> </Project> \ No newline at end of file diff --git a/Dizzy.sln b/Dizzy.sln index 7b21c4f..8eef052 100644 --- a/Dizzy.sln +++ b/Dizzy.sln @@ -16,5 +16,12 @@ Global EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution StartupItem = Dizzy.csproj + Policies = $0 + $0.DotNetNamingPolicy = $1 + $1.DirectoryNamespaceAssociation = Flat + $1.ResourceNamePolicy = FileFormatDefault + $0.StandardHeader = $2 + $2.Text = + $2.inheritsSet = MITX11License EndGlobalSection EndGlobal diff --git a/Dizzy/AssemblyInfo.cs b/Dizzy/AssemblyInfo.cs new file mode 100644 index 0000000..99ef281 --- /dev/null +++ b/Dizzy/AssemblyInfo.cs @@ -0,0 +1,26 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("Dizzy")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/Dizzy/AuthDialog.cs b/Dizzy/AuthDialog.cs new file mode 100644 index 0000000..0885129 --- /dev/null +++ b/Dizzy/AuthDialog.cs @@ -0,0 +1,24 @@ + +using System; + +namespace Dizzy +{ + + + public partial class AuthDialog : Gtk.Dialog + { + GlobalConfig config; + + protected virtual void OnOkClicked (object sender, System.EventArgs e) + { + this.config.password = passwordEntry.Text; + this.config.InsertValue("user", userEntry.Text); + } + + public AuthDialog (ref GlobalConfig config) + { + this.config = config; + this.Build (); + } + } +} diff --git a/Dizzy/File.cs b/Dizzy/File.cs new file mode 100644 index 0000000..dec97cf --- /dev/null +++ b/Dizzy/File.cs @@ -0,0 +1,73 @@ + +using System; + +namespace Dizzy +{ + + + public class FileType { + + int type; + const int UNKNOWN = 0; + const int VIDEO = 1; + const int AUDIO = 2; + const int BOOK = 3; + + public FileType(string filename) { + + if(filename.EndsWith(".avi")) + type = VIDEO; + else if(filename.EndsWith(".pdf")) + type = BOOK; + else if(filename.EndsWith(".mp3")) + type = AUDIO; + else + type = UNKNOWN; + + } + + public string Name() + { + if(type == VIDEO) + return "Video"; + else if(type == BOOK) + return "Book"; + else if(type == AUDIO) + return "Audio"; + else + return "Sconosciuto"; + } + } + + public class File + { + + + public string user; + public string name; + public string path; + public FileType type; + + public File (string path, string user) + { + // Determino il tipo di file + type = new FileType (path); + string [] a; + if (user == "") + { + a = path.Split('/'); + if (a.Length >= 2) + user = a[2]; + } + this.user = user; + this.path = path; + // Console.WriteLine("Path set to: {0}", this.path); + string[] pieces = path.Split ('/'); + + name = pieces[pieces.Length - 1]; + + } + + + } +} diff --git a/Dizzy/FileTreeView.cs b/Dizzy/FileTreeView.cs new file mode 100644 index 0000000..b968efb --- /dev/null +++ b/Dizzy/FileTreeView.cs @@ -0,0 +1,92 @@ +using Gtk; +using System; + +namespace Dizzy +{ + + + public class FileTreeView + { + + // La treeview passataci dalla grafica + Gtk.TreeView tree; + + // Le colonne che ci servono + Gtk.TreeViewColumn filenameColumn; + Gtk.TreeViewColumn userColumn; + + // La listStore per memorizzare i file + // che troviamo. + Gtk.ListStore fileListStore; + + public FileTreeView (Gtk.TreeView tree) + { + // Costruisco la ListStore e popolo di colonne + // la TreeView + this.tree = tree; + this.filenameColumn = new Gtk.TreeViewColumn (); + filenameColumn.Title = "Nome del file"; + + + this.userColumn = new Gtk.TreeViewColumn (); + userColumn.Title = "Utente"; + + this.tree.AppendColumn (filenameColumn); + this.tree.AppendColumn (userColumn); + + this.fileListStore = new Gtk.ListStore (typeof(string), // Nome del file + typeof(string), // Utente + typeof(string));// Path del file. + + this.tree.Model = fileListStore; + CellSetup (); + + } + + protected void CellSetup() + { + // Filename + Gtk.CellRendererText filenameRenderer = new Gtk.CellRendererText (); + filenameColumn.PackStart (filenameRenderer, true); + filenameColumn.AddAttribute (filenameRenderer, "text", 0); + + // Utente + Gtk.CellRendererText userRenderer = new Gtk.CellRendererText (); + userColumn.PackStart (userRenderer, true); + userColumn.AddAttribute (userRenderer, "text", 1); + } + + public void AddFile(Dizzy.File file) + { + lock (this) { + // Aggiungo i valori effettivi nel liststore. + fileListStore.AppendValues(file.name, + file.user, + file.path); + } + } + + public void Clear () + { + lock (this) { + fileListStore.Clear (); + } + } + + public void SearchInProgress () + { + this.Clear (); + this.AddFile (new File("Ricerca in corso...", " ")); + } + + public File GetFileFromPath (TreePath path) + { + TreeIter iter = new TreeIter (); + fileListStore.GetIter(out iter, path); + File f = new File((string) fileListStore.GetValue(iter, 2), + (string) fileListStore.GetValue(iter, 1)); + return f; + } + + } +} diff --git a/Dizzy/GlobalConfig.cs b/Dizzy/GlobalConfig.cs new file mode 100644 index 0000000..382a01e --- /dev/null +++ b/Dizzy/GlobalConfig.cs @@ -0,0 +1,124 @@ + +using System; +using System.Data.SQLite; + +namespace Dizzy +{ + + + public class GlobalConfig + { + public string password; + private SQLiteConnection conn; + + public GlobalConfig () + { + conn = new SQLiteConnection ("Data Source=" + DataBaseName () + ";Version=3;"); + // Controlliamo che il database sia correttamente + // inizializzato. + Init (); + } + + public string GetValue(string field) + { + string val; + + SQLiteCommand sqlCmd; + this.conn.Open (); + sqlCmd = this.conn.CreateCommand (); + + sqlCmd.CommandText = "SELECT value FROM config WHERE field = '" + field + "';"; + SQLiteDataReader reader = sqlCmd.ExecuteReader (); + if (reader.Read()) + val = reader.GetString(0); + else + val = ""; + this.conn.Close (); + return val; + + } + + public void InsertValue(string field, string val) + { + lock (this) + { + + SQLiteCommand sqlCmd; + + this.conn.Open (); + sqlCmd = this.conn.CreateCommand (); + + sqlCmd.CommandText = "INSERT OR REPLACE INTO config VALUES ('" + field + "', '" + val + "');"; + sqlCmd.ExecuteNonQuery (); + this.conn.Close (); + } + } + + protected void Init () + { + + SQLiteCommand sqlCmd; + this.conn.Open (); + sqlCmd = this.conn.CreateCommand (); + + sqlCmd.CommandText = "SELECT * FROM sqlite_master WHERE type='table';"; + SQLiteDataReader reader = sqlCmd.ExecuteReader (); + + if(!reader.HasRows) + { + this.conn.Close (); + InitialSetup (); + } + else + this.conn.Close (); + + } + + protected void InitialSetup () + { + lock (this) + { + // Dobbiamo creare la struttura del database + SQLiteCommand sqlCmd; + this.conn.Open (); + + // Tabelle delle configurazioni + sqlCmd = this.conn.CreateCommand (); + sqlCmd.CommandText = "CREATE TABLE config (field TEXT PRIMARY KEY, value TEXT);"; + sqlCmd.ExecuteNonQuery (); + + // Tabella della lista + sqlCmd = this.conn.CreateCommand (); + sqlCmd.CommandText = "CREATE TABLE list (path TEXT PRIMARY KEY, user TEXT);"; + sqlCmd.ExecuteNonQuery (); + + this.conn.Close (); + } + } + + protected string DataBaseName () + { + string dir = ""; + if (System.Environment.OSVersion.ToString ().Contains("Windows")) + { + + System.Reflection.Assembly a = System.Reflection.Assembly.GetEntryAssembly (); + dir = System.IO.Path.GetDirectoryName (a.Location); + + } + else // Assumiamo qualcosa di Unix-like + { + dir = System.Environment.GetEnvironmentVariable("HOME"); + dir += System.IO.Path.DirectorySeparatorChar + ".dizzy"; + } + if (!System.IO.Directory.Exists(dir)) + System.IO.Directory.CreateDirectory (dir); + + string db = dir + System.IO.Path.DirectorySeparatorChar + "config.sqlite"; + if (!System.IO.File.Exists (db)) + System.IO.File.Create (db); + return db; + } + } + +} diff --git a/Dizzy/Main.cs b/Dizzy/Main.cs new file mode 100644 index 0000000..a3eec63 --- /dev/null +++ b/Dizzy/Main.cs @@ -0,0 +1,30 @@ +using System; +using Gtk; + +namespace Dizzy +{ + + class MainClass + { + + public static void Main (string[] args) + { + Application.Init (); + + // Inizializziamo la configurazione generale. + // Forse sarebbe il caso di salvarla su file e + // poi passarla per riferimento a tutte le form. + GlobalConfig config = new GlobalConfig (); + + // Cosa vogliamo fare + MainWindow win; + + + win = new MainWindow (ref config); + win.ShowAll (); + + Application.Run (); + + } + } +} diff --git a/Dizzy/MainWindow.cs b/Dizzy/MainWindow.cs new file mode 100644 index 0000000..3bd5b05 --- /dev/null +++ b/Dizzy/MainWindow.cs @@ -0,0 +1,104 @@ +using System; +using Gtk; +using Dizzy; + +public partial class MainWindow : Gtk.Window +{ + + Protocol protocol; + FileTreeView files; + TaskTreeView tasks; + GlobalConfig config; + + bool connected = false; + + public MainWindow (ref GlobalConfig config) : base(Gtk.WindowType.Toplevel) + { + + Build (); + this.config = config; + + // Inizializziamo la vista dei file. + files = new Dizzy.FileTreeView (filelist); + + // .. e anche quella dei download + tasks = new Dizzy.TaskTreeView (tasklist); + + // Carichiamo qualche impostazione di default + string downloadpath = config.GetValue("download_folder"); + if (downloadpath != "") + downloadpathchooser.SetFilename(downloadpath); + + this.Connect (); + } + + protected void Connect () + { + AuthDialog a = new AuthDialog (ref this.config); + this.connected = true; + try { + a.Run (); + a.Destroy (); + this.protocol = new Protocol (ref config); + } catch (Exception ex) { + this.connected = false; + Gtk.MessageDialog d = new Gtk.MessageDialog(this, + DialogFlags.Modal, + MessageType.Error, + ButtonsType.Ok, + true,"Errore di connessione"); + d.Markup = "Errore di autenticazione. Non è stato possibile connettersi" + + "all'host <b>poisson.phc.unipi.it</b>." + + "Errore riportato: " + ex.Message; + d.Run (); + d.Destroy (); + } + } + + + protected void OnDeleteEvent (object sender, DeleteEventArgs a) + { + if (protocol != null) + protocol.Disconnect (); + + Application.Quit (); + + // Questo è molto grezzo ma è effettivamente l'unico metodo per uscire + // per il momento. + this.Destroy (); + a.RetVal = true; + } + + protected virtual void OnSearchRequested (object sender, System.EventArgs e) + { + if(!connected) {this.Connect ();} + if(connected) + { + this.files.SearchInProgress (); + this.protocol.Search(searchBox.Text, ref this.files); + } + } + + protected virtual void OnRowActivated (object o, Gtk.RowActivatedArgs args) + { + Console.WriteLine("row_activated called"); + File f = this.files.GetFileFromPath (args.Path); + + // Piccolo hack per evitare che ci freghino :) + if(f.name == "Ricerca in corso..." && f.user == " ") + return; + // this.tasks.AddTask (f.name, 24); + string download_folder = this.downloadpathchooser.Filename; + + if(!connected) {this.Connect ();} + if(connected) {this.protocol.Download(f, ref tasks, download_folder);} + + } + + protected virtual void OnDownloadPathSelectionChanged (object sender, System.EventArgs e) + { + config.InsertValue("download_folder", downloadpathchooser.Filename); + } + + +} diff --git a/Dizzy/Protocol.cs b/Dizzy/Protocol.cs new file mode 100644 index 0000000..81fe226 --- /dev/null +++ b/Dizzy/Protocol.cs @@ -0,0 +1,331 @@ + +using System; +using System.Collections; +using System.Threading; +using System.Text.RegularExpressions; +using System.IO; +using Tamir.SharpSsh; +using Dizzy; + +namespace Dizzy +{ + + + public class ProtocolException : ApplicationException + { + public ProtocolException () {} + public ProtocolException (string Message) {} + } + + public class Protocol + { + + // I dati del nostro povero utente. + string user, password; + + // I transfer attivi + ArrayList transfers = new ArrayList (); + + public delegate void Del (string src, string dest, + int transferredBytes, int totalBytes, string message); + + + ArrayList threads = new ArrayList (); + + Thread finder; + + public Protocol (ref GlobalConfig config) + { + this.user = config.GetValue("user"); + this.password = config.password; + + // Questa parte di codice in realtà ha il solo scopo + // di verificare che i dati dall'utente siano corretti. + // Per questo motivo dopo esserci connessi ci + // disconnettiamo subito. + SFTPConnection sftpUpdater; + try + { + sftpUpdater = new SFTPConnection(this.user, this.password); + sftpUpdater.Connect (); + sftpUpdater.Disconnect (); + } + catch(Exception e) + { + throw new ProtocolException("Impossibile connettersi a poisson.phc.unipi.it %% " + e.Message); + } + + } + + public void Search(string keyword, ref FileTreeView f) + { + if(this.finder != null && this.finder.IsAlive) + { + Console.WriteLine("Ricerca in corso, tento di interromperla."); + this.finder.Abort (); + } + + FileSearch fs = new FileSearch (this.user, this.password, keyword, ref f); + this.finder = new Thread (new ThreadStart (fs.DoSearch)); + this.finder.Start (); + } + + + public void Disconnect () + { + foreach(FileTransfer t in this.transfers) + { + t.Stop (); + } + foreach(Thread t in this.threads) + { + if(t.IsAlive) + t.Abort (); + } + + if (this.finder != null && this.finder.IsAlive) + { + this.finder.Abort (); + } + } + + + public void Download(File f, ref TaskTreeView tasks, string downloadFolder) + { + // Preparo gli argomento da passare alla funzione. + 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); + } + + protected void _Download(object args) + { + // Questi cast sono piuttosto brutali ma posso passare + // solo un oggetto a Download e quindi è il meglio che + // 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, downloadFolder); + this.transfers.Add (transfer); + } + + } + + public class SFTPConnection + { + + public Sftp sftp; + public delegate void SFTPEvent (string src, string dest, int transferredBytes, + int totalBytes, string message); + + public event SFTPEvent TransferStarted; + public event SFTPEvent TransferProgress; + public event SFTPEvent TransferStopped; + + public delegate void Del (string src, string dest, + int transferredBytes, int totalBytes, string message); + + public SFTPConnection (string user, string password) + { + + // Inizializziamo il protocollo + this.sftp = new Sftp ("poisson.phc.unipi.it", user); + this.sftp.Password = password; + + this.sftp.OnTransferStart += new FileTransferEvent(this.TransferStartedHandler); + this.sftp.OnTransferProgress += new FileTransferEvent(this.TransferProgressHandler); + this.sftp.OnTransferEnd += new FileTransferEvent(this.TransferStoppedHandler); + + } + + private void TransferStartedHandler(string src, string dest, int transferredBytes, + int totalBytes, string message) + { + Console.WriteLine (" => TransferStarted"); + TransferStarted(src, dest, transferredBytes, totalBytes, message); + } + + private void TransferProgressHandler(string src, string dest, int transferredBytes, + int totalBytes, string message) + { + TransferProgress(src, dest, transferredBytes, totalBytes, message); + } + + private void TransferStoppedHandler(string src, string dest, int transferredBytes, + int totalBytes, string message) + { + TransferStopped(src, dest, transferredBytes, totalBytes, message); + } + + public void Connect() + { + sftp.Connect (22); + } + + public ArrayList SearchFiles() + { + ArrayList matches = new ArrayList (); + Console.WriteLine(" => Scan della nobackup"); + // ArrayList users = sftp.GetFileList ("/nobackup/"); + ArrayList users = new ArrayList(); + users.Add("robol"); + users.Add("bianchi"); + foreach(string folder in users) + { + if (folder == ".") + continue; + else if (folder == "..") + continue; + Console.WriteLine(" => Scan di {0}", folder); + try { matches.AddRange (GetFolderContent(folder)); } + catch(Exception e) { Console.WriteLine (e.Message); } + } + Console.WriteLine(" => Scan terminato"); + return matches; + } + + protected ArrayList GetFolderContent(string folder) + { + ArrayList matches, files; + File f; + string user; + files = sftp.GetFileList("/nobackup/" + folder + "/"); + matches = new ArrayList (); + foreach(string entry in files) + { + // Controllo che non sia una cartella. Evidentemente + // questo metodo non è affidabile, ma per ora è il meglio + // che SFTP ci permetta di fare. + if(entry.IndexOf(".") == -1) + matches.AddRange(GetFolderContent(folder + "/" + entry)); + else if(!entry.StartsWith(".")) + { + user = folder; + if(user.Contains("/")) + user = user.Substring(0, user.IndexOf("/")); + f = new File("/nobackup/" + folder + "/" + entry, user ); + matches.Add(f); + } + } + return matches; + } + + public void Download(File f, string downloadFolder) + { + Console.WriteLine (" => Getting {0}", f.name); + // try + // { + Console.WriteLine (f.path); + this.sftp.Get (f.path, downloadFolder + Path.DirectorySeparatorChar + f.name); + // } + /* catch() + { + Console.WriteLine("Error in Get... "); + Console.WriteLine(e.Message); + } */ + } + + public void Disconnect () + { + sftp.Close (); + } + } + + public class FileTransfer + { + + TaskTreeView tasks; + File file; + Gtk.TreeIter iter; + + SFTPConnection sftp; + + 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, string downloadFolder) + { + // Connessione al server + this.sftp = new SFTPConnection (user, password); + this.sftp.Connect (); + + this.tasks = tasks; + this.file = f; + + sftp.TransferStarted += new SFTPConnection.SFTPEvent(OnTransferStarted); + sftp.TransferProgress += new SFTPConnection.SFTPEvent(OnTransferProgress); + sftp.TransferStopped += new SFTPConnection.SFTPEvent(OnTransferStopped); + + Console.WriteLine(" => Starting sftp command"); + sftp.Download (this.file, downloadFolder); + sftp.Disconnect (); + } + + public void Stop () + { + this.sftp.Disconnect (); + } + + public void OnTransferStarted (string src, string dest, int transferredBytes, + int totalBytes, string message) + { + Console.WriteLine(" => TransferStarted received"); + this.iter = this.tasks.AddTask(file.name, 0); + } + + public void OnTransferProgress(string src, string dest, int transferredBytes, + int totalBytes, string message) + { + // if(message != "") + // Console.WriteLine(message); + int perc = transferredBytes / (totalBytes / 100); + this.tasks.SetProgress(this.iter, perc); + } + + public void OnTransferStopped (string src, string dest, int transferredBytes, + int totalBytes, string message) + { + this.tasks.DeleteRow (this.iter); + } + } + + + class FileSearch +{ + SshExec sshexec; + string username, password, keywords; + FileTreeView f; + + public FileSearch (string username, string password, string keywords, ref FileTreeView f) + { + this.username = username; + this.password = password; + this.keywords = keywords; + this.f = f; + } + + public void DoSearch () + { + sshexec = new SshExec("poisson.phc.unipi.it", this.username, this.password); + sshexec.Connect (); + + string command = "locate -i -e --regex /nobackup/.+" + this.keywords; + string output = sshexec.RunCommand (command); + f.Clear (); + foreach(string line in Regex.Split(output, "\n")) + { + if (line.StartsWith("/nobackup/") && Regex.Match(line,".*[.].*").Success) + this.f.AddFile (new File(line, "")); + } + sshexec.Close (); + } + +} + +} \ No newline at end of file diff --git a/Dizzy/TaskTreeView.cs b/Dizzy/TaskTreeView.cs new file mode 100644 index 0000000..cba9ab1 --- /dev/null +++ b/Dizzy/TaskTreeView.cs @@ -0,0 +1,77 @@ +using Gtk; +using System; + +namespace Dizzy +{ + + + public class TaskTreeView + { + + TreeView tree; + + TreeViewColumn fileColumn; + TreeViewColumn progressColumn; + + ListStore tasklist; + + public TaskTreeView (Gtk.TreeView tree) + { + this.tree = tree; + + fileColumn = new TreeViewColumn (); + fileColumn.Title = "File"; + + progressColumn = new TreeViewColumn (); + progressColumn.Title = "Avanzamento"; + + this.tree.AppendColumn (fileColumn); + this.tree.AppendColumn (progressColumn); + + tasklist = new ListStore (typeof(string), + typeof(int)); + + CellSetup (); + this.tree.Model = tasklist; + } + + protected void CellSetup () + { + CellRendererText fileRenderer = new CellRendererText (); + CellRendererProgress progressRenderer = new CellRendererProgress (); + + fileColumn.PackStart (fileRenderer, true); + progressColumn.PackStart (progressRenderer, true); + + fileColumn.AddAttribute (fileRenderer, "text", 0); + progressColumn.AddAttribute (progressRenderer, "value", 1); + } + + + // Ritorna un TreeIter all'elemento aggiunto + public TreeIter AddTask (string name, int progress) + { + lock (this) + { + TreeIter iter = tasklist.AppendValues (name, progress); + return iter; + } + } + + public void SetProgress (TreeIter iter, int progress) + { + lock (this) + { + tasklist.SetValue (iter, 1, progress); + } + } + + public void DeleteRow(TreeIter iter) + { + lock (this) + { + tasklist.Remove(ref iter); + } + } + } +} diff --git a/Dizzy/sqlite3.dll b/Dizzy/sqlite3.dll new file mode 100755 index 0000000..ec15374 Binary files /dev/null and b/Dizzy/sqlite3.dll differ diff --git a/ErrorDialog.cs b/ErrorDialog.cs deleted file mode 100644 index 659b009..0000000 --- a/ErrorDialog.cs +++ /dev/null @@ -1,16 +0,0 @@ - -using System; - -namespace Dizzy -{ - - - public partial class ErrorDialog : Gtk.Dialog - { - - public ErrorDialog () - { - this.Build (); - } - } -} diff --git a/File.cs b/File.cs deleted file mode 100644 index dec97cf..0000000 --- a/File.cs +++ /dev/null @@ -1,73 +0,0 @@ - -using System; - -namespace Dizzy -{ - - - public class FileType { - - int type; - const int UNKNOWN = 0; - const int VIDEO = 1; - const int AUDIO = 2; - const int BOOK = 3; - - public FileType(string filename) { - - if(filename.EndsWith(".avi")) - type = VIDEO; - else if(filename.EndsWith(".pdf")) - type = BOOK; - else if(filename.EndsWith(".mp3")) - type = AUDIO; - else - type = UNKNOWN; - - } - - public string Name() - { - if(type == VIDEO) - return "Video"; - else if(type == BOOK) - return "Book"; - else if(type == AUDIO) - return "Audio"; - else - return "Sconosciuto"; - } - } - - public class File - { - - - public string user; - public string name; - public string path; - public FileType type; - - public File (string path, string user) - { - // Determino il tipo di file - type = new FileType (path); - string [] a; - if (user == "") - { - a = path.Split('/'); - if (a.Length >= 2) - user = a[2]; - } - this.user = user; - this.path = path; - // Console.WriteLine("Path set to: {0}", this.path); - string[] pieces = path.Split ('/'); - - name = pieces[pieces.Length - 1]; - - } - - - } -} diff --git a/FileTreeView.cs b/FileTreeView.cs deleted file mode 100644 index 2ccc614..0000000 --- a/FileTreeView.cs +++ /dev/null @@ -1,92 +0,0 @@ -using Gtk; -using System; - -namespace Dizzy -{ - - - public class FileTreeView - { - - // La treeview passataci dalla grafica - Gtk.TreeView tree; - - // Le colonne che ci servono - Gtk.TreeViewColumn filenameColumn; - Gtk.TreeViewColumn userColumn; - - // La listStore per memorizzare i file - // che troviamo. - Gtk.ListStore fileListStore; - - public FileTreeView (Gtk.TreeView tree) - { - // Costruisco la ListStore e popolo di colonne - // la TreeView - this.tree = tree; - this.filenameColumn = new Gtk.TreeViewColumn (); - filenameColumn.Title = "Nome del file"; - - - this.userColumn = new Gtk.TreeViewColumn (); - userColumn.Title = "Utente"; - - this.tree.AppendColumn (filenameColumn); - this.tree.AppendColumn (userColumn); - - this.fileListStore = new Gtk.ListStore (typeof(string), // Nome del file - typeof(string), // Utente - typeof(string));// Path del file. - - this.tree.Model = fileListStore; - CellSetup (); - - } - - protected void CellSetup() - { - // Filename - Gtk.CellRendererText filenameRenderer = new Gtk.CellRendererText (); - filenameColumn.PackStart (filenameRenderer, true); - filenameColumn.AddAttribute (filenameRenderer, "text", 0); - - // Utente - Gtk.CellRendererText userRenderer = new Gtk.CellRendererText (); - userColumn.PackStart (userRenderer, true); - userColumn.AddAttribute (userRenderer, "text", 1); - } - - public void AddFile(Dizzy.File file) - { - lock (this) { - // Aggiungo i valori effettivi nel liststore. - fileListStore.AppendValues(file.name, - file.user, - file.path); - } - } - - public void Clear () - { - lock (this) { - fileListStore.Clear (); - } - } - - public void SearchInProgress () - { - this.Clear (); - this.AddFile (new File("Ricerca in corso...", "...")); - } - - public File GetFileFromPath (TreePath path) - { - TreeIter iter = new TreeIter (); - fileListStore.GetIter(out iter, path); - File f = new File((string) fileListStore.GetValue(iter, 2), - (string) fileListStore.GetValue(iter, 1)); - return f; - } - - } -} diff --git a/GlobalConfig.cs b/GlobalConfig.cs deleted file mode 100644 index cd88acc..0000000 --- a/GlobalConfig.cs +++ /dev/null @@ -1,124 +0,0 @@ - -using System; -using System.Data.SQLite; - -namespace Dizzy -{ - - - public class GlobalConfig - { - public string password; - private SQLiteConnection conn; - - public GlobalConfig () - { - conn = new SQLiteConnection ("Data Source=" + DataBaseName () + ";"); - // Controlliamo che il database sia correttamente - // inizializzato. - Init (); - } - - public string GetValue(string field) - { - string val; - - SQLiteCommand sqlCmd; - this.conn.Open (); - sqlCmd = this.conn.CreateCommand (); - - sqlCmd.CommandText = "SELECT value FROM config WHERE field = '" + field + "';"; - SQLiteDataReader reader = sqlCmd.ExecuteReader (); - if (reader.Read()) - val = reader.GetString(0); - else - val = ""; - this.conn.Close (); - return val; - - } - - public void InsertValue(string field, string val) - { - lock (this) - { - - SQLiteCommand sqlCmd; - - this.conn.Open (); - sqlCmd = this.conn.CreateCommand (); - - sqlCmd.CommandText = "INSERT OR REPLACE INTO config VALUES ('" + field + "', '" + val + "');"; - sqlCmd.ExecuteNonQuery (); - this.conn.Close (); - } - } - - protected void Init () - { - - SQLiteCommand sqlCmd; - this.conn.Open (); - sqlCmd = this.conn.CreateCommand (); - - sqlCmd.CommandText = "SELECT * FROM sqlite_master WHERE type='table';"; - SQLiteDataReader reader = sqlCmd.ExecuteReader (); - - if(!reader.HasRows) - { - this.conn.Close (); - InitialSetup (); - } - else - this.conn.Close (); - - } - - protected void InitialSetup () - { - lock (this) - { - // Dobbiamo creare la struttura del database - SQLiteCommand sqlCmd; - this.conn.Open (); - - // Tabelle delle configurazioni - sqlCmd = this.conn.CreateCommand (); - sqlCmd.CommandText = "CREATE TABLE config (field TEXT PRIMARY KEY, value TEXT);"; - sqlCmd.ExecuteNonQuery (); - - // Tabella della lista - sqlCmd = this.conn.CreateCommand (); - sqlCmd.CommandText = "CREATE TABLE list (path TEXT PRIMARY KEY, user TEXT);"; - sqlCmd.ExecuteNonQuery (); - - this.conn.Close (); - } - } - - protected string DataBaseName () - { - string dir = ""; - if (System.Environment.OSVersion.ToString ().Contains("Windows")) - { - - System.Reflection.Assembly a = System.Reflection.Assembly.GetEntryAssembly (); - dir = System.IO.Path.GetDirectoryName (a.Location); - - } - else // Assumiamo qualcosa di Unix-like - { - dir = System.Environment.GetEnvironmentVariable("HOME"); - dir += System.IO.Path.DirectorySeparatorChar + ".dizzy"; - } - if (!System.IO.Directory.Exists(dir)) - System.IO.Directory.CreateDirectory (dir); - - string db = dir + System.IO.Path.DirectorySeparatorChar + "config.sqlite"; - if (!System.IO.File.Exists (db)) - System.IO.File.Create (db); - return db; - } - } - -} diff --git a/Main.cs b/Main.cs deleted file mode 100644 index a3eec63..0000000 --- a/Main.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using Gtk; - -namespace Dizzy -{ - - class MainClass - { - - public static void Main (string[] args) - { - Application.Init (); - - // Inizializziamo la configurazione generale. - // Forse sarebbe il caso di salvarla su file e - // poi passarla per riferimento a tutte le form. - GlobalConfig config = new GlobalConfig (); - - // Cosa vogliamo fare - MainWindow win; - - - win = new MainWindow (ref config); - win.ShowAll (); - - Application.Run (); - - } - } -} diff --git a/MainWindow.cs b/MainWindow.cs deleted file mode 100644 index a8044c2..0000000 --- a/MainWindow.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using Gtk; -using Dizzy; - -public partial class MainWindow : Gtk.Window -{ - - Protocol protocol; - FileTreeView files; - TaskTreeView tasks; - GlobalConfig config; - - bool connected = false; - - public MainWindow (ref GlobalConfig config) : base(Gtk.WindowType.Toplevel) - { - - Build (); - this.config = config; - - // Inizializziamo la vista dei file. - files = new Dizzy.FileTreeView (filelist); - - // .. e anche quella dei download - tasks = new Dizzy.TaskTreeView (tasklist); - - // Carichiamo qualche impostazione di default - string downloadpath = config.GetValue("download_folder"); - if (downloadpath != "") - downloadpathchooser.SetFilename(downloadpath); - - this.Connect (); - } - - protected void Connect () - { - AuthDialog a = new AuthDialog (ref this.config); - this.connected = true; - try { - a.Run (); - a.Destroy (); - this.protocol = new Protocol (ref config); - } catch (Exception ex) { - this.connected = false; - Gtk.MessageDialog d = new Gtk.MessageDialog(this, - DialogFlags.Modal, - MessageType.Error, - ButtonsType.Ok, - true,""); - d.Markup = "Errore di autenticazione. Non è stato possibile connettersi" + - "all'host <b>poisson.phc.unipi.it</b>."; - d.Run (); - d.Destroy (); - } - } - - - protected void OnDeleteEvent (object sender, DeleteEventArgs a) - { - protocol.Disconnect (); - Application.Quit (); - - // Questo è molto grezzo ma è effettivamente l'unico metodo per uscire - // per il momento. - this.Destroy (); - a.RetVal = true; - } - - protected virtual void OnSearchRequested (object sender, System.EventArgs e) - { - if(!connected) {this.Connect ();} - if(connected) - { - this.files.SearchInProgress (); - this.protocol.Search(searchBox.Text, ref this.files); - } - } - - protected virtual void OnRowActivated (object o, Gtk.RowActivatedArgs args) - { - Console.WriteLine("row_activated called"); - File f = this.files.GetFileFromPath (args.Path); - // this.tasks.AddTask (f.name, 24); - string download_folder = this.downloadpathchooser.Filename; - - if(!connected) {this.Connect ();} - if(connected) {this.protocol.Download(f, ref tasks, download_folder);} - - } - - protected virtual void OnDownloadPathSelectionChanged (object sender, System.EventArgs e) - { - config.InsertValue("download_folder", downloadpathchooser.Filename); - } - - -} diff --git a/Protocol.cs b/Protocol.cs deleted file mode 100644 index e47c1ee..0000000 --- a/Protocol.cs +++ /dev/null @@ -1,327 +0,0 @@ - -using System; -using System.Collections; -using System.Threading; -using System.Text.RegularExpressions; -using System.IO; -using Tamir.SharpSsh; -using Dizzy; - -namespace Dizzy -{ - - - public class ProtocolException : ApplicationException - { - public ProtocolException () {} - public ProtocolException (string Message) {} - } - - public class Protocol - { - - // I dati del nostro povero utente. - string user, password; - - // I transfer attivi - ArrayList transfers = new ArrayList (); - - public delegate void Del (string src, string dest, - int transferredBytes, int totalBytes, string message); - - - ArrayList threads = new ArrayList (); - - Thread finder; - SFTPConnection sftpUpdater; - - public Protocol (ref GlobalConfig config) - { - this.user = config.GetValue("user"); - this.password = config.password; - - try - { - this.sftpUpdater = new SFTPConnection(this.user, this.password); - this.sftpUpdater.Connect (); - } - catch(Exception e) - { - throw new ProtocolException("Impossibile connettersi a poisson.phc.unipi.it %% " + e.Message); - } - - - } - - public void Search(string keyword, ref FileTreeView f) - { - if(this.finder != null && this.finder.IsAlive) - { - Console.WriteLine("Ricerca in corso, tento di interromperla."); - this.finder.Abort (); - } - - FileSearch fs = new FileSearch (this.user, this.password, keyword, ref f); - this.finder = new Thread (new ThreadStart (fs.DoSearch)); - this.finder.Start (); - } - - - public void Disconnect () - { - foreach(FileTransfer t in this.transfers) - { - t.Stop (); - } - foreach(Thread t in this.threads) - { - if(t.IsAlive) - t.Abort (); - } - - if (this.finder.IsAlive) - { - this.finder.Abort (); - } - } - - - public void Download(File f, ref TaskTreeView tasks, string downloadFolder) - { - // Preparo gli argomento da passare alla funzione. - 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); - } - - protected void _Download(object args) - { - // Questi cast sono piuttosto brutali ma posso passare - // solo un oggetto a Download e quindi è il meglio che - // 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, downloadFolder); - this.transfers.Add (transfer); - } - - } - - public class SFTPConnection - { - - public Sftp sftp; - public delegate void SFTPEvent (string src, string dest, int transferredBytes, - int totalBytes, string message); - - public event SFTPEvent TransferStarted; - public event SFTPEvent TransferProgress; - public event SFTPEvent TransferStopped; - - public delegate void Del (string src, string dest, - int transferredBytes, int totalBytes, string message); - - public SFTPConnection (string user, string password) - { - - // Inizializziamo il protocollo - this.sftp = new Sftp ("poisson.phc.unipi.it", user); - this.sftp.Password = password; - - this.sftp.OnTransferStart += new FileTransferEvent(this.TransferStartedHandler); - this.sftp.OnTransferProgress += new FileTransferEvent(this.TransferProgressHandler); - this.sftp.OnTransferEnd += new FileTransferEvent(this.TransferStoppedHandler); - - } - - private void TransferStartedHandler(string src, string dest, int transferredBytes, - int totalBytes, string message) - { - Console.WriteLine (" => TransferStarted"); - TransferStarted(src, dest, transferredBytes, totalBytes, message); - } - - private void TransferProgressHandler(string src, string dest, int transferredBytes, - int totalBytes, string message) - { - TransferProgress(src, dest, transferredBytes, totalBytes, message); - } - - private void TransferStoppedHandler(string src, string dest, int transferredBytes, - int totalBytes, string message) - { - TransferStopped(src, dest, transferredBytes, totalBytes, message); - } - - public void Connect() - { - sftp.Connect (22); - } - - public ArrayList SearchFiles() - { - ArrayList matches = new ArrayList (); - Console.WriteLine(" => Scan della nobackup"); - // ArrayList users = sftp.GetFileList ("/nobackup/"); - ArrayList users = new ArrayList(); - users.Add("robol"); - users.Add("bianchi"); - foreach(string folder in users) - { - if (folder == ".") - continue; - else if (folder == "..") - continue; - Console.WriteLine(" => Scan di {0}", folder); - try { matches.AddRange (GetFolderContent(folder)); } - catch(Exception e) { Console.WriteLine (e.Message); } - } - Console.WriteLine(" => Scan terminato"); - return matches; - } - - protected ArrayList GetFolderContent(string folder) - { - ArrayList matches, files; - File f; - string user; - files = sftp.GetFileList("/nobackup/" + folder + "/"); - matches = new ArrayList (); - foreach(string entry in files) - { - // Controllo che non sia una cartella. Evidentemente - // questo metodo non è affidabile, ma per ora è il meglio - // che SFTP ci permetta di fare. - if(entry.IndexOf(".") == -1) - matches.AddRange(GetFolderContent(folder + "/" + entry)); - else if(!entry.StartsWith(".")) - { - user = folder; - if(user.Contains("/")) - user = user.Substring(0, user.IndexOf("/")); - f = new File("/nobackup/" + folder + "/" + entry, user ); - matches.Add(f); - } - } - return matches; - } - - public void Download(File f, string downloadFolder) - { - Console.WriteLine (" => Getting {0}", f.name); - // try - // { - Console.WriteLine (f.path); - this.sftp.Get (f.path, downloadFolder + Path.DirectorySeparatorChar + f.name); - // } - /* catch() - { - Console.WriteLine("Error in Get... "); - Console.WriteLine(e.Message); - } */ - } - - public void Disconnect () - { - sftp.Close (); - } - } - - public class FileTransfer - { - - TaskTreeView tasks; - File file; - Gtk.TreeIter iter; - - SFTPConnection sftp; - - 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, string downloadFolder) - { - // Connessione al server - this.sftp = new SFTPConnection (user, password); - this.sftp.Connect (); - - this.tasks = tasks; - this.file = f; - - sftp.TransferStarted += new SFTPConnection.SFTPEvent(OnTransferStarted); - sftp.TransferProgress += new SFTPConnection.SFTPEvent(OnTransferProgress); - sftp.TransferStopped += new SFTPConnection.SFTPEvent(OnTransferStopped); - - Console.WriteLine(" => Starting sftp command"); - sftp.Download (this.file, downloadFolder); - sftp.Disconnect (); - } - - public void Stop () - { - this.sftp.Disconnect (); - } - - public void OnTransferStarted (string src, string dest, int transferredBytes, - int totalBytes, string message) - { - Console.WriteLine(" => TransferStarted received"); - this.iter = this.tasks.AddTask(file.name, 0); - } - - public void OnTransferProgress(string src, string dest, int transferredBytes, - int totalBytes, string message) - { - // if(message != "") - // Console.WriteLine(message); - int perc = transferredBytes / (totalBytes / 100); - this.tasks.SetProgress(this.iter, perc); - } - - public void OnTransferStopped (string src, string dest, int transferredBytes, - int totalBytes, string message) - { - this.tasks.DeleteRow (this.iter); - } - } - - - class FileSearch -{ - SshExec sshexec; - string username, password, keywords; - FileTreeView f; - - public FileSearch (string username, string password, string keywords, ref FileTreeView f) - { - this.username = username; - this.password = password; - this.keywords = keywords; - this.f = f; - } - - public void DoSearch () - { - sshexec = new SshExec("poisson.phc.unipi.it", this.username, this.password); - sshexec.Connect (); - - string command = "locate -i -e --regex /nobackup/.+" + this.keywords; - string output = sshexec.RunCommand (command); - f.Clear (); - foreach(string line in Regex.Split(output, "\n")) - { - if (line.StartsWith("/nobackup/") && Regex.Match(line,".*[.].*").Success) - this.f.AddFile (new File(line, "")); - } - sshexec.Close (); - } - -} - -} \ No newline at end of file diff --git a/StartupDialog.cs b/StartupDialog.cs deleted file mode 100644 index 7cf5334..0000000 --- a/StartupDialog.cs +++ /dev/null @@ -1,36 +0,0 @@ - -using System; -using Dizzy; - -namespace Dizzy -{ - - - public partial class StartupDialog : Gtk.Dialog - { - - GlobalConfig config; - - protected virtual void OnOkClicked (object sender, System.EventArgs e) - { - config.InsertValue("user", entryUser.Text); - config.password = entryPassword.Text; - message.Text = "Connessione in corso..."; - } - - public StartupDialog (ref GlobalConfig config) - { - this.Build (); - this.config = config; - - this.entryUser.Text = config.GetValue("user"); - - // Dobbiamo fare in modo di ottenere utente e password dall' - // utente e poi caricare la finestra principale connettendoci - // al server - entryPassword.Visibility = false; - entryPassword.ActivatesDefault = true; - - } - } -} diff --git a/TaskTreeView.cs b/TaskTreeView.cs deleted file mode 100644 index cba9ab1..0000000 --- a/TaskTreeView.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Gtk; -using System; - -namespace Dizzy -{ - - - public class TaskTreeView - { - - TreeView tree; - - TreeViewColumn fileColumn; - TreeViewColumn progressColumn; - - ListStore tasklist; - - public TaskTreeView (Gtk.TreeView tree) - { - this.tree = tree; - - fileColumn = new TreeViewColumn (); - fileColumn.Title = "File"; - - progressColumn = new TreeViewColumn (); - progressColumn.Title = "Avanzamento"; - - this.tree.AppendColumn (fileColumn); - this.tree.AppendColumn (progressColumn); - - tasklist = new ListStore (typeof(string), - typeof(int)); - - CellSetup (); - this.tree.Model = tasklist; - } - - protected void CellSetup () - { - CellRendererText fileRenderer = new CellRendererText (); - CellRendererProgress progressRenderer = new CellRendererProgress (); - - fileColumn.PackStart (fileRenderer, true); - progressColumn.PackStart (progressRenderer, true); - - fileColumn.AddAttribute (fileRenderer, "text", 0); - progressColumn.AddAttribute (progressRenderer, "value", 1); - } - - - // Ritorna un TreeIter all'elemento aggiunto - public TreeIter AddTask (string name, int progress) - { - lock (this) - { - TreeIter iter = tasklist.AppendValues (name, progress); - return iter; - } - } - - public void SetProgress (TreeIter iter, int progress) - { - lock (this) - { - tasklist.SetValue (iter, 1, progress); - } - } - - public void DeleteRow(TreeIter iter) - { - lock (this) - { - tasklist.Remove(ref iter); - } - } - } -} diff --git a/app.desktop b/app.desktop deleted file mode 100644 index 0de0d07..0000000 --- a/app.desktop +++ /dev/null @@ -1,6 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=Application -Name=Dizzy -Exec=dizzy -Terminal=false diff --git a/gtk-gui/Dizzy.AuthDialog.cs b/gtk-gui/Dizzy.AuthDialog.cs index bc194ee..6695d49 100644 --- a/gtk-gui/Dizzy.AuthDialog.cs +++ b/gtk-gui/Dizzy.AuthDialog.cs @@ -46,6 +46,7 @@ namespace Dizzy { this.vbox2 = new Gtk.VBox(); this.vbox2.Name = "vbox2"; this.vbox2.Spacing = 6; + this.vbox2.BorderWidth = ((uint)(5)); // Container child vbox2.Gtk.Box+BoxChild this.label3 = new Gtk.Label(); this.label3.Name = "label3"; diff --git a/gtk-gui/MainWindow.cs b/gtk-gui/MainWindow.cs index 3b765e4..d5a996d 100644 --- a/gtk-gui/MainWindow.cs +++ b/gtk-gui/MainWindow.cs @@ -55,6 +55,7 @@ public partial class MainWindow { // Widget MainWindow this.Name = "MainWindow"; this.Title = Mono.Unix.Catalog.GetString("Dizzy PreRelease"); + this.Icon = Stetic.IconLoader.LoadIcon(this, "stock_connect", Gtk.IconSize.Menu, 16); this.WindowPosition = ((Gtk.WindowPosition)(4)); this.DefaultWidth = 640; this.DefaultHeight = 480; diff --git a/gtk-gui/gui.stetic b/gtk-gui/gui.stetic index 8113689..c48bd32 100644 --- a/gtk-gui/gui.stetic +++ b/gtk-gui/gui.stetic @@ -11,6 +11,7 @@ <widget class="Gtk.Window" id="MainWindow" design-size="474 300"> <property name="MemberName" /> <property name="Title" translatable="yes">Dizzy PreRelease</property> + <property name="Icon">stock:stock_connect Menu</property> <property name="WindowPosition">CenterOnParent</property> <property name="DefaultWidth">640</property> <property name="DefaultHeight">480</property> @@ -238,6 +239,7 @@ <widget class="Gtk.VBox" id="vbox2"> <property name="MemberName" /> <property name="Spacing">6</property> + <property name="BorderWidth">5</property> <child> <widget class="Gtk.Label" id="label3"> <property name="MemberName" /> diff --git a/sqlite3.dll b/sqlite3.dll deleted file mode 100755 index ec15374..0000000 Binary files a/sqlite3.dll and /dev/null differ