docs: Add GIOModuleScope and GIOModuleScopeFlags
[glib.git] / gio / gmount.h
blob131d45156837e7ddff594ed425f966e008fa5b00
1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2006-2008 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 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, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: Alexander Larsson <alexl@redhat.com>
21 * David Zeuthen <davidz@redhat.com>
24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
26 #endif
28 #ifndef __G_MOUNT_H__
29 #define __G_MOUNT_H__
31 #include <gio/giotypes.h>
33 G_BEGIN_DECLS
35 #define G_TYPE_MOUNT (g_mount_get_type ())
36 #define G_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_MOUNT, GMount))
37 #define G_IS_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_MOUNT))
38 #define G_MOUNT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_MOUNT, GMountIface))
40 typedef struct _GMountIface GMountIface;
42 /**
43 * GMountIface:
44 * @g_iface: The parent interface.
45 * @changed: Changed signal that is emitted when the mount's state has changed.
46 * @unmounted: The unmounted signal that is emitted when the #GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.
47 * @pre_unmount: The ::pre-unmount signal that is emitted when the #GMount will soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file.
48 * @get_root: Gets a #GFile to the root directory of the #GMount.
49 * @get_name: Gets a string containing the name of the #GMount.
50 * @get_icon: Gets a #GIcon for the #GMount.
51 * @get_uuid: Gets the UUID for the #GMount. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns %NULL if there is no UUID available.
52 * @get_volume: Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.
53 * @get_drive: Gets a #GDrive the volume of the mount is located on. Returns %NULL if the #GMount is not associated with a #GDrive or a #GVolume. This is convenience method for getting the #GVolume and using that to get the #GDrive.
54 * @can_unmount: Checks if a #GMount can be unmounted.
55 * @can_eject: Checks if a #GMount can be ejected.
56 * @unmount: Starts unmounting a #GMount.
57 * @unmount_finish: Finishes an unmounting operation.
58 * @eject: Starts ejecting a #GMount.
59 * @eject_finish: Finishes an eject operation.
60 * @remount: Starts remounting a #GMount.
61 * @remount_finish: Finishes a remounting operation.
62 * @guess_content_type: Starts guessing the type of the content of a #GMount.
63 * See g_mount_guess_content_type() for more information on content
64 * type guessing. This operation was added in 2.18.
65 * @guess_content_type_finish: Finishes a content type guessing operation. Added in 2.18.
66 * @guess_content_type_sync: Synchronous variant of @guess_content_type. Added in 2.18
67 * @unmount_with_operation: Starts unmounting a #GMount using a #GMountOperation. Since 2.22.
68 * @unmount_with_operation_finish: Finishes an unmounting operation using a #GMountOperation. Since 2.22.
69 * @eject_with_operation: Starts ejecting a #GMount using a #GMountOperation. Since 2.22.
70 * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
71 * @get_default_location: Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24.
72 * @get_sort_key: Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32.
74 * Interface for implementing operations for mounts.
75 **/
76 struct _GMountIface
78 GTypeInterface g_iface;
80 /* signals */
82 void (* changed) (GMount *mount);
83 void (* unmounted) (GMount *mount);
85 /* Virtual Table */
87 GFile * (* get_root) (GMount *mount);
88 char * (* get_name) (GMount *mount);
89 GIcon * (* get_icon) (GMount *mount);
90 char * (* get_uuid) (GMount *mount);
91 GVolume * (* get_volume) (GMount *mount);
92 GDrive * (* get_drive) (GMount *mount);
93 gboolean (* can_unmount) (GMount *mount);
94 gboolean (* can_eject) (GMount *mount);
96 void (* unmount) (GMount *mount,
97 GMountUnmountFlags flags,
98 GCancellable *cancellable,
99 GAsyncReadyCallback callback,
100 gpointer user_data);
101 gboolean (* unmount_finish) (GMount *mount,
102 GAsyncResult *result,
103 GError **error);
105 void (* eject) (GMount *mount,
106 GMountUnmountFlags flags,
107 GCancellable *cancellable,
108 GAsyncReadyCallback callback,
109 gpointer user_data);
110 gboolean (* eject_finish) (GMount *mount,
111 GAsyncResult *result,
112 GError **error);
114 void (* remount) (GMount *mount,
115 GMountMountFlags flags,
116 GMountOperation *mount_operation,
117 GCancellable *cancellable,
118 GAsyncReadyCallback callback,
119 gpointer user_data);
120 gboolean (* remount_finish) (GMount *mount,
121 GAsyncResult *result,
122 GError **error);
124 void (* guess_content_type) (GMount *mount,
125 gboolean force_rescan,
126 GCancellable *cancellable,
127 GAsyncReadyCallback callback,
128 gpointer user_data);
129 gchar ** (* guess_content_type_finish) (GMount *mount,
130 GAsyncResult *result,
131 GError **error);
132 gchar ** (* guess_content_type_sync) (GMount *mount,
133 gboolean force_rescan,
134 GCancellable *cancellable,
135 GError **error);
137 /* Signal, not VFunc */
138 void (* pre_unmount) (GMount *mount);
140 void (* unmount_with_operation) (GMount *mount,
141 GMountUnmountFlags flags,
142 GMountOperation *mount_operation,
143 GCancellable *cancellable,
144 GAsyncReadyCallback callback,
145 gpointer user_data);
146 gboolean (* unmount_with_operation_finish) (GMount *mount,
147 GAsyncResult *result,
148 GError **error);
150 void (* eject_with_operation) (GMount *mount,
151 GMountUnmountFlags flags,
152 GMountOperation *mount_operation,
153 GCancellable *cancellable,
154 GAsyncReadyCallback callback,
155 gpointer user_data);
156 gboolean (* eject_with_operation_finish) (GMount *mount,
157 GAsyncResult *result,
158 GError **error);
159 GFile * (* get_default_location) (GMount *mount);
161 const gchar * (* get_sort_key) (GMount *mount);
164 GType g_mount_get_type (void) G_GNUC_CONST;
166 GFile * g_mount_get_root (GMount *mount);
167 GFile * g_mount_get_default_location (GMount *mount);
168 char * g_mount_get_name (GMount *mount);
169 GIcon * g_mount_get_icon (GMount *mount);
170 char * g_mount_get_uuid (GMount *mount);
171 GVolume * g_mount_get_volume (GMount *mount);
172 GDrive * g_mount_get_drive (GMount *mount);
173 gboolean g_mount_can_unmount (GMount *mount);
174 gboolean g_mount_can_eject (GMount *mount);
176 GLIB_DEPRECATED_FOR(g_mount_unmount_with_operation)
177 void g_mount_unmount (GMount *mount,
178 GMountUnmountFlags flags,
179 GCancellable *cancellable,
180 GAsyncReadyCallback callback,
181 gpointer user_data);
183 GLIB_DEPRECATED_FOR(g_mount_unmount_with_operation_finish)
184 gboolean g_mount_unmount_finish (GMount *mount,
185 GAsyncResult *result,
186 GError **error);
188 GLIB_DEPRECATED_FOR(g_mount_eject_with_operation)
189 void g_mount_eject (GMount *mount,
190 GMountUnmountFlags flags,
191 GCancellable *cancellable,
192 GAsyncReadyCallback callback,
193 gpointer user_data);
195 GLIB_DEPRECATED_FOR(g_mount_eject_with_operation_finish)
196 gboolean g_mount_eject_finish (GMount *mount,
197 GAsyncResult *result,
198 GError **error);
200 void g_mount_remount (GMount *mount,
201 GMountMountFlags flags,
202 GMountOperation *mount_operation,
203 GCancellable *cancellable,
204 GAsyncReadyCallback callback,
205 gpointer user_data);
206 gboolean g_mount_remount_finish (GMount *mount,
207 GAsyncResult *result,
208 GError **error);
210 void g_mount_guess_content_type (GMount *mount,
211 gboolean force_rescan,
212 GCancellable *cancellable,
213 GAsyncReadyCallback callback,
214 gpointer user_data);
215 gchar ** g_mount_guess_content_type_finish (GMount *mount,
216 GAsyncResult *result,
217 GError **error);
218 gchar ** g_mount_guess_content_type_sync (GMount *mount,
219 gboolean force_rescan,
220 GCancellable *cancellable,
221 GError **error);
223 gboolean g_mount_is_shadowed (GMount *mount);
224 void g_mount_shadow (GMount *mount);
225 void g_mount_unshadow (GMount *mount);
227 void g_mount_unmount_with_operation (GMount *mount,
228 GMountUnmountFlags flags,
229 GMountOperation *mount_operation,
230 GCancellable *cancellable,
231 GAsyncReadyCallback callback,
232 gpointer user_data);
233 gboolean g_mount_unmount_with_operation_finish (GMount *mount,
234 GAsyncResult *result,
235 GError **error);
237 void g_mount_eject_with_operation (GMount *mount,
238 GMountUnmountFlags flags,
239 GMountOperation *mount_operation,
240 GCancellable *cancellable,
241 GAsyncReadyCallback callback,
242 gpointer user_data);
243 gboolean g_mount_eject_with_operation_finish (GMount *mount,
244 GAsyncResult *result,
245 GError **error);
247 const gchar *g_mount_get_sort_key (GMount *mount);
249 G_END_DECLS
251 #endif /* __G_MOUNT_H__ */