#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <glib.h>

#include "eggfilemonitor.h"

#define TEST_URI	"file:///tmp/test.txt"

static gboolean
file_monitor_cb (const gchar  *uri,
		 EggFileEvent  event,
		 gpointer      user_data)
{
  switch (event)
    {
    case EGG_FILE_CREATED_EVENT:
      g_print ("File '%s' has been created\n", uri);
      break;
    case EGG_FILE_CHANGED_EVENT:
      g_print ("File '%s' has been changed\n", uri);
      break;
    case EGG_FILE_REMOVED_EVENT:
      g_print ("File '%s' has been removed\n", uri);
      break;
    default:
      g_assert_not_reached ();
      return FALSE;
    }
  
  return TRUE;
}

int main (int argc, char *argv[])
{
  GMainLoop *main_loop;
  guint id;
  
  main_loop = g_main_loop_new (NULL, FALSE);
  
  id = egg_file_monitor_add (TEST_URI, file_monitor_cb, NULL);
  
  g_main_loop_run (main_loop);
  
  return 0;
}
