commit c4eabaa5af9cbdbcd737f58a25a42b2b7029fc23
parent a01a912208ef7ac81c5734e5339c71253bc4f08f
Author: Sweets <Sweets@users.noreply.github.com>
Date: Sun, 26 Apr 2020 00:13:36 -0700
triangular brain, functional brain
Diffstat:
3 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/callbacks.c b/callbacks.c
@@ -11,8 +11,6 @@ void method_handler(GDBusConnection *connection, const gchar *sender,
if (!strcmp(method, "Notify")) {
GVariantIter iterator;
- void *value;
-
g_variant_iter_init(&iterator, parameters);
gchar *app_name;
@@ -39,8 +37,8 @@ void method_handler(GDBusConnection *connection, const gchar *sender,
gint32 timeout;
g_variant_iter_next(&iterator, "i", &timeout);
- print("%s %d %s %s %s actions,hints %d",
- app_name, replaces_id, app_icon, summary, body, timeout);
+ output(app_name, replaces_id, app_icon, summary, body, actions, hints,
+ timeout);
return_value = g_variant_new("(u)", 0);
goto flush;
diff --git a/tiramisu.c b/tiramisu.c
@@ -42,6 +42,42 @@ const char *xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
" </interface>\n"
"</node>";
+void output(gchar *app_name, guint32 replaces_id, gchar *app_icon,
+ gchar *summary, gchar *body, GVariant *actions, GVariant *hints,
+ gint32 timeout) {
+
+ /* Build output and fucking send it */
+
+ char *out;
+
+ char *format = "%s"
+#ifdef RECEIVE_APP_ICON
+ "\n%s"
+#endif
+
+ /* TODO: actions */
+ /* TODO: hints */
+
+#ifdef RECEIVE_REPLACES_ID
+ "\n%lu"
+#endif
+ "\n%d\n%s\n%s";
+
+ asprintf(&out, format, app_name,
+#ifdef RECEIVE_APP_ICON
+ app_icon,
+#endif
+/* TODO: actions */
+/* TODO: hints */
+#ifdef RECEIVE_REPLACES_ID
+ replaces_id,
+#endif
+ timeout, summary, body);
+
+ printf("%s\n", out);
+
+}
+
int main(int argc, char **argv) {
GMainLoop *main_loop;
diff --git a/tiramisu.h b/tiramisu.h
@@ -12,3 +12,6 @@ extern GDBusConnection *dbus_connection;
extern GDBusNodeInfo *introspection;
#define print(...) fprintf(stderr, __VA_ARGS__);
+
+void output(gchar*, guint32, gchar*, gchar*, gchar*, GVariant*, GVariant*,
+ gint32);