diff options
author | Robert Tari <robert@tari.in> | 2023-09-09 12:37:35 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2023-09-09 12:37:35 +0200 |
commit | 0a88a8d7aee8d8ee253de43f031c0811d8015a3a (patch) | |
tree | 027e6599a1d9ee0984753fb6325b496433bb81e8 | |
parent | 36d648b28cbc731e333406d934e95b188341c445 (diff) | |
download | ayatana-indicator-datetime-0a88a8d7aee8d8ee253de43f031c0811d8015a3a.tar.gz ayatana-indicator-datetime-0a88a8d7aee8d8ee253de43f031c0811d8015a3a.tar.bz2 ayatana-indicator-datetime-0a88a8d7aee8d8ee253de43f031c0811d8015a3a.zip |
Remove osd-notify remnants and use native notification timeout
-rw-r--r-- | src/notifications.cpp | 9 | ||||
-rw-r--r-- | tests/notification-fixture.h | 8 | ||||
-rw-r--r-- | tests/test-sound.cpp | 12 |
3 files changed, 10 insertions, 19 deletions
diff --git a/src/notifications.cpp b/src/notifications.cpp index bb0e05c..b962e68 100644 --- a/src/notifications.cpp +++ b/src/notifications.cpp @@ -1,6 +1,6 @@ /* * Copyright 2014 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 @@ -248,10 +248,7 @@ public: { const auto& d= info.m_duration; auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(d); - - notify_notification_set_hint (nn.get(), - HINT_TIMEOUT, - g_variant_new_int32(ms.count())); + notify_notification_set_timeout (nn.get (), ms.count ()); } for (const auto& hint : info.m_string_hints) @@ -512,8 +509,6 @@ private: // server capabilities. // as the name indicates, don't use this directly: use server_caps() instead mutable std::set<std::string> m_lazy_caps; - - static constexpr char const * HINT_TIMEOUT {"x-lomiri-snap-decisions-timeout"}; }; /*** diff --git a/tests/notification-fixture.h b/tests/notification-fixture.h index 2349bab..33bcd7e 100644 --- a/tests/notification-fixture.h +++ b/tests/notification-fixture.h @@ -1,6 +1,6 @@ /* * Copyright 2014-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 version 3, as published @@ -77,8 +77,6 @@ protected: static constexpr char const * SIGNAL_CLOSED {"NotificationClosed"}; - static constexpr char const * HINT_TIMEOUT {"x-lomiri-snap-decisions-timeout"}; - static constexpr char const * AS_BUSNAME {"org.freedesktop.Accounts"}; static constexpr char const * AS_INTERFACE {"com.lomiri.touch.AccountsService.Sound"}; static constexpr char const * PROP_OTHER_VIBRATIONS {"OtherVibrate"}; @@ -315,8 +313,8 @@ protected: void make_interactive() { // GetCapabilities returns an array containing 'actions', - // so our snap decision will be interactive. - // For this test, it means we should get a timeout Notify Hint + // so our notifications will be interactive. + // For this test, it means we should get an expire_timeout // that matches duration_minutes GError * error = nullptr; dbus_test_dbus_mock_object_add_method(notify_mock, diff --git a/tests/test-sound.cpp b/tests/test-sound.cpp index f808db6..19dffe3 100644 --- a/tests/test-sound.cpp +++ b/tests/test-sound.cpp @@ -1,5 +1,6 @@ /* * Copyright 2014-2016 Canonical Ltd. + * Copyright 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 @@ -15,6 +16,7 @@ * * Authors: * Charles Kerr <charles.kerr@canonical.com> + * Robert Tari <robert@tari.in> */ #include <datetime/appointment.h> @@ -89,19 +91,15 @@ TEST_F(NotificationFixture, InteractiveDuration) g_variant_get_child (params, 0, "&s", &str); ASSERT_STREQ(APP_NAME, str); - // confirm that the icon passed to Notify was "alarm-clock" + // confirm that the icon passed to Notify was "calendar-app" g_variant_get_child (params, 2, "&s", &str); ASSERT_STREQ("calendar-app", str); - // confirm that the hints passed to Notify included a timeout matching duration_minutes + // confirm that the timeout passed to Notify matches duration_minutes int32_t i32; - bool b; - auto hints = g_variant_get_child_value (params, 6); - b = g_variant_lookup (hints, HINT_TIMEOUT, "i", &i32); - EXPECT_TRUE(b); + g_variant_get_child (params, 7, "i", &i32); const auto duration = std::chrono::minutes(duration_minutes); EXPECT_EQ(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count(), i32); - g_variant_unref(hints); ne.reset(); } |