Notification comparison done right
This commit is contained in:
parent
e4b0aae05a
commit
e091dd4d15
@ -150,17 +150,11 @@ const char *notification_urgency_to_string(enum urgency urgency)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper function to compare to given
|
* Helper function to compare two given
|
||||||
* notifications.
|
* notifications.
|
||||||
*/
|
*/
|
||||||
int notification_cmp(const void *va, const void *vb)
|
int notification_cmp(const notification *a, const notification *b)
|
||||||
{
|
{
|
||||||
notification *a = (notification *) va;
|
|
||||||
notification *b = (notification *) vb;
|
|
||||||
|
|
||||||
if (!settings.sort)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (a->urgency != b->urgency) {
|
if (a->urgency != b->urgency) {
|
||||||
return b->urgency - a->urgency;
|
return b->urgency - a->urgency;
|
||||||
} else {
|
} else {
|
||||||
@ -174,7 +168,13 @@ int notification_cmp(const void *va, const void *vb)
|
|||||||
*/
|
*/
|
||||||
int notification_cmp_data(const void *va, const void *vb, void *data)
|
int notification_cmp_data(const void *va, const void *vb, void *data)
|
||||||
{
|
{
|
||||||
return notification_cmp(va, vb);
|
notification *a = (notification *) va;
|
||||||
|
notification *b = (notification *) vb;
|
||||||
|
|
||||||
|
if (!settings.sort)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return notification_cmp(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
int notification_is_duplicate(const notification *a, const notification *b)
|
int notification_is_duplicate(const notification *a, const notification *b)
|
||||||
|
@ -89,8 +89,8 @@ void notification_init(notification *n);
|
|||||||
void actions_free(Actions *a);
|
void actions_free(Actions *a);
|
||||||
void rawimage_free(RawImage *i);
|
void rawimage_free(RawImage *i);
|
||||||
void notification_free(notification *n);
|
void notification_free(notification *n);
|
||||||
int notification_cmp(const void *a, const void *b);
|
int notification_cmp(const notification *a, const notification *b);
|
||||||
int notification_cmp_data(const void *a, const void *b, void *data);
|
int notification_cmp_data(const void *va, const void *vb, void *data);
|
||||||
int notification_is_duplicate(const notification *a, const notification *b);
|
int notification_is_duplicate(const notification *a, const notification *b);
|
||||||
void notification_run_script(notification *n);
|
void notification_run_script(notification *n);
|
||||||
void notification_print(notification *n);
|
void notification_print(notification *n);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user