/* eggfilemonitor.h: simple/pluggable file monitoring
 * Copyright (C) 2006 Emmanuele Bassi
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 */

#ifndef __EGG_FILE_MONITOR_H__
#define __EGG_FILE_MONITOR_H__

#include <glib/gerror.h>
#include <glib/gmain.h>

G_BEGIN_DECLS

typedef enum {
  EGG_FILE_CREATED_EVENT,
  EGG_FILE_CHANGED_EVENT,
  EGG_FILE_REMOVED_EVENT
} EggFileEvent;

typedef struct _EggFileMonitorSource EggFileMonitorSource;
typedef struct _EggFileMonitorHooks EggFileMonitorHooks;

typedef gboolean (*EggFileMonitorFunc) (const gchar  *uri,
					EggFileEvent  event,
					gpointer      user_data);


GSource *egg_file_monitor_source_new (const gchar          *uri);

guint    egg_file_monitor_add_full   (gint                priority,
				      const gchar        *uri,
				      EggFileMonitorFunc  function,
				      gpointer            data,
				      GDestroyNotify      notify);
guint    egg_file_monitor_add        (const gchar        *uri,
				      EggFileMonitorFunc  func,
				      gpointer            data);

struct _EggFileMonitorHooks
{
  gboolean (*add_monitor)    (EggFileMonitorSource *source);
  gboolean (*cancel_monitor) (EggFileMonitorSource *source);
  void     (*error)          (EggFileMonitorSource *source,
  			      const GError         *error);
};

void egg_set_file_monitor_hooks (EggFileMonitorHooks *hooks,
				 gpointer             data);

G_END_DECLS

#endif /* __EGG_FILE_MONITOR_H__ */
