From 1e799c5ce7cb08d47bd6c2b8556a8b8985e66eef Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 11 Feb 2018 13:30:08 +0000 Subject: [PATCH 1/2] linux: Write GTK+ version to the logs --- SparkleShare/Linux/UserInterface.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SparkleShare/Linux/UserInterface.cs b/SparkleShare/Linux/UserInterface.cs index b6d687bf..70f40b88 100644 --- a/SparkleShare/Linux/UserInterface.cs +++ b/SparkleShare/Linux/UserInterface.cs @@ -43,6 +43,9 @@ namespace SparkleShare 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.Register (null); From 3e74b2cb6f8810ac365feb6c837f948e80891c1d Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 11 Feb 2018 13:31:13 +0000 Subject: [PATCH 2/2] linux: Detect right Run method for installed GTK+ bindings --- SparkleShare/Linux/UserInterface.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/SparkleShare/Linux/UserInterface.cs b/SparkleShare/Linux/UserInterface.cs index 70f40b88..773a342e 100644 --- a/SparkleShare/Linux/UserInterface.cs +++ b/SparkleShare/Linux/UserInterface.cs @@ -16,6 +16,7 @@ using System; +using System.Reflection; using Gtk; using Sparkles; @@ -68,17 +69,18 @@ namespace SparkleShare public void Run (string [] args) { - // FIXME: Hack to cover API differences between Ubuntu and latest GNOME - if (InstallationInfo.OperatingSystem == OS.Ubuntu) { - #if HAVE_APP_INDICATOR - (application as GLib.Application).Run (0, null); - #endif + MethodInfo run_method = typeof (GLib.Application).GetMethod ("Run"); + ParameterInfo [] run_parameters = run_method.GetParameters (); + + // Use the right Run method arguments depending on the installed GTK bindings + 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 { - #if HAVE_APP_INDICATOR - #else - (application as GLib.Application).Run ("org.sparkleshare.SparkleShare", new string [0]); - #endif - } + run_method.Invoke ((application as GLib.Application), new object [] { "org.sparkleshare.SparkleShare", new string [0] }); + } }