diff options
Diffstat (limited to 'SparkleShare/Mac')
26 files changed, 974 insertions, 1149 deletions
diff --git a/SparkleShare/Mac/AppDelegate.cs b/SparkleShare/Mac/AppDelegate.cs index 9e246c1..f68c695 100755 --- a/SparkleShare/Mac/AppDelegate.cs +++ b/SparkleShare/Mac/AppDelegate.cs @@ -1,5 +1,5 @@ -// SparkleShare, a collaboration and sharing tool. -// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com> +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // // 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 @@ -15,17 +15,11 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. -using System; -using System.Drawing; - -using MonoMac.Foundation; -using MonoMac.AppKit; -using MonoMac.ObjCRuntime; +using AppKit; namespace SparkleShare { public partial class AppDelegate : NSApplicationDelegate { - } } diff --git a/SparkleShare/Mac/Assets.xcassets/Contents.json b/SparkleShare/Mac/Assets.xcassets/Contents.json new file mode 100644 index 0000000..2d92bd5 --- /dev/null +++ b/SparkleShare/Mac/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/SparkleShare/Mac/SparkleController.cs b/SparkleShare/Mac/Controller.cs index 8f7a79e..67eae50 100755..100644 --- a/SparkleShare/Mac/SparkleController.cs +++ b/SparkleShare/Mac/Controller.cs @@ -1,5 +1,5 @@ -// SparkleShare, a collaboration and sharing tool. -// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com> +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // // 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 @@ -16,142 +16,107 @@ using System; -using System.Diagnostics; +using System.Collections.Generic; using System.IO; using System.Threading; -using MonoMac.Foundation; -using MonoMac.AppKit; +using Foundation; +using AppKit; -using Mono.Unix.Native; -using SparkleLib; -using System.Collections.Generic; +using Sparkles; +using Sparkles.Git; namespace SparkleShare { - public class SparkleController : SparkleControllerBase { + public class Controller : BaseController { - public override string PluginsPath { + public override string PresetsPath { get { - return Path.Combine (NSBundle.MainBundle.ResourcePath, "Plugins"); + return Path.Combine (NSBundle.MainBundle.ResourcePath, "Presets"); } } - // We have to use our own custom made folder watcher, as - // System.IO.FileSystemWatcher fails watching subfolders on Mac - private SparkleMacWatcher watcher; - - public SparkleController () : base () + public Controller (Configuration config) + : base (config) { NSApplication.Init (); - // Let's use the bundled git first - SparkleLib.Git.SparkleGit.GitPath = Path.Combine (NSBundle.MainBundle.ResourcePath, "git", "libexec", "git-core", "git"); - SparkleLib.Git.SparkleGit.ExecPath = Path.Combine (NSBundle.MainBundle.ResourcePath, "git", "libexec", "git-core"); + GitCommand.GitPath = Path.Combine (NSBundle.MainBundle.ResourcePath, "git", "libexec", "git-core", "git"); + GitCommand.ExecPath = Path.Combine (NSBundle.MainBundle.ResourcePath, "git", "libexec", "git-core"); + + bool overwite = true; + + File.Copy ( + Path.Combine (GitCommand.ExecPath, "git-lfs"), + Path.Combine (Config.BinPath, "git-lfs"), + overwite); } - + public override void Initialize () { base.Initialize (); - SparkleRepoBase.UseCustomWatcher = true; - this.watcher = new SparkleMacWatcher (Program.Controller.FoldersPath); + BaseRepository.UseCustomWatcher = true; + this.watcher = new SparkleMacWatcher (SparkleShare.Controller.FoldersPath); this.watcher.Changed += OnFilesChanged; } - private void OnFilesChanged (List<string> changed_files_in_basedir) + public override void CreateSparkleShareFolder () { - List<string> triggered_repos = new List<string> (); - - foreach (string file in changed_files_in_basedir) { - string repo_name; - int path_sep_index = file.IndexOf (Path.DirectorySeparatorChar); - - if (path_sep_index >= 0) - repo_name = file.Substring (0, path_sep_index); - else - repo_name = file; - - repo_name = Path.GetFileNameWithoutExtension (repo_name); - SparkleRepoBase repo = GetRepoByName (repo_name); + if (Directory.Exists (SparkleShare.Controller.FoldersPath)) + return; - if (repo == null) - continue; - - if (!triggered_repos.Contains (repo_name)) { - triggered_repos.Add (repo_name); - - FileActivityTask task = MacActivityTask (repo, - new FileSystemEventArgs (WatcherChangeTypes.Changed, file, "Unknown")); - - task (); - } + Directory.CreateDirectory (SparkleShare.Controller.FoldersPath); - } + // TODO: Use proper API + var chmod = new Command ("chmod", "700 " + SparkleShare.Controller.FoldersPath); + chmod.StartAndWaitForExit (); } - private delegate void FileActivityTask (); - private FileActivityTask MacActivityTask (SparkleRepoBase repo, FileSystemEventArgs fse_args) { - return delegate { new Thread (() => { repo.OnFileActivity (fse_args); }).Start (); }; + public override void SetFolderIcon () + { + if (Environment.OSVersion.Version.Major >= 14) { + NSWorkspace.SharedWorkspace.SetIconforFile ( + NSImage.ImageNamed ("sparkleshare-folder-yosemite.icns"), + SparkleShare.Controller.FoldersPath, 0); + + } else { + NSWorkspace.SharedWorkspace.SetIconforFile ( + NSImage.ImageNamed ("sparkleshare-folder.icns"), + SparkleShare.Controller.FoldersPath, 0); + } } + // There aren't any bindings in Xamarin.Mac to support this yet, so + // we call out to an applescript to do the job public override void CreateStartupItem () { - // 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.Arguments = "-e 'tell application \"System Events\" to " + - "make login item at end with properties {path:\"" + NSBundle.MainBundle.BundlePath + "\", hidden:false}'"; + string args = "-e 'tell application \"System Events\" to " + + "make login item at end with properties " + + "{path:\"" + NSBundle.MainBundle.BundlePath + "\", hidden:false}'"; - process.Start (); - process.WaitForExit (); + var process = new Command ("osascript", args); + process.StartAndWaitForExit (); - SparkleLogger.LogInfo ("Controller", "Added " + NSBundle.MainBundle.BundlePath + " to login items"); + Logger.LogInfo ("Controller", "Added " + NSBundle.MainBundle.BundlePath + " to login items"); } public override void InstallProtocolHandler () { - // We ship SparkleShareInviteHandler.app in the bundle - } - - - public override void AddToBookmarks () - { - // TODO } - public override bool CreateSparkleShareFolder () + public override void CopyToClipboard (string text) { - if (!Directory.Exists (Program.Controller.FoldersPath)) { - Directory.CreateDirectory (Program.Controller.FoldersPath); - - if (Environment.OSVersion.Version.Major >= 14) { - NSWorkspace.SharedWorkspace.SetIconforFile ( - NSImage.ImageNamed ("sparkleshare-folder-yosemite.icns"), - Program.Controller.FoldersPath, 0); - - } else { - NSWorkspace.SharedWorkspace.SetIconforFile ( - NSImage.ImageNamed ("sparkleshare-folder.icns"), - Program.Controller.FoldersPath, 0); - } - - Syscall.chmod (Program.Controller.FoldersPath, (FilePermissions) 448); // 448 -> 700 - - return true; - } - - return false; + NSPasteboard.GeneralPasteboard.ClearContents (); + NSPasteboard.GeneralPasteboard.SetStringForType (text, "NSStringPboardType"); } @@ -175,14 +140,7 @@ namespace SparkleShare { } - public override void CopyToClipboard (string text) - { - NSPasteboard.GeneralPasteboard.ClearContents (); - NSPasteboard.GeneralPasteboard.SetStringForType (text, "NSStringPboardType"); - } - - - private string event_log_html; + string event_log_html; public override string EventLogHTML { get { @@ -199,7 +157,7 @@ namespace SparkleShare { } - private string day_entry_html; + string day_entry_html; public override string DayEntryHTML { get { @@ -213,7 +171,7 @@ namespace SparkleShare { } - private string event_entry_html; + string event_entry_html; public override string EventEntryHTML { get { @@ -227,14 +185,47 @@ namespace SparkleShare { } + // We have to use our own custom made folder watcher, as + // System.IO.FileSystemWatcher fails watching subfolders on Mac + + SparkleMacWatcher watcher; + delegate void FileActivityTask (); + + FileActivityTask MacFileActivityTask (BaseRepository repo, FileSystemEventArgs fse_args) + { + return delegate { new Thread (() => { repo.OnFileActivity (fse_args); }).Start (); }; + } + + void OnFilesChanged (List<string> changed_files_in_basedir) + { + var triggered_repos = new List<string> (); + + foreach (string file_path in changed_files_in_basedir) { + string [] paths = file_path.Split (Path.DirectorySeparatorChar); + + if (paths.Length < 2) + continue; + + BaseRepository repo = GetRepoByName (paths [1]); + + if (repo != null && !triggered_repos.Contains (repo.Name)) { + FileActivityTask task = MacFileActivityTask (repo, + new FileSystemEventArgs (WatcherChangeTypes.Changed, file_path, "Unknown")); + + task (); + triggered_repos.Add (repo.Name); + } + } + } + + public delegate void Code (); - private NSObject obj = new NSObject (); public void Invoke (Code code) { using (var a = new NSAutoreleasePool ()) { - obj.InvokeOnMainThread (() => code ()); + new NSObject ().InvokeOnMainThread (() => code ()); } } } diff --git a/SparkleShare/Mac/Info.plist b/SparkleShare/Mac/Info.plist index 73f9a12..3df3ed2 100755 --- a/SparkleShare/Mac/Info.plist +++ b/SparkleShare/Mac/Info.plist @@ -5,17 +5,17 @@ <key>CFBundleIconFile</key> <string>sparkleshare-app</string> <key>CFBundleIdentifier</key> - <string>org.sparkleshare.sparkleshare</string> + <string>org.sparkleshare.SparkleShare</string> <key>CFBundleName</key> <string>SparkleShare</string> <key>CFBundleShortVersionString</key> - <string>1.5.0</string> + <string>2.0.1</string> <key>CFBundleVersion</key> - <string>1.5.0</string> + <string>2.0.1</string> <key>LSApplicationCategoryType</key> - <string>public.app-category.productivity</string> + <string>public.app-category.utilities</string> <key>LSMinimumSystemVersion</key> - <string>10.6</string> + <string>10.7</string> <key>LSUIElement</key> <string>1</string> <key>NSMainNibFile</key> diff --git a/SparkleShare/Mac/MainMenu.xib.designer.cs b/SparkleShare/Mac/MainMenu.xib.designer.cs index 1ce6227..90e749c 100755 --- a/SparkleShare/Mac/MainMenu.xib.designer.cs +++ b/SparkleShare/Mac/MainMenu.xib.designer.cs @@ -11,8 +11,8 @@ namespace SparkleShare { - // Should subclass MonoMac.AppKit.NSResponder - [MonoMac.Foundation.Register("AppDelegate")] + // Should subclass AppKit.NSResponder + [Foundation.Register("AppDelegate")] public partial class AppDelegate { } } diff --git a/SparkleShare/Mac/README.md b/SparkleShare/Mac/README.md index 60fea68..2ab5bb9 100644 --- a/SparkleShare/Mac/README.md +++ b/SparkleShare/Mac/README.md @@ -1,12 +1,12 @@ -## Building on Mac +## Building on macOS You can build SparkleShare from source or download the SparkleShare bundle. ### Installing build requirements - Install [Xcode](https://itunes.apple.com/gb/app/xcode/id497799835?mt=12) from the Mac App Store, or [download](https://developer.apple.com/xcode/) it manually. - Install [Xamarin Studio](http://monodevelop.com/download/). + Install [Xcode](https://itunes.apple.com/gb/app/xcode/id497799835?mt=12) from the macOS App Store, or [download](https://developer.apple.com/xcode/) it manually. + Install [Visual Studio](https://www.visualstudio.com/vs/visual-studio-mac/). The required `git` binaries are now built automatically. For doing this and for building the distribution release, where Mono libraries are merged into SparkleShare, we need the packes <tt>autoconf</tt> and <tt>pkg-config</tt>. You can install these in several ways, here's how it's done using [Homebrew](http://brew.sh/): @@ -19,7 +19,7 @@ brew install autoconf automake libtool pkg-config There are three build configurations available: -* Debug +* DebugMac with debug symbols and having the Symbol DEBUG defined. Requires an installed Mono framework. @@ -27,20 +27,21 @@ There are three build configurations available: without debug symbols. Requires an installed Mono framework. -* ReleaseDist +* ReleaseMac without debug symbols, the Mono framework is linked statically into the binary, so it does not require an installed Mono framework. To build any of these configurations, -* open `./SparkleShare/Mac/SparkleShare.sln` +* open `./SparkleShare.sln` in Visual Studio +* select the SparkleShare.Mac project in the Solution view * select the required configuration -* select `Build`, then `"Build SparkleShare"` from the menu +* select `Build`, then `"Build SparkleShare.Mac"` from the menu To build SparkleShare from a command line (e.g. for using a CI system), use this command: ```bash -/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool -v build "--configuration:ReleaseDist" "./SparkleShare/Mac/SparkleShare.sln" + /Applications/Visual\ Studio.app/Contents/MacOS/vstool build "--configuration:ReleaseMac" "SparkleShare.sln" ``` @@ -48,7 +49,7 @@ To build SparkleShare from a command line (e.g. for using a CI system), use this ``` rm -Rf ~/SparkleShare -rm -Rf ~/.config/sparkleshare +rm -Rf ~/.config/org.sparkleshare.SparkleShare ``` diff --git a/SparkleShare/Mac/Resources/sparkleshare-app.icns b/SparkleShare/Mac/Resources/sparkleshare-app.icns Binary files differindex c550166..c75b4f8 100755..100644 --- a/SparkleShare/Mac/Resources/sparkleshare-app.icns +++ b/SparkleShare/Mac/Resources/sparkleshare-app.icns diff --git a/SparkleShare/Mac/SparkleShare.Mac.csproj b/SparkleShare/Mac/SparkleShare.Mac.csproj new file mode 100644 index 0000000..6c46443 --- /dev/null +++ b/SparkleShare/Mac/SparkleShare.Mac.csproj @@ -0,0 +1,340 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{8FCDF699-E2C3-4CB3-AF98-44198972AFC0}</ProjectGuid> + <ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <OutputType>Exe</OutputType> + <RootNamespace>SparkleShare</RootNamespace> + <AssemblyName>SparkleShare</AssemblyName> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <MonoMacResourcePrefix>Resources</MonoMacResourcePrefix> + <ReleaseVersion></ReleaseVersion> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>none</DebugType> + <Optimize>False</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CustomCommands> + <CustomCommands> + <Command> + <type>AfterBuild</type> + <command>${ProjectDir}/postBuild.sh ${TargetDir}/${SolutionName}.app</command> + </Command> + </CustomCommands> + </CustomCommands> + <EnableCodeSigning>False</EnableCodeSigning> + <CreatePackage>False</CreatePackage> + <EnablePackageSigning>False</EnablePackageSigning> + <IncludeMonoRuntime>false</IncludeMonoRuntime> + <ConsolePause>False</ConsolePause> + <UseSGen>false</UseSGen> + <UseRefCounting>false</UseRefCounting> + <Profiling>false</Profiling> + <HttpClientHandler>HttpClientHandler</HttpClientHandler> + <TlsProvider>Default</TlsProvider> + <LinkMode>None</LinkMode> + <UseMSBuildEngine>True</UseMSBuildEngine> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <Optimize>False</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CustomCommands> + <CustomCommands> + <Command> + <type>AfterBuild</type> + <command>${ProjectDir}/postBuild.sh ${TargetDir}/${SolutionName}.app</command> + </Command> + </CustomCommands> + </CustomCommands> + <EnableCodeSigning>False</EnableCodeSigning> + <CreatePackage>False</CreatePackage> + <EnablePackageSigning>False</EnablePackageSigning> + <IncludeMonoRuntime>false</IncludeMonoRuntime> + <ConsolePause>False</ConsolePause> + <DebugSymbols>true</DebugSymbols> + <UseSGen>false</UseSGen> + <UseRefCounting>false</UseRefCounting> + <Profiling>false</Profiling> + <LinkMode>None</LinkMode> + <HttpClientHandler>HttpClientHandler</HttpClientHandler> + <TlsProvider>Default</TlsProvider> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseDist|AnyCPU' "> + <Optimize>false</Optimize> + <OutputPath>bin\ReleaseDist</OutputPath> + <WarningLevel>4</WarningLevel> + <UseSGen>false</UseSGen> + <IncludeMonoRuntime>false</IncludeMonoRuntime> + <EnablePackageSigning>false</EnablePackageSigning> + <CustomCommands> + <CustomCommands> + <Command> + <type>AfterBuild</type> + <command>${ProjectDir}/postBuild.sh ${TargetDir}/${SolutionName}.app</command> + </Command> + <Command> + <type>AfterBuild</type> + <command>${ProjectDir}/packReleaseDist.sh ${TargetDir}/${SolutionName}.app</command> + </Command> + </CustomCommands> + </CustomCommands> + <EnableCodeSigning>false</EnableCodeSigning> + <CreatePackage>false</CreatePackage> + <UseRefCounting>false</UseRefCounting> + <Profiling>false</Profiling> + <HttpClientHandler>HttpClientHandler</HttpClientHandler> + <TlsProvider>Default</TlsProvider> + <LinkMode>None</LinkMode> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMac|AnyCPU' "> + <DebugType>none</DebugType> + <Optimize>False</Optimize> + <OutputPath>bin\ReleaseMac</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CustomCommands> + <CustomCommands> + <Command> + <type>AfterBuild</type> + <command>${ProjectDir}/postBuild.sh ${TargetDir}/${SolutionName}.app</command> + </Command> + </CustomCommands> + </CustomCommands> + <EnableCodeSigning>False</EnableCodeSigning> + <CreatePackage>False</CreatePackage> + <EnablePackageSigning>False</EnablePackageSigning> + <IncludeMonoRuntime>false</IncludeMonoRuntime> + <ConsolePause>False</ConsolePause> + <UseSGen>false</UseSGen> + <UseRefCounting>false</UseRefCounting> + <Profiling>false</Profiling> + <HttpClientHandler>HttpClientHandler</HttpClientHandler> + <TlsProvider>Default</TlsProvider> + <LinkMode>None</LinkMode> + <CodeSigningKey>Mac Developer</CodeSigningKey> + <PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMac|AnyCPU' "> + <Optimize>False</Optimize> + <OutputPath>bin\DebugMac</OutputPath> + <DefineConstants>DEBUG</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CustomCommands> + <CustomCommands> + <Command> + <type>AfterBuild</type> + <command>${ProjectDir}/postBuild.sh ${TargetDir}/${SolutionName}.app</command> + </Command> + </CustomCommands> + </CustomCommands> + <EnableCodeSigning>False</EnableCodeSigning> + <CreatePackage>False</CreatePackage> + <EnablePackageSigning>False</EnablePackageSigning> + <IncludeMonoRuntime>false</IncludeMonoRuntime> + <ConsolePause>False</ConsolePause> + <DebugSymbols>true</DebugSymbols> + <UseSGen>false</UseSGen> + <UseRefCounting>false</UseRefCounting> + <Profiling>false</Profiling> + <LinkMode>None</LinkMode> + <HttpClientHandler>HttpClientHandler</HttpClientHandler> + <TlsProvider>Default</TlsProvider> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="Xamarin.Mac" /> + <Reference Include="System.Net" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-128.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-128%402x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-16.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-16%402x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-256.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-256%402x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-32.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-32%402x.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512.png" /> + <ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512%402x.png" /> + <ImageAsset Include="Assets.xcassets\Contents.json" /> + </ItemGroup> + <ItemGroup> + <None Include="Info.plist" /> + </ItemGroup> + <ItemGroup> + <Compile Include="UserInterface\About.cs" /> + <Compile Include="UserInterface\Bubbles.cs" /> + <Compile Include="UserInterface\EventLog.cs" /> + <Compile Include="UserInterface\Note.cs" /> + <Compile Include="UserInterface\Setup.cs" /> + <Compile Include="UserInterface\SetupWindow.cs" /> + <Compile Include="UserInterface\StatusIcon.cs" /> + <Compile Include="UserInterface\UserInterface.cs" /> + <Compile Include="AppDelegate.cs"> + <DependentUpon>MainMenu.xib</DependentUpon> + </Compile> + <Compile Include="MainMenu.xib.designer.cs"> + <DependentUpon>MainMenu.xib</DependentUpon> + </Compile> + <Compile Include="Watcher.cs" /> + <Compile Include="Controller.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Sparkles\Sparkles.csproj"> + <Project>{2C914413-B31C-4362-93C7-1AE34F09112A}</Project> + <Name>Sparkles</Name> + </ProjectReference> + <ProjectReference Include="..\..\Sparkles\Git\Sparkles.Git.csproj"> + <Project>{009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}</Project> + <Name>Sparkles.Git</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <BundleResource Include="..\Common\Images\about.png"> + <Link>Resources\about.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Images\about%402x.png"> + <Link>Resources\about%402x.png</Link> + </BundleResource> + <BundleResource Include="..\Linux\Images\icons\hicolor\document-added-12.png"> + <Link>Resources\document-added-12.png</Link> + </BundleResource> + <BundleResource Include="..\Linux\Images\icons\hicolor\document-deleted-12.png"> + <Link>Resources\document-deleted-12.png</Link> + </BundleResource> + <BundleResource Include="..\Linux\Images\icons\hicolor\document-edited-12.png"> + <Link>Resources\document-edited-12.png</Link> + </BundleResource> + <BundleResource Include="..\Linux\Images\icons\hicolor\document-moved-12.png"> + <Link>Resources\document-moved-12.png</Link> + </BundleResource> + <BundleResource Include="Resources\process-syncing.png" /> + <BundleResource Include="Resources\process-syncing%402x.png" /> + <BundleResource Include="Resources\process-syncing-down.png" /> + <BundleResource Include="Resources\process-syncing-down%402x.png" /> + <BundleResource Include="Resources\process-syncing-error.png" /> + <BundleResource Include="Resources\process-syncing-error%402x.png" /> + <BundleResource Include="Resources\process-syncing-idle.png" /> + <BundleResource Include="Resources\process-syncing-idle%402x.png" /> + <BundleResource Include="Resources\process-syncing-up.png" /> + <BundleResource Include="Resources\process-syncing-up%402x.png" /> + <BundleResource Include="..\Common\Images\side-splash.png"> + <Link>Resources\side-splash.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Images\side-splash%402x.png"> + <Link>Resources\side-splash%402x.png</Link> + </BundleResource> + <BundleResource Include="..\Mac\Resources\sparkleshare-app.icns"> + <Link>Resources\sparkleshare-app.icns</Link> + </BundleResource> + <BundleResource Include="..\Mac\Resources\sparkleshare-folder.icns"> + <Link>Resources\sparkleshare-folder.icns</Link> + </BundleResource> + <BundleResource Include="..\Mac\Resources\sparkleshare-folder-yosemite.icns"> + <Link>Resources\sparkleshare-folder-yosemite.icns</Link> + </BundleResource> + <BundleResource Include="..\Common\Images\text-balloon.png"> + <Link>Resources\text-balloon.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Images\text-balloon%402x.png"> + <Link>Resources\text-balloon%402x.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Images\tutorial-slide-1.png"> + <Link>Resources\tutorial-slide-1.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Images\tutorial-slide-1%402x.png"> + <Link>Resources\tutorial-slide-1%402x.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Images\tutorial-slide-2.png"> + <Link>Resources\tutorial-slide-2.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Images\tutorial-slide-2%402x.png"> + <Link>Resources\tutorial-slide-2%402x.png</Link> + </BundleResource> + <BundleResource Include="..\Mac\Resources\tutorial-slide-3.png"> + <Link>Resources\tutorial-slide-3.png</Link> + </BundleResource> + <BundleResource Include="Resources\tutorial-slide-3%402x.png" /> + <BundleResource Include="..\Common\Images\user-icon-default.png"> + <Link>Resources\user-icon-default.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\bitbucket.png"> + <Link>Presets\bitbucket.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\bitbucket%402x.png"> + <Link>Presets\bitbucket%402x.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\github.png"> + <Link>Presets\github.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\github%402x.png"> + <Link>Presets\github%402x.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\gitlab.png"> + <Link>Presets\gitlab.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\gitlab%402x.png"> + <Link>Presets\gitlab%402x.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\own-server.png"> + <Link>Presets\own-server.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\own-server%402x.png"> + <Link>Presets\own-server%402x.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\planio.png"> + <Link>Presets\planio.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\planio%402x.png"> + <Link>Presets\planio%402x.png</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\bitbucket.xml"> + <Link>Presets\bitbucket.xml</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\github.xml"> + <Link>Presets\github.xml</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\gitlab.xml"> + <Link>Presets\gitlab.xml</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\own-server.xml"> + <Link>Presets\own-server.xml</Link> + </BundleResource> + <BundleResource Include="..\Common\Presets\planio.xml"> + <Link>Presets\planio.xml</Link> + </BundleResource> + <BundleResource Include="..\Common\HTML\day-entry.html"> + <Link>HTML\day-entry.html</Link> + </BundleResource> + <BundleResource Include="..\Common\HTML\event-entry.html"> + <Link>HTML\event-entry.html</Link> + </BundleResource> + <BundleResource Include="..\Common\HTML\event-log.html"> + <Link>HTML\event-log.html</Link> + </BundleResource> + <BundleResource Include="..\Common\HTML\jquery.js"> + <Link>HTML\jquery.js</Link> + </BundleResource> + </ItemGroup> + <ItemGroup> + <Folder Include="Resources\" /> + <Folder Include="UserInterface\" /> + </ItemGroup> + <ItemGroup> + <InterfaceDefinition Include="MainMenu.xib" /> + </ItemGroup> + <Import Project="..\Common\SparkleShare.projitems" Label="Shared" Condition="Exists('..\Common\SparkleShare.projitems')" /> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" /> +</Project> diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj deleted file mode 100644 index 04b8cbb..0000000 --- a/SparkleShare/Mac/SparkleShare.csproj +++ /dev/null @@ -1,296 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>8.0.30703</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}</ProjectGuid> - <ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> - <OutputType>Exe</OutputType> - <RootNamespace>SparkleShare</RootNamespace> - <AssemblyName>SparkleShare</AssemblyName> - <ReleaseVersion> - </ReleaseVersion> - <SuppressXamMacMigration>True</SuppressXamMacMigration> - <SuppressXamMacUpsell>True</SuppressXamMacUpsell> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>none</DebugType> - <Optimize>False</Optimize> - <OutputPath>bin\Release</OutputPath> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <CustomCommands> - <CustomCommands> - <Command type="AfterBuild" command="${ProjectDir}/postBuild.sh ${TargetDir}/${SolutionName}.app" /> - </CustomCommands> - </CustomCommands> - <EnableCodeSigning>False</EnableCodeSigning> - <CreatePackage>False</CreatePackage> - <EnablePackageSigning>False</EnablePackageSigning> - <IncludeMonoRuntime>false</IncludeMonoRuntime> - <ConsolePause>False</ConsolePause> - <UseSGen>false</UseSGen> - <UseRefCounting>false</UseRefCounting> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <Optimize>False</Optimize> - <OutputPath>bin\Debug</OutputPath> - <DefineConstants>DEBUG</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <CustomCommands> - <CustomCommands> - <Command type="AfterBuild" command="${ProjectDir}/postBuild.sh ${TargetDir}/${SolutionName}.app" /> - </CustomCommands> - </CustomCommands> - <EnableCodeSigning>False</EnableCodeSigning> - <CreatePackage>False</CreatePackage> - <EnablePackageSigning>False</EnablePackageSigning> - <IncludeMonoRuntime>false</IncludeMonoRuntime> - <ConsolePause>False</ConsolePause> - <DebugSymbols>true</DebugSymbols> - <UseSGen>false</UseSGen> - <UseRefCounting>false</UseRefCounting> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseDist|AnyCPU' "> - <Optimize>false</Optimize> - <OutputPath>bin\ReleaseDist</OutputPath> - <WarningLevel>4</WarningLevel> - <UseSGen>false</UseSGen> - <IncludeMonoRuntime>false</IncludeMonoRuntime> - <EnablePackageSigning>false</EnablePackageSigning> - <CustomCommands> - <CustomCommands> - <Command type="AfterBuild" command="${ProjectDir}/postBuild.sh ${TargetDir}/${SolutionName}.app" /> - <Command type="AfterBuild" command="${ProjectDir}/packReleaseDist.sh ${TargetDir}/${SolutionName}.app" /> - </CustomCommands> - </CustomCommands> - <EnableCodeSigning>false</EnableCodeSigning> - <CreatePackage>false</CreatePackage> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Xml" /> - <Reference Include="System.Drawing" /> - <Reference Include="System.Net" /> - <Reference Include="Mono.Posix" /> - <Reference Include="MonoMac"> - <HintPath>..\..\..\monomac\src\MonoMac.dll</HintPath> - </Reference> - </ItemGroup> - <ItemGroup> - <Compile Include="AppDelegate.cs"> - <DependentUpon>MainMenu.xib</DependentUpon> - </Compile> - <Compile Include="MainMenu.xib.designer.cs"> - <DependentUpon>MainMenu.xib</DependentUpon> - </Compile> - <Compile Include="..\SparkleControllerBase.cs"> - <Link>SparkleControllerBase.cs</Link> - </Compile> - <Compile Include="SparkleStatusIcon.cs" /> - <Compile Include="SparkleUI.cs" /> - <Compile Include="..\Program.cs"> - <Link>Program.cs</Link> - </Compile> - <Compile Include="SparkleMacWatcher.cs" /> - <Compile Include="SparkleEventLog.cs" /> - <Compile Include="SparkleBubbles.cs" /> - <Compile Include="SparkleSetup.cs" /> - <Compile Include="SparkleSetupWindow.cs" /> - <Compile Include="..\SparkleBubblesController.cs"> - <Link>SparkleBubblesController.cs</Link> - </Compile> - <Compile Include="..\SparkleEventLogController.cs"> - <Link>SparkleEventLogController.cs</Link> - </Compile> - <Compile Include="..\SparkleSetupController.cs"> - <Link>SparkleSetupController.cs</Link> - </Compile> - <Compile Include="..\SparkleStatusIconController.cs"> - <Link>SparkleStatusIconController.cs</Link> - </Compile> - <Compile Include="..\SparkleAboutController.cs"> - <Link>SparkleAboutController.cs</Link> - </Compile> - <Compile Include="SparkleController.cs" /> - <Compile Include="..\SparklePlugin.cs"> - <Link>SparklePlugin.cs</Link> - </Compile> - <Compile Include="SparkleAbout.cs" /> - <Compile Include="..\SparkleInvite.cs"> - <Link>SparkleInvite.cs</Link> - </Compile> - <Compile Include="..\SparkleKeys.cs"> - <Link>SparkleKeys.cs</Link> - </Compile> - <Compile Include="..\SparkleAvatars.cs" /> - <Compile Include="..\SparkleNoteController.cs"> - <Link>SparkleNoteController.cs</Link> - </Compile> - <Compile Include="SparkleNote.cs" /> - </ItemGroup> - <ItemGroup> - <InterfaceDefinition Include="MainMenu.xib" xmlns="" /> - </ItemGroup> - <ItemGroup> - <None Include="Info.plist" /> - </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" /> - <ItemGroup> - <Content Include="..\Common\HTML\day-entry.html"> - <Link>HTML\day-entry.html</Link> - </Content> - <Content Include="..\Common\HTML\event-entry.html"> - <Link>HTML\event-entry.html</Link> - </Content> - <Content Include="..\Common\HTML\event-log.html"> - <Link>HTML\event-log.html</Link> - </Content> - <Content Include="Resources\sparkleshare-folder.icns"> - <Link>sparkleshare-folder.icns</Link> - </Content> - <Content Include="Resources\sparkleshare-app.icns"> - <Link>sparkleshare-app.icns</Link> - </Content> - <Content Include="..\Common\HTML\jquery.js"> - <Link>HTML\jquery.js</Link> - </Content> - <Content Include="Resources\sparkleshare-folder-yosemite.icns"> - <Link>sparkleshare-folder-yosemite.icns</Link> - </Content> - </ItemGroup> - <ItemGroup> - <Folder Include="Resources\" /> - <Folder Include="HTML\" /> - <Folder Include="Plugins\" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\SparkleLib\SparkleLib.csproj"> - <Project>{2C914413-B31C-4362-93C7-1AE34F09112A}</Project> - <Name>SparkleLib</Name> - </ProjectReference> - <ProjectReference Include="..\..\SparkleLib\Git\SparkleLib.Git.csproj"> - <Project>{009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}</Project> - <Name>SparkleLib.Git</Name> - </ProjectReference> - </ItemGroup> - <ItemGroup> - <BundleResource Include="..\Common\Pixmaps\side-splash.png"> - <Link>Resources\side-splash.png</Link> - </BundleResource> - <BundleResource Include="..\Linux\Pixmaps\icons\document-added-12.png"> - <Link>Resources\document-added-12.png</Link> - </BundleResource> - <BundleResource Include="..\Linux\Pixmaps\icons\document-edited-12.png"> - <Link>Resources\document-edited-12.png</Link> - </BundleResource> - <BundleResource Include="..\Linux\Pixmaps\icons\document-deleted-12.png"> - <Link>Resources\document-deleted-12.png</Link> - </BundleResource> - <BundleResource Include="..\Linux\Pixmaps\icons\document-moved-12.png"> - <Link>Resources\document-moved-12.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Pixmaps\about.png"> - <Link>Resources\about.png</Link> - </BundleResource> - <BundleResource Include="Resources\tutorial-slide-3.png"> - <Link>Resources\tutorial-slide-3.png</Link> - </BundleResource> - <BundleResource Include="Resources\process-syncing-down.png" /> - <BundleResource Include="Resources\process-syncing-error.png" /> - <BundleResource Include="Resources\process-syncing-idle.png" /> - <BundleResource Include="Resources\process-syncing-up.png" /> - <BundleResource Include="Resources\process-syncing.png" /> - <BundleResource Include="..\Common\Pixmaps\user-icon-default.png"> - <Link>Resources\user-icon-default.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Pixmaps\side-splash%402x.png"> - <Link>Resources\side-splash%402x.png</Link> - </BundleResource> - <BundleResource Include="Resources\process-syncing-down%402x.png" /> - <BundleResource Include="Resources\process-syncing-error%402x.png" /> - <BundleResource Include="Resources\process-syncing-idle%402x.png" /> - <BundleResource Include="Resources\process-syncing-up%402x.png" /> - <BundleResource Include="Resources\process-syncing%402x.png" /> - <BundleResource Include="..\Common\Pixmaps\about%402x.png"> - <Link>Resources\about%402x.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Pixmaps\tutorial-slide-1.png"> - <Link>Resources\tutorial-slide-1.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Pixmaps\tutorial-slide-1%402x.png"> - <Link>Resources\tutorial-slide-1%402x.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Pixmaps\tutorial-slide-2.png"> - <Link>Resources\tutorial-slide-2.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Pixmaps\tutorial-slide-2%402x.png"> - <Link>Resources\tutorial-slide-2%402x.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\bitbucket%402x.png"> - <Link>Plugins\bitbucket%402x.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\github%402x.png"> - <Link>Plugins\github%402x.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\gitorious%402x.png"> - <Link>Plugins\gitorious%402x.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\own-server%402x.png"> - <Link>Plugins\own-server%402x.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\ssnet%402x.png"> - <Link>Plugins\ssnet%402x.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\bitbucket.xml"> - <Link>Plugins\bitbucket.xml</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\github.xml"> - <Link>Plugins\github.xml</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\gitorious.xml"> - <Link>Plugins\gitorious.xml</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\own-server.xml"> - <Link>Plugins\own-server.xml</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\bitbucket.png"> - <Link>Plugins\bitbucket.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\github.png"> - <Link>Plugins\github.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\gitorious.png"> - <Link>Plugins\gitorious.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\own-server.png"> - <Link>Plugins\own-server.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\ssnet.png"> - <Link>Plugins\ssnet.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\ssnet.xml"> - <Link>Plugins\ssnet.xml</Link> - </BundleResource> - <BundleResource Include="Resources\tutorial-slide-3%402x.png" /> - <BundleResource Include="..\Common\Plugins\planio.png"> - <Link>Plugins\planio.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\planio.xml"> - <Link>Plugins\planio.xml</Link> - </BundleResource> - <BundleResource Include="..\Common\Plugins\planio%402x.png"> - <Link>Plugins\planio%402x.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Pixmaps\text-balloon.png"> - <Link>Resources\text-balloon.png</Link> - </BundleResource> - <BundleResource Include="..\Common\Pixmaps\text-balloon%402x.png"> - <Link>Resources\text-balloon%402x.png</Link> - </BundleResource> - </ItemGroup> -</Project> diff --git a/SparkleShare/Mac/SparkleShare.sln b/SparkleShare/Mac/SparkleShare.sln deleted file mode 100644 index 8920b7f..0000000 --- a/SparkleShare/Mac/SparkleShare.sln +++ /dev/null @@ -1,56 +0,0 @@ -
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleShare", "SparkleShare.csproj", "{CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleLib", "..\..\SparkleLib\SparkleLib.csproj", "{2C914413-B31C-4362-93C7-1AE34F09112A}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleLib.Git", "..\..\SparkleLib\Git\SparkleLib.Git.csproj", "{009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Release|Any CPU = Release|Any CPU
- Debug|Any CPU = Debug|Any CPU
- ReleaseDist|Any CPU = ReleaseDist|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Release|Any CPU.Build.0 = Release|Any CPU
- {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseDist|Any CPU.ActiveCfg = Release|Any CPU
- {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.ReleaseDist|Any CPU.Build.0 = Release|Any CPU
- {2C914413-B31C-4362-93C7-1AE34F09112A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2C914413-B31C-4362-93C7-1AE34F09112A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.Build.0 = Release|Any CPU
- {2C914413-B31C-4362-93C7-1AE34F09112A}.ReleaseDist|Any CPU.ActiveCfg = Release|Any CPU
- {2C914413-B31C-4362-93C7-1AE34F09112A}.ReleaseDist|Any CPU.Build.0 = Release|Any CPU
- {CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}.Release|Any CPU.Build.0 = Release|Any CPU
- {CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}.ReleaseDist|Any CPU.ActiveCfg = ReleaseDist|Any CPU
- {CF5BC8DB-A633-4FCC-8A3E-E3AC9B59FABC}.ReleaseDist|Any CPU.Build.0 = ReleaseDist|Any CPU
- EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- StartupItem = SparkleShare.csproj
- Policies = $0
- $0.DotNetNamingPolicy = $1
- $1.DirectoryNamespaceAssociation = None
- $1.ResourceNamePolicy = FileFormatDefault
- $0.TextStylePolicy = $2
- $2.inheritsSet = null
- $2.scope = text/x-csharp
- $0.CSharpFormattingPolicy = $3
- $3.inheritsSet = Mono
- $3.inheritsScope = text/x-csharp
- $3.scope = text/x-csharp
- $0.TextStylePolicy = $4
- $4.FileWidth = 120
- $4.inheritsSet = VisualStudio
- $4.inheritsScope = text/plain
- $4.scope = text/plain
- version =
- EndGlobalSection
-EndGlobal
diff --git a/SparkleShare/Mac/SparkleUI.cs b/SparkleShare/Mac/SparkleUI.cs deleted file mode 100755 index 508055a..0000000 --- a/SparkleShare/Mac/SparkleUI.cs +++ /dev/null @@ -1,97 +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; - -using MonoMac.Foundation; -using MonoMac.AppKit; - -namespace SparkleShare { - - public class SparkleUI : AppDelegate { - - public SparkleStatusIcon StatusIcon; - public SparkleEventLog EventLog; - public SparkleSetup Setup; - public SparkleBubbles Bubbles; - public SparkleAbout About; - public SparkleNote Note; - - public static string FontName = "Helvetica Neue"; - - public SparkleUI () - { - if (Environment.OSVersion.Version.Major < 14) - FontName = "Lucida Grande"; - - Program.Controller.Invoke (() => { - if (Environment.OSVersion.Version.Major >= 14) { - NSWorkspace.SharedWorkspace.SetIconforFile ( - NSImage.ImageNamed ("sparkleshare-folder-yosemite.icns"), - Program.Controller.FoldersPath, 0); - - } else { - NSWorkspace.SharedWorkspace.SetIconforFile ( - NSImage.ImageNamed ("sparkleshare-folder.icns"), - Program.Controller.FoldersPath, 0); - } - - NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare-app.icns"); - - Setup = new SparkleSetup (); - EventLog = new SparkleEventLog (); - About = new SparkleAbout (); - Note = new SparkleNote (); - Bubbles = new SparkleBubbles (); - StatusIcon = new SparkleStatusIcon (); - }); - - Program.Controller.UIHasLoaded (); - } - - - public void Run () - { - NSApplication.Main (Program.Arguments); - } - - - public void UpdateDockIconVisibility () - { -// if (Setup.IsVisible || EventLog.IsVisible || About.IsVisible) -// NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.Regular; - } - } - - - public partial class AppDelegate : NSApplicationDelegate { - - public override void WillTerminate (NSNotification notification) - { - Program.Controller.Quit (); - } - - - public override bool ApplicationShouldHandleReopen (NSApplication sender, bool has_visible_windows) - { - if (!has_visible_windows) - Program.Controller.HandleReopen (); - - return true; - } - } -} diff --git a/SparkleShare/Mac/SparkleAbout.cs b/SparkleShare/Mac/UserInterface/About.cs index 448f7a1..b9393ff 100755..100644 --- a/SparkleShare/Mac/SparkleAbout.cs +++ b/SparkleShare/Mac/UserInterface/About.cs @@ -1,5 +1,5 @@ -// SparkleShare, a collaboration and sharing tool. -// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com> +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // // 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 @@ -16,17 +16,16 @@ using System; -using System.Drawing; -using System.IO; -using MonoMac.AppKit; -using MonoMac.Foundation; +using AppKit; +using CoreGraphics; +using Foundation; namespace SparkleShare { - public class SparkleAbout : NSWindow { + public class About : NSWindow { - public SparkleAboutController Controller = new SparkleAboutController (); + public AboutController Controller = new AboutController (); private NSTextField version_text_field, updates_text_field, credits_text_field; private SparkleLink website_link, credits_link, report_problem_link, debug_log_link; @@ -35,24 +34,25 @@ namespace SparkleShare { private NSButton hidden_close_button; - public SparkleAbout (IntPtr handle) : base (handle) { } + public About (IntPtr handle) : base (handle) { } - public SparkleAbout () : base () + public About () : base () { - SetFrame (new RectangleF (0, 0, 640, 281), true); + SetFrame (new CGRect (0, 0, 640, 281), true); Center (); Delegate = new SparkleAboutDelegate (); StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Titled); Title = "About SparkleShare"; - MaxSize = new SizeF (640, 281); - MinSize = new SizeF (640, 281); + MaxSize = new CGSize (640, 281); + MinSize = new CGSize (640, 281); HasShadow = true; + IsOpaque = false; BackingType = NSBackingStore.Buffered; Level = NSWindowLevel.Floating; this.hidden_close_button = new NSButton () { - Frame = new RectangleF (0, 0, 0, 0), + Frame = new CGRect (0, 0, 0, 0), KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask, KeyEquivalent = "w" }; @@ -63,15 +63,15 @@ namespace SparkleShare { this.hidden_close_button.Activated += delegate { Controller.WindowClosed (); }; Controller.HideWindowEvent += delegate { - Program.Controller.Invoke (() => PerformClose (this)); + SparkleShare.Controller.Invoke (() => PerformClose (this)); }; Controller.ShowWindowEvent += delegate { - Program.Controller.Invoke (() => OrderFrontRegardless ()); + SparkleShare.Controller.Invoke (() => OrderFrontRegardless ()); }; Controller.UpdateLabelEvent += delegate (string text) { - Program.Controller.Invoke (() => { this.updates_text_field.StringValue = text; }); + SparkleShare.Controller.Invoke (() => { this.updates_text_field.StringValue = text; }); }; @@ -82,52 +82,52 @@ namespace SparkleShare { private void CreateAbout () { this.about_image = NSImage.ImageNamed ("about"); - this.about_image.Size = new SizeF (720, 260); + this.about_image.Size = new CGSize (720, 260); this.about_image_view = new NSImageView () { Image = this.about_image, - Frame = new RectangleF (0, 0, 720, 260) + Frame = new CGRect (0, 0, 720, 260) }; this.version_text_field = new SparkleLabel ("version " + Controller.RunningVersion, NSTextAlignment.Left) { DrawsBackground = false, - Frame = new RectangleF (295, 140, 318, 22), + Frame = new CGRect (295, 140, 318, 22), TextColor = NSColor.White }; - this.updates_text_field = new SparkleLabel ("Checking for updates...", NSTextAlignment.Left) { + this.updates_text_field = new SparkleLabel ("Checking for updates…", NSTextAlignment.Left) { DrawsBackground = false, - Frame = new RectangleF (295, Frame.Height - 232, 318, 98), + Frame = new CGRect (295, Frame.Height - 232, 318, 98), TextColor = NSColor.FromCalibratedRgba (1.0f, 1.0f, 1.0f, 0.5f) }; this.credits_text_field = new SparkleLabel ( - @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others." + + @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others" + "\n\n" + "SparkleShare is Open Source. You are free to use, modify, and redistribute it " + - "under the GNU GPLv3.", NSTextAlignment.Left) { + "under the GNU GPLv3", NSTextAlignment.Left) { DrawsBackground = false, - Frame = new RectangleF (295, Frame.Height - 260, 318, 98), + Frame = new CGRect (295, Frame.Height - 260, 318, 98), TextColor = NSColor.White }; this.website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress); - this.website_link.Frame = new RectangleF (new PointF (295, 25), this.website_link.Frame.Size); + this.website_link.Frame = new CGRect (new CGPoint (295, 25), this.website_link.Frame.Size); this.credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress); - this.credits_link.Frame = new RectangleF ( - new PointF (this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25), + this.credits_link.Frame = new CGRect ( + new CGPoint (this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25), this.credits_link.Frame.Size); this.report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress); - this.report_problem_link.Frame = new RectangleF ( - new PointF (this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25), + this.report_problem_link.Frame = new CGRect ( + new CGPoint (this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25), this.report_problem_link.Frame.Size); this.debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress); - this.debug_log_link.Frame = new RectangleF ( - new PointF (this.report_problem_link.Frame.X + this.report_problem_link.Frame.Width + 10, 25), + this.debug_log_link.Frame = new CGRect ( + new CGPoint (this.report_problem_link.Frame.X + this.report_problem_link.Frame.Width + 10, 25), this.debug_log_link.Frame.Size); ContentView.AddSubview (this.about_image_view); @@ -145,10 +145,6 @@ namespace SparkleShare { { NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); MakeKeyAndOrderFront (this); - - if (Program.UI != null) - Program.UI.UpdateDockIconVisibility (); - base.OrderFrontRegardless (); } @@ -156,10 +152,6 @@ namespace SparkleShare { public override void PerformClose (NSObject sender) { base.OrderOut (this); - - if (Program.UI != null) - Program.UI.UpdateDockIconVisibility (); - return; } @@ -168,7 +160,7 @@ namespace SparkleShare { public override bool WindowShouldClose (NSObject sender) { - (sender as SparkleAbout).Controller.WindowClosed (); + (sender as About).Controller.WindowClosed (); return false; } } @@ -181,32 +173,27 @@ namespace SparkleShare { public SparkleLink (string text, string address) : base () { + StringValue = text; this.url = new NSUrl (address); - AllowsEditingTextAttributes = true; + Font = NSFont.SystemFontOfSize (11); + + TextColor = NSColor.FromCalibratedRgba (1.0f, 1.0f, 1.0f, 0.5f); BackgroundColor = NSColor.White; + + AllowsEditingTextAttributes = true; Bordered = false; DrawsBackground = false; Editable = false; Selectable = false; - - NSData name_data = NSData.FromString ("<a href='" + this.url + - "' style='font-size: 9pt; font-family: \"Helvetica Neue\"; color: #739ECF'>" + text + "</a></font>"); - - NSDictionary name_dictionary = new NSDictionary(); - NSAttributedString name_attributes = new NSAttributedString (name_data, new NSUrl ("file://"), out name_dictionary); - - NSMutableAttributedString s = new NSMutableAttributedString (); - s.Append (name_attributes); - - Cell.AttributedStringValue = s; - SizeToFit (); + + SizeToFit (); } public override void MouseUp (NSEvent e) { - Program.Controller.OpenWebsite (this.url.ToString ()); + SparkleShare.Controller.OpenWebsite (this.url.ToString ()); } diff --git a/SparkleShare/Mac/SparkleBubbles.cs b/SparkleShare/Mac/UserInterface/Bubbles.cs index 1ac44e4..d00fba7 100755 --- a/SparkleShare/Mac/SparkleBubbles.cs +++ b/SparkleShare/Mac/UserInterface/Bubbles.cs @@ -1,5 +1,5 @@ -// SparkleShare, a collaboration and sharing tool. -// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com> +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // // 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 @@ -16,18 +16,16 @@ using System; - -using MonoMac.AppKit; -using MonoMac.Foundation; +using Foundation; namespace SparkleShare { - public class SparkleBubbles : NSObject { + public class Bubbles : NSObject { - public SparkleBubblesController Controller = new SparkleBubblesController (); + public BubblesController Controller = new BubblesController (); - public SparkleBubbles () + public Bubbles () { // The notification center was introduced in Mountain Lion if (Environment.OSVersion.Version.Major >= 12) @@ -35,18 +33,18 @@ namespace SparkleShare { } - private void ShowBubbleEvent (string title, string subtext, string image_path) { + void ShowBubbleEvent (string title, string subtext, string image_path) { InvokeOnMainThread (() => { - NSUserNotification notification = new NSUserNotification () { + var notification = new NSUserNotification { Title = title, InformativeText = subtext, - DeliveryDate = DateTime.Now + DeliveryDate = (NSDate) DateTime.Now }; NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter; center.ShouldPresentNotification = delegate { return true; }; - center.DidActivateNotification += delegate { Controller.BubbleClicked (); }; + center.DidActivateNotification += delegate { Controller.BubbleClicked (); }; center.ScheduleNotification (notification); }); } diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/UserInterface/EventLog.cs index 6ea3c73..52aa690 100755..100644 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/UserInterface/EventLog.cs @@ -1,5 +1,5 @@ -// SparkleShare, a collaboration and sharing tool. -// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com> +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // // 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 @@ -16,34 +16,34 @@ using System; -using System.Drawing; using System.IO; -using System.Threading; -using MonoMac.Foundation; -using MonoMac.AppKit; -using MonoMac.ObjCRuntime; -using MonoMac.WebKit; +using AppKit; +using CoreGraphics; +using Foundation; +using WebKit; namespace SparkleShare { - public class SparkleEventLog : NSWindow { + public class EventLog : NSWindow { - public SparkleEventLogController Controller = new SparkleEventLogController (); + public EventLogController Controller = new EventLogController (); public float TitlebarHeight; - private WebView web_view; - private NSBox background; - private NSBox cover; - private NSPopUpButton popup_button; - private NSProgressIndicator progress_indicator; - private NSTextField size_label, size_label_value, history_label, history_label_value; - private NSButton hidden_close_button; + WebView web_view; + NSBox background; + NSBox cover; + NSPopUpButton popup_button; + NSProgressIndicator progress_indicator; + NSTextField size_label, size_label_value, history_label, history_label_value; + NSButton hidden_close_button; - public SparkleEventLog (IntPtr handle) : base (handle) { } + public EventLog (IntPtr handle) : base (handle) + { + } - public SparkleEventLog () : base () + public EventLog () { Title = "Recent Changes"; Delegate = new SparkleEventsDelegate (); @@ -56,30 +56,33 @@ namespace SparkleShare { float y = (float) (NSScreen.MainScreen.Frame.Height * 0.5 - (height * 0.5)); SetFrame ( - new RectangleF ( - new PointF (x, y), - new SizeF (min_width, height)), + new CGRect ( + new CGPoint (x, y), + new CGSize (min_width, height)), true); StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Miniaturizable | NSWindowStyle.Titled | NSWindowStyle.Resizable); - MinSize = new SizeF (min_width, min_height); + MinSize = new CGSize (min_width, min_height); HasShadow = true; + IsOpaque = false; BackingType = NSBackingStore.Buffered; - TitlebarHeight = Frame.Height - ContentView.Frame.Height; + TitlebarHeight = (float) (Frame.Height - ContentView.Frame.Height); Level = NSWindowLevel.Floating; - this.web_view = new WebView (new RectangleF (0, 0, 481, 579), "", "") { - Frame = new RectangleF (new PointF (0, 0), - new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39)) + this.web_view = new WebView (new CGRect (0, 0, 481, 579), "", "") { + Frame = new CGRect (new CGPoint (0, 0), + new CGSize (ContentView.Frame.Width, ContentView.Frame.Height - 39)) }; + this.web_view.Preferences.PlugInsEnabled = false; + this.cover = new NSBox () { - Frame = new RectangleF ( - new PointF (-1, -1), - new SizeF (Frame.Width + 2, this.web_view.Frame.Height + 1)), + Frame = new CGRect ( + new CGPoint (-1, -1), + new CGSize (Frame.Width + 2, this.web_view.Frame.Height + 1)), FillColor = NSColor.White, BorderType = NSBorderType.NoBorder, BoxType = NSBoxType.NSBoxCustom @@ -100,9 +103,9 @@ namespace SparkleShare { BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, - Frame = new RectangleF ( - new PointF (0, ContentView.Frame.Height - 31), - new SizeF (60, 20)), + Frame = new CGRect ( + new CGPoint (0, ContentView.Frame.Height - 31), + new CGSize (60, 20)), StringValue = "Size:" }; @@ -111,11 +114,11 @@ namespace SparkleShare { BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, - Frame = new RectangleF ( - new PointF (60, ContentView.Frame.Height - 27), - new SizeF (60, 20)), + Frame = new CGRect ( + new CGPoint (60, ContentView.Frame.Height - 31), + new CGSize (60, 20)), StringValue = "…", - Font = NSFont.FromFontName (SparkleUI.FontName + " Bold", NSFont.SystemFontSize) + Font = NSFont.BoldSystemFontOfSize (12) }; @@ -124,9 +127,9 @@ namespace SparkleShare { BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, - Frame = new RectangleF ( - new PointF (130, ContentView.Frame.Height - 31), - new SizeF (60, 20)), + Frame = new CGRect ( + new CGPoint (130, ContentView.Frame.Height - 31), + new CGSize (60, 20)), StringValue = "History:" }; @@ -135,34 +138,34 @@ namespace SparkleShare { BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, - Frame = new RectangleF ( - new PointF (190, ContentView.Frame.Height - 27), - new SizeF (60, 20) + Frame = new CGRect ( + new CGPoint (190, ContentView.Frame.Height - 31), + new CGSize (60, 20) ), StringValue = "…", - Font = NSFont.FromFontName (SparkleUI.FontName + " Bold", NSFont.SystemFontSize) + Font = NSFont.BoldSystemFontOfSize (12) }; this.popup_button = new NSPopUpButton () { - Frame = new RectangleF ( - new PointF (ContentView.Frame.Width - 156 - 12, ContentView.Frame.Height - 33), - new SizeF (156, 26)), + Frame = new CGRect ( + new CGPoint (ContentView.Frame.Width - 156 - 12, ContentView.Frame.Height - 33), + new CGSize (156, 26)), PullsDown = false }; this.background = new NSBox () { - Frame = new RectangleF ( - new PointF (-1, -1), - new SizeF (Frame.Width + 2, this.web_view.Frame.Height + 2)), + Frame = new CGRect ( + new CGPoint (-1, -1), + new CGSize (Frame.Width + 2, this.web_view.Frame.Height + 2)), FillColor = NSColor.White, BorderColor = NSColor.LightGray, BoxType = NSBoxType.NSBoxCustom }; this.progress_indicator = new NSProgressIndicator () { - Frame = new RectangleF ( - new PointF (Frame.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10), - new SizeF (20, 20)), + Frame = new CGRect ( + new CGPoint (Frame.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10), + new CGSize (20, 20)), Style = NSProgressIndicatorStyle.Spinning }; @@ -177,33 +180,33 @@ namespace SparkleShare { ContentView.AddSubview (this.background); ContentView.AddSubview (this.hidden_close_button); - (Delegate as SparkleEventsDelegate).WindowResized += delegate (SizeF new_window_size) { - Program.Controller.Invoke (() => Relayout (new_window_size)); + (Delegate as SparkleEventsDelegate).WindowResized += delegate (CGSize new_window_size) { + SparkleShare.Controller.Invoke (() => Relayout (new_window_size)); }; // Hook up the controller events Controller.HideWindowEvent += delegate { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { this.progress_indicator.Hidden = true; PerformClose (this); }); }; Controller.ShowWindowEvent += delegate { - Program.Controller.Invoke (() => OrderFrontRegardless ()); + SparkleShare.Controller.Invoke (() => OrderFrontRegardless ()); }; Controller.UpdateChooserEvent += delegate (string [] folders) { - Program.Controller.Invoke (() => UpdateChooser (folders)); + SparkleShare.Controller.Invoke (() => UpdateChooser (folders)); }; Controller.UpdateChooserEnablementEvent += delegate (bool enabled) { - Program.Controller.Invoke (() => { this.popup_button.Enabled = enabled; }); + SparkleShare.Controller.Invoke (() => { this.popup_button.Enabled = enabled; }); }; Controller.UpdateContentEvent += delegate (string html) { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { this.cover.RemoveFromSuperview (); this.progress_indicator.Hidden = true; UpdateContent (html); @@ -211,7 +214,7 @@ namespace SparkleShare { }; Controller.ContentLoadingEvent += delegate { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { this.web_view.RemoveFromSuperview (); // FIXME: Hack to hide that the WebView sometimes doesn't disappear ContentView.AddSubview (this.cover); @@ -221,14 +224,14 @@ namespace SparkleShare { }; Controller.UpdateSizeInfoEvent += delegate (string size, string history_size) { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { this.size_label_value.StringValue = size; this.history_label_value.StringValue = history_size; }); }; Controller.ShowSaveDialogEvent += delegate (string file_name, string target_folder_path) { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { NSSavePanel panel = new NSSavePanel () { DirectoryUrl = new NSUrl (target_folder_path, true), NameFieldStringValue = file_name, @@ -237,7 +240,7 @@ namespace SparkleShare { PreventsApplicationTerminationWhenModal = false }; - if ((NSPanelButtonType) panel.RunModal () == NSPanelButtonType.Ok) { + if ((NSPanelButtonType) (int) panel.RunModal () == NSPanelButtonType.Ok) { string target_file_path = Path.Combine (panel.DirectoryUrl.RelativePath, panel.NameFieldStringValue); Controller.SaveDialogCompleted (target_file_path); @@ -249,41 +252,41 @@ namespace SparkleShare { } - public void Relayout (SizeF new_window_size) + public void Relayout (CGSize new_window_size) { - this.web_view.Frame = new RectangleF (this.web_view.Frame.Location, - new SizeF (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39)); + this.web_view.Frame = new CGRect (this.web_view.Frame.Location, + new CGSize (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39)); - this.cover.Frame = new RectangleF (this.cover.Frame.Location, - new SizeF (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39)); + this.cover.Frame = new CGRect (this.cover.Frame.Location, + new CGSize (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39)); - this.background.Frame = new RectangleF (this.background.Frame.Location, - new SizeF (new_window_size.Width, new_window_size.Height - TitlebarHeight - 37)); + this.background.Frame = new CGRect (this.background.Frame.Location, + new CGSize (new_window_size.Width, new_window_size.Height - TitlebarHeight - 37)); - this.size_label.Frame = new RectangleF ( - new PointF (this.size_label.Frame.X, new_window_size.Height - TitlebarHeight - 30), + this.size_label.Frame = new CGRect ( + new CGPoint (this.size_label.Frame.X, new_window_size.Height - TitlebarHeight - 30), this.size_label.Frame.Size); - this.size_label_value.Frame = new RectangleF ( - new PointF (this.size_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27), + this.size_label_value.Frame = new CGRect ( + new CGPoint (this.size_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27), this.size_label_value.Frame.Size); - this.history_label.Frame = new RectangleF ( - new PointF (this.history_label.Frame.X, new_window_size.Height - TitlebarHeight - 30), + this.history_label.Frame = new CGRect ( + new CGPoint (this.history_label.Frame.X, new_window_size.Height - TitlebarHeight - 30), this.history_label.Frame.Size); - this.history_label_value.Frame = new RectangleF ( - new PointF (this.history_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27), + this.history_label_value.Frame = new CGRect ( + new CGPoint (this.history_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27), this.history_label_value.Frame.Size); - this.progress_indicator.Frame = new RectangleF ( - new PointF (new_window_size.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10), + this.progress_indicator.Frame = new CGRect ( + new CGPoint (new_window_size.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10), this.progress_indicator.Frame.Size); this.popup_button.RemoveFromSuperview (); // Needed to prevent redraw glitches - this.popup_button.Frame = new RectangleF ( - new PointF (new_window_size.Width - this.popup_button.Frame.Width - 12, new_window_size.Height - TitlebarHeight - 33), + this.popup_button.Frame = new CGRect ( + new CGPoint (new_window_size.Width - this.popup_button.Frame.Width - 12, new_window_size.Height - TitlebarHeight - 33), this.popup_button.Frame.Size); ContentView.AddSubview (this.popup_button); @@ -299,21 +302,21 @@ namespace SparkleShare { this.popup_button.AddItem ("Summary"); this.popup_button.Menu.AddItem (NSMenuItem.SeparatorItem); - - int row = 2; - foreach (string folder in folders) { + + int row = 2; + foreach (string folder in folders) { this.popup_button.AddItem (folder); - - if (folder.Equals (Controller.SelectedFolder)) - this.popup_button.SelectItem (row); - - row++; - } - + + if (folder.Equals (Controller.SelectedFolder)) + this.popup_button.SelectItem (row); + + row++; + } + this.popup_button.AddItems (folders); this.popup_button.Activated += delegate { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { if (this.popup_button.IndexOfSelectedItem == 0) Controller.SelectedFolder = null; else @@ -325,9 +328,9 @@ namespace SparkleShare { public void UpdateContent (string html) { - string pixmaps_path = "file://" + NSBundle.MainBundle.ResourcePath; - - html = html.Replace ("<!-- $body-font-family -->", "Helvetica Neue"); + string pixmaps_path = "file://" + NSBundle.MainBundle.ResourcePath; + + html = html.Replace ("<!-- $body-font-family -->", UserInterface.FontName); html = html.Replace ("<!-- $day-entry-header-font-size -->", "13.6px"); html = html.Replace ("<!-- $body-font-size -->", "13.4px"); html = html.Replace ("<!-- $secondary-font-color -->", "#bbb"); @@ -341,9 +344,9 @@ namespace SparkleShare { html = html.Replace ("<!-- $document-deleted-background-image -->", pixmaps_path + "/document-deleted-12.png"); html = html.Replace ("<!-- $document-edited-background-image -->", pixmaps_path + "/document-edited-12.png"); html = html.Replace ("<!-- $document-moved-background-image -->", pixmaps_path + "/document-moved-12.png"); - - this.web_view = new WebView (new RectangleF (0, 0, 481, 579), "", "") { - Frame = new RectangleF (new PointF (0, 0), new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39)) + + this.web_view = new WebView (new CGRect (0, 0, 481, 579), "", "") { + Frame = new CGRect (new CGPoint (0, 0), new CGSize (ContentView.Frame.Width, ContentView.Frame.Height - 39)) }; this.web_view.MainFrame.LoadHtmlString (html, new NSUrl ("")); @@ -351,12 +354,7 @@ namespace SparkleShare { this.web_view.PolicyDelegate = new SparkleWebPolicyDelegate (); ContentView.AddSubview (this.web_view); - (this.web_view.PolicyDelegate as SparkleWebPolicyDelegate).LinkClicked += delegate (string href) { - if (href.StartsWith ("file:///")) - href = href.Substring (7); - - Controller.LinkClicked (href); - }; + (this.web_view.PolicyDelegate as SparkleWebPolicyDelegate).LinkClicked += Controller.LinkClicked; this.progress_indicator.Hidden = true; } @@ -366,10 +364,6 @@ namespace SparkleShare { { NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); MakeKeyAndOrderFront (this); - - if (Program.UI != null) - Program.UI.UpdateDockIconVisibility (); - base.OrderFrontRegardless (); } @@ -377,10 +371,6 @@ namespace SparkleShare { public override void PerformClose (NSObject sender) { base.OrderOut (this); - - if (Program.UI != null) - Program.UI.UpdateDockIconVisibility (); - return; } } @@ -389,9 +379,9 @@ namespace SparkleShare { public class SparkleEventsDelegate : NSWindowDelegate { public event WindowResizedHandler WindowResized = delegate { }; - public delegate void WindowResizedHandler (SizeF new_window_size); + public delegate void WindowResizedHandler (CGSize new_window_size); - public override SizeF WillResize (NSWindow sender, SizeF to_frame_size) + public override CGSize WillResize (NSWindow sender, CGSize to_frame_size) { WindowResized (to_frame_size); return to_frame_size; @@ -399,7 +389,7 @@ namespace SparkleShare { public override bool WindowShouldClose (NSObject sender) { - (sender as SparkleEventLog).Controller.WindowClosed (); + (sender as EventLog).Controller.WindowClosed (); return false; } } diff --git a/SparkleShare/Mac/SparkleNote.cs b/SparkleShare/Mac/UserInterface/Note.cs index 9b9cbf2..9e5c247 100755..100644 --- a/SparkleShare/Mac/SparkleNote.cs +++ b/SparkleShare/Mac/UserInterface/Note.cs @@ -1,5 +1,5 @@ -// SparkleShare, a collaboration and sharing tool. -// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com> +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // // 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 @@ -16,16 +16,16 @@ using System; -using System.Drawing; -using MonoMac.AppKit; -using MonoMac.Foundation; +using AppKit; +using CoreGraphics; +using Foundation; namespace SparkleShare { - public class SparkleNote : NSWindow { + public class Note : NSWindow { - public SparkleNoteController Controller = new SparkleNoteController (); + public NoteController Controller = new NoteController (); private NSImage user_image, balloon_image; private NSImageView user_image_view, balloon_image_view; @@ -34,24 +34,25 @@ namespace SparkleShare { private NSTextField user_name_text_field, user_email_text_field, balloon_text_field; - public SparkleNote (IntPtr handle) : base (handle) { } + public Note (IntPtr handle) : base (handle) { } - public SparkleNote () : base () + public Note () : base () { - SetFrame (new RectangleF (0, 0, 480, 240), true); + SetFrame (new CGRect (0, 0, 480, 240), true); Center (); Delegate = new SparkleNoteDelegate (); StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Titled); Title = "Add Note"; - MaxSize = new SizeF (480, 240); - MinSize = new SizeF (480, 240); + MaxSize = new CGSize (480, 240); + MinSize = new CGSize (480, 240); HasShadow = true; + IsOpaque = false; BackingType = NSBackingStore.Buffered; Level = NSWindowLevel.Floating; this.hidden_close_button = new NSButton () { - Frame = new RectangleF (0, 0, 0, 0), + Frame = new CGRect (0, 0, 0, 0), KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask, KeyEquivalent = "w" }; @@ -62,16 +63,16 @@ namespace SparkleShare { this.hidden_close_button.Activated += delegate { Controller.WindowClosed (); }; Controller.HideWindowEvent += delegate { - Program.Controller.Invoke (() => PerformClose (this)); + SparkleShare.Controller.Invoke (() => PerformClose (this)); }; Controller.ShowWindowEvent += delegate { - Program.Controller.Invoke (() => OrderFrontRegardless ()); + SparkleShare.Controller.Invoke (() => OrderFrontRegardless ()); CreateNote (); }; Controller.UpdateTitleEvent += delegate (string title) { - Program.Controller.Invoke (() => { Title = title; }); + SparkleShare.Controller.Invoke (() => { Title = title; }); }; @@ -82,9 +83,9 @@ namespace SparkleShare { private void CreateNote () { this.cover = new NSBox () { - Frame = new RectangleF ( - new PointF (-1, 58), - new SizeF (Frame.Width + 2, this.ContentView.Frame.Height + 1)), + Frame = new CGRect ( + new CGPoint (-1, 58), + new CGSize (Frame.Width + 2, this.ContentView.Frame.Height + 1)), FillColor = NSColor.FromCalibratedRgba (0.77f, 0.77f, 0.75f, 1.0f), BorderColor = NSColor.LightGray, BoxType = NSBoxType.NSBoxCustom @@ -96,11 +97,11 @@ namespace SparkleShare { BackgroundColor = NSColor.FromCalibratedRgba (0.77f, 0.77f, 0.75f, 1.0f), Bordered = false, Editable = false, - Frame = new RectangleF ( - new PointF (85, ContentView.Frame.Height - 41), - new SizeF (320, 22)), - StringValue = Program.Controller.CurrentUser.Name, - Font = NSFont.FromFontName (SparkleUI.FontName + " Bold", NSFont.SystemFontSize) + Frame = new CGRect ( + new CGPoint (85, ContentView.Frame.Height - 41), + new CGSize (320, 22)), + StringValue = SparkleShare.Controller.CurrentUser.Name, + Font = NSFont.BoldSystemFontOfSize (12) }; this.user_email_text_field = new NSTextField () { @@ -109,10 +110,10 @@ namespace SparkleShare { TextColor = NSColor.DisabledControlText, Bordered = false, Editable = false, - Frame = new RectangleF ( - new PointF (85, ContentView.Frame.Height - 60), - new SizeF (320, 20)), - StringValue = Program.Controller.CurrentUser.Email, + Frame = new CGRect ( + new CGPoint (85, ContentView.Frame.Height - 60), + new CGSize (320, 20)), + StringValue = SparkleShare.Controller.CurrentUser.Email, }; @@ -121,9 +122,9 @@ namespace SparkleShare { BackgroundColor = NSColor.White, Bordered = false, Editable = true, - Frame = new RectangleF ( - new PointF (30, ContentView.Frame.Height - 137), - new SizeF (418, 48)) + Frame = new CGRect ( + new CGPoint (30, ContentView.Frame.Height - 137), + new CGSize (418, 48)) }; (this.balloon_text_field.Cell as NSTextFieldCell).PlaceholderString = "Anything to add?"; @@ -136,13 +137,13 @@ namespace SparkleShare { this.cancel_button = new NSButton () { Title = "Cancel", BezelStyle = NSBezelStyle.Rounded, - Frame = new RectangleF (Frame.Width - 15 - 105 * 2, 12, 105, 32), + Frame = new CGRect (Frame.Width - 15 - 105 * 2, 12, 105, 32), }; this.sync_button = new NSButton () { Title = "Sync", BezelStyle = NSBezelStyle.Rounded, - Frame = new RectangleF (Frame.Width - 15 - 105, 12, 105, 32), + Frame = new CGRect (Frame.Width - 15 - 105, 12, 105, 32), }; this.cancel_button.Activated += delegate { Controller.CancelClicked (); }; @@ -156,10 +157,10 @@ namespace SparkleShare { else this.balloon_image = NSImage.ImageNamed ("text-balloon"); - this.balloon_image.Size = new SizeF (438, 72); + this.balloon_image.Size = new CGSize (438, 72); this.balloon_image_view = new NSImageView () { Image = this.balloon_image, - Frame = new RectangleF (21, ContentView.Frame.Height - 145, 438, 72) + Frame = new CGRect (21, ContentView.Frame.Height - 145, 438, 72) }; @@ -168,10 +169,10 @@ namespace SparkleShare { else this.user_image = NSImage.ImageNamed ("user-icon-default"); - this.user_image.Size = new SizeF (48, 48); + this.user_image.Size = new CGSize (48, 48); this.user_image_view = new NSImageView () { Image = this.user_image, - Frame = new RectangleF (21, ContentView.Frame.Height - 65, 48, 48) + Frame = new CGRect (21, ContentView.Frame.Height - 65, 48, 48) }; this.user_image_view.WantsLayer = true; @@ -197,10 +198,6 @@ namespace SparkleShare { { NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); MakeKeyAndOrderFront (this); - - if (Program.UI != null) - Program.UI.UpdateDockIconVisibility (); - base.OrderFrontRegardless (); } @@ -208,24 +205,21 @@ namespace SparkleShare { public override void PerformClose (NSObject sender) { base.OrderOut (this); - - if (Program.UI != null) - Program.UI.UpdateDockIconVisibility (); - return; } + public override bool AcceptsFirstResponder () { return true; } - private class SparkleNoteDelegate : NSWindowDelegate { + class SparkleNoteDelegate : NSWindowDelegate { public override bool WindowShouldClose (NSObject sender) { - (sender as SparkleNote).Controller.WindowClosed (); + (sender as Note).Controller.WindowClosed (); return false; } } diff --git a/SparkleShare/Mac/SparkleSetup.cs b/SparkleShare/Mac/UserInterface/Setup.cs index d544627..75aca2a 100755..100644 --- a/SparkleShare/Mac/SparkleSetup.cs +++ b/SparkleShare/Mac/UserInterface/Setup.cs @@ -1,5 +1,5 @@ -// SparkleShare, a collaboration and sharing tool. -// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com> +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // // 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 @@ -17,55 +17,63 @@ using System; using System.Collections.Generic; -using System.Drawing; using System.IO; -using MonoMac.Foundation; -using MonoMac.AppKit; -using MonoMac.WebKit; +using AppKit; +using CoreGraphics; +using Foundation; +using WebKit; -using Mono.Unix; +using Sparkles; namespace SparkleShare { - public class SparkleSetup : SparkleSetupWindow { + public class Setup : SetupWindow { - public SparkleSetupController Controller = new SparkleSetupController (); + public SetupController Controller = new SetupController (); - private NSButton ContinueButton, AddButton, CopyButton, TryAgainButton, CancelButton, - SkipTutorialButton, FinishButton, ShowFilesButton; + private NSButton ContinueButton, AddButton, TryAgainButton, CancelButton, FinishButton, ShowFilesButton; - private NSTextField FullNameTextField, FullNameLabel, EmailLabel, EmailTextField, - LinkCodeTextField, AddressTextField, AddressLabel, AddressHelpLabel, PathTextField, PathLabel, - PathHelpLabel, ProgressLabel, PasswordTextField, VisiblePasswordTextField, PasswordLabel, WarningTextField; + private NSTextField FullNameTextField, FullNameLabel, EmailLabel, EmailTextField; - private NSButton StartupCheckButton, HistoryCheckButton, ShowPasswordCheckButton; + private NSTextField AddressTextField, AddressLabel, AddressHelpLabel; + private NSTextField PathLabel, PathTextField, PathHelpLabel; + + private NSTextField ProgressLabel, PasswordTextField, VisiblePasswordTextField, PasswordLabel, WarningTextField; + + private NSImage WarningImage; + private NSImageView WarningImageView; + + private NSButton HistoryCheckButton, ShowPasswordCheckButton; private NSProgressIndicator ProgressIndicator; - private NSImage WarningImage, SlideImage; - private NSImageView WarningImageView, SlideImageView; private NSTableColumn IconColumn, DescriptionColumn; private NSTableView TableView; private NSScrollView ScrollView; private SparkleDataSource DataSource; + private NSButtonCell ButtonCellProto; + private NSMatrix Matrix; + List<NSTextField> storage_type_descriptions; - public SparkleSetup () : base () + + public Setup () : base () { Controller.HideWindowEvent += delegate { - Program.Controller.Invoke (() => PerformClose (this)); + SparkleShare.Controller.Invoke (() => PerformClose (this)); }; Controller.ShowWindowEvent += delegate { - Program.Controller.Invoke (() => OrderFrontRegardless ()); + SparkleShare.Controller.Invoke (() => OrderFrontRegardless ()); }; Controller.ChangePageEvent += delegate (PageType type, string [] warnings) { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { Reset (); ShowPage (type, warnings); ShowAll (); }); }; + } @@ -76,19 +84,19 @@ namespace SparkleShare { Description = "First off, what’s your name and email?\n(visible only to team members)"; FullNameLabel = new SparkleLabel ("Full Name:", NSTextAlignment.Right); - FullNameLabel.Frame = new RectangleF (165, Frame.Height - 234, 160, 17); + FullNameLabel.Frame = new CGRect (165, Frame.Height - 234, 160, 17); FullNameTextField = new NSTextField () { - Frame = new RectangleF (330, Frame.Height - 238, 196, 22), - StringValue = UnixUserInfo.GetRealUser ().RealName, + Frame = new CGRect (330, Frame.Height - 238, 196, 22), + StringValue = new NSProcessInfo ().GetFullUserName (), Delegate = new SparkleTextFieldDelegate () }; EmailLabel = new SparkleLabel ("Email:", NSTextAlignment.Right); - EmailLabel.Frame = new RectangleF (165, Frame.Height - 264, 160, 17); + EmailLabel.Frame = new CGRect (165, Frame.Height - 264, 160, 17); EmailTextField = new NSTextField () { - Frame = new RectangleF (330, Frame.Height - 268, 196, 22), + Frame = new CGRect (330, Frame.Height - 268, 196, 22), Delegate = new SparkleTextFieldDelegate () }; @@ -118,7 +126,7 @@ namespace SparkleShare { CancelButton.Activated += delegate { Controller.SetupPageCancelled (); }; Controller.UpdateSetupContinueButtonEvent += delegate (bool button_enabled) { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { ContinueButton.Enabled = button_enabled; }); }; @@ -145,20 +153,19 @@ namespace SparkleShare { Description = "Do you want to add this project to SparkleShare?"; AddressLabel = new SparkleLabel ("Address:", NSTextAlignment.Right); - AddressLabel.Frame = new RectangleF (165, Frame.Height - 238, 160, 17); - AddressLabel.Font = NSFont.FromFontName (SparkleUI.FontName + " Bold", NSFont.SystemFontSize); - + AddressLabel.Frame = new CGRect (165, Frame.Height - 238, 160, 17); + AddressLabel.Font = NSFont.BoldSystemFontOfSize (12); + AddressTextField = new SparkleLabel (Controller.PendingInvite.Address, NSTextAlignment.Left) { - Frame = new RectangleF (330, Frame.Height - 240, 260, 17) + Frame = new CGRect (330, Frame.Height - 240, 260, 17) }; PathLabel = new SparkleLabel ("Remote Path:", NSTextAlignment.Right); - PathLabel.Frame = new RectangleF (165, Frame.Height - 262, 160, 17); - PathLabel.Font = NSFont.FromFontName (SparkleUI.FontName + " Bold", NSFont.SystemFontSize); - + PathLabel.Frame = new CGRect (165, Frame.Height - 262, 160, 17); + PathLabel.Font = NSFont.BoldSystemFontOfSize (12); PathTextField = new SparkleLabel (Controller.PendingInvite.RemotePath, NSTextAlignment.Left) { - Frame = new RectangleF (330, Frame.Height - 264, 260, 17) + Frame = new CGRect (330, Frame.Height - 264, 260, 17) }; CancelButton = new NSButton () { Title = "Cancel" }; @@ -183,13 +190,13 @@ namespace SparkleShare { Description = ""; AddressLabel = new SparkleLabel ("Address:", NSTextAlignment.Left) { - Frame = new RectangleF (190, Frame.Height - 308, 160, 17), - Font = NSFont.FromFontName (SparkleUI.FontName + " Bold", NSFont.SystemFontSize) + Frame = new CGRect (190, Frame.Height - 310, 160, 17), + Font = NSFont.BoldSystemFontOfSize (12) }; AddressTextField = new NSTextField () { - Frame = new RectangleF (190, Frame.Height - 336, 196, 22), - Enabled = (Controller.SelectedPlugin.Address == null), + Frame = new CGRect (190, Frame.Height - 336, 196, 22), + Enabled = (Controller.SelectedPreset.Address == null), Delegate = new SparkleTextFieldDelegate (), StringValue = "" + Controller.PreviousAddress }; @@ -197,40 +204,40 @@ namespace SparkleShare { AddressTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathLabel = new SparkleLabel ("Remote Path:", NSTextAlignment.Left) { - Frame = new RectangleF (190 + 196 + 16, Frame.Height - 308, 160, 17), - Font = NSFont.FromFontName (SparkleUI.FontName + " Bold", NSFont.SystemFontSize) + Frame = new CGRect (190 + 196 + 16, Frame.Height - 310, 160, 17), + Font = NSFont.BoldSystemFontOfSize (12) }; PathTextField = new NSTextField () { - Frame = new RectangleF (190 + 196 + 16, Frame.Height - 336, 196, 22), - Enabled = (Controller.SelectedPlugin.Path == null), + Frame = new CGRect (190 + 196 + 16, Frame.Height - 336, 196, 22), + Enabled = (Controller.SelectedPreset.Path == null), Delegate = new SparkleTextFieldDelegate (), StringValue = "" + Controller.PreviousPath }; PathTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; - PathHelpLabel = new SparkleLabel (Controller.SelectedPlugin.PathExample, NSTextAlignment.Left) { - TextColor = NSColor.DisabledControlText, - Frame = new RectangleF (190 + 196 + 16, Frame.Height - 358, 204, 19) + PathHelpLabel = new SparkleLabel (Controller.SelectedPreset.PathExample, NSTextAlignment.Left) { + TextColor = NSColor.DisabledControlText, + Frame = new CGRect (190 + 196 + 16, Frame.Height - 358, 204, 19) }; - AddressHelpLabel = new SparkleLabel (Controller.SelectedPlugin.AddressExample, NSTextAlignment.Left) { - TextColor = NSColor.DisabledControlText, - Frame = new RectangleF (190, Frame.Height - 358, 204, 19) + AddressHelpLabel = new SparkleLabel (Controller.SelectedPreset.AddressExample, NSTextAlignment.Left) { + TextColor = NSColor.DisabledControlText, + Frame = new CGRect (190, Frame.Height - 358, 204, 19) }; - if (TableView == null || TableView.RowCount != Controller.Plugins.Count) { + if (TableView == null || TableView.RowCount != Controller.Presets.Count) { TableView = new NSTableView () { - Frame = new RectangleF (0, 0, 0, 0), + Frame = new CGRect (0, 0, 0, 0), RowHeight = 38, - IntercellSpacing = new SizeF (8, 12), + IntercellSpacing = new CGSize (8, 12), HeaderView = null, Delegate = new SparkleTableViewDelegate () }; ScrollView = new NSScrollView () { - Frame = new RectangleF (190, Frame.Height - 280, 408, 185), + Frame = new CGRect (190, Frame.Height - 280, 408, 185), DocumentView = TableView, HasVerticalScroller = true, BorderType = NSBorderType.BezelBorder @@ -248,33 +255,30 @@ namespace SparkleShare { Editable = false }; - DescriptionColumn.DataCell.Font = NSFontManager.SharedFontManager.FontWithFamily ( - SparkleUI.FontName, NSFontTraitMask.Condensed, 0, 11); - TableView.AddColumn (IconColumn); TableView.AddColumn (DescriptionColumn); // Hi-res display support was added after Snow Leopard if (Environment.OSVersion.Version.Major < 11) - DataSource = new SparkleDataSource (1, Controller.Plugins); + DataSource = new SparkleDataSource (1, Controller.Presets); else - DataSource = new SparkleDataSource (BackingScaleFactor, Controller.Plugins); + DataSource = new SparkleDataSource ((float) BackingScaleFactor, Controller.Presets); TableView.DataSource = DataSource; TableView.ReloadData (); (TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate { - Controller.SelectedPluginChanged (TableView.SelectedRow); - Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); + Controller.SelectedPresetChanged ((int) TableView.SelectedRow); + Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, (int) TableView.SelectedRow); }; } - TableView.SelectRow (Controller.SelectedPluginIndex, false); - TableView.ScrollRowToVisible (Controller.SelectedPluginIndex); + TableView.SelectRow (Controller.SelectedPresetIndex, false); + TableView.ScrollRowToVisible (Controller.SelectedPresetIndex); MakeFirstResponder ((NSResponder) TableView); HistoryCheckButton = new NSButton () { - Frame = new RectangleF (190, Frame.Height - 400, 300, 18), + Frame = new CGRect (190, Frame.Height - 400, 300, 18), Title = "Fetch prior revisions" }; @@ -292,7 +296,7 @@ namespace SparkleShare { Controller.ChangeAddressFieldEvent += delegate (string text, string example_text, FieldState state) { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { AddressTextField.StringValue = text; AddressTextField.Enabled = (state == FieldState.Enabled); AddressHelpLabel.StringValue = example_text; @@ -300,7 +304,7 @@ namespace SparkleShare { }; Controller.ChangePathFieldEvent += delegate (string text, string example_text, FieldState state) { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { PathTextField.StringValue = text; PathTextField.Enabled = (state == FieldState.Enabled); PathHelpLabel.StringValue = example_text; @@ -309,11 +313,11 @@ namespace SparkleShare { (AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { - Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); + Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, (int) TableView.SelectedRow); }; (PathTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { - Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); + Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, (int) TableView.SelectedRow); }; @@ -328,7 +332,7 @@ namespace SparkleShare { CancelButton.Activated += delegate { Controller.PageCancelled (); }; Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { AddButton.Enabled = button_enabled; }); }; @@ -345,7 +349,7 @@ namespace SparkleShare { Buttons.Add (AddButton); Buttons.Add (CancelButton); - Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); + Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, (int) TableView.SelectedRow); } if (type == PageType.Syncing) { @@ -353,7 +357,7 @@ namespace SparkleShare { Description = "This may take a while for large projects.\nIsn’t it coffee-o’clock?"; ProgressIndicator = new NSProgressIndicator () { - Frame = new RectangleF (190, Frame.Height - 200, 640 - 150 - 80, 20), + Frame = new CGRect (190, Frame.Height - 200, 640 - 150 - 80, 20), Style = NSProgressIndicatorStyle.Bar, MinValue = 0.0, MaxValue = 100.0, @@ -371,11 +375,11 @@ namespace SparkleShare { }; ProgressLabel = new SparkleLabel ("Preparing to fetch files…", NSTextAlignment.Right); - ProgressLabel.Frame = new RectangleF (Frame.Width - 40 - 250, 185, 250, 25); + ProgressLabel.Frame = new CGRect (Frame.Width - 40 - 250, 185, 250, 25); Controller.UpdateProgressBarEvent += delegate (double percentage, string speed) { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { ProgressIndicator.DoubleValue = percentage; ProgressLabel.StringValue = speed; }); @@ -399,11 +403,11 @@ namespace SparkleShare { // Displaying marked up text with Cocoa is // a pain, so we just use a webview instead WebView web_view = new WebView (); - web_view.Frame = new RectangleF (190, Frame.Height - 525, 375, 400); + web_view.Frame = new CGRect (190, Frame.Height - 525, 375, 400); string html = "<style>" + "* {" + - " font-family: '" + SparkleUI.FontName + "';" + + " font-family: -apple-system, '" + UserInterface.FontName + "';" + " font-size: 12px; cursor: default;" + "}" + "body {" + @@ -440,7 +444,7 @@ namespace SparkleShare { web_view.DrawsBackground = false; CancelButton = new NSButton () { Title = "Cancel" }; - TryAgainButton = new NSButton () { Title = "Try Again…" }; + TryAgainButton = new NSButton () { Title = "Retry" }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; @@ -453,6 +457,58 @@ namespace SparkleShare { Buttons.Add (CancelButton); } + if (type == PageType.StorageSetup) { + Header = string.Format ("Storage type for ‘{0}’", Controller.SyncingFolder); + Description = "What type of storage would you like to use?"; + + + storage_type_descriptions = new List<NSTextField> (); + + ButtonCellProto = new NSButtonCell (); + ButtonCellProto.SetButtonType (NSButtonType.Radio); + ButtonCellProto.Font = NSFont.BoldSystemFontOfSize (12); + + Matrix = new NSMatrix (new CGRect (202, Frame.Height - 256 - 128, 256, 256), NSMatrixMode.Radio, + ButtonCellProto, SparkleShare.Controller.FetcherAvailableStorageTypes.Count, 1); + + Matrix.CellSize = new CGSize (256, 36); + Matrix.IntercellSpacing = new CGSize (32, 32); + + int i = 0; + foreach (StorageTypeInfo storage_type in SparkleShare.Controller.FetcherAvailableStorageTypes) { + Matrix.Cells [i].Title = " " + storage_type.Name; + + NSTextField storage_type_description = new SparkleLabel (storage_type.Description, NSTextAlignment.Left) { + TextColor = NSColor.DisabledControlText, + Frame = new CGRect (223, Frame.Height - 190 - (68 * i), 256, 32) + }; + + storage_type_descriptions.Add (storage_type_description); + ContentView.AddSubview (storage_type_description); + + i++; + } + + ContentView.AddSubview (Matrix); + + + CancelButton = new NSButton () { Title = "Cancel" }; + ContinueButton = new NSButton () { Title = "Continue" }; + + ContinueButton.Activated += delegate { + StorageTypeInfo selected_storage_type = SparkleShare.Controller.FetcherAvailableStorageTypes [(int) Matrix.SelectedRow]; + Controller.StoragePageCompleted (selected_storage_type.Type); + }; + + CancelButton.Activated += delegate { Controller.SyncingCancelled (); }; + + Buttons.Add (ContinueButton); + Buttons.Add (CancelButton); + + + NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); + } + if (type == PageType.CryptoSetup || type == PageType.CryptoPassword) { if (type == PageType.CryptoSetup) { Header = "Set up file encryption"; @@ -469,22 +525,22 @@ namespace SparkleShare { extra_pos_y = 20; PasswordLabel = new SparkleLabel ("Password:", NSTextAlignment.Right) { - Frame = new RectangleF (155, Frame.Height - 202 - extra_pos_y, 160, 17), - Font = NSFont.FromFontName (SparkleUI.FontName + " Bold", NSFont.SystemFontSize) + Frame = new CGRect (155, Frame.Height - 204 - extra_pos_y, 160, 17), + Font = NSFont.BoldSystemFontOfSize (12) }; PasswordTextField = new NSSecureTextField () { - Frame = new RectangleF (320, Frame.Height - 208 - extra_pos_y, 196, 22), + Frame = new CGRect (320, Frame.Height - 208 - extra_pos_y, 196, 22), Delegate = new SparkleTextFieldDelegate () }; VisiblePasswordTextField = new NSTextField () { - Frame = new RectangleF (320, Frame.Height - 208 - extra_pos_y, 196, 22), + Frame = new CGRect (320, Frame.Height - 208 - extra_pos_y, 196, 22), Delegate = new SparkleTextFieldDelegate () }; ShowPasswordCheckButton = new NSButton () { - Frame = new RectangleF (318, Frame.Height - 235 - extra_pos_y, 300, 18), + Frame = new CGRect (318, Frame.Height - 235 - extra_pos_y, 300, 18), Title = "Show password", State = NSCellStateValue.Off }; @@ -492,15 +548,15 @@ namespace SparkleShare { ShowPasswordCheckButton.SetButtonType (NSButtonType.Switch); WarningImage = NSImage.ImageNamed ("NSInfo"); - WarningImage.Size = new SizeF (24, 24); + WarningImage.Size = new CGSize (24, 24); WarningImageView = new NSImageView () { Image = WarningImage, - Frame = new RectangleF (200, Frame.Height - 320, 24, 24) + Frame = new CGRect (200, Frame.Height - 320, 24, 24) }; WarningTextField = new SparkleLabel ("This password can’t be changed later, and your files can’t be recovered if it’s forgotten.", NSTextAlignment.Left) { - Frame = new RectangleF (235, Frame.Height - 390, 325, 100), + Frame = new CGRect (235, Frame.Height - 390, 325, 100), }; CancelButton = new NSButton () { Title = "Cancel" }; @@ -512,11 +568,11 @@ namespace SparkleShare { Controller.UpdateCryptoPasswordContinueButtonEvent += delegate (bool button_enabled) { - Program.Controller.Invoke (() => { ContinueButton.Enabled = button_enabled; }); + SparkleShare.Controller.Invoke (() => { ContinueButton.Enabled = button_enabled; }); }; Controller.UpdateCryptoSetupContinueButtonEvent += delegate (bool button_enabled) { - Program.Controller.Invoke (() => { ContinueButton.Enabled = button_enabled; }); + SparkleShare.Controller.Invoke (() => { ContinueButton.Enabled = button_enabled; }); }; ShowPasswordCheckButton.Activated += delegate { @@ -581,21 +637,21 @@ namespace SparkleShare { if (warnings.Length > 0) { WarningImage = NSImage.ImageNamed ("NSInfo"); - WarningImage.Size = new SizeF (24, 24); + WarningImage.Size = new CGSize (24, 24); WarningImageView = new NSImageView () { Image = WarningImage, - Frame = new RectangleF (200, Frame.Height - 175, 24, 24) + Frame = new CGRect (200, Frame.Height - 175, 24, 24) }; WarningTextField = new SparkleLabel (warnings [0], NSTextAlignment.Left); - WarningTextField.Frame = new RectangleF (235, Frame.Height - 245, 325, 100); + WarningTextField.Frame = new CGRect (235, Frame.Height - 245, 325, 100); ContentView.AddSubview (WarningImageView); ContentView.AddSubview (WarningTextField); } - ShowFilesButton = new NSButton () { Title = "Show Files…" }; + ShowFilesButton = new NSButton () { Title = "Show Files" }; FinishButton = new NSButton () { Title = "Finish" }; @@ -608,116 +664,6 @@ namespace SparkleShare { NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); } - - if (type == PageType.Tutorial) { - SlideImage = NSImage.ImageNamed ("tutorial-slide-" + Controller.TutorialPageNumber); - if (SlideImage != null) { - SlideImage.Size = new SizeF (324, 200); - - SlideImageView = new NSImageView () { - Image = SlideImage, - Frame = new RectangleF (228, Frame.Height - 350, 324, 200) - }; - - ContentView.AddSubview (SlideImageView); - } - - switch (Controller.TutorialPageNumber) { - case 1: { - Header = "What’s happening next?"; - Description = "SparkleShare creates a special folder on your computer " + - "that will keep track of your projects."; - - SkipTutorialButton = new NSButton () { Title = "Skip Tutorial" }; - ContinueButton = new NSButton () { Title = "Continue" }; - - - SkipTutorialButton.Activated += delegate { Controller.TutorialSkipped (); }; - ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; - - - ContentView.AddSubview (SlideImageView); - - Buttons.Add (ContinueButton); - Buttons.Add (SkipTutorialButton); - - break; - } - - case 2: { - Header = "Sharing files with others"; - Description = "All files added to your project folders are synced automatically with " + - "the host and your team members."; - - ContinueButton = new NSButton () { Title = "Continue" }; - ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; - Buttons.Add (ContinueButton); - - break; - } - - case 3: { - Header = "The status icon helps you"; - Description = "It shows the syncing progress, provides easy access to " + - "your projects, and lets you view recent changes."; - - ContinueButton = new NSButton () { Title = "Continue" }; - ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; - Buttons.Add (ContinueButton); - - break; - } - - case 4: { - Header = "Here’s your unique Client ID"; - Description = "You’ll need it whenever you want to link this computer to a host. " + - "You can also find it in the status icon menu."; - - LinkCodeTextField = new NSTextField () { - StringValue = Program.Controller.CurrentUser.PublicKey, - Enabled = false, - Selectable = false, - Frame = new RectangleF (230, Frame.Height - 238, 246, 22) - }; - - LinkCodeTextField.Cell.UsesSingleLineMode = true; - LinkCodeTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; - - CopyButton = new NSButton () { - Title = "Copy", - BezelStyle = NSBezelStyle.RoundRect, - Frame = new RectangleF (480, Frame.Height - 238, 60, 22) - }; - - 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); - - FinishButton = new NSButton () { Title = "Finish" }; - - - StartupCheckButton.Activated += delegate { - Controller.StartupItemChanged (StartupCheckButton.State == NSCellStateValue.On); - }; - - CopyButton.Activated += delegate { Controller.CopyToClipboardClicked (); }; - FinishButton.Activated += delegate { Controller.TutorialPageCompleted (); }; - - - ContentView.AddSubview (LinkCodeTextField); - ContentView.AddSubview (CopyButton); - ContentView.AddSubview (StartupCheckButton); - - Buttons.Add (FinishButton); - - break; - } - } - } } } @@ -730,28 +676,29 @@ namespace SparkleShare { int backing_scale_factor; - public SparkleDataSource (float backing_scale_factor, List<SparklePlugin> plugins) + public SparkleDataSource (float backing_scale_factor, List<Preset> presets) { Items = new List <object> (); - Cells = new NSAttributedString [plugins.Count]; - SelectedCells = new NSAttributedString [plugins.Count]; + Cells = new NSAttributedString [presets.Count]; + SelectedCells = new NSAttributedString [presets.Count]; this.backing_scale_factor = (int) backing_scale_factor; int i = 0; - foreach (SparklePlugin plugin in plugins) { - Items.Add (plugin); + foreach (Preset preset in presets) { + Items.Add (preset); NSTextFieldCell cell = new NSTextFieldCell (); - NSData name_data = NSData.FromString ("<font face='" + SparkleUI.FontName + "'><b>" + plugin.Name + "</b></font>"); + NSData name_data = NSData.FromString ( + "<font face='-apple-system, sans-serif' style='line-height: 140%'><b>" + preset.Name + "</b></font>"); NSDictionary name_dictionary = new NSDictionary(); NSAttributedString name_attributes = new NSAttributedString ( name_data, new NSUrl ("file://"), out name_dictionary); NSData description_data = NSData.FromString ( - "<small><font style='line-height: 150%' color='#aaa' face='" + SparkleUI.FontName + "'>" + plugin.Description + "</font></small>"); + "<small><font style='line-height: 150%' color='#aaa' face='-apple-system, sans-serif'>" + preset.Description + "</font></small>"); NSDictionary description_dictionary = new NSDictionary(); NSAttributedString description_attributes = new NSAttributedString ( @@ -767,15 +714,14 @@ namespace SparkleShare { NSTextFieldCell selected_cell = new NSTextFieldCell (); NSData selected_name_data = NSData.FromString ( - "<font color='white' face='" + SparkleUI.FontName +"'><b>" + plugin.Name + "</b></font>"); + "<font color='white' face='-apple-system, sans-serif' style='line-height: 140%'><b>" + preset.Name + "</b></font>"); NSDictionary selected_name_dictionary = new NSDictionary (); NSAttributedString selected_name_attributes = new NSAttributedString ( selected_name_data, new NSUrl ("file://"), out selected_name_dictionary); NSData selected_description_data = NSData.FromString ( - "<small><font style='line-height: 150%' color='#9bbaeb' face='" + SparkleUI.FontName + "'>" + - plugin.Description + "</font></small>"); + "<small><font style='line-height: 150%' color='#9bbaeb' face='-apple-system, sans-serif'>" + preset.Description + "</font></small>"); NSDictionary selected_description_dictionary = new NSDictionary (); NSAttributedString selected_description_attributes = new NSAttributedString ( @@ -811,31 +757,28 @@ namespace SparkleShare { { if (table_column.HeaderToolTip.Equals ("Description")) { if (table_view.SelectedRow == row_index && - Program.UI.Setup.IsKeyWindow && - Program.UI.Setup.FirstResponder == table_view) { + SparkleShare.UI.Setup.IsKeyWindow && + SparkleShare.UI.Setup.FirstResponder == table_view) { return SelectedCells [row_index]; - - } else { - return Cells [row_index]; } - } else { - SparklePlugin plugin = (SparklePlugin) Items [row_index]; - string path = plugin.ImagePath; + return Cells [row_index]; + } - if (backing_scale_factor >= 2) { - string hi_path = String.Format ("{0}@{1}x{2}", - Path.Combine (Path.GetDirectoryName (path), Path.GetFileNameWithoutExtension (path)), - backing_scale_factor, Path.GetExtension (path) - ); + string image_path = (Items [row_index] as Preset).ImagePath; - if (File.Exists (hi_path)) - path = hi_path; - } + if (backing_scale_factor >= 2) { + string hi_path = String.Format ("{0}@{1}x{2}", + Path.Combine (Path.GetDirectoryName (image_path), Path.GetFileNameWithoutExtension (image_path)), + backing_scale_factor, Path.GetExtension (image_path) + ); - return new NSImage (path) { Size = new SizeF (24, 24) }; + if (File.Exists (hi_path)) + image_path = hi_path; } + + return new NSImage (image_path) { Size = new CGSize (24, 24) }; } } diff --git a/SparkleShare/Mac/SparkleSetupWindow.cs b/SparkleShare/Mac/UserInterface/SetupWindow.cs index a0dcb8a..83ffa54 100755..100644 --- a/SparkleShare/Mac/SparkleSetupWindow.cs +++ b/SparkleShare/Mac/UserInterface/SetupWindow.cs @@ -1,5 +1,5 @@ -// SparkleShare, an instant update workflow to Git. -// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com> +// SparkleShare, an instant update workflow to Git. +// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // // 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 @@ -15,64 +15,59 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. -using System; using System.Collections.Generic; -using System.Drawing; -using System.IO; -using MonoMac.Foundation; -using MonoMac.AppKit; +using CoreGraphics; +using Foundation; +using AppKit; namespace SparkleShare { - public class SparkleSetupWindow : NSWindow { + public class SetupWindow : NSWindow { public List <NSButton> Buttons = new List <NSButton> (); public string Header; new public string Description; - private NSImage side_splash; - private NSImageView side_splash_view; - private NSTextField header_text_field, description_text_field; + NSImage side_splash; + NSImageView side_splash_view; + NSTextField header_text_field; + NSTextField description_text_field; - public SparkleSetupWindow (IntPtr handle) : base (handle) { } - public SparkleSetupWindow () : base () + public SetupWindow () { - SetFrame (new RectangleF (0, 0, 640, 420), true); + SetFrame (new CGRect (0, 0, 640, 420), true); StyleMask = NSWindowStyle.Titled; - MaxSize = new SizeF (640, 420); - MinSize = new SizeF (640, 420); + MaxSize = new CGSize (640, 420); + MinSize = new CGSize (640, 420); HasShadow = true; + IsOpaque = false; BackingType = NSBackingStore.Buffered; Level = NSWindowLevel.Floating; Center (); this.side_splash = NSImage.ImageNamed ("side-splash"); - this.side_splash.Size = new SizeF (150, 482); + this.side_splash.Size = new CGSize (150, 482); this.side_splash_view = new NSImageView () { Image = this.side_splash, - Frame = new RectangleF (0, 0, 150, 482) + Frame = new CGRect (0, 0, 150, 482) }; this.header_text_field = new SparkleLabel ("", NSTextAlignment.Left) { - Frame = new RectangleF (190, Frame.Height - 80, Frame.Width, 24), - Font = NSFontManager.SharedFontManager.FontWithFamily ( - SparkleUI.FontName, NSFontTraitMask.Bold, 0, 16) + Frame = new CGRect (190, Frame.Height - 80, Frame.Width, 24), + Font = NSFont.BoldSystemFontOfSize (16) }; this.description_text_field = new SparkleLabel ("", NSTextAlignment.Left) { - Frame = new RectangleF (190, Frame.Height - 130, 640 - 240, 44) + Frame = new CGRect (190, Frame.Height - 130, 640 - 240, 44) }; this.header_text_field.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; - - if (Program.UI != null) - Program.UI.UpdateDockIconVisibility (); } @@ -103,12 +98,12 @@ namespace SparkleShare { foreach (NSButton button in Buttons) { button.BezelStyle = NSBezelStyle.Rounded; - button.Frame = new RectangleF (Frame.Width - 15 - x - (105 * i), 12, 105, 32); + button.Frame = new CGRect (Frame.Width - 15 - x - (105 * i), 12, 105, 32); // Make the button a bit wider if the text is likely to be longer if (button.Title.Contains (" ")) { button.SizeToFit (); - button.Frame = new RectangleF (Frame.Width - 30 - 15 - (105 * (i - 1)) - button.Frame.Width, + button.Frame = new CGRect (Frame.Width - 30 - 15 - (105 * (i - 1)) - button.Frame.Width, 12, button.Frame.Width + 30, 32); x += 22; @@ -129,21 +124,15 @@ namespace SparkleShare { NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); MakeKeyAndOrderFront (this); - if (Program.UI != null) - Program.UI.UpdateDockIconVisibility (); - base.OrderFrontRegardless (); } public override void PerformClose (NSObject sender) { - base.OrderOut (this); + OrderOut (this); NSApplication.SharedApplication.RemoveWindowsItem (this); - if (Program.UI != null) - Program.UI.UpdateDockIconVisibility (); - return; } diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/UserInterface/StatusIcon.cs index a925366..2e857b3 100755..100644 --- a/SparkleShare/Mac/SparkleStatusIcon.cs +++ b/SparkleShare/Mac/UserInterface/StatusIcon.cs @@ -1,5 +1,5 @@ -// SparkleShare, an instant update workflow to Git. -// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com> +// SparkleShare, an instant update workflow to Git. +// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // // 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 @@ -17,17 +17,15 @@ using System; using System.Collections.Generic; -using System.Drawing; -using System.IO; -using MonoMac.Foundation; -using MonoMac.AppKit; +using AppKit; +using CoreGraphics; namespace SparkleShare { - public class SparkleStatusIcon { + public class StatusIcon { - public SparkleStatusIconController Controller = new SparkleStatusIconController (); + public StatusIconController Controller = new StatusIconController (); private NSStatusItem status_item = NSStatusBar.SystemStatusBar.CreateStatusItem (28); private NSMenu menu, submenu, link_code_submenu; @@ -45,12 +43,12 @@ namespace SparkleShare { private NSImage syncing_image = NSImage.ImageNamed ("process-syncing"); private NSImage syncing_error_image = NSImage.ImageNamed ("process-syncing-error"); - private NSImage folder_image = NSImage.ImageNamed ("NSFolder"); - private NSImage caution_image = NSImage.ImageNamed ("NSCaution"); + private NSImage folder_image = NSImage.ImageNamed ("NSFolder"); + private NSImage caution_image = NSImage.ImageNamed ("NSCaution"); private NSImage sparkleshare_image; - public SparkleStatusIcon () + public StatusIcon () { this.status_item.HighlightMode = true; this.status_item.Image = this.syncing_idle_image; @@ -64,7 +62,7 @@ namespace SparkleShare { CreateMenu (); Controller.UpdateIconEvent += delegate (IconState state) { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { switch (state) { case IconState.Idle: { this.status_item.Image = this.syncing_idle_image; break; } case IconState.SyncingUp: { this.status_item.Image = this.syncing_up_image; break; } @@ -78,7 +76,7 @@ namespace SparkleShare { }; Controller.UpdateStatusItemEvent += delegate (string state_text) { - Program.Controller.Invoke (() => { + SparkleShare.Controller.Invoke (() => { this.state_item.Title = state_text; if (Controller.Projects.Length == this.state_menu_items.Length) { @@ -92,11 +90,11 @@ namespace SparkleShare { while (this.menu_delegate.MenuIsOpen) System.Threading.Thread.Sleep (100); - Program.Controller.Invoke (() => CreateMenu ()); + SparkleShare.Controller.Invoke (() => CreateMenu ()); }; Controller.UpdateQuitItemEvent += delegate (bool quit_item_enabled) { - Program.Controller.Invoke (() => { this.quit_item.Enabled = quit_item_enabled; }); + SparkleShare.Controller.Invoke (() => { this.quit_item.Enabled = quit_item_enabled; }); }; } @@ -116,10 +114,10 @@ namespace SparkleShare { }; this.folder_item.Image = this.sparkleshare_image; - this.folder_item.Image.Size = new SizeF (16, 16); + this.folder_item.Image.Size = new CGSize (16, 16); this.add_item = new NSMenuItem () { - Title = "Add Hosted Project…", + Title = "Sync Remote Project…", Enabled = true }; @@ -129,13 +127,13 @@ namespace SparkleShare { }; this.link_code_item = new NSMenuItem (); - this.link_code_item.Title = "Client ID"; + this.link_code_item.Title = "Computer ID"; if (Controller.LinkCodeItemEnabled) { this.link_code_submenu = new NSMenu (); this.code_item = new NSMenuItem (); - this.code_item.Title = Program.Controller.CurrentUser.PublicKey.Substring (0, 20) + "..."; + this.code_item.Title = SparkleShare.Controller.UserAuthenticationInfo.PublicKey.Substring (0, 20) + "..."; this.copy_item = new NSMenuItem (); this.copy_item.Title = "Copy to Clipboard"; @@ -203,7 +201,7 @@ namespace SparkleShare { item.Image = this.caution_image; this.try_again_menu_items [i] = new NSMenuItem (); - this.try_again_menu_items [i].Title = "Try Again"; + this.try_again_menu_items [i].Title = "Retry Sync"; this.try_again_menu_items [i].Activated += Controller.TryAgainDelegate (project.Name); item.Submenu.AddItem (this.try_again_menu_items [i]); @@ -219,7 +217,7 @@ namespace SparkleShare { if (!Controller.Projects [i].HasError) this.folder_menu_items [i].Activated += Controller.OpenFolderDelegate (project.Name); - item.Image.Size = new SizeF (16, 16); + item.Image.Size = new CGSize (16, 16); i++; }; } diff --git a/SparkleShare/Mac/UserInterface/UserInterface.cs b/SparkleShare/Mac/UserInterface/UserInterface.cs new file mode 100755 index 0000000..876a178 --- /dev/null +++ b/SparkleShare/Mac/UserInterface/UserInterface.cs @@ -0,0 +1,89 @@ +// SparkleShare, a collaboration and sharing tool. +// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> +// +// 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; + +using AppKit; +using Foundation; + +namespace SparkleShare { + + public class UserInterface : AppDelegate { + + public StatusIcon StatusIcon; + public EventLog EventLog; + public Setup Setup; + public Bubbles Bubbles; + public About About; + public Note Note; + + + public UserInterface () + { + SparkleShare.Controller.Invoke (() => { + NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare-app.icns"); + + Setup = new Setup (); + EventLog = new EventLog (); + About = new About (); + Note = new Note (); + Bubbles = new Bubbles (); + StatusIcon = new StatusIcon (); + }); + + SparkleShare.Controller.UIHasLoaded (); + } + + + public void Run (string [] args) + { + NSApplication.Main (args); + } + + + // To provide the right font in web views + public static string FontName { + get { + if (Environment.OSVersion.Version.Major < 14) + return "Lucida Grande"; + + if (Environment.OSVersion.Version.Major <= 15) + return "Helvetica Neue"; + + return "SF UI Text"; + } + } + } + + + public partial class AppDelegate : NSApplicationDelegate { + + public override void WillTerminate (NSNotification notification) + { + SparkleShare.Controller.Quit (); + } + + + public override bool ApplicationShouldHandleReopen (NSApplication sender, bool has_visible_windows) + { + if (!has_visible_windows) + SparkleShare.Controller.HandleReopen (); + + return true; + } + } +} diff --git a/SparkleShare/Mac/SparkleMacWatcher.cs b/SparkleShare/Mac/Watcher.cs index 0046cb3..e8de3ae 100755 --- a/SparkleShare/Mac/SparkleMacWatcher.cs +++ b/SparkleShare/Mac/Watcher.cs @@ -1,6 +1,6 @@ -// Originally taken from: +// Originally taken from: // https://github.com/jesse99/Continuum/blob/master/source/shared/DirectoryWatcher.cs -// Modified to use MonoMac and integrate into SparkleShare +// Modified to use Xamarin.Mac and integrate into SparkleShare // // Copyright (C) 2008 Jesse Jones // Copyright (C) 2012 Hylke Bons @@ -27,14 +27,10 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Runtime.InteropServices; using System.IO; -using System.Threading; -using System.Timers; -using MonoMac.AppKit; -using MonoMac.Foundation; +using Foundation; namespace SparkleShare { diff --git a/SparkleShare/Mac/checkGit.sh b/SparkleShare/Mac/checkGit.sh index d64a083..c882fbe 100755 --- a/SparkleShare/Mac/checkGit.sh +++ b/SparkleShare/Mac/checkGit.sh @@ -13,25 +13,17 @@ function abspath() export projectFolder=$(dirname $0) export projectFolder=$(abspath ${projectFolder}) - -export gitVersion=$(cat ${projectFolder}/git.version) +export gitDownload=$(cat ${projectFolder}/git.download) set -e -if [ ! -f ${projectFolder}/git-${gitVersion}.tar.gz ] +if [ ! -f ${projectFolder}/git.tar.gz ] then - curl -s https://codeload.github.com/git/git/zip/v${gitVersion} > git.zip - unzip -q git.zip - - cd git-${gitVersion} - - make configure - ./configure --prefix=${projectFolder}/git - make install - cd .. + curl -s -L ${gitDownload} > git.tar.gz + test -e git.tar.gz || { echo "Failed to download git"; exit 1; } - tar cfz git-${gitVersion}.tar.gz git - rm -rf git - rm -rf git-${gitVersion} - rm git.zip + mkdir git/ + tar xzf git.tar.gz --directory git/ + tar czf git.tar.gz git/ + rm -rf git/ fi diff --git a/SparkleShare/Mac/config b/SparkleShare/Mac/config index e15ba99..8313843 100644 --- a/SparkleShare/Mac/config +++ b/SparkleShare/Mac/config @@ -1,30 +1,2 @@ <configuration> - <dllmap dll="i:cygwin1.dll" target="libc.dylib" os="!windows" /> - <dllmap dll="libc" target="libc.dylib" os="!windows"/> - <dllmap dll="intl" target="libintl.dylib" os="!windows"/> - <dllmap dll="intl" name="bind_textdomain_codeset" target="libc.dylib" os="solaris"/> - <dllmap dll="libintl" name="bind_textdomain_codeset" target="libc.dylib" os="solaris"/> - <dllmap dll="libintl" target="libintl.dylib" os="!windows"/> - <dllmap dll="i:libxslt.dll" target="libxslt.dylib" os="!windows"/> - <dllmap dll="i:odbc32.dll" target="libodbc.dylib" os="!windows"/> - <dllmap dll="i:odbc32.dll" target="libiodbc.dylib" os="osx"/> - <dllmap dll="oci" target="libclntsh.dylib" os="!windows"/> - <dllmap dll="db2cli" target="libdb2_36.dylib" os="!windows"/> - <dllmap dll="MonoPosixHelper" target="libMonoPosixHelper.dylib" os="!windows" /> - <dllmap dll="i:msvcrt" target="libc.dylib" os="!windows"/> - <dllmap dll="i:msvcrt.dll" target="libc.dylib" os="!windows"/> - <dllmap dll="sqlite" target="libsqlite.0.dylib" os="!windows"/> - <dllmap dll="sqlite3" target="libsqlite3.0.dylib" os="!windows"/> - <dllmap dll="libX11" target="/usr/X11R6/lib/libX11.dylib" os="!windows" /> - <dllmap dll="libcairo-2.dll" target="libcairo.2.dylib" os="!windows"/> - <dllmap dll="libcups" target="libcups.so.2" os="!windows"/> - <dllmap dll="i:kernel32.dll"> - <dllentry dll="__Internal" name="CopyMemory" target="mono_win32_compat_CopyMemory"/> - <dllentry dll="__Internal" name="FillMemory" target="mono_win32_compat_FillMemory"/> - <dllentry dll="__Internal" name="MoveMemory" target="mono_win32_compat_MoveMemory"/> - <dllentry dll="__Internal" name="ZeroMemory" target="mono_win32_compat_ZeroMemory"/> - </dllmap> - <dllmap dll="gdiplus.dll" target="libgdiplus.dylib" /> - <dllmap dll="gdiplus" target="libgdiplus.dylib" /> </configuration> - diff --git a/SparkleShare/Mac/git.download b/SparkleShare/Mac/git.download new file mode 100644 index 0000000..556ff9a --- /dev/null +++ b/SparkleShare/Mac/git.download @@ -0,0 +1 @@ +https://github.com/desktop/dugite-native/releases/download/v2.15.1-rc2/dugite-native-v2.15.1-macOS-56.tar.gz diff --git a/SparkleShare/Mac/git.version b/SparkleShare/Mac/git.version deleted file mode 100644 index 05fc3da..0000000 --- a/SparkleShare/Mac/git.version +++ /dev/null @@ -1 +0,0 @@ -1.8.5.5 diff --git a/SparkleShare/Mac/packReleaseDist.sh b/SparkleShare/Mac/packReleaseDist.sh index 171811d..6305f7b 100755 --- a/SparkleShare/Mac/packReleaseDist.sh +++ b/SparkleShare/Mac/packReleaseDist.sh @@ -14,11 +14,6 @@ export PATH=/usr/local/bin:/opt/local/bin:/Library/Frameworks/Mono.framework/Ver cd ${bundle}/Contents/MonoBundle/ -# add / fix dependency libMonoPosixHelper -cp ${MONO_PATH}/lib/libMonoPosixHelper.dylib ../MacOS/ -sed -i .bak 's/libMonoPosixHelper.dylib/@executable_path\/libMonoPosixHelper.dylib/' ./config - # merge all Assemblies into one Mac binary -mkbundle --static --deps --config ./config -o ../MacOS/SparkleShare SparkleShare.exe SparkleLib.dll MonoMac.dll SparkleLib.Git.dll +mkbundle --static --deps --config ./config -o ../MacOS/SparkleShare SparkleShare.exe Sparkles.dll Xamarin.Mac.dll Sparkles.Git.dll rm *.dll *.exe - diff --git a/SparkleShare/Mac/postBuild.sh b/SparkleShare/Mac/postBuild.sh index 643f33a..6fe1222 100755 --- a/SparkleShare/Mac/postBuild.sh +++ b/SparkleShare/Mac/postBuild.sh @@ -1,15 +1,14 @@ #!/bin/sh -# expect path to app bundle argument +# Expect path to app bundle argument export bundle=$1 export projectFolder=$(dirname $0) -export gitVersion=$(cat ${projectFolder}/git.version) -echo postprocessing ${bundle} +echo Postprocessing ${bundle}... export PATH=/usr/local/bin:/opt/local/bin:/Library/Frameworks/Mono.framework/Versions/Current/bin:/usr/bin:/bin ${projectFolder}/checkGit.sh -tar -x -f ${projectFolder}/git-${gitVersion}.tar.gz -C ${bundle}/Contents/Resources +tar -x -f ${projectFolder}/git.tar.gz --directory ${bundle}/Contents/Resources cp -R SparkleShareInviteOpener.app ${bundle}/Contents/Resources cp config ${bundle}/Contents/MonoBundle |