controller: add a Initialize () method, instead of doing everything in the constructor
This commit is contained in:
parent
e63b1c64e2
commit
0e7f1e5491
|
@ -16,11 +16,8 @@
|
|||
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
using Mono.Unix;
|
||||
|
||||
namespace SparkleLib {
|
||||
|
||||
public static class SparklePaths {
|
||||
|
@ -30,7 +27,7 @@ namespace SparkleLib {
|
|||
public static string SparkleTmpPath = Path.Combine (SparklePath, ".tmp");
|
||||
public static string SparkleConfigPath = Path.Combine (Environment.GetFolderPath (
|
||||
Environment.SpecialFolder.ApplicationData), "sparkleshare");
|
||||
public static string SparkleLocalIconPath = SparkleHelpers.CombineMore (SparkleConfigPath, "icons");
|
||||
public static string SparkleLocalIconPath = Path.Combine (SparkleConfigPath, "icons");
|
||||
|
||||
public static string SparkleInstallPath = Path.Combine (Defines.PREFIX, "sparkleshare");
|
||||
public static string SparkleIconPath = SparkleHelpers.CombineMore (Defines.DATAROOTDIR, "sparkleshare", "icons");
|
||||
|
|
|
@ -32,9 +32,12 @@ namespace SparkleShare {
|
|||
// System.IO.FileSystemWatcher fails watching subfolders on Mac
|
||||
private SparkleMacWatcher watcher = new SparkleMacWatcher (SparklePaths.SparklePath);
|
||||
|
||||
public SparkleMacController () : base () { }
|
||||
|
||||
public SparkleMacController () : base ()
|
||||
new public void Initialize ()
|
||||
{
|
||||
base.Initialize ();
|
||||
|
||||
watcher.Changed += delegate (string path) {
|
||||
string repo_name;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace SparkleShare {
|
|||
|
||||
public List <SparkleRepoBase> Repositories;
|
||||
public string FolderSize;
|
||||
public readonly string SparklePath;
|
||||
public readonly string SparklePath = SparklePaths.SparklePath;
|
||||
|
||||
public event OnQuitWhileSyncingEventHandler OnQuitWhileSyncing;
|
||||
public delegate void OnQuitWhileSyncingEventHandler ();
|
||||
|
@ -88,10 +88,10 @@ namespace SparkleShare {
|
|||
}
|
||||
|
||||
|
||||
public SparkleController ()
|
||||
{
|
||||
SparklePath = SparklePaths.SparklePath;
|
||||
public SparkleController () { }
|
||||
|
||||
public void Initialize ()
|
||||
{
|
||||
InstallLauncher ();
|
||||
EnableSystemAutostart ();
|
||||
|
||||
|
|
|
@ -100,6 +100,8 @@ namespace SparkleShare {
|
|||
Controller = (SparkleController) Activator.CreateInstance (
|
||||
Type.GetType ("SparkleShare.Sparkle" + controller_name + "Controller"));
|
||||
|
||||
Controller.Initialize ();
|
||||
|
||||
if (Controller != null && !hide_ui) {
|
||||
UI = new SparkleUI ();
|
||||
UI.Run ();
|
||||
|
|
Loading…
Reference in a new issue