aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-07-27 10:51:54 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-07-27 10:51:54 -0500
commit7271b2139a5c600a2c3cdb4e552e05ddb0f374dd (patch)
tree4e537b6864292c42a846ebfccee76bd04de309ba
parent31d63005e2937f7712a515f56645fe3c34628ca8 (diff)
downloadayatana-indicator-datetime-7271b2139a5c600a2c3cdb4e552e05ddb0f374dd.tar.gz
ayatana-indicator-datetime-7271b2139a5c600a2c3cdb4e552e05ddb0f374dd.tar.bz2
ayatana-indicator-datetime-7271b2139a5c600a2c3cdb4e552e05ddb0f374dd.zip
make close return void instead of bool, because after all what more can you do if the call fails? What's the point?
-rw-r--r--include/notifications/notifications.h4
-rw-r--r--src/notifications.cpp26
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&