1 /*******************************************************************************
2 Copyright (c) 2011, 2012 Dmitry Matveev <me@dmitrymatveev.co.uk>
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 *******************************************************************************/
25 #include "kqueue-sub.h"
27 static gboolean ks_debug_enabled
= FALSE
;
28 #define KS_W if (ks_debug_enabled) g_warning
32 * @filename: a file path to monitor (will be copied)
33 * @pair_moves: pair moves flag. Refer to #GFileMonitorFlags documentation.
34 * @user_data: user-supplied poiner.
36 * Creates a new subscription object.
38 * Returns: a pointer to a created subscription object.
41 _kh_sub_new (const gchar
*filename
,
45 kqueue_sub
*sub
= g_slice_new (kqueue_sub
);
46 g_assert (sub
!= NULL
);
48 sub
->filename
= g_strdup (filename
);
49 sub
->pair_moves
= pair_moves
;
50 sub
->user_data
= user_data
;
53 /* I think that having such flag in the subscription is not good */
56 KS_W ("new subscription for %s being setup\n", sub
->filename
);
66 * Frees a subscription object and all its associated memory.
69 _kh_sub_free (kqueue_sub
*sub
)
77 g_free (sub
->filename
);
78 g_slice_free (kqueue_sub
, sub
);