1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2006-2007 Red Hat, Inc.
5 * SPDX-License-Identifier: LGPL-2.1-or-later
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This 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 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 * Author: Alexander Larsson <alexl@redhat.com>
26 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27 #error "Only <gio/gio.h> can be included directly."
30 #include <gio/giotypes.h>
34 #define G_TYPE_VFS (g_vfs_get_type ())
35 #define G_VFS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VFS, GVfs))
36 #define G_VFS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VFS, GVfsClass))
37 #define G_VFS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VFS, GVfsClass))
38 #define G_IS_VFS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VFS))
39 #define G_IS_VFS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VFS))
44 * @identifier: the identifier to look up a #GFile for. This can either
45 * be an URI or a parse name as returned by g_file_get_parse_name()
46 * @user_data: user data passed to the function
48 * This function type is used by g_vfs_register_uri_scheme() to make it
49 * possible for a client to associate an URI scheme to a different #GFile
52 * The client should return a reference to the new file that has been
53 * created for @uri, or %NULL to continue with the default implementation.
55 * Returns: (transfer full): a #GFile for @identifier.
59 typedef GFile * (* GVfsFileLookupFunc) (GVfs *vfs,
60 const char *identifier,
64 * G_VFS_EXTENSION_POINT_NAME:
66 * Extension point for #GVfs functionality.
67 * See [Extending GIO][extending-gio].
69 #define G_VFS_EXTENSION_POINT_NAME "gio-vfs"
71 typedef struct _GVfsClass GVfsClass;
75 GObject parent_instance;
80 GObjectClass parent_class;
84 gboolean (* is_active) (GVfs *vfs);
85 GFile * (* get_file_for_path) (GVfs *vfs,
87 GFile * (* get_file_for_uri) (GVfs *vfs,
89 const gchar * const * (* get_supported_uri_schemes) (GVfs *vfs);
90 GFile * (* parse_name) (GVfs *vfs,
91 const char *parse_name);
94 void (* local_file_add_info) (GVfs *vfs,
97 GFileAttributeMatcher *attribute_matcher,
99 GCancellable *cancellable,
100 gpointer *extra_data,
101 GDestroyNotify *free_extra_data);
102 void (* add_writable_namespaces) (GVfs *vfs,
103 GFileAttributeInfoList *list);
104 gboolean (* local_file_set_attributes) (GVfs *vfs,
105 const char *filename,
107 GFileQueryInfoFlags flags,
108 GCancellable *cancellable,
110 void (* local_file_removed) (GVfs *vfs,
111 const char *filename);
112 void (* local_file_moved) (GVfs *vfs,
115 GIcon * (* deserialize_icon) (GVfs *vfs,
117 /* Padding for future expansion */
118 void (*_g_reserved1) (void);
119 void (*_g_reserved2) (void);
120 void (*_g_reserved3) (void);
121 void (*_g_reserved4) (void);
122 void (*_g_reserved5) (void);
123 void (*_g_reserved6) (void);
127 GType g_vfs_get_type (void) G_GNUC_CONST;
130 gboolean g_vfs_is_active (GVfs *vfs);
132 GFile * g_vfs_get_file_for_path (GVfs *vfs,
135 GFile * g_vfs_get_file_for_uri (GVfs *vfs,
138 const gchar* const * g_vfs_get_supported_uri_schemes (GVfs *vfs);
141 GFile * g_vfs_parse_name (GVfs *vfs,
142 const char *parse_name);
145 GVfs * g_vfs_get_default (void);
147 GVfs * g_vfs_get_local (void);
149 GIO_AVAILABLE_IN_2_50
150 gboolean g_vfs_register_uri_scheme (GVfs *vfs,
152 GVfsFileLookupFunc uri_func,
154 GDestroyNotify uri_destroy,
155 GVfsFileLookupFunc parse_name_func,
156 gpointer parse_name_data,
157 GDestroyNotify parse_name_destroy);
158 GIO_AVAILABLE_IN_2_50
159 gboolean g_vfs_unregister_uri_scheme (GVfs *vfs,
165 #endif /* __G_VFS_H__ */