diff options
author | Ratchanan Srirattanamet <ratchanan@ubports.com> | 2023-12-21 19:16:35 +0700 |
---|---|---|
committer | Ratchanan Srirattanamet <ratchanan@ubports.com> | 2023-12-26 20:35:22 +0000 |
commit | 30b2de458752ad0855b508eb2f8ffeee85628cea (patch) | |
tree | f365be20c8095738d4f3aff8b2acdcb22c00c9c1 /src/notifications.cpp | |
parent | 6f1c3f7f25052c1f4c001e30bc8368359531af87 (diff) | |
download | ayatana-indicator-datetime-30b2de458752ad0855b508eb2f8ffeee85628cea.tar.gz ayatana-indicator-datetime-30b2de458752ad0855b508eb2f8ffeee85628cea.tar.bz2 ayatana-indicator-datetime-30b2de458752ad0855b508eb2f8ffeee85628cea.zip |
src, tests: enable notification code path without Lomiri depspersonal/peat-psuwit/bring-back-lomiri-hints
With the recent change, the notification code path is no longer Lomiri
(or Ubuntu Touch) specific.
Theres still some if-def's in the code to avoid adding dependendies in
non-Lomiri case.
Diffstat (limited to 'src/notifications.cpp')
-rw-r--r-- | src/notifications.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/notifications.cpp b/src/notifications.cpp index a2a1fc3..4049851 100644 --- a/src/notifications.cpp +++ b/src/notifications.cpp @@ -199,6 +199,13 @@ public: return server_caps().count("actions") != 0; } +#ifdef LOMIRI_FEATURES_ENABLED + bool requires_hint_lomiri_timeout() const + { + return server_caps().count(HINT_LOMIRI_TIMEOUT) != 0; + } +#endif + void close_all () { // call close() on all our keys @@ -249,10 +256,14 @@ public: const auto& d= info.m_duration; auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(d); notify_notification_set_timeout (nn.get (), ms.count ()); - // Lomiri has its own logic regarding timeout. - notify_notification_set_hint (nn.get(), - HINT_LOMIRI_TIMEOUT, - g_variant_new_int32(ms.count())); +#ifdef LOMIRI_FEATURES_ENABLED + if (requires_hint_lomiri_timeout()) { + // Lomiri has its own logic regarding timeout. + notify_notification_set_hint (nn.get(), + HINT_LOMIRI_TIMEOUT, + g_variant_new_int32(ms.count())); + } +#endif } for (const auto& hint : info.m_string_hints) @@ -514,7 +525,9 @@ private: // as the name indicates, don't use this directly: use server_caps() instead mutable std::set<std::string> m_lazy_caps; +#ifdef LOMIRI_FEATURES_ENABLED static constexpr char const * HINT_LOMIRI_TIMEOUT {"x-lomiri-snap-decisions-timeout"}; +#endif }; /*** |