1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2006-2007 Red Hat, Inc.
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.
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.
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.
20 * Author: Alexander Larsson <alexl@redhat.com>
23 #ifndef __G_VOLUME_H__
24 #define __G_VOLUME_H__
26 #include <glib-object.h>
27 #include <gio/gfile.h>
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))
36 /* GVolume typedef is in gfile.h due to include order issues */
40 * Opaque drive object.
42 typedef struct _GDrive GDrive; /* Dummy typedef */
43 typedef struct _GVolumeIface 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.
60 * Interface for implementing operations for mounted volumes.
64 GTypeInterface g_iface;
68 void (*changed) (GVolume *volume);
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,
82 gboolean (*unmount_finish) (GVolume *volume,
85 void (*eject) (GVolume *volume,
86 GCancellable *cancellable,
87 GAsyncReadyCallback callback,
89 gboolean (*eject_finish) (GVolume *volume,
94 GType g_volume_get_type (void) G_GNUC_CONST;
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,
106 gboolean g_volume_unmount_finish (GVolume *volume,
107 GAsyncResult *result,
109 void g_volume_eject (GVolume *volume,
110 GCancellable *cancellable,
111 GAsyncReadyCallback callback,
113 gboolean g_volume_eject_finish (GVolume *volume,
114 GAsyncResult *result,
119 #endif /* __G_VOLUME_H__ */