From 0c4fb6d4f945e3d5d204392fe4fd02c9bca1cb69 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Wed, 16 Mar 2011 00:01:20 +0000 Subject: [PATCH] [linux] Keep setup dialog in memory --- SparkleShare/SparkleIntro.cs | 49 +++++++------------------------ SparkleShare/SparkleStatusIcon.cs | 14 +++++++-- SparkleShare/SparkleUI.cs | 5 ++-- SparkleShare/SparkleWindow.cs | 22 +++++++++++--- 4 files changed, 44 insertions(+), 46 deletions(-) diff --git a/SparkleShare/SparkleIntro.cs b/SparkleShare/SparkleIntro.cs index d5e47a69..b5dfcc90 100644 --- a/SparkleShare/SparkleIntro.cs +++ b/SparkleShare/SparkleIntro.cs @@ -61,7 +61,7 @@ namespace SparkleShare { VBox layout_vertical = new VBox (false, 0); - DeleteEvent += PreventClose; + Deletable = false; Label header = new Label ("" + _("Welcome to SparkleShare!") + @@ -131,7 +131,7 @@ namespace SparkleShare { SparkleShare.Controller.FirstRun = false; - DeleteEvent += PreventClose; + Deletable = false; ShowServerForm (); }; @@ -152,16 +152,6 @@ namespace SparkleShare { } - private void PreventClose (object o, DeleteEventArgs args) - { - - // Cancel closing when the "Close" - // button of the window is pressed - args.RetVal = true; - - } - - public void ShowServerForm (bool server_form_only) { @@ -364,13 +354,13 @@ namespace SparkleShare { string canonical_name = System.IO.Path.GetFileNameWithoutExtension (name); - DeleteEvent += PreventClose; + Deletable = false; ShowSyncingPage (canonical_name); SparkleShare.Controller.FolderFetched += delegate { - DeleteEvent -= PreventClose; + Deletable = true; Application.Invoke (delegate { ShowSuccessPage (name); @@ -380,7 +370,7 @@ namespace SparkleShare { SparkleShare.Controller.FolderFetchError += delegate { - DeleteEvent -= PreventClose; + Deletable = true; Application.Invoke (delegate { ShowErrorPage (); }); @@ -397,7 +387,7 @@ namespace SparkleShare { Button cancel_button = new Button (_("Cancel")); cancel_button.Clicked += delegate { - Destroy (); + Close (); }; AddButton (cancel_button); @@ -485,9 +475,7 @@ namespace SparkleShare { Button accept_button = new Button (_("Accept and Sync")); reject_button.Clicked += delegate { - - Destroy (); - + Close (); }; accept_button.Clicked += delegate { @@ -599,7 +587,7 @@ namespace SparkleShare { Button finish_button = new Button (_("Finish")); finish_button.Clicked += delegate (object o, EventArgs args) { - Destroy (); + Close (); }; AddButton (open_folder_button); @@ -644,7 +632,7 @@ namespace SparkleShare { }; button.Clicked += delegate { - Destroy (); + Close (); }; AddButton (button); @@ -658,28 +646,13 @@ namespace SparkleShare { HBox box = new HBox (false, 0); - table.Attach (spinner, 0, 1, 0, 1); + table.Attach (spinner, 0, 1, 0, 1); table.Attach (header, 1, 2, 0, 1); table.Attach (information, 1, 2, 1, 2); box.PackStart (table, false, false, 0); - ProgressBar progress_bar = new ProgressBar () { - - }; - - Timer timer = new Timer () { - Interval = 100 - }; - - timer.Elapsed += delegate { - progress_bar.Pulse (); - }; - layout_vertical.PackStart (box, false, false, 0); - layout_vertical.PackStart (progress_bar, true, false, 0); - - timer.Start (); Add (layout_vertical); @@ -725,7 +698,7 @@ namespace SparkleShare { Button finish_button = new Button (_("Finish")); finish_button.Clicked += delegate (object o, EventArgs args) { - Destroy (); + Close (); }; AddButton (finish_button); diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 12934e88..6be3d2cb 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -203,8 +203,18 @@ namespace SparkleShare { sync_item.Activated += delegate { Application.Invoke (delegate { - SparkleIntro intro = new SparkleIntro (); - intro.ShowServerForm (true); + if (SparkleUI.Intro == null) { + + SparkleUI.Intro = new SparkleIntro (); + SparkleUI.Intro.ShowServerForm (true); + + } + + if (!SparkleUI.Intro.Visible) + SparkleUI.Intro.ShowServerForm (true); + + SparkleUI.Intro.ShowAll (); + SparkleUI.Intro.Present (); }); }; diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index 5a13cc93..1d672b11 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -34,6 +34,7 @@ namespace SparkleShare { public static SparkleStatusIcon StatusIcon; public static List OpenLogs; + public static SparkleIntro Intro; // Short alias for the translations @@ -57,8 +58,8 @@ namespace SparkleShare { if (SparkleShare.Controller.FirstRun) { - SparkleIntro intro = new SparkleIntro (); - intro.ShowAccountForm (); + Intro = new SparkleIntro (); + Intro.ShowAccountForm (); } diff --git a/SparkleShare/SparkleWindow.cs b/SparkleShare/SparkleWindow.cs index 32ebf35a..743c9a10 100644 --- a/SparkleShare/SparkleWindow.cs +++ b/SparkleShare/SparkleWindow.cs @@ -39,10 +39,17 @@ namespace SparkleShare { BorderWidth = 0; IconName = "folder-sparkleshare"; - Resizable = true; - WindowPosition = WindowPosition.Center; + Resizable = false; + WindowPosition = WindowPosition.Center; // FIXME: seems to have broken - SetDefaultSize (640, 425); + SetSizeRequest (680, 440); + + DeleteEvent += delegate (object o, DeleteEventArgs args) { + + args.RetVal = true; + Close (); + + }; HBox = new HBox (false, 6); @@ -71,7 +78,7 @@ namespace SparkleShare { box.Add (side_splash); - HBox.PackStart (box, true, true, 0); + HBox.PackStart (box, false, false, 0); HBox.PackStart (VBox, true, true, 0); base.Add (HBox); @@ -130,6 +137,13 @@ namespace SparkleShare { } + public void Close () + { + + HideAll (); + + } + } }