gresource: Fix potential array overflow if using empty paths
[glib.git] / gio / glocalfilemonitor.h
blob7f3baadbda6d484238ca3d8c445a34348d9746c7
1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2006-2007 Red Hat, Inc.
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.
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.
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/>.
18 * Author: Alexander Larsson <alexl@redhat.com>
21 #ifndef __G_LOCAL_FILE_MONITOR_H__
22 #define __G_LOCAL_FILE_MONITOR_H__
24 #include <gio/gfilemonitor.h>
25 #include "gunixmounts.h"
27 G_BEGIN_DECLS
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))
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"
39 typedef struct _GLocalFileMonitor GLocalFileMonitor;
40 typedef struct _GLocalFileMonitorClass GLocalFileMonitorClass;
41 typedef struct _GFileMonitorSource GFileMonitorSource;
43 struct _GLocalFileMonitor
45 GFileMonitor parent_instance;
47 GFileMonitorSource *source;
48 GUnixMountMonitor *mount_monitor;
49 gboolean was_mounted;
52 struct _GLocalFileMonitorClass
54 GFileMonitorClass parent_class;
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);
63 gboolean mount_notify;
66 #ifdef G_OS_UNIX
67 GLIB_AVAILABLE_IN_ALL
68 #endif
69 GType g_local_file_monitor_get_type (void) G_GNUC_CONST;
71 /* for glocalfile.c */
72 GFileMonitor *
73 g_local_file_monitor_new_for_path (const gchar *pathname,
74 gboolean is_directory,
75 GFileMonitorFlags flags,
76 GError **error);
78 /* for various users in glib */
79 typedef void (* GFileMonitorCallback) (GFileMonitor *monitor,
80 GFile *child,
81 GFile *other,
82 GFileMonitorEvent event,
83 gpointer user_data);
84 GFileMonitor *
85 g_local_file_monitor_new_in_worker (const gchar *pathname,
86 gboolean is_directory,
87 GFileMonitorFlags flags,
88 GFileMonitorCallback callback,
89 gpointer user_data,
90 GError **error);
92 /* for implementations of GLocalFileMonitor */
93 GLIB_AVAILABLE_IN_2_44
94 gboolean
95 g_file_monitor_source_handle_event (GFileMonitorSource *fms,
96 GFileMonitorEvent event_type,
97 const gchar *child,
98 const gchar *rename_to,
99 GFile *other,
100 gint64 event_time);
103 G_END_DECLS
105 #endif /* __G_LOCAL_FILE_MONITOR_H__ */