From 485e12b8aeeb0952925af23507fd943c81cecc29 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 10 Oct 2013 13:06:16 +0200 Subject: [PATCH] linux statusicon: Simplify status icon allocation Conflicts: SparkleShare/Linux/SparkleStatusIcon.cs --- SparkleShare/Linux/SparkleStatusIcon.cs | 61 ++++++++----------------- 1 file changed, 18 insertions(+), 43 deletions(-) diff --git a/SparkleShare/Linux/SparkleStatusIcon.cs b/SparkleShare/Linux/SparkleStatusIcon.cs index 0349c355..327c8e0b 100644 --- a/SparkleShare/Linux/SparkleStatusIcon.cs +++ b/SparkleShare/Linux/SparkleStatusIcon.cs @@ -58,53 +58,28 @@ namespace SparkleShare { Controller.UpdateIconEvent += delegate (IconState state) { Application.Invoke (delegate { - switch (state) { - case IconState.Idle: { - #if HAVE_APP_INDICATOR - this.indicator.IconName = "process-syncing-idle"; - #else - this.status_icon.IconName = "sparkleshare"; - #endif - break; - } - case IconState.SyncingUp: { - #if HAVE_APP_INDICATOR - this.indicator.IconName = "process-syncing-up"; - #else - this.status_icon.IconName = "process-syncing-up"; - #endif - break; - } - case IconState.SyncingDown: { - #if HAVE_APP_INDICATOR - this.indicator.IconName = "process-syncing-down"; - #else - this.status_icon.IconName = "process-syncing-down"; - #endif - break; - } - case IconState.Syncing: { - #if HAVE_APP_INDICATOR - this.indicator.IconName = "process-syncing"; - #else - this.status_icon.IconName = "process-syncing"; - #endif - break; - } - case IconState.Error: { - #if HAVE_APP_INDICATOR - this.indicator.IconName = "process-syncing-error"; - #else - this.status_icon.IconName = "process-syncing-error"; - #endif - break; - } - } + #if HAVE_APP_INDICATOR + string icon_name = "process-syncing-idle"; + #else + string icon_name = "sparkleshare"; + #endif + + if (state == IconState.SyncingUp) + icon_name = "process-syncing-up"; + else if (state == IconState.SyncingDown) + icon_name = "process-syncing-down"; + else if (state == IconState.Syncing) + icon_name = "process-syncing"; + else if (state == IconState.Error) + icon_name = "process-syncing-error"; #if HAVE_APP_INDICATOR - // Force update of the status icon + this.indicator.IconName = icon_name; + this.indicator.Status = Status.Attention; this.indicator.Status = Status.Active; + #else + this.status_icon.IconName = icon_name #endif }); };