|
Revision 2779
(checked in by chipx86, 3 years ago)
|
Set the second, replaced notification to have a default expiration.
|
| Line | |
|---|
| 1 |
#include <libnotify/notify.h> |
|---|
| 2 |
#include <stdio.h> |
|---|
| 3 |
#include <unistd.h> |
|---|
| 4 |
#include <glib.h> |
|---|
| 5 |
|
|---|
| 6 |
int main() { |
|---|
| 7 |
NotifyNotification *n; |
|---|
| 8 |
GError *error; |
|---|
| 9 |
error = NULL; |
|---|
| 10 |
|
|---|
| 11 |
g_type_init (); |
|---|
| 12 |
|
|---|
| 13 |
notify_init("Replace Test"); |
|---|
| 14 |
|
|---|
| 15 |
n = notify_notification_new ("Summary", "First message", |
|---|
| 16 |
NULL, //no icon |
|---|
| 17 |
NULL); //don't attach to widget |
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
notify_notification_set_timeout (n, 0); //don't timeout |
|---|
| 21 |
|
|---|
| 22 |
if (!notify_notification_show (n, &error)) { |
|---|
| 23 |
fprintf(stderr, "failed to send notification: %s\n", error->message); |
|---|
| 24 |
g_error_free (error); |
|---|
| 25 |
return 1; |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
sleep(3); |
|---|
| 29 |
|
|---|
| 30 |
notify_notification_update (n, "Second Summary", |
|---|
| 31 |
"First mesage was replaced", NULL); |
|---|
| 32 |
notify_notification_set_timeout (n, NOTIFY_EXPIRES_DEFAULT); |
|---|
| 33 |
|
|---|
| 34 |
if (!notify_notification_show (n, &error)) { |
|---|
| 35 |
fprintf(stderr, "failed to send notification: %s\n", error->message); |
|---|
| 36 |
g_error_free (error); |
|---|
| 37 |
return 1; |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
return 0; |
|---|
| 41 |
} |
|---|