Dunstify: Print id before blocking

Print the notification id, if requested, before blocking to catch action
return or NotificationClosed signal since once of those events happens
the program will exit without further action, bypassing the id printing
logic.
This commit is contained in:
Nikos Tsipinakis 2017-11-22 17:49:50 +02:00
parent 73eaa25690
commit 51a98b8fd0

View File

@ -296,9 +296,10 @@ int main(int argc, char *argv[])
GMainLoop *l = NULL; GMainLoop *l = NULL;
if (block || action_strs) if (block || action_strs) {
l = g_main_loop_new(NULL, false); l = g_main_loop_new(NULL, false);
g_signal_connect(n, "closed", G_CALLBACK(closed), NULL); g_signal_connect(n, "closed", G_CALLBACK(closed), NULL);
}
if (action_strs) if (action_strs)
for (int i = 0; action_strs[i]; i++) { for (int i = 0; action_strs[i]; i++) {
@ -317,13 +318,12 @@ int main(int argc, char *argv[])
die(1); die(1);
} }
if (printid)
g_print("%d\n", get_id(n));
if (block || action_strs) if (block || action_strs)
g_main_loop_run(l); g_main_loop_run(l);
if (printid) {
g_print("%d\n", get_id(n));
}
g_object_unref(G_OBJECT (n)); g_object_unref(G_OBJECT (n));
die(0); die(0);