Moved all relevant typedefs into these files.
[platform/upstream/glib.git] / gio / gmount.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_MOUNT_H__
29 #define __G_MOUNT_H__
30
31 #include <gio/giotypes.h>
32
33 G_BEGIN_DECLS
34
35 #define G_TYPE_MOUNT            (g_mount_get_type ())
36 #define G_MOUNT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_MOUNT, GMount))
37 #define G_IS_MOUNT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_MOUNT))
38 #define G_MOUNT_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_MOUNT, GMountIface))
39
40 typedef struct _GMountIface    GMountIface;
41
42 /**
43  * GMountIface:
44  * @g_iface: The parent interface.
45  * @changed: Changed signal that is emitted when the mount's state has changed.
46  * @unmounted: The unmounted signal that is emitted when the #GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.
47  * @get_root: Gets a #GFile to the root directory of the #GMount.
48  * @get_name: Gets a string containing the name of the #GMount.
49  * @get_icon: Gets a #GIcon for the #GMount.
50  * @get_uuid: Gets the UUID for the #GMount. 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.
51  * @get_volume: Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.
52  * @get_drive: Gets a #GDrive the volume of the mount is located on. Returns %NULL if the #GMount is not associated with a #GDrive or a #GVolume. This is convenience method for getting the #GVolume and using that to get the #GDrive.
53  * @can_unmount: Checks if a #GMount can be unmounted.
54  * @can_eject: Checks if a #GMount can be ejected.
55  * @unmount: Starts unmounting a #GMount.
56  * @unmount_finish: Finishes an unmounting operation.
57  * @eject: Starts ejecting a #GMount.
58  * @eject_finish: Finishes an eject operation.
59  * @remount: Starts remounting a #GMount.
60  * @remount_finish: Finishes a remounting operation.
61  * 
62  * Interface for implementing operations for mounts.
63  **/
64 struct _GMountIface
65 {
66   GTypeInterface g_iface;
67
68   /* signals */
69
70   void (*changed) (GMount *mount);
71   void (*unmounted) (GMount *mount);
72   
73   /* Virtual Table */
74
75   GFile *            (*get_root)             (GMount         *mount);
76   char *             (*get_name)             (GMount         *mount);
77   GIcon *            (*get_icon)             (GMount         *mount);
78   char *             (*get_uuid)             (GMount         *mount);
79   GVolume *          (*get_volume)           (GMount         *mount);
80   GDrive *           (*get_drive)            (GMount         *mount);
81   gboolean           (*can_unmount)          (GMount         *mount);
82   gboolean           (*can_eject)            (GMount         *mount);
83   void               (*unmount)              (GMount         *mount,
84                                               GMountUnmountFlags flags,
85                                               GCancellable    *cancellable,
86                                               GAsyncReadyCallback callback,
87                                               gpointer         user_data);
88   gboolean           (*unmount_finish)       (GMount         *mount,
89                                               GAsyncResult    *result,
90                                               GError         **error);
91   void               (*eject)                (GMount         *mount,
92                                               GMountUnmountFlags flags,
93                                               GCancellable    *cancellable,
94                                               GAsyncReadyCallback callback,
95                                               gpointer         user_data);
96   gboolean           (*eject_finish)         (GMount         *mount,
97                                               GAsyncResult    *result,
98                                               GError         **error);
99   void               (*remount)              (GMount         *mount,
100                                               GMountMountFlags     flags,
101                                               GMountOperation     *mount_operation,
102                                               GCancellable    *cancellable,
103                                               GAsyncReadyCallback callback,
104                                               gpointer         user_data);
105   gboolean           (*remount_finish)       (GMount         *mount,
106                                               GAsyncResult    *result,
107                                               GError         **error);
108 };
109
110 GType g_mount_get_type (void) G_GNUC_CONST;
111
112 GFile *            g_mount_get_root             (GMount              *mount);
113 char *             g_mount_get_name             (GMount              *mount);
114 GIcon *            g_mount_get_icon             (GMount              *mount);
115 char *             g_mount_get_uuid             (GMount              *mount);
116 GVolume *          g_mount_get_volume           (GMount              *mount);
117 GDrive *           g_mount_get_drive            (GMount              *mount);
118 gboolean           g_mount_can_unmount          (GMount              *mount);
119 gboolean           g_mount_can_eject            (GMount              *mount);
120 void               g_mount_unmount              (GMount              *mount,
121                                                  GMountUnmountFlags   flags,
122                                                  GCancellable        *cancellable,
123                                                  GAsyncReadyCallback  callback,
124                                                  gpointer             user_data);
125 gboolean           g_mount_unmount_finish       (GMount              *mount,
126                                                  GAsyncResult        *result,
127                                                  GError             **error);
128 void               g_mount_eject                (GMount              *mount,
129                                                  GMountUnmountFlags   flags,
130                                                  GCancellable        *cancellable,
131                                                  GAsyncReadyCallback  callback,
132                                                  gpointer             user_data);
133 gboolean           g_mount_eject_finish         (GMount              *mount,
134                                                  GAsyncResult        *result,
135                                                  GError             **error);
136 void               g_mount_remount              (GMount              *mount,
137                                                  GMountMountFlags     flags,
138                                                  GMountOperation     *mount_operation,
139                                                  GCancellable        *cancellable,
140                                                  GAsyncReadyCallback  callback,
141                                                  gpointer             user_data);
142 gboolean           g_mount_remount_finish       (GMount              *mount,
143                                                  GAsyncResult        *result,
144                                                  GError             **error);
145
146 G_END_DECLS
147
148 #endif /* __G_MOUNT_H__ */