Merge pull request #1803 from hbons/fix/linux-main-loop

Fix/linux main loop
This commit is contained in:
Hylke Bons 2018-02-11 17:08:21 +00:00 committed by GitHub
commit 06a16ff44a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,6 +45,9 @@ namespace SparkleShare
public UserInterface () public UserInterface ()
{ {
string gtk_version = string.Format ("{0}.{1}.{2}", Global.MajorVersion, Global.MinorVersion, Global.MicroVersion);
Logger.LogInfo ("Environment", "GTK+ " + gtk_version);
application = new Application ("org.sparkleshare.SparkleShare", GLib.ApplicationFlags.None); application = new Application ("org.sparkleshare.SparkleShare", GLib.ApplicationFlags.None);
application.Register (null); application.Register (null);
@ -69,17 +72,18 @@ namespace SparkleShare
public void Run (string [] args) public void Run (string [] args)
{ {
// FIXME: Hack to cover API differences between Ubuntu and latest GNOME MethodInfo run_method = typeof (GLib.Application).GetMethod ("Run");
if (InstallationInfo.OperatingSystem == OS.Ubuntu) { ParameterInfo [] run_parameters = run_method.GetParameters ();
#if HAVE_APP_INDICATOR
(application as GLib.Application).Run (0, null); // Use the right Run method arguments depending on the installed GTK bindings
#endif if (run_parameters [0].ParameterType == typeof (System.Int32) &&
run_parameters [1].ParameterType == typeof (System.String)) {
run_method.Invoke ((application as GLib.Application), new object [] { 0, null });
} else { } else {
#if HAVE_APP_INDICATOR run_method.Invoke ((application as GLib.Application), new object [] { "org.sparkleshare.SparkleShare", new string [0] });
#else }
(application as GLib.Application).Run ("org.sparkleshare.SparkleShare", new string [0]);
#endif
}
} }