diff options
author | Ben Blain <mail@servc.eu> | 2021-03-09 15:44:46 +0000 |
---|---|---|
committer | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2022-04-25 22:23:40 +0200 |
commit | 12d4b906233bed616d54535051e2263716285fac (patch) | |
tree | da51bdca635fea1d0090b5157e072890b0d2f5bc /tools | |
parent | 6c707d2dfd01150f12282160f3a0a25b2759b080 (diff) | |
download | libnotify-12d4b906233bed616d54535051e2263716285fac.tar.gz |
notify-send: Check for notification server actions capability support
Diffstat (limited to 'tools')
-rw-r--r-- | tools/notify-send.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/notify-send.c b/tools/notify-send.c index bf31894..7fd9efe 100644 --- a/tools/notify-send.c +++ b/tools/notify-send.c @@ -313,11 +313,27 @@ main (int argc, char *argv[]) } if (actions != NULL) { + GList *server_caps = notify_get_server_caps (); gint i = 0; char *action = NULL; gchar **spl = NULL; + gboolean have_actions; + + have_actions = + !!g_list_find_custom (server_caps, + "actions", + (GCompareFunc) g_ascii_strcasecmp); + g_list_foreach (server_caps, (GFunc) g_free, NULL); + g_list_free (server_caps); + + if (!have_actions) { + g_printerr (N_("Actions are not supported by this " + "notifications server. " + "Displaying non-interactively.\n")); + show_error = TRUE; + } - while ((action = actions[i++])) { + while (have_actions && (action = actions[i++])) { gchar *name; const gchar *label; |