Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gdrive.h
Go to the documentation of this file.
1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2006-2007 Red Hat, Inc.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 *
20 * Author: Alexander Larsson <alexl@redhat.com>
21 * David Zeuthen <davidz@redhat.com>
22 */
23
24#ifndef __G_DRIVE_H__
25#define __G_DRIVE_H__
26
27#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
28#error "Only <gio/gio.h> can be included directly."
29#endif
30
31#include <gio/giotypes.h>
32
34
35/**
36 * G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE:
37 *
38 * The string used to obtain a Unix device path with g_drive_get_identifier().
39 *
40 * Since: 2.58
41 */
42#define G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE "unix-device"
43
44#define G_TYPE_DRIVE (g_drive_get_type ())
45#define G_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DRIVE, GDrive))
46#define G_IS_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DRIVE))
47#define G_DRIVE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DRIVE, GDriveIface))
48
49/**
50 * GDriveIface:
51 * @g_iface: The parent interface.
52 * @changed: Signal emitted when the drive is changed.
53 * @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.
54 * @eject_button: Signal emitted when the physical eject button (if any) of a drive have been pressed.
55 * @get_name: Returns the name for the given #GDrive.
56 * @get_icon: Returns a #GIcon for the given #GDrive.
57 * @has_volumes: Returns %TRUE if the #GDrive has mountable volumes.
58 * @get_volumes: Returns a list #GList of #GVolume for the #GDrive.
59 * @is_removable: Returns %TRUE if the #GDrive and/or its media is considered removable by the user. Since 2.50.
60 * @is_media_removable: Returns %TRUE if the #GDrive supports removal and insertion of media.
61 * @has_media: Returns %TRUE if the #GDrive has media inserted.
62 * @is_media_check_automatic: Returns %TRUE if the #GDrive is capable of automatically detecting media changes.
63 * @can_poll_for_media: Returns %TRUE if the #GDrive is capable of manually polling for media change.
64 * @can_eject: Returns %TRUE if the #GDrive can eject media.
65 * @eject: Ejects a #GDrive.
66 * @eject_finish: Finishes an eject operation.
67 * @poll_for_media: Poll for media insertion/removal on a #GDrive.
68 * @poll_for_media_finish: Finishes a media poll operation.
69 * @get_identifier: Returns the identifier of the given kind, or %NULL if
70 * the #GDrive doesn't have one.
71 * @enumerate_identifiers: Returns an array strings listing the kinds
72 * of identifiers which the #GDrive has.
73 * @get_start_stop_type: Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.
74 * @can_stop: Returns %TRUE if a #GDrive can be stopped. Since 2.22.
75 * @stop: Stops a #GDrive. Since 2.22.
76 * @stop_finish: Finishes a stop operation. Since 2.22.
77 * @can_start: Returns %TRUE if a #GDrive can be started. Since 2.22.
78 * @can_start_degraded: Returns %TRUE if a #GDrive can be started degraded. Since 2.22.
79 * @start: Starts a #GDrive. Since 2.22.
80 * @start_finish: Finishes a start operation. Since 2.22.
81 * @stop_button: Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.
82 * @eject_with_operation: Starts ejecting a #GDrive using a #GMountOperation. Since 2.22.
83 * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
84 * @get_sort_key: Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32.
85 * @get_symbolic_icon: Returns a symbolic #GIcon for the given #GDrive. Since 2.34.
86 *
87 * Interface for creating #GDrive implementations.
88 */
90
92{
94
95 /* signals */
96 void (* changed) (GDrive *drive);
97 void (* disconnected) (GDrive *drive);
98 void (* eject_button) (GDrive *drive);
99
100 /* Virtual Table */
101 char * (* get_name) (GDrive *drive);
102 GIcon * (* get_icon) (GDrive *drive);
104 GList * (* get_volumes) (GDrive *drive);
110 void (* eject) (GDrive *drive,
111 GMountUnmountFlags flags,
112 GCancellable *cancellable,
113 GAsyncReadyCallback callback,
114 gpointer user_data);
116 GAsyncResult *result,
117 GError **error);
118 void (* poll_for_media) (GDrive *drive,
119 GCancellable *cancellable,
120 GAsyncReadyCallback callback,
121 gpointer user_data);
123 GAsyncResult *result,
124 GError **error);
125
126 char * (* get_identifier) (GDrive *drive,
127 const char *kind);
128 char ** (* enumerate_identifiers) (GDrive *drive);
129
131
134 void (* start) (GDrive *drive,
135 GDriveStartFlags flags,
136 GMountOperation *mount_operation,
137 GCancellable *cancellable,
138 GAsyncReadyCallback callback,
139 gpointer user_data);
141 GAsyncResult *result,
142 GError **error);
143
145 void (* stop) (GDrive *drive,
146 GMountUnmountFlags flags,
147 GMountOperation *mount_operation,
148 GCancellable *cancellable,
149 GAsyncReadyCallback callback,
150 gpointer user_data);
152 GAsyncResult *result,
153 GError **error);
154 /* signal, not VFunc */
155 void (* stop_button) (GDrive *drive);
156
157 void (* eject_with_operation) (GDrive *drive,
158 GMountUnmountFlags flags,
159 GMountOperation *mount_operation,
160 GCancellable *cancellable,
161 GAsyncReadyCallback callback,
162 gpointer user_data);
164 GAsyncResult *result,
165 GError **error);
166
167 const gchar * (* get_sort_key) (GDrive *drive);
168 GIcon * (* get_symbolic_icon) (GDrive *drive);
170
171};
172
175
177char * g_drive_get_name (GDrive *drive);
200 GMountUnmountFlags flags,
201 GCancellable *cancellable,
202 GAsyncReadyCallback callback,
203 gpointer user_data);
204
207 GAsyncResult *result,
208 GError **error);
211 GCancellable *cancellable,
212 GAsyncReadyCallback callback,
213 gpointer user_data);
216 GAsyncResult *result,
217 GError **error);
220 const char *kind);
223
226
233 GDriveStartFlags flags,
234 GMountOperation *mount_operation,
235 GCancellable *cancellable,
236 GAsyncReadyCallback callback,
237 gpointer user_data);
240 GAsyncResult *result,
241 GError **error);
242
246void g_drive_stop (GDrive *drive,
247 GMountUnmountFlags flags,
248 GMountOperation *mount_operation,
249 GCancellable *cancellable,
250 GAsyncReadyCallback callback,
251 gpointer user_data);
254 GAsyncResult *result,
255 GError **error);
256
259 GMountUnmountFlags flags,
260 GMountOperation *mount_operation,
261 GCancellable *cancellable,
262 GAsyncReadyCallback callback,
263 gpointer user_data);
266 GAsyncResult *result,
267 GError **error);
268
271
273
274#endif /* __G_DRIVE_H__ */
GIO_AVAILABLE_IN_ALL gboolean g_drive_has_volumes(GDrive *drive)
GIO_AVAILABLE_IN_ALL void g_drive_poll_for_media(GDrive *drive, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
GIO_AVAILABLE_IN_ALL void g_drive_start(GDrive *drive, GDriveStartFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
GIO_AVAILABLE_IN_ALL gboolean g_drive_can_start(GDrive *drive)
GIO_AVAILABLE_IN_ALL GIcon * g_drive_get_symbolic_icon(GDrive *drive)
GIO_AVAILABLE_IN_ALL gboolean g_drive_can_eject(GDrive *drive)
GIO_AVAILABLE_IN_ALL GIcon * g_drive_get_icon(GDrive *drive)
GIO_AVAILABLE_IN_ALL GList * g_drive_get_volumes(GDrive *drive)
GIO_AVAILABLE_IN_ALL gboolean g_drive_start_finish(GDrive *drive, GAsyncResult *result, GError **error)
GIO_AVAILABLE_IN_ALL gboolean g_drive_has_media(GDrive *drive)
GIO_AVAILABLE_IN_ALL gboolean g_drive_stop_finish(GDrive *drive, GAsyncResult *result, GError **error)
GIO_AVAILABLE_IN_ALL GType g_drive_get_type(void) G_GNUC_CONST
gboolean g_drive_eject_finish(GDrive *drive, GAsyncResult *result, GError **error)
GIO_AVAILABLE_IN_ALL char * g_drive_get_name(GDrive *drive)
GIO_AVAILABLE_IN_ALL gboolean g_drive_eject_with_operation_finish(GDrive *drive, GAsyncResult *result, GError **error)
GIO_AVAILABLE_IN_ALL gboolean g_drive_is_media_removable(GDrive *drive)
GIO_AVAILABLE_IN_ALL GDriveStartStopType g_drive_get_start_stop_type(GDrive *drive)
GIO_AVAILABLE_IN_ALL char ** g_drive_enumerate_identifiers(GDrive *drive)
GIO_AVAILABLE_IN_ALL void g_drive_stop(GDrive *drive, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
GIO_AVAILABLE_IN_ALL void g_drive_eject_with_operation(GDrive *drive, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
GIO_AVAILABLE_IN_ALL char * g_drive_get_identifier(GDrive *drive, const char *kind)
GIO_AVAILABLE_IN_2_50 gboolean g_drive_is_removable(GDrive *drive)
GIO_AVAILABLE_IN_ALL gboolean g_drive_is_media_check_automatic(GDrive *drive)
GIO_AVAILABLE_IN_ALL gboolean g_drive_can_poll_for_media(GDrive *drive)
GIO_AVAILABLE_IN_2_32 const gchar * g_drive_get_sort_key(GDrive *drive)
GIO_AVAILABLE_IN_ALL gboolean g_drive_poll_for_media_finish(GDrive *drive, GAsyncResult *result, GError **error)
GIO_AVAILABLE_IN_ALL gboolean g_drive_can_start_degraded(GDrive *drive)
GIO_AVAILABLE_IN_ALL gboolean g_drive_can_stop(GDrive *drive)
void g_drive_eject(GDrive *drive, GMountUnmountFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
#define GIO_AVAILABLE_IN_ALL
#define GIO_AVAILABLE_IN_2_32
#define GIO_DEPRECATED_FOR(f)
#define GIO_AVAILABLE_IN_2_50
GDriveStartFlags
Definition gioenums.h:276
GMountUnmountFlags
Definition gioenums.h:263
GDriveStartStopType
Definition gioenums.h:300
struct _GIcon GIcon
Definition giotypes.h:92
struct _GDrive GDrive
Definition giotypes.h:68
struct _GAsyncResult GAsyncResult
Definition giotypes.h:36
void(* GAsyncReadyCallback)(GObject *source_object, GAsyncResult *res, gpointer data)
Definition giotypes.h:190
typedefG_BEGIN_DECLS struct _GList GList
Definition glist.h:39
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
#define G_GNUC_CONST
Definition gmacros.h:637
gsize GType
Definition gtype.h:427
gint gboolean
Definition gtypes.h:56
G_BEGIN_DECLS typedef char gchar
Definition gtypes.h:52
void * gpointer
Definition gtypes.h:109
static void error(LoadState *S, const char *why)
void(* poll_for_media)(GDrive *drive, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition gdrive.h:118
gboolean(* can_poll_for_media)(GDrive *drive)
Definition gdrive.h:109
gboolean(* has_media)(GDrive *drive)
Definition gdrive.h:106
gboolean(* start_finish)(GDrive *drive, GAsyncResult *result, GError **error)
Definition gdrive.h:140
void(* eject_button)(GDrive *drive)
Definition gdrive.h:98
GDriveStartStopType(* get_start_stop_type)(GDrive *drive)
Definition gdrive.h:130
void(* stop_button)(GDrive *drive)
Definition gdrive.h:155
gboolean(* eject_with_operation_finish)(GDrive *drive, GAsyncResult *result, GError **error)
Definition gdrive.h:163
gboolean(* is_removable)(GDrive *drive)
Definition gdrive.h:169
GTypeInterface g_iface
Definition gdrive.h:93
gboolean(* can_start_degraded)(GDrive *drive)
Definition gdrive.h:133
void(* eject_with_operation)(GDrive *drive, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition gdrive.h:157
gboolean(* stop_finish)(GDrive *drive, GAsyncResult *result, GError **error)
Definition gdrive.h:151
void(* eject)(GDrive *drive, GMountUnmountFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition gdrive.h:110
gboolean(* has_volumes)(GDrive *drive)
Definition gdrive.h:103
gboolean(* is_media_removable)(GDrive *drive)
Definition gdrive.h:105
void(* stop)(GDrive *drive, GMountUnmountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition gdrive.h:145
void(* changed)(GDrive *drive)
Definition gdrive.h:96
gboolean(* can_stop)(GDrive *drive)
Definition gdrive.h:144
gboolean(* poll_for_media_finish)(GDrive *drive, GAsyncResult *result, GError **error)
Definition gdrive.h:122
gboolean(* can_eject)(GDrive *drive)
Definition gdrive.h:108
gboolean(* eject_finish)(GDrive *drive, GAsyncResult *result, GError **error)
Definition gdrive.h:115
void(* start)(GDrive *drive, GDriveStartFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
Definition gdrive.h:134
gboolean(* is_media_check_automatic)(GDrive *drive)
Definition gdrive.h:107
void(* disconnected)(GDrive *drive)
Definition gdrive.h:97
gboolean(* can_start)(GDrive *drive)
Definition gdrive.h:132