commit e3acb7de68ace0572cf292f368a4cfeedd83983d
parent 29a6867ab7a15bf2c3e002b9904d4d8654bfaecd
Author: Sweets <Sweets@users.noreply.github.com>
Date: Sun, 20 Sep 2020 23:58:04 -0700
Fix for hints always being delimited by commas
Diffstat:
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/output.c b/src/output.c
@@ -72,7 +72,7 @@ void output_notification(GVariant *parameters) {
void hints_output_iterator(GVariant *hints, const char *str_format,
const char *int_format, const char *uint_format,
const char *double_format, const char *boolean_format,
- const char *byte_format) {
+ const char *byte_format, const char *element_delimiter) {
GVariantIter iterator;
gchar *key;
@@ -84,7 +84,7 @@ void hints_output_iterator(GVariant *hints, const char *str_format,
g_variant_iter_init(&iterator, hints);
while (g_variant_iter_loop(&iterator, "{sv}", &key, NULL)) {
if (index)
- printf(", ");
+ printf(element_delimiter);
/* Strings */
if ((value = g_variant_lookup_value(hints, key, GT_STRING))) {
@@ -149,7 +149,7 @@ void default_output(gchar *app_name, gchar *app_icon, guint32 replaces_id,
hints_output_iterator(hints,
str_format, int_format, uint_format, double_format, boolean_format,
- byte_format);
+ byte_format, "");
free(str_format);
free(int_format);
@@ -184,7 +184,7 @@ void json_output(gchar *app_name, gchar *app_icon, guint32 replaces_id,
printf("\"hints\": {");
hints_output_iterator(hints, "\"%s\": \"%s\"", "\"%s\": %d", "\"%s\": %u",
- "\"%s\": %f", "\"%s\": %x", "\"%s\": %d");
+ "\"%s\": %f", "\"%s\": %x", "\"%s\": %d", ", ");
printf("}, \"actions\": {");
unsigned int index = 0;
diff --git a/src/output.h b/src/output.h
@@ -18,7 +18,7 @@ char *sanitize(const char*);
void output_notification(GVariant*);
void hints_output_iterator(GVariant*, const char*, const char*, const char*,
- const char*, const char*, const char*);
+ const char*, const char*, const char*, const char*);
void default_output(gchar*, gchar*, guint32, gint32, GVariant*, gchar**, gchar*,
gchar*);
void json_output(gchar*, gchar*, guint32, gint32, GVariant*, gchar**, gchar*,