support for replacing an existing notification
This commit is contained in:
parent
55eb69247f
commit
7970f9622d
|
@ -131,6 +131,8 @@ main (int argc, char *argv[])
|
||||||
static char *icons = NULL;
|
static char *icons = NULL;
|
||||||
static char **n_text = NULL;
|
static char **n_text = NULL;
|
||||||
static char **hints = NULL;
|
static char **hints = NULL;
|
||||||
|
static gboolean print_id = FALSE;
|
||||||
|
static gint replace_id = 0;
|
||||||
static gboolean do_version = FALSE;
|
static gboolean do_version = FALSE;
|
||||||
static gboolean hint_error = FALSE;
|
static gboolean hint_error = FALSE;
|
||||||
static glong expire_timeout = NOTIFY_EXPIRES_DEFAULT;
|
static glong expire_timeout = NOTIFY_EXPIRES_DEFAULT;
|
||||||
|
@ -160,6 +162,10 @@ main (int argc, char *argv[])
|
||||||
N_
|
N_
|
||||||
("Specifies basic extra data to pass. Valid types are int, double, string and byte."),
|
("Specifies basic extra data to pass. Valid types are int, double, string and byte."),
|
||||||
N_("TYPE:NAME:VALUE")},
|
N_("TYPE:NAME:VALUE")},
|
||||||
|
{"print-id", 'p', 0, G_OPTION_ARG_NONE, &print_id,
|
||||||
|
N_ ("Print the notification ID."), NULL},
|
||||||
|
{"replace-id", 'r', 0, G_OPTION_ARG_INT, &replace_id,
|
||||||
|
N_ ("The ID of the notification to replace."), N_("REPLACE_ID")},
|
||||||
{"version", 'v', 0, G_OPTION_ARG_NONE, &do_version,
|
{"version", 'v', 0, G_OPTION_ARG_NONE, &do_version,
|
||||||
N_("Version of the package."),
|
N_("Version of the package."),
|
||||||
NULL},
|
NULL},
|
||||||
|
@ -238,6 +244,9 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
g_free (body);
|
g_free (body);
|
||||||
|
|
||||||
|
if (replace_id)
|
||||||
|
g_object_set (notify, "id", replace_id, NULL);
|
||||||
|
|
||||||
/* Set hints */
|
/* Set hints */
|
||||||
if (hints != NULL) {
|
if (hints != NULL) {
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
|
@ -277,6 +286,12 @@ main (int argc, char *argv[])
|
||||||
if (!hint_error)
|
if (!hint_error)
|
||||||
notify_notification_show (notify, NULL);
|
notify_notification_show (notify, NULL);
|
||||||
|
|
||||||
|
if (print_id) {
|
||||||
|
gint id;
|
||||||
|
g_object_get (notify, "id", &id, NULL);
|
||||||
|
g_printf ("%d\n", id);
|
||||||
|
}
|
||||||
|
|
||||||
g_object_unref (G_OBJECT (notify));
|
g_object_unref (G_OBJECT (notify));
|
||||||
|
|
||||||
notify_uninit ();
|
notify_uninit ();
|
||||||
|
|
Loading…
Reference in New Issue