aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Garcia Mena <xavi.garcia.mena@canonical.com>2015-10-02 12:46:54 +0200
committerXavi Garcia Mena <xavi.garcia.mena@canonical.com>2015-10-02 12:46:54 +0200
commite49548a7edb0d4d8a3420cc6c0be2b0e15f57bcf (patch)
tree08bc33da54c341d65a73700d977b2f3ab5e8b895
parent33a73fad65c52fc324ad3d35a6d1305a1489958d (diff)
downloadayatana-indicator-sound-e49548a7edb0d4d8a3420cc6c0be2b0e15f57bcf.tar.gz
ayatana-indicator-sound-e49548a7edb0d4d8a3420cc6c0be2b0e15f57bcf.tar.bz2
ayatana-indicator-sound-e49548a7edb0d4d8a3420cc6c0be2b0e15f57bcf.zip
Updated to show a label stating the active output
-rw-r--r--src/service.vala16
-rw-r--r--tests/notifications-test.cc2
2 files changed, 16 insertions, 2 deletions
diff --git a/src/service.vala b/src/service.vala
index a1850d0..15fd97e 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -411,9 +411,23 @@ public class IndicatorSound.Service: Object {
if (notify_server_supports_sync && !block_info_notifications) {
/* Determine Label */
- unowned string volume_label = loud
+ string volume_label = loud
? _("High volume can damage your hearing.")
: "";
+
+ if (volume_label == "") {
+ if (volume_control.active_output == VolumeControl.ActiveOutput.SPEAKERS) {
+ volume_label = _("Speakers");
+ }
+
+ if (volume_control.active_output == VolumeControl.ActiveOutput.HEADPHONES) {
+ volume_label = _("Headphones");
+ }
+
+ if (volume_control.active_output == VolumeControl.ActiveOutput.BLUETOOTH_HEADPHONES) {
+ volume_label = _("Bluetooth");
+ }
+ }
/* Choose an icon */
string icon = get_volume_notification_icon (volume_control.volume.volume, loud, volume_control.active_output);
diff --git a/tests/notifications-test.cc b/tests/notifications-test.cc
index 8d5617d..a096bb8 100644
--- a/tests/notifications-test.cc
+++ b/tests/notifications-test.cc
@@ -345,7 +345,7 @@ TEST_F(NotificationsTest, HighVolume) {
auto notev = notifications->getNotifications();
ASSERT_EQ(1, notev.size());
EXPECT_EQ("Volume", notev[0].summary);
- EXPECT_EQ("", notev[0].body);
+ EXPECT_EQ("Speakers", notev[0].body);
EXPECT_GVARIANT_EQ("@s 'false'", notev[0].hints["x-canonical-value-bar-tint"]);
/* Set high volume with volume change */