diff --git a/src/dbus.c b/src/dbus.c index 8a603ac..5bb6210 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -384,6 +384,8 @@ void signal_notification_closed(struct notification *n, enum reason reason) body, &err); + notification_invalidate_actions(n); + n->dbus_valid = false; if (err) { diff --git a/src/notification.c b/src/notification.c index 6518b49..0689e48 100644 --- a/src/notification.c +++ b/src/notification.c @@ -598,4 +598,8 @@ void notification_do_action(const struct notification *n) } } +void notification_invalidate_actions(struct notification *n) { + g_hash_table_remove_all(n->actions); +} + /* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */ diff --git a/src/notification.h b/src/notification.h index d78d5f9..2ba76f0 100644 --- a/src/notification.h +++ b/src/notification.h @@ -191,6 +191,15 @@ void notification_update_text_to_render(struct notification *n); */ void notification_do_action(const struct notification *n); +/** + * Remove all client action data from the notification. + * + * This should be called after a notification is closed to avoid showing + * actions that will not work anymore since the client has stopped listening + * for them. + */ +void notification_invalidate_actions(struct notification *n); + const char *notification_urgency_to_string(const enum urgency urgency); /**