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

void
route_changed (GNetworkMonitor* nm, gboolean available, gpointer user_data)
{
    if (available)
        printf ("Available.\n");
    else
        printf ("Unavailable.\n");
}

int
main (int argc, char** argv)
{
    GNetworkMonitor* nm = NULL;
    GMainLoop* loop = NULL;

    g_type_init ();
    loop = g_main_loop_new (NULL, FALSE);
    nm = g_network_monitor_get_default ();
    g_signal_connect (nm, "network-changed", G_CALLBACK (route_changed), NULL);
    g_main_loop_run (loop);
}

