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>
27 #include <glib-object.h>
28 #include <gio/gfile.h>
32 #define G_TYPE_MOUNT (g_mount_get_type ())
33 #define G_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_MOUNT, GMount))
34 #define G_IS_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_MOUNT))
35 #define G_MOUNT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_MOUNT, GMountIface))
37 /* GMount typedef is in gfile.h due to include order issues */
41 * Opaque mountable volume object.
43 typedef struct _GVolume GVolume; /* Dummy typedef */
48 * Opaque drive object.
50 typedef struct _GDrive GDrive; /* Dummy typedef */
52 typedef struct _GMountIface GMountIface;
56 * @g_iface: The parent interface.
57 * @changed: Changed signal that is emitted when the mount's state has changed.
58 * @get_root: Gets a #GFile to the root directory of the #GMount.
59 * @get_name: Gets a string containing the name of the #GMount.
60 * @get_icon: Gets a #GIcon for the #GMount.
61 * @get_volume: Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.
62 * @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.
63 * @can_unmount: Checks if a #GMount can be unmounted.
64 * @unmount: Starts unmounting a #GMount.
65 * @unmount_finish: Finishes an unmounting operation.
67 * Interface for implementing operations for mounts.
71 GTypeInterface g_iface;
75 void (*changed) (GMount *mount);
79 GFile * (*get_root) (GMount *mount);
80 char * (*get_name) (GMount *mount);
81 GIcon * (*get_icon) (GMount *mount);
82 GVolume * (*get_volume) (GMount *mount);
83 GDrive * (*get_drive) (GMount *mount);
84 gboolean (*can_unmount) (GMount *mount);
85 void (*unmount) (GMount *mount,
86 GCancellable *cancellable,
87 GAsyncReadyCallback callback,
89 gboolean (*unmount_finish) (GMount *mount,
94 GType g_mount_get_type (void) G_GNUC_CONST;
96 GFile * g_mount_get_root (GMount *mount);
97 char * g_mount_get_name (GMount *mount);
98 GIcon * g_mount_get_icon (GMount *mount);
99 GVolume * g_mount_get_volume (GMount *mount);
100 GDrive * g_mount_get_drive (GMount *mount);
101 gboolean g_mount_can_unmount (GMount *mount);
102 void g_mount_unmount (GMount *mount,
103 GCancellable *cancellable,
104 GAsyncReadyCallback callback,
106 gboolean g_mount_unmount_finish (GMount *mount,
107 GAsyncResult *result,
112 #endif /* __G_MOUNT_H__ */