summaryrefslogtreecommitdiff
path: root/gio/src/mount.hg
blob: 8576b2a1380fcc84d04cb1669e3ba630a555f836 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-

/* Copyright (C) 2007 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

//#include <giomm/drive.h>
#include <giomm/file.h>
#include <giomm/volume.h>
#include <glibmm/interface.h>


_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)

#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GMountIface GMountIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gio
{

class Drive;
//class Volume;

/** The Mount interface represents user-visible mounts.
 * Mount is a "mounted" filesystem that you can access. Mounted is in quotes because it's not the same as a unix mount: 
 * it might be a gvfs mount, but you can still access the files on it if you use GIO. It might or might not be related to a volume object.
 *
 * Unmounting a Mount instance is an asynchronous operation. For more information about asynchronous operations, see AsyncReady. 
 * To unmount a Mount instance, first call unmount(). The callback slot will be called when the operation has resolved (either with success or failure), 
 * and a AsyncReady structure will be passed to the callback. That callback should then call unmount_finish() with the AsyncReady data to see if the operation was completed successfully. 
 *
 * @ingroup Streams
 *
 * @newin2p16
 */
class Mount : public Glib::Interface
{
  _CLASS_INTERFACE(Mount, GMount, G_MOUNT, GMountIface)

public:

  _WRAP_METHOD(Glib::RefPtr<File> get_root(), g_mount_get_root, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const File> get_root() const, g_mount_get_root, refreturn, constversion)

  _WRAP_METHOD(std::string get_name() const, g_mount_get_name)

  _WRAP_METHOD(Glib::RefPtr<Icon> get_icon(), g_mount_get_icon, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Icon> get_icon() const, g_mount_get_icon, refreturn, constversion)

  _WRAP_METHOD(std::string get_uuid() const, g_mount_get_uuid)

  _WRAP_METHOD(Glib::RefPtr<Volume> get_volume(), g_mount_get_volume, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Volume> get_volume() const, g_mount_get_volume, refreturn, constversion)

  _WRAP_METHOD(Glib::RefPtr<Drive> get_drive(), g_mount_get_drive, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Drive> get_drive() const, g_mount_get_drive, refreturn, constversion)

  _WRAP_METHOD(bool can_unmount() const, g_mount_can_unmount)
  _WRAP_METHOD(bool can_eject() const, g_mount_can_eject)

  /** Unmounts a mount. 
   * This is an asynchronous operation, and is finished by calling unmount_finish() with the AsyncResult data returned in the callback slot.
   *
   * @param slot A callback which will be called when the operation is completed or canceled.
   * @param cancellable A cancellable object which can be used to cancel the operation.
   * @param flags Flags affecting the unmount.
   */
  void unmount(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);

  /** Unmounts a mount. 
   * This is an asynchronous operation, and is finished by calling unmount_finish() with the AsyncResult data returned in the callback slot.
   *
   * @param slot A callback which will be called when the operation is completed or canceled.
   * @param flags Flags affecting the unmount.
   */
  void unmount(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);

  /** Unmounts a mount.
   *
   * @param cancellable A cancellable object which can be used to cancel the operation.
   */
  void unmount(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
  _IGNORE(g_mount_unmount)

  _WRAP_METHOD(bool unmount_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_unmount_finish, errthrow)

  /** Remounts a mount.
   * This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot.
   *
   * Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount 
   * to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to 
   * actually be unmounted.
   *
   * @param operation A mount operation.
   * @param slot A callback which will be called when the operation is completed or canceled.
   * @param cancellable A cancellable object which can be used to cancel the operation.
   */
  void remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags = MOUNT_MOUNT_NONE);

  /** Remounts a mount.
   * This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot.
   *
   * Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount 
   * to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to 
   * actually be unmounted.
   *
   * @param operation A mount operation.
   * @param slot A callback which will be called when the operation is completed or canceled.
   */
  void remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, MountMountFlags flags = MOUNT_MOUNT_NONE);

  /** Remounts a mount.
   * 
   * Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount 
   * to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to 
   * actually be unmounted.
   *
   * @param operation A mount operation.
   */
  void remount(const Glib::RefPtr<MountOperation>& operation, MountMountFlags flags = MOUNT_MOUNT_NONE);

  /** Remounts a mount, without user interaction.
   * 
   * Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount 
   * to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to 
   * actually be unmounted.
   */
  void remount(MountMountFlags flags = MOUNT_MOUNT_NONE);
  _IGNORE(g_mount_remount)


  _WRAP_METHOD(bool remount_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_remount_finish, errthrow)

  /** Ejects a mount. 
   * This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
   *
   * @param slot A callback which will be called when the operation is completed or canceled.
   * @param cancellable A cancellable object which can be used to cancel the operation.
   * @param flags Flags affecting the unmount if required for eject.
   */
  void eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);

  /** Ejects a mount. 
   * This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
   *
   * @param slot A callback which will be called when the operation is completed or canceled.
   * @param flags Flags affecting the unmount if required for eject.
   */
  void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);

  /** Ejects a mount. 
   *
   * @param flags Flags affecting the unmount if required for eject.
   */
  void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
  _IGNORE(g_mount_eject)

  _WRAP_METHOD(bool eject_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_eject_finish, errthrow)

  _WRAP_SIGNAL(void changed(), changed)
  _WRAP_SIGNAL(void unmounted(), unmounted)

  //There are no properties.
};

} // namespace Gio