linux: Add options to toggle statusicon type

This commit is contained in:
Hylke Bons 2018-03-17 22:45:38 +00:00
parent 1cf3d6a9f9
commit 5f6153e8b3
5 changed files with 24 additions and 6 deletions

View file

@ -175,4 +175,4 @@
</ItemGroup>
<Import Project="..\Common\SparkleShare.projitems" Label="Shared" Condition="Exists('..\Common\SparkleShare.projitems')" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
</Project>

View file

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

View file

@ -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];

View file

@ -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

View file

@ -55,7 +55,7 @@ namespace Sparkles {
operating_system = OS.Ubuntu;
} else {
operating_system = OS.Ubuntu;
operating_system = OS.GNOME;
}
return operating_system;