/*
   gcc -o mount-test mount-test.c `pkg-config --cflags --libs gio-2.0 gio-unix-2.0`
*/

#include <glib.h>
#include <gio/gio.h>
#include <gio/gunixmounts.h>

#include <stdio.h>

void mounts_changed(GUnixMountMonitor* mon, gpointer data) {
  puts("mounts changed\n");
  fflush(stdout);
}

int main() {
  GMainLoop* loop = g_main_loop_new(0, FALSE);
  GUnixMountMonitor* mon = g_unix_mount_monitor_get();

  g_signal_connect(mon, "mounts-changed",
                   G_CALLBACK(mounts_changed), NULL);
  g_main_loop_run(loop);
}
