2 // Generated by gtkmmproc -- DO NOT MODIFY!
9 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
11 /* Copyright (C) 2007 The gtkmm Development Team
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
23 * You should have received a copy of the GNU Library General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 //#include <giomm/drive.h>
29 #include <giomm/file.h>
30 #include <giomm/volume.h>
31 #include <glibmm/interface.h>
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 typedef struct _GMountIface GMountIface;
36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
39 #ifndef DOXYGEN_SHOULD_SKIP_THIS
40 typedef struct _GMount GMount;
41 typedef struct _GMountClass GMountClass;
42 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
46 { class Mount_Class; } // namespace Gio
53 /** The Mount interface represents user-visible mounts.
54 * Mount is a "mounted" filesystem that you can access. Mounted is in quotes because it's not the same as a unix mount:
55 * 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.
57 * Unmounting a Mount instance is an asynchronous operation. For more information about asynchronous operations, see AsyncReady.
58 * To unmount a Mount instance, first call unmount(). The callback slot will be called when the operation has resolved (either with success or failure),
59 * 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.
66 class Mount : public Glib::Interface
69 #ifndef DOXYGEN_SHOULD_SKIP_THIS
72 typedef Mount CppObjectType;
73 typedef Mount_Class CppClassType;
74 typedef GMount BaseObjectType;
75 typedef GMountIface BaseClassType;
78 friend class Mount_Class;
79 static CppClassType mount_class_;
83 Mount& operator=(const Mount&);
86 Mount(); // you must derive from this class
88 /** Called by constructors of derived classes. Provide the result of
89 * the Class init() function to ensure that it is properly
92 * @param interface_class The Class object for the derived type.
94 explicit Mount(const Glib::Interface_Class& interface_class);
97 // This is public so that C++ wrapper instances can be
98 // created for C instances of unwrapped types.
99 // For instance, if an unexpected C type implements the C interface.
100 explicit Mount(GMount* castitem);
103 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
108 static void add_interface(GType gtype_implementer);
110 #ifndef DOXYGEN_SHOULD_SKIP_THIS
111 static GType get_type() G_GNUC_CONST;
112 static GType get_base_type() G_GNUC_CONST;
115 ///Provides access to the underlying C GObject.
116 GMount* gobj() { return reinterpret_cast<GMount*>(gobject_); }
118 ///Provides access to the underlying C GObject.
119 const GMount* gobj() const { return reinterpret_cast<GMount*>(gobject_); }
127 /** Gets the root directory on @a mount.
130 Glib::RefPtr<File> get_root();
132 /** Gets the root directory on @a mount.
135 Glib::RefPtr<const File> get_root() const;
138 /** Gets the name of @a mount.
139 * @return The name for the given @a mount. The returned string should
140 * be freed when no longer needed.
142 std::string get_name() const;
145 /** Gets the icon for @a mount.
148 Glib::RefPtr<Icon> get_icon();
150 /** Gets the icon for @a mount.
153 Glib::RefPtr<const Icon> get_icon() const;
156 /** Gets the UUID for the @a mount. The reference is typically based on
157 * the file system UUID for the mount in question and should be
158 * considered an opaque string. Returns <tt>0</tt> if there is no UUID
160 * @return The UUID for @a mount or <tt>0</tt> if no UUID can be computed.
162 std::string get_uuid() const;
165 /** Gets the volume for the @a mount.
166 * @return A Volume or <tt>0</tt> if @a mount is not associated with a volume.
168 Glib::RefPtr<Volume> get_volume();
170 /** Gets the volume for the @a mount.
171 * @return A Volume or <tt>0</tt> if @a mount is not associated with a volume.
173 Glib::RefPtr<const Volume> get_volume() const;
176 /** Gets the drive for the @a mount.
178 * This is a convenience method for getting the Volume and then
179 * using that object to get the Drive.
180 * @return A Drive or <tt>0</tt> if @a mount is not associated with a volume or a drive.
182 Glib::RefPtr<Drive> get_drive();
184 /** Gets the drive for the @a mount.
186 * This is a convenience method for getting the Volume and then
187 * using that object to get the Drive.
188 * @return A Drive or <tt>0</tt> if @a mount is not associated with a volume or a drive.
190 Glib::RefPtr<const Drive> get_drive() const;
193 /** Checks if @a mount can be mounted.
194 * @return <tt>true</tt> if the @a mount can be unmounted.
196 bool can_unmount() const;
198 /** Checks if @a mount can be eject.
199 * @return <tt>true</tt> if the @a mount can be ejected.
201 bool can_eject() const;
203 /** Unmounts a mount.
204 * This is an asynchronous operation, and is finished by calling unmount_finish() with the AsyncResult data returned in the callback slot.
206 * @param slot A callback which will be called when the operation is completed or canceled.
207 * @param cancellable A cancellable object which can be used to cancel the operation.
208 * @param flags Flags affecting the unmount.
210 void unmount(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
212 /** Unmounts a mount.
213 * This is an asynchronous operation, and is finished by calling unmount_finish() with the AsyncResult data returned in the callback slot.
215 * @param slot A callback which will be called when the operation is completed or canceled.
216 * @param flags Flags affecting the unmount.
218 void unmount(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
220 /** Unmounts a mount.
222 * @param cancellable A cancellable object which can be used to cancel the operation.
224 void unmount(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
227 /** Finishes unmounting a mount. If any errors occurred during the operation,
228 * @a error will be set to contain the errors and <tt>false</tt> will be returned.
229 * @param result A AsyncResult.
230 * @return <tt>true</tt> if the mount was successfully unmounted. <tt>false</tt> otherwise.
232 #ifdef GLIBMM_EXCEPTIONS_ENABLED
233 bool unmount_finish(const Glib::RefPtr<AsyncResult>& result);
235 bool unmount_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error);
236 #endif //GLIBMM_EXCEPTIONS_ENABLED
239 /** Remounts a mount.
240 * This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot.
242 * Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount
243 * to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to
244 * actually be unmounted.
246 * @param operation A mount operation.
247 * @param slot A callback which will be called when the operation is completed or canceled.
248 * @param cancellable A cancellable object which can be used to cancel the operation.
250 void remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags = MOUNT_MOUNT_NONE);
252 /** Remounts a mount.
253 * This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot.
255 * Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount
256 * to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to
257 * actually be unmounted.
259 * @param operation A mount operation.
260 * @param slot A callback which will be called when the operation is completed or canceled.
262 void remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, MountMountFlags flags = MOUNT_MOUNT_NONE);
264 /** Remounts a mount.
266 * Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount
267 * to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to
268 * actually be unmounted.
270 * @param operation A mount operation.
272 void remount(const Glib::RefPtr<MountOperation>& operation, MountMountFlags flags = MOUNT_MOUNT_NONE);
274 /** Remounts a mount, without user interaction.
276 * Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount
277 * to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to
278 * actually be unmounted.
280 void remount(MountMountFlags flags = MOUNT_MOUNT_NONE);
283 /** Finishes remounting a mount. If any errors occurred during the operation,
284 * @a error will be set to contain the errors and <tt>false</tt> will be returned.
285 * @param result A AsyncResult.
286 * @return <tt>true</tt> if the mount was successfully remounted. <tt>false</tt> otherwise.
288 #ifdef GLIBMM_EXCEPTIONS_ENABLED
289 bool remount_finish(const Glib::RefPtr<AsyncResult>& result);
291 bool remount_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error);
292 #endif //GLIBMM_EXCEPTIONS_ENABLED
296 * This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
298 * @param slot A callback which will be called when the operation is completed or canceled.
299 * @param cancellable A cancellable object which can be used to cancel the operation.
300 * @param flags Flags affecting the unmount if required for eject.
302 void eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
305 * This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
307 * @param slot A callback which will be called when the operation is completed or canceled.
308 * @param flags Flags affecting the unmount if required for eject.
310 void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
314 * @param flags Flags affecting the unmount if required for eject.
316 void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
319 /** Finishes ejecting a mount. If any errors occurred during the operation,
320 * @a error will be set to contain the errors and <tt>false</tt> will be returned.
321 * @param result A AsyncResult.
322 * @return <tt>true</tt> if the mount was successfully ejected. <tt>false</tt> otherwise.
324 #ifdef GLIBMM_EXCEPTIONS_ENABLED
325 bool eject_finish(const Glib::RefPtr<AsyncResult>& result);
327 bool eject_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error);
328 #endif //GLIBMM_EXCEPTIONS_ENABLED
331 /** Tries to guess the type of content stored on the mount.
332 * Returns one or more textual identifiers of well-known content types (typically
333 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera
334 * memory cards. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink> specification for more on x-content types.
336 * This is an asynchronous operation, and is finished by calling
337 * guess_content_type_finish().
339 * @param slot A callback which will be called when the operation is completed or canceled.
340 * @param cancellable A cancellable object which can be used to cancel the operation.
341 * @param force_rescan Whether to force a rescan of the content. Otherwise a cached result will be used if available.
345 void guess_content_type(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan = true);
347 /** Tries to guess the type of content stored on the mount.
348 * Returns one or more textual identifiers of well-known content types (typically
349 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera
350 * memory cards. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink> specification for more on x-content types.
352 * This is an asynchronous operation, and is finished by calling
353 * guess_content_type_finish().
355 * @param slot A callback which will be called when the operation is completed or canceled.
356 * @param force_rescan Whether to force a rescan of the content. Otherwise a cached result will be used if available.
360 void guess_content_type(const SlotAsyncReady& slot, bool force_rescan = true);
362 /** Tries to guess the type of content stored on the mount.
363 * Returns one or more textual identifiers of well-known content types (typically
364 * prefixed with "x-content/"), e.g. x-content/image-dcf for camera
365 * memory cards. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink> specification for more on x-content types.
367 * @param force_rescan Whether to force a rescan of the content. Otherwise a cached result will be used if available.
371 void guess_content_type(bool force_rescan = true);
374 //TODO: Correct the documentation:
376 #ifdef GLIBMM_EXCEPTIONS_ENABLED
377 Glib::StringArrayHandle guess_content_type_finish(const Glib::RefPtr<AsyncResult>& result);
379 Glib::StringArrayHandle guess_content_type_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error);
380 #endif //GLIBMM_EXCEPTIONS_ENABLED
385 * <tt>void on_my_%changed()</tt>
388 Glib::SignalProxy0< void > signal_changed();
393 * <tt>void on_my_%unmounted()</tt>
396 Glib::SignalProxy0< void > signal_unmounted();
399 //There are no properties.
405 //C++ methods used to invoke GTK+ virtual functions:
406 #ifdef GLIBMM_VFUNCS_ENABLED
407 #endif //GLIBMM_VFUNCS_ENABLED
410 //GTK+ Virtual Functions (override these to change behaviour):
411 #ifdef GLIBMM_VFUNCS_ENABLED
412 #endif //GLIBMM_VFUNCS_ENABLED
414 //Default Signal Handlers::
415 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
416 virtual void on_changed();
417 virtual void on_unmounted();
418 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
428 //Pre-declare this so we can use it in TypeTrait:
429 Glib::RefPtr<Gio::Mount> wrap(GMount* object, bool take_copy);
431 namespace Container_Helpers
434 /** This specialization of TypeTraits exists
435 * because the default use of Glib::wrap(GObject*),
436 * instead of a specific Glib::wrap(GSomeInterface*),
437 * would not return a wrapper for an interface.
440 struct TypeTraits< Glib::RefPtr<Gio::Mount> >
442 typedef Glib::RefPtr<Gio::Mount> CppType;
443 typedef GMount* CType;
444 typedef GMount* CTypeNonConst;
446 static CType to_c_type (const CppType& item)
447 { return Glib::unwrap (item); }
449 static CppType to_cpp_type (const CType& item)
451 //Use a specific Glib::wrap() function,
452 //because CType has the specific type (not just GObject):
453 return Glib::wrap(item, true /* take_copy */);
456 static void release_c_type (CType item)
458 GLIBMM_DEBUG_UNREFERENCE(0, item);
459 g_object_unref(item);
463 } // Container_Helpers
469 /** A Glib::wrap() method for this object.
471 * @param object The C instance.
472 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
473 * @result A C++ instance that wraps this C instance.
475 * @relates Gio::Mount
477 Glib::RefPtr<Gio::Mount> wrap(GMount* object, bool take_copy = false);
482 #endif /* _GIOMM_MOUNT_H */