summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Blain <mail@servc.eu>2021-03-09 15:44:46 +0000
committerMarco Trevisan (TreviƱo) <mail@3v1n0.net>2022-04-25 22:23:40 +0200
commit12d4b906233bed616d54535051e2263716285fac (patch)
treeda51bdca635fea1d0090b5157e072890b0d2f5bc
parent6c707d2dfd01150f12282160f3a0a25b2759b080 (diff)
downloadlibnotify-12d4b906233bed616d54535051e2263716285fac.tar.gz
notify-send: Check for notification server actions capability support
-rw-r--r--tools/notify-send.c18
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;