gvfs.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2006-2007 Red Hat, Inc.
  4. *
  5. * SPDX-License-Identifier: LGPL-2.1-or-later
  6. *
  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.
  11. *
  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.
  16. *
  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/>.
  19. *
  20. * Author: Alexander Larsson <alexl@redhat.com>
  21. */
  22. #ifndef __G_VFS_H__
  23. #define __G_VFS_H__
  24. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  25. #error "Only <gio/gio.h> can be included directly."
  26. #endif
  27. #include <gio/giotypes.h>
  28. G_BEGIN_DECLS
  29. #define G_TYPE_VFS (g_vfs_get_type ())
  30. #define G_VFS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VFS, GVfs))
  31. #define G_VFS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VFS, GVfsClass))
  32. #define G_VFS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VFS, GVfsClass))
  33. #define G_IS_VFS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VFS))
  34. #define G_IS_VFS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VFS))
  35. /**
  36. * GVfsFileLookupFunc:
  37. * @vfs: a #GVfs
  38. * @identifier: the identifier to look up a #GFile for. This can either
  39. * be a URI or a parse name as returned by g_file_get_parse_name()
  40. * @user_data: user data passed to the function
  41. *
  42. * This function type is used by g_vfs_register_uri_scheme() to make it
  43. * possible for a client to associate a URI scheme to a different #GFile
  44. * implementation.
  45. *
  46. * The client should return a reference to the new file that has been
  47. * created for @uri, or %NULL to continue with the default implementation.
  48. *
  49. * Returns: (transfer full): a #GFile for @identifier.
  50. *
  51. * Since: 2.50
  52. */
  53. typedef GFile * (* GVfsFileLookupFunc) (GVfs *vfs,
  54. const char *identifier,
  55. gpointer user_data);
  56. /**
  57. * G_VFS_EXTENSION_POINT_NAME:
  58. *
  59. * Extension point for #GVfs functionality.
  60. * See [Extending GIO][extending-gio].
  61. */
  62. #define G_VFS_EXTENSION_POINT_NAME "gio-vfs"
  63. typedef struct _GVfsClass GVfsClass;
  64. struct _GVfs
  65. {
  66. GObject parent_instance;
  67. };
  68. struct _GVfsClass
  69. {
  70. GObjectClass parent_class;
  71. /* Virtual Table */
  72. gboolean (* is_active) (GVfs *vfs);
  73. GFile * (* get_file_for_path) (GVfs *vfs,
  74. const char *path);
  75. GFile * (* get_file_for_uri) (GVfs *vfs,
  76. const char *uri);
  77. const gchar * const * (* get_supported_uri_schemes) (GVfs *vfs);
  78. GFile * (* parse_name) (GVfs *vfs,
  79. const char *parse_name);
  80. /*< private >*/
  81. void (* local_file_add_info) (GVfs *vfs,
  82. const char *filename,
  83. guint64 device,
  84. GFileAttributeMatcher *attribute_matcher,
  85. GFileInfo *info,
  86. GCancellable *cancellable,
  87. gpointer *extra_data,
  88. GDestroyNotify *free_extra_data);
  89. void (* add_writable_namespaces) (GVfs *vfs,
  90. GFileAttributeInfoList *list);
  91. gboolean (* local_file_set_attributes) (GVfs *vfs,
  92. const char *filename,
  93. GFileInfo *info,
  94. GFileQueryInfoFlags flags,
  95. GCancellable *cancellable,
  96. GError **error);
  97. void (* local_file_removed) (GVfs *vfs,
  98. const char *filename);
  99. void (* local_file_moved) (GVfs *vfs,
  100. const char *source,
  101. const char *dest);
  102. GIcon * (* deserialize_icon) (GVfs *vfs,
  103. GVariant *value);
  104. /* Padding for future expansion */
  105. void (*_g_reserved1) (void);
  106. void (*_g_reserved2) (void);
  107. void (*_g_reserved3) (void);
  108. void (*_g_reserved4) (void);
  109. void (*_g_reserved5) (void);
  110. void (*_g_reserved6) (void);
  111. };
  112. GIO_AVAILABLE_IN_ALL
  113. GType g_vfs_get_type (void) G_GNUC_CONST;
  114. GIO_AVAILABLE_IN_ALL
  115. gboolean g_vfs_is_active (GVfs *vfs);
  116. GIO_AVAILABLE_IN_ALL
  117. GFile * g_vfs_get_file_for_path (GVfs *vfs,
  118. const char *path);
  119. GIO_AVAILABLE_IN_ALL
  120. GFile * g_vfs_get_file_for_uri (GVfs *vfs,
  121. const char *uri);
  122. GIO_AVAILABLE_IN_ALL
  123. const gchar* const * g_vfs_get_supported_uri_schemes (GVfs *vfs);
  124. GIO_AVAILABLE_IN_ALL
  125. GFile * g_vfs_parse_name (GVfs *vfs,
  126. const char *parse_name);
  127. GIO_AVAILABLE_IN_ALL
  128. GVfs * g_vfs_get_default (void);
  129. GIO_AVAILABLE_IN_ALL
  130. GVfs * g_vfs_get_local (void);
  131. GIO_AVAILABLE_IN_2_50
  132. gboolean g_vfs_register_uri_scheme (GVfs *vfs,
  133. const char *scheme,
  134. GVfsFileLookupFunc uri_func,
  135. gpointer uri_data,
  136. GDestroyNotify uri_destroy,
  137. GVfsFileLookupFunc parse_name_func,
  138. gpointer parse_name_data,
  139. GDestroyNotify parse_name_destroy);
  140. GIO_AVAILABLE_IN_2_50
  141. gboolean g_vfs_unregister_uri_scheme (GVfs *vfs,
  142. const char *scheme);
  143. G_END_DECLS
  144. #endif /* __G_VFS_H__ */