commit c09e7ccc9a9e828f9b56e08519aea0e9f4650e9a
parent 4719469dbb90299a718efad56b2443c73ac37fdb
Author: Sweets <Sweets@users.noreply.github.com>
Date: Sat, 4 Jul 2020 16:02:18 -0700
Add: initial for actions
Diffstat:
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/callbacks.c b/callbacks.c
@@ -31,7 +31,7 @@ void method_handler(GDBusConnection *connection, const gchar *sender,
gchar *body;
g_variant_iter_next(&iterator, "s", &body);
- GVariant *actions;
+ GVariant **actions;
g_variant_iter_next(&iterator, "as", &actions);
GVariant *hints;
diff --git a/format.c b/format.c
@@ -18,11 +18,19 @@ char* escape_quotes(char *str, char *out) {
}
void output_notification(gchar *app_name, guint32 replaces_id, gchar *app_icon,
- gchar *summary, gchar *body, GVariant *actions, GVariant *hints,
+ gchar *summary, gchar *body, GVariant **actions, GVariant *hints,
gint32 timeout) {
char *escaped_string = (char *)calloc(512, sizeof(char));
+ gsize index = 0;
+ while (actions[index] && actions[index + 1]) {
+ g_print(", \"%s\": \"%s\"", g_variant_dup_string(actions[index], NULL),
+ g_variant_dup_string(actions[index++], NULL));
+ index++;
+ }
+
+
#ifdef PRINT_JSON
printf("{ \"app_name\": \"%s\",", escape_quotes(app_name, escaped_string));
diff --git a/format.h b/format.h
@@ -3,5 +3,5 @@
#include <gio/gio.h>
#include <glib.h>
-void output_notification(gchar*, guint32, gchar*, gchar*, gchar*, GVariant*,
+void output_notification(gchar*, guint32, gchar*, gchar*, gchar*, GVariant**,
GVariant*, gint32);