aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--src/info-notification.vala18
-rw-r--r--src/warn-notification.vala5
-rw-r--r--tests/integration/indicator-sound-test-base.cpp10
-rw-r--r--tests/notifications-mock.h4
-rw-r--r--tests/notifications-test.cc11
6 files changed, 20 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ef2cf6..f2c6503 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
-project(ayatana-indicator-sound C CXX)
-cmake_minimum_required(VERSION 3.13)
+cmake_minimum_required (VERSION 3.13)
+project (ayatana-indicator-sound VERSION 22.9.2 LANGUAGES C CXX)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
@@ -7,8 +7,6 @@ endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
-set(PACKAGE ${CMAKE_PROJECT_NAME})
-set(PROJECT_VERSION 22.9.2)
find_package(PkgConfig REQUIRED)
include(GNUInstallDirs)
include(UseVala)
diff --git a/src/info-notification.vala b/src/info-notification.vala
index bd43a91..4379acf 100644
--- a/src/info-notification.vala
+++ b/src/info-notification.vala
@@ -1,6 +1,6 @@
/*
* Copyright 2015 Canonical Ltd.
- * Copyright 2021 Robert Tari
+ * Copyright 2021-2023 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,22 +30,26 @@ public class IndicatorSound.InfoNotification: Notification
public void show (VolumeControl.ActiveOutput active_output,
double volume,
bool is_high_volume) {
- if (!notify_server_supports ("x-lomiri-private-synchronous"))
- return;
/* Determine Label */
- unowned string volume_label = get_notification_label (active_output);
+ string volume_label = get_notification_label (active_output);
/* Choose an icon */
unowned string icon = get_volume_notification_icon (active_output, volume, is_high_volume);
/* Reset the notification */
var n = _notification;
+
+ uint nChars = ((int32)((volume * 20) + 0.5)).clamp(0, 20);
+ volume_label += "\n";
+
+ for (uint nChar = 0; nChar < nChars; nChar++)
+ {
+ volume_label += "◼";
+ }
+
n.update (_("Volume"), volume_label, icon);
n.clear_hints();
- n.set_hint ("x-lomiri-non-shaped-icon", "true");
- n.set_hint ("x-lomiri-private-synchronous", "true");
- n.set_hint ("x-lomiri-value-bar-tint", is_high_volume ? "true" : "false");
n.set_hint ("value", ((int32)((volume * 100.0) + 0.5)).clamp(0, 100));
show_notification ();
}
diff --git a/src/warn-notification.vala b/src/warn-notification.vala
index 6a08431..203758e 100644
--- a/src/warn-notification.vala
+++ b/src/warn-notification.vala
@@ -1,5 +1,6 @@
/*
* Copyright 2015 Canonical Ltd.
+ * Copyright 2021-2023 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
public class IndicatorSound.WarnNotification: Notification
@@ -31,9 +33,6 @@ public class IndicatorSound.WarnNotification: Notification
_("Volume"),
_("Allow volume above safe level?\nHigh volume can damage your hearing."),
"audio-volume-high");
- n.set_hint ("x-lomiri-non-shaped-icon", "true");
- n.set_hint ("x-lomiri-snap-decisions", "true");
- n.set_hint ("x-lomiri-private-affirmative-tint", "true");
n.closed.connect ((n) => {
n.clear_actions ();
});
diff --git a/tests/integration/indicator-sound-test-base.cpp b/tests/integration/indicator-sound-test-base.cpp
index c201e27..eb4ee8c 100644
--- a/tests/integration/indicator-sound-test-base.cpp
+++ b/tests/integration/indicator-sound-test-base.cpp
@@ -1,6 +1,6 @@
/*
* Copyright 2015 Canonical Ltd.
- * Copyright 2021 Robert Tari
+ * Copyright 2021-2023 Robert Tari
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
@@ -72,7 +72,7 @@ void IndicatorSoundTestBase::SetUp()
"GetCapabilities",
"",
"as",
- "ret = ['actions', 'body', 'body-markup', 'icon-static', 'image/svg+xml', 'x-lomiri-private-synchronous', 'x-canonical-append', 'x-lomiri-private-icon-only', 'x-lomiri-truncation', 'x-canonical-truncation', 'private-synchronous', 'append', 'private-icon-only', 'truncation']"
+ "ret = ['actions', 'body', 'body-markup', 'icon-static', 'image/svg+xml', 'private-synchronous', 'append', 'private-icon-only', 'truncation']"
).waitForFinished();
int waitedTime = 0;
@@ -647,14 +647,8 @@ void IndicatorSoundTestBase::checkVolumeNotification(double volume, QString cons
QVariantMap hints;
ASSERT_TRUE(qDBusArgumentToMap(args.at(6), hints));
ASSERT_TRUE(hints.contains("value"));
- ASSERT_TRUE(hints.contains("x-lomiri-non-shaped-icon"));
- ASSERT_TRUE(hints.contains("x-lomiri-value-bar-tint"));
- ASSERT_TRUE(hints.contains("x-lomiri-private-synchronous"));
EXPECT_EQ(volume*100, hints["value"]);
- EXPECT_EQ(true, hints["x-lomiri-non-shaped-icon"]);
- EXPECT_EQ(isLoud, hints["x-lomiri-value-bar-tint"]);
- EXPECT_EQ(true, hints["x-lomiri-private-synchronous"]);
}
void IndicatorSoundTestBase::checkHighVolumeNotification(QVariantList call)
diff --git a/tests/notifications-mock.h b/tests/notifications-mock.h
index ad042d2..3ae8da5 100644
--- a/tests/notifications-mock.h
+++ b/tests/notifications-mock.h
@@ -1,6 +1,6 @@
/*
* Copyright 2015 Canonical Ltd.
- * Copyright 2021 Robert Tari
+ * Copyright 2021-2023 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ class NotificationsMock
DbusTestDbusMockObject * baseobj = nullptr;
public:
- NotificationsMock (const std::vector<std::string>& capabilities = {"actions", "body", "body-markup", "icon-static", "image/svg+xml", "x-lomiri-private-synchronous", "x-canonical-append", "x-lomiri-private-icon-only", "x-lomiri-truncation", "x-canonical-truncation", "private-synchronous", "append", "private-icon-only", "truncation"}) {
+ NotificationsMock (const std::vector<std::string>& capabilities = {"actions", "body", "body-markup", "icon-static", "image/svg+xml", "private-synchronous", "append", "private-icon-only", "truncation"}) {
mock = dbus_test_dbus_mock_new("org.freedesktop.Notifications");
dbus_test_task_set_bus(DBUS_TEST_TASK(mock), DBUS_TEST_SERVICE_BUS_SESSION);
dbus_test_task_set_name(DBUS_TEST_TASK(mock), "Notify");
diff --git a/tests/notifications-test.cc b/tests/notifications-test.cc
index 7f65104..0233ca6 100644
--- a/tests/notifications-test.cc
+++ b/tests/notifications-test.cc
@@ -1,6 +1,6 @@
/*
* Copyright 2015-2016 Canonical Ltd.
- * Copyright 2021 Robert Tari
+ * Copyright 2021-2023 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -259,7 +259,6 @@ TEST_F(NotificationsTest, VolumeChanges) {
EXPECT_EQ("ayatana-indicator-sound", notev[0].app_name);
EXPECT_EQ("Volume", notev[0].summary);
EXPECT_EQ(0, notev[0].actions.size());
- EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-lomiri-private-synchronous"]);
EXPECT_GVARIANT_EQ("@i 50", notev[0].hints["value"]);
/* Set a different volume */
@@ -432,7 +431,6 @@ TEST_F(NotificationsTest, DISABLED_HighVolume) {
ASSERT_EQ(1, notev.size());
EXPECT_EQ("Volume", notev[0].summary);
EXPECT_EQ("Speakers", notev[0].body);
- EXPECT_GVARIANT_EQ("@s 'false'", notev[0].hints["x-lomiri-value-bar-tint"]);
/* Set high volume with volume change */
notifications->clearNotifications();
@@ -443,7 +441,6 @@ TEST_F(NotificationsTest, DISABLED_HighVolume) {
ASSERT_LT(0, notev.size()); /* This passes with one or two since it would just be an update to the first if a second was sent */
EXPECT_EQ("Volume", notev[0].summary);
EXPECT_EQ("Speakers", notev[0].body);
- EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-lomiri-value-bar-tint"]);
/* Move it back */
volume_warning_mock_set_high_volume(VOLUME_WARNING_MOCK(volumeWarning.get()), false);
@@ -459,7 +456,6 @@ TEST_F(NotificationsTest, DISABLED_HighVolume) {
ASSERT_EQ(1, notev.size());
EXPECT_EQ("Volume", notev[0].summary);
EXPECT_EQ("Speakers", notev[0].body);
- EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-lomiri-value-bar-tint"]);
}
TEST_F(NotificationsTest, DISABLED_MenuHide) {
@@ -513,7 +509,6 @@ TEST_F(NotificationsTest, DISABLED_ExtendendVolumeNotification) {
EXPECT_EQ("ayatana-indicator-sound", notev[0].app_name);
EXPECT_EQ("Volume", notev[0].summary);
EXPECT_EQ(0, notev[0].actions.size());
- EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-lomiri-private-synchronous"]);
EXPECT_GVARIANT_EQ("@i 50", notev[0].hints["value"]);
/* Allow an amplified volume */
@@ -628,14 +623,10 @@ TEST_F(NotificationsTest, DISABLED_TriggerWarning) {
if (warning_expected) {
EXPECT_TRUE(volume_warning_get_active(volumeWarning.get()));
ASSERT_EQ(1, notev.size());
- EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-lomiri-snap-decisions"]);
- EXPECT_GVARIANT_EQ(nullptr, notev[0].hints["x-lomiri-private-synchronous"]);
}
else {
EXPECT_FALSE(volume_warning_get_active(volumeWarning.get()));
ASSERT_EQ(1, notev.size());
- EXPECT_GVARIANT_EQ(nullptr, notev[0].hints["x-lomiri-snap-decisions"]);
- EXPECT_GVARIANT_EQ("@s 'true'", notev[0].hints["x-lomiri-private-synchronous"]);
}
} // multimedia_active