diff --git a/SparkleLib/Makefile.am b/SparkleLib/Makefile.am index 87efac60..9d0cf6a5 100755 --- a/SparkleLib/Makefile.am +++ b/SparkleLib/Makefile.am @@ -4,7 +4,6 @@ TARGET = library ASSEMBLY_INFO_SOURCE = Defines.cs SOURCES = \ - SparkleAnnouncement.cs \ SparkleBackend.cs \ SparkleConfig.cs \ SparkleExceptions.cs \ diff --git a/SparkleLib/SparkleAnnouncement.cs b/SparkleLib/SparkleAnnouncement.cs deleted file mode 100644 index 9ec5cf56..00000000 --- a/SparkleLib/SparkleAnnouncement.cs +++ /dev/null @@ -1,34 +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 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 SparkleAnnouncement { - - public readonly string FolderIdentifier; - public readonly string Message; - - - public SparkleAnnouncement (string folder_identifier, string message) - { - FolderIdentifier = folder_identifier; - Message = message; - } - } -} diff --git a/SparkleLib/SparkleLib.csproj b/SparkleLib/SparkleLib.csproj index ebb359b8..3137978b 100644 --- a/SparkleLib/SparkleLib.csproj +++ b/SparkleLib/SparkleLib.csproj @@ -37,7 +37,6 @@ - diff --git a/SparkleLib/SparkleListenerFactory.cs b/SparkleLib/SparkleListenerFactory.cs index 30b12e97..ea4ee0e7 100644 --- a/SparkleLib/SparkleListenerFactory.cs +++ b/SparkleLib/SparkleListenerFactory.cs @@ -37,12 +37,6 @@ namespace SparkleLib { // This is SparkleShare's centralized notification service. // It communicates "It's time to sync!" signals between clients. // - // Here's how it works: the client listens to a channel (the - // folder identifier, a SHA-1 hash) for when it's time to sync. - // Clients also send the current revision hash to the channel - // for other clients to pick up when you've synced up any - // changes. - // // Please see the SparkleShare wiki if you wish to run // your own service instead if (string.IsNullOrEmpty (uri)) diff --git a/SparkleLib/SparkleWatcher.cs b/SparkleLib/SparkleWatcher.cs index 4b6d75de..20c571f3 100755 --- a/SparkleLib/SparkleWatcher.cs +++ b/SparkleLib/SparkleWatcher.cs @@ -22,8 +22,8 @@ namespace SparkleLib { public class SparkleWatcher : FileSystemWatcher { + public event ChangeEventEventHandler ChangeEvent = delegate { }; public delegate void ChangeEventEventHandler (FileSystemEventArgs args); - public event ChangeEventEventHandler ChangeEvent; private Object thread_lock = new Object (); @@ -34,25 +34,16 @@ namespace SparkleLib { EnableRaisingEvents = true; Filter = "*"; - Changed += delegate (object o, FileSystemEventArgs args) { - if (ChangeEvent != null) - ChangeEvent (args); - }; + Changed += OnChanged; + Created += OnChanged; + Deleted += OnChanged; + Renamed += OnChanged; + } - Created += delegate (object o, FileSystemEventArgs args) { - if (ChangeEvent != null) - ChangeEvent (args); - }; - Deleted += delegate (object o, FileSystemEventArgs args) { - if (ChangeEvent != null) - ChangeEvent (args); - }; - - Renamed += delegate (object o, RenamedEventArgs args) { - if (ChangeEvent != null) - ChangeEvent (args); - }; + private void OnChanged (object sender, FileSystemEventArgs args) + { + ChangeEvent (args); } diff --git a/SparkleLib/SparkleWrappers.cs b/SparkleLib/SparkleWrappers.cs index 82cf0262..bf60ddcf 100644 --- a/SparkleLib/SparkleWrappers.cs +++ b/SparkleLib/SparkleWrappers.cs @@ -75,4 +75,18 @@ namespace SparkleLib { Name = name; } } + + + public class SparkleAnnouncement { + + public readonly string FolderIdentifier; + public readonly string Message; + + + public SparkleAnnouncement (string folder_identifier, string message) + { + FolderIdentifier = folder_identifier; + Message = message; + } + } } diff --git a/SparkleShare/Linux/SparkleStatusIcon.cs b/SparkleShare/Linux/SparkleStatusIcon.cs index d523ad4d..cc3a58ae 100644 --- a/SparkleShare/Linux/SparkleStatusIcon.cs +++ b/SparkleShare/Linux/SparkleStatusIcon.cs @@ -281,12 +281,13 @@ namespace SparkleShare { private void CreateAnimationFrames () { - this.animation_frames = new Gdk.Pixbuf [5]; - this.animation_frames [0] = SparkleUIHelpers.GetIcon ("process-syncing-i", 24); - this.animation_frames [1] = SparkleUIHelpers.GetIcon ("process-syncing-ii", 24); - this.animation_frames [2] = SparkleUIHelpers.GetIcon ("process-syncing-iii", 24); - this.animation_frames [3] = SparkleUIHelpers.GetIcon ("process-syncing-iiii", 24); - this.animation_frames [4] = SparkleUIHelpers.GetIcon ("process-syncing-iiiii", 24); + this.animation_frames = new Gdk.Pixbuf [] { + SparkleUIHelpers.GetIcon ("process-syncing-i", 24), + SparkleUIHelpers.GetIcon ("process-syncing-ii", 24), + SparkleUIHelpers.GetIcon ("process-syncing-iii", 24), + SparkleUIHelpers.GetIcon ("process-syncing-iiii", 24), + SparkleUIHelpers.GetIcon ("process-syncing-iiiii", 24) + } } diff --git a/SparkleShare/Mac/SparkleController.cs b/SparkleShare/Mac/SparkleController.cs index 4d892825..4f3b4ecd 100755 --- a/SparkleShare/Mac/SparkleController.cs +++ b/SparkleShare/Mac/SparkleController.cs @@ -102,8 +102,9 @@ namespace SparkleShare { // 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.StartInfo.FileName = "osascript"; - process.StartInfo.UseShellExecute = false; + process.StartInfo.FileName = "osascript"; + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.UseShellExecute = false; process.StartInfo.Arguments = "-e 'tell application \"System Events\" to " + "make login item at end with properties {path:\"" + NSBundle.MainBundle.BundlePath + "\", hidden:false}'"; diff --git a/SparkleShare/Mac/SparkleMacWatcher.cs b/SparkleShare/Mac/SparkleMacWatcher.cs index 8f338c8f..88ca7d28 100755 --- a/SparkleShare/Mac/SparkleMacWatcher.cs +++ b/SparkleShare/Mac/SparkleMacWatcher.cs @@ -1,19 +1,3 @@ -// 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 . - // Originally taken from: // https://github.com/jesse99/Continuum/blob/master/source/shared/DirectoryWatcher.cs // Modified to use MonoMac and integrate into SparkleShare @@ -120,7 +104,6 @@ namespace SparkleShare { GC.SuppressFinalize (this); throw new InvalidOperationException ("Failed to start FSEvent stream for " + path); } - } @@ -186,36 +169,23 @@ namespace SparkleShare { private extern static IntPtr CFRunLoopGetMain (); [DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")] - private extern static IntPtr FSEventStreamCreate ( - IntPtr allocator, - FSEventStreamCallback callback, - IntPtr context, - IntPtr pathsToWatch, - ulong sinceWhen, - double latency, - FSEventStreamCreateFlags flags); + private extern static IntPtr FSEventStreamCreate (IntPtr allocator, FSEventStreamCallback callback, + IntPtr context, IntPtr pathsToWatch, ulong sinceWhen, double latency, FSEventStreamCreateFlags flags); [DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")] - private extern static void FSEventStreamScheduleWithRunLoop ( - IntPtr streamRef, - IntPtr runLoop, - IntPtr runLoopMode); + private extern static void FSEventStreamScheduleWithRunLoop (IntPtr streamRef, IntPtr runLoop, IntPtr runLoopMode); - [DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")] [return: MarshalAs (UnmanagedType.U1)] - private extern static bool FSEventStreamStart ( - IntPtr streamRef); + [DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")] + private extern static bool FSEventStreamStart (IntPtr streamRef); [DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")] - private extern static void FSEventStreamStop ( - IntPtr streamRef); + private extern static void FSEventStreamStop (IntPtr streamRef); [DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")] - private extern static void FSEventStreamInvalidate ( - IntPtr streamRef); + private extern static void FSEventStreamInvalidate (IntPtr streamRef); [DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")] - private extern static void FSEventStreamRelease ( - IntPtr streamRef); + private extern static void FSEventStreamRelease (IntPtr streamRef); } } diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleStatusIcon.cs index 76203219..7f39ca69 100755 --- a/SparkleShare/Mac/SparkleStatusIcon.cs +++ b/SparkleShare/Mac/SparkleStatusIcon.cs @@ -113,9 +113,7 @@ namespace SparkleShare { Controller.UpdateMenuEvent += delegate { using (var a = new NSAutoreleasePool ()) { - InvokeOnMainThread (delegate { - CreateMenu (); - }); + InvokeOnMainThread (() => CreateMenu); } }; @@ -321,35 +319,26 @@ namespace SparkleShare { private void CreateAnimationFrames () { this.animation_frames = new NSImage [] { - new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, - "Pixmaps", "process-syncing-i.png")), - new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, - "Pixmaps", "process-syncing-ii.png")), - new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, - "Pixmaps", "process-syncing-iii.png")), - new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, - "Pixmaps", "process-syncing-iiii.png")), - new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, - "Pixmaps", "process-syncing-iiiii.png")) + new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-i.png")), + new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-ii.png")), + new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iii.png")), + new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiii.png")), + new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiiii.png")) }; this.animation_frames_active = new NSImage [] { - new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, - "Pixmaps", "process-syncing-i-active.png")), - new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, - "Pixmaps", "process-syncing-ii-active.png")), - new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, - "Pixmaps", "process-syncing-iii-active.png")), - new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, - "Pixmaps", "process-syncing-iiii-active.png")), - new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, - "Pixmaps", "process-syncing-iiiii-active.png")) + new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-i-active.png")), + new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-ii-active.png")), + new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iii-active.png")), + new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiii-active.png")), + new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiiii-active.png")) }; - this.error_image = new NSImage (NSBundle.MainBundle.ResourcePath + - "/Pixmaps/process-syncing-error.png"); - this.error_image_active = new NSImage (NSBundle.MainBundle.ResourcePath + - "/Pixmaps/process-syncing-error-active.png"); + this.error_image = new NSImage ( + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-error.png")); + + this.error_image_active = new NSImage ( + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-error.png")); } } diff --git a/SparkleShare/SparklePlugin.cs b/SparkleShare/SparklePlugin.cs index 379d6dca..7d66d826 100644 --- a/SparkleShare/SparklePlugin.cs +++ b/SparkleShare/SparklePlugin.cs @@ -29,18 +29,15 @@ namespace SparkleShare { public static string LocalPluginsPath = new string [] { Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "sparkleshare", "plugins" }.Combine (); - - public string Name { - get { - return GetValue ("info", "name"); - } - } - - public string Description { - get { - return GetValue ("info", "description"); - } - } + public string Name { get { return GetValue ("info", "name"); } } + public string Description { get { return GetValue ("info", "description"); } } + public string Backend { get { return GetValue ("info", "backend"); } } + public string Fingerprint { get { return GetValue ("info", "fingerprint"); } } + public string AnnouncementsUrl { get { return GetValue ("info", "announcements_url"); } } + public string Address { get { return GetValue ("address", "value"); } } + public string AddressExample { get { return GetValue ("address", "example"); } } + public string Path { get { return GetValue ("path", "value"); } } + public string PathExample { get { return GetValue ("path", "example"); } } public string ImagePath { get { @@ -53,48 +50,6 @@ namespace SparkleShare { return IO.Path.Combine (PluginsPath, image_file_name); } } - - public string Backend { - get { - return GetValue ("info", "backend"); - } - } - - public string Fingerprint { - get { - return GetValue ("info", "fingerprint"); - } - } - - public string Address { - get { - return GetValue ("address", "value"); - } - } - - public string AddressExample { - get { - return GetValue ("address", "example"); - } - } - - public string Path { - get { - return GetValue ("path", "value"); - } - } - - public string PathExample { - get { - return GetValue ("path", "example"); - } - } - - public string AnnouncementsUrl { - get { - return GetValue ("info", "announcements_url"); - } - } public bool PathUsesLowerCase { get {