controller: move folder opening logic to base controller
This commit is contained in:
parent
508092e0f1
commit
f65401a237
|
@ -204,18 +204,13 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void OpenSparkleShareFolder (string subfolder)
|
public override void OpenFolder (string path)
|
||||||
{
|
{
|
||||||
string folder = Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, subfolder);
|
OpenFile (path);
|
||||||
|
|
||||||
Process process = new Process ();
|
|
||||||
process.StartInfo.FileName = "xdg-open";
|
|
||||||
process.StartInfo.Arguments = "\"" + folder + "\"";
|
|
||||||
process.Start ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void OpenFile (string url)
|
public override void OpenFile (string path)
|
||||||
{
|
{
|
||||||
Process process = new Process ();
|
Process process = new Process ();
|
||||||
process.StartInfo.FileName = "xdg-open";
|
process.StartInfo.FileName = "xdg-open";
|
||||||
|
|
|
@ -186,13 +186,10 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Opens the SparkleShare folder or an (optional) subfolder
|
public override void OpenFolder (string path)
|
||||||
public override void OpenSparkleShareFolder (string subfolder)
|
|
||||||
{
|
{
|
||||||
string folder = Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, subfolder);
|
path = path.Replace (" ", "\\ "); // Escape space-characters
|
||||||
folder.Replace (" ", "\\ "); // Escape space-characters
|
NSWorkspace.SharedWorkspace.OpenFile (path);
|
||||||
|
|
||||||
NSWorkspace.SharedWorkspace.OpenFile (folder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -144,10 +144,10 @@ namespace SparkleShare {
|
||||||
public abstract bool CreateSparkleShareFolder ();
|
public abstract bool CreateSparkleShareFolder ();
|
||||||
|
|
||||||
// Opens the SparkleShare folder or an (optional) subfolder
|
// Opens the SparkleShare folder or an (optional) subfolder
|
||||||
public abstract void OpenSparkleShareFolder (string subfolder);
|
public abstract void OpenFolder (string path);
|
||||||
|
|
||||||
// Opens a file with the appropriate application
|
// Opens a file with the appropriate application
|
||||||
public abstract void OpenFile (string url);
|
public abstract void OpenFile (string path);
|
||||||
|
|
||||||
|
|
||||||
private SparkleFetcherBase fetcher;
|
private SparkleFetcherBase fetcher;
|
||||||
|
@ -736,7 +736,13 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void OpenSparkleShareFolder ()
|
public void OpenSparkleShareFolder ()
|
||||||
{
|
{
|
||||||
OpenSparkleShareFolder ("");
|
OpenFolder (SparkleConfig.DefaultConfig.FoldersPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void OpenSparkleShareFolder (string name)
|
||||||
|
{
|
||||||
|
OpenFolder (new SparkleFolder (name).FullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -180,17 +180,17 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void OpenFile (string url)
|
public override void OpenFile (string path)
|
||||||
{
|
{
|
||||||
Process.Start (url);
|
Process.Start (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void OpenSparkleShareFolder (string subfolder)
|
public override void OpenFolder (string path)
|
||||||
{
|
{
|
||||||
Process process = new Process ();
|
Process process = new Process ();
|
||||||
process.StartInfo.FileName = "explorer";
|
process.StartInfo.FileName = "explorer";
|
||||||
process.StartInfo.Arguments = Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, subfolder);
|
process.StartInfo.Arguments = path;
|
||||||
|
|
||||||
process.Start();
|
process.Start();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue