From 1e8e6b8363d25d4bbe53fa8dcd4a8c5f891c418b Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 12 Feb 2012 16:22:08 +0100 Subject: [PATCH 01/53] controller: remove old methods --- SparkleShare/SparkleControllerBase.cs | 28 --------------------------- 1 file changed, 28 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index f0bd3e05..c8ece6b6 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -699,34 +699,6 @@ namespace SparkleShare { } - public string GetSize (string folder_name) - { - double folder_size = 0; - /* TODO - foreach (SparkleRepoBase repo in - Repositories.GetRange (0, Repositories.Count)) { - - folder_size += repo.Size + repo.HistorySize; - } - */ - return FormatSize (folder_size); - } - - - public string GetHistorySize (string folder_name) - { - double folder_size = 0; - /* TODO - foreach (SparkleRepoBase repo in - Repositories.GetRange (0, Repositories.Count)) { - - folder_size += repo.Size + repo.HistorySize; - } - */ - return FormatSize (folder_size); - } - - // Format a file size nicely with small caps. // Example: 1048576 becomes "1 ᴍʙ" public string FormatSize (double byte_count) From 77add3df112a7b5399ad58ff6657561135a828b5 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 12 Feb 2012 22:25:20 +0100 Subject: [PATCH 02/53] Refactor the invite system, warn if cloning's taking place already --- SparkleLib/SparkleFetcherBase.cs | 5 + SparkleShare/SparkleBubblesController.cs | 6 +- SparkleShare/SparkleControllerBase.cs | 45 +++--- SparkleShare/SparkleInvite.cs | 192 +++++------------------ SparkleShare/SparkleSetupController.cs | 44 ++++++ 5 files changed, 110 insertions(+), 182 deletions(-) diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index ec01fba5..b1ee2711 100755 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -42,6 +42,7 @@ namespace SparkleLib { public string RemoteUrl; public string [] ExcludeRules; public string [] Warnings; + public bool IsActive { get; private set; } private Thread thread; @@ -50,6 +51,7 @@ namespace SparkleLib { { TargetFolder = target_folder; RemoteUrl = server + "/" + remote_folder; + IsActive = false; ExcludeRules = new string [] { // gedit and emacs @@ -125,6 +127,7 @@ namespace SparkleLib { // Clones the remote repository public void Start () { + IsActive = true; SparkleHelpers.DebugInfo ("Fetcher", "[" + TargetFolder + "] Fetching folder: " + RemoteUrl); if (Started != null) @@ -149,6 +152,7 @@ namespace SparkleLib { SparkleHelpers.DebugInfo ("Fetcher", "Finished"); EnableHostKeyCheckingForHost (host); + IsActive = false; if (Finished != null) Finished (Warnings); @@ -157,6 +161,7 @@ namespace SparkleLib { SparkleHelpers.DebugInfo ("Fetcher", "Failed"); EnableHostKeyCheckingForHost (host); + IsActive = false; if (Failed != null) Failed (); diff --git a/SparkleShare/SparkleBubblesController.cs b/SparkleShare/SparkleBubblesController.cs index 1dcf0a1c..48c7e36b 100755 --- a/SparkleShare/SparkleBubblesController.cs +++ b/SparkleShare/SparkleBubblesController.cs @@ -28,10 +28,8 @@ namespace SparkleShare { public SparkleBubblesController () { - Program.Controller.ConflictNotificationRaised += delegate { - ShowBubble ("Conflict detected.", - "Don't worry, SparkleShare made a copy of each conflicting file.", - null); + Program.Controller.AlertNotificationRaised += delegate (string title, string message) { + ShowBubble (title, message, null); }; Program.Controller.NotificationRaised += delegate (SparkleChangeSet change_set) { diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index c8ece6b6..f6564fca 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -67,12 +67,12 @@ namespace SparkleShare { public event OnInviteHandler OnInvite; public delegate void OnInviteHandler (SparkleInvite invite); - public event ConflictNotificationRaisedHandler ConflictNotificationRaised; - public delegate void ConflictNotificationRaisedHandler (); - public event NotificationRaisedEventHandler NotificationRaised; public delegate void NotificationRaisedEventHandler (SparkleChangeSet change_set); + public event AlertNotificationRaisedEventHandler AlertNotificationRaised; + public delegate void AlertNotificationRaisedEventHandler (string title, string message); + public event NoteNotificationRaisedEventHandler NoteNotificationRaised; public delegate void NoteNotificationRaisedEventHandler (SparkleUser user, string folder_name); @@ -126,16 +126,23 @@ namespace SparkleShare { FolderListChanged (); }; + watcher.Created += delegate (object o, FileSystemEventArgs args) { + if (!args.FullPath.EndsWith (".xml")) + return; - SparkleInviteListener invite_listener = new SparkleInviteListener (1987); + if (this.fetcher == null || + this.fetcher.IsActive) { - invite_listener.InviteReceived += delegate (SparkleInvite invite) { - if (OnInvite != null && !FirstRun) - OnInvite (invite); + if (AlertNotificationRaised != null) + AlertNotificationRaised ("SparkleShare Setup is busy", + "Please try again later"); + + } else { + if (OnInvite != null) + OnInvite (new SparkleInvite (args.FullPath)); + } }; - invite_listener.Start (); - new Thread (new ThreadStart (PopulateRepositories)).Start (); } @@ -147,7 +154,7 @@ namespace SparkleShare { } - // Uploads the user's public key to the server + // Uploads the user's public key to the server TODO public bool AcceptInvitation (string server, string folder, string token) { // The location of the user's public key for SparkleShare @@ -184,6 +191,7 @@ namespace SparkleShare { get { List folders = SparkleConfig.DefaultConfig.Folders; folders.Sort (); + return folders; } } @@ -584,7 +592,6 @@ namespace SparkleShare { repo.NewChangeSet += delegate (SparkleChangeSet change_set) { - if (NotificationRaised != null) NotificationRaised (change_set); }; @@ -596,8 +603,9 @@ namespace SparkleShare { }; repo.ConflictResolved += delegate { - if (ConflictNotificationRaised != null) - ConflictNotificationRaised (); + if (AlertNotificationRaised != null) + AlertNotificationRaised ("Conflict detected.", + "Don't worry, SparkleShare made a copy of each conflicting file."); }; repo.SyncStatusChanged += delegate (SyncStatus status) { @@ -851,7 +859,6 @@ namespace SparkleShare { } foreach (string raw_email in emails) { - // Gravatar wants lowercase emails string email = raw_email.ToLower (); string avatar_file_path = Path.Combine (avatar_path, "avatar-" + email); @@ -866,9 +873,6 @@ namespace SparkleShare { old_avatars.Add (email); } catch (FileNotFoundException) { - // FIXME: For some reason the previous File.Exists () check - // doesn't cover all cases sometimes, so we catch any errors - if (old_avatars.Contains (email)) old_avatars.Remove (email); } @@ -876,11 +880,11 @@ namespace SparkleShare { } else if (this.failed_avatars.Contains (email)) { break; + } else { WebClient client = new WebClient (); string url = "http://gravatar.com/avatar/" + GetMD5 (email) + ".jpg?s=" + size + "&d=404"; - try { // Fetch the avatar byte [] buffer = client.DownloadData (url); @@ -900,11 +904,10 @@ namespace SparkleShare { SparkleHelpers.DebugInfo ("Avatar", "Failed fetching gravatar for " + email); // Stop downloading further avatars if we have no internet access - if (e.Status == WebExceptionStatus.Timeout){ + if (e.Status == WebExceptionStatus.Timeout) break; - } else { + else this.failed_avatars.Add (email); - } } } } diff --git a/SparkleShare/SparkleInvite.cs b/SparkleShare/SparkleInvite.cs index ca660648..d95ecf7a 100644 --- a/SparkleShare/SparkleInvite.cs +++ b/SparkleShare/SparkleInvite.cs @@ -29,32 +29,22 @@ namespace SparkleShare { public class SparkleInvite { - public readonly Uri FullAddress; - public readonly string Token; - - public string Host { - get { - return FullAddress.Host; - } - } - - public string Path { - get { - return FullAddress.AbsolutePath; - } - } + public readonly string Address; + public readonly string RemotePath; + public readonly Uri AcceptUrl; - public SparkleInvite (string host, string path, string token) + public SparkleInvite (string address, string remote_path, string accept_url) { - if (path.StartsWith ("/")) - path = path.Substring (1); + if (remote_path.StartsWith ("/")) + remote_path = remote_path.Substring (1); - if (!host.EndsWith ("/")) - host = host + "/"; + if (!address.EndsWith ("/")) + address = address + "/"; - FullAddress = new Uri ("ssh://" + host + path); - Token = token; + Address = address; + RemotePath = remote_path; + AcceptUrl = new Uri (accept_url); } @@ -63,19 +53,19 @@ namespace SparkleShare { XmlDocument xml_document = new XmlDocument (); XmlNode node; - string host = "", path = "", token = ""; + string address = "", remote_path = "", accept_url = ""; try { xml_document.Load (xml_file_path); - node = xml_document.SelectSingleNode ("/sparkleshare/invite/host/text()"); - if (node != null) { host = node.Value; } + node = xml_document.SelectSingleNode ("/sparkleshare/invite/address/text()"); + if (node != null) { address = node.Value; } - node = xml_document.SelectSingleNode ("/sparkleshare/invite/path/text()"); - if (node != null) { path = node.Value; } + node = xml_document.SelectSingleNode ("/sparkleshare/invite/remote_path/text()"); + if (node != null) { remote_path = node.Value; } - node = xml_document.SelectSingleNode ("/sparkleshare/invite/token/text()"); - if (node != null) { token = node.Value; } + node = xml_document.SelectSingleNode ("/sparkleshare/invite/accept_url/text()"); + if (node != null) { accept_url = node.Value; } } catch (XmlException e) { SparkleHelpers.DebugInfo ("Invite", "Invalid XML: " + e.Message); @@ -83,146 +73,34 @@ namespace SparkleShare { } - if (path.StartsWith ("/")) - path = path.Substring (1); + if (remote_path.StartsWith ("/")) + remote_path = remote_path.Substring (1); - if (!host.EndsWith ("/")) - host = host + "/"; + if (!address.EndsWith ("/")) + address = address + "/"; - FullAddress = new Uri ("ssh://" + host + path); - Token = token; - } - } - - - public class SparkleInviteListener { - - public event InviteReceivedHandler InviteReceived; - public delegate void InviteReceivedHandler (SparkleInvite invite); - - private Thread thread; - private TcpListener tcp_listener; - - - public SparkleInviteListener (int port) - { - this.tcp_listener = new TcpListener (IPAddress.Loopback, port); - this.thread = new Thread(new ThreadStart (Listen)); + Address = address; + RemotePath = remote_path; + AcceptUrl = new Uri (accept_url); } - public void Start () + public bool Accept () { - this.thread.Start (); - } + WebClient web_client = new WebClient (); + try { + web_client.DownloadData (AcceptUrl); + SparkleHelpers.DebugInfo ("Invite", "Uploaded public key"); - private void Listen () - { - this.tcp_listener.Start (); + return true; - while (true) - { - // Blocks until a client connects - TcpClient client = this.tcp_listener.AcceptTcpClient (); + } catch (WebException e) { + SparkleHelpers.DebugInfo ("Invite", + "Failed uploading public key: " + e.Message); - // Create a thread to handle communications - Thread client_thread = new Thread (HandleClient); - client_thread.Start (client); + return false; } } - - - private void HandleClient (object client) - { - TcpClient tcp_client = (TcpClient) client; - NetworkStream client_stream = tcp_client.GetStream (); - - byte [] message = new byte [4096]; - int bytes_read; - - while (true) - { - bytes_read = 0; - - try { - // Blocks until the client sends a message - bytes_read = client_stream.Read (message, 0, 4096); - - } catch { - Console.WriteLine ("Socket error..."); - } - - // The client has disconnected - if (bytes_read == 0) - break; - - ASCIIEncoding encoding = new ASCIIEncoding (); - string received_message = encoding.GetString (message, 0, bytes_read); - string invite_xml = ""; - - if (received_message.StartsWith (Uri.UriSchemeHttp) || - received_message.StartsWith (Uri.UriSchemeHttps)) { - - WebClient web_client = new WebClient (); - - try { - // Fetch the invite file - byte [] buffer = web_client.DownloadData (received_message); - SparkleHelpers.DebugInfo ("Invite", "Received: " + received_message); - - invite_xml = ASCIIEncoding.ASCII.GetString (buffer); - - } catch (WebException e) { - SparkleHelpers.DebugInfo ("Invite", "Failed downloading: " + - received_message + " " + e.Message); - continue; - } - - } else if (received_message.StartsWith (Uri.UriSchemeFile)) { - try { - received_message = received_message.Replace (Uri.UriSchemeFile + "://", ""); - invite_xml = File.ReadAllText (received_message); - - } catch { - SparkleHelpers.DebugInfo ("Invite", "Failed opening: " + received_message); - continue; - } - - } else { - SparkleHelpers.DebugInfo ("Invite", - "Path to invite must use either the file:// or http(s):// scheme"); - - continue; - } - - XmlDocument xml_document = new XmlDocument (); - XmlNode node; - - string host = "", path = "", token = ""; - - try { - xml_document.LoadXml (invite_xml); - - node = xml_document.SelectSingleNode ("/sparkleshare/invite/host/text()"); - if (node != null) { host = node.Value; } - - node = xml_document.SelectSingleNode ("/sparkleshare/invite/path/text()"); - if (node != null) { path = node.Value; } - - node = xml_document.SelectSingleNode ("/sparkleshare/invite/token/text()"); - if (node != null) { token = node.Value; } - - } catch (XmlException e) { - SparkleHelpers.DebugInfo ("Invite", "Invalid XML: " + received_message + " " + e.Message); - return; - } - - if (InviteReceived != null) - InviteReceived (new SparkleInvite (host, path, token)); - } - - tcp_client.Close (); - } } } diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 1b0cc3c6..f114e5eb 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -27,6 +27,7 @@ namespace SparkleShare { public enum PageType { Setup, Add, + Invite, Syncing, Error, Finished, @@ -274,6 +275,49 @@ namespace SparkleShare { } + public void InvitePageCompleted (SparkleInvite invite) + {/* + if (ChangePageEvent != null) + ChangePageEvent (PageType.Syncing, null); + + if (!invite.Accept ()) { + if (ChangePageEvent != null) + ChangePageEvent (PageType.Error, null); + + return; + } + */ + + // TODO: Remove events afterwards + + Program.Controller.FolderFetched += delegate (string [] warnings) { + if (ChangePageEvent != null) + ChangePageEvent (PageType.Finished, warnings); + + this.previous_address = ""; + this.syncing_folder = ""; + this.previous_url = ""; + SelectedPlugin = Plugins [0]; + }; + + Program.Controller.FolderFetchError += delegate (string remote_url) { + this.previous_url = remote_url; + + if (ChangePageEvent != null) + ChangePageEvent (PageType.Error, null); + + this.syncing_folder = ""; + }; + + Program.Controller.FolderFetching += delegate (double percentage) { + if (UpdateProgressBarEvent != null) + UpdateProgressBarEvent (percentage); + }; + + //Program.Controller.FetchFolder (address, path); + } + + public void ErrorPageCompleted () { if (ChangePageEvent != null) From 82ec6c8b790ae58e2d9527a2af4a7f081ff3470b Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Mon, 13 Feb 2012 21:27:53 +0100 Subject: [PATCH 03/53] event log: remove static property from LinkClicked method --- SparkleShare/Mac/SparkleEventLog.cs | 16 ++++++++++++++-- SparkleShare/SparkleEventLog.cs | 2 +- SparkleShare/SparkleEventLogController.cs | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs index a12d2c52..fc03e6fa 100755 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/SparkleEventLog.cs @@ -55,6 +55,7 @@ namespace SparkleShare { public SparkleEventLog () : base () { Title = "Recent Events"; + Delegate = new SparkleEventsDelegate (); SetFrame (new RectangleF (0, 0, 480, 640), true); @@ -142,6 +143,12 @@ namespace SparkleShare { ContentView.AddSubview (this.progress_indicator); + (this.web_view.PolicyDelegate as SparkleWebPolicyDelegate) + .LinkClicked += delegate (string href) { + Controller.LinkClicked (href); + }; + + UpdateContent (null); UpdateChooser (null); OrderFrontRegardless (); @@ -274,11 +281,16 @@ namespace SparkleShare { public class SparkleWebPolicyDelegate : WebPolicyDelegate { - + + public event LinkClickedHandler LinkClicked; + public delegate void LinkClickedHandler (string href); + + public override void DecidePolicyForNavigation (WebView web_view, NSDictionary action_info, NSUrlRequest request, WebFrame frame, NSObject decision_token) { - SparkleEventLogController.LinkClicked (request.Url.ToString ()); + if (LinkClicked != null) + LinkClicked (request.Url.ToString ()); } } } diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index b9f39580..7bc154bd 100755 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -78,7 +78,7 @@ namespace SparkleShare { this.web_view.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) { if (args.Request.Uri == this.link_status) - SparkleEventLogController.LinkClicked (args.Request.Uri); + Controller.LinkClicked (args.Request.Uri); // Don't follow HREFs (as this would cause a page refresh) if (!args.Request.Uri.Equals ("file:")) diff --git a/SparkleShare/SparkleEventLogController.cs b/SparkleShare/SparkleEventLogController.cs index c4243eac..3615fcb8 100755 --- a/SparkleShare/SparkleEventLogController.cs +++ b/SparkleShare/SparkleEventLogController.cs @@ -178,7 +178,7 @@ namespace SparkleShare { } - public static void LinkClicked (string url) + public void LinkClicked (string url) { if (url.StartsWith (Path.VolumeSeparatorChar.ToString ())) { Program.Controller.OpenFile (url); From 99e76b1655c634310068dc72d4db173d09eb997e Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Mon, 13 Feb 2012 21:27:53 +0100 Subject: [PATCH 04/53] event log: remove static property from LinkClicked method --- SparkleShare/Mac/SparkleEventLog.cs | 16 ++++++++++++++-- SparkleShare/SparkleEventLog.cs | 2 +- SparkleShare/SparkleEventLogController.cs | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs index a12d2c52..fc03e6fa 100755 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/SparkleEventLog.cs @@ -55,6 +55,7 @@ namespace SparkleShare { public SparkleEventLog () : base () { Title = "Recent Events"; + Delegate = new SparkleEventsDelegate (); SetFrame (new RectangleF (0, 0, 480, 640), true); @@ -142,6 +143,12 @@ namespace SparkleShare { ContentView.AddSubview (this.progress_indicator); + (this.web_view.PolicyDelegate as SparkleWebPolicyDelegate) + .LinkClicked += delegate (string href) { + Controller.LinkClicked (href); + }; + + UpdateContent (null); UpdateChooser (null); OrderFrontRegardless (); @@ -274,11 +281,16 @@ namespace SparkleShare { public class SparkleWebPolicyDelegate : WebPolicyDelegate { - + + public event LinkClickedHandler LinkClicked; + public delegate void LinkClickedHandler (string href); + + public override void DecidePolicyForNavigation (WebView web_view, NSDictionary action_info, NSUrlRequest request, WebFrame frame, NSObject decision_token) { - SparkleEventLogController.LinkClicked (request.Url.ToString ()); + if (LinkClicked != null) + LinkClicked (request.Url.ToString ()); } } } diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index b9f39580..7bc154bd 100755 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -78,7 +78,7 @@ namespace SparkleShare { this.web_view.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) { if (args.Request.Uri == this.link_status) - SparkleEventLogController.LinkClicked (args.Request.Uri); + Controller.LinkClicked (args.Request.Uri); // Don't follow HREFs (as this would cause a page refresh) if (!args.Request.Uri.Equals ("file:")) diff --git a/SparkleShare/SparkleEventLogController.cs b/SparkleShare/SparkleEventLogController.cs index c4243eac..3615fcb8 100755 --- a/SparkleShare/SparkleEventLogController.cs +++ b/SparkleShare/SparkleEventLogController.cs @@ -178,7 +178,7 @@ namespace SparkleShare { } - public static void LinkClicked (string url) + public void LinkClicked (string url) { if (url.StartsWith (Path.VolumeSeparatorChar.ToString ())) { Program.Controller.OpenFile (url); From a28ea22647082f81f6c280443d48ee2803602a1b Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Tue, 14 Feb 2012 17:23:08 +0100 Subject: [PATCH 05/53] mac setup: Add an invite page --- SparkleShare/Mac/SparkleSetup.cs | 35 ++++++++++++++++++++++++-- SparkleShare/SparkleSetupController.cs | 33 ++++++++++++++++++------ 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/SparkleShare/Mac/SparkleSetup.cs b/SparkleShare/Mac/SparkleSetup.cs index 9d890127..817e4b4d 100755 --- a/SparkleShare/Mac/SparkleSetup.cs +++ b/SparkleShare/Mac/SparkleSetup.cs @@ -36,6 +36,7 @@ namespace SparkleShare { private NSButton SyncButton; private NSButton TryAgainButton; private NSButton CancelButton; + private NSButton AcceptButton; private NSButton SkipTutorialButton; private NSButton OpenFolderButton; private NSButton FinishButton; @@ -158,10 +159,40 @@ namespace SparkleShare { break; } + case PageType.Invite: { + + Header = "You've received an invite!"; + Description = "Do you want to add this project to SparkleShare?"; + + + CancelButton = new NSButton () { + Title = "Cancel" + }; + + CancelButton.Activated += delegate { + InvokeOnMainThread (delegate { + PerformClose (this); + }); + }; + + AcceptButton = new NSButton () { + Title = "Accept" + }; + + AcceptButton.Activated += delegate { + Controller.InvitePageCompleted (); + }; + + Buttons.Add (AcceptButton); + Buttons.Add (CancelButton); + + break; + } + case PageType.Add: { - Header = "Where's your project hosted?"; - Description = ""; + Header = "Where's your project hosted?"; + Description = ""; AddressLabel = new NSTextField () { Alignment = NSTextAlignment.Left, diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index f114e5eb..225be36c 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; +using System.Threading; using SparkleLib; @@ -214,7 +215,7 @@ namespace SparkleShare { public void ShowAddPage () { if (ChangePageEvent != null) - ChangePageEvent (PageType.Add, null); + ChangePageEvent (PageType.Invite, null); SelectedPluginChanged (SelectedPluginIndex); } @@ -258,6 +259,7 @@ namespace SparkleShare { }; Program.Controller.FolderFetchError += delegate (string remote_url) { + Thread.Sleep (1000); this.previous_url = remote_url; if (ChangePageEvent != null) @@ -275,18 +277,22 @@ namespace SparkleShare { } - public void InvitePageCompleted (SparkleInvite invite) - {/* + public SparkleInvite PendingInvite = new SparkleInvite ("ssh://git@sparkleshare.org/", + "/home/stuff/", + "http://www.sparkleshare.org/"); + + public void InvitePageCompleted () + { if (ChangePageEvent != null) ChangePageEvent (PageType.Syncing, null); - if (!invite.Accept ()) { + if (!PendingInvite.Accept ()) { if (ChangePageEvent != null) ChangePageEvent (PageType.Error, null); return; } - */ + // TODO: Remove events afterwards @@ -301,6 +307,7 @@ namespace SparkleShare { }; Program.Controller.FolderFetchError += delegate (string remote_url) { + Thread.Sleep (1000); this.previous_url = remote_url; if (ChangePageEvent != null) @@ -314,13 +321,18 @@ namespace SparkleShare { UpdateProgressBarEvent (percentage); }; - //Program.Controller.FetchFolder (address, path); + Program.Controller.FetchFolder (PendingInvite.Address, PendingInvite.RemotePath); } public void ErrorPageCompleted () { - if (ChangePageEvent != null) + if (ChangePageEvent == null) + return; + + if (PendingInvite != null) + ChangePageEvent (PageType.Invite, null); + else ChangePageEvent (PageType.Add, null); } @@ -329,7 +341,12 @@ namespace SparkleShare { { Program.Controller.StopFetcher (); - if (ChangePageEvent != null) + if (ChangePageEvent == null) + return; + + if (PendingInvite != null) + ChangePageEvent (PageType.Invite, null); + else ChangePageEvent (PageType.Add, null); } From 41ea97c9272a2c999185a209b14aaac849c7676a Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Tue, 14 Feb 2012 20:34:03 +0100 Subject: [PATCH 06/53] repo: don't recurse into first .git folder --- SparkleLib/Git/SparkleRepoGit.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 50228091..e831113f 100755 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -724,6 +724,9 @@ namespace SparkleLib { } else if (child_path.EndsWith (".notes")) { continue; + + } else if (child_path.EndsWith (".git")) { + continue; } PrepareDirectories (child_path); From 9dee454773d67ca1439fd8feb894cc42a2ed0e57 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Tue, 14 Feb 2012 20:39:09 +0100 Subject: [PATCH 07/53] setup: add more helpful help label to address field --- SparkleShare/Mac/SparkleSetup.cs | 18 +++++++++++++++--- SparkleShare/SparkleSetup.cs | 1 + data/plugins/own-server.xml.in | 3 +-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/SparkleShare/Mac/SparkleSetup.cs b/SparkleShare/Mac/SparkleSetup.cs index 9d890127..a4ac0509 100755 --- a/SparkleShare/Mac/SparkleSetup.cs +++ b/SparkleShare/Mac/SparkleSetup.cs @@ -48,6 +48,7 @@ namespace SparkleShare { private NSTextField FullNameLabel; private NSTextField AddressTextField; private NSTextField AddressLabel; + private NSTextField AddressHelpLabel; private NSTextField PathTextField; private NSTextField PathLabel; private NSTextField PathHelpLabel; @@ -215,6 +216,17 @@ namespace SparkleShare { ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11) }; + AddressHelpLabel = new NSTextField () { + BackgroundColor = NSColor.WindowBackground, + Bordered = false, + TextColor = NSColor.DisabledControlText, + Editable = false, + Frame = new RectangleF (190, Frame.Height - 355, 204, 17), + StringValue = "e.g. ‘rupert/website-design’", + Font = NSFontManager.SharedFontManager.FontWithFamily + ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11) + }; + TableView = new NSTableView () { Frame = new RectangleF (0, 0, 0, 0), @@ -265,6 +277,7 @@ namespace SparkleShare { InvokeOnMainThread (delegate { AddressTextField.StringValue = text; AddressTextField.Enabled = (state == FieldState.Enabled); + AddressHelpLabel.StringValue = example_text; }); }; @@ -275,9 +288,7 @@ namespace SparkleShare { InvokeOnMainThread (delegate { PathTextField.StringValue = text; PathTextField.Enabled = (state == FieldState.Enabled); - - if (!string.IsNullOrEmpty (example_text)) - PathHelpLabel.StringValue = "e.g. " + example_text; + PathHelpLabel.StringValue = example_text; }); }; @@ -322,6 +333,7 @@ namespace SparkleShare { ContentView.AddSubview (ScrollView); ContentView.AddSubview (AddressLabel); ContentView.AddSubview (AddressTextField); + ContentView.AddSubview (AddressHelpLabel); ContentView.AddSubview (PathLabel); ContentView.AddSubview (PathTextField); ContentView.AddSubview (PathHelpLabel); diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index 9eb6d69e..abd96806 100755 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -208,6 +208,7 @@ namespace SparkleShare { path_entry.Text = text; path_entry.Sensitive = (state == FieldState.Enabled); + // TODO: Use small labels like the mac UI if (string.IsNullOrEmpty (example_text)) path_entry.ExampleText = null; else diff --git a/data/plugins/own-server.xml.in b/data/plugins/own-server.xml.in index 678cddff..c3f854b5 100644 --- a/data/plugins/own-server.xml.in +++ b/data/plugins/own-server.xml.in @@ -9,7 +9,7 @@
- domain name or IP address + [user@]hostname[:port]
@@ -17,4 +17,3 @@ - From 3120758bfd824755125a0b8fbe0265312497696f Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Wed, 15 Feb 2012 22:18:08 +0100 Subject: [PATCH 08/53] setup: remove some strings --- SparkleShare/Mac/SparkleSetup.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SparkleShare/Mac/SparkleSetup.cs b/SparkleShare/Mac/SparkleSetup.cs index a4ac0509..a20cb5b4 100755 --- a/SparkleShare/Mac/SparkleSetup.cs +++ b/SparkleShare/Mac/SparkleSetup.cs @@ -211,7 +211,7 @@ namespace SparkleShare { TextColor = NSColor.DisabledControlText, Editable = false, Frame = new RectangleF (190 + 196 + 16, Frame.Height - 355, 204, 17), - StringValue = "e.g. ‘rupert/website-design’", + StringValue = "", Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11) }; @@ -222,7 +222,7 @@ namespace SparkleShare { TextColor = NSColor.DisabledControlText, Editable = false, Frame = new RectangleF (190, Frame.Height - 355, 204, 17), - StringValue = "e.g. ‘rupert/website-design’", + StringValue = "", Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11) }; From 4d3f1a6e85e5003c51c86db8de2baf4a02dcf1f2 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 16 Feb 2012 22:43:41 +0100 Subject: [PATCH 09/53] repo git: adjust commit message for notes --- SparkleLib/Git/SparkleRepoGit.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index e831113f..a8bcec9f 100755 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -783,7 +783,10 @@ namespace SparkleLib { if (file_name.EndsWith (".empty")) file_name = file_name.Substring (0, file_name.Length - 6); - message += "+ ‘" + file_name + "’" + n; + if (file_name.StartsWith (".notes")) + message += "added a note"; + else + message += "+ ‘" + file_name + "’" + n; count++; if (count == max_count) From 7e0e972221bcaedbe3d4f042c53035347926cdfc Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 17 Feb 2012 00:51:44 +0100 Subject: [PATCH 10/53] Finish support for invite.xml files dropped in ~/SparkleShare --- SparkleShare/Mac/SparkleSetup.cs | 100 +++-- SparkleShare/Mac/SparkleSetupWindow.cs | 8 +- SparkleShare/Mac/SparkleStatusIcon.cs | 23 +- SparkleShare/Mac/SparkleUI.cs | 6 +- SparkleShare/SparkleControllerBase.cs | 81 ++-- SparkleShare/SparkleInvite.cs | 60 +-- SparkleShare/SparkleSetupController.cs | 405 ++++++++++---------- SparkleShare/SparkleStatusIconController.cs | 6 + 8 files changed, 371 insertions(+), 318 deletions(-) diff --git a/SparkleShare/Mac/SparkleSetup.cs b/SparkleShare/Mac/SparkleSetup.cs index 817e4b4d..b77aa191 100755 --- a/SparkleShare/Mac/SparkleSetup.cs +++ b/SparkleShare/Mac/SparkleSetup.cs @@ -33,10 +33,9 @@ namespace SparkleShare { public SparkleSetupController Controller = new SparkleSetupController (); private NSButton ContinueButton; - private NSButton SyncButton; + private NSButton AddButton; private NSButton TryAgainButton; private NSButton CancelButton; - private NSButton AcceptButton; private NSButton SkipTutorialButton; private NSButton OpenFolderButton; private NSButton FinishButton; @@ -65,6 +64,18 @@ namespace SparkleShare { public SparkleSetup () : base () { + Controller.HideWindowEvent += delegate { + InvokeOnMainThread (delegate { + PerformClose (this); + }); + }; + + Controller.ShowWindowEvent += delegate { + InvokeOnMainThread (delegate { + OrderFrontRegardless (); + }); + }; + Controller.ChangePageEvent += delegate (PageType type, string [] warnings) { InvokeOnMainThread (delegate { Reset (); @@ -72,6 +83,7 @@ namespace SparkleShare { switch (type) { case PageType.Setup: { + // TODO: Improve text Header = "Welcome to SparkleShare!"; Description = "We'll need some info to mark your changes in the event log. " + "Don't worry, this stays between you and your peers."; @@ -165,25 +177,70 @@ namespace SparkleShare { Description = "Do you want to add this project to SparkleShare?"; + AddressLabel = new NSTextField () { + Alignment = NSTextAlignment.Right, + BackgroundColor = NSColor.WindowBackground, + Bordered = false, + Editable = false, + Frame = new RectangleF (165, Frame.Height - 240, 160, 17), + StringValue = "Address:", + Font = SparkleUI.Font + }; + + PathLabel = new NSTextField () { + Alignment = NSTextAlignment.Right, + BackgroundColor = NSColor.WindowBackground, + Bordered = false, + Editable = false, + Frame = new RectangleF (165, Frame.Height - 264, 160, 17), + StringValue = "Remote Path:", + Font = SparkleUI.Font + }; + + AddressTextField = new NSTextField () { + Alignment = NSTextAlignment.Left, + BackgroundColor = NSColor.WindowBackground, + Bordered = false, + Editable = false, + Frame = new RectangleF (330, Frame.Height - 240, 260, 17), + StringValue = Controller.PendingInvite.Address, + Font = SparkleUI.BoldFont + }; + + PathTextField = new NSTextField () { + Alignment = NSTextAlignment.Left, + BackgroundColor = NSColor.WindowBackground, + Bordered = false, + Editable = false, + Frame = new RectangleF (330, Frame.Height - 264, 260, 17), + StringValue = Controller.PendingInvite.RemotePath, + Font = SparkleUI.BoldFont + }; + + + ContentView.AddSubview (AddressLabel); + ContentView.AddSubview (PathLabel); + ContentView.AddSubview (AddressTextField); + ContentView.AddSubview (PathTextField); + + CancelButton = new NSButton () { Title = "Cancel" }; CancelButton.Activated += delegate { - InvokeOnMainThread (delegate { - PerformClose (this); - }); + Controller.PageCancelled (); }; - AcceptButton = new NSButton () { - Title = "Accept" + AddButton = new NSButton () { + Title = "Add" }; - AcceptButton.Activated += delegate { + AddButton.Activated += delegate { Controller.InvitePageCompleted (); }; - Buttons.Add (AcceptButton); + Buttons.Add (AddButton); Buttons.Add (CancelButton); break; @@ -201,7 +258,7 @@ namespace SparkleShare { Editable = false, Frame = new RectangleF (190, Frame.Height - 308, 160, 17), StringValue = "Address:", - Font = SparkleUI.Font + Font = SparkleUI.BoldFont }; AddressTextField = new NSTextField () { @@ -220,7 +277,7 @@ namespace SparkleShare { Editable = false, Frame = new RectangleF (190 + 196 + 16, Frame.Height - 308, 160, 17), StringValue = "Remote Path:", - Font = SparkleUI.Font + Font = SparkleUI.BoldFont }; PathTextField = new NSTextField () { @@ -345,7 +402,7 @@ namespace SparkleShare { Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) { InvokeOnMainThread (delegate { - SyncButton.Enabled = button_enabled; + AddButton.Enabled = button_enabled; }); }; @@ -357,28 +414,26 @@ namespace SparkleShare { ContentView.AddSubview (PathTextField); ContentView.AddSubview (PathHelpLabel); - SyncButton = new NSButton () { + AddButton = new NSButton () { Title = "Add", Enabled = false }; - SyncButton.Activated += delegate { + AddButton.Activated += delegate { Controller.AddPageCompleted ( AddressTextField.StringValue, PathTextField.StringValue ); }; - Buttons.Add (SyncButton); + Buttons.Add (AddButton); CancelButton = new NSButton () { Title = "Cancel" }; CancelButton.Activated += delegate { - InvokeOnMainThread (delegate { - PerformClose (this); - }); + Controller.PageCancelled (); }; Buttons.Add (CancelButton); @@ -524,10 +579,7 @@ namespace SparkleShare { }; FinishButton.Activated += delegate { - InvokeOnMainThread (delegate { - Controller.FinishedPageCompleted (); - PerformClose (this); - }); + Controller.FinishPageCompleted (); }; OpenFolderButton = new NSButton () { @@ -674,9 +726,7 @@ namespace SparkleShare { }; FinishButton.Activated += delegate { - InvokeOnMainThread (delegate { - PerformClose (this); - }); + Controller.TutorialPageCompleted (); }; string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, diff --git a/SparkleShare/Mac/SparkleSetupWindow.cs b/SparkleShare/Mac/SparkleSetupWindow.cs index 1441071b..7bdb249a 100755 --- a/SparkleShare/Mac/SparkleSetupWindow.cs +++ b/SparkleShare/Mac/SparkleSetupWindow.cs @@ -83,11 +83,6 @@ namespace SparkleShare { Font = SparkleUI.Font }; - NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); - MakeKeyAndOrderFront (this); - - OrderFrontRegardless (); - if (Program.UI != null) Program.UI.UpdateDockIconVisibility (); } @@ -140,6 +135,9 @@ namespace SparkleShare { public override void OrderFrontRegardless () { NSApplication.SharedApplication.AddWindowsItem (this, "SparkleShare Setup", false); + NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); + MakeKeyAndOrderFront (this); + base.OrderFrontRegardless (); } diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleStatusIcon.cs index 231fe902..b83dcbd2 100755 --- a/SparkleShare/Mac/SparkleStatusIcon.cs +++ b/SparkleShare/Mac/SparkleStatusIcon.cs @@ -230,26 +230,13 @@ namespace SparkleShare { Menu.AddItem (NSMenuItem.SeparatorItem); SyncMenuItem = new NSMenuItem () { - Title = "Add Hosted Project…", + Title = "Add Hosted Project…", Enabled = true }; if (!Program.Controller.FirstRun) { SyncMenuItem.Activated += delegate { - InvokeOnMainThread (delegate { - NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); - - if (SparkleUI.Setup == null) { - SparkleUI.Setup = new SparkleSetup (); - SparkleUI.Setup.Controller.ShowAddPage (); - } - - if (!SparkleUI.Setup.IsVisible) - SparkleUI.Setup.Controller.ShowAddPage (); - - SparkleUI.Setup.OrderFrontRegardless (); - SparkleUI.Setup.MakeKeyAndOrderFront (this); - }); + Controller.AddHostedProjectClicked (); }; } @@ -262,7 +249,9 @@ namespace SparkleShare { }; if (Controller.Folders.Length > 0) { + // TODO: move this logic RecentEventsMenuItem.Activated += delegate { + // Controller.OpenRecentEventsClicked () InvokeOnMainThread (delegate { NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); @@ -304,8 +293,10 @@ namespace SparkleShare { Title = "About SparkleShare", Enabled = true }; - + + // TODO: move this logic AboutMenuItem.Activated += delegate { + // Controller.AboutClicked (); InvokeOnMainThread (delegate { NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); diff --git a/SparkleShare/Mac/SparkleUI.cs b/SparkleShare/Mac/SparkleUI.cs index 43e9f62f..0c268f2f 100755 --- a/SparkleShare/Mac/SparkleUI.cs +++ b/SparkleShare/Mac/SparkleUI.cs @@ -65,11 +65,11 @@ namespace SparkleShare { StatusIcon = new SparkleStatusIcon (); Bubbles = new SparkleBubbles (); + Setup = new SparkleSetup (); + // About = new SparkleAbout (); if (Program.Controller.FirstRun) { - Setup = new SparkleSetup (); - Setup.Controller.ShowSetupPage (); - + Program.Controller.ShowSetupWindow (PageType.Setup); UpdateDockIconVisibility (); } } diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index f6564fca..5368cef8 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -40,6 +40,17 @@ namespace SparkleShare { public double ProgressPercentage = 0.0; public string ProgressSpeed = ""; + + public event ShowSetupWindowEventHandler ShowSetupWindowEvent; + public delegate void ShowSetupWindowEventHandler (PageType page_type); + + public event ShowAboutWindowEventHandler ShowAboutWindowEvent; + public delegate void ShowAboutWindowEventHandler (); + + public event ShowEventsWindowEventHandler ShowEventsWindowEvent; + public delegate void ShowEventsWindowEventHandler (); + + public event FolderFetchedEventHandler FolderFetched; public delegate void FolderFetchedEventHandler (string [] warnings); @@ -64,8 +75,8 @@ namespace SparkleShare { public event OnErrorHandler OnError; public delegate void OnErrorHandler (); - public event OnInviteHandler OnInvite; - public delegate void OnInviteHandler (SparkleInvite invite); + public event InviteReceivedHandler InviteReceived; + public delegate void InviteReceivedHandler (SparkleInvite invite); public event NotificationRaisedEventHandler NotificationRaised; public delegate void NotificationRaisedEventHandler (SparkleChangeSet change_set); @@ -130,7 +141,7 @@ namespace SparkleShare { if (!args.FullPath.EndsWith (".xml")) return; - if (this.fetcher == null || + if (this.fetcher != null && this.fetcher.IsActive) { if (AlertNotificationRaised != null) @@ -138,8 +149,12 @@ namespace SparkleShare { "Please try again later"); } else { - if (OnInvite != null) - OnInvite (new SparkleInvite (args.FullPath)); + if (InviteReceived != null) { + SparkleInvite invite = new SparkleInvite (args.FullPath); + + if (invite.Valid) + InviteReceived (invite); + } } }; @@ -154,39 +169,6 @@ namespace SparkleShare { } - // Uploads the user's public key to the server TODO - public bool AcceptInvitation (string server, string folder, string token) - { - // The location of the user's public key for SparkleShare - string public_key_file_path = SparkleHelpers.CombineMore (SparkleConfig.DefaultConfig.HomePath, - ".ssh", "sparkleshare." + UserEmail + ".key.pub"); - - if (!File.Exists (public_key_file_path)) - return false; - - StreamReader reader = new StreamReader (public_key_file_path); - string public_key = reader.ReadToEnd (); - reader.Close (); - - string url = "https://" + server + "/?folder=" + folder + - "&token=" + token + "&pubkey=" + public_key; - - SparkleHelpers.DebugInfo ("WebRequest", url); - - HttpWebRequest request = (HttpWebRequest) WebRequest.Create (url); - HttpWebResponse response = (HttpWebResponse) request.GetResponse(); - - if (response.StatusCode == HttpStatusCode.OK) { - response.Close (); - return true; - - } else { - response.Close (); - return false; - } - } - - public List Folders { get { List folders = SparkleConfig.DefaultConfig.Folders; @@ -202,6 +184,7 @@ namespace SparkleShare { List hosts = SparkleConfig.DefaultConfig.HostsWithUsername; hosts.AddRange(SparkleConfig.DefaultConfig.Hosts); hosts.Sort (); + return hosts; } } @@ -221,6 +204,28 @@ namespace SparkleShare { } + public void ShowSetupWindow (PageType page_type) + { + if (ShowSetupWindowEvent != null) + ShowSetupWindowEvent (page_type); + } + + + public void ShowAboutWindow () + { + if (ShowAboutWindowEvent != null) + ShowAboutWindowEvent (); + } + + + public void ShowEventsWindow () + { + if (ShowEventsWindowEvent != null) + ShowEventsWindowEvent (); + } + + + public List GetLog () { List list = new List (); diff --git a/SparkleShare/SparkleInvite.cs b/SparkleShare/SparkleInvite.cs index d95ecf7a..0b56ef56 100644 --- a/SparkleShare/SparkleInvite.cs +++ b/SparkleShare/SparkleInvite.cs @@ -16,12 +16,8 @@ using System; -using System.IO; using System.Net; -using System.Net.Sockets; -using System.Text; using System.Xml; -using System.Threading; using SparkleLib; @@ -29,22 +25,22 @@ namespace SparkleShare { public class SparkleInvite { - public readonly string Address; - public readonly string RemotePath; - public readonly Uri AcceptUrl; + public string Address { get; private set; } + public string RemotePath { get; private set; } + public Uri AcceptUrl { get; private set; } + + public bool Valid { + get { + return (!string.IsNullOrEmpty (Address) && + !string.IsNullOrEmpty (RemotePath) && + !string.IsNullOrEmpty (AcceptUrl.ToString ())); + } + } public SparkleInvite (string address, string remote_path, string accept_url) { - if (remote_path.StartsWith ("/")) - remote_path = remote_path.Substring (1); - - if (!address.EndsWith ("/")) - address = address + "/"; - - Address = address; - RemotePath = remote_path; - AcceptUrl = new Uri (accept_url); + Initialize (address, remote_path, accept_url); } @@ -53,7 +49,10 @@ namespace SparkleShare { XmlDocument xml_document = new XmlDocument (); XmlNode node; - string address = "", remote_path = "", accept_url = ""; + string address = ""; + string remote_path = ""; + string accept_url = ""; + try { xml_document.Load (xml_file_path); @@ -67,21 +66,12 @@ namespace SparkleShare { node = xml_document.SelectSingleNode ("/sparkleshare/invite/accept_url/text()"); if (node != null) { accept_url = node.Value; } + Initialize (address, remote_path, accept_url); + } catch (XmlException e) { SparkleHelpers.DebugInfo ("Invite", "Invalid XML: " + e.Message); return; } - - - if (remote_path.StartsWith ("/")) - remote_path = remote_path.Substring (1); - - if (!address.EndsWith ("/")) - address = address + "/"; - - Address = address; - RemotePath = remote_path; - AcceptUrl = new Uri (accept_url); } @@ -102,5 +92,19 @@ namespace SparkleShare { return false; } } + + + private void Initialize (string address, string remote_path, string accept_url) + {/* + if (!remote_path.StartsWith ("/")) + remote_path = "/" + remote_path; + + if (!address.EndsWith ("/")) + address = address + "/"; + */ + Address = address; + RemotePath = remote_path; + AcceptUrl = new Uri (accept_url); + } } } diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 225be36c..446a7c51 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -43,6 +43,12 @@ namespace SparkleShare { public class SparkleSetupController { + public event ShowWindowEventHandler ShowWindowEvent; + public delegate void ShowWindowEventHandler (); + + public event HideWindowEventHandler HideWindowEvent; + public delegate void HideWindowEventHandler (); + public event ChangePageEventHandler ChangePageEvent; public delegate void ChangePageEventHandler (PageType page, string [] warnings); @@ -60,12 +66,17 @@ namespace SparkleShare { string example_text, FieldState state); public event ChangePathFieldEventHandler ChangePathFieldEvent; - public delegate void ChangePathFieldEventHandler (string text, - string example_text, FieldState state); + public delegate void ChangePathFieldEventHandler (string text, string example_text, FieldState state); public readonly List Plugins = new List (); public SparklePlugin SelectedPlugin; + public int TutorialPageNumber { get; private set; } + public string PreviousUrl { get; private set; } + public string PreviousAddress { get; private set; } + public string PreviousPath { get; private set; } + public string SyncingFolder { get; private set; } + public int SelectedPluginIndex { get { @@ -73,42 +84,6 @@ namespace SparkleShare { } } - public int TutorialPageNumber { - get { - return this.tutorial_page_number; - } - } - - public string PreviousUrl { - get { - return this.previous_url; - } - } - - public string PreviousAddress { - get { - return this.previous_address; - } - } - - public string PreviousPath { - get { - return this.previous_path; - } - } - - public string SyncingFolder { - get { - return this.syncing_folder; - } - } - - public PageType PreviousPage { - get { - return this.previous_page; - } - } - public string GuessedUserName { get { return Program.Controller.UserName; @@ -125,16 +100,14 @@ namespace SparkleShare { } - private string previous_address = ""; - private string previous_path = ""; - private string previous_url = ""; - private string syncing_folder = ""; - private int tutorial_page_number = 1; - private PageType previous_page; - - public SparkleSetupController () { + TutorialPageNumber = 1; + PreviousAddress = ""; + PreviousPath = ""; + PreviousUrl = ""; + SyncingFolder = ""; + string local_plugins_path = SparkleHelpers.CombineMore ( Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "sparkleshare", "plugins"); @@ -154,16 +127,37 @@ namespace SparkleShare { SelectedPlugin = Plugins [0]; - ChangePageEvent += delegate (PageType page, string [] warning) { - this.previous_page = page; + + Program.Controller.InviteReceived += delegate (SparkleInvite invite) { + PendingInvite = invite; + + if (ChangePageEvent != null) + ChangePageEvent (PageType.Invite, null); + + if (ShowWindowEvent != null) + ShowWindowEvent (); + }; + + + Program.Controller.ShowSetupWindowEvent += delegate (PageType page_type) { + if (ChangePageEvent != null) + ChangePageEvent (page_type, null); + + if (ShowWindowEvent != null) + ShowWindowEvent (); + + if (page_type == PageType.Add) + SelectedPluginChanged (SelectedPluginIndex); }; } - public void ShowSetupPage () + public void PageCancelled () { - if (ChangePageEvent != null) - ChangePageEvent (PageType.Setup, null); + // PendingInvite = null; + + if (HideWindowEvent != null) + HideWindowEvent (); } @@ -194,171 +188,27 @@ namespace SparkleShare { } - public void TutorialPageCompleted () - { - this.tutorial_page_number++; - - if (ChangePageEvent != null) - ChangePageEvent (PageType.Tutorial, null); - } - - public void TutorialSkipped () { - this.tutorial_page_number = 4; + TutorialPageNumber = 4; if (ChangePageEvent != null) ChangePageEvent (PageType.Tutorial, null); } - public void ShowAddPage () + public void TutorialPageCompleted () { - if (ChangePageEvent != null) - ChangePageEvent (PageType.Invite, null); + TutorialPageNumber++; - SelectedPluginChanged (SelectedPluginIndex); - } + if (TutorialPageNumber == 4) { + if (HideWindowEvent != null) + HideWindowEvent (); - - public void CheckAddPage (string address, string remote_path, int selected_plugin) - { - if (SelectedPluginIndex != selected_plugin) - SelectedPluginChanged (selected_plugin); - - address = address.Trim (); - remote_path = remote_path.Trim (); - - bool fields_valid = address != null && address.Trim().Length > 0 && - remote_path != null && remote_path.Trim().Length > 0; - - if (UpdateAddProjectButtonEvent != null) - UpdateAddProjectButtonEvent (fields_valid); - } - - - public void AddPageCompleted (string address, string path) - { - this.syncing_folder = Path.GetFileNameWithoutExtension (path); - this.previous_address = address; - this.previous_path = path; - - if (ChangePageEvent != null) - ChangePageEvent (PageType.Syncing, null); - - // TODO: Remove events afterwards - - Program.Controller.FolderFetched += delegate (string [] warnings) { + } else { if (ChangePageEvent != null) - ChangePageEvent (PageType.Finished, warnings); - - this.previous_address = ""; - this.syncing_folder = ""; - this.previous_url = ""; - SelectedPlugin = Plugins [0]; - }; - - Program.Controller.FolderFetchError += delegate (string remote_url) { - Thread.Sleep (1000); - this.previous_url = remote_url; - - if (ChangePageEvent != null) - ChangePageEvent (PageType.Error, null); - - this.syncing_folder = ""; - }; - - Program.Controller.FolderFetching += delegate (double percentage) { - if (UpdateProgressBarEvent != null) - UpdateProgressBarEvent (percentage); - }; - - Program.Controller.FetchFolder (address, path); - } - - - public SparkleInvite PendingInvite = new SparkleInvite ("ssh://git@sparkleshare.org/", - "/home/stuff/", - "http://www.sparkleshare.org/"); - - public void InvitePageCompleted () - { - if (ChangePageEvent != null) - ChangePageEvent (PageType.Syncing, null); - - if (!PendingInvite.Accept ()) { - if (ChangePageEvent != null) - ChangePageEvent (PageType.Error, null); - - return; + ChangePageEvent (PageType.Tutorial, null); } - - - // TODO: Remove events afterwards - - Program.Controller.FolderFetched += delegate (string [] warnings) { - if (ChangePageEvent != null) - ChangePageEvent (PageType.Finished, warnings); - - this.previous_address = ""; - this.syncing_folder = ""; - this.previous_url = ""; - SelectedPlugin = Plugins [0]; - }; - - Program.Controller.FolderFetchError += delegate (string remote_url) { - Thread.Sleep (1000); - this.previous_url = remote_url; - - if (ChangePageEvent != null) - ChangePageEvent (PageType.Error, null); - - this.syncing_folder = ""; - }; - - Program.Controller.FolderFetching += delegate (double percentage) { - if (UpdateProgressBarEvent != null) - UpdateProgressBarEvent (percentage); - }; - - Program.Controller.FetchFolder (PendingInvite.Address, PendingInvite.RemotePath); - } - - - public void ErrorPageCompleted () - { - if (ChangePageEvent == null) - return; - - if (PendingInvite != null) - ChangePageEvent (PageType.Invite, null); - else - ChangePageEvent (PageType.Add, null); - } - - - public void SyncingCancelled () - { - Program.Controller.StopFetcher (); - - if (ChangePageEvent == null) - return; - - if (PendingInvite != null) - ChangePageEvent (PageType.Invite, null); - else - ChangePageEvent (PageType.Add, null); - } - - - // TODO: public void WindowClosed () { } - - - public void FinishedPageCompleted () - { - this.previous_address = ""; - this.previous_path = ""; - Program.Controller.UpdateState (); } @@ -393,6 +243,155 @@ namespace SparkleShare { } + public void CheckAddPage (string address, string remote_path, int selected_plugin) + { + if (SelectedPluginIndex != selected_plugin) + SelectedPluginChanged (selected_plugin); + + address = address.Trim (); + remote_path = remote_path.Trim (); + + bool fields_valid = address != null && address.Trim().Length > 0 && + remote_path != null && remote_path.Trim().Length > 0; + + if (UpdateAddProjectButtonEvent != null) + UpdateAddProjectButtonEvent (fields_valid); + } + + + public void AddPageCompleted (string address, string path) + { + SyncingFolder = Path.GetFileNameWithoutExtension (path); + PreviousAddress = address; + PreviousPath = path; + + if (ChangePageEvent != null) + ChangePageEvent (PageType.Syncing, null); + + // TODO: Remove events afterwards + + Program.Controller.FolderFetched += delegate (string [] warnings) { + if (ChangePageEvent != null) + ChangePageEvent (PageType.Finished, warnings); + + PreviousAddress = ""; + SyncingFolder = ""; + PreviousUrl = ""; + SelectedPlugin = Plugins [0]; + }; + + Program.Controller.FolderFetchError += delegate (string remote_url) { + Thread.Sleep (1000); + PreviousUrl = remote_url; + + if (ChangePageEvent != null) + ChangePageEvent (PageType.Error, null); + + SyncingFolder = ""; + }; + + Program.Controller.FolderFetching += delegate (double percentage) { + if (UpdateProgressBarEvent != null) + UpdateProgressBarEvent (percentage); + }; + + Program.Controller.FetchFolder (address, path); + } + + + // TODO: trailing slash should work + public SparkleInvite PendingInvite = new SparkleInvite ("ssh://git@github.com/", + "/hbons/Stuff", "http://www.sparkleshare.org/"); + + public void InvitePageCompleted () + { + SyncingFolder = Path.GetFileNameWithoutExtension (PendingInvite.RemotePath); + PreviousAddress = PendingInvite.Address; + PreviousPath = PendingInvite.RemotePath; + + if (ChangePageEvent != null) + ChangePageEvent (PageType.Syncing, null); + + if (!PendingInvite.Accept ()) { + if (ChangePageEvent != null) + ChangePageEvent (PageType.Error, null); + + return; + } + + + // TODO: Remove events afterwards + + Program.Controller.FolderFetched += delegate (string [] warnings) { + if (ChangePageEvent != null) + ChangePageEvent (PageType.Finished, warnings); + + + PreviousAddress = ""; + SyncingFolder = ""; + PreviousUrl = ""; + SelectedPlugin = Plugins [0]; + + PendingInvite = null; + }; + + Program.Controller.FolderFetchError += delegate (string remote_url) { + Thread.Sleep (1000); + PreviousUrl = remote_url; + + if (ChangePageEvent != null) + ChangePageEvent (PageType.Error, null); + + SyncingFolder = ""; + }; + + Program.Controller.FolderFetching += delegate (double percentage) { + if (UpdateProgressBarEvent != null) + UpdateProgressBarEvent (percentage); + }; + + Program.Controller.FetchFolder (PendingInvite.Address, PendingInvite.RemotePath); + } + + + public void SyncingCancelled () + { + Program.Controller.StopFetcher (); + + if (ChangePageEvent == null) + return; + + if (PendingInvite != null) + ChangePageEvent (PageType.Invite, null); + else + ChangePageEvent (PageType.Add, null); + } + + + public void ErrorPageCompleted () + { + if (ChangePageEvent == null) + return; + + if (PendingInvite != null) + ChangePageEvent (PageType.Invite, null); + else + ChangePageEvent (PageType.Add, null); + } + + + public void FinishPageCompleted () + { + PreviousAddress = ""; + PreviousPath = ""; + + Program.Controller.UpdateState (); + + if (HideWindowEvent != null) + HideWindowEvent (); + } + + private bool IsValidEmail (string email) { Regex regex = new Regex (@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index aa67810e..2328dc8e 100755 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -129,5 +129,11 @@ namespace SparkleShare { UpdateMenuEvent (IconState.Error); }; } + + + public void AddHostedProjectClicked () + { + Program.Controller.ShowSetupWindow (PageType.Add); + } } } From 17cc6230275dbefa24c3d8df3c8a4c899dfd126f Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 17 Feb 2012 01:26:27 +0100 Subject: [PATCH 11/53] invites: fix some potential edge cases --- SparkleShare/Mac/SparkleSetupWindow.cs | 3 +++ SparkleShare/Mac/SparkleUI.cs | 5 ++--- SparkleShare/SparkleSetupController.cs | 15 ++++++++++----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/SparkleShare/Mac/SparkleSetupWindow.cs b/SparkleShare/Mac/SparkleSetupWindow.cs index 7bdb249a..dbd194a2 100755 --- a/SparkleShare/Mac/SparkleSetupWindow.cs +++ b/SparkleShare/Mac/SparkleSetupWindow.cs @@ -137,6 +137,9 @@ namespace SparkleShare { NSApplication.SharedApplication.AddWindowsItem (this, "SparkleShare Setup", false); NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); MakeKeyAndOrderFront (this); + + if (Program.UI != null) + Program.UI.UpdateDockIconVisibility (); base.OrderFrontRegardless (); } diff --git a/SparkleShare/Mac/SparkleUI.cs b/SparkleShare/Mac/SparkleUI.cs index 0c268f2f..54b4d194 100755 --- a/SparkleShare/Mac/SparkleUI.cs +++ b/SparkleShare/Mac/SparkleUI.cs @@ -68,10 +68,9 @@ namespace SparkleShare { Setup = new SparkleSetup (); // About = new SparkleAbout (); - if (Program.Controller.FirstRun) { + if (Program.Controller.FirstRun) Program.Controller.ShowSetupWindow (PageType.Setup); - UpdateDockIconVisibility (); - } + } } diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 446a7c51..17249986 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -76,6 +76,7 @@ namespace SparkleShare { public string PreviousAddress { get; private set; } public string PreviousPath { get; private set; } public string SyncingFolder { get; private set; } + public SparkleInvite PendingInvite; public int SelectedPluginIndex { @@ -140,6 +141,13 @@ namespace SparkleShare { Program.Controller.ShowSetupWindowEvent += delegate (PageType page_type) { + if (PendingInvite != null) { + if (ShowWindowEvent != null) + ShowWindowEvent (); + + return; + } + if (ChangePageEvent != null) ChangePageEvent (page_type, null); @@ -154,7 +162,7 @@ namespace SparkleShare { public void PageCancelled () { - // PendingInvite = null; + PendingInvite = null; if (HideWindowEvent != null) HideWindowEvent (); @@ -299,14 +307,11 @@ namespace SparkleShare { } - // TODO: trailing slash should work - public SparkleInvite PendingInvite = new SparkleInvite ("ssh://git@github.com/", - "/hbons/Stuff", "http://www.sparkleshare.org/"); - public void InvitePageCompleted () { SyncingFolder = Path.GetFileNameWithoutExtension (PendingInvite.RemotePath); PreviousAddress = PendingInvite.Address; + // TODO: trailing slash should work PreviousPath = PendingInvite.RemotePath; if (ChangePageEvent != null) From 13f1cc07a0a49fa47dc07604e4c93a4a1a0d4187 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 17 Feb 2012 02:19:54 +0100 Subject: [PATCH 12/53] about: don't use eye bleeding orange with the new background --- SparkleShare/Mac/SparkleAbout.cs | 4 ++-- SparkleShare/Mac/SparkleSetup.cs | 2 +- SparkleShare/SparkleAbout.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Mac/SparkleAbout.cs b/SparkleShare/Mac/SparkleAbout.cs index 069ba2e2..8d662c05 100755 --- a/SparkleShare/Mac/SparkleAbout.cs +++ b/SparkleShare/Mac/SparkleAbout.cs @@ -65,7 +65,7 @@ namespace SparkleShare { InvokeOnMainThread (delegate { UpdatesTextField.StringValue = "A newer version (" + new_version + ") is available!"; UpdatesTextField.TextColor = - NSColor.FromCalibratedRgba (0.96f, 0.47f, 0.0f, 1.0f); // Tango Orange #2 + NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f); }); }; @@ -73,7 +73,7 @@ namespace SparkleShare { InvokeOnMainThread (delegate { UpdatesTextField.StringValue = "You are running the latest version."; UpdatesTextField.TextColor = - NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f); // Tango Sky Blue #1 + NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f); }); }; diff --git a/SparkleShare/Mac/SparkleSetup.cs b/SparkleShare/Mac/SparkleSetup.cs index 38f09160..31517352 100755 --- a/SparkleShare/Mac/SparkleSetup.cs +++ b/SparkleShare/Mac/SparkleSetup.cs @@ -384,7 +384,7 @@ namespace SparkleShare { TableView.SelectRow (Controller.SelectedPluginIndex, false); - (AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { + (AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage ( AddressTextField.StringValue, PathTextField.StringValue, diff --git a/SparkleShare/SparkleAbout.cs b/SparkleShare/SparkleAbout.cs index 6a35cf78..9e7a0d74 100755 --- a/SparkleShare/SparkleAbout.cs +++ b/SparkleShare/SparkleAbout.cs @@ -66,7 +66,7 @@ namespace SparkleShare { Controller.NewVersionEvent += delegate (string new_version) { Application.Invoke (delegate { - this.updates.Markup = String.Format ("{0}", + this.updates.Markup = String.Format ("{0}", String.Format (_("A newer version ({0}) is available!"), new_version)); this.updates.ShowAll (); From 0633e53a73d46c9b2501e28fc01d320f36bad068 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 17 Feb 2012 02:32:07 +0100 Subject: [PATCH 13/53] Warn about invalid invites --- SparkleShare/Mac/SparkleUI.cs | 10 ++++++---- SparkleShare/SparkleControllerBase.cs | 12 +++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/SparkleShare/Mac/SparkleUI.cs b/SparkleShare/Mac/SparkleUI.cs index 54b4d194..ab7dd363 100755 --- a/SparkleShare/Mac/SparkleUI.cs +++ b/SparkleShare/Mac/SparkleUI.cs @@ -95,8 +95,8 @@ namespace SparkleShare { public void UpdateDockIconVisibility () { - // if (true) { // TODO: check for open windows - + // TODO: check for open windows + // if (true) { ShowDockIcon (); // } else { @@ -105,13 +105,15 @@ namespace SparkleShare { } - private void HideDockIcon () { + private void HideDockIcon () + { // Currently not supported, here for completeness sake (see Apple's docs) // NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.None; } - private void ShowDockIcon () { + private void ShowDockIcon () + { NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular; } diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 5368cef8..ac5cac40 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -145,15 +145,21 @@ namespace SparkleShare { this.fetcher.IsActive) { if (AlertNotificationRaised != null) - AlertNotificationRaised ("SparkleShare Setup is busy", - "Please try again later"); + AlertNotificationRaised ("SparkleShare Setup seems busy", + "Please wait for it to finish"); } else { if (InviteReceived != null) { SparkleInvite invite = new SparkleInvite (args.FullPath); - if (invite.Valid) + if (invite.Valid) { InviteReceived (invite); + + } else { + if (AlertNotificationRaised != null) + AlertNotificationRaised ("Oh noes!", + "This invite seems screwed up..."); + } } } }; From 5de44918923f71a56e49588c2fba876d79b0b4e6 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 17 Feb 2012 02:48:41 +0100 Subject: [PATCH 14/53] fetcher git: add FIXME --- SparkleLib/Git/SparkleFetcherGit.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/SparkleLib/Git/SparkleFetcherGit.cs b/SparkleLib/Git/SparkleFetcherGit.cs index 88110bba..5446bb7a 100755 --- a/SparkleLib/Git/SparkleFetcherGit.cs +++ b/SparkleLib/Git/SparkleFetcherGit.cs @@ -28,23 +28,27 @@ namespace SparkleLib { private SparkleGit git; - public SparkleFetcherGit (string server, string remote_folder, string target_folder) : - base (server, remote_folder, target_folder) + public SparkleFetcherGit (string server, string remote_path, string target_folder) : + base (server, remote_path, target_folder) { if (server.EndsWith ("/")) server = server.Substring (0, server.Length - 1); - if (!remote_folder.StartsWith ("/")) - remote_folder = "/" + remote_folder; + // FIXME: Adding these lines makes the fetcher fail + // if (remote_path.EndsWith ("/")) + // remote_path = remote_path.Substring (0, remote_path.Length - 1); + + if (!remote_path.StartsWith ("/")) + remote_path = "/" + remote_path; Uri uri; try { - uri = new Uri (server + remote_folder); + uri = new Uri (server + remote_path); } catch (UriFormatException) { - uri = new Uri ("ssh://" + server + remote_folder); + uri = new Uri ("ssh://" + server + remote_path); } From 8bed56d70747a88d645027f0e06745d35391d436 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 17 Feb 2012 21:26:13 +0100 Subject: [PATCH 15/53] invites: upload the user's pubkey on invite accept --- SparkleLib/Git/SparkleRepoGit.cs | 11 ++++---- SparkleLib/Makefile.am | 1 + SparkleLib/SparkleChangeSet.cs | 16 ------------ SparkleLib/SparkleConfig.cs | 11 +++++++- SparkleLib/SparkleUser.cs | 36 +++++++++++++++++++++++++++ SparkleShare/SparkleControllerBase.cs | 2 +- SparkleShare/SparkleInvite.cs | 33 ++++++++++++++++++------ 7 files changed, 79 insertions(+), 31 deletions(-) create mode 100644 SparkleLib/SparkleUser.cs diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index a8bcec9f..a68cb9ab 100755 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -626,12 +626,11 @@ namespace SparkleLib { if (match.Success) { SparkleChangeSet change_set = new SparkleChangeSet (); - change_set.Folder = Name; - change_set.Revision = match.Groups [1].Value; - change_set.User.Name = match.Groups [2].Value; - change_set.User.Email = match.Groups [3].Value; - change_set.IsMagical = is_merge_commit; - change_set.Url = Url; + change_set.Folder = Name; + change_set.Revision = match.Groups [1].Value; + change_set.User = new SparkleUser (match.Groups [2].Value, match.Groups [3].Value); + change_set.IsMagical = is_merge_commit; + change_set.Url = Url; change_set.Timestamp = new DateTime (int.Parse (match.Groups [4].Value), int.Parse (match.Groups [5].Value), int.Parse (match.Groups [6].Value), diff --git a/SparkleLib/Makefile.am b/SparkleLib/Makefile.am index 30484fe1..ddd7498c 100755 --- a/SparkleLib/Makefile.am +++ b/SparkleLib/Makefile.am @@ -17,6 +17,7 @@ SOURCES = \ SparkleListenerFactory.cs \ SparkleListenerTcp.cs \ SparkleRepoBase.cs \ + SparkleUser.cs \ SparkleWatcher.cs diff --git a/SparkleLib/SparkleChangeSet.cs b/SparkleLib/SparkleChangeSet.cs index bc173ac3..ef29d56f 100755 --- a/SparkleLib/SparkleChangeSet.cs +++ b/SparkleLib/SparkleChangeSet.cs @@ -84,22 +84,6 @@ namespace SparkleLib { } - public class SparkleUser { - - public string Name; - public string Email; - - public string PublicKey; - - - public SparkleUser (string name, string email) - { - Name = name; - Email = email; - } - } - - public class SparkleFolder { public string Name; diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs index 405f05c4..ca01f402 100755 --- a/SparkleLib/SparkleConfig.cs +++ b/SparkleLib/SparkleConfig.cs @@ -145,7 +145,16 @@ namespace SparkleLib { XmlNode email_node = SelectSingleNode ("/sparkleshare/user/email/text()"); string email = email_node.Value; - return new SparkleUser (name, email); + string pubkey_file_path = Path.Combine ( + Path.GetDirectoryName (FullPath), + "sparkleshare." + email + ".key.pub" + ); + + SparkleUser user = new SparkleUser (name, email) { + PublicKey = File.ReadAllText (pubkey_file_path) + }; + + return user; } set { diff --git a/SparkleLib/SparkleUser.cs b/SparkleLib/SparkleUser.cs new file mode 100644 index 00000000..ef44bc41 --- /dev/null +++ b/SparkleLib/SparkleUser.cs @@ -0,0 +1,36 @@ +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +using System; + +namespace SparkleLib { + + public class SparkleUser { + + public readonly string Name; + public readonly string Email; + + public string PublicKey; + + + public SparkleUser (string name, string email) + { + Name = name; + Email = email; + } + } +} diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index ac5cac40..f9279baf 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -106,7 +106,7 @@ namespace SparkleShare { { } - + public virtual void Initialize () { InstallLauncher (); diff --git a/SparkleShare/SparkleInvite.cs b/SparkleShare/SparkleInvite.cs index 0b56ef56..2a219f78 100644 --- a/SparkleShare/SparkleInvite.cs +++ b/SparkleShare/SparkleInvite.cs @@ -16,7 +16,9 @@ using System; +using System.IO; using System.Net; +using System.Text; using System.Xml; using SparkleLib; @@ -77,17 +79,34 @@ namespace SparkleShare { public bool Accept () { - WebClient web_client = new WebClient (); - try { - web_client.DownloadData (AcceptUrl); - SparkleHelpers.DebugInfo ("Invite", "Uploaded public key"); + WebRequest request = WebRequest.Create (AcceptUrl); - return true; + request.Method = "POST"; + request.ContentType = "application/x-www-form-urlencoded"; + string post_data = "pubkey=" + SparkleConfig.DefaultConfig.User.PublicKey; + byte [] post_bytes = Encoding.UTF8.GetBytes (post_data); + request.ContentLength = post_bytes.Length; + + Stream data_stream = request.GetRequestStream (); + data_stream.Write (post_bytes, 0, post_bytes.Length); + data_stream.Close (); + + WebResponse response = request.GetResponse (); + response.Close (); + + + if ((response as HttpWebResponse).StatusCode == HttpStatusCode.OK) { + SparkleHelpers.DebugInfo ("Invite", "Uploaded public key to " + AcceptUrl); + return true; + + } else { + SparkleHelpers.DebugInfo ("Invite", "Failed uploading public key to " + AcceptUrl); + return false; + } } catch (WebException e) { - SparkleHelpers.DebugInfo ("Invite", - "Failed uploading public key: " + e.Message); + SparkleHelpers.DebugInfo ("Invite", "Failed uploading public key to " + AcceptUrl + ": " + e.Message); return false; } From 1980a81204e878885a652eae3f5ed34d1fb53200 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 18 Feb 2012 00:06:33 +0100 Subject: [PATCH 16/53] about: move more logic to controller --- SparkleShare/Mac/SparkleAbout.cs | 42 +++++++++++++++++---- SparkleShare/Mac/SparkleStatusIcon.cs | 12 +----- SparkleShare/Mac/SparkleUI.cs | 6 +-- SparkleShare/SparkleAboutController.cs | 28 ++++++++------ SparkleShare/SparkleStatusIconController.cs | 6 +++ 5 files changed, 61 insertions(+), 33 deletions(-) diff --git a/SparkleShare/Mac/SparkleAbout.cs b/SparkleShare/Mac/SparkleAbout.cs index 8d662c05..a00d5771 100755 --- a/SparkleShare/Mac/SparkleAbout.cs +++ b/SparkleShare/Mac/SparkleAbout.cs @@ -54,12 +54,17 @@ namespace SparkleShare { CreateAbout (); - NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); - MakeKeyAndOrderFront (this); + Controller.HideWindowEvent += delegate { + InvokeOnMainThread (delegate { + PerformClose (this); + }); + }; - OrderFrontRegardless (); - - Program.UI.UpdateDockIconVisibility (); + Controller.ShowWindowEvent += delegate { + InvokeOnMainThread (delegate { + OrderFrontRegardless (); + }); + }; Controller.NewVersionEvent += delegate (string new_version) { InvokeOnMainThread (delegate { @@ -157,6 +162,29 @@ namespace SparkleShare { ContentView.AddSubview (UpdatesTextField); ContentView.AddSubview (CreditsTextField); } + + + public override void OrderFrontRegardless () + { + NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); + MakeKeyAndOrderFront (this); + + if (Program.UI != null) + Program.UI.UpdateDockIconVisibility (); + + base.OrderFrontRegardless (); + } + + + public override void PerformClose (NSObject sender) + { + base.OrderOut (this); + + if (Program.UI != null) + Program.UI.UpdateDockIconVisibility (); + + return; + } } @@ -164,9 +192,7 @@ namespace SparkleShare { public override bool WindowShouldClose (NSObject sender) { - (sender as SparkleAbout).OrderOut (this); - Program.UI.UpdateDockIconVisibility (); - + (sender as SparkleAbout).Controller.HideWindow (); return false; } } diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleStatusIcon.cs index b83dcbd2..0638679d 100755 --- a/SparkleShare/Mac/SparkleStatusIcon.cs +++ b/SparkleShare/Mac/SparkleStatusIcon.cs @@ -294,18 +294,8 @@ namespace SparkleShare { Enabled = true }; - // TODO: move this logic AboutMenuItem.Activated += delegate { - // Controller.AboutClicked (); - InvokeOnMainThread (delegate { - NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); - - if (SparkleUI.About == null) - SparkleUI.About = new SparkleAbout (); - else - SparkleUI.About.OrderFrontRegardless (); - - }); + Controller.AboutClicked (); }; Menu.AddItem (AboutMenuItem); diff --git a/SparkleShare/Mac/SparkleUI.cs b/SparkleShare/Mac/SparkleUI.cs index ab7dd363..cc28d9de 100755 --- a/SparkleShare/Mac/SparkleUI.cs +++ b/SparkleShare/Mac/SparkleUI.cs @@ -64,9 +64,9 @@ namespace SparkleShare { ("Lucida Grande", NSFontTraitMask.Bold, 0, 13); StatusIcon = new SparkleStatusIcon (); - Bubbles = new SparkleBubbles (); - Setup = new SparkleSetup (); - // About = new SparkleAbout (); + Bubbles = new SparkleBubbles (); + Setup = new SparkleSetup (); + About = new SparkleAbout (); if (Program.Controller.FirstRun) Program.Controller.ShowSetupWindow (PageType.Setup); diff --git a/SparkleShare/SparkleAboutController.cs b/SparkleShare/SparkleAboutController.cs index 801d84a6..a16da088 100755 --- a/SparkleShare/SparkleAboutController.cs +++ b/SparkleShare/SparkleAboutController.cs @@ -26,6 +26,12 @@ namespace SparkleShare { public class SparkleAboutController { + public event ShowWindowEventHandler ShowWindowEvent; + public delegate void ShowWindowEventHandler (); + + public event HideWindowEventHandler HideWindowEvent; + public delegate void HideWindowEventHandler (); + public event NewVersionEventHandler NewVersionEvent; public delegate void NewVersionEventHandler (string new_version); @@ -35,32 +41,34 @@ namespace SparkleShare { public event CheckingForNewVersionEventHandler CheckingForNewVersionEvent; public delegate void CheckingForNewVersionEventHandler (); + public string RunningVersion { get { return SparkleBackend.Version; } } - // Check for a new version once a day - private System.Timers.Timer version_checker = new System.Timers.Timer () { - Enabled = true, - Interval = 24 * 60 * 60 * 1000 - }; - public SparkleAboutController () { - CheckForNewVersion (); + Program.Controller.ShowAboutWindowEvent += delegate { + if (ShowWindowEvent != null) + ShowWindowEvent (); - this.version_checker.Elapsed += delegate { CheckForNewVersion (); }; } + public void HideWindow () + { + if (HideWindowEvent != null) + HideWindowEvent (); + } + + public void CheckForNewVersion () { - this.version_checker.Stop (); if (CheckingForNewVersionEvent != null) CheckingForNewVersionEvent (); @@ -92,8 +100,6 @@ namespace SparkleShare { if (NewVersionEvent != null) NewVersionEvent (result); } - - this.version_checker.Start (); }; web_client.DownloadStringAsync (uri); diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index 2328dc8e..543e9b6a 100755 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -135,5 +135,11 @@ namespace SparkleShare { { Program.Controller.ShowSetupWindow (PageType.Add); } + + + public void AboutClicked () + { + Program.Controller.ShowAboutWindow (); + } } } From aa610c818ee991418282f9fb669799f3354ba602 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 18 Feb 2012 01:01:24 +0100 Subject: [PATCH 17/53] event log, bubbles: move more logic to controllers --- SparkleShare/Mac/SparkleAbout.cs | 2 +- SparkleShare/Mac/SparkleBubbles.cs | 16 ++----- SparkleShare/Mac/SparkleEventLog.cs | 48 +++++++++++++++++---- SparkleShare/Mac/SparkleStatusIcon.cs | 12 +----- SparkleShare/Mac/SparkleUI.cs | 6 +-- SparkleShare/SparkleAboutController.cs | 2 +- SparkleShare/SparkleBubblesController.cs | 6 +++ SparkleShare/SparkleControllerBase.cs | 10 ++--- SparkleShare/SparkleEventLogController.cs | 18 ++++++++ SparkleShare/SparkleStatusIconController.cs | 6 +++ 10 files changed, 83 insertions(+), 43 deletions(-) diff --git a/SparkleShare/Mac/SparkleAbout.cs b/SparkleShare/Mac/SparkleAbout.cs index a00d5771..3f3999fa 100755 --- a/SparkleShare/Mac/SparkleAbout.cs +++ b/SparkleShare/Mac/SparkleAbout.cs @@ -192,7 +192,7 @@ namespace SparkleShare { public override bool WindowShouldClose (NSObject sender) { - (sender as SparkleAbout).Controller.HideWindow (); + (sender as SparkleAbout).Controller.WindowClosed (); return false; } } diff --git a/SparkleShare/Mac/SparkleBubbles.cs b/SparkleShare/Mac/SparkleBubbles.cs index 8f169c6c..a36443f7 100755 --- a/SparkleShare/Mac/SparkleBubbles.cs +++ b/SparkleShare/Mac/SparkleBubbles.cs @@ -26,12 +26,12 @@ namespace SparkleShare { public class SparkleBubbles : NSObject { - private SparkleBubblesController controller = new SparkleBubblesController (); + public SparkleBubblesController Controller = new SparkleBubblesController (); public SparkleBubbles () { - this.controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) { + Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) { InvokeOnMainThread (delegate { if (!GrowlApplicationBridge.IsGrowlRunning ()) { NSApplication.SharedApplication.RequestUserAttention ( @@ -68,17 +68,7 @@ namespace SparkleShare { [Export("growlNotificationWasClicked")] public override void GrowlNotificationWasClicked (NSObject o) { - InvokeOnMainThread (delegate { - NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); - - if (SparkleUI.EventLog == null) - SparkleUI.EventLog = new SparkleEventLog (); - - SparkleUI.EventLog.Controller.SelectedFolder = null; - - SparkleUI.EventLog.OrderFrontRegardless (); - SparkleUI.EventLog.MakeKeyAndOrderFront (this); - }); + SparkleUI.Bubbles.Controller.BubbleClicked (); } } } diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs index fc03e6fa..8c8d9797 100755 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/SparkleEventLog.cs @@ -149,13 +149,22 @@ namespace SparkleShare { }; - UpdateContent (null); - UpdateChooser (null); - OrderFrontRegardless (); - - Program.UI.UpdateDockIconVisibility (); - // Hook up the controller events + Controller.HideWindowEvent += delegate { + InvokeOnMainThread (delegate { + PerformClose (this); + }); + }; + + Controller.ShowWindowEvent += delegate { + InvokeOnMainThread (delegate { + OrderFrontRegardless (); + + UpdateContent (null); + UpdateChooser (null); + }); + }; + Controller.UpdateChooserEvent += delegate (string [] folders) { InvokeOnMainThread (delegate { UpdateChooser (folders); @@ -265,6 +274,29 @@ namespace SparkleShare { thread.Start (); } } + + + public override void OrderFrontRegardless () + { + NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); + MakeKeyAndOrderFront (this); + + if (Program.UI != null) + Program.UI.UpdateDockIconVisibility (); + + base.OrderFrontRegardless (); + } + + + public override void PerformClose (NSObject sender) + { + base.OrderOut (this); + + if (Program.UI != null) + Program.UI.UpdateDockIconVisibility (); + + return; + } } @@ -272,9 +304,7 @@ namespace SparkleShare { public override bool WindowShouldClose (NSObject sender) { - (sender as SparkleEventLog).OrderOut (this); - Program.UI.UpdateDockIconVisibility (); - + (sender as SparkleEventLog).Controller.WindowClosed (); return false; } } diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleStatusIcon.cs index 0638679d..c539859e 100755 --- a/SparkleShare/Mac/SparkleStatusIcon.cs +++ b/SparkleShare/Mac/SparkleStatusIcon.cs @@ -249,18 +249,8 @@ namespace SparkleShare { }; if (Controller.Folders.Length > 0) { - // TODO: move this logic RecentEventsMenuItem.Activated += delegate { - // Controller.OpenRecentEventsClicked () - InvokeOnMainThread (delegate { - NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); - - if (SparkleUI.EventLog == null) - SparkleUI.EventLog = new SparkleEventLog (); - - SparkleUI.EventLog.OrderFrontRegardless (); - SparkleUI.EventLog.MakeKeyAndOrderFront (this); - }); + Controller.OpenRecentEventsClicked (); }; } diff --git a/SparkleShare/Mac/SparkleUI.cs b/SparkleShare/Mac/SparkleUI.cs index cc28d9de..54712290 100755 --- a/SparkleShare/Mac/SparkleUI.cs +++ b/SparkleShare/Mac/SparkleUI.cs @@ -63,14 +63,14 @@ namespace SparkleShare { BoldFont = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Bold, 0, 13); - StatusIcon = new SparkleStatusIcon (); - Bubbles = new SparkleBubbles (); Setup = new SparkleSetup (); + EventLog = new SparkleEventLog (); About = new SparkleAbout (); + Bubbles = new SparkleBubbles (); + StatusIcon = new SparkleStatusIcon (); if (Program.Controller.FirstRun) Program.Controller.ShowSetupWindow (PageType.Setup); - } } diff --git a/SparkleShare/SparkleAboutController.cs b/SparkleShare/SparkleAboutController.cs index a16da088..776552fd 100755 --- a/SparkleShare/SparkleAboutController.cs +++ b/SparkleShare/SparkleAboutController.cs @@ -60,7 +60,7 @@ namespace SparkleShare { } - public void HideWindow () + public void WindowClosed () { if (HideWindowEvent != null) HideWindowEvent (); diff --git a/SparkleShare/SparkleBubblesController.cs b/SparkleShare/SparkleBubblesController.cs index 48c7e36b..2b1b7cff 100755 --- a/SparkleShare/SparkleBubblesController.cs +++ b/SparkleShare/SparkleBubblesController.cs @@ -51,6 +51,12 @@ namespace SparkleShare { } + public void BubbleClicked () + { + Program.Controller.ShowEventLogWindow (); + } + + private string FormatMessage (SparkleChangeSet change_set) { string file_name = ""; diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index f9279baf..42d9d4fd 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -47,8 +47,8 @@ namespace SparkleShare { public event ShowAboutWindowEventHandler ShowAboutWindowEvent; public delegate void ShowAboutWindowEventHandler (); - public event ShowEventsWindowEventHandler ShowEventsWindowEvent; - public delegate void ShowEventsWindowEventHandler (); + public event ShowEventLogWindowEventHandler ShowEventLogWindowEvent; + public delegate void ShowEventLogWindowEventHandler (); public event FolderFetchedEventHandler FolderFetched; @@ -224,10 +224,10 @@ namespace SparkleShare { } - public void ShowEventsWindow () + public void ShowEventLogWindow () { - if (ShowEventsWindowEvent != null) - ShowEventsWindowEvent (); + if (ShowEventLogWindowEvent != null) + ShowEventLogWindowEvent (); } diff --git a/SparkleShare/SparkleEventLogController.cs b/SparkleShare/SparkleEventLogController.cs index 3615fcb8..97b6fefd 100755 --- a/SparkleShare/SparkleEventLogController.cs +++ b/SparkleShare/SparkleEventLogController.cs @@ -28,6 +28,12 @@ namespace SparkleShare { public class SparkleEventLogController { + public event ShowWindowEventHandler ShowWindowEvent; + public delegate void ShowWindowEventHandler (); + + public event HideWindowEventHandler HideWindowEvent; + public delegate void HideWindowEventHandler (); + public event UpdateContentEventEventHandler UpdateContentEvent; public delegate void UpdateContentEventEventHandler (string html); @@ -146,6 +152,11 @@ namespace SparkleShare { public SparkleEventLogController () { + Program.Controller.ShowEventLogWindowEvent += delegate { + if (ShowWindowEvent != null) + ShowWindowEvent (); + }; + Program.Controller.AvatarFetched += delegate { if (UpdateContentEvent != null) UpdateContentEvent (HTML); @@ -178,6 +189,13 @@ namespace SparkleShare { } + public void WindowClosed () + { + if (HideWindowEvent != null) + HideWindowEvent (); + } + + public void LinkClicked (string url) { if (url.StartsWith (Path.VolumeSeparatorChar.ToString ())) { diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index 543e9b6a..dcf383a2 100755 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -141,5 +141,11 @@ namespace SparkleShare { { Program.Controller.ShowAboutWindow (); } + + + public void OpenRecentEventsClicked () + { + Program.Controller.ShowEventLogWindow (); + } } } From 35a7c13422ad3a7b135f4e5cdf69d06c5140b894 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 18 Feb 2012 01:52:17 +0100 Subject: [PATCH 18/53] controller: use a lock for accessing Repositories. Fixes rare crashes when multiple threads want access --- SparkleShare/SparkleControllerBase.cs | 113 +++++++++++++++----------- 1 file changed, 65 insertions(+), 48 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 42d9d4fd..38d3b3bd 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -34,7 +34,7 @@ namespace SparkleShare { public abstract class SparkleControllerBase { - public List Repositories; + public List Repositories = new List (); public readonly string SparklePath = SparkleConfig.DefaultConfig.FoldersPath; public double ProgressPercentage = 0.0; @@ -93,6 +93,7 @@ namespace SparkleShare { private List failed_avatars = new List (); private Object avatar_lock = new Object (); + private Object repo_lock = new Object (); // Short alias for the translations @@ -200,10 +201,12 @@ namespace SparkleShare { get { List unsynced_folders = new List (); - foreach (SparkleRepoBase repo in Repositories) { - if (repo.HasUnsyncedChanges) - unsynced_folders.Add (repo.Name); - } + lock (this.repo_lock) { + foreach (SparkleRepoBase repo in Repositories) { + if (repo.HasUnsyncedChanges) + unsynced_folders.Add (repo.Name); + } + } return unsynced_folders; } @@ -236,13 +239,15 @@ namespace SparkleShare { { List list = new List (); - foreach (SparkleRepoBase repo in Repositories) { - List change_sets = repo.GetChangeSets (30); - - if (change_sets != null) - list.AddRange (change_sets); - else - SparkleHelpers.DebugInfo ("Log", "Could not create log for " + repo.Name); + lock (this.repo_lock) { + foreach (SparkleRepoBase repo in Repositories) { + List change_sets = repo.GetChangeSets (30); + + if (change_sets != null) + list.AddRange (change_sets); + else + SparkleHelpers.DebugInfo ("Log", "Could not create log for " + repo.Name); + } } list.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp))); @@ -262,10 +267,12 @@ namespace SparkleShare { string path = Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, name); int log_size = 50; - - foreach (SparkleRepoBase repo in Repositories) { - if (repo.LocalPath.Equals (path)) - return repo.GetChangeSets (log_size); + + lock (this.repo_lock) { + foreach (SparkleRepoBase repo in Repositories) { + if (repo.LocalPath.Equals (path)) + return repo.GetChangeSets (log_size); + } } return null; @@ -553,19 +560,20 @@ namespace SparkleShare { bool has_syncing_repos = false; bool has_unsynced_repos = false; - foreach (SparkleRepoBase repo in Repositories) { - if (repo.Status == SyncStatus.SyncDown || - repo.Status == SyncStatus.SyncUp || - repo.IsBuffering) { - - has_syncing_repos = true; - - } else if (repo.HasUnsyncedChanges) { - has_unsynced_repos = true; + lock (this.repo_lock) { + foreach (SparkleRepoBase repo in Repositories) { + if (repo.Status == SyncStatus.SyncDown || + repo.Status == SyncStatus.SyncUp || + repo.IsBuffering) { + + has_syncing_repos = true; + + } else if (repo.HasUnsyncedChanges) { + has_unsynced_repos = true; + } } } - if (has_syncing_repos) { if (OnSyncing != null) OnSyncing (); @@ -646,7 +654,10 @@ namespace SparkleShare { }; - Repositories.Add (repo); + lock (this.repo_lock) { + Repositories.Add (repo); + } + repo.Initialize (); } @@ -657,14 +668,16 @@ namespace SparkleShare { { string folder_name = Path.GetFileName (folder_path); - for (int i = 0; i < Repositories.Count; i++) { - SparkleRepoBase repo = Repositories [i]; - - if (repo.Name.Equals (folder_name)) { - repo.Dispose (); - Repositories.Remove (repo); - repo = null; - break; + lock (this.repo_lock) { + for (int i = 0; i < Repositories.Count; i++) { + SparkleRepoBase repo = Repositories [i]; + + if (repo.Name.Equals (folder_name)) { + repo.Dispose (); + Repositories.Remove (repo); + repo = null; + break; + } } } } @@ -674,8 +687,6 @@ namespace SparkleShare { // folders in the SparkleShare folder private void PopulateRepositories () { - Repositories = new List (); - foreach (string folder_name in SparkleConfig.DefaultConfig.Folders) { string folder_path = new SparkleFolder (folder_name).FullPath; @@ -1077,12 +1088,14 @@ namespace SparkleShare { // quits if safe public void TryQuit () { - foreach (SparkleRepoBase repo in Repositories) { - if (repo.Status == SyncStatus.SyncUp || - repo.Status == SyncStatus.SyncDown || - repo.IsBuffering) { - - return; + lock (this.repo_lock) { + foreach (SparkleRepoBase repo in Repositories) { + if (repo.Status == SyncStatus.SyncUp || + repo.Status == SyncStatus.SyncDown || + repo.IsBuffering) { + + return; + } } } @@ -1092,8 +1105,10 @@ namespace SparkleShare { public void Quit () { - foreach (SparkleRepoBase repo in Repositories) - repo.Dispose (); + lock (this.repo_lock) { + foreach (SparkleRepoBase repo in Repositories) + repo.Dispose (); + } Environment.Exit (0); } @@ -1104,9 +1119,11 @@ namespace SparkleShare { folder_name = folder_name.Replace ("%20", " "); note = note.Replace ("%20", " "); - foreach (SparkleRepoBase repo in Repositories) { - if (repo.Name.Equals (folder_name)) - repo.AddNote (revision, note); + lock (this.repo_lock) { + foreach (SparkleRepoBase repo in Repositories) { + if (repo.Name.Equals (folder_name)) + repo.AddNote (revision, note); + } } } From 11ddb6ee119d799f7129512dcb12fc08dcfb1aba Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 18 Feb 2012 17:01:50 +0100 Subject: [PATCH 19/53] gitignore: remove *.app --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index d2e01e5f..b147f35b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ *.exe *.exe.mdb *.userprefs -*.app *.pidb *.gmo po/POTFILES From f5fa48f46c91eb60c4f60159928859492ccf5138 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 18 Feb 2012 17:03:34 +0100 Subject: [PATCH 20/53] Add a skeleton sparkleshare:// protocol handler on the mac --- .../Contents/Info.plist | 58 ++++++++++++++++++ .../Contents/MacOS/applet | Bin 0 -> 34480 bytes .../Contents/PkgInfo | 1 + .../Contents/Resources/Scripts/main.scpt | Bin 0 -> 670 bytes .../Contents/Resources/applet.icns | Bin 0 -> 40291 bytes .../Contents/Resources/applet.rsrc | Bin 0 -> 362 bytes .../Resources/description.rtfd/TXT.rtf | 4 ++ 7 files changed, 63 insertions(+) create mode 100644 SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Info.plist create mode 100755 SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/MacOS/applet create mode 100644 SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/PkgInfo create mode 100644 SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Resources/Scripts/main.scpt create mode 100644 SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Resources/applet.icns create mode 100644 SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Resources/applet.rsrc create mode 100644 SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Resources/description.rtfd/TXT.rtf diff --git a/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Info.plist b/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Info.plist new file mode 100644 index 00000000..342a3160 --- /dev/null +++ b/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Info.plist @@ -0,0 +1,58 @@ + + + + +CFBundleURLTypes + + + CFBundleURLName + SparkleShareInviteOpener + CFBundleURLSchemes + + sparkleshare + + + + + CFBundleIdentifier + org.sparkleshare.SparkleShareInviteOpener + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + English + CFBundleExecutable + applet + CFBundleIconFile + applet + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + SparkleShareInviteOpen + CFBundlePackageType + APPL + CFBundleSignature + aplt + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + WindowState + + dividerCollapsed + + eventLogLevel + -1 + name + ScriptWindowState + positionOfDivider + 333 + savedFrame + 3 178 602 597 0 0 1280 778 + selectedTabView + result + + + diff --git a/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/MacOS/applet b/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/MacOS/applet new file mode 100755 index 0000000000000000000000000000000000000000..0079f4b19d448615de26af5c84a0a6195d511bfc GIT binary patch literal 34480 zcmeHP3tWuZ`+sMeGNrq8K{ZjRXx?rVi&C>?3z6J2rfI5C&9pO9$+D${B)7$C<&vyh zSuAo}6s=H5ZlQI*l*-b&Bv$|DnM!wS`en~RHlJP5rqJS0EGaB0EGaB0EGaB0EGaB z0EGaB0EGaBz<&|~=b9Vd!b?64Uh-4u&~XEB{#pc)PO#*|u)sJtE;q>Ak28@odZawL z%?0)jK1;}_3JP+$V>si-v@I^LkJ}FFq>SSRgr?GAHkT_COqXFuLGAek>ce0lYl$)+ z<2bHXVh|~zb8t5 zq_RB5Ki$80QKC>3&J~Ix#2?_tf(gU%1}XVr{8Pl`3Zl3X5?-u8QL26a;*|VU_+cFG zjgJz}>wNjV`g)J?Rx4(x=$Cvu36mi%C#A34SRxq8WG**OB94T9aT9nFm<}%Y!~A+H z%OgKkT~(60&*h3@xYDH9FmVhwP9}MeUvFjqRNcb3`Z#eu)#F@l4DVC?Je2&*m7T!2 zdVSS>tm-3|%NNJSibe0@ZO0p=EQsTJ5Cwh|_;~MPeig(Kv+*_r5eI%pa6#aZ zkiW`d`A^N82h_)Q+Y>w{1PdH)O0wgn5_XI*j2)g76Ap2tuHdjA2lV#1m4&+B$x9G< z*E3g&Y#|MxgwE;URlb(&2Os<3fC>L%Qmt2?>jsV+@y0PK)(dwC(Fk^Ml2j&$Wd{nw zBs@tH`%8SZ6UCBfDceUZ5d;e)2|~U=>Lh>UF`YeDAdw2iA}QOuO$p$Jgzb2Md)Ll7 zh(S9l%mH^rlTJgO0DoZ^WCQgChd5WT6!T}Pio<*snLvah3IPfM3IPfM3IPg%|4Ia= z5&jwX{nPF}@z0#a^v{Yn%x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>mEWvzT?QRUOo|Z>t`Sq7QTo&@$#>ZtRv&B zB>|p|e)HD9Z+$<``S)ADS!c#sO8`6@{ntysqs$tH)lGk%rTp%t|5|^>SyO^-yAC|` z>>K~Qm26b;&o`cZ=)j6K&RR^?YD3xR-p7x<=epi(G~)W+F|@#2XS!XBH_-;!=&lE! ze*JGn>&Zsn7ya$^rysn_=o;tdtc<^*%SP{7_1@I;y_WB8G~*cOy=Veh9=`gA?6sGN z-(~&&)zubwYmvWs8_Gt9fAQSAXXR^{Kz`<(=YDbcCTpCV^D_Pho{gS(iYTc2a0@fengZyuk>|L91mm7toN?Ba0A-_RUjJLEJ{x^s`nT7g+2V||rU1Il zstvJO9kf|xOSu+}&9xDm)mQ(V_1(gES%1Dw8D}jK7dNYlwYQXO(b!xYzFB?Z`0K}? zSaVCcIVNlNhJ<|Z!ABlE2 Date: Sat, 18 Feb 2012 18:24:17 +0100 Subject: [PATCH 21/53] mac: implement protocol handler --- .../Contents/Info.plist | 31 +++++++++--------- .../Contents/Resources/Scripts/main.scpt | Bin 670 -> 3058 bytes 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Info.plist b/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Info.plist index 342a3160..72862b4c 100644 --- a/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Info.plist +++ b/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Info.plist @@ -2,20 +2,6 @@ -CFBundleURLTypes - - - CFBundleURLName - SparkleShareInviteOpener - CFBundleURLSchemes - - sparkleshare - - - - - CFBundleIdentifier - org.sparkleshare.SparkleShareInviteOpener CFBundleAllowMixedLocalizations CFBundleDevelopmentRegion @@ -24,6 +10,8 @@ applet CFBundleIconFile applet + CFBundleIdentifier + org.sparkleshare.SparkleShareInviteOpener CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -32,6 +20,17 @@ APPL CFBundleSignature aplt + CFBundleURLTypes + + + CFBundleURLName + SparkleShareInviteOpener + CFBundleURLSchemes + + sparkleshare + + + LSMinimumSystemVersionByArchitecture x86_64 @@ -50,9 +49,9 @@ positionOfDivider 333 savedFrame - 3 178 602 597 0 0 1280 778 + 263 111 773 597 0 0 1280 778 selectedTabView - result + event log diff --git a/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Resources/Scripts/main.scpt b/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Resources/Scripts/main.scpt index 8bf0be90cf3ad70e851dfc455ff1ab0aee92717d..50aefc0f2966bf12196e603050fe0970fca88bad 100644 GIT binary patch literal 3058 zcmaJ@>338`9=-2%lfbJ~Ck?29U~H8TSpo^;8r)C<>M%wjIE>?nSvm`LI|sOAHMf6Gl7}#w%~{) zj=&;ZizQf#L9`=>E0IB3quy|o)|)nXS=ff9iidm2;8%$B`CvDi19mAV^*Lp9(3mh`mKhci7~|aZH(X6SCwIw z)_sH7{5nt<4+;aRl*R05ozlXu%K4RYbLqiMduO_k9xlMFi3V*N_?Ro?QpQ&tvplhEPiTn7DBp}J~I3WQyUTQ?#p($ zMJv@-@k5JMV~aj8{2&xIdaSgLA3FHN73%UaB0bN?dD?$IF0g`8BAtRiVzm|cSvdv7 z@F!eo1zwXzo_Oc|fbTob8ScthTo}!}K)o06J@etld2qD5`dye=cY z74WT5i+o%prR#8s6@*GF#DsswdMgNBti>$%tRPfBU0nY+Ty6!S&!Q{7X82lZ<}5BBb9)1> zu-Fi}H&fTls{vmvx_w17FV5mC0beP)eVO#Oqr(b9z18CBPIOs8cv7py5@~c>L3mPi z_n;>sp3&jzO^Ra_i0;V5S-NmuHhj6%HH)q>&tEcpsr0pv4q4ELjaCp^P%E<3eQE`v z=Q_@O(eTCbHDW~!qXh`vNm(lh3owP__(H%JihgIKdEGdCKH&33zc)(j0H3p>1#h(~ zcdjmoK`ZJGbNK4$p%gcXL5O=Q3- z5wE^<_$VLY!+eMj@&VPrd@SPqBIsqjFW{pJqx<%V@sawffDgN9>l34#4@DmpF+Qj% z?fd-?8Y5|w5n;glCb?*md;;~`7wp)%YxkZCl-2F6YuVDeU}WF^{)Gry?ruFWQg^WK z`nruejFk!9>k8(*SkA4yM;~QZbBob%GVKX&g&*hL7>)^I34Qs*z`J-SHyhqnS`~(O zjw2$&&Ee~D(_QtLb=! zG!`^QOoX*I`^Cy{@fJrmjn+;*0SsDbH3#>_n|D1}u;>#mJcA89Mg|Q94gcA*!(j=J zJ`ksO8X$u#y$Po4Z^owgwOtK#)eKjCwdr+Dl!q)gDydIBLH%fOLA`(OD?@J(FV9;K TTUTkAE-LCW Date: Sat, 18 Feb 2012 18:30:31 +0100 Subject: [PATCH 22/53] mac: Add SparkleShareInviteOpener.app to the bundle --- SparkleShare/Mac/SparkleShare.csproj | 4 +- SparkleShare/sparkleshare-invite-open.cs | 66 ++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 SparkleShare/sparkleshare-invite-open.cs diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj index 23783cbb..9afb571a 100755 --- a/SparkleShare/Mac/SparkleShare.csproj +++ b/SparkleShare/Mac/SparkleShare.csproj @@ -24,7 +24,7 @@ false - + @@ -59,7 +59,7 @@ False - + False ..\..\bin\SparkleLib.dll diff --git a/SparkleShare/sparkleshare-invite-open.cs b/SparkleShare/sparkleshare-invite-open.cs new file mode 100644 index 00000000..7a8b812f --- /dev/null +++ b/SparkleShare/sparkleshare-invite-open.cs @@ -0,0 +1,66 @@ +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +using System; +using System.IO; +using System.Net; + +namespace SparkleShare { + + public class SparkleShare { + + public static void Main (string [] args) { + + new SparkleInviteOpen (args [0]); + } + } + + + public class SparkleInviteOpen { + + public SparkleInviteOpen (string url) + { + string safe_url = url.Replace ("sparkleshare://", "https://"); + string unsafe_url = url.Replace ("sparkleshare://", "http://"); + string xml = ""; + + WebClient web_client = new WebClient (); + + try { + xml = web_client.DownloadString (safe_url); + + } catch { + Console.WriteLine ("Failed downloading invite: " + safe_url); + + try { + xml = web_client.DownloadString (safe_url); + + } catch { + Console.WriteLine ("Failed downloading invite: " + unsafe_url); + } + } + + string home_path = Environment.GetFolderPath (Environment.SpecialFolder.Personal); + string target_path = Path.Combine (home_path, "SparkleShare"); + + if (xml.Contains ("")) { + File.WriteAllText (target_path, xml); + Console.WriteLine ("Downloaded invite: " + safe_url); + } + } + } +} From bdce13998eebfb9e6155a884d3f1996de8ea1aed Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 18 Feb 2012 19:01:50 +0100 Subject: [PATCH 23/53] Fix a broken path in project file --- SparkleShare/Mac/SparkleShare.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj index 9afb571a..fb99e7b9 100755 --- a/SparkleShare/Mac/SparkleShare.csproj +++ b/SparkleShare/Mac/SparkleShare.csproj @@ -24,7 +24,7 @@ false - + From 710d5db7dca0af9dfd7d48d52c21ac6dd7a6b83c Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 18 Feb 2012 20:50:05 +0100 Subject: [PATCH 24/53] Remove invite after import --- SparkleShare/SparkleControllerBase.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 38d3b3bd..6c8ca830 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -161,6 +161,8 @@ namespace SparkleShare { AlertNotificationRaised ("Oh noes!", "This invite seems screwed up..."); } + + File.Delete (args.FullPath); } } }; @@ -1055,6 +1057,8 @@ namespace SparkleShare { } catch (Exception e) { SparkleHelpers.DebugInfo ("Controller", "Error moving folder: " + e.Message); } + + this.fetcher = null; }; this.fetcher.Failed += delegate { @@ -1065,6 +1069,8 @@ namespace SparkleShare { if (Directory.Exists (tmp_path)) Directory.Delete (tmp_path, true); + + this.fetcher = null; }; this.fetcher.ProgressChanged += delegate (double percentage) { From 19797fdc5fe66459ef2012025ff229d085eb9498 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 18 Feb 2012 23:16:25 +0100 Subject: [PATCH 25/53] fetcher: always finish the progress reporting animation smoothly to 100% --- SparkleLib/Git/SparkleFetcherGit.cs | 13 +++++++++++++ SparkleLib/SparkleFetcherBase.cs | 2 +- SparkleShare/SparkleSetupController.cs | 1 - 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/SparkleLib/Git/SparkleFetcherGit.cs b/SparkleLib/Git/SparkleFetcherGit.cs index 5446bb7a..0b7f7e4f 100755 --- a/SparkleLib/Git/SparkleFetcherGit.cs +++ b/SparkleLib/Git/SparkleFetcherGit.cs @@ -19,6 +19,7 @@ using System; using System.IO; using System.Diagnostics; using System.Text.RegularExpressions; +using System.Threading; namespace SparkleLib { @@ -136,6 +137,18 @@ namespace SparkleLib { this.git.WaitForExit (); SparkleHelpers.DebugInfo ("Git", "Exit code " + this.git.ExitCode.ToString ()); + while (percentage < 100) { + percentage += 25; + + if (percentage >= 100) + break; + + base.OnProgressChanged (percentage); + Thread.Sleep (750); + } + + base.OnProgressChanged (100); + Thread.Sleep (1000); if (this.git.ExitCode != 0) { return false; diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index b1ee2711..ce278853 100755 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -183,7 +183,7 @@ namespace SparkleLib { protected void OnProgressChanged (double percentage) { if (ProgressChanged != null) - ProgressChanged (percentage); + ProgressChanged (percentage); } diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 17249986..e837039c 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -331,7 +331,6 @@ namespace SparkleShare { if (ChangePageEvent != null) ChangePageEvent (PageType.Finished, warnings); - PreviousAddress = ""; SyncingFolder = ""; PreviousUrl = ""; From a2e3f2e842f4d018a1cc940090da413d189796b2 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 18 Feb 2012 23:42:41 +0100 Subject: [PATCH 26/53] Add a test page for the protocol handler --- .../add-to-sparkleshare-button.png | Bin 0 -> 4339 bytes data/html/protocol-handler-test/invite.xml | 9 +++++ .../protocol-handler-test.htm | 38 ++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 data/html/protocol-handler-test/add-to-sparkleshare-button.png create mode 100644 data/html/protocol-handler-test/invite.xml create mode 100644 data/html/protocol-handler-test/protocol-handler-test.htm diff --git a/data/html/protocol-handler-test/add-to-sparkleshare-button.png b/data/html/protocol-handler-test/add-to-sparkleshare-button.png new file mode 100644 index 0000000000000000000000000000000000000000..be46a091aa375a77579179e2459d4ac77160399b GIT binary patch literal 4339 zcmVNxe|7KezTG|3Gd&B#HVdo5u&N;7L(nKn z0zx1UpWAbd8kZ<>iCf$?;xjQA74xD-+|VGXL>7%8ihe5K!WMRBgBfO+wR@)bzPH{V zw`XI9VPGKW`}+5N_v_nL)u+y>I$d?Ds{0BlC5;Fn6hK*WHR*u}3JDVYz%V4y%ihEb zm{Ll!FYKyMu5|HVqPL>U3jjj{#O-I1>9RA6JVlop z5R-?ImLS22L%Koa2v^UbybE|AXwU%l(o>mg=t61|h@My_6C~&q4ndN}z+as~?q9xS zhXyDOVLYZlA$Fp*OOT-R7+^*X(g8&Slu!(tG!coABEgRdDG~k%I&nwFln6|YO<1Am zpx7Z+e++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6E0nA|QpBk7U zFJ{PxKvK8zLDbB_FntLTy(g8+Zo_DZZyOpRjD`xN(Y!_LHYzB4c@i;0!qkPxDQ^=p z6ujG((-j2Z{O~${GqFDpI5hMlmf*;MQ*W`HdE4vOUSXr?0Y8UcXTY{Mp>jiqVhj_C zYQW=!jHI^tkr?c)v*J0A6DoWVFs+j)rxHTfAQ-jcQ~+NHDjNXZgBGnL&1JpM_Rtjf zwq#!&gm9r60kS>TR9D>q-mpM8GmwEQ(p-?<&YC1@Kz$ej5eVZzNE3$=!L3{IyJ`2J z++0iD`&Z%pc0Mu90}(IjE^9gms0lz_LX?-%R{wVW8ZdyDniW7>$fqIDA+=yrp zmlh+%Vd;7#gkwZ5e~W1gH?XGbj(h@X+(zu^;LMb*Rn_#T)+zd|XZf7htqu|k9QhwSO=;PBwC1*SAxD#0N!BZNx6MmENd3642G>Jj-z zLo`6;OXIBg`UvB|1f4?zh#G`jo?9n4wkQH}JSSR<|9_|oiZ@6YtkA-I>|;Jvl*GeW z68yN>?_>W*J2(KC3Sh1+p<+`RpGS;?&y5l!_+b)?5_@|CivS;B3an8%d2kk|+&rGy zGlnrKGl{PKf+InK + + +
ssh://git@github.com/
+ /hbons/Stuff + http://www.sparkleshare.org/test.php +
+
+ diff --git a/data/html/protocol-handler-test/protocol-handler-test.htm b/data/html/protocol-handler-test/protocol-handler-test.htm new file mode 100644 index 00000000..9e0a1226 --- /dev/null +++ b/data/html/protocol-handler-test/protocol-handler-test.htm @@ -0,0 +1,38 @@ + + + SparkleShare Protocol Handler Test + + + +
+ hbons's stuff on Github + + Add to SparkleShare + +
+ + + From 1b2fb55aa43cf88c97f066deed92752ea28df1d2 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 18 Feb 2012 23:59:24 +0100 Subject: [PATCH 27/53] setup: close window after clicking Open Folder button and move said logic to controller --- SparkleShare/Mac/SparkleSetup.cs | 2 +- SparkleShare/SparkleSetup.cs | 2 +- SparkleShare/SparkleSetupController.cs | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/SparkleShare/Mac/SparkleSetup.cs b/SparkleShare/Mac/SparkleSetup.cs index 31517352..ca15b5ce 100755 --- a/SparkleShare/Mac/SparkleSetup.cs +++ b/SparkleShare/Mac/SparkleSetup.cs @@ -599,7 +599,7 @@ namespace SparkleShare { }; OpenFolderButton.Activated += delegate { - Program.Controller.OpenSparkleShareFolder (Path.GetFileName (Controller.PreviousPath)); + Controller.OpenFolderClicked (); }; Buttons.Add (FinishButton); diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index abd96806..76afa582 100755 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -456,7 +456,7 @@ namespace SparkleShare { Button open_folder_button = new Button (_("Open Folder")); open_folder_button.Clicked += delegate { - Program.Controller.OpenSparkleShareFolder (System.IO.Path.GetFileName (Controller.PreviousPath)); + Controller.OpenFolderClicked (); }; Button finish_button = new Button (_("Finish")); diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index e837039c..4d78733e 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -384,6 +384,15 @@ namespace SparkleShare { } + public void OpenFolderClicked () + { + Program.Controller.OpenSparkleShareFolder ( + Path.GetFileName (PreviousPath)); + + FinishPageCompleted (); + } + + public void FinishPageCompleted () { PreviousAddress = ""; From 331c51b144ca26e585290fdcf2b464224604c12e Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 19 Feb 2012 01:16:44 +0100 Subject: [PATCH 28/53] Allow invites without a accept_url element --- SparkleShare/SparkleControllerBase.cs | 2 +- SparkleShare/SparkleInvite.cs | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 6c8ca830..5e2507e8 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -155,6 +155,7 @@ namespace SparkleShare { if (invite.Valid) { InviteReceived (invite); + File.Delete (args.FullPath); } else { if (AlertNotificationRaised != null) @@ -162,7 +163,6 @@ namespace SparkleShare { "This invite seems screwed up..."); } - File.Delete (args.FullPath); } } }; diff --git a/SparkleShare/SparkleInvite.cs b/SparkleShare/SparkleInvite.cs index 2a219f78..782fa76a 100644 --- a/SparkleShare/SparkleInvite.cs +++ b/SparkleShare/SparkleInvite.cs @@ -34,8 +34,7 @@ namespace SparkleShare { public bool Valid { get { return (!string.IsNullOrEmpty (Address) && - !string.IsNullOrEmpty (RemotePath) && - !string.IsNullOrEmpty (AcceptUrl.ToString ())); + !string.IsNullOrEmpty (RemotePath)); } } @@ -79,6 +78,9 @@ namespace SparkleShare { public bool Accept () { + if (AcceptUrl == null) + return true; + try { WebRequest request = WebRequest.Create (AcceptUrl); @@ -114,13 +116,7 @@ namespace SparkleShare { private void Initialize (string address, string remote_path, string accept_url) - {/* - if (!remote_path.StartsWith ("/")) - remote_path = "/" + remote_path; - - if (!address.EndsWith ("/")) - address = address + "/"; - */ + { Address = address; RemotePath = remote_path; AcceptUrl = new Uri (accept_url); From a3810138016d91fde00e28e0a64029f4d5655317 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 19 Feb 2012 01:19:46 +0100 Subject: [PATCH 29/53] invites: always use https when accepting invites --- .../Contents/Resources/Scripts/main.scpt | Bin 3058 -> 2942 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Resources/Scripts/main.scpt b/SparkleShare/Mac/SparkleShareInviteOpener.app/Contents/Resources/Scripts/main.scpt index 50aefc0f2966bf12196e603050fe0970fca88bad..37bae65bf279697c910d370a9e4f95f1da476223 100644 GIT binary patch delta 1204 zcmYLJNo-SB6g}_Tj_vPU6O*=fWBOw|A&CPa4h;lC17S*&kOWGBG6Vt{ASTX$Z78d< ztkhlgmMmC+Xg5d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Guo- zo^c8l8}l8L@4z2}XD*wV&siB#8)eKQO_+7$Mo`1I4ZgizM%vkz8;)-od~3aoX<^Oq zFVg%Bv|jO0tr&2QFsI)0wb2zBtDMF^TbJP#b<@`!%)%SwpXAT}k$;doprC^O4lS>G z{Vi1mxjjnxd;X4Z^0)jAe=QwoKofr@v)Z9P^4|#NtixZTlW*`Bn8#H$WHkC0Tzn0# n02b5-#zAdfEgQ$pt8nwD{0V=INmXyk7+7|;Jo3-#>SzA}pOGx% From 641a5680a6dcd3ef5a83f41b90b05d2747ea52f3 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 19 Feb 2012 15:04:43 +0100 Subject: [PATCH 30/53] Port Linux UI to new controller logic --- SparkleShare/SparkleAbout.cs | 19 +++++++++++++++--- SparkleShare/SparkleBubbles.cs | 10 +--------- SparkleShare/SparkleEventLog.cs | 32 +++++++++++++++++++------------ SparkleShare/SparkleSetup.cs | 23 +++++++++++++++++++--- SparkleShare/SparkleStatusIcon.cs | 30 +++-------------------------- SparkleShare/SparkleUI.cs | 14 ++++++++------ 6 files changed, 68 insertions(+), 60 deletions(-) diff --git a/SparkleShare/SparkleAbout.cs b/SparkleShare/SparkleAbout.cs index 9e7a0d74..51a220ca 100755 --- a/SparkleShare/SparkleAbout.cs +++ b/SparkleShare/SparkleAbout.cs @@ -27,7 +27,7 @@ namespace SparkleShare { public class SparkleAbout : Window { - public SparkleAboutController Controller; + public SparkleAboutController Controller = new SparkleAboutController (); private Label updates; @@ -41,10 +41,11 @@ namespace SparkleShare { public SparkleAbout () : base ("") { DeleteEvent += delegate (object o, DeleteEventArgs args) { - HideAll (); + Controller.WindowClosed (); args.RetVal = true; }; + DefaultSize = new Gdk.Size (600, 260); Resizable = false; BorderWidth = 0; @@ -62,7 +63,19 @@ namespace SparkleShare { buf.RenderPixmapAndMask (out map, out map2, 255); GdkWindow.SetBackPixmap (map, false); - Controller = new SparkleAboutController (); + + Controller.HideWindowEvent += delegate { + Application.Invoke (delegate { + HideAll (); + }); + }; + + Controller.ShowWindowEvent += delegate { + Application.Invoke (delegate { + ShowAll (); + Present (); + }); + }; Controller.NewVersionEvent += delegate (string new_version) { Application.Invoke (delegate { diff --git a/SparkleShare/SparkleBubbles.cs b/SparkleShare/SparkleBubbles.cs index 1d08df2a..1c2851d8 100755 --- a/SparkleShare/SparkleBubbles.cs +++ b/SparkleShare/SparkleBubbles.cs @@ -44,15 +44,7 @@ namespace SparkleShare { notification.IconName = "folder-sparkleshare"; notification.Closed += delegate { - Application.Invoke (delegate { - if (SparkleUI.EventLog == null) - SparkleUI.EventLog = new SparkleEventLog (); - - SparkleUI.EventLog.Controller.SelectedFolder = null; - - SparkleUI.EventLog.ShowAll (); - SparkleUI.EventLog.Present (); - }); + Controller.BubbleClicked (); }; notification.Show (); diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index 7bc154bd..210bc935 100755 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -57,7 +57,10 @@ namespace SparkleShare { Title = _("Recent Events"); IconName = "folder-sparkleshare"; - DeleteEvent += Close; + DeleteEvent += Close (object o, DeleteEventArgs args) { + Controller.WindowClosed (); + args.RetVal = true; + }; this.size_label = new Label () { Markup = "Size:History: …" @@ -99,13 +102,25 @@ namespace SparkleShare { layout_vertical.PackStart (this.content_wrapper, true, true, 0); Add (layout_vertical); - ShowAll (); - - UpdateChooser (null); - UpdateContent (null); // Hook up the controller events + Controller.HideWindowEvent += delegate { + Application.Invoke (delegate { + HideAll (); + }); + }; + + Controller.ShowWindowEvent += delegate { + Application.Invoke (delegate { + ShowAll (); + Present (); + + UpdateChooser (null); + UpdateContent (null); + }); + }; + Controller.UpdateChooserEvent += delegate (string [] folders) { Application.Invoke (delegate { UpdateChooser (folders); @@ -236,13 +251,6 @@ namespace SparkleShare { } - public void Close (object o, DeleteEventArgs args) - { - HideAll (); - args.RetVal = true; - } - - private MenuBar CreateShortcutsBar () { // Adds a hidden menubar that contains to enable keyboard diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index 76afa582..1c0f44e6 100755 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -56,6 +56,20 @@ namespace SparkleShare { ) ); + + Controller.HideWindowEvent += delegate { + Application.Invoke (delegate { + HideAll (); + }); + }; + + Controller.ShowWindowEvent += delegate { + Application.Invoke (delegate { + ShowAll (); + Present (); + }); + }; + Controller.ChangePageEvent += delegate (PageType type, string [] warnings) { Application.Invoke (delegate { Reset (); @@ -621,9 +635,12 @@ namespace SparkleShare { private Gdk.Color MixColors (Gdk.Color first_color, Gdk.Color second_color, double ratio) { return new Gdk.Color ( - Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) + second_color.Red * ratio))) / 65535), - Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) + second_color.Green * ratio))) / 65535), - Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) + second_color.Blue * ratio))) / 65535) + Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) + + second_color.Red * ratio))) / 65535), + Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) + + second_color.Green * ratio))) / 65535), + Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) + + second_color.Blue * ratio))) / 65535) ); } } diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 81ccb866..559d9d20 100755 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -254,19 +254,7 @@ namespace SparkleShare { sync_item.Sensitive = false; sync_item.Activated += delegate { - Application.Invoke (delegate { - - if (SparkleUI.Setup == null) { - SparkleUI.Setup = new SparkleSetup (); - SparkleUI.Setup.Controller.ShowAddPage (); - } - - if (!SparkleUI.Setup.Visible) - SparkleUI.Setup.Controller.ShowAddPage (); - - //SparkleUI.Intro.ShowAll (); - //SparkleUI.Intro.Present (); - }); + Controller.AddHostedProjectClicked (); }; this.menu.Add (sync_item); @@ -277,13 +265,7 @@ namespace SparkleShare { recent_events_item.Sensitive = (Controller.Folders.Length > 0); recent_events_item.Activated += delegate { - Application.Invoke (delegate { - if (SparkleUI.EventLog == null) - SparkleUI.EventLog = new SparkleEventLog (); - - SparkleUI.EventLog.ShowAll (); - SparkleUI.EventLog.Present (); - }); + Controller.OpenRecentEventsClicked (); }; this.menu.Add (recent_events_item); @@ -307,13 +289,7 @@ namespace SparkleShare { MenuItem about_item = new MenuItem (_("About SparkleShare")); about_item.Activated += delegate { - Application.Invoke (delegate { - if (SparkleUI.About == null) - SparkleUI.About = new SparkleAbout (); - - SparkleUI.About.ShowAll (); - SparkleUI.About.Present (); - }); + Controller.AboutClicked (); }; this.menu.Add (about_item); diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index deb387da..dc4bf6ef 100755 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -37,6 +37,7 @@ namespace SparkleShare { public static SparkleBubbles Bubbles; public static SparkleSetup Setup; public static SparkleAbout About; + public static string AssetsPath = new string [] {Defines.PREFIX, "share", "sparkleshare"}.Combine (); @@ -56,13 +57,14 @@ namespace SparkleShare { // Use translations Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); - StatusIcon = new SparkleStatusIcon (); + Setup = new SparkleSetup (); + EventLog = new SparkleEventLog (); + About = new SparkleAbout (); Bubbles = new SparkleBubbles (); - - if (Program.Controller.FirstRun) { - Setup = new SparkleSetup (); - Setup.Controller.ShowSetupPage (); - } + StatusIcon = new SparkleStatusIcon (); + + if (Program.Controller.FirstRun) + Program.Controller.ShowSetupWindow (PageType.Setup) } From c21d84c7176947a2d722774dc4716ff07f97c417 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 19 Feb 2012 15:11:13 +0100 Subject: [PATCH 31/53] setup: port some more new logic calls --- SparkleShare/SparkleSetup.cs | 5 ++--- SparkleShare/SparkleSetupWindow.cs | 10 ---------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index 1c0f44e6..b4721915 100755 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -327,7 +327,7 @@ namespace SparkleShare { Button cancel_button = new Button (_("Cancel")); cancel_button.Clicked += delegate { - Close (); + Controller.PageCancelled (); }; // Sync button @@ -477,7 +477,6 @@ namespace SparkleShare { finish_button.Clicked += delegate { Controller.FinishedPageCompleted (); - Close (); }; @@ -592,7 +591,7 @@ namespace SparkleShare { Button finish_button = new Button (_("Finish")); finish_button.Clicked += delegate { - Close (); + Controller.FinishPageCompleted (); }; diff --git a/SparkleShare/SparkleSetupWindow.cs b/SparkleShare/SparkleSetupWindow.cs index 3ef464c8..45ef6a41 100755 --- a/SparkleShare/SparkleSetupWindow.cs +++ b/SparkleShare/SparkleSetupWindow.cs @@ -50,11 +50,6 @@ namespace SparkleShare { SetSizeRequest (680, 440); - DeleteEvent += delegate (object o, DeleteEventArgs args) { - args.RetVal = true; - Close (); - }; - HBox = new HBox (false, 6); VBox = new VBox (false, 0); @@ -147,10 +142,5 @@ namespace SparkleShare { Present (); base.ShowAll (); } - - public void Close () - { - HideAll (); - } } } From e68a832aecf1e95f1383a615dbda7cf4c6f10c4a Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 19 Feb 2012 16:00:41 +0100 Subject: [PATCH 32/53] controller: add abstract method InstallProtocolHandler () --- SparkleShare/Mac/SparkleController.cs | 6 +++ SparkleShare/Mac/SparkleStatusIcon.cs | 4 +- SparkleShare/SparkleController.cs | 34 ------------- SparkleShare/SparkleControllerBase.cs | 55 ++++++++++++--------- SparkleShare/SparkleStatusIcon.cs | 4 +- SparkleShare/SparkleStatusIconController.cs | 20 ++++++-- 6 files changed, 57 insertions(+), 66 deletions(-) diff --git a/SparkleShare/Mac/SparkleController.cs b/SparkleShare/Mac/SparkleController.cs index d0fb3cb2..1f4daa3b 100755 --- a/SparkleShare/Mac/SparkleController.cs +++ b/SparkleShare/Mac/SparkleController.cs @@ -113,6 +113,12 @@ namespace SparkleShare { // N/A } + + public override void InstallProtocolHandler () + { + // We ship SparkleShareInviteHandler.app in the bundle + } + // Adds the SparkleShare folder to the user's // list of bookmarked places diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleStatusIcon.cs index c539859e..d370ac3b 100755 --- a/SparkleShare/Mac/SparkleStatusIcon.cs +++ b/SparkleShare/Mac/SparkleStatusIcon.cs @@ -180,7 +180,7 @@ namespace SparkleShare { }; FolderMenuItem.Activated += delegate { - Program.Controller.OpenSparkleShareFolder (); + Controller.SparkleShareClicked (); }; FolderMenuItem.Image = SparkleShareImage; @@ -314,7 +314,7 @@ namespace SparkleShare { private EventHandler OpenFolderDelegate (string name) { return delegate { - Program.Controller.OpenSparkleShareFolder (name); + Controller.SubfolderClicked (name); }; } diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 3016430d..24354f5e 100755 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -74,40 +74,6 @@ namespace SparkleShare { SparkleHelpers.DebugInfo ("Controller", "Enabled autostart on login"); } } - - - // Installs a launcher so the user can launch SparkleShare - // from the Internet category if needed - public override void InstallLauncher () - { - string apps_path = - new string [] {SparkleConfig.DefaultConfig.HomePath, - ".local", "share", "applications"}.Combine (); - - string desktopfile_path = Path.Combine (apps_path, "sparkleshare.desktop"); - - if (!File.Exists (desktopfile_path)) { - if (!Directory.Exists (apps_path)) - Directory.CreateDirectory (apps_path); - - TextWriter writer = new StreamWriter (desktopfile_path); - writer.WriteLine ("[Desktop Entry]\n" + - "Type=Application\n" + - "Name=SparkleShare\n" + - "Comment=Share documents\n" + - "Exec=sparkleshare start\n" + - "Icon=folder-sparkleshare\n" + - "Terminal=false\n" + - "Categories=Network;"); - writer.Close (); - - // Give the launcher the right permissions so it can be launched by the user - UnixFileInfo file_info = new UnixFileInfo (desktopfile_path); - file_info.FileAccessPermissions = FileAccessPermissions.UserReadWriteExecute; - - SparkleHelpers.DebugInfo ("Controller", "Created '" + desktopfile_path + "'"); - } - } // Adds the SparkleShare folder to the user's diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 5e2507e8..37c5dcfc 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -87,8 +87,34 @@ namespace SparkleShare { public event NoteNotificationRaisedEventHandler NoteNotificationRaised; public delegate void NoteNotificationRaisedEventHandler (SparkleUser user, string folder_name); + + // Path where the plugins are kept public abstract string PluginsPath { get; } + // Enables SparkleShare to start automatically at login + public abstract void EnableSystemAutostart (); + + // Installs a launcher so the user can launch SparkleShare + // from the Internet category if needed + public abstract void InstallLauncher (); + + // Installs the sparkleshare:// protocol handler + public abstract void InstallProtocolHandler (); + + // Adds the SparkleShare folder to the user's + // list of bookmarked places + public abstract void AddToBookmarks (); + + // Creates the SparkleShare folder in the user's home folder + public abstract bool CreateSparkleShareFolder (); + + // Opens the SparkleShare folder or an (optional) subfolder + public abstract void OpenSparkleShareFolder (string subfolder); + + // Opens a file with the appropriate application + public abstract void OpenFile (string url); + + private SparkleFetcherBase fetcher; private List failed_avatars = new List (); @@ -117,10 +143,13 @@ namespace SparkleShare { if (CreateSparkleShareFolder ()) AddToBookmarks (); - if (FirstRun) + if (FirstRun) { SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.TrueString); - else + InstallProtocolHandler (); + + } else { ImportPrivateKey (); + } // Watch the SparkleShare folder FileSystemWatcher watcher = new FileSystemWatcher (SparkleConfig.DefaultConfig.FoldersPath) { @@ -534,28 +563,6 @@ namespace SparkleShare { } - // Creates a .desktop entry in autostart folder to - // start SparkleShare automatically at login - public abstract void EnableSystemAutostart (); - - // Installs a launcher so the user can launch SparkleShare - // from the Internet category if needed - public abstract void InstallLauncher (); - - // Adds the SparkleShare folder to the user's - // list of bookmarked places - public abstract void AddToBookmarks (); - - // Creates the SparkleShare folder in the user's home folder - public abstract bool CreateSparkleShareFolder (); - - // Opens the SparkleShare folder or an (optional) subfolder - public abstract void OpenSparkleShareFolder (string subfolder); - - // Opens a file with the appropriate application - public abstract void OpenFile (string url); - - // Fires events for the current syncing state public void UpdateState () { diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 559d9d20..5998fbfe 100755 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -209,7 +209,7 @@ namespace SparkleShare { }; folder_item.Activated += delegate { - Program.Controller.OpenSparkleShareFolder (); + Controller.SparkleShareClicked (); }; this.menu.Add (folder_item); @@ -318,7 +318,7 @@ namespace SparkleShare { private EventHandler OpenFolderDelegate (string name) { return delegate { - Program.Controller.OpenSparkleShareFolder (name); + Controller.SubfolderClicked (name); }; } diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index dcf383a2..05671aec 100755 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -131,15 +131,21 @@ namespace SparkleShare { } - public void AddHostedProjectClicked () + public void SparkleShareClicked () { - Program.Controller.ShowSetupWindow (PageType.Add); + Program.Controller.OpenSparkleShareFolder (); } - public void AboutClicked () + public void SubfolderClicked (string subfolder) { - Program.Controller.ShowAboutWindow (); + Program.Controller.OpenSparkleShareFolder (subfolder); + } + + + public void AddHostedProjectClicked () + { + Program.Controller.ShowSetupWindow (PageType.Add); } @@ -147,5 +153,11 @@ namespace SparkleShare { { Program.Controller.ShowEventLogWindow (); } + + + public void AboutClicked () + { + Program.Controller.ShowAboutWindow (); + } } } From ff55094651b2201237dcf1550392685e998258c6 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 19 Feb 2012 16:04:43 +0100 Subject: [PATCH 33/53] controller: always install protocol handler, not just on the first run --- SparkleShare/SparkleAboutController.cs | 2 +- SparkleShare/SparkleControllerBase.cs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/SparkleShare/SparkleAboutController.cs b/SparkleShare/SparkleAboutController.cs index 776552fd..fb9fa5ee 100755 --- a/SparkleShare/SparkleAboutController.cs +++ b/SparkleShare/SparkleAboutController.cs @@ -90,7 +90,7 @@ namespace SparkleShare { // Add a little delay, making it seems we're // actually doing hard work - Thread.Sleep (2 * 1000); + Thread.Sleep (1000); if (running_version >= new_version) { if (VersionUpToDateEvent != null) diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 37c5dcfc..b4224018 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -138,18 +138,16 @@ namespace SparkleShare { { InstallLauncher (); EnableSystemAutostart (); + InstallProtocolHandler (); // Create the SparkleShare folder and add it to the bookmarks if (CreateSparkleShareFolder ()) AddToBookmarks (); - if (FirstRun) { + if (FirstRun) SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.TrueString); - InstallProtocolHandler (); - - } else { + else ImportPrivateKey (); - } // Watch the SparkleShare folder FileSystemWatcher watcher = new FileSystemWatcher (SparkleConfig.DefaultConfig.FoldersPath) { From 51758c53850f101f2921faa4c7066bfe0657123e Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 19 Feb 2012 21:32:45 +0100 Subject: [PATCH 34/53] bubbles: Only show event log on user click --- SparkleShare/SparkleBubbles.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SparkleShare/SparkleBubbles.cs b/SparkleShare/SparkleBubbles.cs index 1c2851d8..8fbbab6f 100755 --- a/SparkleShare/SparkleBubbles.cs +++ b/SparkleShare/SparkleBubbles.cs @@ -43,8 +43,9 @@ namespace SparkleShare { else notification.IconName = "folder-sparkleshare"; - notification.Closed += delegate { - Controller.BubbleClicked (); + notification.Closed += delegate (object o, EventArgs args) { + if ((args as CloseArgs).Reason == CloseReason.User) + Controller.BubbleClicked (); }; notification.Show (); From 135e2fe73f640611f392e560296f59bd0422c6d7 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 19 Feb 2012 21:33:25 +0100 Subject: [PATCH 35/53] Fix Linux build --- SparkleLib/SparkleListenerTcp.cs | 9 +++++++-- SparkleShare/Makefile.am | 2 +- SparkleShare/SparkleController.cs | 6 ++++++ SparkleShare/SparkleControllerBase.cs | 5 ----- SparkleShare/SparkleEventLog.cs | 14 +++++++------- SparkleShare/SparkleSetup.cs | 6 +++--- SparkleShare/SparkleUI.cs | 2 +- 7 files changed, 25 insertions(+), 19 deletions(-) diff --git a/SparkleLib/SparkleListenerTcp.cs b/SparkleLib/SparkleListenerTcp.cs index 1bb38a1d..24ec0f70 100755 --- a/SparkleLib/SparkleListenerTcp.cs +++ b/SparkleLib/SparkleListenerTcp.cs @@ -91,7 +91,8 @@ namespace SparkleLib { this.is_connected = false; this.is_connecting = false; - this.socket.Dispose (); + if (this.socket != null) + this.socket.Close (); OnDisconnected (e.Message); return; @@ -158,7 +159,8 @@ namespace SparkleLib { this.is_connected = false; this.is_connecting = false;; - this.socket.Dispose (); + if (this.socket != null) + this.socket.Close (); OnDisconnected ("Ping timeout"); return; @@ -244,6 +246,9 @@ namespace SparkleLib { this.thread.Abort (); this.thread.Join (); + if (this.socket != null) + this.socket.Close (); + base.Dispose (); } diff --git a/SparkleShare/Makefile.am b/SparkleShare/Makefile.am index ad557503..9b34f320 100755 --- a/SparkleShare/Makefile.am +++ b/SparkleShare/Makefile.am @@ -23,8 +23,8 @@ SOURCES = \ SparkleEventLog.cs \ SparkleEventLogController.cs \ SparkleExtensions.cs \ - SparkleOptions.cs \ SparkleInvite.cs \ + SparkleOptions.cs \ SparklePlugin.cs \ SparkleSetup.cs \ SparkleSetupController.cs \ diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 24354f5e..ea42c837 100755 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -74,6 +74,12 @@ namespace SparkleShare { SparkleHelpers.DebugInfo ("Controller", "Enabled autostart on login"); } } + + + public override void InstallProtocolHandler () + { + // TODO + } // Adds the SparkleShare folder to the user's diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index b4224018..ec9d54c6 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -94,10 +94,6 @@ namespace SparkleShare { // Enables SparkleShare to start automatically at login public abstract void EnableSystemAutostart (); - // Installs a launcher so the user can launch SparkleShare - // from the Internet category if needed - public abstract void InstallLauncher (); - // Installs the sparkleshare:// protocol handler public abstract void InstallProtocolHandler (); @@ -136,7 +132,6 @@ namespace SparkleShare { public virtual void Initialize () { - InstallLauncher (); EnableSystemAutostart (); InstallProtocolHandler (); diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index 210bc935..6d21ad3d 100755 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -57,7 +57,7 @@ namespace SparkleShare { Title = _("Recent Events"); IconName = "folder-sparkleshare"; - DeleteEvent += Close (object o, DeleteEventArgs args) { + DeleteEvent += delegate (object o, DeleteEventArgs args) { Controller.WindowClosed (); args.RetVal = true; }; @@ -269,15 +269,15 @@ namespace SparkleShare { AddAccelGroup (accel_group); // Close on Esc - close_1.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.W, Gdk.ModifierType.ControlMask, - AccelFlags.Visible)); + close_1.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.W, + Gdk.ModifierType.ControlMask, AccelFlags.Visible)); - close_1.Activated += delegate { HideAll (); }; + close_1.Activated += delegate { Controller.WindowClosed (); }; // Close on Ctrl+W - close_2.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, - AccelFlags.Visible)); - close_2.Activated += delegate { HideAll (); }; + close_2.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.Escape, + Gdk.ModifierType.None, AccelFlags.Visible)); + close_2.Activated += delegate { Controller.WindowClosed (); }; file_menu.Append (close_1); file_menu.Append (close_2); diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index b4721915..b3b65a39 100755 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -287,7 +287,7 @@ namespace SparkleShare { }; layout_address.PackStart (new Label () { - Markup = "" + _("Address") + "", + Markup = "" + _("Address:") + "", Xalign = 0 }, true, true, 0); @@ -308,7 +308,7 @@ namespace SparkleShare { }; layout_path.PackStart (new Label () { - Markup = "" + _("Remote Path") + "", + Markup = "" + _("Remote Path:") + "", Xalign = 0 }, true, true, 0); @@ -476,7 +476,7 @@ namespace SparkleShare { Button finish_button = new Button (_("Finish")); finish_button.Clicked += delegate { - Controller.FinishedPageCompleted (); + Controller.FinishPageCompleted (); }; diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index dc4bf6ef..e533fb03 100755 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -64,7 +64,7 @@ namespace SparkleShare { StatusIcon = new SparkleStatusIcon (); if (Program.Controller.FirstRun) - Program.Controller.ShowSetupWindow (PageType.Setup) + Program.Controller.ShowSetupWindow (PageType.Setup); } From 5b0feca548f9f0fbba36b12dfa34aad706cb2ece Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 19 Feb 2012 23:26:19 +0100 Subject: [PATCH 36/53] setup: Fix several bugs in the Add page --- SparkleShare/Makefile.am | 1 - SparkleShare/SparkleEntry.cs | 106 ----------------------------- SparkleShare/SparkleSetup.cs | 81 +++++++--------------- SparkleShare/SparkleSetupWindow.cs | 43 ++++++++++-- 4 files changed, 60 insertions(+), 171 deletions(-) delete mode 100755 SparkleShare/SparkleEntry.cs diff --git a/SparkleShare/Makefile.am b/SparkleShare/Makefile.am index 9b34f320..28cd4390 100755 --- a/SparkleShare/Makefile.am +++ b/SparkleShare/Makefile.am @@ -19,7 +19,6 @@ SOURCES = \ SparkleBubblesController.cs \ SparkleController.cs \ SparkleControllerBase.cs \ - SparkleEntry.cs \ SparkleEventLog.cs \ SparkleEventLogController.cs \ SparkleExtensions.cs \ diff --git a/SparkleShare/SparkleEntry.cs b/SparkleShare/SparkleEntry.cs deleted file mode 100755 index 304fe941..00000000 --- a/SparkleShare/SparkleEntry.cs +++ /dev/null @@ -1,106 +0,0 @@ -// SparkleShare, a collaboration and sharing tool. -// Copyright (C) 2010 Hylke Bons -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General private License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General private License for more details. -// -// You should have received a copy of the GNU General private License -// along with this program. If not, see . - - -using Gtk; - -// TODO: Remove with Gtk3 -namespace SparkleShare { - - public class SparkleEntry : Entry { - - - private string example_text; - private bool example_text_active; - - - public SparkleEntry () - { - ExampleTextActive = true; - - FocusGrabbed += delegate { OnEntered (); }; - ClipboardPasted += delegate { OnEntered (); }; - - FocusOutEvent += delegate { - if (Text.Equals ("") || Text == null) - ExampleTextActive = true; - - if (ExampleTextActive) - UseExampleText (); - }; - } - - - private void OnEntered () - { - if (ExampleTextActive) { - ExampleTextActive = false; - Text = ""; - UseNormalTextColor (); - } - } - - - public bool ExampleTextActive { - get { - return this.example_text_active; - } - - set { - this.example_text_active = value; - - if (this.example_text_active) - UseSecondaryTextColor (); - else - UseNormalTextColor (); - } - } - - - public string ExampleText - { - get { - return this.example_text; - } - - set { - this.example_text = value; - - if (this.example_text_active) - UseExampleText (); - } - } - - - private void UseExampleText () - { - Text = this.example_text; - UseSecondaryTextColor (); - } - - - private void UseSecondaryTextColor () - { - ModifyText (StateType.Normal, Style.Foreground (StateType.Insensitive)); - } - - - private void UseNormalTextColor () - { - ModifyText (StateType.Normal, Style.Foreground (StateType.Normal)); - } - } -} diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index b3b65a39..6a42eee9 100755 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -31,9 +31,6 @@ namespace SparkleShare { public SparkleSetupController Controller = new SparkleSetupController (); - private string SecondaryTextColor; - private string SecondaryTextColorSelected; - private ProgressBar progress_bar = new ProgressBar (); @@ -46,17 +43,6 @@ namespace SparkleShare { public SparkleSetup () : base () { - SecondaryTextColor = SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive)); - SecondaryTextColorSelected = - SparkleUIHelpers.GdkColorToHex ( - MixColors ( - new TreeView ().Style.Foreground (StateType.Selected), - new TreeView ().Style.Background (StateType.Selected), - 0.15 - ) - ); - - Controller.HideWindowEvent += delegate { Application.Invoke (delegate { HideAll (); @@ -186,8 +172,10 @@ namespace SparkleShare { tree.AppendColumn (service_column); - SparkleEntry path_entry = new SparkleEntry (); - SparkleEntry address_entry = new SparkleEntry (); + Entry address_entry = new Entry (); + Entry path_entry = new Entry (); + Label address_example = new Label ("1") { Xalign = 0, UseMarkup = true }; + Label path_example = new Label ("2") { Xalign = 0, UseMarkup = true }; // Select the first plugin by default @@ -200,18 +188,11 @@ namespace SparkleShare { string example_text, FieldState state) { Application.Invoke (delegate { - address_entry.Text = text; - address_entry.Sensitive = (state == FieldState.Enabled); + address_entry.Text = text; + address_entry.Sensitive = (state == FieldState.Enabled); + address_example.Markup = "" + example_text + ""; - if (string.IsNullOrEmpty (example_text)) - address_entry.ExampleText = null; - else - address_entry.ExampleText = example_text; - - if (string.IsNullOrEmpty (text)) - address_entry.ExampleTextActive = true; - else - address_entry.ExampleTextActive = false; }); }; @@ -219,21 +200,13 @@ namespace SparkleShare { string example_text, FieldState state) { Application.Invoke (delegate { - path_entry.Text = text; - path_entry.Sensitive = (state == FieldState.Enabled); - - // TODO: Use small labels like the mac UI - if (string.IsNullOrEmpty (example_text)) - path_entry.ExampleText = null; - else - path_entry.ExampleText = example_text; - - if (string.IsNullOrEmpty (text)) - path_entry.ExampleTextActive = true; - else - path_entry.ExampleTextActive = false; + path_entry.Text = text; + path_entry.Sensitive = (state == FieldState.Enabled); + path_example.Markup = "" + example_text + ""; }); }; + // Update the address field text when the selection changes tree.CursorChanged += delegate (object sender, EventArgs e) { @@ -291,7 +264,8 @@ namespace SparkleShare { Xalign = 0 }, true, true, 0); - layout_address.PackStart (address_entry, true, true, 0); + layout_address.PackStart (address_entry, false, false, 0); + layout_address.PackStart (address_example, false, false, 0); path_entry.Completion = new EntryCompletion(); @@ -312,7 +286,8 @@ namespace SparkleShare { Xalign = 0 }, true, true, 0); - layout_path.PackStart (path_entry, true, true, 0); + layout_path.PackStart (path_entry, false, false, 0); + layout_path.PackStart (path_example, false, false, 0); layout_fields.PackStart (layout_address); layout_fields.PackStart (layout_path); @@ -330,7 +305,6 @@ namespace SparkleShare { Controller.PageCancelled (); }; - // Sync button Button add_button = new Button (_("Add")); add_button.Clicked += delegate { @@ -340,10 +314,16 @@ namespace SparkleShare { Controller.AddPageCompleted (server, folder_name); }; + Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) { + Application.Invoke (delegate { + add_button.Sensitive = button_enabled; + }); + }; + AddButton (cancel_button); AddButton (add_button); - Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree.SelectedRow); + Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1); break; } @@ -629,19 +609,6 @@ namespace SparkleShare { (cell as CellRendererText).Markup = markup; } - - - private Gdk.Color MixColors (Gdk.Color first_color, Gdk.Color second_color, double ratio) - { - return new Gdk.Color ( - Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) + - second_color.Red * ratio))) / 65535), - Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) + - second_color.Green * ratio))) / 65535), - Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) + - second_color.Blue * ratio))) / 65535) - ); - } } diff --git a/SparkleShare/SparkleSetupWindow.cs b/SparkleShare/SparkleSetupWindow.cs index 45ef6a41..1f13927f 100755 --- a/SparkleShare/SparkleSetupWindow.cs +++ b/SparkleShare/SparkleSetupWindow.cs @@ -36,6 +36,9 @@ namespace SparkleShare { public string Header; public string Description; + + public string SecondaryTextColor; + public string SecondaryTextColorSelected; public Container Content; @@ -48,20 +51,31 @@ namespace SparkleShare { WindowPosition = WindowPosition.Center; Deletable = false; - SetSizeRequest (680, 440); + SecondaryTextColor = SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive)); + + SecondaryTextColorSelected = + SparkleUIHelpers.GdkColorToHex ( + MixColors ( + new TreeView ().Style.Foreground (StateType.Selected), + new TreeView ().Style.Background (StateType.Selected), + 0.15 + ) + ); - HBox = new HBox (false, 6); + SetSizeRequest (680, 400); + + HBox = new HBox (false, 0); VBox = new VBox (false, 0); Wrapper = new VBox (false, 0) { - BorderWidth = 30 + BorderWidth = 0 }; Buttons = CreateButtonBox (); VBox.PackStart (Wrapper, true, true, 0); - VBox.PackStart (Buttons, false, false, 0); + VBox.PackStart (Buttons, false, false, 15); EventBox box = new EventBox (); Gdk.Color bg_color = new Gdk.Color (); @@ -74,7 +88,7 @@ namespace SparkleShare { box.Add (side_splash); HBox.PackStart (box, false, false, 0); - HBox.PackStart (VBox, true, true, 0); + HBox.PackStart (VBox, true, true, 30); base.Add (HBox); } @@ -83,7 +97,7 @@ namespace SparkleShare { private HButtonBox CreateButtonBox () { return new HButtonBox () { - BorderWidth = 12, + BorderWidth = 0, Layout = ButtonBoxStyle.End, Spacing = 6 }; @@ -101,7 +115,7 @@ namespace SparkleShare { { Label header = new Label ("" + Header + "") { UseMarkup = true, - Xalign = 0 + Xalign = 0, }; Label description = new Label (Description) { @@ -110,6 +124,7 @@ namespace SparkleShare { }; VBox layout_vertical = new VBox (false, 0); + layout_vertical.PackStart (new Label (""), false, false, 6); layout_vertical.PackStart (header, false, false, 0); if (!string.IsNullOrEmpty (Description)) @@ -137,10 +152,24 @@ namespace SparkleShare { ShowAll (); } + new public void ShowAll () { Present (); base.ShowAll (); } + + + private Gdk.Color MixColors (Gdk.Color first_color, Gdk.Color second_color, double ratio) + { + return new Gdk.Color ( + Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) + + second_color.Red * ratio))) / 65535), + Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) + + second_color.Green * ratio))) / 65535), + Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) + + second_color.Blue * ratio))) / 65535) + ); + } } } From 357ed939aabc83f0dab450eccdaa6a2bf3b2e207 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 19 Feb 2012 23:58:33 +0100 Subject: [PATCH 37/53] event log: fix the paddings of the size labels and dropdown --- NEWS | 8 ++++++++ README.md | 2 +- SparkleShare/SparkleControllerBase.cs | 4 ++-- SparkleShare/SparkleEventLog.cs | 23 +++++++++++++++++------ 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 10bb72a0..ab470c1f 100755 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +0.8.3 for Linux and Mac (Mon Feb 19 2012): + + Hylke: + - + - + - + + 0.8.2 for Linux and Mac (Sat Feb 11 2012): Hylke: diff --git a/README.md b/README.md index fccd50ef..b84a8424 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ information see the LICENSE file or visit http://www.gnu.org/licenses/gpl-3.0.ht Requirements: - - git >= 1.7.0 + - git >= 1.7.3 - gtk-sharp2 - mono-core >= 2.8 - notify-sharp diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index ec9d54c6..ca32af9e 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -740,9 +740,9 @@ namespace SparkleShare { else if (byte_count >= 1073741824) return String.Format ("{0:##.##} ɢʙ", Math.Round (byte_count / 1073741824, 1)); else if (byte_count >= 1048576) - return String.Format ("{0:##.##} ᴍʙ", Math.Round (byte_count / 1048576, 1)); + return String.Format ("{0:##.##} ᴍʙ", Math.Round (byte_count / 1048576, 0)); else if (byte_count >= 1024) - return String.Format ("{0:##.##} ᴋʙ", Math.Round (byte_count / 1024, 1)); + return String.Format ("{0:##.##} ᴋʙ", Math.Round (byte_count / 1024, 0)); else return byte_count.ToString () + " bytes"; } diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index 6d21ad3d..4e6dc7a7 100755 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -30,6 +30,7 @@ namespace SparkleShare { public SparkleEventLogController Controller = new SparkleEventLogController (); private Label size_label; + private Label history_label; private HBox layout_horizontal; private ComboBox combo_box; private EventBox content_wrapper; @@ -63,8 +64,18 @@ namespace SparkleShare { }; this.size_label = new Label () { - Markup = "Size:History: …" + Markup = "Size: …", + Xalign = 0 }; + + this.history_label = new Label () { + Markup = "History: …", + Xalign = 0 + }; + + HBox layout_sizes = new HBox (false, 12); + layout_sizes.Add (this.size_label); + layout_sizes.Add (this.history_label); VBox layout_vertical = new VBox (false, 0); this.spinner = new SparkleSpinner (22); @@ -93,9 +104,8 @@ namespace SparkleShare { this.spinner.Start (); - this.layout_horizontal = new HBox (false, 0); - this.layout_horizontal.PackStart (this.size_label, true, true, 0); - this.layout_horizontal.PackStart (new Label (" "), false, false, 0); + this.layout_horizontal = new HBox (true, 0); + this.layout_horizontal.PackStart (layout_sizes, true, true, 12); layout_vertical.PackStart (this.layout_horizontal, false, false, 0); layout_vertical.PackStart (CreateShortcutsBar (), false, false, 0); @@ -146,10 +156,11 @@ namespace SparkleShare { Controller.UpdateSizeInfoEvent += delegate (string size, string history_size) { Application.Invoke (delegate { - this.size_label.Markup = "Size: " + size + " " + - "History: " + history_size; + this.size_label.Markup = "Size: " + size; + this.history_label.Markup = "History: " + history_size; this.size_label.ShowAll (); + this.history_label.ShowAll (); }); }; } From 5aae363fd52e42e2d850353cc23663c4f5d2cf5b Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Mon, 20 Feb 2012 00:15:58 +0100 Subject: [PATCH 38/53] event log: fix overlooked controller call --- SparkleShare/Mac/SparkleEventLog.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs index 8c8d9797..0b6d25fa 100755 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/SparkleEventLog.cs @@ -78,7 +78,7 @@ namespace SparkleShare { }; this.hidden_close_button.Activated += delegate { - PerformClose (this); + Controller.WindowClosed (); }; ContentView.AddSubview (this.hidden_close_button); From 221cf3131c44d3b430723a07587fa6fd7d9cb41e Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Mon, 20 Feb 2012 00:17:43 +0100 Subject: [PATCH 39/53] bump version to 0.8.3 --- SparkleShare/Mac/SparkleShare.csproj | 2 +- SparkleShare/Mac/SparkleShare.sln | 2 +- configure.ac | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj index fb99e7b9..e7bcb21b 100755 --- a/SparkleShare/Mac/SparkleShare.csproj +++ b/SparkleShare/Mac/SparkleShare.csproj @@ -11,7 +11,7 @@ SparkleShare SparkleShare v4.0 - 0.8.2 + 0.8.3 true diff --git a/SparkleShare/Mac/SparkleShare.sln b/SparkleShare/Mac/SparkleShare.sln index 6ad0b1a6..3521ad0b 100644 --- a/SparkleShare/Mac/SparkleShare.sln +++ b/SparkleShare/Mac/SparkleShare.sln @@ -16,6 +16,6 @@ Global EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution StartupItem = SparkleShare.csproj - version = 0.8.2 + version = 0.8.3 EndGlobalSection EndGlobal diff --git a/configure.ac b/configure.ac index ac6a1f62..0d4adcd5 100755 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,9 @@ dnl Process this file with autoconf to produce a configure script. m4_define([sparkleshare_version], - [0.8.2]) + [0.8.3]) m4_define([sparkleshare_asm_version], - [0.8.2]) + [0.8.3]) AC_PREREQ([2.54]) AC_INIT([SparkleShare], sparkleshare_version) From 243ece241dfa85115d1583eb77b584e924a2b57d Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Mon, 20 Feb 2012 00:38:21 +0100 Subject: [PATCH 40/53] controller: Fix opening links with spaces in them --- SparkleShare/SparkleController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index ea42c837..07a17520 100755 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -198,7 +198,7 @@ namespace SparkleShare { { Process process = new Process (); process.StartInfo.FileName = "xdg-open"; - process.StartInfo.Arguments = url.Replace (" ", "%20"); + process.StartInfo.Arguments = "\"" + url + "\""; process.Start (); } } From ec532c612e56369b560e1c26b29cbdf880092a59 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Wed, 22 Feb 2012 01:24:40 +0100 Subject: [PATCH 41/53] event log: Add a set of GNOME styled hash avatars --- SparkleShare/Mac/SparkleEventLog.cs | 7 +- SparkleShare/Mac/SparkleShare.csproj | 39 +- SparkleShare/SparkleControllerBase.cs | 19 +- data/icons/avatar-1.png | Bin 0 -> 650 bytes data/icons/avatar-10.png | Bin 0 -> 735 bytes data/icons/avatar-11.png | Bin 0 -> 669 bytes data/icons/avatar-2.png | Bin 0 -> 751 bytes data/icons/avatar-3.png | Bin 0 -> 989 bytes data/icons/avatar-4.png | Bin 0 -> 720 bytes data/icons/avatar-5.png | Bin 0 -> 753 bytes data/icons/avatar-6.png | Bin 0 -> 912 bytes data/icons/avatar-7.png | Bin 0 -> 771 bytes data/icons/avatar-8.png | Bin 0 -> 780 bytes data/icons/avatar-9.png | Bin 0 -> 666 bytes data/src/avatars.svg | 676 ++++++++++++++++++++++++++ 15 files changed, 731 insertions(+), 10 deletions(-) create mode 100644 data/icons/avatar-1.png create mode 100644 data/icons/avatar-10.png create mode 100644 data/icons/avatar-11.png create mode 100644 data/icons/avatar-2.png create mode 100644 data/icons/avatar-3.png create mode 100644 data/icons/avatar-4.png create mode 100644 data/icons/avatar-5.png create mode 100644 data/icons/avatar-6.png create mode 100644 data/icons/avatar-7.png create mode 100644 data/icons/avatar-8.png create mode 100644 data/icons/avatar-9.png create mode 100644 data/src/avatars.svg diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs index 0b6d25fa..0635867b 100755 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/SparkleEventLog.cs @@ -242,9 +242,9 @@ namespace SparkleShare { html = html.Replace ("", "#f5f5f5"); html = html.Replace ("", "#0085cf"); html = html.Replace ("", "#009ff8"); - html = html.Replace ("", + html = html.Replace ("", "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, - "Pixmaps","avatar-default.png")); + "Pixmaps")); html = html.Replace ("", "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, @@ -261,7 +261,8 @@ namespace SparkleShare { html = html.Replace ("", "file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "document-moved-12.png")); - + + InvokeOnMainThread (delegate { if (this.progress_indicator.Superview == ContentView) this.progress_indicator.RemoveFromSuperview (); diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj index e7bcb21b..cc48b6fe 100755 --- a/SparkleShare/Mac/SparkleShare.csproj +++ b/SparkleShare/Mac/SparkleShare.csproj @@ -120,9 +120,6 @@ - - Pixmaps\avatar-default.png - @@ -326,6 +323,42 @@ Plugins\own-server.png + + Pixmaps\avatar-default.png + + + Pixmaps\avatar-1.png + + + Pixmaps\avatar-2.png + + + Pixmaps\avatar-3.png + + + Pixmaps\avatar-4.png + + + Pixmaps\avatar-5.png + + + Pixmaps\avatar-6.png + + + Pixmaps\avatar-7.png + + + Pixmaps\avatar-8.png + + + Pixmaps\avatar-9.png + + + Pixmaps\avatar-10.png + + + Pixmaps\avatar-11.png + diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index ca32af9e..6d87f9ff 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -485,8 +485,8 @@ namespace SparkleShare { if (File.Exists (change_set_avatar)) change_set_avatar = "file://" + change_set_avatar; else - change_set_avatar = ""; - + change_set_avatar = "/" + AssignAvatar (change_set.User.Email); + event_entry += ""; string timestamp = change_set.Timestamp.ToString ("H:mm"); @@ -1141,13 +1141,24 @@ namespace SparkleShare { private string AssignColor (string s) { - string hash = GetMD5 (s).Substring (0, 8); + string hash = "0" + GetMD5 (s).Substring (0, 8); string numbers = Regex.Replace (hash, "[a-z]", ""); - int number = 3 + int.Parse (numbers); + int number = int.Parse (numbers); + return this.tango_palette [number % this.tango_palette.Length]; } + private string AssignAvatar (string s) + { + string hash = "0" + GetMD5 (s).Substring (0, 8); + string numbers = Regex.Replace (hash, "[a-z]", ""); + int number = int.Parse (numbers); + + return "avatar-" + (number % 11) + ".png"; + } + + // Creates an MD5 hash of input private string GetMD5 (string s) { diff --git a/data/icons/avatar-1.png b/data/icons/avatar-1.png new file mode 100644 index 0000000000000000000000000000000000000000..4ffc65a48a67239dcd63db5df3dd521c8bd06895 GIT binary patch literal 650 zcmV;50(Jd~P)J=xgdlq&n&#zr=N!gytdcxXK>+wz ziR<+Wr4-t>g_QDBb&WB?IR|TP@t*%m6@is`p0@-!=MX}`dtdEtKckueV+=xwzxo;> z#HUtaErKP*>yaV>r4*!;kWyy%Gv0eR=iroATZsk&$X zjcTni3`5n9bp2qWwa%WKC18vp1xZC~4P#8!oMeHfX{sJ0|AkU2sh+GP2{6X8?@S5C znB-Ghl0e`0KlV!H8Ju(UeV;ZqWl-C;MF~+zjrmf5b6))rp8{hnY1Lnjkg{sGkwr@E k|6kxYA6`oAw|_JD2kHpFO4K^=jQ{`u07*qoM6N<$f)nQ)Q~&?~ literal 0 HcmV?d00001 diff --git a/data/icons/avatar-10.png b/data/icons/avatar-10.png new file mode 100644 index 0000000000000000000000000000000000000000..7187ca199e0bc71a2f93088b296cafcf0599615e GIT binary patch literal 735 zcmV<50wDc~P)e}Ao2fyRae5OI zQSpuGoMSyn;2YHeZn`}UkaNZ`49L0MG2(i?vNIEF4=l@qWm({yL(??uyEjb}rfCvo zBGF&SS}UrwL?lk5YyfL5s;Uy1JLmpbKaPqG;G7c~?~>jGHUKy6{Vro<%>WC4h>8J7 z$pu`E_(Dv?sc<#PFT zz&FO+bg3z&n}d8w6&tGnKR5Qiz$5}v&N&!k zV2nB4&%_w9Z5y_2d;VBOYmK&TMNQcLWSn!T>l%IEBgS|-&gnGjy+_w|MLSZhHM*{Y z_x|*?rvO3-ER&=1-k%~}U&3=B+Co-U3d z8I5meIQBnQ;AxeY@DN$_?f?H1a$2ogiY(uztdh!9=lqtFmiAk3ugE-mpB~4%dE1-h zb!y8PV)ingyC(f02SH7nI4?kxHJPW!@IsXG^PVX}L0%fJ``!vMD=1aGPdsyf`JCsH ziY!m&EX_&X7I1spju^f9Z2Sz@qGHyEZ^_k84u8BVWP8^aelT5@9i~II(A|syF!3ld*T5T z-}YlYk2NlJGBLd^(PUL*IU@0J@Bc3Wr!12t*fugTaNIlbtn%33I(ET>63j|Wf{Br0 zOQy`*e@SSs@bsX0-|yF}nl)Vewe!)j8E54(TVsq5t#!J}aL%$MHvDSG-ffSvE!VB} zXlI-f^x@uN%kb16fl=9CYWpRWojBV0k2?c{>`SfwHLv}rEZMVl+Y&8Gw!Jy`f7hpY zL7U^r<_>S`?6uZ@U3k1HRxmPq^?d)Vk|!rq#TmZ;T;f)3YYsFtN&JWMt?KvpSS*x( zDBqjSaHm|l?_0(He>^p*cc*{&XMewS-{gM`CR{t8%!)qN08B~@p00i_>zopr09J$? Aga7~l literal 0 HcmV?d00001 diff --git a/data/icons/avatar-2.png b/data/icons/avatar-2.png new file mode 100644 index 0000000000000000000000000000000000000000..891fce67974fcda039171e4ead225bad20e85993 GIT binary patch literal 751 zcmV;vf))e-04{R^|O4a&97tIdIsEtytrj9XYAx zmj9&m+5ueFO@)X)1B4JLrG6drui#?sKX)!h(EyzD2qFKseYnIJLi&v$x*7GXaH;N!y&d;a*C4n%NTV6DZnEX6thQ&j*q&GUQ-kWvc97@Tv}p7x%q0T4pK7`v%! z7-LtZ!uAoY)!irp5JG@+erc7bXzKx4Ym3q<3xF|($<8HDPs&>*WK-Y?#tb?f4n+awDAwm)07~h@ua@>i2#MPDyCYKXtZFL8_x}&@ h%)^`G`|Ue(e*oZs2TWzNqrw0H002ovPDHLkV1k9TOP2ru literal 0 HcmV?d00001 diff --git a/data/icons/avatar-3.png b/data/icons/avatar-3.png new file mode 100644 index 0000000000000000000000000000000000000000..17cc5ef7e828555d74da4b8782f9c11ba31916e2 GIT binary patch literal 989 zcmV<310wv1P)=l?%4FR?H-Aee`gG}eNIBqpv@ z&3TDqlcuj4nr;^2 z;GEmE^J;^04(~mzwSygNZF&J&mZ7d|P&y78r4*cV=;e}t z=kp1r6r6LoUay-QEEZ!7?)N)@@5q;BIdhnEKFVst`%4B1A)|b6twr0mQHRu7wARpC zBhT~E9t=fbaS3_vhj1EWaJ$`p#Q9gA&nIrT+u%oNc?I`C*L85tp>5lw>wOQ#7)U7r zAXr`m7ja+Pyvz9>tu>4>K>>>qpp*`o;oT5IptTOB^jQSTvP4;y0D!8h(6;SnJ@T)} zvJ6er49+X1pp+Vo8AX5)f}$u!zxQIMq&VcZm==FUQOxEY31E!P287aAN&z8T)47)p zw2^?msdz+XGTc6h#5fIkeWn<|JhVLIRXh@ZLiR0c-7|FPjZb zh^A={m)cX-y0|S4H}xq~>{5*r%V7a$CY^HTVVsIUiu&m6X@6LN_kJjW-)ZC2#a3VX z9z`j2dMTd1nUhi;TElB8dJm@sc<=G`^);(e*2cGOi?(ggP7Pq^)#4gTDQK;Sc5r&+ z_g99G$0KQTluQ8dom%@R+t)4L`=lv%N>Txgu~}I#?XQ8q-Chb#3E-SV2r=9=@2QVo zZ?(17hof{zz>y2zDU?!BN|9w5ilTs0>QGkNEr4^5rfGr|079Lm!P;q6PF<b&+q z2#LBpj*h@PNG2e~mlQ{cnRipb-V-(@Nh0u5nP-WmI%>+V|5t-Ql_`xN1&)gM00000 LNkvXXu0mjfx%9tP literal 0 HcmV?d00001 diff --git a/data/icons/avatar-4.png b/data/icons/avatar-4.png new file mode 100644 index 0000000000000000000000000000000000000000..af35c7def9874beaa8eeb7cec7c83540b79defc3 GIT binary patch literal 720 zcmV;>0x$iEP)LoK~!jg?U~J%qaYB4FFyiG65jtIvx+WM#98#vC#LNLDU7FQ z`fhSg0#)@dROu zC7g5b2Z%vA=N3E7+UiHub-ftZGz~773pnSP=lo_sX3zW^h_x0SpbhK7PIlH6s)zRa#>TcT_`26@5WF{C<}n%u(bZqUZ`XSsJ4DHK-G`W z0CihE9Du6BONgq&GjK>ZTDrfd*vkT#rYYNDX?xkvKq-h2!uxw6pj;Nb_oVsR0K+hl z97m1gNSaRqpgJGN5q;m2Y>>9muIsYvcb;c-T}N>bfCvym$byK$hY%?40TBNa10SX2 zy@$1S_2%JG-g~rdTO@d(008ijiQDZ4tu>TVkWwyA*Lj}dy~i*N__N zoI?nKX_|_y_L_`tkao?pacc@7KP1EfDuIpZ$^W;}kNl_`KNCD+2)#pn9&Ux`G z@f0z}lCu7Cgp@_QjZI4N{qF<3^Wn|$efY%|Reu2R-npkI5Ip$+0000z?+aL^u4;TzKPV)W_nVBRW|6}OIj@>406N7NK z>Gs^&Gax>MKoUEj&mM0q{@Dwl>Oa6|OYAWz=Nw8Yc<(U`1H9ia%#s6SS%%Z;w0;*w zfy?Ex8$|LWq_w{LW{e@v^VDWmB?n-PZTgo=$pQMlzx!U|U@s*DV2nX)4XrhtbL)Ta zJ&ZBXTJPcsmf|HALZGTDaQ=KhoO5WJ2GcZAO@6mcouDksp91%H;+*4fIA9nCG)+S_ z{V^wHuu^LC;vdHqML{vWDjI-uj zvhgg-$Xt zfVGxnH04}h(*xdnbX`X>3;@G0kZ-i;Anv-3w0q7uv~3$bei7*wqEuB)(EvqAIh;>T4WF(v1`hAf<#c z=4BUdtMWXD5CU!6MjgK(0Aozja&i&p9930Cb?i28qf%;@#Xs5z?euK|pmyOx6xy-d z1dyT&w^hppu~jbtq?Adza3KomJ-q~=cFtn8)$YF!kg^XNqOEqH0&vcgJy@Y)jBSE= jy1GAg^HA)+eP8GsXFc#`t)GEu00000NkvXXu0mjfzsF4? literal 0 HcmV?d00001 diff --git a/data/icons/avatar-6.png b/data/icons/avatar-6.png new file mode 100644 index 0000000000000000000000000000000000000000..59cc2e5500ac0ece50a5967daf3bc2d1cd3860d1 GIT binary patch literal 912 zcmV;B18@9^P)B5#4Dr|s#?G2cIYJULI@N^0pOMjTO&gX zwASl=%V#R08`;u9m+{~cU}kh(m(<*%o&XWS81vBJf!h-{#-!QA98&7gq4iK--+mwX zKM3Tu`5dH9r%?o$8Q1GIE1(pF5R&~wS4`jcaLz#~1!hK36e!CwImp)-hGFf-<2WWa zw4{=s=Xp)1aU3C~%x*xyZBHJCA=@6>|L-StLRT=(_HZ#eR2( zT9%Z$uA`dJIF7hnE`N_I0bpI~mjO>H^(GzN4Q*Z=!~$)D!^^7SysiP z{_QOsMu3RcJ@_6{$`{JRvLhd*(Cs3iwO;q#RC#1s^rvasl~!2gSKsV3sU!xQlf3!UGhgP?)T&v zM6Z;4CBPI|YopiKC<0YgWy>cycrCencsAzHUil;ku|7W~AcT0h8nJ~~weHgse^Qai m@%`@;_>;w({%OahxQ5p00000`7q^25T+awtW@_06;z?DCZp3T1Y7` zucv9kw$WcXu_p=lZl>M{X)GD@lBXWO=gF{XqbKtU06 z&e3&U(VkXHU5Y#Rgvwe0DJ6zsASuYIs_qtk43eMPPnv%fYbt~g7>40;Z=@hefYut; z+GLU#FvigLJ?gqndM--9ZVR;5S;?g!mFMA_{j>$IfYus9h$#E*j4?6+rE#(ZP#dz6cv%9dEpbV_Yyngv zy!WrK0RULnHJg+&PPTw$S&E3M;$#bO&J~l-^Ne|(i((Y@10{|6wrzJWuoM&t2q9#N z*tU(V!7nyA^E_i+*J!`AEDNS-B0I%M99jqg$Kw%7Db#fhDdkna5JG_W9`iiIIY&Wx z0jb4w&Rr7ZoI?l!?>+g&_Z?&cc7ODml4hsTQwfSOU@VL=(Q~IL0d3o6PtJ0{IgcI|M`cAZeMm(t=R*OU zbJ8(lEEr=^tN!pCuN-LQaR2`TURk_3+`s;h?mvIS$0jXa_$vSa002ovPDHLkV1i$; BNy-2K literal 0 HcmV?d00001 diff --git a/data/icons/avatar-8.png b/data/icons/avatar-8.png new file mode 100644 index 0000000000000000000000000000000000000000..14dd39f04d63ee758bcc09c80cf9cd450bb03d57 GIT binary patch literal 780 zcmV+n1M~ceP)!|=zK7W7oGZwYh!WaW7C1Q+l&f$8!-i_(| z9?m(05JPj} zSZe`%fC4;Mj153*4P(rgW4f+`QfhPjtpNJI&l)!j!{+#U5)`oj7-OJy-s7aT-mckO z00<$ncYjsewg7+_Bh@?|pzFHgom|Ji1;DzSHF`OK)*4Ew>iOP#ig^G;0LtzIAi=MC zDFAgoKmgEMlLL`bihK&y9{eq3C>8Y-ij%qBZU=zp{sNytaGqy4=ZfbS190v9Dk&wT zl+|fM;^nmPBp-?EF{BR>r?|c=g7wAdB!}?q%}ydleJA!qm&Z4 zr2-HEVvJP~)Zle1a${?rXL#>1j$>9~zbp&R=QG<|jHNRdW5nTbfH4Mb+d^x77pY^6 z2q9D_Y+s4BwdkDN9F$T*DTNRMd*Hhj8-Nf3N~u3`q~D8{loC03-HHUT=JGYgeFy>G zdwB0j*QyFYDTQ$yNkz?iGR7EmU5C@@R81$B zNUp547>1!}PBuW(G!NV795Tifm91F-LWts>p=cO}?20c7pzr%{`Czw7N}1j9&hm<* zgI20sn-2jv3-}TVA+k>W;fUNXFV9ep?SCKOJ0IQ}+duxl62Ab#>Diw4>E6iz0000< KMNUMnLSTYJb5l3~ literal 0 HcmV?d00001 diff --git a/data/icons/avatar-9.png b/data/icons/avatar-9.png new file mode 100644 index 0000000000000000000000000000000000000000..2f9cc3e3b57a99fc15d11eba33a901a8e5ad5be2 GIT binary patch literal 666 zcmV;L0%iS)P)0aJ@EXzV}PpW}! z+t_?jYaDVBbGgz(0E7^10IhLI0NmdME%C@Tz^RsaWB@LRloI)S7-%Ts7$Z3;XB;vB z*QwkZhYYYROLKCLlfB8zdGE>VH|I>Y4|_EMY}-bH$T`C~$FdPL`+*PwVvLxkspwQ) z*A?D-wq1-7q2EsQbHT0;o&;dx34A%rI5_LW#~s+MJW@1T?tN-3n2*blzF z*Z|)A(SGECSDUc63OVQI!)vc50BbF@*3ep4`fKm$6G&Py9x0$il z;&eK}Ifs-|b)4#LwC{V&^UUfXB*DIF6rov+q;{Fbo6hKe2m~QWoEM6!pp&)6^k~N^{-?kWv;; zC#QrEMYDeQji3B4#*zE~1N>(3QgZ*P>vf7=0D6zbZQ(RZIsgCw07*qoM6N<$f@FXo Aw*UYD literal 0 HcmV?d00001 diff --git a/data/src/avatars.svg b/data/src/avatars.svg new file mode 100644 index 00000000..1fcc93a6 --- /dev/null +++ b/data/src/avatars.svg @@ -0,0 +1,676 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 4a677c60996ca1b0d160f8408ede1738aada350b Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 23 Feb 2012 01:25:50 +0100 Subject: [PATCH 42/53] Point to the right location for the avatars on Linux --- data/Makefile.am | 11 +++++++++++ data/{icons/avatar-1.png => avatar-a.png} | Bin data/{icons/avatar-2.png => avatar-b.png} | Bin data/{icons/avatar-3.png => avatar-c.png} | Bin data/{icons/avatar-4.png => avatar-d.png} | Bin data/{icons/avatar-5.png => avatar-e.png} | Bin data/{icons/avatar-6.png => avatar-f.png} | Bin data/{icons/avatar-7.png => avatar-g.png} | Bin data/{icons/avatar-8.png => avatar-h.png} | Bin data/{icons/avatar-9.png => avatar-i.png} | Bin data/{icons/avatar-10.png => avatar-j.png} | Bin data/{icons/avatar-11.png => avatar-k.png} | Bin data/icons/Makefile.am | 2 +- 13 files changed, 12 insertions(+), 1 deletion(-) rename data/{icons/avatar-1.png => avatar-a.png} (100%) rename data/{icons/avatar-2.png => avatar-b.png} (100%) rename data/{icons/avatar-3.png => avatar-c.png} (100%) rename data/{icons/avatar-4.png => avatar-d.png} (100%) rename data/{icons/avatar-5.png => avatar-e.png} (100%) rename data/{icons/avatar-6.png => avatar-f.png} (100%) rename data/{icons/avatar-7.png => avatar-g.png} (100%) rename data/{icons/avatar-8.png => avatar-h.png} (100%) rename data/{icons/avatar-9.png => avatar-i.png} (100%) rename data/{icons/avatar-10.png => avatar-j.png} (100%) rename data/{icons/avatar-11.png => avatar-k.png} (100%) diff --git a/data/Makefile.am b/data/Makefile.am index cea4d45f..cf1520b3 100755 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -9,6 +9,17 @@ dist_pixmaps_DATA = \ tutorial-slide-2.png \ tutorial-slide-3.png \ tutorial-slide-4.png \ + avatar-a.png \ + avatar-b.png \ + avatar-c.png \ + avatar-d.png \ + avatar-e.png \ + avatar-f.png \ + avatar-g.png \ + avatar-h.png \ + avatar-i.png \ + avatar-j.png \ + avatar-k.png \ about.png pixmapsdir = $(pkgdatadir)/pixmaps/ diff --git a/data/icons/avatar-1.png b/data/avatar-a.png similarity index 100% rename from data/icons/avatar-1.png rename to data/avatar-a.png diff --git a/data/icons/avatar-2.png b/data/avatar-b.png similarity index 100% rename from data/icons/avatar-2.png rename to data/avatar-b.png diff --git a/data/icons/avatar-3.png b/data/avatar-c.png similarity index 100% rename from data/icons/avatar-3.png rename to data/avatar-c.png diff --git a/data/icons/avatar-4.png b/data/avatar-d.png similarity index 100% rename from data/icons/avatar-4.png rename to data/avatar-d.png diff --git a/data/icons/avatar-5.png b/data/avatar-e.png similarity index 100% rename from data/icons/avatar-5.png rename to data/avatar-e.png diff --git a/data/icons/avatar-6.png b/data/avatar-f.png similarity index 100% rename from data/icons/avatar-6.png rename to data/avatar-f.png diff --git a/data/icons/avatar-7.png b/data/avatar-g.png similarity index 100% rename from data/icons/avatar-7.png rename to data/avatar-g.png diff --git a/data/icons/avatar-8.png b/data/avatar-h.png similarity index 100% rename from data/icons/avatar-8.png rename to data/avatar-h.png diff --git a/data/icons/avatar-9.png b/data/avatar-i.png similarity index 100% rename from data/icons/avatar-9.png rename to data/avatar-i.png diff --git a/data/icons/avatar-10.png b/data/avatar-j.png similarity index 100% rename from data/icons/avatar-10.png rename to data/avatar-j.png diff --git a/data/icons/avatar-11.png b/data/avatar-k.png similarity index 100% rename from data/icons/avatar-11.png rename to data/avatar-k.png diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index d09cc805..da21e519 100755 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -24,7 +24,7 @@ app_theme_icons = \ places,folder-sparkleshare-256.png \ places,folder-sparkleshare-32.png \ places,folder-sparkleshare-48.png \ - status,sparkleshare-syncing-error-24.png \ + status,sparkleshare-syncing-error-24.png \ status,avatar-default-16.png \ status,avatar-default-22.png \ status,avatar-default-24.png \ From 758bfe62a913b167d058a62f509b15dfda85f2df Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 23 Feb 2012 01:25:50 +0100 Subject: [PATCH 43/53] Point to the right location for the avatars on Linux --- SparkleLib/SparkleConfig.cs | 7 ++-- SparkleShare/Mac/SparkleShare.csproj | 44 ++++++++++----------- SparkleShare/SparkleControllerBase.cs | 3 +- SparkleShare/SparkleEventLog.cs | 7 ++-- data/Makefile.am | 11 ++++++ data/{icons/avatar-1.png => avatar-a.png} | Bin data/{icons/avatar-2.png => avatar-b.png} | Bin data/{icons/avatar-3.png => avatar-c.png} | Bin data/{icons/avatar-4.png => avatar-d.png} | Bin data/{icons/avatar-5.png => avatar-e.png} | Bin data/{icons/avatar-6.png => avatar-f.png} | Bin data/{icons/avatar-7.png => avatar-g.png} | Bin data/{icons/avatar-8.png => avatar-h.png} | Bin data/{icons/avatar-9.png => avatar-i.png} | Bin data/{icons/avatar-10.png => avatar-j.png} | Bin data/{icons/avatar-11.png => avatar-k.png} | Bin data/icons/Makefile.am | 2 +- 17 files changed, 44 insertions(+), 30 deletions(-) rename data/{icons/avatar-1.png => avatar-a.png} (100%) rename data/{icons/avatar-2.png => avatar-b.png} (100%) rename data/{icons/avatar-3.png => avatar-c.png} (100%) rename data/{icons/avatar-4.png => avatar-d.png} (100%) rename data/{icons/avatar-5.png => avatar-e.png} (100%) rename data/{icons/avatar-6.png => avatar-f.png} (100%) rename data/{icons/avatar-7.png => avatar-g.png} (100%) rename data/{icons/avatar-8.png => avatar-h.png} (100%) rename data/{icons/avatar-9.png => avatar-i.png} (100%) rename data/{icons/avatar-10.png => avatar-j.png} (100%) rename data/{icons/avatar-11.png => avatar-k.png} (100%) diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs index ca01f402..57a677b2 100755 --- a/SparkleLib/SparkleConfig.cs +++ b/SparkleLib/SparkleConfig.cs @@ -150,9 +150,10 @@ namespace SparkleLib { "sparkleshare." + email + ".key.pub" ); - SparkleUser user = new SparkleUser (name, email) { - PublicKey = File.ReadAllText (pubkey_file_path) - }; + SparkleUser user = new SparkleUser (name, email); + + if (File.Exists (pubkey_file_path)) + user.PublicKey = File.ReadAllText (pubkey_file_path); return user; } diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj index cc48b6fe..38fac9b1 100755 --- a/SparkleShare/Mac/SparkleShare.csproj +++ b/SparkleShare/Mac/SparkleShare.csproj @@ -326,38 +326,38 @@ Pixmaps\avatar-default.png - - Pixmaps\avatar-1.png + + Pixmaps\avatar-a.png - - Pixmaps\avatar-2.png + + Pixmaps\avatar-b.png - - Pixmaps\avatar-3.png + + Pixmaps\avatar-c.png - - Pixmaps\avatar-4.png + + Pixmaps\avatar-d.png - - Pixmaps\avatar-5.png + + Pixmaps\avatar-e.png - - Pixmaps\avatar-6.png + + Pixmaps\avatar-f.png - - Pixmaps\avatar-7.png + + Pixmaps\avatar-g.png - - Pixmaps\avatar-8.png + + Pixmaps\avatar-h.png - - Pixmaps\avatar-9.png + + Pixmaps\avatar-i.png - - Pixmaps\avatar-10.png + + Pixmaps\avatar-j.png - - Pixmaps\avatar-11.png + + Pixmaps\avatar-k.png diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 6d87f9ff..3e5bfbb4 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -1154,8 +1154,9 @@ namespace SparkleShare { string hash = "0" + GetMD5 (s).Substring (0, 8); string numbers = Regex.Replace (hash, "[a-z]", ""); int number = int.Parse (numbers); + string letters = "abcdefghijklmnopqrstuvwxyz"; - return "avatar-" + (number % 11) + ".png"; + return "avatar-" + letters [(number % 11)] + ".png"; } diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index 4e6dc7a7..12bd6bdc 100755 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -233,9 +233,8 @@ namespace SparkleShare { html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal))); html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); - html = html.Replace ("", "file://" + - new string [] {SparkleUI.AssetsPath, "icons", - "hicolor", "32x32", "status", "avatar-default.png"}.Combine ()); + html = html.Replace ("", "file://" + + new string [] {SparkleUI.AssetsPath, "pixmaps"}.Combine ()); html = html.Replace ("", "file://" + new string [] {SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status", "document-added.png"}.Combine ()); @@ -249,6 +248,8 @@ namespace SparkleShare { new string [] {SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status", "document-moved.png"}.Combine ()); +Console.WriteLine (html); + Application.Invoke (delegate { this.spinner.Stop (); this.web_view.LoadString (html, null, null, "file://"); diff --git a/data/Makefile.am b/data/Makefile.am index cea4d45f..cf1520b3 100755 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -9,6 +9,17 @@ dist_pixmaps_DATA = \ tutorial-slide-2.png \ tutorial-slide-3.png \ tutorial-slide-4.png \ + avatar-a.png \ + avatar-b.png \ + avatar-c.png \ + avatar-d.png \ + avatar-e.png \ + avatar-f.png \ + avatar-g.png \ + avatar-h.png \ + avatar-i.png \ + avatar-j.png \ + avatar-k.png \ about.png pixmapsdir = $(pkgdatadir)/pixmaps/ diff --git a/data/icons/avatar-1.png b/data/avatar-a.png similarity index 100% rename from data/icons/avatar-1.png rename to data/avatar-a.png diff --git a/data/icons/avatar-2.png b/data/avatar-b.png similarity index 100% rename from data/icons/avatar-2.png rename to data/avatar-b.png diff --git a/data/icons/avatar-3.png b/data/avatar-c.png similarity index 100% rename from data/icons/avatar-3.png rename to data/avatar-c.png diff --git a/data/icons/avatar-4.png b/data/avatar-d.png similarity index 100% rename from data/icons/avatar-4.png rename to data/avatar-d.png diff --git a/data/icons/avatar-5.png b/data/avatar-e.png similarity index 100% rename from data/icons/avatar-5.png rename to data/avatar-e.png diff --git a/data/icons/avatar-6.png b/data/avatar-f.png similarity index 100% rename from data/icons/avatar-6.png rename to data/avatar-f.png diff --git a/data/icons/avatar-7.png b/data/avatar-g.png similarity index 100% rename from data/icons/avatar-7.png rename to data/avatar-g.png diff --git a/data/icons/avatar-8.png b/data/avatar-h.png similarity index 100% rename from data/icons/avatar-8.png rename to data/avatar-h.png diff --git a/data/icons/avatar-9.png b/data/avatar-i.png similarity index 100% rename from data/icons/avatar-9.png rename to data/avatar-i.png diff --git a/data/icons/avatar-10.png b/data/avatar-j.png similarity index 100% rename from data/icons/avatar-10.png rename to data/avatar-j.png diff --git a/data/icons/avatar-11.png b/data/avatar-k.png similarity index 100% rename from data/icons/avatar-11.png rename to data/avatar-k.png diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index d09cc805..da21e519 100755 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -24,7 +24,7 @@ app_theme_icons = \ places,folder-sparkleshare-256.png \ places,folder-sparkleshare-32.png \ places,folder-sparkleshare-48.png \ - status,sparkleshare-syncing-error-24.png \ + status,sparkleshare-syncing-error-24.png \ status,avatar-default-16.png \ status,avatar-default-22.png \ status,avatar-default-24.png \ From f046234692779e07a3434e75758d513991e8b5ee Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 23 Feb 2012 01:57:58 +0100 Subject: [PATCH 44/53] Fix new avatar paths on mac --- SparkleShare/Mac/SparkleController.cs | 6 ------ SparkleShare/Mac/SparkleShare.csproj | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/SparkleShare/Mac/SparkleController.cs b/SparkleShare/Mac/SparkleController.cs index 1f4daa3b..24d9637e 100755 --- a/SparkleShare/Mac/SparkleController.cs +++ b/SparkleShare/Mac/SparkleController.cs @@ -108,12 +108,6 @@ namespace SparkleShare { } - public override void InstallLauncher () - { - // N/A - } - - public override void InstallProtocolHandler () { // We ship SparkleShareInviteHandler.app in the bundle diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj index 38fac9b1..8cf2ea5d 100755 --- a/SparkleShare/Mac/SparkleShare.csproj +++ b/SparkleShare/Mac/SparkleShare.csproj @@ -326,37 +326,37 @@ Pixmaps\avatar-default.png - + Pixmaps\avatar-a.png - + Pixmaps\avatar-b.png - + Pixmaps\avatar-c.png - + Pixmaps\avatar-d.png - + Pixmaps\avatar-e.png - + Pixmaps\avatar-f.png - + Pixmaps\avatar-g.png - + Pixmaps\avatar-h.png - + Pixmaps\avatar-i.png - + Pixmaps\avatar-j.png - + Pixmaps\avatar-k.png From 06f80f294dcbac08364414e1183c3d1a2a3d51bb Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 23 Feb 2012 02:53:36 +0100 Subject: [PATCH 45/53] Change some wording: 'Open Recent Events' to 'View Recent Changes...' --- SparkleShare/Mac/SparkleEventLog.cs | 2 +- SparkleShare/Mac/SparkleStatusIcon.cs | 2 +- SparkleShare/SparkleEventLog.cs | 2 +- SparkleShare/SparkleStatusIcon.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs index 0635867b..e5d1bdb9 100755 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/SparkleEventLog.cs @@ -54,7 +54,7 @@ namespace SparkleShare { // TODO: Window needs to be made resizable public SparkleEventLog () : base () { - Title = "Recent Events"; + Title = "Recent Changes"; Delegate = new SparkleEventsDelegate (); diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleStatusIcon.cs index d370ac3b..d926e208 100755 --- a/SparkleShare/Mac/SparkleStatusIcon.cs +++ b/SparkleShare/Mac/SparkleStatusIcon.cs @@ -244,7 +244,7 @@ namespace SparkleShare { Menu.AddItem (NSMenuItem.SeparatorItem); RecentEventsMenuItem = new NSMenuItem () { - Title = "Open Recent Events", + Title = "View Recent Changes…", Enabled = (Controller.Folders.Length > 0) }; diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index 12bd6bdc..833be1d4 100755 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -55,7 +55,7 @@ namespace SparkleShare { Resizable = true; BorderWidth = 0; - Title = _("Recent Events"); + Title = _("Recent Changes"); IconName = "folder-sparkleshare"; DeleteEvent += delegate (object o, DeleteEventArgs args) { diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 5998fbfe..5731f2db 100755 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -260,7 +260,7 @@ namespace SparkleShare { this.menu.Add (sync_item); this.menu.Add (new SeparatorMenuItem ()); - MenuItem recent_events_item = new MenuItem (_("Open Recent Events")); + MenuItem recent_events_item = new MenuItem (_("View Recent Changes…")); recent_events_item.Sensitive = (Controller.Folders.Length > 0); From 001abbe5ced5f7343be1a4d2a82681b476ad9a57 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 23 Feb 2012 03:11:00 +0100 Subject: [PATCH 46/53] Change some wording: 'Up to date' to 'Files up to date' --- SparkleShare/Mac/SparkleStatusIcon.cs | 4 ++-- SparkleShare/SparkleStatusIcon.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleStatusIcon.cs index d926e208..90ccd26b 100755 --- a/SparkleShare/Mac/SparkleStatusIcon.cs +++ b/SparkleShare/Mac/SparkleStatusIcon.cs @@ -85,7 +85,7 @@ namespace SparkleShare { if (Controller.Folders.Length == 0) StateText = _("Welcome to SparkleShare!"); else - StateText = _("Up to date") + Controller.FolderSize; + StateText = _("Files up to date") + Controller.FolderSize; CreateMenu (); @@ -112,7 +112,7 @@ namespace SparkleShare { if (Controller.Folders.Length == 0) StateText = _("Welcome to SparkleShare!"); else - StateText = _("Up to date") + Controller.FolderSize; + StateText = _("Files up to date") + Controller.FolderSize; StateMenuItem.Title = StateText; CreateMenu (); diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 5731f2db..2aaa456b 100755 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -75,7 +75,7 @@ namespace SparkleShare { if (Controller.Folders.Length == 0) this.state_text = _("Welcome to SparkleShare!"); else - this.state_text = _("Up to date") + Controller.FolderSize; + this.state_text = _("Files up to date") + Controller.FolderSize; CreateMenu (); @@ -99,7 +99,7 @@ namespace SparkleShare { if (Controller.Folders.Length == 0) this.state_text = _("Welcome to SparkleShare!"); else - this.state_text = _("Up to date") + Controller.FolderSize; + this.state_text = _("Files up to date") + Controller.FolderSize; #if HAVE_APP_INDICATOR this.indicator.IconName = "process-syncing-sparkleshare-i"; From 51b5e738ee38e06b437befa260d848e77cc53703 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 23 Feb 2012 14:08:05 +0100 Subject: [PATCH 47/53] setup: don't clear the Path field when switching plugins and remember own server Address --- SparkleShare/SparkleSetupController.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 4d78733e..240efaf3 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -101,6 +101,10 @@ namespace SparkleShare { } + private string saved_address = ""; + private string saved_remote_path = ""; + + public SparkleSetupController () { TutorialPageNumber = 1; @@ -230,10 +234,10 @@ namespace SparkleShare { } else if (SelectedPlugin.AddressExample != null) { if (ChangeAddressFieldEvent != null) - ChangeAddressFieldEvent ("", SelectedPlugin.AddressExample, FieldState.Enabled); + ChangeAddressFieldEvent (this.saved_address, SelectedPlugin.AddressExample, FieldState.Enabled); } else { if (ChangeAddressFieldEvent != null) - ChangeAddressFieldEvent ("", "", FieldState.Enabled); + ChangeAddressFieldEvent (this.saved_address, "", FieldState.Enabled); } if (SelectedPlugin.Path != null) { @@ -242,11 +246,11 @@ namespace SparkleShare { } else if (SelectedPlugin.PathExample != null) { if (ChangePathFieldEvent != null) - ChangePathFieldEvent ("", SelectedPlugin.PathExample, FieldState.Enabled); + ChangePathFieldEvent (this.saved_remote_path, SelectedPlugin.PathExample, FieldState.Enabled); } else { if (ChangePathFieldEvent != null) - ChangePathFieldEvent ("", "", FieldState.Enabled); + ChangePathFieldEvent (this.saved_remote_path, "", FieldState.Enabled); } } @@ -259,8 +263,13 @@ namespace SparkleShare { address = address.Trim (); remote_path = remote_path.Trim (); - bool fields_valid = address != null && address.Trim().Length > 0 && - remote_path != null && remote_path.Trim().Length > 0; + if (selected_plugin == 0) + this.saved_address = address; + + this.saved_remote_path = remote_path; + + bool fields_valid = address != null && address.Trim ().Length > 0 && + remote_path != null && remote_path.Trim ().Length > 0; if (UpdateAddProjectButtonEvent != null) UpdateAddProjectButtonEvent (fields_valid); From e90796cbae242e1c8389e88027be7fc742aa06b7 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 24 Feb 2012 03:43:28 +0100 Subject: [PATCH 48/53] setup: '[X] Add SparklShare to startup items' and tutorial phrases tweaks --- SparkleShare/Mac/SparkleController.cs | 28 ++++++++++++- SparkleShare/Mac/SparkleSetup.cs | 43 +++++++++++--------- SparkleShare/SparkleController.cs | 4 +- SparkleShare/SparkleControllerBase.cs | 3 +- SparkleShare/SparkleSetup.cs | 35 ++++++---------- SparkleShare/SparkleSetupController.cs | 14 ++++++- SparkleShare/SparkleStatusIconController.cs | 2 +- data/tutorial-slide-4.png | Bin 6851 -> 4532 bytes 8 files changed, 79 insertions(+), 50 deletions(-) diff --git a/SparkleShare/Mac/SparkleController.cs b/SparkleShare/Mac/SparkleController.cs index 24d9637e..e3be75cf 100755 --- a/SparkleShare/Mac/SparkleController.cs +++ b/SparkleShare/Mac/SparkleController.cs @@ -102,9 +102,33 @@ namespace SparkleShare { } - public override void EnableSystemAutostart () + public override void CreateStartupItem () { - // N/A + // There aren't any bindings in MonoMac to support this yet, so + // we call out to an applescript to do the job + Process process = new Process (); + process.EnableRaisingEvents = true; + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.UseShellExecute = false; + process.StartInfo.FileName = "osascript"; + process.StartInfo.CreateNoWindow = true; + + string app_path = Path.GetDirectoryName (NSBundle.MainBundle.ResourcePath); + app_path = Path.GetDirectoryName (app_path); + + process.StartInfo.Arguments = "-e 'tell application \"System Events\" to " + + "make login item at end with properties {path:\"" + app_path + "\", hidden:false}'"; + + process.Exited += delegate { + SparkleHelpers.DebugInfo ("Controller", "Added " + app_path + " to login items"); + }; + + try { + process.Start (); + + } catch (Exception e) { + SparkleHelpers.DebugInfo ("Controller", "Failed adding " + app_path + " to login items: " + e.Message); + } } diff --git a/SparkleShare/Mac/SparkleSetup.cs b/SparkleShare/Mac/SparkleSetup.cs index ca15b5ce..a90856c7 100755 --- a/SparkleShare/Mac/SparkleSetup.cs +++ b/SparkleShare/Mac/SparkleSetup.cs @@ -37,6 +37,7 @@ namespace SparkleShare { private NSButton TryAgainButton; private NSButton CancelButton; private NSButton SkipTutorialButton; + private NSButton StartupCheckButton; private NSButton OpenFolderButton; private NSButton FinishButton; private NSImage SlideImage; @@ -52,7 +53,6 @@ namespace SparkleShare { private NSTextField PathTextField; private NSTextField PathLabel; private NSTextField PathHelpLabel; - private NSTextField AddProjectTextField; private NSTextField WarningTextField; private NSImage WarningImage; private NSImageView WarningImageView; @@ -84,10 +84,9 @@ namespace SparkleShare { switch (type) { case PageType.Setup: { - // TODO: Improve text Header = "Welcome to SparkleShare!"; - Description = "We'll need some info to mark your changes in the event log. " + - "Don't worry, this stays between you and your peers."; + Description = "Before we get started, what's your name and email? " + + "Don't worry, this information is only visible to your team members."; FullNameLabel = new NSTextField () { @@ -618,7 +617,7 @@ namespace SparkleShare { switch (Controller.TutorialPageNumber) { case 1: { Header = "What's happening next?"; - Description = "SparkleShare creates a special folder in your personal folder " + + Description = "SparkleShare creates a special folder on your computer " + "that will keep track of your projects."; SkipTutorialButton = new NSButton () { @@ -658,8 +657,8 @@ namespace SparkleShare { case 2: { Header = "Sharing files with others"; - Description = "All files added to your project folders are synced with the host " + - "automatically, as well as with your collaborators."; + Description = "All files added to your project folders are synced automatically with " + + "the host and your team members."; ContinueButton = new NSButton () { Title = "Continue" @@ -689,8 +688,8 @@ namespace SparkleShare { case 3: { Header = "The status icon is here to help"; - Description = "It shows the syncing process status, " + - "and contains links to your projects and the event log."; + Description = "It shows the syncing progress, provides easy access to " + + "your projects and let's you view recent changes."; ContinueButton = new NSButton () { Title = "Continue" @@ -720,17 +719,20 @@ namespace SparkleShare { case 4: { Header = "Adding projects to SparkleShare"; - Description = "Just click this button when you see it on the web, and " + - "the project will be automatically added:"; + Description = "You can do this through the status icon menu, or by clicking " + + "magic buttons on webpages that look like this:"; - AddProjectTextField = new NSTextField () { - Frame = new RectangleF (190, Frame.Height - 290, 640 - 240, 44), - BackgroundColor = NSColor.WindowBackground, - Bordered = false, - Editable = false, - Font = SparkleUI.Font, - StringValue = "…or select ‘Add Hosted Project…’ from the status icon menu " + - "to add one by hand." + + StartupCheckButton = new NSButton () { + Frame = new RectangleF (190, Frame.Height - 400, 300, 18), + Title = "Add SparkleShare to startup items", + State = NSCellStateValue.On + }; + + StartupCheckButton.SetButtonType (NSButtonType.Switch); + + StartupCheckButton.Activated += delegate { + Controller.StartupItemChanged (StartupCheckButton.State == NSCellStateValue.On); }; FinishButton = new NSButton () { @@ -741,6 +743,7 @@ namespace SparkleShare { Controller.TutorialPageCompleted (); }; + string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "tutorial-slide-4.png"); @@ -754,7 +757,7 @@ namespace SparkleShare { }; ContentView.AddSubview (SlideImageView); - ContentView.AddSubview (AddProjectTextField); + ContentView.AddSubview (StartupCheckButton); Buttons.Add (FinishButton); break; diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 07a17520..db8c93b8 100755 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -45,8 +45,10 @@ namespace SparkleShare { // Creates a .desktop entry in autostart folder to // start SparkleShare automatically at login - public override void EnableSystemAutostart () + public override void CreateStartupItem () { + // TODO: check whether this still works + string autostart_path = Path.Combine (Environment.GetFolderPath ( Environment.SpecialFolder.ApplicationData), "autostart"); diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 3e5bfbb4..eccd7034 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -92,7 +92,7 @@ namespace SparkleShare { public abstract string PluginsPath { get; } // Enables SparkleShare to start automatically at login - public abstract void EnableSystemAutostart (); + public abstract void CreateStartupItem (); // Installs the sparkleshare:// protocol handler public abstract void InstallProtocolHandler (); @@ -132,7 +132,6 @@ namespace SparkleShare { public virtual void Initialize () { - EnableSystemAutostart (); InstallProtocolHandler (); // Create the SparkleShare folder and add it to the bookmarks diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index 6a42eee9..3af57d68 100755 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -64,8 +64,9 @@ namespace SparkleShare { case PageType.Setup: { Header = _("Welcome to SparkleShare!"); - Description = "We'll need some info to mark your changes in the event log. " + - "Don't worry, this stays between you and your peers."; + Description = "Before we get started, what's your name and email? " + + "Don't worry, this information is only visible to your team members."; + Table table = new Table (2, 3, true) { @@ -496,8 +497,8 @@ namespace SparkleShare { switch (Controller.TutorialPageNumber) { case 1: { Header = _("What's happening next?"); - Description = _("SparkleShare creates a special folder in your personal folder " + - "that will keep track of your projects."); + Description = "SparkleShare creates a special folder on your computer " + + "that will keep track of your projects."; Button skip_tutorial_button = new Button (_("Skip Tutorial")); skip_tutorial_button.Clicked += delegate { @@ -521,8 +522,8 @@ namespace SparkleShare { case 2: { Header = _("Sharing files with others"); - Description = _("All files added to your project folders are synced with the host " + - "automatically, as well as with your collaborators."); + Description = _("All files added to your project folders are synced automatically with " + + "the host and your team members."); Button continue_button = new Button (_("Continue")); continue_button.Clicked += delegate { @@ -539,8 +540,8 @@ namespace SparkleShare { case 3: { Header = _("The status icon is here to help"); - Description = _("It shows the syncing process status, " + - "and contains links to your projects and the event log."); + Description = _("It shows the syncing progress, provides easy access to " + + "your projects and let's you view recent changes."); Button continue_button = new Button (_("Continue")); continue_button.Clicked += delegate { @@ -557,15 +558,8 @@ namespace SparkleShare { case 4: { Header = _("Adding projects to SparkleShare"); - Description = _("Just click this button when you see it on the web, and " + - "the project will be automatically added:"); - - Label label = new Label (_("…or select ‘Add Hosted Project…’ from the status icon menu " + - "to add one by hand.")) { - Wrap = true, - Xalign = 0, - UseMarkup = true - }; + Description = _("You can do this through the status icon menu, or by clicking " + + "magic buttons on webpages that look like this:"); Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-4.png"); @@ -574,12 +568,9 @@ namespace SparkleShare { Controller.FinishPageCompleted (); }; + // TODO: Add startup item checkbox here - VBox box = new VBox (false, 0); - box.Add (slide); - box.Add (label); - - Add (box); + Add (slide); AddButton (finish_button); break; diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 240efaf3..08bcd946 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -103,6 +103,7 @@ namespace SparkleShare { private string saved_address = ""; private string saved_remote_path = ""; + private bool create_startup_item = true; public SparkleSetupController () @@ -209,14 +210,23 @@ namespace SparkleShare { } + public void StartupItemChanged (bool create_startup_item) + { + this.create_startup_item = create_startup_item; + } + + public void TutorialPageCompleted () { TutorialPageNumber++; - if (TutorialPageNumber == 4) { + if (TutorialPageNumber == 5) { if (HideWindowEvent != null) HideWindowEvent (); + if (this.create_startup_item) + Program.Controller.CreateStartupItem (); + } else { if (ChangePageEvent != null) ChangePageEvent (PageType.Tutorial, null); @@ -264,7 +274,7 @@ namespace SparkleShare { remote_path = remote_path.Trim (); if (selected_plugin == 0) - this.saved_address = address; + this.saved_address = address; this.saved_remote_path = remote_path; diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index 05671aec..c0212c1b 100755 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -145,7 +145,7 @@ namespace SparkleShare { public void AddHostedProjectClicked () { - Program.Controller.ShowSetupWindow (PageType.Add); + Program.Controller.ShowSetupWindow (PageType.Tutorial); } diff --git a/data/tutorial-slide-4.png b/data/tutorial-slide-4.png index ae642773c7086b8b37f1a2fa136551fa42d95d95..315179b60bb0c1fc73277a55cf264a7340cd5764 100755 GIT binary patch literal 4532 zcmb_g_d6Th`;MY9OO>L;D6Q2Otr``C7{yzo_8z77Dybw!Y^|zQZOtNWjj9nVsa?CJ zh*7W6NQ{;iF-nj~e0~3i&vRYReV%oGyRUPd`$@Ajzst>Wg#!QpaGMw#SOEY`ZfCJB z+xauJiWfILJ6Iy1CN^wm7Q^QK^ekr&Gj@zPoB!|soe3&igg7e-!wel@)}cNyxM%o7 z02~fi^bZM)@bV0Ms2CdVTSV5n0svgRX=0#fgDBo2AYnEKgrVKT?Xi-t-jd!47?!IE ziTrv7VK~Ev>9%QBg9Rx-W z?$*37-Z||D9-nrE#uCS>CUN=2_UM{lMA^ySLE+m_Z}kVbE?A^^%i zKM9obZat|6wr<{(l14NcfHG7TQP!3}1>Zs1fDZz*pii{b3RW zrVDs1KLI{0nF+6&iipCiFV(OX5KH^6_!^x5DjbS+xQmb$%t-xJi+QB;XEk~vQ&9Bp z4pkn)^LPv*LDiwQjz_j5G|}u#^V71Ge^DBKTD2pr?epW71j|FyAk^A7eoceq z4eMaCxb7pd(A5WD?|=XU7l=Cr%D=7`+MOgEQNe5nB4(cgI5Mr{iEmdvJv)`<>zE6d zm8mQN1e}aZx-2q^Bk_Ty;gGi>NRVp4WsTZXuNI^K6cbyrU_`h%L`z_8>WI>3FzAvX zh5`)^(v$4y1K)H-uK4vVWJ;L7pVhJjCrGq|h{$Pt-o0W=Go zzhsarM{0BrOZg?sq>6n%%|78s)zqbdD4O|lrXeFaPy#M=J7!gp#NLav=)9tkG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;qZ9*`E&l1`juB`_E?bmxE4E-Rwfw$6Jy4ic-{6mcZ@P9A zH(lbtT8iepT`QaOJhj24TKa4m#Zbcs%!;X6MDa*E(6o5OS!$~g)YsPoL*(3k$$*vt z>Qh395pgEc>)502@g!gf~!L`nilPkZ!jq~!2EgJkZL=QYS zhw^Y1L%eEvIOV_mhIwaY0cY7z!(ESA`=M{3N)S5XXya?l8!*uOKlCdXYWTkbUZ;Kl zW#iw!fB%<#A70%5rQ-iT5O Date: Fri, 24 Feb 2012 03:45:48 +0100 Subject: [PATCH 49/53] statusicon controller: change back testing var --- SparkleShare/SparkleStatusIconController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index c0212c1b..05671aec 100755 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -145,7 +145,7 @@ namespace SparkleShare { public void AddHostedProjectClicked () { - Program.Controller.ShowSetupWindow (PageType.Tutorial); + Program.Controller.ShowSetupWindow (PageType.Add); } From 71f938b9da7db37163099b98557f032185b2a742 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 24 Feb 2012 04:12:13 +0100 Subject: [PATCH 50/53] setup: fix first run logic --- SparkleShare/Mac/SparkleStatusIcon.cs | 9 ++++----- SparkleShare/SparkleSetupController.cs | 20 +++++++++++++++----- SparkleShare/SparkleStatusIcon.cs | 3 --- SparkleShare/SparkleStatusIconController.cs | 2 +- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleStatusIcon.cs index 90ccd26b..58c4d9cf 100755 --- a/SparkleShare/Mac/SparkleStatusIcon.cs +++ b/SparkleShare/Mac/SparkleStatusIcon.cs @@ -234,11 +234,10 @@ namespace SparkleShare { Enabled = true }; - if (!Program.Controller.FirstRun) { - SyncMenuItem.Activated += delegate { - Controller.AddHostedProjectClicked (); - }; - } + SyncMenuItem.Activated += delegate { + Controller.AddHostedProjectClicked (); + }; + Menu.AddItem (SyncMenuItem); Menu.AddItem (NSMenuItem.SeparatorItem); diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 08bcd946..cc2eca6a 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -108,7 +108,7 @@ namespace SparkleShare { public SparkleSetupController () { - TutorialPageNumber = 1; + TutorialPageNumber = 0; PreviousAddress = ""; PreviousPath = ""; PreviousUrl = ""; @@ -153,14 +153,23 @@ namespace SparkleShare { return; } + if (page_type == PageType.Add) { + if (TutorialPageNumber < 5) { + if (ShowWindowEvent != null) + ShowWindowEvent (); + + return; + + } else { + SelectedPluginChanged (SelectedPluginIndex); + } + } + if (ChangePageEvent != null) ChangePageEvent (page_type, null); if (ShowWindowEvent != null) ShowWindowEvent (); - - if (page_type == PageType.Add) - SelectedPluginChanged (SelectedPluginIndex); }; } @@ -194,7 +203,8 @@ namespace SparkleShare { Program.Controller.GenerateKeyPair (); Program.Controller.ImportPrivateKey (); - Program.Controller.UpdateState (); + + TutorialPageNumber = 1; if (ChangePageEvent != null) ChangePageEvent (PageType.Tutorial, null); diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 2aaa456b..b69c36e3 100755 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -249,9 +249,6 @@ namespace SparkleShare { // Opens the wizard to add a new remote folder MenuItem sync_item = new MenuItem (_("Add Hosted Project…")); - - if (Program.Controller.FirstRun) - sync_item.Sensitive = false; sync_item.Activated += delegate { Controller.AddHostedProjectClicked (); diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index 05671aec..e65b2c98 100755 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -145,7 +145,7 @@ namespace SparkleShare { public void AddHostedProjectClicked () { - Program.Controller.ShowSetupWindow (PageType.Add); + Program.Controller.ShowSetupWindow (PageType.Add); } From 5d7c9a79aca4d96a084245031c3a5a25145bcf62 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 24 Feb 2012 18:50:05 +0100 Subject: [PATCH 51/53] Allow invites and plugins to set a custom . Closes #562 --- SparkleLib/SparkleConfig.cs | 25 ++++++------- SparkleShare/SparkleController.cs | 40 +++++++++++---------- SparkleShare/SparkleControllerBase.cs | 24 +++++++++---- SparkleShare/SparkleInvite.cs | 39 +++++++++++++------- SparkleShare/SparklePlugin.cs | 6 ++++ SparkleShare/SparkleSetupController.cs | 23 +++++++----- SparkleShare/SparkleStatusIconController.cs | 2 +- 7 files changed, 101 insertions(+), 58 deletions(-) diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs index 57a677b2..d6a6915a 100755 --- a/SparkleLib/SparkleConfig.cs +++ b/SparkleLib/SparkleConfig.cs @@ -18,8 +18,8 @@ using System; using System.IO; using System.Collections.Generic; -using System.Xml; using System.Security.Principal; +using System.Xml; namespace SparkleLib { @@ -167,7 +167,7 @@ namespace SparkleLib { XmlNode email_node = SelectSingleNode ("/sparkleshare/user/email/text()"); email_node.InnerText = user.Email; - this.Save (); + Save (); // ConfigureSSH (); } @@ -252,7 +252,7 @@ namespace SparkleLib { XmlNode node_root = SelectSingleNode ("/sparkleshare"); node_root.AppendChild (node_folder); - this.Save (); + Save (); } @@ -263,32 +263,32 @@ namespace SparkleLib { SelectSingleNode ("/sparkleshare").RemoveChild (node_folder); } - this.Save (); + Save (); } public bool FolderExists (string name) { - XmlNode folder = this.GetFolder (name); + XmlNode folder = GetFolder (name); return (folder != null); } public string GetBackendForFolder (string name) { - return this.GetFolderValue (name, "backend"); + return GetFolderValue (name, "backend"); } public string GetUrlForFolder (string name) { - return this.GetFolderValue (name, "url"); + return GetFolderValue (name, "url"); } public bool SetFolderOptionalAttribute (string folder_name, string key, string value) { - XmlNode folder = this.GetFolder (folder_name); + XmlNode folder = GetFolder (folder_name); if (folder == null) return false; @@ -302,13 +302,14 @@ namespace SparkleLib { folder.AppendChild (new_node); } + Save (); return true; } public string GetFolderOptionalAttribute (string folder_name, string key) { - XmlNode folder = this.GetFolder (folder_name); + XmlNode folder = GetFolder (folder_name); if (folder != null) { if (folder [key] != null) @@ -368,7 +369,7 @@ namespace SparkleLib { private string GetFolderValue (string name, string key) { - XmlNode folder = this.GetFolder(name); + XmlNode folder = GetFolder(name); if ((folder != null) && (folder [key] != null)) { return folder [key].InnerText; @@ -405,7 +406,7 @@ namespace SparkleLib { } SparkleHelpers.DebugInfo ("Config", "Updated " + name + ":" + content); - this.Save (); + Save (); } @@ -414,7 +415,7 @@ namespace SparkleLib { if (!File.Exists (FullPath)) throw new ConfigFileNotFoundException (FullPath + " does not exist"); - this.Save (FullPath); + Save (FullPath); SparkleHelpers.DebugInfo ("Config", "Updated \"" + FullPath + "\""); } diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index db8c93b8..5dcd461e 100755 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -47,10 +47,10 @@ namespace SparkleShare { // start SparkleShare automatically at login public override void CreateStartupItem () { - // TODO: check whether this still works - - string autostart_path = Path.Combine (Environment.GetFolderPath ( - Environment.SpecialFolder.ApplicationData), "autostart"); + string autostart_path = Path.Combine ( + Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), + "autostart" + ); string desktopfile_path = Path.Combine (autostart_path, "sparkleshare.desktop"); @@ -58,22 +58,26 @@ namespace SparkleShare { Directory.CreateDirectory (autostart_path); if (!File.Exists (desktopfile_path)) { - TextWriter writer = new StreamWriter (desktopfile_path); - writer.WriteLine ("[Desktop Entry]\n" + - "Type=Application\n" + - "Name=SparkleShare\n" + - "Exec=sparkleshare start\n" + - "Icon=folder-sparkleshare\n" + - "Terminal=false\n" + - "X-GNOME-Autostart-enabled=true\n" + - "Categories=Network"); - writer.Close (); + try { + File.WriteAllText (desktopfile_path, + "[Desktop Entry]\n" + + "Type=Application\n" + + "Name=SparkleShare\n" + + "Exec=sparkleshare start\n" + + "Icon=folder-sparkleshare\n" + + "Terminal=false\n" + + "X-GNOME-Autostart-enabled=true\n" + + "Categories=Network"); - // Give the launcher the right permissions so it can be launched by the user - UnixFileInfo file_info = new UnixFileInfo (desktopfile_path); - file_info.Create (FileAccessPermissions.UserReadWriteExecute); + // Give the launcher the right permissions so it can be launched by the user + UnixFileInfo file_info = new UnixFileInfo (desktopfile_path); + file_info.Create (FileAccessPermissions.UserReadWriteExecute); - SparkleHelpers.DebugInfo ("Controller", "Enabled autostart on login"); + SparkleHelpers.DebugInfo ("Controller", "Added " + app_path + " to login items"); + + } catch (Exception e) { + SparkleHelpers.DebugInfo ("Controller", "Failed adding " + app_path + " to login items: " + e.Message); + } } } diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index eccd7034..9855f5bf 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -174,16 +174,18 @@ namespace SparkleShare { if (InviteReceived != null) { SparkleInvite invite = new SparkleInvite (args.FullPath); - if (invite.Valid) { + if (invite.IsValid) { InviteReceived (invite); - File.Delete (args.FullPath); } else { + invite = null; + if (AlertNotificationRaised != null) AlertNotificationRaised ("Oh noes!", "This invite seems screwed up..."); } + File.Delete (args.FullPath); } } }; @@ -965,10 +967,14 @@ namespace SparkleShare { } - public void FetchFolder (string server, string remote_folder) + public void FetchFolder (string server, string remote_folder, string announcements_url) { - server = server.Trim (); - remote_folder = remote_folder.Trim (); + server = server.Trim (); + remote_folder = remote_folder.Trim (); + + if (announcements_url != null) + announcements_url = announcements_url.Trim (); + string tmp_path = SparkleConfig.DefaultConfig.TmpPath; if (!Directory.Exists (tmp_path)) { @@ -1038,8 +1044,14 @@ namespace SparkleShare { try { Directory.Move (tmp_folder, target_folder_path); - SparkleConfig.DefaultConfig.AddFolder (target_folder_name, this.fetcher.RemoteUrl, backend); + + if (!string.IsNullOrEmpty (announcements_url)) { + SparkleConfig.DefaultConfig.SetFolderOptionalAttribute (target_folder_name, + "announcements_url", announcements_url); + } + + AddRepository (target_folder_path); if (FolderFetched != null) diff --git a/SparkleShare/SparkleInvite.cs b/SparkleShare/SparkleInvite.cs index 782fa76a..2252c242 100644 --- a/SparkleShare/SparkleInvite.cs +++ b/SparkleShare/SparkleInvite.cs @@ -30,8 +30,10 @@ namespace SparkleShare { public string Address { get; private set; } public string RemotePath { get; private set; } public Uri AcceptUrl { get; private set; } + public Uri AnnouncementsUrl { get; private set; } - public bool Valid { + + public bool IsValid { get { return (!string.IsNullOrEmpty (Address) && !string.IsNullOrEmpty (RemotePath)); @@ -39,9 +41,17 @@ namespace SparkleShare { } - public SparkleInvite (string address, string remote_path, string accept_url) + public SparkleInvite (string address, string remote_path, + string accept_url) { - Initialize (address, remote_path, accept_url); + Initialize (address, remote_path, accept_url, null); + } + + + public SparkleInvite (string address, string remote_path, + string accept_url, string announcements_url) + { + Initialize (address, remote_path, accept_url, announcements_url); } @@ -50,10 +60,10 @@ namespace SparkleShare { XmlDocument xml_document = new XmlDocument (); XmlNode node; - string address = ""; - string remote_path = ""; - string accept_url = ""; - + string address = ""; + string remote_path = ""; + string accept_url = ""; + string announcements_url = ""; try { xml_document.Load (xml_file_path); @@ -67,7 +77,10 @@ namespace SparkleShare { node = xml_document.SelectSingleNode ("/sparkleshare/invite/accept_url/text()"); if (node != null) { accept_url = node.Value; } - Initialize (address, remote_path, accept_url); + node = xml_document.SelectSingleNode ("/sparkleshare/invite/announcements_url/text()"); + if (node != null) { announcements_url = node.Value; } + + Initialize (address, remote_path, accept_url, announcements_url); } catch (XmlException e) { SparkleHelpers.DebugInfo ("Invite", "Invalid XML: " + e.Message); @@ -115,11 +128,13 @@ namespace SparkleShare { } - private void Initialize (string address, string remote_path, string accept_url) + private void Initialize (string address, string remote_path, + string accept_url, string announcements_url) { - Address = address; - RemotePath = remote_path; - AcceptUrl = new Uri (accept_url); + Address = address; + RemotePath = remote_path; + AcceptUrl = new Uri (accept_url); + AnnouncementsUrl = new Uri (announcements_url); } } } diff --git a/SparkleShare/SparklePlugin.cs b/SparkleShare/SparklePlugin.cs index 3868438b..b3d2db81 100644 --- a/SparkleShare/SparklePlugin.cs +++ b/SparkleShare/SparklePlugin.cs @@ -49,6 +49,12 @@ namespace SparkleShare { } } + public string AnnouncementsUrl { + get { + return GetValue ("info", "announcements_url"); + } + } + public string Address { get { return GetValue ("address", "value"); diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index cc2eca6a..2f2fadf0 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -71,12 +71,12 @@ namespace SparkleShare { public readonly List Plugins = new List (); public SparklePlugin SelectedPlugin; + public SparkleInvite PendingInvite { get; private set; } public int TutorialPageNumber { get; private set; } public string PreviousUrl { get; private set; } public string PreviousAddress { get; private set; } public string PreviousPath { get; private set; } public string SyncingFolder { get; private set; } - public SparkleInvite PendingInvite; public int SelectedPluginIndex { @@ -135,8 +135,6 @@ namespace SparkleShare { Program.Controller.InviteReceived += delegate (SparkleInvite invite) { - PendingInvite = invite; - if (ChangePageEvent != null) ChangePageEvent (PageType.Invite, null); @@ -154,15 +152,21 @@ namespace SparkleShare { } if (page_type == PageType.Add) { - if (TutorialPageNumber < 5) { + if (!Program.Controller.FirstRun && + (TutorialPageNumber == 0 || + TutorialPageNumber > 4)) { + + if (ChangePageEvent != null) + ChangePageEvent (page_type, null); + if (ShowWindowEvent != null) ShowWindowEvent (); - return; - - } else { SelectedPluginChanged (SelectedPluginIndex); + } + + return; } if (ChangePageEvent != null) @@ -332,7 +336,7 @@ namespace SparkleShare { UpdateProgressBarEvent (percentage); }; - Program.Controller.FetchFolder (address, path); + Program.Controller.FetchFolder (address, path, SelectedPlugin.AnnouncementsUrl); } @@ -383,7 +387,8 @@ namespace SparkleShare { UpdateProgressBarEvent (percentage); }; - Program.Controller.FetchFolder (PendingInvite.Address, PendingInvite.RemotePath); + Program.Controller.FetchFolder (PendingInvite.Address, + PendingInvite.RemotePath, PendingInvite.AnnouncementsUrl.ToString ()); } diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index e65b2c98..05671aec 100755 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -145,7 +145,7 @@ namespace SparkleShare { public void AddHostedProjectClicked () { - Program.Controller.ShowSetupWindow (PageType.Add); + Program.Controller.ShowSetupWindow (PageType.Add); } From 86ab06486a6cb6272b1573a4ace6887cdb3fc76e Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 24 Feb 2012 21:31:45 +0100 Subject: [PATCH 52/53] Invite page for Linux --- SparkleShare/SparkleSetup.cs | 57 +++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index 3af57d68..6f31c200 100755 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -68,7 +68,6 @@ namespace SparkleShare { "Don't worry, this information is only visible to your team members."; - Table table = new Table (2, 3, true) { RowSpacing = 6, ColumnSpacing = 6 @@ -329,6 +328,62 @@ namespace SparkleShare { break; } + case PageType.Invite: { + + Header = _("You've reveived an invite!"); + Description = _("Do you want to add this project to SparkleShare?"); + + + Table table = new Table (2, 3, true) { + RowSpacing = 6, + ColumnSpacing = 6 + }; + + Label address_label = new Label (_("Address:")) { + Xalign = 1 + }; + + Label path_label = new Label (_("Remote Path:")) { + Xalign = 1 + }; + + Label address_value = new Label ("" + Controller.PendingInvite.Address + "") { + UseMarkup = true, + Xalign = 0 + }; + + Label path_value = new Label ("" + Controller.PendingInvite.RemotePath + "") { + UseMarkup = true, + Xalign = 0 + }; + + table.Attach (address_label, 0, 1, 0, 1); + table.Attach (address_value, 1, 2, 0, 1); + table.Attach (path_label, 0, 1, 1, 2); + table.Attach (path_value, 1, 2, 1, 2); + + VBox wrapper = new VBox (false, 9); + wrapper.PackStart (table, true, false, 0); + + Button cancel_button = new Button (_("Cancel")); + + cancel_button.Clicked += delegate { + Controller.PageCancelled (); + }; + + Button add_button = new Button (_("Add")); + + add_button.Clicked += delegate { + Controller.InvitePageCompleted (); + }; + + AddButton (cancel_button); + AddButton (add_button); + Add (wrapper); + + break; + } + case PageType.Syncing: { Header = String.Format (_("Adding project ‘{0}’…"), Controller.SyncingFolder); From 29ff2335f8778abc7f3b27283095c77a11f1fd2d Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 24 Feb 2012 21:58:39 +0100 Subject: [PATCH 53/53] setup: Add UI for '[X] Add SparkleShare to startup items' on Linux --- SparkleShare/SparkleSetup.cs | 8 +++++++- SparkleShare/SparkleSetupWindow.cs | 23 ++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index 6f31c200..29578ac2 100755 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -623,9 +623,15 @@ namespace SparkleShare { Controller.FinishPageCompleted (); }; - // TODO: Add startup item checkbox here + + check_button = new CheckButton ("Add SparkleShare to startup items"); + + check_button.Toggled += delegate { + Controller.StartupItemChanged (check_button.Active); + }; Add (slide); + AddOption (check_button); AddButton (finish_button); break; diff --git a/SparkleShare/SparkleSetupWindow.cs b/SparkleShare/SparkleSetupWindow.cs index 1f13927f..1f4f347b 100755 --- a/SparkleShare/SparkleSetupWindow.cs +++ b/SparkleShare/SparkleSetupWindow.cs @@ -29,9 +29,11 @@ namespace SparkleShare { public class SparkleSetupWindow : Window { + // TODO: caps private HBox HBox; private VBox VBox; private VBox Wrapper; + private VBox OptionArea; private HButtonBox Buttons; public string Header; @@ -72,10 +74,22 @@ namespace SparkleShare { BorderWidth = 0 }; + OptionArea = new VBox (false, 0) { + BorderWidth = 0 + }; + Buttons = CreateButtonBox (); + + HBox layout_horizontal = new HBox (false , 0) { + BorderWidth = 0 + }; + + layout_horizontal.PackStart (OptionArea, true, true, 0); + layout_horizontal.PackStart (Buttons, false, false, 0); + VBox.PackStart (Wrapper, true, true, 0); - VBox.PackStart (Buttons, false, false, 15); + VBox.PackStart (layout_horizontal, false, false, 15); EventBox box = new EventBox (); Gdk.Color bg_color = new Gdk.Color (); @@ -111,6 +125,13 @@ namespace SparkleShare { } + public void AddOption (Widget widget) + { + OptionArea.Add (widget); + ShowAll (); + } + + new public void Add (Widget widget) { Label header = new Label ("" + Header + "") {