linux statusicon: Simplify status icon allocation
This commit is contained in:
parent
15179608cc
commit
d4a39b5a89
|
@ -58,53 +58,29 @@ namespace SparkleShare {
|
||||||
|
|
||||||
Controller.UpdateIconEvent += delegate (IconState state) {
|
Controller.UpdateIconEvent += delegate (IconState state) {
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate {
|
||||||
switch (state) {
|
|
||||||
case IconState.Idle: {
|
|
||||||
#if HAVE_APP_INDICATOR
|
#if HAVE_APP_INDICATOR
|
||||||
this.indicator.IconName = "process-syncing-idle";
|
string icon_name = "process-syncing-idle";
|
||||||
#else
|
#else
|
||||||
this.status_icon.IconName = "sparkleshare";
|
string icon_name = "sparkleshare";
|
||||||
#endif
|
#endif
|
||||||
break;
|
|
||||||
}
|
if (state == IconState.SyncingUp)
|
||||||
case IconState.SyncingUp: {
|
icon_name = "process-syncing-up";
|
||||||
#if HAVE_APP_INDICATOR
|
else if (state == IconState.SyncingDown)
|
||||||
this.indicator.IconName = "process-syncing-up";
|
icon_name = "process-syncing-down";
|
||||||
#else
|
else if (state == IconState.Syncing)
|
||||||
this.status_icon.IconName = "process-syncing-up";
|
icon_name = "process-syncing";
|
||||||
#endif
|
else if (state == IconState.Error)
|
||||||
break;
|
icon_name = "process-syncing-error";
|
||||||
}
|
|
||||||
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
|
#if HAVE_APP_INDICATOR
|
||||||
|
this.indicator.IconName = icon_name;
|
||||||
|
|
||||||
// Force update of the status icon
|
// Force update of the status icon
|
||||||
this.indicator.Status = (int) IndicatorStatus.Attention;
|
this.indicator.Status = (int) IndicatorStatus.Attention;
|
||||||
this.indicator.Status = (int) IndicatorStatus.Active;
|
this.indicator.Status = (int) IndicatorStatus.Active;
|
||||||
|
#else
|
||||||
|
this.status_icon.IconName = icon_name
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue