-
-
Notifications
You must be signed in to change notification settings - Fork 576
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
191 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// SparkleShare, a collaboration and sharing tool. | ||
// SparkleShare, a collaboration and sharing tool. | ||
// Copyright (C) 2010 Hylke Bons <[email protected]> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
|
@@ -67,10 +67,14 @@ public override void Initialize () | |
|
||
public override void CreateSparkleShareFolder () | ||
{ | ||
if (!Directory.Exists (SparkleShare.Controller.FoldersPath)) { | ||
Directory.CreateDirectory (SparkleShare.Controller.FoldersPath); | ||
Syscall.chmod (SparkleShare.Controller.FoldersPath, (FilePermissions) 448); // 448 -> 700 | ||
} | ||
if (Directory.Exists (SparkleShare.Controller.FoldersPath)) | ||
return; | ||
|
||
Directory.CreateDirectory (SparkleShare.Controller.FoldersPath); | ||
|
||
// TODO: Use proper API | ||
var chmod = new Command ("chmod", "700 " + SparkleShare.Controller.FoldersPath); | ||
chmod.StartAndWaitForExit (); | ||
} | ||
|
||
|
||
|
@@ -89,31 +93,31 @@ public override void SetFolderIcon () | |
} | ||
|
||
|
||
// There aren't any bindings in Xamarin.Mac to support this yet, so | ||
// we call out to an applescript to do the job | ||
// 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 () | ||
{ | ||
string args = "-e 'tell application \"System Events\" to " + | ||
"make login item at end with properties " + | ||
"{path:\"" + NSBundle.MainBundle.BundlePath + "\", hidden:false}'"; | ||
var process = new Command ("osascript", args); | ||
process.StartAndWaitForExit (); | ||
Logger.LogInfo ("Controller", "Added " + NSBundle.MainBundle.BundlePath + " to login items"); | ||
} | ||
string args = "-e 'tell application \"System Events\" to " + | ||
"make login item at end with properties " + | ||
"{path:\"" + NSBundle.MainBundle.BundlePath + "\", hidden:false}'"; | ||
|
||
var process = new Command ("osascript", args); | ||
process.StartAndWaitForExit (); | ||
|
||
Logger.LogInfo ("Controller", "Added " + NSBundle.MainBundle.BundlePath + " to login items"); | ||
} | ||
|
||
|
||
public override void InstallProtocolHandler () | ||
{ | ||
} | ||
|
||
|
||
public override void CopyToClipboard (string text) | ||
{ | ||
NSPasteboard.GeneralPasteboard.ClearContents (); | ||
NSPasteboard.GeneralPasteboard.SetStringForType (text, "NSStringPboardType"); | ||
} | ||
public override void CopyToClipboard (string text) | ||
{ | ||
NSPasteboard.GeneralPasteboard.ClearContents (); | ||
NSPasteboard.GeneralPasteboard.SetStringForType (text, "NSStringPboardType"); | ||
} | ||
|
||
|
||
public override void OpenFolder (string path) | ||
|
@@ -216,13 +220,12 @@ void OnFilesChanged (List<string> changed_files_in_basedir) | |
|
||
|
||
public delegate void Code (); | ||
readonly NSObject obj = new NSObject (); | ||
|
||
public void Invoke (Code code) | ||
{ | ||
using (var a = new NSAutoreleasePool ()) | ||
{ | ||
obj.InvokeOnMainThread (() => code ()); | ||
new NSObject ().InvokeOnMainThread (() => code ()); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// SparkleShare, a collaboration and sharing tool. | ||
// SparkleShare, a collaboration and sharing tool. | ||
// Copyright (C) 2010 Hylke Bons <[email protected]> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,9 +16,9 @@ | |
|
||
|
||
using System; | ||
using System.Drawing; | ||
|
||
using AppKit; | ||
using CoreGraphics; | ||
using Foundation; | ||
|
||
namespace SparkleShare { | ||
|
@@ -38,21 +38,21 @@ public About (IntPtr handle) : base (handle) { } | |
|
||
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" | ||
}; | ||
|
@@ -82,22 +82,22 @@ public About () : base () | |
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) { | ||
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) | ||
}; | ||
|
||
|
@@ -108,26 +108,26 @@ private void CreateAbout () | |
"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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.