controller: add abstract method InstallProtocolHandler ()
This commit is contained in:
parent
c21d84c717
commit
e68a832aec
|
@ -113,6 +113,12 @@ namespace SparkleShare {
|
||||||
// N/A
|
// N/A
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void InstallProtocolHandler ()
|
||||||
|
{
|
||||||
|
// We ship SparkleShareInviteHandler.app in the bundle
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Adds the SparkleShare folder to the user's
|
// Adds the SparkleShare folder to the user's
|
||||||
// list of bookmarked places
|
// list of bookmarked places
|
||||||
|
|
|
@ -180,7 +180,7 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
FolderMenuItem.Activated += delegate {
|
FolderMenuItem.Activated += delegate {
|
||||||
Program.Controller.OpenSparkleShareFolder ();
|
Controller.SparkleShareClicked ();
|
||||||
};
|
};
|
||||||
|
|
||||||
FolderMenuItem.Image = SparkleShareImage;
|
FolderMenuItem.Image = SparkleShareImage;
|
||||||
|
@ -314,7 +314,7 @@ namespace SparkleShare {
|
||||||
private EventHandler OpenFolderDelegate (string name)
|
private EventHandler OpenFolderDelegate (string name)
|
||||||
{
|
{
|
||||||
return delegate {
|
return delegate {
|
||||||
Program.Controller.OpenSparkleShareFolder (name);
|
Controller.SubfolderClicked (name);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,40 +74,6 @@ namespace SparkleShare {
|
||||||
SparkleHelpers.DebugInfo ("Controller", "Enabled autostart on login");
|
SparkleHelpers.DebugInfo ("Controller", "Enabled autostart on login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Installs a launcher so the user can launch SparkleShare
|
|
||||||
// from the Internet category if needed
|
|
||||||
public override void InstallLauncher ()
|
|
||||||
{
|
|
||||||
string apps_path =
|
|
||||||
new string [] {SparkleConfig.DefaultConfig.HomePath,
|
|
||||||
".local", "share", "applications"}.Combine ();
|
|
||||||
|
|
||||||
string desktopfile_path = Path.Combine (apps_path, "sparkleshare.desktop");
|
|
||||||
|
|
||||||
if (!File.Exists (desktopfile_path)) {
|
|
||||||
if (!Directory.Exists (apps_path))
|
|
||||||
Directory.CreateDirectory (apps_path);
|
|
||||||
|
|
||||||
TextWriter writer = new StreamWriter (desktopfile_path);
|
|
||||||
writer.WriteLine ("[Desktop Entry]\n" +
|
|
||||||
"Type=Application\n" +
|
|
||||||
"Name=SparkleShare\n" +
|
|
||||||
"Comment=Share documents\n" +
|
|
||||||
"Exec=sparkleshare start\n" +
|
|
||||||
"Icon=folder-sparkleshare\n" +
|
|
||||||
"Terminal=false\n" +
|
|
||||||
"Categories=Network;");
|
|
||||||
writer.Close ();
|
|
||||||
|
|
||||||
// Give the launcher the right permissions so it can be launched by the user
|
|
||||||
UnixFileInfo file_info = new UnixFileInfo (desktopfile_path);
|
|
||||||
file_info.FileAccessPermissions = FileAccessPermissions.UserReadWriteExecute;
|
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Controller", "Created '" + desktopfile_path + "'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Adds the SparkleShare folder to the user's
|
// Adds the SparkleShare folder to the user's
|
||||||
|
|
|
@ -87,8 +87,34 @@ namespace SparkleShare {
|
||||||
public event NoteNotificationRaisedEventHandler NoteNotificationRaised;
|
public event NoteNotificationRaisedEventHandler NoteNotificationRaised;
|
||||||
public delegate void NoteNotificationRaisedEventHandler (SparkleUser user, string folder_name);
|
public delegate void NoteNotificationRaisedEventHandler (SparkleUser user, string folder_name);
|
||||||
|
|
||||||
|
|
||||||
|
// Path where the plugins are kept
|
||||||
public abstract string PluginsPath { get; }
|
public abstract string PluginsPath { get; }
|
||||||
|
|
||||||
|
// Enables SparkleShare to start automatically at login
|
||||||
|
public abstract void EnableSystemAutostart ();
|
||||||
|
|
||||||
|
// Installs a launcher so the user can launch SparkleShare
|
||||||
|
// from the Internet category if needed
|
||||||
|
public abstract void InstallLauncher ();
|
||||||
|
|
||||||
|
// Installs the sparkleshare:// protocol handler
|
||||||
|
public abstract void InstallProtocolHandler ();
|
||||||
|
|
||||||
|
// Adds the SparkleShare folder to the user's
|
||||||
|
// list of bookmarked places
|
||||||
|
public abstract void AddToBookmarks ();
|
||||||
|
|
||||||
|
// Creates the SparkleShare folder in the user's home folder
|
||||||
|
public abstract bool CreateSparkleShareFolder ();
|
||||||
|
|
||||||
|
// Opens the SparkleShare folder or an (optional) subfolder
|
||||||
|
public abstract void OpenSparkleShareFolder (string subfolder);
|
||||||
|
|
||||||
|
// Opens a file with the appropriate application
|
||||||
|
public abstract void OpenFile (string url);
|
||||||
|
|
||||||
|
|
||||||
private SparkleFetcherBase fetcher;
|
private SparkleFetcherBase fetcher;
|
||||||
private List<string> failed_avatars = new List<string> ();
|
private List<string> failed_avatars = new List<string> ();
|
||||||
|
|
||||||
|
@ -117,10 +143,13 @@ namespace SparkleShare {
|
||||||
if (CreateSparkleShareFolder ())
|
if (CreateSparkleShareFolder ())
|
||||||
AddToBookmarks ();
|
AddToBookmarks ();
|
||||||
|
|
||||||
if (FirstRun)
|
if (FirstRun) {
|
||||||
SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.TrueString);
|
SparkleConfig.DefaultConfig.SetConfigOption ("notifications", bool.TrueString);
|
||||||
else
|
InstallProtocolHandler ();
|
||||||
|
|
||||||
|
} else {
|
||||||
ImportPrivateKey ();
|
ImportPrivateKey ();
|
||||||
|
}
|
||||||
|
|
||||||
// Watch the SparkleShare folder
|
// Watch the SparkleShare folder
|
||||||
FileSystemWatcher watcher = new FileSystemWatcher (SparkleConfig.DefaultConfig.FoldersPath) {
|
FileSystemWatcher watcher = new FileSystemWatcher (SparkleConfig.DefaultConfig.FoldersPath) {
|
||||||
|
@ -534,28 +563,6 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Creates a .desktop entry in autostart folder to
|
|
||||||
// start SparkleShare automatically at login
|
|
||||||
public abstract void EnableSystemAutostart ();
|
|
||||||
|
|
||||||
// Installs a launcher so the user can launch SparkleShare
|
|
||||||
// from the Internet category if needed
|
|
||||||
public abstract void InstallLauncher ();
|
|
||||||
|
|
||||||
// Adds the SparkleShare folder to the user's
|
|
||||||
// list of bookmarked places
|
|
||||||
public abstract void AddToBookmarks ();
|
|
||||||
|
|
||||||
// Creates the SparkleShare folder in the user's home folder
|
|
||||||
public abstract bool CreateSparkleShareFolder ();
|
|
||||||
|
|
||||||
// Opens the SparkleShare folder or an (optional) subfolder
|
|
||||||
public abstract void OpenSparkleShareFolder (string subfolder);
|
|
||||||
|
|
||||||
// Opens a file with the appropriate application
|
|
||||||
public abstract void OpenFile (string url);
|
|
||||||
|
|
||||||
|
|
||||||
// Fires events for the current syncing state
|
// Fires events for the current syncing state
|
||||||
public void UpdateState ()
|
public void UpdateState ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -209,7 +209,7 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
folder_item.Activated += delegate {
|
folder_item.Activated += delegate {
|
||||||
Program.Controller.OpenSparkleShareFolder ();
|
Controller.SparkleShareClicked ();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.menu.Add (folder_item);
|
this.menu.Add (folder_item);
|
||||||
|
@ -318,7 +318,7 @@ namespace SparkleShare {
|
||||||
private EventHandler OpenFolderDelegate (string name)
|
private EventHandler OpenFolderDelegate (string name)
|
||||||
{
|
{
|
||||||
return delegate {
|
return delegate {
|
||||||
Program.Controller.OpenSparkleShareFolder (name);
|
Controller.SubfolderClicked (name);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,15 +131,21 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void AddHostedProjectClicked ()
|
public void SparkleShareClicked ()
|
||||||
{
|
{
|
||||||
Program.Controller.ShowSetupWindow (PageType.Add);
|
Program.Controller.OpenSparkleShareFolder ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void AboutClicked ()
|
public void SubfolderClicked (string subfolder)
|
||||||
{
|
{
|
||||||
Program.Controller.ShowAboutWindow ();
|
Program.Controller.OpenSparkleShareFolder (subfolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void AddHostedProjectClicked ()
|
||||||
|
{
|
||||||
|
Program.Controller.ShowSetupWindow (PageType.Add);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,5 +153,11 @@ namespace SparkleShare {
|
||||||
{
|
{
|
||||||
Program.Controller.ShowEventLogWindow ();
|
Program.Controller.ShowEventLogWindow ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void AboutClicked ()
|
||||||
|
{
|
||||||
|
Program.Controller.ShowAboutWindow ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue