From 7271b2139a5c600a2c3cdb4e552e05ddb0f374dd Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 27 Jul 2014 10:51:54 -0500 Subject: make close return void instead of bool, because after all what more can you do if the call fails? What's the point? --- include/notifications/notifications.h | 4 ++-- src/notifications.cpp | 26 ++++++++------------------ 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/include/notifications/notifications.h b/include/notifications/notifications.h index b4c88b4..43442d3 100644 --- a/include/notifications/notifications.h +++ b/include/notifications/notifications.h @@ -96,11 +96,11 @@ public: /** Close a notification. @param key the int returned by show() @return true if the notification was closed. */ - bool close(int key); + void close(int key); /** Close all remaining notifications. *@return true if all closed successfully. */ - bool close_all(); + void close_all(); const std::string& app_name() const; diff --git a/src/notifications.cpp b/src/notifications.cpp index 486a910..6d993df 100644 --- a/src/notifications.cpp +++ b/src/notifications.cpp @@ -154,42 +154,32 @@ public: return m_caps.count("actions") != 0; } - bool close_all () + void close_all () { - bool all_closed = true; - // close() removes the item from m_notifications, // so increment the iterator before it gets invalidated for (auto it=m_notifications.begin(), e=m_notifications.end(); it!=e; ) { const int key = it->first; ++it; - if (!close (key)) - all_closed = false; + close (key); } - - return all_closed; } - bool close (int key) + void close (int key) { - bool is_closed = true; - // if we've got this one... auto it = m_notifications.find(key); if (it != m_notifications.end()) { GError * error = nullptr; - is_closed = notify_notification_close (it->second.nn.get(), &error); - if (!is_closed) + if (!notify_notification_close (it->second.nn.get(), &error)) { g_warning ("Unable to close notification %d: %s", key, error->message); g_error_free (error); } on_closed (key); } - - return is_closed; } int show (const Builder& builder) @@ -339,16 +329,16 @@ Engine::show(const Builder& builder) return impl->show(builder); } -bool +void Engine::close_all() { - return impl->close_all(); + impl->close_all(); } -bool +void Engine::close(int key) { - return impl->close(key); + impl->close(key); } const std::string& -- cgit v1.2.3