From 2d7a1c902c22690957cdf93cd3da09fb9dcf8faa Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Tue, 26 Oct 2010 11:45:57 +0100 Subject: [PATCH] [intro] don't let the user close the window while syncing --- SparkleShare/SparkleIntro.cs | 22 +++++++++++++++++++--- SparkleShare/SparkleStatusIcon.cs | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/SparkleShare/SparkleIntro.cs b/SparkleShare/SparkleIntro.cs index 06ed7a47..3ea02fcb 100644 --- a/SparkleShare/SparkleIntro.cs +++ b/SparkleShare/SparkleIntro.cs @@ -142,6 +142,16 @@ namespace SparkleShare { } + private void PreventClose (object o, DeleteEventArgs e) + { + + // Cancel closing when the "Close" + // button of the window is pressed + e.RetVal = true; + + } + + public void ShowServerForm (bool server_form_only) { @@ -155,7 +165,7 @@ namespace SparkleShare { { Reset (); - + VBox layout_vertical = new VBox (false, 0); Label header = new Label ("" + @@ -270,7 +280,7 @@ namespace SparkleShare { FolderEntry.Changed += CheckServerForm; - Label folder_label = new Label ("" + _("Remote Folder Name:") + "") { + Label folder_label = new Label ("" + _("Folder Name:") + "") { UseMarkup = true, Xalign = 1 }; @@ -483,7 +493,7 @@ namespace SparkleShare { { Reset (); - + VBox layout_vertical = new VBox (false, 0); Label header = new Label ("" + @@ -623,6 +633,8 @@ namespace SparkleShare { fetcher.CloningStarted += delegate { + DeleteEvent += PreventClose; + SparkleHelpers.DebugInfo ("Git", "[" + canonical_name + "] Cloning Repository"); }; @@ -630,6 +642,8 @@ namespace SparkleShare { fetcher.CloningFinished += delegate { + DeleteEvent -= PreventClose; + SparkleHelpers.DebugInfo ("Git", "[" + canonical_name + "] Repository cloned"); SparkleHelpers.ClearAttributes (tmp_folder); @@ -654,6 +668,8 @@ namespace SparkleShare { fetcher.CloningFailed += delegate { + DeleteEvent -= PreventClose; + SparkleHelpers.DebugInfo ("Git", "[" + canonical_name + "] Cloning failed"); if (Directory.Exists (tmp_folder)) { diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 073dcf11..33cfd984 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -202,7 +202,7 @@ namespace SparkleShare { Application.Invoke (delegate { SparkleIntro intro = new SparkleIntro (); - intro.ShowServerForm (); + intro.ShowServerForm (true); }); };