Merge pull request #1805 from hbons/fix/xdg-open

Fix/xdg-open
This commit is contained in:
Hylke Bons 2018-02-12 11:38:38 +00:00 committed by GitHub
commit 84b3fd1365
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 2 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@
*.sln.cache
*.user
*.resources
Makecache
Makefile.in
Makefile
intltool-*

View file

@ -103,7 +103,7 @@ namespace SparkleShare {
Xalign = 0, Xpad = 0
};
if (InstallationInfo.Directory.StartsWith ("/app", StringComparison.InvariantCulture))
if (InstallationInfo.IsFlatpak)
version.Text += " (Flatpak)";
updates = new Label ("Checking for updates…") {

View file

@ -98,7 +98,10 @@ namespace SparkleShare {
public override void OpenFile (string path)
{
Global.ShowUri (Gdk.Screen.Default, path);
if (InstallationInfo.IsFlatpak)
Global.ShowUri (Gdk.Screen.Default, path);
else
new Command ("xdg-open", string.Format ("\"{0}\"", path)).Start ();
}

View file

@ -230,6 +230,7 @@ namespace SparkleShare {
return false;
}
#pragma warning disable 0612
string uri = (decision as NavigationPolicyDecision).Request.Uri;
if (uri.Equals ("file:///")) {

View file

@ -120,3 +120,4 @@ namespace SparkleShare
}
}
}

View file

@ -95,5 +95,12 @@ namespace Sparkles {
return version.Substring (0, version.Length - 2);
}
}
public static bool IsFlatpak {
get {
return Directory.StartsWith ("/app", StringComparison.InvariantCulture);
}
}
}
}