From 5f6153e8b36df0fd1ed5befdacb92fe220fe57e1 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 17 Mar 2018 22:45:38 +0000 Subject: [PATCH] linux: Add options to toggle statusicon type --- SparkleShare/Linux/SparkleShare.Linux.csproj | 2 +- SparkleShare/Linux/StatusIcon.cs | 12 +++++++++--- SparkleShare/Linux/UserInterface.cs | 12 ++++++++++++ SparkleShare/Linux/sparkleshare.in | 2 +- Sparkles/InstallationInfo.cs | 2 +- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/SparkleShare/Linux/SparkleShare.Linux.csproj b/SparkleShare/Linux/SparkleShare.Linux.csproj index d87811f8..4f5b6455 100644 --- a/SparkleShare/Linux/SparkleShare.Linux.csproj +++ b/SparkleShare/Linux/SparkleShare.Linux.csproj @@ -175,4 +175,4 @@ - \ No newline at end of file + diff --git a/SparkleShare/Linux/StatusIcon.cs b/SparkleShare/Linux/StatusIcon.cs index 2f6a6d38..cefdd0be 100644 --- a/SparkleShare/Linux/StatusIcon.cs +++ b/SparkleShare/Linux/StatusIcon.cs @@ -31,6 +31,7 @@ namespace SparkleShare { public class StatusIcon { public StatusIconController Controller = new StatusIconController (); + public static bool use_appindicator = true; Gtk.StatusIcon status_icon; @@ -44,8 +45,6 @@ namespace SparkleShare { Indicator indicator; #endif - bool use_appindicator = true; - public StatusIcon () { @@ -67,7 +66,10 @@ namespace SparkleShare { Controller.UpdateIconEvent += delegate (IconState state) { Application.Invoke (delegate { - string icon_name = "org.sparkleshare.SparkleShare-symbolic"; + string icon_name = "org.sparkleshare.SparkleShare"; + + if (use_appindicator) + icon_name += "-symbolic"; if (state == IconState.SyncingUp) icon_name = "process-syncing-up"; @@ -209,6 +211,10 @@ namespace SparkleShare { this.recent_events_item = new MenuItem ("Recent Changes…"); this.recent_events_item.Sensitive = Controller.RecentEventsItemEnabled; + + if (!use_appindicator) + (folder_item.Submenu as Menu).Add (new SeparatorMenuItem ()); + (folder_item.Submenu as Menu).Add (this.recent_events_item); diff --git a/SparkleShare/Linux/UserInterface.cs b/SparkleShare/Linux/UserInterface.cs index b5d62155..73dafe28 100644 --- a/SparkleShare/Linux/UserInterface.cs +++ b/SparkleShare/Linux/UserInterface.cs @@ -71,6 +71,18 @@ namespace SparkleShare public void Run (string [] args) { + if (Array.IndexOf (args, "--status-icon=gtk") > -1) { + StatusIcon.use_appindicator = false; + Logger.LogInfo ("Environment", "Arguments: --status-icon=gtk"); + } + + #if HAVE_APPINDICATOR + if (Array.IndexOf (args, "--status-icon=appindicator") > -1) { + StatusIcon.use_appindicator = true; + Logger.LogInfo ("Environment", "Arguments: --status-icon=appindicator"); + } + #endif + MethodInfo [] methods = typeof (GLib.Application).GetMethods (BindingFlags.Instance | BindingFlags.Public); ParameterInfo [] run_parameters = new ParameterInfo [0]; MethodInfo run_method = methods [0]; diff --git a/SparkleShare/Linux/sparkleshare.in b/SparkleShare/Linux/sparkleshare.in index 441edfa9..103ffcdd 100755 --- a/SparkleShare/Linux/sparkleshare.in +++ b/SparkleShare/Linux/sparkleshare.in @@ -16,6 +16,6 @@ case $1 in mono "@ABS_INSTALL_DIR@/SparkleShare.exe" help ;; *) - mono "@ABS_INSTALL_DIR@/SparkleShare.exe" $2 + mono "@ABS_INSTALL_DIR@/SparkleShare.exe" $1 ;; esac diff --git a/Sparkles/InstallationInfo.cs b/Sparkles/InstallationInfo.cs index 8e538ccf..c3b47bc1 100644 --- a/Sparkles/InstallationInfo.cs +++ b/Sparkles/InstallationInfo.cs @@ -55,7 +55,7 @@ namespace Sparkles { operating_system = OS.Ubuntu; } else { - operating_system = OS.Ubuntu; + operating_system = OS.GNOME; } return operating_system;