diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2022-04-27 20:45:06 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2022-04-27 20:45:06 +0200 |
commit | 02f2f91c3dc97a25b9f2cd669e2082c3c7a86d3f (patch) | |
tree | 58b3d47c38ccff7eb1c05a5a8cc33564d79b4f0c /tools | |
parent | d6f4734adf504e6efb40e4331c723a52345bdc2a (diff) | |
download | libnotify-02f2f91c3dc97a25b9f2cd669e2082c3c7a86d3f.tar.gz |
notify-send: Support passing any hint value, by parsing variant strings
Diffstat (limited to 'tools')
-rw-r--r-- | tools/notify-send.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/notify-send.c b/tools/notify-send.c index 8d3898d..04eb770 100644 --- a/tools/notify-send.c +++ b/tools/notify-send.c @@ -111,6 +111,15 @@ notify_notification_set_hint_variant (NotifyNotification *notification, notify_notification_set_hint (notification, key, g_variant_new_boolean (h_boolean)); + } else if (g_ascii_strcasecmp (type, "variant") == 0) { + GVariant *variant = g_variant_parse (NULL, value, NULL, NULL, NULL); + + if (variant != NULL) { + notify_notification_set_hint (notification, key, variant); + } else { + conv_error = TRUE; + } + } else { *error = g_error_new (G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, @@ -208,7 +217,7 @@ main (int argc, char *argv[]) N_("TYPE[,TYPE...]")}, {"hint", 'h', 0, G_OPTION_ARG_FILENAME_ARRAY, &hints, N_ - ("Specifies basic extra data to pass. Valid types are boolean, int, double, string and byte."), + ("Specifies basic extra data to pass. Valid types are boolean, int, double, string, byte and variant."), N_("TYPE:NAME:VALUE")}, {"print-id", 'p', 0, G_OPTION_ARG_NONE, &print_id, N_ ("Print the notification ID."), NULL}, |