diff --git a/Dizzy.csproj b/Dizzy.csproj
index 992c18f..275a330 100644
--- a/Dizzy.csproj
+++ b/Dizzy.csproj
@@ -88,9 +88,9 @@
<Compile Include="FileTreeView.cs" />
<Compile Include="TaskTreeView.cs" />
<Compile Include="Protocol.cs" />
- <Compile Include="StartupDialog.cs" />
- <Compile Include="gtk-gui\Dizzy.StartupDialog.cs" />
<Compile Include="GlobalConfig.cs" />
+ <Compile Include="AuthDialog.cs" />
+ <Compile Include="gtk-gui\Dizzy.AuthDialog.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="app.desktop">
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 @@
-// ------------------------------------------------------------------------------
-// <autogenerated>
-// This code was generated by a tool.
-//
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </autogenerated>
-// ------------------------------------------------------------------------------
-
-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 <b>poisson.phc.unipi.it</b>");
- 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 <leo@robol.it>");
+ 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 @@
<child>
<widget class="Gtk.Label" id="label5">
<property name="MemberName" />
- <property name="LabelProp" translatable="yes">Dizzy (c) Leonardo Robol <leo@robol.it></property>
+ <property name="LabelProp" translatable="yes">Dizzy ti ricorda di scaricare responsabilmente! ;)</property>
</widget>
<packing>
<property name="Position">0</property>
@@ -223,25 +223,25 @@
</widget>
</child>
</widget>
- <widget class="Gtk.Dialog" id="Dizzy.StartupDialog" design-size="508 178">
+ <widget class="Gtk.Dialog" id="Dizzy.AuthDialog" design-size="400 154">
<property name="MemberName" />
- <property name="Title" translatable="yes">DIzzy Login</property>
+ <property name="Title" translatable="yes">Autenticazione</property>
+ <property name="Icon">stock:gtk-dialog-authentication Menu</property>
<property name="WindowPosition">CenterOnParent</property>
<property name="Buttons">2</property>
<property name="HelpButton">False</property>
<child internal-child="VBox">
<widget class="Gtk.VBox" id="dialog1_VBox">
<property name="MemberName" />
- <property name="Spacing">5</property>
- <property name="BorderWidth">5</property>
+ <property name="BorderWidth">2</property>
<child>
<widget class="Gtk.VBox" id="vbox2">
<property name="MemberName" />
<property name="Spacing">6</property>
<child>
- <widget class="Gtk.Label" id="message">
+ <widget class="Gtk.Label" id="label3">
<property name="MemberName" />
- <property name="LabelProp" translatable="yes">Inserire nome utente e password per autenticarsi su <b>poisson.phc.unipi.it</b></property>
+ <property name="LabelProp" translatable="yes">Autenticazione su <b>poisson.phc.unipi.it</b>:</property>
<property name="UseMarkup">True</property>
</widget>
<packing>
@@ -252,40 +252,22 @@
</packing>
</child>
<child>
- <widget class="Gtk.HSeparator" id="hseparator1">
- <property name="MemberName" />
- </widget>
- <packing>
- <property name="Position">1</property>
- <property name="AutoSize">True</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
- </child>
- <child>
<widget class="Gtk.Table" id="table1">
<property name="MemberName" />
<property name="NRows">2</property>
<property name="NColumns">2</property>
<property name="RowSpacing">6</property>
<property name="ColumnSpacing">6</property>
- <property name="BorderWidth">5</property>
<child>
- <widget class="Gtk.Entry" id="entryPassword">
+ <widget class="Gtk.Label" id="label1">
<property name="MemberName" />
- <property name="CanDefault">True</property>
- <property name="CanFocus">True</property>
- <property name="IsEditable">True</property>
- <property name="InvisibleChar">•</property>
+ <property name="LabelProp" translatable="yes">Username</property>
</widget>
<packing>
- <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="XOptions">Fill</property>
<property name="YOptions">Fill</property>
- <property name="XExpand">True</property>
+ <property name="XExpand">False</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
@@ -294,17 +276,17 @@
</packing>
</child>
<child>
- <widget class="Gtk.Entry" id="entryUser">
+ <widget class="Gtk.Label" id="label2">
<property name="MemberName" />
- <property name="IsEditable">True</property>
- <property name="InvisibleChar">•</property>
+ <property name="LabelProp" translatable="yes">Password</property>
</widget>
<packing>
- <property name="LeftAttach">1</property>
- <property name="RightAttach">2</property>
+ <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">True</property>
+ <property name="XExpand">False</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
@@ -313,15 +295,23 @@
</packing>
</child>
<child>
- <widget class="Gtk.Label" id="label4">
+ <widget class="Gtk.Entry" id="passwordEntry">
<property name="MemberName" />
- <property name="LabelProp" translatable="yes">Utente</property>
+ <property name="CanDefault">True</property>
+ <property name="CanFocus">True</property>
+ <property name="IsEditable">True</property>
+ <property name="Visibility">False</property>
+ <property name="InvisibleChar">•</property>
+ <signal name="Activated" handler="OnOkClicked" />
</widget>
<packing>
+ <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="XOptions">Fill</property>
<property name="YOptions">Fill</property>
- <property name="XExpand">False</property>
+ <property name="XExpand">True</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
@@ -330,17 +320,19 @@
</packing>
</child>
<child>
- <widget class="Gtk.Label" id="label5">
+ <widget class="Gtk.Entry" id="userEntry">
<property name="MemberName" />
- <property name="LabelProp" translatable="yes">Password</property>
+ <property name="CanDefault">True</property>
+ <property name="CanFocus">True</property>
+ <property name="IsEditable">True</property>
+ <property name="InvisibleChar">•</property>
</widget>
<packing>
- <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="XOptions">Fill</property>
<property name="YOptions">Fill</property>
- <property name="XExpand">False</property>
+ <property name="XExpand">True</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
@@ -350,7 +342,7 @@
</child>
</widget>
<packing>
- <property name="Position">2</property>
+ <property name="Position">1</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>