Merge pull request #1821 from hbons/fix/freeze-on-quit
Fix/freeze-on-quit
This commit is contained in:
commit
fee2151054
|
@ -181,6 +181,9 @@ namespace SparkleShare {
|
||||||
// Copies text to the clipboard
|
// Copies text to the clipboard
|
||||||
public abstract void CopyToClipboard (string text);
|
public abstract void CopyToClipboard (string text);
|
||||||
|
|
||||||
|
// Allows for platform-specific quit and cleanup methods to be called on exit
|
||||||
|
public abstract void PlatformQuit ();
|
||||||
|
|
||||||
public abstract string EventLogHTML { get; }
|
public abstract string EventLogHTML { get; }
|
||||||
public abstract string DayEntryHTML { get; }
|
public abstract string DayEntryHTML { get; }
|
||||||
public abstract string EventEntryHTML { get; }
|
public abstract string EventEntryHTML { get; }
|
||||||
|
@ -717,12 +720,12 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual void Quit ()
|
public void Quit ()
|
||||||
{
|
{
|
||||||
foreach (BaseRepository repo in Repositories)
|
foreach (BaseRepository repo in Repositories)
|
||||||
repo.Dispose ();
|
repo.Dispose ();
|
||||||
|
|
||||||
Environment.Exit (0);
|
PlatformQuit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public class Controller : BaseController {
|
public class Controller : BaseController {
|
||||||
|
|
||||||
public Controller (Configuration config)
|
public Controller (Configuration config) : base (config)
|
||||||
: base (config)
|
|
||||||
{
|
{
|
||||||
if (InstallationInfo.IsFlatpak)
|
if (InstallationInfo.IsFlatpak)
|
||||||
GitCommand.ExecPath = Path.Combine ("/app", "libexec", "git-core");
|
GitCommand.ExecPath = Path.Combine ("/app", "libexec", "git-core");
|
||||||
|
@ -142,5 +141,11 @@ namespace SparkleShare {
|
||||||
return Path.Combine (InstallationInfo.Directory, "presets");
|
return Path.Combine (InstallationInfo.Directory, "presets");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void PlatformQuit ()
|
||||||
|
{
|
||||||
|
Environment.Exit (0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,16 +80,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public override void SetFolderIcon ()
|
public override void SetFolderIcon ()
|
||||||
{
|
{
|
||||||
if (Environment.OSVersion.Version.Major >= 14) {
|
string folder_icon_name = "sparkleshare-folder.icns";
|
||||||
NSWorkspace.SharedWorkspace.SetIconforFile (
|
|
||||||
NSImage.ImageNamed ("sparkleshare-folder-yosemite.icns"),
|
|
||||||
SparkleShare.Controller.FoldersPath, 0);
|
|
||||||
|
|
||||||
} else {
|
if (Environment.OSVersion.Version.Major >= 14)
|
||||||
NSWorkspace.SharedWorkspace.SetIconforFile (
|
folder_icon_name = "sparkleshare-folder-yosemite.icns";
|
||||||
NSImage.ImageNamed ("sparkleshare-folder.icns"),
|
|
||||||
SparkleShare.Controller.FoldersPath, 0);
|
NSWorkspace.SharedWorkspace.SetIconforFile (NSImage.ImageNamed (folder_icon_name), SparkleShare.Controller.FoldersPath, 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -228,5 +224,13 @@ namespace SparkleShare {
|
||||||
new NSObject ().InvokeOnMainThread (() => code ());
|
new NSObject ().InvokeOnMainThread (() => code ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void PlatformQuit ()
|
||||||
|
{
|
||||||
|
watcher.Dispose ();
|
||||||
|
NSRunningApplication.CurrentApplication.Terminate ();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,12 +72,6 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public partial class AppDelegate : NSApplicationDelegate {
|
public partial class AppDelegate : NSApplicationDelegate {
|
||||||
|
|
||||||
public override void WillTerminate (NSNotification notification)
|
|
||||||
{
|
|
||||||
SparkleShare.Controller.Quit ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public override bool ApplicationShouldHandleReopen (NSApplication sender, bool has_visible_windows)
|
public override bool ApplicationShouldHandleReopen (NSApplication sender, bool has_visible_windows)
|
||||||
{
|
{
|
||||||
if (!has_visible_windows)
|
if (!has_visible_windows)
|
||||||
|
|
|
@ -664,7 +664,7 @@ namespace Sparkles {
|
||||||
|
|
||||||
// this.listener.Dispose ();
|
// this.listener.Dispose ();
|
||||||
|
|
||||||
if (!UseCustomWatcher)
|
if (!UseCustomWatcher && this.watcher != null)
|
||||||
this.watcher.Dispose ();
|
this.watcher.Dispose ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue