Merge pull request #453 from tsipinakis/fix-emiting-signal-on-redisplayed

Don't emit NotificationClosed signal on redisplayed notifications
This commit is contained in:
Nikos Tsipinakis 2017-12-10 16:00:11 +02:00 committed by GitHub
commit e51ac67715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 11 deletions

View File

@ -298,7 +298,7 @@ static void on_notify(GDBusConnection *connection,
// The message got discarded
if (id == 0) {
notification_closed(n, 2);
signal_notification_closed(n, 2);
notification_free(n);
}
@ -331,7 +331,7 @@ static void on_get_server_information(GDBusConnection *connection,
g_dbus_connection_flush(connection, NULL, NULL, NULL);
}
void notification_closed(notification *n, enum reason reason)
void signal_notification_closed(notification *n, enum reason reason)
{
if (reason < REASON_MIN || REASON_MAX < reason) {
fprintf(stderr, "ERROR: Closing notification with reason '%d' not supported. "
@ -362,7 +362,7 @@ void notification_closed(notification *n, enum reason reason)
}
void action_invoked(notification *n, const char *identifier)
void signal_action_invoked(notification *n, const char *identifier)
{
GVariant *body = g_variant_new("(us)", n->id, identifier);
GError *err = NULL;

View File

@ -17,8 +17,8 @@ enum reason {
int initdbus(void);
void dbus_tear_down(int id);
/* void dbus_poll(int timeout); */
void notification_closed(notification *n, enum reason reason);
void action_invoked(notification *n, const char *identifier);
void signal_notification_closed(notification *n, enum reason reason);
void signal_action_invoked(notification *n, const char *identifier);
#endif
/* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */

View File

@ -157,7 +157,7 @@ void invoke_action(const char *action)
}
if (invoked && action_identifier) {
action_invoked(invoked, action_identifier);
signal_action_invoked(invoked, action_identifier);
}
}

View File

@ -558,12 +558,12 @@ void notification_do_action(notification *n)
{
if (n->actions) {
if (n->actions->count == 2) {
action_invoked(n, n->actions->actions[0]);
signal_action_invoked(n, n->actions->actions[0]);
return;
}
for (int i = 0; i < n->actions->count; i += 2) {
if (strcmp(n->actions->actions[i], "default") == 0) {
action_invoked(n, n->actions->actions[i]);
signal_action_invoked(n, n->actions->actions[i]);
return;
}
}

View File

@ -115,7 +115,7 @@ static bool queues_stack_duplicate(notification *n)
n->dup_count = orig->dup_count;
notification_closed(orig, 1);
signal_notification_closed(orig, 1);
notification_free(orig);
return true;
@ -138,7 +138,7 @@ static bool queues_stack_duplicate(notification *n)
n->dup_count = orig->dup_count;
notification_closed(orig, 1);
signal_notification_closed(orig, 1);
notification_free(orig);
return true;
@ -205,7 +205,9 @@ int queues_notification_close_id(int id, enum reason reason)
}
if (target) {
notification_closed(target, reason);
//Don't notify clients if notification was pulled from history
if (!target->redisplayed)
signal_notification_closed(target, reason);
queues_history_push(target);
}