wok annotate libnotify/stuff/print-and-replace-id-v3.patch @ rev 18948

libnotify: patch to print and replace id
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Mar 04 17:37:01 2016 +0200 (2016-03-04)
parents
children
rev   line source
al@18948 1 https://bugs.launchpad.net/ubuntu/+source/libnotify/+bug/257135/comments/10
al@18948 2 https://launchpadlibrarian.net/105791133/print-and-replace-id-v3.patch
al@18948 3
al@18948 4 Index: libnotify-0.7.5/tools/notify-send.c
al@18948 5 ===================================================================
al@18948 6 --- libnotify-0.7.5.orig/tools/notify-send.c 2011-10-14 11:24:15.000000000 +1300
al@18948 7 +++ libnotify-0.7.5/tools/notify-send.c 2012-05-22 22:15:43.370979671 +1200
al@18948 8 @@ -130,6 +130,8 @@
al@18948 9 static char *icons = NULL;
al@18948 10 static char **n_text = NULL;
al@18948 11 static char **hints = NULL;
al@18948 12 + static gboolean print_id = FALSE;
al@18948 13 + static gint replace_id = 0;
al@18948 14 static gboolean do_version = FALSE;
al@18948 15 static gboolean hint_error = FALSE;
al@18948 16 static glong expire_timeout = NOTIFY_EXPIRES_DEFAULT;
al@18948 17 @@ -159,6 +161,10 @@
al@18948 18 N_
al@18948 19 ("Specifies basic extra data to pass. Valid types are int, double, string and byte."),
al@18948 20 N_("TYPE:NAME:VALUE")},
al@18948 21 + {"print-id", 'p', 0, G_OPTION_ARG_NONE, &print_id,
al@18948 22 + N_ ("Print the notification ID."), NULL},
al@18948 23 + {"replace-id", 'r', 0, G_OPTION_ARG_INT, &replace_id,
al@18948 24 + N_ ("The ID of the notification to replace."), N_("REPLACE_ID")},
al@18948 25 {"version", 'v', 0, G_OPTION_ARG_NONE, &do_version,
al@18948 26 N_("Version of the package."),
al@18948 27 NULL},
al@18948 28 @@ -233,6 +239,9 @@
al@18948 29
al@18948 30 g_free (body);
al@18948 31
al@18948 32 + if (replace_id)
al@18948 33 + g_object_set (notify, "id", replace_id, NULL);
al@18948 34 +
al@18948 35 /* Set hints */
al@18948 36 if (hints != NULL) {
al@18948 37 gint i = 0;
al@18948 38 @@ -272,6 +281,12 @@
al@18948 39 if (!hint_error)
al@18948 40 notify_notification_show (notify, NULL);
al@18948 41
al@18948 42 + if (print_id) {
al@18948 43 + gint id;
al@18948 44 + g_object_get (notify, "id", &id, NULL);
al@18948 45 + g_printf ("%d\n", id);
al@18948 46 + }
al@18948 47 +
al@18948 48 g_object_unref (G_OBJECT (notify));
al@18948 49
al@18948 50 notify_uninit ();