gvfs.h 6.5 KB

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