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