Fix the docs build
[platform/upstream/glib.git] / gio / gvolume.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright (C) 2006-2007 Red Hat, Inc.
4  *
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.
9  *
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.
14  *
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/>.
17  *
18  * Author: Alexander Larsson <alexl@redhat.com>
19  *         David Zeuthen <davidz@redhat.com>
20  */
21
22 #ifndef __G_VOLUME_H__
23 #define __G_VOLUME_H__
24
25 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
26 #error "Only <gio/gio.h> can be included directly."
27 #endif
28
29 #include <gio/giotypes.h>
30
31 G_BEGIN_DECLS
32
33 /**
34  * G_VOLUME_IDENTIFIER_KIND_HAL_UDI:
35  *
36  * The string used to obtain a Hal UDI with g_volume_get_identifier().
37  */
38 #define G_VOLUME_IDENTIFIER_KIND_HAL_UDI "hal-udi"
39
40 /**
41  * G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE:
42  *
43  * The string used to obtain a Unix device path with g_volume_get_identifier().
44  */
45 #define G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE "unix-device"
46
47 /**
48  * G_VOLUME_IDENTIFIER_KIND_LABEL:
49  *
50  * The string used to obtain a filesystem label with g_volume_get_identifier().
51  */
52 #define G_VOLUME_IDENTIFIER_KIND_LABEL "label"
53
54 /**
55  * G_VOLUME_IDENTIFIER_KIND_UUID:
56  *
57  * The string used to obtain a UUID with g_volume_get_identifier().
58  */
59 #define G_VOLUME_IDENTIFIER_KIND_UUID "uuid"
60
61 /**
62  * G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT:
63  *
64  * The string used to obtain a NFS mount with g_volume_get_identifier().
65  */
66 #define G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT "nfs-mount"
67
68 /**
69  * G_VOLUME_IDENTIFIER_KIND_CLASS:
70  *
71  * The string used to obtain the volume <emphasis>class</emphasis>
72  * with g_volume_get_identifier().
73  *
74  * Known volume classes include <literal>device</literal> and
75  * <literal>network</literal>. Other classes may be added in the
76  * future.
77  *
78  * This is intended to be used by applications to classify #GVolume
79  * instances into different sections - for example a file manager or
80  * file chooser can use this information to show
81  * <literal>network</literal> volumes under a "Network" heading and
82  * <literal>device</literal> volumes under a "Devices" heading.
83  */
84 #define G_VOLUME_IDENTIFIER_KIND_CLASS "class"
85
86
87 #define G_TYPE_VOLUME            (g_volume_get_type ())
88 #define G_VOLUME(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_VOLUME, GVolume))
89 #define G_IS_VOLUME(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_VOLUME))
90 #define G_VOLUME_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_VOLUME, GVolumeIface))
91
92 /**
93  * GVolumeIface:
94  * @g_iface: The parent interface.
95  * @changed: Changed signal that is emitted when the volume's state has changed.
96  * @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.
97  * @get_name: Gets a string containing the name of the #GVolume.
98  * @get_icon: Gets a #GIcon for the #GVolume.
99  * @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.
100  * @get_drive: Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive.
101  * @get_mount: Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted.
102  * @can_mount: Returns %TRUE if the #GVolume can be mounted.
103  * @can_eject: Checks if a #GVolume can be ejected.
104  * @mount_fn: Mounts a given #GVolume. 
105  *     #GVolume implementations must emit the #GMountOperation::aborted 
106  *     signal before completing a mount operation that is aborted while 
107  *     awaiting input from the user through a #GMountOperation instance.
108  * @mount_finish: Finishes a mount operation.
109  * @eject: Ejects a given #GVolume.
110  * @eject_finish: Finishes an eject operation.
111  * @get_identifier: Returns the <link linkend="volume-identifier">identifier</link> of the given kind, or %NULL if
112  *    the #GVolume doesn't have one.
113  * @enumerate_identifiers: Returns an array strings listing the kinds
114  *    of <link linkend="volume-identifier">identifiers</link> which the #GVolume has.
115  * @should_automount: Returns %TRUE if the #GVolume should be automatically mounted.
116  * @get_activation_root: Returns the activation root for the #GVolume if it is known in advance or %NULL if
117  *   it is not known.
118  * @eject_with_operation: Starts ejecting a #GVolume using a #GMountOperation. Since 2.22.
119  * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
120  * @get_sort_key: Gets a key used for sorting #GVolume instance or %NULL if no such key exists. Since 2.32.
121  * @get_symbolic_icon: Gets a symbolic #GIcon for the #GVolume. Since 2.34.
122  *
123  * Interface for implementing operations for mountable volumes.
124  **/
125 typedef struct _GVolumeIface    GVolumeIface;
126
127 struct _GVolumeIface
128 {
129   GTypeInterface g_iface;
130
131   /* signals */
132
133   void        (* changed)               (GVolume             *volume);
134   void        (* removed)               (GVolume             *volume);
135
136   /* Virtual Table */
137
138   char      * (* get_name)              (GVolume             *volume);
139   GIcon     * (* get_icon)              (GVolume             *volume);
140   char      * (* get_uuid)              (GVolume             *volume);
141   GDrive    * (* get_drive)             (GVolume             *volume);
142   GMount    * (* get_mount)             (GVolume             *volume);
143   gboolean    (* can_mount)             (GVolume             *volume);
144   gboolean    (* can_eject)             (GVolume             *volume);
145   void        (* mount_fn)              (GVolume             *volume,
146                                          GMountMountFlags     flags,
147                                          GMountOperation     *mount_operation,
148                                          GCancellable        *cancellable,
149                                          GAsyncReadyCallback  callback,
150                                          gpointer             user_data);
151   gboolean    (* mount_finish)          (GVolume             *volume,
152                                          GAsyncResult        *result,
153                                          GError             **error);
154   void        (* eject)                 (GVolume             *volume,
155                                          GMountUnmountFlags   flags,
156                                          GCancellable        *cancellable,
157                                          GAsyncReadyCallback  callback,
158                                          gpointer             user_data);
159   gboolean    (* eject_finish)          (GVolume             *volume,
160                                          GAsyncResult        *result,
161                                          GError             **error);
162
163   char      * (* get_identifier)        (GVolume             *volume,
164                                          const char          *kind);
165   char     ** (* enumerate_identifiers) (GVolume             *volume);
166
167   gboolean    (* should_automount)      (GVolume             *volume);
168
169   GFile     * (* get_activation_root)   (GVolume             *volume);
170
171   void        (* eject_with_operation)      (GVolume             *volume,
172                                              GMountUnmountFlags   flags,
173                                              GMountOperation     *mount_operation,
174                                              GCancellable        *cancellable,
175                                              GAsyncReadyCallback  callback,
176                                              gpointer             user_data);
177   gboolean    (* eject_with_operation_finish) (GVolume           *volume,
178                                              GAsyncResult        *result,
179                                              GError             **error);
180
181   const gchar * (* get_sort_key)        (GVolume             *volume);
182   GIcon       * (* get_symbolic_icon)   (GVolume             *volume);
183 };
184
185 GLIB_AVAILABLE_IN_ALL
186 GType    g_volume_get_type              (void) G_GNUC_CONST;
187
188 GLIB_AVAILABLE_IN_ALL
189 char *   g_volume_get_name              (GVolume              *volume);
190 GLIB_AVAILABLE_IN_ALL
191 GIcon *  g_volume_get_icon              (GVolume              *volume);
192 GLIB_AVAILABLE_IN_ALL
193 GIcon *  g_volume_get_symbolic_icon     (GVolume              *volume);
194 GLIB_AVAILABLE_IN_ALL
195 char *   g_volume_get_uuid              (GVolume              *volume);
196 GLIB_AVAILABLE_IN_ALL
197 GDrive * g_volume_get_drive             (GVolume              *volume);
198 GLIB_AVAILABLE_IN_ALL
199 GMount * g_volume_get_mount             (GVolume              *volume);
200 GLIB_AVAILABLE_IN_ALL
201 gboolean g_volume_can_mount             (GVolume              *volume);
202 GLIB_AVAILABLE_IN_ALL
203 gboolean g_volume_can_eject             (GVolume              *volume);
204 GLIB_AVAILABLE_IN_ALL
205 gboolean g_volume_should_automount      (GVolume              *volume);
206 GLIB_AVAILABLE_IN_ALL
207 void     g_volume_mount                 (GVolume              *volume,
208                                          GMountMountFlags      flags,
209                                          GMountOperation      *mount_operation,
210                                          GCancellable         *cancellable,
211                                          GAsyncReadyCallback   callback,
212                                          gpointer              user_data);
213 GLIB_AVAILABLE_IN_ALL
214 gboolean g_volume_mount_finish          (GVolume              *volume,
215                                          GAsyncResult         *result,
216                                          GError              **error);
217 GLIB_DEPRECATED_FOR(g_volume_eject_with_operation)
218 void     g_volume_eject                 (GVolume              *volume,
219                                          GMountUnmountFlags    flags,
220                                          GCancellable         *cancellable,
221                                          GAsyncReadyCallback   callback,
222                                          gpointer              user_data);
223
224 GLIB_DEPRECATED_FOR(g_volume_eject_with_operation_finish)
225 gboolean g_volume_eject_finish          (GVolume              *volume,
226                                          GAsyncResult         *result,
227                                          GError              **error);
228 GLIB_AVAILABLE_IN_ALL
229 char *   g_volume_get_identifier        (GVolume              *volume,
230                                          const char           *kind);
231 GLIB_AVAILABLE_IN_ALL
232 char **  g_volume_enumerate_identifiers (GVolume              *volume);
233
234 GLIB_AVAILABLE_IN_ALL
235 GFile *  g_volume_get_activation_root   (GVolume              *volume);
236
237 GLIB_AVAILABLE_IN_ALL
238 void        g_volume_eject_with_operation     (GVolume             *volume,
239                                                GMountUnmountFlags   flags,
240                                                GMountOperation     *mount_operation,
241                                                GCancellable        *cancellable,
242                                                GAsyncReadyCallback  callback,
243                                                gpointer             user_data);
244 GLIB_AVAILABLE_IN_ALL
245 gboolean    g_volume_eject_with_operation_finish (GVolume          *volume,
246                                                GAsyncResult        *result,
247                                                GError             **error);
248
249 GLIB_AVAILABLE_IN_2_32
250 const gchar *g_volume_get_sort_key            (GVolume              *volume);
251
252 G_END_DECLS
253
254 #endif /* __G_VOLUME_H__ */