Add new error codes for when compilation fails and make compilation error
[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, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Author: Alexander Larsson <alexl@redhat.com>
21  */
22
23 #ifndef __G_VOLUME_H__
24 #define __G_VOLUME_H__
25
26 #include <glib-object.h>
27 #include <gio/gfile.h>
28
29 G_BEGIN_DECLS
30
31 #define G_TYPE_VOLUME            (g_volume_get_type ())
32 #define G_VOLUME(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_VOLUME, GVolume))
33 #define G_IS_VOLUME(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_VOLUME))
34 #define G_VOLUME_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_VOLUME, GVolumeIface))
35
36 /* GVolume typedef is in gfile.h due to include order issues */
37 /**
38  * GDrive:
39  * 
40  * Opaque drive object.
41  **/
42 typedef struct _GDrive          GDrive; /* Dummy typedef */
43 typedef struct _GVolumeIface    GVolumeIface;
44
45 /**
46  * GVolumeIface:
47  * @g_iface: The parent interface.
48  * @changed: Changed signal that is emitted when the volume's state has changed.
49  * @get_root: Gets a #GFile to the root directory of the #GVolume.
50  * @get_name: Gets a string containing the name of the #GVolume.
51  * @get_icon: Gets a #GIcon for the #GVolume.
52  * @get_drive: Gets a #GDrive the volume is located on.
53  * @can_unmount: Checks if a #GVolume can be unmounted.
54  * @can_eject: Checks if a #GVolume can be ejected.
55  * @unmount: Starts unmounting a #GVolume.
56  * @unmount_finish: Finishes an unmounting operation.
57  * @eject: Starts ejecting a #GVolume.
58  * @eject_finish: Finishes an eject operation.
59  * 
60  * Interface for implementing operations for mounted volumes.
61  **/
62 struct _GVolumeIface
63 {
64   GTypeInterface g_iface;
65
66   /* signals */
67
68   void (*changed) (GVolume *volume);
69   
70   /* Virtual Table */
71
72   GFile *  (*get_root)       (GVolume         *volume);
73   char *   (*get_name)       (GVolume         *volume);
74   GIcon *  (*get_icon)       (GVolume         *volume);
75   GDrive * (*get_drive)      (GVolume         *volume);
76   gboolean (*can_unmount)    (GVolume         *volume);
77   gboolean (*can_eject)      (GVolume         *volume);
78   void     (*unmount)        (GVolume         *volume,
79                               GCancellable    *cancellable,
80                               GAsyncReadyCallback callback,
81                               gpointer         user_data);
82   gboolean (*unmount_finish) (GVolume         *volume,
83                               GAsyncResult    *result,
84                               GError         **error);
85   void     (*eject)          (GVolume         *volume,
86                               GCancellable    *cancellable,
87                               GAsyncReadyCallback callback,
88                               gpointer         user_data);
89   gboolean (*eject_finish)   (GVolume         *volume,
90                               GAsyncResult    *result,
91                               GError         **error);
92 };
93
94 GType g_volume_get_type (void) G_GNUC_CONST;
95
96 GFile   *g_volume_get_root       (GVolume              *volume);
97 char *   g_volume_get_name       (GVolume              *volume);
98 GIcon *  g_volume_get_icon       (GVolume              *volume);
99 GDrive * g_volume_get_drive      (GVolume              *volume);
100 gboolean g_volume_can_unmount    (GVolume              *volume);
101 gboolean g_volume_can_eject      (GVolume              *volume);
102 void     g_volume_unmount        (GVolume              *volume,
103                                   GCancellable         *cancellable,
104                                   GAsyncReadyCallback   callback,
105                                   gpointer              user_data);
106 gboolean g_volume_unmount_finish (GVolume              *volume,
107                                   GAsyncResult         *result,
108                                   GError              **error);
109 void     g_volume_eject          (GVolume              *volume,
110                                   GCancellable         *cancellable,
111                                   GAsyncReadyCallback   callback,
112                                   gpointer              user_data);
113 gboolean g_volume_eject_finish   (GVolume              *volume,
114                                   GAsyncResult         *result,
115                                   GError              **error);
116
117 G_END_DECLS
118
119 #endif /* __G_VOLUME_H__ */