From 10e5dd11fa58d05cc00b6fa84bd37b4de3eb5270 Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Sat, 6 Feb 2010 18:51:52 +0100 Subject: [PATCH] Migliorata la gestione della connessione e aggiunta ricerca in tutta la nobackup tramite locate. --- Dizzy.csproj | 4 +- FileTreeView.cs | 15 ++-- Main.cs | 24 ++---- MainWindow.cs | 3 + gtk-gui/Dizzy.StartupDialog.cs | 169 ----------------------------------------- gtk-gui/MainWindow.cs | 2 +- gtk-gui/generated.cs | 33 ++++++++ gtk-gui/gui.stetic | 84 +++++++++----------- 8 files changed, 93 insertions(+), 241 deletions(-) delete mode 100644 gtk-gui/Dizzy.StartupDialog.cs diff --git a/Dizzy.csproj b/Dizzy.csproj index 992c18f..275a330 100644 --- a/Dizzy.csproj +++ b/Dizzy.csproj @@ -88,9 +88,9 @@ - - + + diff --git a/FileTreeView.cs b/FileTreeView.cs index 3b505ab..2ccc614 100644 --- a/FileTreeView.cs +++ b/FileTreeView.cs @@ -58,19 +58,24 @@ namespace Dizzy public void AddFile(Dizzy.File file) { - // Aggiungo i valori effettivi nel liststore. - fileListStore.AppendValues(file.name, - file.user, - file.path); + lock (this) { + // Aggiungo i valori effettivi nel liststore. + fileListStore.AppendValues(file.name, + file.user, + file.path); + } } public void Clear () { - fileListStore.Clear (); + lock (this) { + fileListStore.Clear (); + } } public void SearchInProgress () { + this.Clear (); this.AddFile (new File("Ricerca in corso...", "...")); } diff --git a/Main.cs b/Main.cs index 591b8d6..a3eec63 100644 --- a/Main.cs +++ b/Main.cs @@ -18,25 +18,13 @@ namespace Dizzy // Cosa vogliamo fare MainWindow win; - StartupDialog s; - s = new StartupDialog (ref config); - s.Run (); - - try - { - win = new MainWindow (ref config); - win.ShowAll (); - s.Destroy (); - Application.Run (); - - } - catch(Exception e) - { - Console.WriteLine(" => Problemi di autenticazione...non riprovo"); - Console.WriteLine(e.Message); - } - + + win = new MainWindow (ref config); + win.ShowAll (); + + Application.Run (); + } } } diff --git a/MainWindow.cs b/MainWindow.cs index c2ceda4..a8044c2 100644 --- a/MainWindow.cs +++ b/MainWindow.cs @@ -34,8 +34,11 @@ public partial class MainWindow : Gtk.Window 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; diff --git a/gtk-gui/Dizzy.StartupDialog.cs b/gtk-gui/Dizzy.StartupDialog.cs deleted file mode 100644 index 65a9bf3..0000000 --- a/gtk-gui/Dizzy.StartupDialog.cs +++ /dev/null @@ -1,169 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -namespace Dizzy { - - - public partial class StartupDialog { - - private Gtk.VBox vbox2; - - private Gtk.Label message; - - private Gtk.HSeparator hseparator1; - - private Gtk.Table table1; - - private Gtk.Entry entryPassword; - - private Gtk.Entry entryUser; - - private Gtk.Label label4; - - private Gtk.Label label5; - - private Gtk.Button buttonCancel; - - private Gtk.Button buttonOk; - - protected virtual void Build() { - Stetic.Gui.Initialize(this); - // Widget Dizzy.StartupDialog - this.Name = "Dizzy.StartupDialog"; - this.Title = Mono.Unix.Catalog.GetString("DIzzy Login"); - this.WindowPosition = ((Gtk.WindowPosition)(4)); - // Internal child Dizzy.StartupDialog.VBox - Gtk.VBox w1 = this.VBox; - w1.Name = "dialog1_VBox"; - w1.Spacing = 5; - w1.BorderWidth = ((uint)(5)); - // Container child dialog1_VBox.Gtk.Box+BoxChild - this.vbox2 = new Gtk.VBox(); - this.vbox2.Name = "vbox2"; - this.vbox2.Spacing = 6; - // Container child vbox2.Gtk.Box+BoxChild - this.message = new Gtk.Label(); - this.message.Name = "message"; - this.message.LabelProp = Mono.Unix.Catalog.GetString("Inserire nome utente e password per autenticarsi su poisson.phc.unipi.it"); - this.message.UseMarkup = true; - this.vbox2.Add(this.message); - Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.vbox2[this.message])); - w2.Position = 0; - w2.Expand = false; - w2.Fill = false; - // Container child vbox2.Gtk.Box+BoxChild - this.hseparator1 = new Gtk.HSeparator(); - this.hseparator1.Name = "hseparator1"; - this.vbox2.Add(this.hseparator1); - Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox2[this.hseparator1])); - w3.Position = 1; - w3.Expand = false; - w3.Fill = false; - // Container child vbox2.Gtk.Box+BoxChild - this.table1 = new Gtk.Table(((uint)(2)), ((uint)(2)), 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.entryPassword = new Gtk.Entry(); - this.entryPassword.CanDefault = true; - this.entryPassword.CanFocus = true; - this.entryPassword.Name = "entryPassword"; - this.entryPassword.IsEditable = true; - this.entryPassword.InvisibleChar = '•'; - this.table1.Add(this.entryPassword); - Gtk.Table.TableChild w4 = ((Gtk.Table.TableChild)(this.table1[this.entryPassword])); - w4.TopAttach = ((uint)(1)); - w4.BottomAttach = ((uint)(2)); - w4.LeftAttach = ((uint)(1)); - w4.RightAttach = ((uint)(2)); - w4.YOptions = ((Gtk.AttachOptions)(4)); - // Container child table1.Gtk.Table+TableChild - this.entryUser = new Gtk.Entry(); - this.entryUser.Name = "entryUser"; - this.entryUser.IsEditable = true; - this.entryUser.InvisibleChar = '•'; - this.table1.Add(this.entryUser); - Gtk.Table.TableChild w5 = ((Gtk.Table.TableChild)(this.table1[this.entryUser])); - w5.LeftAttach = ((uint)(1)); - w5.RightAttach = ((uint)(2)); - w5.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("Utente"); - this.table1.Add(this.label4); - Gtk.Table.TableChild w6 = ((Gtk.Table.TableChild)(this.table1[this.label4])); - w6.XOptions = ((Gtk.AttachOptions)(4)); - w6.YOptions = ((Gtk.AttachOptions)(4)); - // Container child table1.Gtk.Table+TableChild - this.label5 = new Gtk.Label(); - this.label5.Name = "label5"; - this.label5.LabelProp = Mono.Unix.Catalog.GetString("Password"); - this.table1.Add(this.label5); - Gtk.Table.TableChild w7 = ((Gtk.Table.TableChild)(this.table1[this.label5])); - w7.TopAttach = ((uint)(1)); - w7.BottomAttach = ((uint)(2)); - w7.XOptions = ((Gtk.AttachOptions)(4)); - w7.YOptions = ((Gtk.AttachOptions)(4)); - this.vbox2.Add(this.table1); - Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.vbox2[this.table1])); - w8.Position = 2; - w8.Expand = false; - w8.Fill = false; - w1.Add(this.vbox2); - Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(w1[this.vbox2])); - w9.Position = 0; - w9.Expand = false; - w9.Fill = false; - // Internal child Dizzy.StartupDialog.ActionArea - Gtk.HButtonBox w10 = this.ActionArea; - w10.Name = "dialog1_ActionArea"; - w10.Spacing = 10; - w10.BorderWidth = ((uint)(5)); - w10.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); - // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild - this.buttonCancel = new Gtk.Button(); - this.buttonCancel.CanDefault = true; - this.buttonCancel.CanFocus = true; - this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.UseStock = true; - this.buttonCancel.UseUnderline = true; - this.buttonCancel.Label = "gtk-cancel"; - this.AddActionWidget(this.buttonCancel, -6); - Gtk.ButtonBox.ButtonBoxChild w11 = ((Gtk.ButtonBox.ButtonBoxChild)(w10[this.buttonCancel])); - w11.Expand = false; - w11.Fill = false; - // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild - this.buttonOk = new Gtk.Button(); - this.buttonOk.CanDefault = true; - this.buttonOk.CanFocus = true; - this.buttonOk.Name = "buttonOk"; - this.buttonOk.UseStock = true; - this.buttonOk.UseUnderline = true; - this.buttonOk.Label = "gtk-ok"; - this.AddActionWidget(this.buttonOk, -5); - Gtk.ButtonBox.ButtonBoxChild w12 = ((Gtk.ButtonBox.ButtonBoxChild)(w10[this.buttonOk])); - w12.Position = 1; - w12.Expand = false; - w12.Fill = false; - if ((this.Child != null)) { - this.Child.ShowAll(); - } - this.DefaultWidth = 508; - this.DefaultHeight = 178; - this.buttonOk.HasDefault = true; - this.Show(); - this.buttonOk.Activated += new System.EventHandler(this.OnOkClicked); - this.buttonOk.Clicked += new System.EventHandler(this.OnOkClicked); - } - } -} diff --git a/gtk-gui/MainWindow.cs b/gtk-gui/MainWindow.cs index 55b5af9..3b765e4 100644 --- a/gtk-gui/MainWindow.cs +++ b/gtk-gui/MainWindow.cs @@ -66,7 +66,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 (c) Leonardo Robol "); + this.label5.LabelProp = Mono.Unix.Catalog.GetString("Dizzy ti ricorda di scaricare responsabilmente! ;)"); this.vbox1.Add(this.label5); Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox1[this.label5])); w1.Position = 0; diff --git a/gtk-gui/generated.cs b/gtk-gui/generated.cs index 8b467a5..4c84fb1 100644 --- a/gtk-gui/generated.cs +++ b/gtk-gui/generated.cs @@ -22,6 +22,39 @@ namespace Stetic { } } + internal class IconLoader { + + public static Gdk.Pixbuf LoadIcon(Gtk.Widget widget, string name, Gtk.IconSize size, int sz) { + Gdk.Pixbuf res = widget.RenderIcon(name, size, null); + if ((res != null)) { + return res; + } + else { + try { + return Gtk.IconTheme.Default.LoadIcon(name, sz, 0); + } + catch (System.Exception ) { + if ((name != "gtk-missing-image")) { + return Stetic.IconLoader.LoadIcon(widget, "gtk-missing-image", size, sz); + } + else { + Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, sz, sz); + Gdk.GC gc = new Gdk.GC(pmap); + gc.RgbFgColor = new Gdk.Color(255, 255, 255); + pmap.DrawRectangle(gc, true, 0, 0, sz, sz); + gc.RgbFgColor = new Gdk.Color(0, 0, 0); + pmap.DrawRectangle(gc, false, 0, 0, (sz - 1), (sz - 1)); + gc.SetLineAttributes(3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round); + gc.RgbFgColor = new Gdk.Color(255, 0, 0); + pmap.DrawLine(gc, (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)), ((sz - 1) - (sz / 4))); + pmap.DrawLine(gc, ((sz - 1) - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1) - (sz / 4))); + return Gdk.Pixbuf.FromDrawable(pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz); + } + } + } + } + } + internal class ActionGroups { public static Gtk.ActionGroup GetActionGroup(System.Type type) { diff --git a/gtk-gui/gui.stetic b/gtk-gui/gui.stetic index 088b0ab..8113689 100644 --- a/gtk-gui/gui.stetic +++ b/gtk-gui/gui.stetic @@ -23,7 +23,7 @@ - Dizzy (c) Leonardo Robol <leo@robol.it> + Dizzy ti ricorda di scaricare responsabilmente! ;) 0 @@ -223,25 +223,25 @@ - + - DIzzy Login + Autenticazione + stock:gtk-dialog-authentication Menu CenterOnParent 2 False - 5 - 5 + 2 6 - + - Inserire nome utente e password per autenticarsi su <b>poisson.phc.unipi.it</b> + Autenticazione su <b>poisson.phc.unipi.it</b>: True @@ -252,40 +252,22 @@ - - - - - 1 - True - False - False - - - 2 2 6 6 - 5 - + - True - True - True - + Username - 1 - 2 - 1 - 2 True + Fill Fill - True + False True False False @@ -294,17 +276,17 @@ - + - True - + Password - 1 - 2 + 1 + 2 True + Fill Fill - True + False True False False @@ -313,15 +295,23 @@ - + - Utente + True + True + True + False + + + 1 + 2 + 1 + 2 True - Fill Fill - False + True True False False @@ -330,17 +320,19 @@ - + - Password + True + True + True + - 1 - 2 + 1 + 2 True - Fill Fill - False + True True False False @@ -350,7 +342,7 @@ - 2 + 1 True False False -- 2.1.4