glib/tests: Fix non-debug build of slice test
[glib.git] / gio / gdrive.h
blob13c02ae1f3671ae611bdbd9592277afeae7fda86
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, 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 #ifndef __G_DRIVE_H__
25 #define __G_DRIVE_H__
27 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
28 #error "Only <gio/gio.h> can be included directly."
29 #endif
31 #include <gio/giotypes.h>
33 G_BEGIN_DECLS
35 #define G_TYPE_DRIVE (g_drive_get_type ())
36 #define G_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DRIVE, GDrive))
37 #define G_IS_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DRIVE))
38 #define G_DRIVE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DRIVE, GDriveIface))
40 /**
41 * GDriveIface:
42 * @g_iface: The parent interface.
43 * @changed: Signal emitted when the drive is changed.
44 * @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.
45 * @eject_button: Signal emitted when the physical eject button (if any) of a drive have been pressed.
46 * @get_name: Returns the name for the given #GDrive.
47 * @get_icon: Returns a #GIcon for the given #GDrive.
48 * @has_volumes: Returns %TRUE if the #GDrive has mountable volumes.
49 * @get_volumes: Returns a list #GList of #GVolume for the #GDrive.
50 * @is_media_removable: Returns %TRUE if the #GDrive supports removal and insertion of media.
51 * @has_media: Returns %TRUE if the #GDrive has media inserted.
52 * @is_media_check_automatic: Returns %TRUE if the #GDrive is capabable of automatically detecting media changes.
53 * @can_poll_for_media: Returns %TRUE if the #GDrive is capable of manually polling for media change.
54 * @can_eject: Returns %TRUE if the #GDrive can eject media.
55 * @eject: Ejects a #GDrive.
56 * @eject_finish: Finishes an eject operation.
57 * @poll_for_media: Poll for media insertion/removal on a #GDrive.
58 * @poll_for_media_finish: Finishes a media poll operation.
59 * @get_identifier: Returns the identifier of the given kind, or %NULL if
60 * the #GDrive doesn't have one.
61 * @enumerate_identifiers: Returns an array strings listing the kinds
62 * of identifiers which the #GDrive has.
63 * @get_start_stop_type: Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.
64 * @can_stop: Returns %TRUE if a #GDrive can be stopped. Since 2.22.
65 * @stop: Stops a #GDrive. Since 2.22.
66 * @stop_finish: Finishes a stop operation. Since 2.22.
67 * @can_start: Returns %TRUE if a #GDrive can be started. Since 2.22.
68 * @can_start_degraded: Returns %TRUE if a #GDrive can be started degraded. Since 2.22.
69 * @start: Starts a #GDrive. Since 2.22.
70 * @start_finish: Finishes a start operation. Since 2.22.
71 * @stop_button: Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.
72 * @eject_with_operation: Starts ejecting a #GDrive using a #GMountOperation. Since 2.22.
73 * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
74 * @get_sort_key: Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32.
75 * @get_symbolic_icon: Returns a symbolic #GIcon for the given #GDrive. Since 2.34.
77 * Interface for creating #GDrive implementations.
79 typedef struct _GDriveIface GDriveIface;
81 struct _GDriveIface
83 GTypeInterface g_iface;
85 /* signals */
86 void (* changed) (GDrive *drive);
87 void (* disconnected) (GDrive *drive);
88 void (* eject_button) (GDrive *drive);
90 /* Virtual Table */
91 char * (* get_name) (GDrive *drive);
92 GIcon * (* get_icon) (GDrive *drive);
93 gboolean (* has_volumes) (GDrive *drive);
94 GList * (* get_volumes) (GDrive *drive);
95 gboolean (* is_media_removable) (GDrive *drive);
96 gboolean (* has_media) (GDrive *drive);
97 gboolean (* is_media_check_automatic) (GDrive *drive);
98 gboolean (* can_eject) (GDrive *drive);
99 gboolean (* can_poll_for_media) (GDrive *drive);
100 void (* eject) (GDrive *drive,
101 GMountUnmountFlags flags,
102 GCancellable *cancellable,
103 GAsyncReadyCallback callback,
104 gpointer user_data);
105 gboolean (* eject_finish) (GDrive *drive,
106 GAsyncResult *result,
107 GError **error);
108 void (* poll_for_media) (GDrive *drive,
109 GCancellable *cancellable,
110 GAsyncReadyCallback callback,
111 gpointer user_data);
112 gboolean (* poll_for_media_finish) (GDrive *drive,
113 GAsyncResult *result,
114 GError **error);
116 char * (* get_identifier) (GDrive *drive,
117 const char *kind);
118 char ** (* enumerate_identifiers) (GDrive *drive);
120 GDriveStartStopType (* get_start_stop_type) (GDrive *drive);
122 gboolean (* can_start) (GDrive *drive);
123 gboolean (* can_start_degraded) (GDrive *drive);
124 void (* start) (GDrive *drive,
125 GDriveStartFlags flags,
126 GMountOperation *mount_operation,
127 GCancellable *cancellable,
128 GAsyncReadyCallback callback,
129 gpointer user_data);
130 gboolean (* start_finish) (GDrive *drive,
131 GAsyncResult *result,
132 GError **error);
134 gboolean (* can_stop) (GDrive *drive);
135 void (* stop) (GDrive *drive,
136 GMountUnmountFlags flags,
137 GMountOperation *mount_operation,
138 GCancellable *cancellable,
139 GAsyncReadyCallback callback,
140 gpointer user_data);
141 gboolean (* stop_finish) (GDrive *drive,
142 GAsyncResult *result,
143 GError **error);
144 /* signal, not VFunc */
145 void (* stop_button) (GDrive *drive);
147 void (* eject_with_operation) (GDrive *drive,
148 GMountUnmountFlags flags,
149 GMountOperation *mount_operation,
150 GCancellable *cancellable,
151 GAsyncReadyCallback callback,
152 gpointer user_data);
153 gboolean (* eject_with_operation_finish) (GDrive *drive,
154 GAsyncResult *result,
155 GError **error);
157 const gchar * (* get_sort_key) (GDrive *drive);
158 GIcon * (* get_symbolic_icon) (GDrive *drive);
162 GLIB_AVAILABLE_IN_ALL
163 GType g_drive_get_type (void) G_GNUC_CONST;
165 GLIB_AVAILABLE_IN_ALL
166 char * g_drive_get_name (GDrive *drive);
167 GLIB_AVAILABLE_IN_ALL
168 GIcon * g_drive_get_icon (GDrive *drive);
169 GLIB_AVAILABLE_IN_ALL
170 GIcon * g_drive_get_symbolic_icon (GDrive *drive);
171 GLIB_AVAILABLE_IN_ALL
172 gboolean g_drive_has_volumes (GDrive *drive);
173 GLIB_AVAILABLE_IN_ALL
174 GList * g_drive_get_volumes (GDrive *drive);
175 GLIB_AVAILABLE_IN_ALL
176 gboolean g_drive_is_media_removable (GDrive *drive);
177 GLIB_AVAILABLE_IN_ALL
178 gboolean g_drive_has_media (GDrive *drive);
179 GLIB_AVAILABLE_IN_ALL
180 gboolean g_drive_is_media_check_automatic (GDrive *drive);
181 GLIB_AVAILABLE_IN_ALL
182 gboolean g_drive_can_poll_for_media (GDrive *drive);
183 GLIB_AVAILABLE_IN_ALL
184 gboolean g_drive_can_eject (GDrive *drive);
185 GLIB_DEPRECATED_FOR(g_drive_eject_with_operation)
186 void g_drive_eject (GDrive *drive,
187 GMountUnmountFlags flags,
188 GCancellable *cancellable,
189 GAsyncReadyCallback callback,
190 gpointer user_data);
192 GLIB_DEPRECATED_FOR(g_drive_eject_with_operation_finish)
193 gboolean g_drive_eject_finish (GDrive *drive,
194 GAsyncResult *result,
195 GError **error);
196 GLIB_AVAILABLE_IN_ALL
197 void g_drive_poll_for_media (GDrive *drive,
198 GCancellable *cancellable,
199 GAsyncReadyCallback callback,
200 gpointer user_data);
201 GLIB_AVAILABLE_IN_ALL
202 gboolean g_drive_poll_for_media_finish (GDrive *drive,
203 GAsyncResult *result,
204 GError **error);
205 GLIB_AVAILABLE_IN_ALL
206 char * g_drive_get_identifier (GDrive *drive,
207 const char *kind);
208 GLIB_AVAILABLE_IN_ALL
209 char ** g_drive_enumerate_identifiers (GDrive *drive);
211 GLIB_AVAILABLE_IN_ALL
212 GDriveStartStopType g_drive_get_start_stop_type (GDrive *drive);
214 GLIB_AVAILABLE_IN_ALL
215 gboolean g_drive_can_start (GDrive *drive);
216 GLIB_AVAILABLE_IN_ALL
217 gboolean g_drive_can_start_degraded (GDrive *drive);
218 GLIB_AVAILABLE_IN_ALL
219 void g_drive_start (GDrive *drive,
220 GDriveStartFlags flags,
221 GMountOperation *mount_operation,
222 GCancellable *cancellable,
223 GAsyncReadyCallback callback,
224 gpointer user_data);
225 GLIB_AVAILABLE_IN_ALL
226 gboolean g_drive_start_finish (GDrive *drive,
227 GAsyncResult *result,
228 GError **error);
230 GLIB_AVAILABLE_IN_ALL
231 gboolean g_drive_can_stop (GDrive *drive);
232 GLIB_AVAILABLE_IN_ALL
233 void g_drive_stop (GDrive *drive,
234 GMountUnmountFlags flags,
235 GMountOperation *mount_operation,
236 GCancellable *cancellable,
237 GAsyncReadyCallback callback,
238 gpointer user_data);
239 GLIB_AVAILABLE_IN_ALL
240 gboolean g_drive_stop_finish (GDrive *drive,
241 GAsyncResult *result,
242 GError **error);
244 GLIB_AVAILABLE_IN_ALL
245 void g_drive_eject_with_operation (GDrive *drive,
246 GMountUnmountFlags flags,
247 GMountOperation *mount_operation,
248 GCancellable *cancellable,
249 GAsyncReadyCallback callback,
250 gpointer user_data);
251 GLIB_AVAILABLE_IN_ALL
252 gboolean g_drive_eject_with_operation_finish (GDrive *drive,
253 GAsyncResult *result,
254 GError **error);
256 GLIB_AVAILABLE_IN_2_32
257 const gchar *g_drive_get_sort_key (GDrive *drive);
259 G_END_DECLS
261 #endif /* __G_DRIVE_H__ */