aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Garcia Mena <xavi.garcia.mena@canonical.com>2015-10-05 14:20:14 +0200
committerXavi Garcia Mena <xavi.garcia.mena@canonical.com>2015-10-05 14:20:14 +0200
commitd3802b66c55e50ff1b9e2103cd446cb586d8acb3 (patch)
tree69361d7e02579f782b0ceb764faa1e5498f94845
parent24ab28edf43e3ec188d110d08c810567539d8eb4 (diff)
downloadayatana-indicator-sound-d3802b66c55e50ff1b9e2103cd446cb586d8acb3.tar.gz
ayatana-indicator-sound-d3802b66c55e50ff1b9e2103cd446cb586d8acb3.tar.bz2
ayatana-indicator-sound-d3802b66c55e50ff1b9e2103cd446cb586d8acb3.zip
fixed panel root panel icons
-rw-r--r--src/service.vala105
1 files changed, 97 insertions, 8 deletions
diff --git a/src/service.vala b/src/service.vala
index e3e91f5..8b08dc0 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -367,6 +367,95 @@ public class IndicatorSound.Service: Object {
return icon;
}
+ private string get_volume_root_icon_by_volume (double volume, VolumeControl.ActiveOutput active_output)
+ {
+ string icon = "";
+ switch (active_output)
+ {
+ case VolumeControl.ActiveOutput.SPEAKERS:
+ if (volume <= 0.0)
+ icon = "audio-volume-muted-panel";
+ else if (volume <= 0.3)
+ icon = "audio-volume-low-panel";
+ else if (volume <= 0.7)
+ icon = "audio-volume-medium-panel";
+ else
+ icon = "audio-volume-high-panel";
+ break;
+ case VolumeControl.ActiveOutput.HEADPHONES:
+ if (volume <= 0.0)
+ icon = "audio-volume-muted-panel";
+ else if (volume <= 0.3)
+ icon = "audio-volume-low-panel";
+ else if (volume <= 0.7)
+ icon = "audio-volume-medium-panel";
+ else
+ icon = "audio-volume-high-panel";
+ break;
+ case VolumeControl.ActiveOutput.BLUETOOTH_HEADPHONES:
+ if (volume <= 0.0)
+ icon = "audio-volume-muted-panel";
+ else if (volume <= 0.3)
+ icon = "audio-volume-low-panel";
+ else if (volume <= 0.7)
+ icon = "audio-volume-medium-panel";
+ else
+ icon = "audio-volume-high-panel";
+ break;
+ case VolumeControl.ActiveOutput.BLUETOOTH_SPEAKER:
+ if (volume <= 0.0)
+ icon = "audio-volume-muted-panel";
+ else if (volume <= 0.3)
+ icon = "audio-volume-low-panel";
+ else if (volume <= 0.7)
+ icon = "audio-volume-medium-panel";
+ else
+ icon = "audio-volume-high-panel";
+ break;
+ case VolumeControl.ActiveOutput.USB_SPEAKER:
+ if (volume <= 0.0)
+ icon = "audio-volume-muted-panel";
+ else if (volume <= 0.3)
+ icon = "audio-volume-low-panel";
+ else if (volume <= 0.7)
+ icon = "audio-volume-medium-panel";
+ else
+ icon = "audio-volume-high-panel";
+ break;
+ case VolumeControl.ActiveOutput.USB_HEADPHONES:
+ if (volume <= 0.0)
+ icon = "audio-volume-muted-panel";
+ else if (volume <= 0.3)
+ icon = "audio-volume-low-panel";
+ else if (volume <= 0.7)
+ icon = "audio-volume-medium-panel";
+ else
+ icon = "audio-volume-high-panel";
+ break;
+ case VolumeControl.ActiveOutput.HDMI_SPEAKER:
+ if (volume <= 0.0)
+ icon = "audio-volume-muted-panel";
+ else if (volume <= 0.3)
+ icon = "audio-volume-low-panel";
+ else if (volume <= 0.7)
+ icon = "audio-volume-medium-panel";
+ else
+ icon = "audio-volume-high-panel";
+ break;
+ case VolumeControl.ActiveOutput.HDMI_HEADPHONES:
+ if (volume <= 0.0)
+ icon = "audio-volume-muted-panel";
+ else if (volume <= 0.3)
+ icon = "audio-volume-low-panel";
+ else if (volume <= 0.7)
+ icon = "audio-volume-medium-panel";
+ else
+ icon = "audio-volume-high-panel";
+ break;
+ }
+ return icon;
+ }
+
private string get_volume_notification_icon (double volume, bool loud, VolumeControl.ActiveOutput active_output) {
string icon = "";
if (loud) {
@@ -413,7 +502,7 @@ public class IndicatorSound.Service: Object {
else if (this.accounts_service != null && this.accounts_service.silentMode)
icon = "audio-volume-muted-panel";
else
- icon = get_volume_icon (volume, active_output);
+ icon = get_volume_root_icon_by_volume (volume, active_output);
break;
case VolumeControl.ActiveOutput.HEADPHONES:
if (mute || volume <= 0.0)
@@ -421,7 +510,7 @@ public class IndicatorSound.Service: Object {
else if (this.accounts_service != null && this.accounts_service.silentMode)
icon = "audio-volume-muted-panel";
else
- icon = get_volume_icon (volume, active_output);
+ icon = get_volume_root_icon_by_volume (volume, active_output);
break;
case VolumeControl.ActiveOutput.BLUETOOTH_HEADPHONES:
if (mute || volume <= 0.0)
@@ -429,7 +518,7 @@ public class IndicatorSound.Service: Object {
else if (this.accounts_service != null && this.accounts_service.silentMode)
icon = "audio-volume-muted-panel";
else
- icon = get_volume_icon (volume, active_output);
+ icon = get_volume_root_icon_by_volume (volume, active_output);
break;
case VolumeControl.ActiveOutput.BLUETOOTH_SPEAKER:
if (mute || volume <= 0.0)
@@ -437,7 +526,7 @@ public class IndicatorSound.Service: Object {
else if (this.accounts_service != null && this.accounts_service.silentMode)
icon = "audio-volume-muted-panel";
else
- icon = get_volume_icon (volume, active_output);
+ icon = get_volume_root_icon_by_volume (volume, active_output);
break;
case VolumeControl.ActiveOutput.USB_SPEAKER:
if (mute || volume <= 0.0)
@@ -445,7 +534,7 @@ public class IndicatorSound.Service: Object {
else if (this.accounts_service != null && this.accounts_service.silentMode)
icon = "audio-volume-muted-panel";
else
- icon = get_volume_icon (volume, active_output);
+ icon = get_volume_root_icon_by_volume (volume, active_output);
break;
case VolumeControl.ActiveOutput.USB_HEADPHONES:
if (mute || volume <= 0.0)
@@ -453,7 +542,7 @@ public class IndicatorSound.Service: Object {
else if (this.accounts_service != null && this.accounts_service.silentMode)
icon = "audio-volume-muted-panel";
else
- icon = get_volume_icon (volume, active_output);
+ icon = get_volume_root_icon_by_volume (volume, active_output);
break;
case VolumeControl.ActiveOutput.HDMI_SPEAKER:
if (mute || volume <= 0.0)
@@ -461,7 +550,7 @@ public class IndicatorSound.Service: Object {
else if (this.accounts_service != null && this.accounts_service.silentMode)
icon = "audio-volume-muted-panel";
else
- icon = get_volume_icon (volume, active_output);
+ icon = get_volume_root_icon_by_volume (volume, active_output);
break;
case VolumeControl.ActiveOutput.HDMI_HEADPHONES:
if (mute || volume <= 0.0)
@@ -469,7 +558,7 @@ public class IndicatorSound.Service: Object {
else if (this.accounts_service != null && this.accounts_service.silentMode)
icon = "audio-volume-muted-panel";
else
- icon = get_volume_icon (volume, active_output);
+ icon = get_volume_root_icon_by_volume (volume, active_output);
break;
}
return icon;