gio/ docs/reference/gio Merged gio-standalone into glib.
[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 typedef struct _GDrive          GDrive; /* Dummy typedef */
38 typedef struct _GVolumeIface    GVolumeIface;
39
40 struct _GVolumeIface
41 {
42   GTypeInterface g_iface;
43
44   /* signals */
45
46   void (*changed) (GVolume *volume);
47   
48   /* Virtual Table */
49
50   GFile *  (*get_root)       (GVolume         *volume);
51   char *   (*get_name)       (GVolume         *volume);
52   GIcon *  (*get_icon)       (GVolume         *volume);
53   GDrive * (*get_drive)      (GVolume         *volume);
54   gboolean (*can_unmount)    (GVolume         *volume);
55   gboolean (*can_eject)      (GVolume         *volume);
56   void     (*unmount)        (GVolume         *volume,
57                               GCancellable    *cancellable,
58                               GAsyncReadyCallback callback,
59                               gpointer         user_data);
60   gboolean (*unmount_finish) (GVolume         *volume,
61                               GAsyncResult    *result,
62                               GError         **error);
63   void     (*eject)          (GVolume         *volume,
64                               GCancellable    *cancellable,
65                               GAsyncReadyCallback callback,
66                               gpointer         user_data);
67   gboolean (*eject_finish)   (GVolume         *volume,
68                               GAsyncResult    *result,
69                               GError         **error);
70 };
71
72 GType g_volume_get_type (void) G_GNUC_CONST;
73
74 GFile   *g_volume_get_root       (GVolume              *volume);
75 char *   g_volume_get_name       (GVolume              *volume);
76 GIcon *  g_volume_get_icon       (GVolume              *volume);
77 GDrive * g_volume_get_drive      (GVolume              *volume);
78 gboolean g_volume_can_unmount    (GVolume              *volume);
79 gboolean g_volume_can_eject      (GVolume              *volume);
80 void     g_volume_unmount        (GVolume              *volume,
81                                   GCancellable         *cancellable,
82                                   GAsyncReadyCallback   callback,
83                                   gpointer              user_data);
84 gboolean g_volume_unmount_finish (GVolume              *volume,
85                                   GAsyncResult         *result,
86                                   GError              **error);
87 void     g_volume_eject          (GVolume              *volume,
88                                   GCancellable         *cancellable,
89                                   GAsyncReadyCallback   callback,
90                                   gpointer              user_data);
91 gboolean g_volume_eject_finish   (GVolume              *volume,
92                                   GAsyncResult         *result,
93                                   GError              **error);
94
95 G_END_DECLS
96
97 #endif /* __G_VOLUME_H__ */