[libnotify] notify-send: Check for notification server actions capability support
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libnotify] notify-send: Check for notification server actions capability support
- Date: Mon, 25 Apr 2022 20:33:30 +0000 (UTC)
commit 12d4b906233bed616d54535051e2263716285fac
Author: Ben Blain <mail servc eu>
Date: Tue Mar 9 15:44:46 2021 +0000
notify-send: Check for notification server actions capability support
tools/notify-send.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
---
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]