More clearly define 'named menu' in the XML parser
[glib.git] / gio / inotify / inotify-sub.c
blobfa2e934a7f1e2aad2de82749cdc6849d9a256ac9
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.
22 Authors:
23 John McCutchan <john@johnmccutchan.com>
26 #include "config.h"
27 #include <string.h>
28 #include <glib.h>
30 #include "inotify-sub.h"
32 static gboolean is_debug_enabled = FALSE;
33 #define IS_W if (is_debug_enabled) g_warning
35 static gchar*
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';
44 return d_dirname;
47 inotify_sub*
48 _ih_sub_new (const gchar *dirname,
49 const gchar *filename,
50 gboolean pair_moves,
51 gpointer user_data)
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);
63 return sub;
66 void
67 _ih_sub_free (inotify_sub *sub)
69 g_free (sub->dirname);
70 g_free (sub->filename);
71 g_free (sub);