Refactor notification_* functions to match queues namespace
This commit is contained in:
parent
12fa9d6ce1
commit
38e4bbb7bb
@ -282,7 +282,7 @@ static void on_close_notification(GDBusConnection *connection,
|
|||||||
{
|
{
|
||||||
guint32 id;
|
guint32 id;
|
||||||
g_variant_get(parameters, "(u)", &id);
|
g_variant_get(parameters, "(u)", &id);
|
||||||
notification_close_by_id(id, 3);
|
queues_notification_close_id(id, 3);
|
||||||
wake_up();
|
wake_up();
|
||||||
g_dbus_method_invocation_return_value(invocation, NULL);
|
g_dbus_method_invocation_return_value(invocation, NULL);
|
||||||
g_dbus_connection_flush(connection, NULL, NULL, NULL);
|
g_dbus_connection_flush(connection, NULL, NULL, NULL);
|
||||||
|
@ -451,7 +451,7 @@ void notification_init(notification *n)
|
|||||||
|
|
||||||
/* TODO: this should not be part of notification_init */
|
/* TODO: this should not be part of notification_init */
|
||||||
if (strlen(n->msg) == 0) {
|
if (strlen(n->msg) == 0) {
|
||||||
notification_close(n, 2);
|
queues_notification_close(n, 2);
|
||||||
if (settings.always_run_script) {
|
if (settings.always_run_script) {
|
||||||
notification_run_script(n);
|
notification_run_script(n);
|
||||||
}
|
}
|
||||||
|
16
src/queues.c
16
src/queues.c
@ -50,7 +50,7 @@ int queues_notification_insert(notification *n, int replaces_id)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
n->id = replaces_id;
|
n->id = replaces_id;
|
||||||
if (!notification_replace_by_id(n))
|
if (!queues_notification_replace_id(n))
|
||||||
g_queue_insert_sorted(queue, n, notification_cmp_data, NULL);
|
g_queue_insert_sorted(queue, n, notification_cmp_data, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ static int queues_stack_duplicate(notification *n)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool notification_replace_by_id(notification *new)
|
bool queues_notification_replace_id(notification *new)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (GList *iter = g_queue_peek_head_link(displayed);
|
for (GList *iter = g_queue_peek_head_link(displayed);
|
||||||
@ -141,7 +141,7 @@ bool notification_replace_by_id(notification *new)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int notification_close_by_id(int id, int reason)
|
int queues_notification_close_id(int id, int reason)
|
||||||
{
|
{
|
||||||
notification *target = NULL;
|
notification *target = NULL;
|
||||||
|
|
||||||
@ -174,20 +174,20 @@ int notification_close_by_id(int id, int reason)
|
|||||||
return reason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
int notification_close(notification *n, int reason)
|
int queues_notification_close(notification *n, int reason)
|
||||||
{
|
{
|
||||||
assert(n != NULL);
|
assert(n != NULL);
|
||||||
return notification_close_by_id(n->id, reason);
|
return queues_notification_close_id(n->id, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
void move_all_to_history()
|
void move_all_to_history()
|
||||||
{
|
{
|
||||||
while (displayed->length > 0) {
|
while (displayed->length > 0) {
|
||||||
notification_close(g_queue_peek_head_link(displayed)->data, 2);
|
queues_notification_close(g_queue_peek_head_link(displayed)->data, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (queue->length > 0) {
|
while (queue->length > 0) {
|
||||||
notification_close(g_queue_peek_head_link(queue)->data, 2);
|
queues_notification_close(g_queue_peek_head_link(queue)->data, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ void queues_check_timeouts(bool idle)
|
|||||||
|
|
||||||
/* remove old message */
|
/* remove old message */
|
||||||
if (g_get_monotonic_time() - n->start > n->timeout) {
|
if (g_get_monotonic_time() - n->start > n->timeout) {
|
||||||
notification_close(n, 1);
|
queues_notification_close(n, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ int queues_notification_insert(notification *n, int replaces_id);
|
|||||||
* Returns true, if a matching notification has been found
|
* Returns true, if a matching notification has been found
|
||||||
* and is replaced. Else false.
|
* and is replaced. Else false.
|
||||||
*/
|
*/
|
||||||
bool notification_replace_by_id(notification *new);
|
bool queues_notification_replace_id(notification *new);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close the notification that has id.
|
* Close the notification that has id.
|
||||||
@ -53,10 +53,10 @@ bool notification_replace_by_id(notification *new);
|
|||||||
* 2 -> the notification was dismissed by the user_data
|
* 2 -> the notification was dismissed by the user_data
|
||||||
* 3 -> The notification was closed by a call to CloseNotification
|
* 3 -> The notification was closed by a call to CloseNotification
|
||||||
*/
|
*/
|
||||||
int notification_close_by_id(int id, int reason);
|
int queues_notification_close_id(int id, int reason);
|
||||||
|
|
||||||
/* Close the given notification. SEE notification_close_by_id. */
|
/* Close the given notification. SEE queues_notification_close_id. */
|
||||||
int notification_close(notification *n, int reason);
|
int queues_notification_close(notification *n, int reason);
|
||||||
|
|
||||||
void history_pop(void);
|
void history_pop(void);
|
||||||
void history_push(notification *n);
|
void history_push(notification *n);
|
||||||
|
@ -857,7 +857,7 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback,
|
|||||||
if (displayed) {
|
if (displayed) {
|
||||||
notification *n = g_queue_peek_head(displayed);
|
notification *n = g_queue_peek_head(displayed);
|
||||||
if (n) {
|
if (n) {
|
||||||
notification_close(n, 2);
|
queues_notification_close(n, 2);
|
||||||
wake_up();
|
wake_up();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -939,7 +939,7 @@ static void x_handle_click(XEvent ev)
|
|||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
if (ev.xbutton.button == Button1)
|
if (ev.xbutton.button == Button1)
|
||||||
notification_close(n, 2);
|
queues_notification_close(n, 2);
|
||||||
else
|
else
|
||||||
notification_do_action(n);
|
notification_do_action(n);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user