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>
21 * David Zeuthen <davidz@redhat.com>
24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
28 #ifndef __G_VOLUME_H__
29 #define __G_VOLUME_H__
31 #include <glib-object.h>
32 #include <gio/gfile.h>
33 #include <gio/gdrive.h>
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))
44 * @g_iface: The parent interface.
45 * @changed: Changed signal that is emitted when the volume's state has changed.
46 * @removed: The removed signal that is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.
47 * @get_name: Gets a string containing the name of the #GVolume.
48 * @get_icon: Gets a #GIcon for the #GVolume.
49 * @get_uuid: Gets the UUID for the #GVolume. 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.
50 * @get_drive: Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive.
51 * @get_mount: Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted.
52 * @can_mount: Returns %TRUE if the #GVolume can be mounted.
53 * @can_eject: Checks if a #GVolume can be ejected.
54 * @mount_fn: Mounts a given #GVolume.
55 * @mount_finish: Finishes a mount operation.
56 * @eject: Ejects a given #GVolume.
57 * @eject_finish: Finishes an eject operation.
59 * Interface for implementing operations for mountable volumes.
61 typedef struct _GVolumeIface GVolumeIface;
65 GTypeInterface g_iface;
69 void (*changed) (GVolume *volume);
70 void (*removed) (GVolume *volume);
74 char * (*get_name) (GVolume *volume);
75 GIcon * (*get_icon) (GVolume *volume);
76 char * (*get_uuid) (GVolume *volume);
77 GDrive * (*get_drive) (GVolume *volume);
78 GMount * (*get_mount) (GVolume *volume);
79 gboolean (*can_mount) (GVolume *volume);
80 gboolean (*can_eject) (GVolume *volume);
81 void (*mount_fn) (GVolume *volume,
82 GMountOperation *mount_operation,
83 GCancellable *cancellable,
84 GAsyncReadyCallback callback,
86 gboolean (*mount_finish) (GVolume *volume,
89 void (*eject) (GVolume *volume,
90 GMountUnmountFlags flags,
91 GCancellable *cancellable,
92 GAsyncReadyCallback callback,
94 gboolean (*eject_finish) (GVolume *volume,
99 GType g_volume_get_type (void) G_GNUC_CONST;
101 char * g_volume_get_name (GVolume *volume);
102 GIcon * g_volume_get_icon (GVolume *volume);
103 char * g_volume_get_uuid (GVolume *volume);
104 GDrive * g_volume_get_drive (GVolume *volume);
105 GMount * g_volume_get_mount (GVolume *volume);
106 gboolean g_volume_can_mount (GVolume *volume);
107 gboolean g_volume_can_eject (GVolume *volume);
108 void g_volume_mount (GVolume *volume,
109 GMountOperation *mount_operation,
110 GCancellable *cancellable,
111 GAsyncReadyCallback callback,
113 gboolean g_volume_mount_finish (GVolume *volume,
114 GAsyncResult *result,
116 void g_volume_eject (GVolume *volume,
117 GMountUnmountFlags flags,
118 GCancellable *cancellable,
119 GAsyncReadyCallback callback,
121 gboolean g_volume_eject_finish (GVolume *volume,
122 GAsyncResult *result,
127 #endif /* __G_VOLUME_H__ */