linux: Only use Gtk.ShowUri in flatpaks

This commit is contained in:
Hylke Bons 2018-02-11 19:55:38 +00:00
parent 942441696b
commit 6514d71190
4 changed files with 13 additions and 2 deletions

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

@ -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);
}
}
}
}