Cleanups
This commit is contained in:
parent
c9e4218358
commit
0109856700
|
@ -4,7 +4,6 @@ TARGET = library
|
||||||
ASSEMBLY_INFO_SOURCE = Defines.cs
|
ASSEMBLY_INFO_SOURCE = Defines.cs
|
||||||
|
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
SparkleAnnouncement.cs \
|
|
||||||
SparkleBackend.cs \
|
SparkleBackend.cs \
|
||||||
SparkleConfig.cs \
|
SparkleConfig.cs \
|
||||||
SparkleExceptions.cs \
|
SparkleExceptions.cs \
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
// SparkleShare, a collaboration and sharing tool.
|
|
||||||
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
|
||||||
//
|
|
||||||
// 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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -37,7 +37,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="SparkleRepoBase.cs" />
|
<Compile Include="SparkleRepoBase.cs" />
|
||||||
<Compile Include="SparkleFetcherBase.cs" />
|
<Compile Include="SparkleFetcherBase.cs" />
|
||||||
<Compile Include="SparkleAnnouncement.cs" />
|
|
||||||
<Compile Include="SparkleWrappers.cs" />
|
<Compile Include="SparkleWrappers.cs" />
|
||||||
<Compile Include="SparkleListenerBase.cs" />
|
<Compile Include="SparkleListenerBase.cs" />
|
||||||
<Compile Include="SparkleListenerFactory.cs" />
|
<Compile Include="SparkleListenerFactory.cs" />
|
||||||
|
|
|
@ -37,12 +37,6 @@ namespace SparkleLib {
|
||||||
// This is SparkleShare's centralized notification service.
|
// This is SparkleShare's centralized notification service.
|
||||||
// It communicates "It's time to sync!" signals between clients.
|
// 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
|
// Please see the SparkleShare wiki if you wish to run
|
||||||
// your own service instead
|
// your own service instead
|
||||||
if (string.IsNullOrEmpty (uri))
|
if (string.IsNullOrEmpty (uri))
|
||||||
|
|
|
@ -22,8 +22,8 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public class SparkleWatcher : FileSystemWatcher {
|
public class SparkleWatcher : FileSystemWatcher {
|
||||||
|
|
||||||
|
public event ChangeEventEventHandler ChangeEvent = delegate { };
|
||||||
public delegate void ChangeEventEventHandler (FileSystemEventArgs args);
|
public delegate void ChangeEventEventHandler (FileSystemEventArgs args);
|
||||||
public event ChangeEventEventHandler ChangeEvent;
|
|
||||||
|
|
||||||
private Object thread_lock = new Object ();
|
private Object thread_lock = new Object ();
|
||||||
|
|
||||||
|
@ -34,25 +34,16 @@ namespace SparkleLib {
|
||||||
EnableRaisingEvents = true;
|
EnableRaisingEvents = true;
|
||||||
Filter = "*";
|
Filter = "*";
|
||||||
|
|
||||||
Changed += delegate (object o, FileSystemEventArgs args) {
|
Changed += OnChanged;
|
||||||
if (ChangeEvent != null)
|
Created += OnChanged;
|
||||||
ChangeEvent (args);
|
Deleted += OnChanged;
|
||||||
};
|
Renamed += OnChanged;
|
||||||
|
}
|
||||||
|
|
||||||
Created += delegate (object o, FileSystemEventArgs args) {
|
|
||||||
if (ChangeEvent != null)
|
|
||||||
ChangeEvent (args);
|
|
||||||
};
|
|
||||||
|
|
||||||
Deleted += delegate (object o, FileSystemEventArgs args) {
|
private void OnChanged (object sender, FileSystemEventArgs args)
|
||||||
if (ChangeEvent != null)
|
{
|
||||||
ChangeEvent (args);
|
ChangeEvent (args);
|
||||||
};
|
|
||||||
|
|
||||||
Renamed += delegate (object o, RenamedEventArgs args) {
|
|
||||||
if (ChangeEvent != null)
|
|
||||||
ChangeEvent (args);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,4 +75,18 @@ namespace SparkleLib {
|
||||||
Name = name;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,12 +281,13 @@ namespace SparkleShare {
|
||||||
|
|
||||||
private void CreateAnimationFrames ()
|
private void CreateAnimationFrames ()
|
||||||
{
|
{
|
||||||
this.animation_frames = new Gdk.Pixbuf [5];
|
this.animation_frames = new Gdk.Pixbuf [] {
|
||||||
this.animation_frames [0] = SparkleUIHelpers.GetIcon ("process-syncing-i", 24);
|
SparkleUIHelpers.GetIcon ("process-syncing-i", 24),
|
||||||
this.animation_frames [1] = SparkleUIHelpers.GetIcon ("process-syncing-ii", 24);
|
SparkleUIHelpers.GetIcon ("process-syncing-ii", 24),
|
||||||
this.animation_frames [2] = SparkleUIHelpers.GetIcon ("process-syncing-iii", 24);
|
SparkleUIHelpers.GetIcon ("process-syncing-iii", 24),
|
||||||
this.animation_frames [3] = SparkleUIHelpers.GetIcon ("process-syncing-iiii", 24);
|
SparkleUIHelpers.GetIcon ("process-syncing-iiii", 24),
|
||||||
this.animation_frames [4] = SparkleUIHelpers.GetIcon ("process-syncing-iiiii", 24);
|
SparkleUIHelpers.GetIcon ("process-syncing-iiiii", 24)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,7 @@ namespace SparkleShare {
|
||||||
// we call out to an applescript to do the job
|
// we call out to an applescript to do the job
|
||||||
Process process = new Process ();
|
Process process = new Process ();
|
||||||
process.StartInfo.FileName = "osascript";
|
process.StartInfo.FileName = "osascript";
|
||||||
|
process.StartInfo.RedirectStandardOutput = true;
|
||||||
process.StartInfo.UseShellExecute = false;
|
process.StartInfo.UseShellExecute = false;
|
||||||
|
|
||||||
process.StartInfo.Arguments = "-e 'tell application \"System Events\" to " +
|
process.StartInfo.Arguments = "-e 'tell application \"System Events\" to " +
|
||||||
|
|
|
@ -1,19 +1,3 @@
|
||||||
// SparkleShare, a collaboration and sharing tool.
|
|
||||||
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
|
||||||
//
|
|
||||||
// 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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
// Originally taken from:
|
// Originally taken from:
|
||||||
// https://github.com/jesse99/Continuum/blob/master/source/shared/DirectoryWatcher.cs
|
// https://github.com/jesse99/Continuum/blob/master/source/shared/DirectoryWatcher.cs
|
||||||
// Modified to use MonoMac and integrate into SparkleShare
|
// Modified to use MonoMac and integrate into SparkleShare
|
||||||
|
@ -120,7 +104,6 @@ namespace SparkleShare {
|
||||||
GC.SuppressFinalize (this);
|
GC.SuppressFinalize (this);
|
||||||
throw new InvalidOperationException ("Failed to start FSEvent stream for " + path);
|
throw new InvalidOperationException ("Failed to start FSEvent stream for " + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,36 +169,23 @@ namespace SparkleShare {
|
||||||
private extern static IntPtr CFRunLoopGetMain ();
|
private extern static IntPtr CFRunLoopGetMain ();
|
||||||
|
|
||||||
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
||||||
private extern static IntPtr FSEventStreamCreate (
|
private extern static IntPtr FSEventStreamCreate (IntPtr allocator, FSEventStreamCallback callback,
|
||||||
IntPtr allocator,
|
IntPtr context, IntPtr pathsToWatch, ulong sinceWhen, double latency, FSEventStreamCreateFlags flags);
|
||||||
FSEventStreamCallback callback,
|
|
||||||
IntPtr context,
|
|
||||||
IntPtr pathsToWatch,
|
|
||||||
ulong sinceWhen,
|
|
||||||
double latency,
|
|
||||||
FSEventStreamCreateFlags flags);
|
|
||||||
|
|
||||||
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
||||||
private extern static void FSEventStreamScheduleWithRunLoop (
|
private extern static void FSEventStreamScheduleWithRunLoop (IntPtr streamRef, IntPtr runLoop, IntPtr runLoopMode);
|
||||||
IntPtr streamRef,
|
|
||||||
IntPtr runLoop,
|
|
||||||
IntPtr runLoopMode);
|
|
||||||
|
|
||||||
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
|
||||||
[return: MarshalAs (UnmanagedType.U1)]
|
[return: MarshalAs (UnmanagedType.U1)]
|
||||||
private extern static bool FSEventStreamStart (
|
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
||||||
IntPtr streamRef);
|
private extern static bool FSEventStreamStart (IntPtr streamRef);
|
||||||
|
|
||||||
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
||||||
private extern static void FSEventStreamStop (
|
private extern static void FSEventStreamStop (IntPtr streamRef);
|
||||||
IntPtr streamRef);
|
|
||||||
|
|
||||||
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
||||||
private extern static void FSEventStreamInvalidate (
|
private extern static void FSEventStreamInvalidate (IntPtr streamRef);
|
||||||
IntPtr streamRef);
|
|
||||||
|
|
||||||
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
[DllImport("/System/Library/Frameworks/CoreServices.framework/CoreServices")]
|
||||||
private extern static void FSEventStreamRelease (
|
private extern static void FSEventStreamRelease (IntPtr streamRef);
|
||||||
IntPtr streamRef);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,9 +113,7 @@ namespace SparkleShare {
|
||||||
Controller.UpdateMenuEvent += delegate {
|
Controller.UpdateMenuEvent += delegate {
|
||||||
using (var a = new NSAutoreleasePool ())
|
using (var a = new NSAutoreleasePool ())
|
||||||
{
|
{
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (() => CreateMenu);
|
||||||
CreateMenu ();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -321,35 +319,26 @@ namespace SparkleShare {
|
||||||
private void CreateAnimationFrames ()
|
private void CreateAnimationFrames ()
|
||||||
{
|
{
|
||||||
this.animation_frames = new NSImage [] {
|
this.animation_frames = new NSImage [] {
|
||||||
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath,
|
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-i.png")),
|
||||||
"Pixmaps", "process-syncing-i.png")),
|
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-ii.png")),
|
||||||
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath,
|
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iii.png")),
|
||||||
"Pixmaps", "process-syncing-ii.png")),
|
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiii.png")),
|
||||||
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath,
|
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiiii.png"))
|
||||||
"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 [] {
|
this.animation_frames_active = new NSImage [] {
|
||||||
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath,
|
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-i-active.png")),
|
||||||
"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,
|
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iii-active.png")),
|
||||||
"Pixmaps", "process-syncing-ii-active.png")),
|
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiii-active.png")),
|
||||||
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath,
|
new NSImage (Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-iiiii-active.png"))
|
||||||
"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 +
|
this.error_image = new NSImage (
|
||||||
"/Pixmaps/process-syncing-error.png");
|
Path.Combine (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_active = new NSImage (
|
||||||
|
Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "process-syncing-error.png"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,18 +29,15 @@ namespace SparkleShare {
|
||||||
public static string LocalPluginsPath = new string [] {
|
public static string LocalPluginsPath = new string [] {
|
||||||
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "sparkleshare", "plugins" }.Combine ();
|
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "sparkleshare", "plugins" }.Combine ();
|
||||||
|
|
||||||
|
public string Name { get { return GetValue ("info", "name"); } }
|
||||||
public string Name {
|
public string Description { get { return GetValue ("info", "description"); } }
|
||||||
get {
|
public string Backend { get { return GetValue ("info", "backend"); } }
|
||||||
return GetValue ("info", "name");
|
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 Description {
|
public string Path { get { return GetValue ("path", "value"); } }
|
||||||
get {
|
public string PathExample { get { return GetValue ("path", "example"); } }
|
||||||
return GetValue ("info", "description");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ImagePath {
|
public string ImagePath {
|
||||||
get {
|
get {
|
||||||
|
@ -54,48 +51,6 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
public bool PathUsesLowerCase {
|
||||||
get {
|
get {
|
||||||
string uses_lower_case = GetValue ("path", "uses_lower_case");
|
string uses_lower_case = GetValue ("path", "uses_lower_case");
|
||||||
|
|
Loading…
Reference in a new issue