Only allow including <gio/gio.h> from apps
[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  *         David Zeuthen <davidz@redhat.com>
22  */
23
24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
26 #endif
27
28 #ifndef __G_VOLUME_H__
29 #define __G_VOLUME_H__
30
31 #include <glib-object.h>
32 #include <gio/gfile.h>
33 #include <gio/gdrive.h>
34
35 G_BEGIN_DECLS
36
37 #define G_TYPE_VOLUME            (g_volume_get_type ())
38 #define G_VOLUME(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_VOLUME, GVolume))
39 #define G_IS_VOLUME(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_VOLUME))
40 #define G_VOLUME_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_VOLUME, GVolumeIface))
41
42 /**
43  * GVolumeIface:
44  * @g_iface: The parent interface.
45  * @changed: Changed signal that is emitted when the volume's state has changed.
46  * @get_name: Gets a string containing the name of the #GVolume.
47  * @get_icon: Gets a #GIcon for the #GVolume.
48  * @get_drive: Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive.
49  * @get_mount: Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted.
50  * @can_mount: Returns %TRUE if the #GVolume can be mounted.
51  * @mount: Mounts a given #GVolume.
52  * @mount_finish: Finishes a mount operation.
53  * 
54  * Interface for implementing operations for mountable volumes.
55  **/
56 typedef struct _GVolumeIface    GVolumeIface;
57
58 struct _GVolumeIface
59 {
60   GTypeInterface g_iface;
61
62   /* signals */
63
64   void (*changed) (GVolume *volume);
65   
66   /* Virtual Table */
67
68   char *    (*get_name)       (GVolume             *volume);
69   GIcon *   (*get_icon)       (GVolume             *volume);
70   GDrive *  (*get_drive)      (GVolume             *volume);
71   GMount *  (*get_mount)      (GVolume             *volume);
72   gboolean  (*can_mount)      (GVolume             *volume);
73   void      (*mount_fn)       (GVolume             *volume,
74                                GMountOperation     *mount_operation,
75                                GCancellable        *cancellable,
76                                GAsyncReadyCallback  callback,
77                                gpointer             user_data);
78   gboolean  (*mount_finish)   (GVolume             *volume,
79                                GAsyncResult        *result,
80                                GError             **error);
81 };
82
83 GType     g_volume_get_type       (void) G_GNUC_CONST;
84
85 char *    g_volume_get_name       (GVolume              *volume);
86 GIcon *   g_volume_get_icon       (GVolume              *volume);
87 GDrive *  g_volume_get_drive      (GVolume              *volume);
88 GMount *  g_volume_get_mount      (GVolume              *volume);
89 gboolean  g_volume_can_mount      (GVolume              *volume);
90 void      g_volume_mount          (GVolume              *volume,
91                                    GMountOperation      *mount_operation,
92                                    GCancellable         *cancellable,
93                                    GAsyncReadyCallback   callback,
94                                    gpointer              user_data);
95 gboolean g_volume_mount_finish    (GVolume              *volume,
96                                    GAsyncResult         *result,
97                                    GError              **error);
98
99 G_END_DECLS
100
101 #endif /* __G_VOLUME_H__ */