Better documentation for g_value_dup_object().
[glib.git] / gio / gvolume.h
blob5496d26c4abe33c19057b2f7c9bf7b7b89ceb382
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 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
26 #endif
28 #ifndef __G_VOLUME_H__
29 #define __G_VOLUME_H__
31 #include <gio/giotypes.h>
33 G_BEGIN_DECLS
35 /**
36 * G_VOLUME_IDENTIFIER_KIND_HAL_UDI:
38 * The string used to obtain a Hal UDI with g_volume_get_identifier().
40 #define G_VOLUME_IDENTIFIER_KIND_HAL_UDI "hal-udi"
42 /**
43 * G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE:
45 * The string used to obtain a Unix device path with g_volume_get_identifier().
47 #define G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE "unix-device"
49 /**
50 * G_VOLUME_IDENTIFIER_KIND_LABEL:
52 * The string used to obtain a filesystem label with g_volume_get_identifier().
54 #define G_VOLUME_IDENTIFIER_KIND_LABEL "label"
56 /**
57 * G_VOLUME_IDENTIFIER_KIND_UUID:
59 * The string used to obtain a UUID with g_volume_get_identifier().
61 #define G_VOLUME_IDENTIFIER_KIND_UUID "uuid"
63 /**
64 * G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT:
66 * The string used to obtain a NFS mount with g_volume_get_identifier().
68 #define G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT "nfs-mount"
71 #define G_TYPE_VOLUME (g_volume_get_type ())
72 #define G_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_VOLUME, GVolume))
73 #define G_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_VOLUME))
74 #define G_VOLUME_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_VOLUME, GVolumeIface))
76 /**
77 * GVolumeIface:
78 * @g_iface: The parent interface.
79 * @changed: Changed signal that is emitted when the volume's state has changed.
80 * @removed: The removed signal that is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.
81 * @get_name: Gets a string containing the name of the #GVolume.
82 * @get_icon: Gets a #GIcon for the #GVolume.
83 * @get_uuid: Gets the UUID for the #GVolume. 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.
84 * @get_drive: Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive.
85 * @get_mount: Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted.
86 * @can_mount: Returns %TRUE if the #GVolume can be mounted.
87 * @can_eject: Checks if a #GVolume can be ejected.
88 * @mount_fn: Mounts a given #GVolume.
89 * #GVolume implementations must emit the #GMountOperation::aborted
90 * signal before completing a mount operation that is aborted while
91 * awaiting input from the user through a #GMountOperation instance.
92 * @mount_finish: Finishes a mount operation.
93 * @eject: Ejects a given #GVolume.
94 * @eject_finish: Finishes an eject operation.
95 * @get_identifier: Returns the <link linkend="volume-identifier">identifier</link> of the given kind, or %NULL if
96 * the #GVolume doesn't have one.
97 * @enumerate_identifiers: Returns an array strings listing the kinds
98 * of <link linkend="volume-identifier">identifiers</link> which the #GVolume has.
99 * @should_automount: Returns %TRUE if the #GVolume should be automatically mounted.
100 * @get_activation_root: Returns the activation root for the #GVolume if it is known in advance or %NULL if
101 * it is not known.
102 * @eject_with_operation: Starts ejecting a #GVolume using a #GMountOperation. Since 2.22.
103 * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
105 * Interface for implementing operations for mountable volumes.
107 typedef struct _GVolumeIface GVolumeIface;
109 struct _GVolumeIface
111 GTypeInterface g_iface;
113 /* signals */
115 void (* changed) (GVolume *volume);
116 void (* removed) (GVolume *volume);
118 /* Virtual Table */
120 char * (* get_name) (GVolume *volume);
121 GIcon * (* get_icon) (GVolume *volume);
122 char * (* get_uuid) (GVolume *volume);
123 GDrive * (* get_drive) (GVolume *volume);
124 GMount * (* get_mount) (GVolume *volume);
125 gboolean (* can_mount) (GVolume *volume);
126 gboolean (* can_eject) (GVolume *volume);
127 void (* mount_fn) (GVolume *volume,
128 GMountMountFlags flags,
129 GMountOperation *mount_operation,
130 GCancellable *cancellable,
131 GAsyncReadyCallback callback,
132 gpointer user_data);
133 gboolean (* mount_finish) (GVolume *volume,
134 GAsyncResult *result,
135 GError **error);
136 void (* eject) (GVolume *volume,
137 GMountUnmountFlags flags,
138 GCancellable *cancellable,
139 GAsyncReadyCallback callback,
140 gpointer user_data);
141 gboolean (* eject_finish) (GVolume *volume,
142 GAsyncResult *result,
143 GError **error);
145 char * (* get_identifier) (GVolume *volume,
146 const char *kind);
147 char ** (* enumerate_identifiers) (GVolume *volume);
149 gboolean (* should_automount) (GVolume *volume);
151 GFile * (* get_activation_root) (GVolume *volume);
153 void (* eject_with_operation) (GVolume *volume,
154 GMountUnmountFlags flags,
155 GMountOperation *mount_operation,
156 GCancellable *cancellable,
157 GAsyncReadyCallback callback,
158 gpointer user_data);
159 gboolean (* eject_with_operation_finish) (GVolume *volume,
160 GAsyncResult *result,
161 GError **error);
164 GType g_volume_get_type (void) G_GNUC_CONST;
166 char * g_volume_get_name (GVolume *volume);
167 GIcon * g_volume_get_icon (GVolume *volume);
168 char * g_volume_get_uuid (GVolume *volume);
169 GDrive * g_volume_get_drive (GVolume *volume);
170 GMount * g_volume_get_mount (GVolume *volume);
171 gboolean g_volume_can_mount (GVolume *volume);
172 gboolean g_volume_can_eject (GVolume *volume);
173 gboolean g_volume_should_automount (GVolume *volume);
174 void g_volume_mount (GVolume *volume,
175 GMountMountFlags flags,
176 GMountOperation *mount_operation,
177 GCancellable *cancellable,
178 GAsyncReadyCallback callback,
179 gpointer user_data);
180 gboolean g_volume_mount_finish (GVolume *volume,
181 GAsyncResult *result,
182 GError **error);
183 #ifndef G_DISABLE_DEPRECATED
184 void g_volume_eject (GVolume *volume,
185 GMountUnmountFlags flags,
186 GCancellable *cancellable,
187 GAsyncReadyCallback callback,
188 gpointer user_data);
189 gboolean g_volume_eject_finish (GVolume *volume,
190 GAsyncResult *result,
191 GError **error);
192 #endif
193 char * g_volume_get_identifier (GVolume *volume,
194 const char *kind);
195 char ** g_volume_enumerate_identifiers (GVolume *volume);
197 GFile * g_volume_get_activation_root (GVolume *volume);
199 void g_volume_eject_with_operation (GVolume *volume,
200 GMountUnmountFlags flags,
201 GMountOperation *mount_operation,
202 GCancellable *cancellable,
203 GAsyncReadyCallback callback,
204 gpointer user_data);
205 gboolean g_volume_eject_with_operation_finish (GVolume *volume,
206 GAsyncResult *result,
207 GError **error);
209 G_END_DECLS
211 #endif /* __G_VOLUME_H__ */