don't increment dup_count when progess differs

work around the fact that notify-send doesn't expose the replaces-id.
This commit is contained in:
Sascha Kruse 2013-07-16 13:20:30 +02:00
parent 5cd2b26d0f
commit 0ccd06faf3

View File

@ -321,7 +321,14 @@ int notification_init(notification * n, int id)
if (strcmp(orig->appname, n->appname) == 0 if (strcmp(orig->appname, n->appname) == 0
&& strcmp(orig->summary, n->summary) == 0 && strcmp(orig->summary, n->summary) == 0
&& strcmp(orig->body, n->body) == 0) { && strcmp(orig->body, n->body) == 0) {
orig->dup_count++; /* If the progress differs this was probably intended to replace the notification
* but notify-send was used. So don't increment dup_count in this case
*/
if (orig->progress == n->progress) {
orig->dup_count++;
} else {
orig->progress = n->progress;
}
/* notifications that differ only in progress hints should be expected equal, /* notifications that differ only in progress hints should be expected equal,
* but we want the latest message, with the latest hint value * but we want the latest message, with the latest hint value
*/ */
@ -344,7 +351,14 @@ int notification_init(notification * n, int id)
*/ */
free(orig->msg); free(orig->msg);
orig->msg = strdup(n->msg); orig->msg = strdup(n->msg);
orig->dup_count++; /* If the progress differs this was probably intended to replace the notification
* but notify-send was used. So don't increment dup_count in this case
*/
if (orig->progress == n->progress) {
orig->dup_count++;
} else {
orig->progress = n->progress;
}
orig->start = time(NULL); orig->start = time(NULL);
notification_free(n); notification_free(n);
wake_up(); wake_up();