*
* Copyright (C) 2006-2007 Red Hat, Inc.
* Copyright (C) 2007 Sebastian Dröge.
- * Copyright (C) 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2008, 2010 Oracle and/or its affiliates, Inc. All rights
+ * reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#include "fen-helper.h"
-#include "gioalias.h"
-
struct _GFenFileMonitor
{
GLocalFileMonitor parent_instance;
- fen_sub* sub;
+ gboolean enabled;
};
static gboolean g_fen_file_monitor_cancel (GFileMonitor* monitor);
static void
g_fen_file_monitor_finalize (GObject *object)
{
- GFenFileMonitor *self = G_FEN_FILE_MONITOR (object);
+ GFenFileMonitor *self = G_FEN_FILE_MONITOR (object);
- if (self->sub) {
- _fen_remove (G_LOCAL_FILE_MONITOR (self)->filename, self->sub, FALSE);
- _fen_sub_delete (self->sub);
- self->sub = NULL;
+ if (self->enabled) {
+ fen_remove (G_LOCAL_FILE_MONITOR (self)->filename, self, FALSE);
+ self->enabled = FALSE;
}
if (G_OBJECT_CLASS (g_fen_file_monitor_parent_class)->finalize)
/* Will never fail as is_supported() should be called before instanciating
* anyway */
- if (!_fen_init ())
+ if (!fen_init ())
g_assert_not_reached ();
/* FIXME: what to do about errors here? we can't return NULL or another
* kind of error and an assertion is probably too hard */
- self->sub = _fen_sub_new (self, FALSE);
- g_assert (self->sub);
-
- _fen_add (filename, self->sub, FALSE);
+ fen_add (filename, self, FALSE);
+ self->enabled = TRUE;
return obj;
}
static gboolean
g_fen_file_monitor_is_supported (void)
{
- return _fen_init ();
+ return fen_init ();
}
static void
{
GFenFileMonitor *self = G_FEN_FILE_MONITOR (monitor);
- if (self->sub) {
- _fen_remove (G_LOCAL_FILE_MONITOR (self)->filename, self->sub, FALSE);
- _fen_sub_delete (self->sub);
- self->sub = NULL;
+ if (self->enabled) {
+ fen_remove (G_LOCAL_FILE_MONITOR (self)->filename, self, FALSE);
+ self->enabled = FALSE;
}
if (G_FILE_MONITOR_CLASS (g_fen_file_monitor_parent_class)->cancel)
return TRUE;
}
-