tests: only chmod autorun.exe on UNIX
[glib.git] / gio / gdrive.h
blob451e417f929e9698a16a1ff65c6bb92d72119535
1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2006-2007 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, see <http://www.gnu.org/licenses/>.
18 * Author: Alexander Larsson <alexl@redhat.com>
19 * David Zeuthen <davidz@redhat.com>
22 #ifndef __G_DRIVE_H__
23 #define __G_DRIVE_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_DRIVE (g_drive_get_type ())
34 #define G_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DRIVE, GDrive))
35 #define G_IS_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DRIVE))
36 #define G_DRIVE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DRIVE, GDriveIface))
38 /**
39 * GDriveIface:
40 * @g_iface: The parent interface.
41 * @changed: Signal emitted when the drive is changed.
42 * @disconnected: The removed signal that is emitted when the #GDrive have been disconnected. If the recipient is holding references to the object they should release them so the object can be finalized.
43 * @eject_button: Signal emitted when the physical eject button (if any) of a drive have been pressed.
44 * @get_name: Returns the name for the given #GDrive.
45 * @get_icon: Returns a #GIcon for the given #GDrive.
46 * @has_volumes: Returns %TRUE if the #GDrive has mountable volumes.
47 * @get_volumes: Returns a list #GList of #GVolume for the #GDrive.
48 * @is_media_removable: Returns %TRUE if the #GDrive supports removal and insertion of media.
49 * @has_media: Returns %TRUE if the #GDrive has media inserted.
50 * @is_media_check_automatic: Returns %TRUE if the #GDrive is capabable of automatically detecting media changes.
51 * @can_poll_for_media: Returns %TRUE if the #GDrive is capable of manually polling for media change.
52 * @can_eject: Returns %TRUE if the #GDrive can eject media.
53 * @eject: Ejects a #GDrive.
54 * @eject_finish: Finishes an eject operation.
55 * @poll_for_media: Poll for media insertion/removal on a #GDrive.
56 * @poll_for_media_finish: Finishes a media poll operation.
57 * @get_identifier: Returns the identifier of the given kind, or %NULL if
58 * the #GDrive doesn't have one.
59 * @enumerate_identifiers: Returns an array strings listing the kinds
60 * of identifiers which the #GDrive has.
61 * @get_start_stop_type: Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.
62 * @can_stop: Returns %TRUE if a #GDrive can be stopped. Since 2.22.
63 * @stop: Stops a #GDrive. Since 2.22.
64 * @stop_finish: Finishes a stop operation. Since 2.22.
65 * @can_start: Returns %TRUE if a #GDrive can be started. Since 2.22.
66 * @can_start_degraded: Returns %TRUE if a #GDrive can be started degraded. Since 2.22.
67 * @start: Starts a #GDrive. Since 2.22.
68 * @start_finish: Finishes a start operation. Since 2.22.
69 * @stop_button: Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.
70 * @eject_with_operation: Starts ejecting a #GDrive using a #GMountOperation. Since 2.22.
71 * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
72 * @get_sort_key: Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32.
73 * @get_symbolic_icon: Returns a symbolic #GIcon for the given #GDrive. Since 2.34.
75 * Interface for creating #GDrive implementations.
77 typedef struct _GDriveIface GDriveIface;
79 struct _GDriveIface
81 GTypeInterface g_iface;
83 /* signals */
84 void (* changed) (GDrive *drive);
85 void (* disconnected) (GDrive *drive);
86 void (* eject_button) (GDrive *drive);
88 /* Virtual Table */
89 char * (* get_name) (GDrive *drive);
90 GIcon * (* get_icon) (GDrive *drive);
91 gboolean (* has_volumes) (GDrive *drive);
92 GList * (* get_volumes) (GDrive *drive);
93 gboolean (* is_media_removable) (GDrive *drive);
94 gboolean (* has_media) (GDrive *drive);
95 gboolean (* is_media_check_automatic) (GDrive *drive);
96 gboolean (* can_eject) (GDrive *drive);
97 gboolean (* can_poll_for_media) (GDrive *drive);
98 void (* eject) (GDrive *drive,
99 GMountUnmountFlags flags,
100 GCancellable *cancellable,
101 GAsyncReadyCallback callback,
102 gpointer user_data);
103 gboolean (* eject_finish) (GDrive *drive,
104 GAsyncResult *result,
105 GError **error);
106 void (* poll_for_media) (GDrive *drive,
107 GCancellable *cancellable,
108 GAsyncReadyCallback callback,
109 gpointer user_data);
110 gboolean (* poll_for_media_finish) (GDrive *drive,
111 GAsyncResult *result,
112 GError **error);
114 char * (* get_identifier) (GDrive *drive,
115 const char *kind);
116 char ** (* enumerate_identifiers) (GDrive *drive);
118 GDriveStartStopType (* get_start_stop_type) (GDrive *drive);
120 gboolean (* can_start) (GDrive *drive);
121 gboolean (* can_start_degraded) (GDrive *drive);
122 void (* start) (GDrive *drive,
123 GDriveStartFlags flags,
124 GMountOperation *mount_operation,
125 GCancellable *cancellable,
126 GAsyncReadyCallback callback,
127 gpointer user_data);
128 gboolean (* start_finish) (GDrive *drive,
129 GAsyncResult *result,
130 GError **error);
132 gboolean (* can_stop) (GDrive *drive);
133 void (* stop) (GDrive *drive,
134 GMountUnmountFlags flags,
135 GMountOperation *mount_operation,
136 GCancellable *cancellable,
137 GAsyncReadyCallback callback,
138 gpointer user_data);
139 gboolean (* stop_finish) (GDrive *drive,
140 GAsyncResult *result,
141 GError **error);
142 /* signal, not VFunc */
143 void (* stop_button) (GDrive *drive);
145 void (* eject_with_operation) (GDrive *drive,
146 GMountUnmountFlags flags,
147 GMountOperation *mount_operation,
148 GCancellable *cancellable,
149 GAsyncReadyCallback callback,
150 gpointer user_data);
151 gboolean (* eject_with_operation_finish) (GDrive *drive,
152 GAsyncResult *result,
153 GError **error);
155 const gchar * (* get_sort_key) (GDrive *drive);
156 GIcon * (* get_symbolic_icon) (GDrive *drive);
160 GLIB_AVAILABLE_IN_ALL
161 GType g_drive_get_type (void) G_GNUC_CONST;
163 GLIB_AVAILABLE_IN_ALL
164 char * g_drive_get_name (GDrive *drive);
165 GLIB_AVAILABLE_IN_ALL
166 GIcon * g_drive_get_icon (GDrive *drive);
167 GLIB_AVAILABLE_IN_ALL
168 GIcon * g_drive_get_symbolic_icon (GDrive *drive);
169 GLIB_AVAILABLE_IN_ALL
170 gboolean g_drive_has_volumes (GDrive *drive);
171 GLIB_AVAILABLE_IN_ALL
172 GList * g_drive_get_volumes (GDrive *drive);
173 GLIB_AVAILABLE_IN_ALL
174 gboolean g_drive_is_media_removable (GDrive *drive);
175 GLIB_AVAILABLE_IN_ALL
176 gboolean g_drive_has_media (GDrive *drive);
177 GLIB_AVAILABLE_IN_ALL
178 gboolean g_drive_is_media_check_automatic (GDrive *drive);
179 GLIB_AVAILABLE_IN_ALL
180 gboolean g_drive_can_poll_for_media (GDrive *drive);
181 GLIB_AVAILABLE_IN_ALL
182 gboolean g_drive_can_eject (GDrive *drive);
183 GLIB_DEPRECATED_FOR(g_drive_eject_with_operation)
184 void g_drive_eject (GDrive *drive,
185 GMountUnmountFlags flags,
186 GCancellable *cancellable,
187 GAsyncReadyCallback callback,
188 gpointer user_data);
190 GLIB_DEPRECATED_FOR(g_drive_eject_with_operation_finish)
191 gboolean g_drive_eject_finish (GDrive *drive,
192 GAsyncResult *result,
193 GError **error);
194 GLIB_AVAILABLE_IN_ALL
195 void g_drive_poll_for_media (GDrive *drive,
196 GCancellable *cancellable,
197 GAsyncReadyCallback callback,
198 gpointer user_data);
199 GLIB_AVAILABLE_IN_ALL
200 gboolean g_drive_poll_for_media_finish (GDrive *drive,
201 GAsyncResult *result,
202 GError **error);
203 GLIB_AVAILABLE_IN_ALL
204 char * g_drive_get_identifier (GDrive *drive,
205 const char *kind);
206 GLIB_AVAILABLE_IN_ALL
207 char ** g_drive_enumerate_identifiers (GDrive *drive);
209 GLIB_AVAILABLE_IN_ALL
210 GDriveStartStopType g_drive_get_start_stop_type (GDrive *drive);
212 GLIB_AVAILABLE_IN_ALL
213 gboolean g_drive_can_start (GDrive *drive);
214 GLIB_AVAILABLE_IN_ALL
215 gboolean g_drive_can_start_degraded (GDrive *drive);
216 GLIB_AVAILABLE_IN_ALL
217 void g_drive_start (GDrive *drive,
218 GDriveStartFlags flags,
219 GMountOperation *mount_operation,
220 GCancellable *cancellable,
221 GAsyncReadyCallback callback,
222 gpointer user_data);
223 GLIB_AVAILABLE_IN_ALL
224 gboolean g_drive_start_finish (GDrive *drive,
225 GAsyncResult *result,
226 GError **error);
228 GLIB_AVAILABLE_IN_ALL
229 gboolean g_drive_can_stop (GDrive *drive);
230 GLIB_AVAILABLE_IN_ALL
231 void g_drive_stop (GDrive *drive,
232 GMountUnmountFlags flags,
233 GMountOperation *mount_operation,
234 GCancellable *cancellable,
235 GAsyncReadyCallback callback,
236 gpointer user_data);
237 GLIB_AVAILABLE_IN_ALL
238 gboolean g_drive_stop_finish (GDrive *drive,
239 GAsyncResult *result,
240 GError **error);
242 GLIB_AVAILABLE_IN_ALL
243 void g_drive_eject_with_operation (GDrive *drive,
244 GMountUnmountFlags flags,
245 GMountOperation *mount_operation,
246 GCancellable *cancellable,
247 GAsyncReadyCallback callback,
248 gpointer user_data);
249 GLIB_AVAILABLE_IN_ALL
250 gboolean g_drive_eject_with_operation_finish (GDrive *drive,
251 GAsyncResult *result,
252 GError **error);
254 GLIB_AVAILABLE_IN_2_32
255 const gchar *g_drive_get_sort_key (GDrive *drive);
257 G_END_DECLS
259 #endif /* __G_DRIVE_H__ */