Fix crash on startup if an LV2 plugin has a bad .ttl file.
[ardour.git] / libs / glibmm2 / gio / giomm / mount.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GIOMM_MOUNT_H
4 #define _GIOMM_MOUNT_H
5
6
7 #include <glibmm.h>
8
9 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
10
11 /* Copyright (C) 2007 The gtkmm Development Team
12  *
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.
17  *
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.
22  *
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.
26  */
27
28 //#include <giomm/drive.h>
29 #include <giomm/file.h>
30 #include <giomm/volume.h>
31 #include <glibmm/interface.h>
32
33
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 typedef struct _GMountIface GMountIface;
36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
37
38
39 #ifndef DOXYGEN_SHOULD_SKIP_THIS
40 typedef struct _GMount GMount;
41 typedef struct _GMountClass GMountClass;
42 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
43
44
45 namespace Gio
46 { class Mount_Class; } // namespace Gio
47 namespace Gio
48 {
49
50 class Drive;
51 //class Volume;
52
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.
56  *
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. 
60  *
61  * @ingroup Streams
62  *
63  * @newin2p16
64  */
65
66 class Mount : public Glib::Interface
67 {
68   
69 #ifndef DOXYGEN_SHOULD_SKIP_THIS
70
71 public:
72   typedef Mount CppObjectType;
73   typedef Mount_Class CppClassType;
74   typedef GMount BaseObjectType;
75   typedef GMountIface BaseClassType;
76
77 private:
78   friend class Mount_Class;
79   static CppClassType mount_class_;
80
81   // noncopyable
82   Mount(const Mount&);
83   Mount& operator=(const Mount&);
84
85 protected:
86   Mount(); // you must derive from this class
87
88   /** Called by constructors of derived classes. Provide the result of 
89    * the Class init() function to ensure that it is properly 
90    * initialized.
91    * 
92    * @param interface_class The Class object for the derived type.
93    */
94   explicit Mount(const Glib::Interface_Class& interface_class);
95
96 public:
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);
101
102 protected:
103 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
104
105 public:
106   virtual ~Mount();
107
108   static void add_interface(GType gtype_implementer);
109
110 #ifndef DOXYGEN_SHOULD_SKIP_THIS
111   static GType get_type()      G_GNUC_CONST;
112   static GType get_base_type() G_GNUC_CONST;
113 #endif
114
115   ///Provides access to the underlying C GObject.
116   GMount*       gobj()       { return reinterpret_cast<GMount*>(gobject_); }
117
118   ///Provides access to the underlying C GObject.  
119   const GMount* gobj() const { return reinterpret_cast<GMount*>(gobject_); }
120
121 private:
122
123
124 public:
125
126   
127   /** Gets the root directory on @a mount.
128    * @return A File.
129    */
130   Glib::RefPtr<File> get_root();
131   
132   /** Gets the root directory on @a mount.
133    * @return A File.
134    */
135   Glib::RefPtr<const File> get_root() const;
136
137   
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.
141    */
142   std::string get_name() const;
143
144   
145   /** Gets the icon for @a mount.
146    * @return A Icon.
147    */
148   Glib::RefPtr<Icon> get_icon();
149   
150   /** Gets the icon for @a mount.
151    * @return A Icon.
152    */
153   Glib::RefPtr<const Icon> get_icon() const;
154
155   
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
159    * available.
160    * @return The UUID for @a mount or <tt>0</tt> if no UUID can be computed.
161    */
162   std::string get_uuid() const;
163
164   
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.
167    */
168   Glib::RefPtr<Volume> get_volume();
169   
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.
172    */
173   Glib::RefPtr<const Volume> get_volume() const;
174
175   
176   /** Gets the drive for the @a mount.
177    * 
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.
181    */
182   Glib::RefPtr<Drive> get_drive();
183   
184   /** Gets the drive for the @a mount.
185    * 
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.
189    */
190   Glib::RefPtr<const Drive> get_drive() const;
191
192   
193   /** Checks if @a mount can be mounted.
194    * @return <tt>true</tt> if the @a mount can be unmounted.
195    */
196   bool can_unmount() const;
197   
198   /** Checks if @a mount can be eject.
199    * @return <tt>true</tt> if the @a mount can be ejected.
200    */
201   bool can_eject() const;
202
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.
205    *
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.
209    */
210   void unmount(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
211
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.
214    *
215    * @param slot A callback which will be called when the operation is completed or canceled.
216    * @param flags Flags affecting the unmount.
217    */
218   void unmount(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
219
220   /** Unmounts a mount.
221    *
222    * @param cancellable A cancellable object which can be used to cancel the operation.
223    */
224   void unmount(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
225   
226
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.
231    */
232 #ifdef GLIBMM_EXCEPTIONS_ENABLED
233   bool unmount_finish(const Glib::RefPtr<AsyncResult>& result);
234 #else
235   bool unmount_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error);
236 #endif //GLIBMM_EXCEPTIONS_ENABLED
237
238
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.
241    *
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.
245    *
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.
249    */
250   void remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags = MOUNT_MOUNT_NONE);
251
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.
254    *
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.
258    *
259    * @param operation A mount operation.
260    * @param slot A callback which will be called when the operation is completed or canceled.
261    */
262   void remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, MountMountFlags flags = MOUNT_MOUNT_NONE);
263
264   /** Remounts a mount.
265    * 
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.
269    *
270    * @param operation A mount operation.
271    */
272   void remount(const Glib::RefPtr<MountOperation>& operation, MountMountFlags flags = MOUNT_MOUNT_NONE);
273
274   /** Remounts a mount, without user interaction.
275    * 
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.
279    */
280   void remount(MountMountFlags flags = MOUNT_MOUNT_NONE);
281   
282
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.
287    */
288 #ifdef GLIBMM_EXCEPTIONS_ENABLED
289   bool remount_finish(const Glib::RefPtr<AsyncResult>& result);
290 #else
291   bool remount_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error);
292 #endif //GLIBMM_EXCEPTIONS_ENABLED
293
294
295   /** Ejects a mount. 
296    * This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
297    *
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.
301    */
302   void eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
303
304   /** Ejects a mount. 
305    * This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
306    *
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.
309    */
310   void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
311
312   /** Ejects a mount. 
313    *
314    * @param flags Flags affecting the unmount if required for eject.
315    */
316   void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
317   
318
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.
323    */
324 #ifdef GLIBMM_EXCEPTIONS_ENABLED
325   bool eject_finish(const Glib::RefPtr<AsyncResult>& result);
326 #else
327   bool eject_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error);
328 #endif //GLIBMM_EXCEPTIONS_ENABLED
329
330
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.
335    *
336    * This is an asynchronous operation, and is finished by calling 
337    * guess_content_type_finish().
338    *
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.
342    *
343    * @newin2p18
344    */
345   void guess_content_type(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan = true);
346
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.
351    *
352    * This is an asynchronous operation, and is finished by calling 
353    * guess_content_type_finish().
354    *
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.
357    *
358    * @newin2p18
359    */
360   void guess_content_type(const SlotAsyncReady& slot, bool force_rescan = true);
361
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.
366    *
367    * @param force_rescan Whether to force a rescan of the content. Otherwise a cached result will be used if available.
368    *
369    * @newin2p18
370    */
371   void guess_content_type(bool force_rescan = true);
372   
373
374   //TODO: Correct the documentation:
375   
376 #ifdef GLIBMM_EXCEPTIONS_ENABLED
377   Glib::StringArrayHandle guess_content_type_finish(const Glib::RefPtr<AsyncResult>& result);
378 #else
379   Glib::StringArrayHandle guess_content_type_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error);
380 #endif //GLIBMM_EXCEPTIONS_ENABLED
381
382
383   /**
384    * @par Prototype:
385    * <tt>void on_my_%changed()</tt>
386    */
387
388   Glib::SignalProxy0< void > signal_changed();
389
390   
391   /**
392    * @par Prototype:
393    * <tt>void on_my_%unmounted()</tt>
394    */
395
396   Glib::SignalProxy0< void > signal_unmounted();
397
398
399   //There are no properties.
400
401
402 public:
403
404 public:
405   //C++ methods used to invoke GTK+ virtual functions:
406 #ifdef GLIBMM_VFUNCS_ENABLED
407 #endif //GLIBMM_VFUNCS_ENABLED
408
409 protected:
410   //GTK+ Virtual Functions (override these to change behaviour):
411 #ifdef GLIBMM_VFUNCS_ENABLED
412 #endif //GLIBMM_VFUNCS_ENABLED
413
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
419
420
421 };
422
423 } // namespace Gio
424
425 namespace Glib
426 {
427
428 //Pre-declare this so we can use it in TypeTrait:
429 Glib::RefPtr<Gio::Mount> wrap(GMount* object, bool take_copy);
430
431 namespace Container_Helpers
432 {
433
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.
438  */ 
439 template <>
440 struct TypeTraits< Glib::RefPtr<Gio::Mount> >
441 {
442   typedef Glib::RefPtr<Gio::Mount> CppType;
443   typedef GMount* CType;
444   typedef GMount* CTypeNonConst;
445
446   static CType   to_c_type      (const CppType& item)
447   { return Glib::unwrap (item); }
448
449   static CppType to_cpp_type    (const CType& item)
450   {
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 */);
454   }
455
456   static void    release_c_type (CType item)
457   {
458     GLIBMM_DEBUG_UNREFERENCE(0, item);
459     g_object_unref(item);
460   }
461 };
462
463 } // Container_Helpers
464 } // Glib
465
466
467 namespace Glib
468 {
469   /** A Glib::wrap() method for this object.
470    * 
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.
474    *
475    * @relates Gio::Mount
476    */
477   Glib::RefPtr<Gio::Mount> wrap(GMount* object, bool take_copy = false);
478
479 } // namespace Glib
480
481
482 #endif /* _GIOMM_MOUNT_H */
483