Merge branch 'test-ip_mreq_source-android-only' into 'master'
[glib.git] / gio / gmount.h
blobc376a6135ae103a541cb1acfd8076915d97e33b0
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.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>
19 * David Zeuthen <davidz@redhat.com>
22 #ifndef __G_MOUNT_H__
23 #define __G_MOUNT_H__
25 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
26 #error "Only <gio/gio.h> can be included directly."
27 #endif
29 #include <gio/giotypes.h>
31 G_BEGIN_DECLS
33 #define G_TYPE_MOUNT (g_mount_get_type ())
34 #define G_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_MOUNT, GMount))
35 #define G_IS_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_MOUNT))
36 #define G_MOUNT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_MOUNT, GMountIface))
38 typedef struct _GMountIface GMountIface;
40 /**
41 * GMountIface:
42 * @g_iface: The parent interface.
43 * @changed: Changed signal that is emitted when the mount's state has changed.
44 * @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.
45 * @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.
46 * @get_root: Gets a #GFile to the root directory of the #GMount.
47 * @get_name: Gets a string containing the name of the #GMount.
48 * @get_icon: Gets a #GIcon for the #GMount.
49 * @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.
50 * @get_volume: Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.
51 * @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.
52 * @can_unmount: Checks if a #GMount can be unmounted.
53 * @can_eject: Checks if a #GMount can be ejected.
54 * @unmount: Starts unmounting a #GMount.
55 * @unmount_finish: Finishes an unmounting operation.
56 * @eject: Starts ejecting a #GMount.
57 * @eject_finish: Finishes an eject operation.
58 * @remount: Starts remounting a #GMount.
59 * @remount_finish: Finishes a remounting operation.
60 * @guess_content_type: Starts guessing the type of the content of a #GMount.
61 * See g_mount_guess_content_type() for more information on content
62 * type guessing. This operation was added in 2.18.
63 * @guess_content_type_finish: Finishes a content type guessing operation. Added in 2.18.
64 * @guess_content_type_sync: Synchronous variant of @guess_content_type. Added in 2.18
65 * @unmount_with_operation: Starts unmounting a #GMount using a #GMountOperation. Since 2.22.
66 * @unmount_with_operation_finish: Finishes an unmounting operation using a #GMountOperation. Since 2.22.
67 * @eject_with_operation: Starts ejecting a #GMount using a #GMountOperation. Since 2.22.
68 * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
69 * @get_default_location: Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24.
70 * @get_sort_key: Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32.
71 * @get_symbolic_icon: Gets a symbolic #GIcon for the #GMount. Since 2.34.
73 * Interface for implementing operations for mounts.
74 **/
75 struct _GMountIface
77 GTypeInterface g_iface;
79 /* signals */
81 void (* changed) (GMount *mount);
82 void (* unmounted) (GMount *mount);
84 /* Virtual Table */
86 GFile * (* get_root) (GMount *mount);
87 char * (* get_name) (GMount *mount);
88 GIcon * (* get_icon) (GMount *mount);
89 char * (* get_uuid) (GMount *mount);
90 GVolume * (* get_volume) (GMount *mount);
91 GDrive * (* get_drive) (GMount *mount);
92 gboolean (* can_unmount) (GMount *mount);
93 gboolean (* can_eject) (GMount *mount);
95 void (* unmount) (GMount *mount,
96 GMountUnmountFlags flags,
97 GCancellable *cancellable,
98 GAsyncReadyCallback callback,
99 gpointer user_data);
100 gboolean (* unmount_finish) (GMount *mount,
101 GAsyncResult *result,
102 GError **error);
104 void (* eject) (GMount *mount,
105 GMountUnmountFlags flags,
106 GCancellable *cancellable,
107 GAsyncReadyCallback callback,
108 gpointer user_data);
109 gboolean (* eject_finish) (GMount *mount,
110 GAsyncResult *result,
111 GError **error);
113 void (* remount) (GMount *mount,
114 GMountMountFlags flags,
115 GMountOperation *mount_operation,
116 GCancellable *cancellable,
117 GAsyncReadyCallback callback,
118 gpointer user_data);
119 gboolean (* remount_finish) (GMount *mount,
120 GAsyncResult *result,
121 GError **error);
123 void (* guess_content_type) (GMount *mount,
124 gboolean force_rescan,
125 GCancellable *cancellable,
126 GAsyncReadyCallback callback,
127 gpointer user_data);
128 gchar ** (* guess_content_type_finish) (GMount *mount,
129 GAsyncResult *result,
130 GError **error);
131 gchar ** (* guess_content_type_sync) (GMount *mount,
132 gboolean force_rescan,
133 GCancellable *cancellable,
134 GError **error);
136 /* Signal, not VFunc */
137 void (* pre_unmount) (GMount *mount);
139 void (* unmount_with_operation) (GMount *mount,
140 GMountUnmountFlags flags,
141 GMountOperation *mount_operation,
142 GCancellable *cancellable,
143 GAsyncReadyCallback callback,
144 gpointer user_data);
145 gboolean (* unmount_with_operation_finish) (GMount *mount,
146 GAsyncResult *result,
147 GError **error);
149 void (* eject_with_operation) (GMount *mount,
150 GMountUnmountFlags flags,
151 GMountOperation *mount_operation,
152 GCancellable *cancellable,
153 GAsyncReadyCallback callback,
154 gpointer user_data);
155 gboolean (* eject_with_operation_finish) (GMount *mount,
156 GAsyncResult *result,
157 GError **error);
158 GFile * (* get_default_location) (GMount *mount);
160 const gchar * (* get_sort_key) (GMount *mount);
161 GIcon * (* get_symbolic_icon) (GMount *mount);
164 GLIB_AVAILABLE_IN_ALL
165 GType g_mount_get_type (void) G_GNUC_CONST;
167 GLIB_AVAILABLE_IN_ALL
168 GFile * g_mount_get_root (GMount *mount);
169 GLIB_AVAILABLE_IN_ALL
170 GFile * g_mount_get_default_location (GMount *mount);
171 GLIB_AVAILABLE_IN_ALL
172 char * g_mount_get_name (GMount *mount);
173 GLIB_AVAILABLE_IN_ALL
174 GIcon * g_mount_get_icon (GMount *mount);
175 GLIB_AVAILABLE_IN_ALL
176 GIcon * g_mount_get_symbolic_icon (GMount *mount);
177 GLIB_AVAILABLE_IN_ALL
178 char * g_mount_get_uuid (GMount *mount);
179 GLIB_AVAILABLE_IN_ALL
180 GVolume * g_mount_get_volume (GMount *mount);
181 GLIB_AVAILABLE_IN_ALL
182 GDrive * g_mount_get_drive (GMount *mount);
183 GLIB_AVAILABLE_IN_ALL
184 gboolean g_mount_can_unmount (GMount *mount);
185 GLIB_AVAILABLE_IN_ALL
186 gboolean g_mount_can_eject (GMount *mount);
188 GLIB_DEPRECATED_FOR(g_mount_unmount_with_operation)
189 void g_mount_unmount (GMount *mount,
190 GMountUnmountFlags flags,
191 GCancellable *cancellable,
192 GAsyncReadyCallback callback,
193 gpointer user_data);
195 GLIB_DEPRECATED_FOR(g_mount_unmount_with_operation_finish)
196 gboolean g_mount_unmount_finish (GMount *mount,
197 GAsyncResult *result,
198 GError **error);
200 GLIB_DEPRECATED_FOR(g_mount_eject_with_operation)
201 void g_mount_eject (GMount *mount,
202 GMountUnmountFlags flags,
203 GCancellable *cancellable,
204 GAsyncReadyCallback callback,
205 gpointer user_data);
207 GLIB_DEPRECATED_FOR(g_mount_eject_with_operation_finish)
208 gboolean g_mount_eject_finish (GMount *mount,
209 GAsyncResult *result,
210 GError **error);
212 GLIB_AVAILABLE_IN_ALL
213 void g_mount_remount (GMount *mount,
214 GMountMountFlags flags,
215 GMountOperation *mount_operation,
216 GCancellable *cancellable,
217 GAsyncReadyCallback callback,
218 gpointer user_data);
219 GLIB_AVAILABLE_IN_ALL
220 gboolean g_mount_remount_finish (GMount *mount,
221 GAsyncResult *result,
222 GError **error);
224 GLIB_AVAILABLE_IN_ALL
225 void g_mount_guess_content_type (GMount *mount,
226 gboolean force_rescan,
227 GCancellable *cancellable,
228 GAsyncReadyCallback callback,
229 gpointer user_data);
230 GLIB_AVAILABLE_IN_ALL
231 gchar ** g_mount_guess_content_type_finish (GMount *mount,
232 GAsyncResult *result,
233 GError **error);
234 GLIB_AVAILABLE_IN_ALL
235 gchar ** g_mount_guess_content_type_sync (GMount *mount,
236 gboolean force_rescan,
237 GCancellable *cancellable,
238 GError **error);
240 GLIB_AVAILABLE_IN_ALL
241 gboolean g_mount_is_shadowed (GMount *mount);
242 GLIB_AVAILABLE_IN_ALL
243 void g_mount_shadow (GMount *mount);
244 GLIB_AVAILABLE_IN_ALL
245 void g_mount_unshadow (GMount *mount);
247 GLIB_AVAILABLE_IN_ALL
248 void g_mount_unmount_with_operation (GMount *mount,
249 GMountUnmountFlags flags,
250 GMountOperation *mount_operation,
251 GCancellable *cancellable,
252 GAsyncReadyCallback callback,
253 gpointer user_data);
254 GLIB_AVAILABLE_IN_ALL
255 gboolean g_mount_unmount_with_operation_finish (GMount *mount,
256 GAsyncResult *result,
257 GError **error);
259 GLIB_AVAILABLE_IN_ALL
260 void g_mount_eject_with_operation (GMount *mount,
261 GMountUnmountFlags flags,
262 GMountOperation *mount_operation,
263 GCancellable *cancellable,
264 GAsyncReadyCallback callback,
265 gpointer user_data);
266 GLIB_AVAILABLE_IN_ALL
267 gboolean g_mount_eject_with_operation_finish (GMount *mount,
268 GAsyncResult *result,
269 GError **error);
271 GLIB_AVAILABLE_IN_ALL
272 const gchar *g_mount_get_sort_key (GMount *mount);
274 G_END_DECLS
276 #endif /* __G_MOUNT_H__ */