1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 8 -*- */
3 /* inotify-sub.c - GMonitor based on inotify.
5 Copyright (C) 2006 John McCutchan
7 The Gnome Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 The Gnome Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with the Gnome Library; see the file COPYING.LIB. If not,
19 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
23 John McCutchan <john@johnmccutchan.com>
30 #include "inotify-sub.h"
32 static gboolean is_debug_enabled = FALSE;
33 #define IS_W if (is_debug_enabled) g_warning
36 dup_dirname (const gchar *dirname)
38 gchar *d_dirname = g_strdup (dirname);
39 size_t len = strlen (d_dirname);
41 if (d_dirname[len - 1] == '/')
42 d_dirname[len - 1] = '\0';
48 _ih_sub_new (const gchar *dirname,
49 const gchar *filename,
53 inotify_sub *sub = NULL;
55 sub = g_new0 (inotify_sub, 1);
56 sub->dirname = dup_dirname (dirname);
57 sub->filename = g_strdup (filename);
58 sub->pair_moves = pair_moves;
59 sub->user_data = user_data;
61 IS_W ("new subscription for %s being setup\n", sub->dirname);
67 _ih_sub_free (inotify_sub *sub)
69 g_free (sub->dirname);
70 g_free (sub->filename);