#include <gio/gio.h>
#include <stdio.h>

static void activate (GApplication *application);

int main(void) {
    GApplication *application = g_application_new("application.example", G_APPLICATION_FLAGS_NONE);
    g_signal_connect(application, "activate", G_CALLBACK(activate), NULL);

    int status = g_application_run(application, 0, NULL );
    g_object_unref(application);
    printf("GApplication returned status code %d\n", status);
    return status;
}

void activate (GApplication *application) {
    GNotification *notification = g_notification_new("This is a notification");
    g_notification_set_body(notification, "Longer notification body text, babble, babble, babble.");

    GFile *file = g_file_new_for_path("icon.png");
    GIcon *icon = g_file_icon_new(file);
    g_notification_set_icon(notification, G_ICON(icon));
    g_object_unref(icon);
    g_object_unref(file);

    g_application_send_notification(application, "notification-id", notification);
    g_object_unref(notification);
    printf("g_application_send_notification called\n");
}

