1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2006-2007 Red Hat, Inc.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author: Alexander Larsson <alexl@redhat.com>
19 */
20
21#ifndef __G_LOCAL_FILE_MONITOR_H__
22#define __G_LOCAL_FILE_MONITOR_H__
23
24#include <gio/gfilemonitor.h>
25#include "gunixmounts.h"
26
27G_BEGIN_DECLS
28
29#define G_TYPE_LOCAL_FILE_MONITOR (g_local_file_monitor_get_type ())
30#define G_LOCAL_FILE_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_LOCAL_FILE_MONITOR, GLocalFileMonitor))
31#define G_LOCAL_FILE_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), G_TYPE_LOCAL_FILE_MONITOR, GLocalFileMonitorClass))
32#define G_IS_LOCAL_FILE_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_LOCAL_FILE_MONITOR))
33#define G_IS_LOCAL_FILE_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_LOCAL_FILE_MONITOR))
34#define G_LOCAL_FILE_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_LOCAL_FILE_MONITOR, GLocalFileMonitorClass))
35
36#define G_LOCAL_FILE_MONITOR_EXTENSION_POINT_NAME "gio-local-file-monitor"
37#define G_NFS_FILE_MONITOR_EXTENSION_POINT_NAME "gio-nfs-file-monitor"
38
39typedef struct _GLocalFileMonitor GLocalFileMonitor;
40typedef struct _GLocalFileMonitorClass GLocalFileMonitorClass;
41typedef struct _GFileMonitorSource GFileMonitorSource;
42
43struct _GLocalFileMonitor
44{
45 GFileMonitor parent_instance;
46
47 GFileMonitorSource *source;
48 GUnixMountMonitor *mount_monitor;
49 gboolean was_mounted;
50};
51
52struct _GLocalFileMonitorClass
53{
54 GFileMonitorClass parent_class;
55
56 gboolean (* is_supported) (void);
57 void (* start) (GLocalFileMonitor *local_monitor,
58 const gchar *dirname,
59 const gchar *basename,
60 const gchar *filename,
61 GFileMonitorSource *source);
62
63 gboolean mount_notify;
64};
65
66#ifdef G_OS_UNIX
67GLIB_AVAILABLE_IN_ALL
68#endif
69GType g_local_file_monitor_get_type (void) G_GNUC_CONST;
70
71/* for glocalfile.c */
72GFileMonitor *
73g_local_file_monitor_new_for_path (const gchar *pathname,
74 gboolean is_directory,
75 GFileMonitorFlags flags,
76 GError **error);
77
78/* for various users in glib */
79typedef void (* GFileMonitorCallback) (GFileMonitor *monitor,
80 GFile *child,
81 GFile *other,
82 GFileMonitorEvent event,
83 gpointer user_data);
84GFileMonitor *
85g_local_file_monitor_new_in_worker (const gchar *pathname,
86 gboolean is_directory,
87 GFileMonitorFlags flags,
88 GFileMonitorCallback callback,
89 gpointer user_data,
90 GClosureNotify destroy_user_data,
91 GError **error);
92
93/* for implementations of GLocalFileMonitor */
94GLIB_AVAILABLE_IN_2_44
95gboolean
96g_file_monitor_source_handle_event (GFileMonitorSource *fms,
97 GFileMonitorEvent event_type,
98 const gchar *child,
99 const gchar *rename_to,
100 GFile *other,
101 gint64 event_time);
102
103
104G_END_DECLS
105
106#endif /* __G_LOCAL_FILE_MONITOR_H__ */
107

source code of gtk/subprojects/glib/gio/glocalfilemonitor.h