diff options
author | charles kerr <charlesk@canonical.com> | 2015-12-31 11:21:45 -0600 |
---|---|---|
committer | charles kerr <charlesk@canonical.com> | 2015-12-31 11:21:45 -0600 |
commit | f5c0754ba2b3ebb2f9b4908ecd7b1d0a9ee127fb (patch) | |
tree | 0f21fac2a505dc36b5f2fa0f9868bcc1f8084bb5 /src | |
parent | fe7c32942f923e56dfc757f6666151ddcb694f43 (diff) | |
download | ayatana-indicator-sound-f5c0754ba2b3ebb2f9b4908ecd7b1d0a9ee127fb.tar.gz ayatana-indicator-sound-f5c0754ba2b3ebb2f9b4908ecd7b1d0a9ee127fb.tar.bz2 ayatana-indicator-sound-f5c0754ba2b3ebb2f9b4908ecd7b1d0a9ee127fb.zip |
in info-warning's icon picking code, fold redundant cases into one.
It looks like these switch statements are intended for future expansion,
so leaving the basic switching logic intact
Diffstat (limited to 'src')
-rw-r--r-- | src/info-notification.vala | 78 |
1 files changed, 1 insertions, 77 deletions
diff --git a/src/info-notification.vala b/src/info-notification.vala index 76a5992..9088cb8 100644 --- a/src/info-notification.vala +++ b/src/info-notification.vala @@ -89,26 +89,12 @@ public class IndicatorSound.InfoNotification: Notification if (is_high_volume) { switch (active_output) { case VolumeControl.ActiveOutput.SPEAKERS: - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.HEADPHONES: - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.BLUETOOTH_HEADPHONES: - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.BLUETOOTH_SPEAKER: - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.USB_SPEAKER: - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.USB_HEADPHONES: - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.HDMI_SPEAKER: - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.HDMI_HEADPHONES: icon = "audio-volume-high"; break; @@ -127,75 +113,12 @@ public class IndicatorSound.InfoNotification: Notification switch (active_output) { case VolumeControl.ActiveOutput.SPEAKERS: - if (volume <= 0.0) - icon = "audio-volume-muted"; - else if (volume <= 0.3) - icon = "audio-volume-low"; - else if (volume <= 0.7) - icon = "audio-volume-medium"; - else - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.HEADPHONES: - if (volume <= 0.0) - icon = "audio-volume-muted"; - else if (volume <= 0.3) - icon = "audio-volume-low"; - else if (volume <= 0.7) - icon = "audio-volume-medium"; - else - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.BLUETOOTH_HEADPHONES: - if (volume <= 0.0) - icon = "audio-volume-muted"; - else if (volume <= 0.3) - icon = "audio-volume-low"; - else if (volume <= 0.7) - icon = "audio-volume-medium"; - else - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.BLUETOOTH_SPEAKER: - if (volume <= 0.0) - icon = "audio-volume-muted"; - else if (volume <= 0.3) - icon = "audio-volume-low"; - else if (volume <= 0.7) - icon = "audio-volume-medium"; - else - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.USB_SPEAKER: - if (volume <= 0.0) - icon = "audio-volume-muted"; - else if (volume <= 0.3) - icon = "audio-volume-low"; - else if (volume <= 0.7) - icon = "audio-volume-medium"; - else - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.USB_HEADPHONES: - if (volume <= 0.0) - icon = "audio-volume-muted"; - else if (volume <= 0.3) - icon = "audio-volume-low"; - else if (volume <= 0.7) - icon = "audio-volume-medium"; - else - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.HDMI_SPEAKER: - if (volume <= 0.0) - icon = "audio-volume-muted"; - else if (volume <= 0.3) - icon = "audio-volume-low"; - else if (volume <= 0.7) - icon = "audio-volume-medium"; - else - icon = "audio-volume-high"; - break; case VolumeControl.ActiveOutput.HDMI_HEADPHONES: if (volume <= 0.0) icon = "audio-volume-muted"; @@ -207,6 +130,7 @@ public class IndicatorSound.InfoNotification: Notification icon = "audio-volume-high"; break; } + return icon; } } |