diff --git a/Dizzy.csproj b/Dizzy.csproj index 27b5734..18bcfa5 100644 --- a/Dizzy.csproj +++ b/Dizzy.csproj @@ -77,7 +77,7 @@ <EmbeddedResource Include="gtk-gui\gui.stetic"> <LogicalName>gui.stetic</LogicalName> </EmbeddedResource> - <EmbeddedResource Include="Libraries\sqlite3.dll"> + <EmbeddedResource Include="Dizzy\sqlite3.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </EmbeddedResource> </ItemGroup> diff --git a/Dizzy.make b/Dizzy.make index 608a9f5..c96fca0 100644 --- a/Dizzy.make +++ b/Dizzy.make @@ -16,11 +16,11 @@ COMPILE_TARGET = exe PROJECT_REFERENCES = BUILD_DIR = bin/Debug -SQLITE3_DLL_SOURCE=Libraries/sqlite3.dll +SQLITE3_DLL_SOURCE=Dizzy/sqlite3.dll +TAMIR_SHARPSSH_DLL_SOURCE=Libraries/Tamir.SharpSSH.dll DIFFIEHELLMAN_DLL_SOURCE=Libraries/DiffieHellman.dll ORG_MENTALIS_SECURITY_DLL_SOURCE=Libraries/Org.Mentalis.Security.dll SYSTEM_DATA_SQLITE_DLL_SOURCE=Libraries/System.Data.SQLite.dll -TAMIR_SHARPSSH_DLL_SOURCE=Libraries/Tamir.SharpSSH.dll DIZZY_EXE_MDB_SOURCE=bin/Debug/Dizzy.exe.mdb DIZZY_EXE_MDB=$(BUILD_DIR)/Dizzy.exe.mdb @@ -35,11 +35,11 @@ COMPILE_TARGET = exe PROJECT_REFERENCES = BUILD_DIR = bin/Release -SQLITE3_DLL_SOURCE=Libraries/sqlite3.dll +SQLITE3_DLL_SOURCE=Dizzy/sqlite3.dll +TAMIR_SHARPSSH_DLL_SOURCE=Libraries/Tamir.SharpSSH.dll DIFFIEHELLMAN_DLL_SOURCE=Libraries/DiffieHellman.dll ORG_MENTALIS_SECURITY_DLL_SOURCE=Libraries/Org.Mentalis.Security.dll SYSTEM_DATA_SQLITE_DLL_SOURCE=Libraries/System.Data.SQLite.dll -TAMIR_SHARPSSH_DLL_SOURCE=Libraries/Tamir.SharpSSH.dll DIZZY_EXE_MDB= endif @@ -47,14 +47,14 @@ endif AL=al2 SATELLITE_ASSEMBLY_NAME=$(notdir $(basename $(ASSEMBLY))).resources.dll -PROGRAMFILES_LIBRARIES = \ +PROGRAMFILES_DIZZY = \ $(SQLITE3_DLL) PROGRAMFILES = \ + $(TAMIR_SHARPSSH_DLL) \ $(DIFFIEHELLMAN_DLL) \ $(ORG_MENTALIS_SECURITY_DLL) \ $(SYSTEM_DATA_SQLITE_DLL) \ - $(TAMIR_SHARPSSH_DLL) \ $(DIZZY_EXE_MDB) BINARIES = \ @@ -63,11 +63,11 @@ BINARIES = \ RESGEN=resgen2 -SQLITE3_DLL = $(BUILD_DIR)/Libraries/sqlite3.dll +SQLITE3_DLL = $(BUILD_DIR)/Dizzy/sqlite3.dll +TAMIR_SHARPSSH_DLL = $(BUILD_DIR)/Tamir.SharpSSH.dll DIFFIEHELLMAN_DLL = $(BUILD_DIR)/DiffieHellman.dll ORG_MENTALIS_SECURITY_DLL = $(BUILD_DIR)/Org.Mentalis.Security.dll SYSTEM_DATA_SQLITE_DLL = $(BUILD_DIR)/System.Data.SQLite.dll -TAMIR_SHARPSSH_DLL = $(BUILD_DIR)/Tamir.SharpSSH.dll DIZZY = $(BUILD_DIR)/dizzy FILES = \ @@ -88,10 +88,12 @@ DATA_FILES = RESOURCES = \ gtk-gui/gui.stetic \ - Libraries/sqlite3.dll,Dizzy.Libraries.sqlite3.dll + Dizzy/sqlite3.dll,Dizzy.Dizzy.sqlite3.dll EXTRAS = \ Dizzy/app.desktop \ + Dizzy \ + Libraries \ dizzy.in REFERENCES = \ @@ -102,23 +104,23 @@ REFERENCES = \ Mono.Posix DLL_REFERENCES = \ - Libraries/DiffieHellman.dll \ + Libraries/Tamir.SharpSSH.dll \ Libraries/Org.Mentalis.Security.dll \ - Libraries/System.Data.SQLite.dll \ - Libraries/Tamir.SharpSSH.dll + Libraries/DiffieHellman.dll \ + Libraries/System.Data.SQLite.dll -CLEANFILES = $(PROGRAMFILES_LIBRARIES) $(PROGRAMFILES) $(BINARIES) +CLEANFILES = $(PROGRAMFILES_DIZZY) $(PROGRAMFILES) $(BINARIES) #Targets -all-local: $(ASSEMBLY) $(PROGRAMFILES_LIBRARIES) $(PROGRAMFILES) $(BINARIES) $(top_srcdir)/config.make +all-local: $(ASSEMBLY) $(PROGRAMFILES_DIZZY) $(PROGRAMFILES) $(BINARIES) $(top_srcdir)/config.make $(eval $(call emit-deploy-target,SQLITE3_DLL)) +$(eval $(call emit-deploy-target,TAMIR_SHARPSSH_DLL)) $(eval $(call emit-deploy-target,DIFFIEHELLMAN_DLL)) $(eval $(call emit-deploy-target,ORG_MENTALIS_SECURITY_DLL)) $(eval $(call emit-deploy-target,SYSTEM_DATA_SQLITE_DLL)) -$(eval $(call emit-deploy-target,TAMIR_SHARPSSH_DLL)) $(eval $(call emit-deploy-wrapper,DIZZY,dizzy,x)) @@ -142,12 +144,12 @@ install-local: $(ASSEMBLY) $(ASSEMBLY_MDB) mkdir -p '$(DESTDIR)$(libdir)/$(PACKAGE)' $(call cp,$(ASSEMBLY),$(DESTDIR)$(libdir)/$(PACKAGE)) $(call cp,$(ASSEMBLY_MDB),$(DESTDIR)$(libdir)/$(PACKAGE)) - mkdir -p '$(DESTDIR)$(libdir)/$(PACKAGE)/Libraries' - $(call cp,$(SQLITE3_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)/Libraries) + mkdir -p '$(DESTDIR)$(libdir)/$(PACKAGE)/Dizzy' + $(call cp,$(SQLITE3_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)/Dizzy) + $(call cp,$(TAMIR_SHARPSSH_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)) $(call cp,$(DIFFIEHELLMAN_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)) $(call cp,$(ORG_MENTALIS_SECURITY_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)) $(call cp,$(SYSTEM_DATA_SQLITE_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)) - $(call cp,$(TAMIR_SHARPSSH_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)) $(call cp,$(DIZZY_EXE_MDB),$(DESTDIR)$(libdir)/$(PACKAGE)) mkdir -p '$(DESTDIR)$(bindir)' $(call cp,$(DIZZY),$(DESTDIR)$(bindir)) @@ -158,11 +160,11 @@ uninstall-local: $(ASSEMBLY) $(ASSEMBLY_MDB) make uninstall-satellite-assemblies prefix=$(prefix) $(call rm,$(ASSEMBLY),$(DESTDIR)$(libdir)/$(PACKAGE)) $(call rm,$(ASSEMBLY_MDB),$(DESTDIR)$(libdir)/$(PACKAGE)) - $(call rm,$(SQLITE3_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)/Libraries) + $(call rm,$(SQLITE3_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)/Dizzy) + $(call rm,$(TAMIR_SHARPSSH_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)) $(call rm,$(DIFFIEHELLMAN_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)) $(call rm,$(ORG_MENTALIS_SECURITY_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)) $(call rm,$(SYSTEM_DATA_SQLITE_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)) - $(call rm,$(TAMIR_SHARPSSH_DLL),$(DESTDIR)$(libdir)/$(PACKAGE)) $(call rm,$(DIZZY_EXE_MDB),$(DESTDIR)$(libdir)/$(PACKAGE)) $(call rm,$(DIZZY),$(DESTDIR)$(bindir)) make post-uninstall-local-hook prefix=$(prefix) diff --git a/Dizzy/AuthDialog.cs b/Dizzy/AuthDialog.cs index 0885129..074bfb2 100644 --- a/Dizzy/AuthDialog.cs +++ b/Dizzy/AuthDialog.cs @@ -13,6 +13,7 @@ namespace Dizzy { this.config.password = passwordEntry.Text; this.config.InsertValue("user", userEntry.Text); + this.config.authenticated = true; } public AuthDialog (ref GlobalConfig config) diff --git a/Dizzy/GlobalConfig.cs b/Dizzy/GlobalConfig.cs index 382a01e..408cfb3 100644 --- a/Dizzy/GlobalConfig.cs +++ b/Dizzy/GlobalConfig.cs @@ -9,6 +9,7 @@ namespace Dizzy public class GlobalConfig { public string password; + public bool authenticated = false; private SQLiteConnection conn; public GlobalConfig () @@ -21,21 +22,22 @@ namespace Dizzy 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; - + lock (this) { + 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) @@ -96,7 +98,7 @@ namespace Dizzy } } - protected string DataBaseName () + public string ConfigDir () { string dir = ""; if (System.Environment.OSVersion.ToString ().Contains("Windows")) @@ -113,8 +115,12 @@ namespace Dizzy } if (!System.IO.Directory.Exists(dir)) System.IO.Directory.CreateDirectory (dir); - - string db = dir + System.IO.Path.DirectorySeparatorChar + "config.sqlite"; + return dir; + } + + protected string DataBaseName () + { + string db = this.ConfigDir () + System.IO.Path.DirectorySeparatorChar + "config.sqlite"; if (!System.IO.File.Exists (db)) System.IO.File.Create (db); return db; diff --git a/Dizzy/MainWindow.cs b/Dizzy/MainWindow.cs index 3bd5b05..09fd9de 100644 --- a/Dizzy/MainWindow.cs +++ b/Dizzy/MainWindow.cs @@ -29,30 +29,31 @@ public partial class MainWindow : Gtk.Window if (downloadpath != "") downloadpathchooser.SetFilename(downloadpath); - this.Connect (); + this.protocol = new Protocol (ref this.config); + + this.protocol.AuthenticationRequired += this.Connect; + this.protocol.AuthenticationFailed += this.OnAuthenticationFailed; } 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 (); - } + a.Run (); + a.Destroy (); + + } + + protected void OnAuthenticationFailed () { + + 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>."; + d.Run (); + d.Destroy (); } @@ -71,8 +72,9 @@ public partial class MainWindow : Gtk.Window protected virtual void OnSearchRequested (object sender, System.EventArgs e) { - if(!connected) {this.Connect ();} - if(connected) + if(!this.config.authenticated) {this.Connect ();} + + if(this.config.authenticated) { this.files.SearchInProgress (); this.protocol.Search(searchBox.Text, ref this.files); diff --git a/Dizzy/Protocol.cs b/Dizzy/Protocol.cs index 81fe226..e0c774d 100644 --- a/Dizzy/Protocol.cs +++ b/Dizzy/Protocol.cs @@ -32,28 +32,22 @@ namespace Dizzy ArrayList threads = new ArrayList (); - Thread finder; + Thread finder, listUpdater; + + GlobalConfig config; + + public delegate void ProtocolEvent (); + public event ProtocolEvent AuthenticationRequired; + public event ProtocolEvent AuthenticationFailed; public Protocol (ref GlobalConfig config) { this.user = config.GetValue("user"); this.password = config.password; + this.config = config; - // 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); - } + this.UpdateFileList (); + } @@ -70,6 +64,70 @@ namespace Dizzy this.finder.Start (); } + public void UpdateFileList () + { + if(this.listUpdater != null && this.listUpdater.IsAlive) + { + Console.WriteLine (" => Lista in fase di aggiornamento"); + return; + } + + this.listUpdater = new Thread( new ThreadStart (this._UpdateFileList)); + this.listUpdater.Start (); + } + + + + protected void _UpdateFileList () + { + SFTPConnection s; + + if (!this.config.authenticated) + { + Console.WriteLine ("Requesting authentication..."); + this.AuthenticationRequired (); + + // Aspetto che l'utente abbia fatto. + while(!this.config.authenticated) {} + Console.WriteLine ("Ok, ora siamo autenticati"); + } + + try { + s = new SFTPConnection (this.config.GetValue("user"), + this.config.password); + s.Connect (); + } + catch (Exception e) { + Console.WriteLine ("mmm... {0}", e.Message); + this.config.authenticated = false; + this.AuthenticationRequired (); + + while(!this.config.authenticated) {} + + s = new SFTPConnection(this.config.GetValue("user"), + this.config.password); + try {s.Connect ();} + catch (Exception ex) { + Console.WriteLine (" => mm.. {0}", ex.Message); + this.config.authenticated = false; + } + + // A questo punto ci rinunciamo + if(!this.config.authenticated) + { + this.AuthenticationFailed (); + return; + } + } + + + Console.WriteLine (" => Aggiorno la lista"); + s.Connect (); + s.Download (new File("/nobackup/robol/index.db", "robol"), + this.config.ConfigDir ()); + Console.WriteLine (" => Lista aggiornata"); + } + public void Disconnect () { @@ -148,19 +206,23 @@ namespace Dizzy int totalBytes, string message) { Console.WriteLine (" => TransferStarted"); - TransferStarted(src, dest, transferredBytes, totalBytes, message); + + if(TransferStarted != null) + 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); + if (TransferProgress != null) + 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); + if (TransferStopped != null) + TransferStopped(src, dest, transferredBytes, totalBytes, message); } public void Connect() diff --git a/Libraries/sqlite3.dll b/Libraries/sqlite3.dll deleted file mode 100755 index ec15374..0000000 Binary files a/Libraries/sqlite3.dll and /dev/null differ diff --git a/Makefile b/Makefile index 5ca117a..c18ffa8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -EXTRA_DIST = Dizzy.make rules.make configure Makefile.include Libraries/DiffieHellman.dll Libraries/Org.Mentalis.Security.dll Libraries/System.Data.SQLite.dll Libraries/Tamir.SharpSSH.dll +EXTRA_DIST = Dizzy.make rules.make configure Makefile.include Libraries/Tamir.SharpSSH.dll Libraries/Org.Mentalis.Security.dll Libraries/DiffieHellman.dll Libraries/System.Data.SQLite.dll all: all-recursive diff --git a/Makefile.include b/Makefile.include index b7f6166..26a6545 100644 --- a/Makefile.include +++ b/Makefile.include @@ -65,10 +65,10 @@ DISTCLEANFILES = $(GENERATED_FILES) $(pc_files) $(BUILD_DIR)/* pkglib_SCRIPTS = $(ASSEMBLY) bin_SCRIPTS = $(BINARIES) +programfilesdizzydir = @libdir@/@PACKAGE@/Dizzy +programfilesdizzy_DATA = $(PROGRAMFILES_DIZZY) programfilesdir = @libdir@/@PACKAGE@ programfiles_DATA = $(PROGRAMFILES) -programfileslibrariesdir = @libdir@/@PACKAGE@/Libraries -programfileslibraries_DATA = $(PROGRAMFILES_LIBRARIES) # macros diff --git a/gtk-gui/MainWindow.cs b/gtk-gui/MainWindow.cs index d5a996d..ad7c9f3 100644 --- a/gtk-gui/MainWindow.cs +++ b/gtk-gui/MainWindow.cs @@ -20,13 +20,19 @@ public partial class MainWindow { private Gtk.VBox vbox3; - private Gtk.HBox hbox1; + private Gtk.Table table1; + + private Gtk.Button button1; private Gtk.Label label4; + private Gtk.Label label6; + private Gtk.Entry searchBox; - private Gtk.Button button1; + private Gtk.Entry searchUserBox; + + private Gtk.ComboBox typeBox; private Gtk.ScrolledWindow GtkScrolledWindow; @@ -67,7 +73,7 @@ public partial class MainWindow { // Container child vbox1.Gtk.Box+BoxChild this.label5 = new Gtk.Label(); this.label5.Name = "label5"; - this.label5.LabelProp = Mono.Unix.Catalog.GetString("Dizzy ti ricorda di scaricare responsabilmente! ;)"); + this.label5.LabelProp = Mono.Unix.Catalog.GetString("Ricordati di selezionare la cartella per il download prima di iniziarne uno."); this.vbox1.Add(this.label5); Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox1[this.label5])); w1.Position = 0; @@ -77,50 +83,92 @@ public partial class MainWindow { this.notebook1 = new Gtk.Notebook(); this.notebook1.CanFocus = true; this.notebook1.Name = "notebook1"; - this.notebook1.CurrentPage = 1; + this.notebook1.CurrentPage = 0; // Container child notebook1.Gtk.Notebook+NotebookChild this.vbox3 = new Gtk.VBox(); this.vbox3.Name = "vbox3"; this.vbox3.Spacing = 6; // Container child vbox3.Gtk.Box+BoxChild - this.hbox1 = new Gtk.HBox(); - this.hbox1.Name = "hbox1"; - this.hbox1.Spacing = 6; - this.hbox1.BorderWidth = ((uint)(4)); - // Container child hbox1.Gtk.Box+BoxChild + this.table1 = new Gtk.Table(((uint)(2)), ((uint)(3)), false); + this.table1.Name = "table1"; + this.table1.RowSpacing = ((uint)(6)); + this.table1.ColumnSpacing = ((uint)(6)); + this.table1.BorderWidth = ((uint)(5)); + // Container child table1.Gtk.Table+TableChild + this.button1 = new Gtk.Button(); + this.button1.CanFocus = true; + this.button1.Name = "button1"; + this.button1.UseUnderline = true; + this.button1.Label = Mono.Unix.Catalog.GetString("Cerca"); + this.table1.Add(this.button1); + Gtk.Table.TableChild w2 = ((Gtk.Table.TableChild)(this.table1[this.button1])); + w2.TopAttach = ((uint)(1)); + w2.BottomAttach = ((uint)(2)); + w2.LeftAttach = ((uint)(2)); + w2.RightAttach = ((uint)(3)); + w2.XOptions = ((Gtk.AttachOptions)(4)); + w2.YOptions = ((Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild this.label4 = new Gtk.Label(); this.label4.Name = "label4"; - this.label4.LabelProp = Mono.Unix.Catalog.GetString("Parole chiave"); - this.hbox1.Add(this.label4); - Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.label4])); - w2.Position = 0; - w2.Expand = false; - w2.Fill = false; - // Container child hbox1.Gtk.Box+BoxChild + this.label4.LabelProp = Mono.Unix.Catalog.GetString("Parola chiave"); + this.table1.Add(this.label4); + Gtk.Table.TableChild w3 = ((Gtk.Table.TableChild)(this.table1[this.label4])); + w3.XOptions = ((Gtk.AttachOptions)(4)); + w3.YOptions = ((Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild + this.label6 = new Gtk.Label(); + this.label6.Name = "label6"; + this.label6.LabelProp = Mono.Unix.Catalog.GetString("Utente"); + this.table1.Add(this.label6); + Gtk.Table.TableChild w4 = ((Gtk.Table.TableChild)(this.table1[this.label6])); + w4.TopAttach = ((uint)(1)); + w4.BottomAttach = ((uint)(2)); + w4.XOptions = ((Gtk.AttachOptions)(4)); + w4.YOptions = ((Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild this.searchBox = new Gtk.Entry(); this.searchBox.CanFocus = true; this.searchBox.Name = "searchBox"; this.searchBox.IsEditable = true; this.searchBox.InvisibleChar = '•'; - this.hbox1.Add(this.searchBox); - Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox1[this.searchBox])); - w3.Position = 1; - // Container child hbox1.Gtk.Box+BoxChild - this.button1 = new Gtk.Button(); - this.button1.CanFocus = true; - this.button1.Name = "button1"; - this.button1.UseUnderline = true; - this.button1.Label = Mono.Unix.Catalog.GetString("Cerca"); - this.hbox1.Add(this.button1); - Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.hbox1[this.button1])); - w4.Position = 2; - w4.Expand = false; - w4.Fill = false; - this.vbox3.Add(this.hbox1); - Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox1])); - w5.Position = 0; - w5.Expand = false; - w5.Fill = false; + this.table1.Add(this.searchBox); + Gtk.Table.TableChild w5 = ((Gtk.Table.TableChild)(this.table1[this.searchBox])); + w5.LeftAttach = ((uint)(1)); + w5.RightAttach = ((uint)(2)); + w5.YOptions = ((Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild + this.searchUserBox = new Gtk.Entry(); + this.searchUserBox.CanFocus = true; + this.searchUserBox.Name = "searchUserBox"; + this.searchUserBox.IsEditable = true; + this.searchUserBox.InvisibleChar = '•'; + this.table1.Add(this.searchUserBox); + Gtk.Table.TableChild w6 = ((Gtk.Table.TableChild)(this.table1[this.searchUserBox])); + w6.TopAttach = ((uint)(1)); + w6.BottomAttach = ((uint)(2)); + w6.LeftAttach = ((uint)(1)); + w6.RightAttach = ((uint)(2)); + w6.YOptions = ((Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild + this.typeBox = Gtk.ComboBox.NewText(); + this.typeBox.AppendText(Mono.Unix.Catalog.GetString("Qualsias")); + this.typeBox.AppendText(Mono.Unix.Catalog.GetString("Audio")); + this.typeBox.AppendText(Mono.Unix.Catalog.GetString("Video")); + this.typeBox.AppendText(Mono.Unix.Catalog.GetString("Libro")); + this.typeBox.Name = "typeBox"; + this.typeBox.Active = 0; + this.table1.Add(this.typeBox); + Gtk.Table.TableChild w7 = ((Gtk.Table.TableChild)(this.table1[this.typeBox])); + w7.LeftAttach = ((uint)(2)); + w7.RightAttach = ((uint)(3)); + w7.XOptions = ((Gtk.AttachOptions)(4)); + w7.YOptions = ((Gtk.AttachOptions)(4)); + this.vbox3.Add(this.table1); + Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.vbox3[this.table1])); + w8.Position = 0; + w8.Expand = false; + w8.Fill = false; // Container child vbox3.Gtk.Box+BoxChild this.GtkScrolledWindow = new Gtk.ScrolledWindow(); this.GtkScrolledWindow.Name = "GtkScrolledWindow"; @@ -131,8 +179,8 @@ public partial class MainWindow { this.filelist.Name = "filelist"; this.GtkScrolledWindow.Add(this.filelist); this.vbox3.Add(this.GtkScrolledWindow); - Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox3[this.GtkScrolledWindow])); - w7.Position = 1; + Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox3[this.GtkScrolledWindow])); + w10.Position = 1; this.notebook1.Add(this.vbox3); // Notebook tab this.label1 = new Gtk.Label(); @@ -154,8 +202,8 @@ public partial class MainWindow { this.tasklist.Name = "tasklist"; this.GtkScrolledWindow1.Add(this.tasklist); this.vbox2.Add(this.GtkScrolledWindow1); - Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox2[this.GtkScrolledWindow1])); - w10.Position = 0; + Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(this.vbox2[this.GtkScrolledWindow1])); + w13.Position = 0; // Container child vbox2.Gtk.Box+BoxChild this.hbox2 = new Gtk.HBox(); this.hbox2.Name = "hbox2"; @@ -166,24 +214,24 @@ public partial class MainWindow { this.label2.Name = "label2"; this.label2.LabelProp = Mono.Unix.Catalog.GetString("Scarica in"); this.hbox2.Add(this.label2); - Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.hbox2[this.label2])); - w11.Position = 0; - w11.Expand = false; - w11.Fill = false; + Gtk.Box.BoxChild w14 = ((Gtk.Box.BoxChild)(this.hbox2[this.label2])); + w14.Position = 0; + w14.Expand = false; + w14.Fill = false; // Container child hbox2.Gtk.Box+BoxChild this.downloadpathchooser = new Gtk.FileChooserButton(Mono.Unix.Catalog.GetString("Seleziona una cartella"), ((Gtk.FileChooserAction)(2))); this.downloadpathchooser.Name = "downloadpathchooser"; this.hbox2.Add(this.downloadpathchooser); - Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.hbox2[this.downloadpathchooser])); - w12.Position = 1; + Gtk.Box.BoxChild w15 = ((Gtk.Box.BoxChild)(this.hbox2[this.downloadpathchooser])); + w15.Position = 1; this.vbox2.Add(this.hbox2); - Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(this.vbox2[this.hbox2])); - w13.Position = 1; - w13.Expand = false; - w13.Fill = false; + Gtk.Box.BoxChild w16 = ((Gtk.Box.BoxChild)(this.vbox2[this.hbox2])); + w16.Position = 1; + w16.Expand = false; + w16.Fill = false; this.notebook1.Add(this.vbox2); - Gtk.Notebook.NotebookChild w14 = ((Gtk.Notebook.NotebookChild)(this.notebook1[this.vbox2])); - w14.Position = 1; + Gtk.Notebook.NotebookChild w17 = ((Gtk.Notebook.NotebookChild)(this.notebook1[this.vbox2])); + w17.Position = 1; // Notebook tab this.label3 = new Gtk.Label(); this.label3.Name = "label3"; @@ -191,24 +239,23 @@ public partial class MainWindow { this.notebook1.SetTabLabel(this.vbox2, this.label3); this.label3.ShowAll(); this.vbox1.Add(this.notebook1); - Gtk.Box.BoxChild w15 = ((Gtk.Box.BoxChild)(this.vbox1[this.notebook1])); - w15.Position = 1; + Gtk.Box.BoxChild w18 = ((Gtk.Box.BoxChild)(this.vbox1[this.notebook1])); + w18.Position = 1; // Container child vbox1.Gtk.Box+BoxChild this.statusbar2 = new Gtk.Statusbar(); this.statusbar2.Name = "statusbar2"; this.statusbar2.Spacing = 6; this.vbox1.Add(this.statusbar2); - Gtk.Box.BoxChild w16 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar2])); - w16.Position = 2; - w16.Expand = false; - w16.Fill = false; + Gtk.Box.BoxChild w19 = ((Gtk.Box.BoxChild)(this.vbox1[this.statusbar2])); + w19.Position = 2; + w19.Expand = false; + w19.Fill = false; this.Add(this.vbox1); if ((this.Child != null)) { this.Child.ShowAll(); } this.Show(); this.DeleteEvent += new Gtk.DeleteEventHandler(this.OnDeleteEvent); - this.searchBox.Activated += new System.EventHandler(this.OnSearchRequested); this.button1.Clicked += new System.EventHandler(this.OnSearchRequested); this.filelist.RowActivated += new Gtk.RowActivatedHandler(this.OnRowActivated); this.downloadpathchooser.SelectionChanged += new System.EventHandler(this.OnDownloadPathSelectionChanged); diff --git a/gtk-gui/gui.stetic b/gtk-gui/gui.stetic index c48bd32..85d0e7c 100644 --- a/gtk-gui/gui.stetic +++ b/gtk-gui/gui.stetic @@ -24,7 +24,7 @@ <child> <widget class="Gtk.Label" id="label5"> <property name="MemberName" /> - <property name="LabelProp" translatable="yes">Dizzy ti ricorda di scaricare responsabilmente! ;)</property> + <property name="LabelProp" translatable="yes">Ricordati di selezionare la cartella per il download prima di iniziarne uno.</property> </widget> <packing> <property name="Position">0</property> @@ -37,26 +37,78 @@ <widget class="Gtk.Notebook" id="notebook1"> <property name="MemberName" /> <property name="CanFocus">True</property> - <property name="CurrentPage">1</property> + <property name="CurrentPage">0</property> <child> <widget class="Gtk.VBox" id="vbox3"> <property name="MemberName" /> <property name="Spacing">6</property> <child> - <widget class="Gtk.HBox" id="hbox1"> + <widget class="Gtk.Table" id="table1"> <property name="MemberName" /> - <property name="Spacing">6</property> - <property name="BorderWidth">4</property> + <property name="NRows">2</property> + <property name="NColumns">3</property> + <property name="RowSpacing">6</property> + <property name="ColumnSpacing">6</property> + <property name="BorderWidth">5</property> + <child> + <widget class="Gtk.Button" id="button1"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="Type">TextOnly</property> + <property name="Label" translatable="yes">Cerca</property> + <property name="UseUnderline">True</property> + <signal name="Clicked" handler="OnSearchRequested" /> + </widget> + <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> + <property name="LeftAttach">2</property> + <property name="RightAttach">3</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> <child> <widget class="Gtk.Label" id="label4"> <property name="MemberName" /> - <property name="LabelProp" translatable="yes">Parole chiave</property> + <property name="LabelProp" translatable="yes">Parola chiave</property> </widget> <packing> - <property name="Position">0</property> <property name="AutoSize">True</property> - <property name="Expand">False</property> - <property name="Fill">False</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Label" id="label6"> + <property name="MemberName" /> + <property name="LabelProp" translatable="yes">Utente</property> + </widget> + <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> </packing> </child> <child> @@ -65,27 +117,64 @@ <property name="CanFocus">True</property> <property name="IsEditable">True</property> <property name="InvisibleChar">•</property> - <signal name="Activated" handler="OnSearchRequested" /> </widget> <packing> - <property name="Position">1</property> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> <property name="AutoSize">True</property> + <property name="YOptions">Fill</property> + <property name="XExpand">True</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> </packing> </child> <child> - <widget class="Gtk.Button" id="button1"> + <widget class="Gtk.Entry" id="searchUserBox"> <property name="MemberName" /> <property name="CanFocus">True</property> - <property name="Type">TextOnly</property> - <property name="Label" translatable="yes">Cerca</property> - <property name="UseUnderline">True</property> - <signal name="Clicked" handler="OnSearchRequested" /> + <property name="IsEditable">True</property> + <property name="InvisibleChar">•</property> </widget> <packing> - <property name="Position">2</property> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> <property name="AutoSize">True</property> - <property name="Expand">False</property> - <property name="Fill">False</property> + <property name="YOptions">Fill</property> + <property name="XExpand">True</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.ComboBox" id="typeBox"> + <property name="MemberName" /> + <property name="IsTextCombo">True</property> + <property name="Items" translatable="yes">Qualsias +Audio +Video +Libro</property> + <property name="Active">0</property> + </widget> + <packing> + <property name="LeftAttach">2</property> + <property name="RightAttach">3</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> </packing> </child> </widget>