1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <giomm/mount.h>
5 #include <giomm/private/mount_p.h>
7 // -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2 -*-
9 /* Copyright (C) 2007 The gtkmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <giomm/drive.h>
27 #include <giomm/volume.h>
29 #include "slot_async.h"
34 void Mount::unmount(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
36 // Create a copy of the slot.
37 // A pointer to it will be passed through the callback's data parameter
38 // and deleted in the callback.
39 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
41 g_mount_unmount(gobj(),
42 GMountUnmountFlags(flags),
44 &SignalProxy_async_callback,
48 void Mount::unmount(const SlotAsyncReady& slot, MountUnmountFlags flags)
50 // Create a copy of the slot.
51 // A pointer to it will be passed through the callback's data parameter
52 // and deleted in the callback.
53 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
55 g_mount_unmount(gobj(),
56 GMountUnmountFlags(flags),
58 &SignalProxy_async_callback,
62 void Mount::unmount(MountUnmountFlags flags)
64 g_mount_unmount(gobj(),
65 GMountUnmountFlags(flags),
72 void Mount::remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags)
74 // Create a copy of the slot.
75 // A pointer to it will be passed through the callback's data parameter
76 // and deleted in the callback.
77 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
79 g_mount_remount(gobj(),
80 static_cast<GMountMountFlags>(flags),
83 &SignalProxy_async_callback,
87 void Mount::remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, MountMountFlags flags)
89 // Create a copy of the slot.
90 // A pointer to it will be passed through the callback's data parameter
91 // and deleted in the callback.
92 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
94 g_mount_remount(gobj(),
95 static_cast<GMountMountFlags>(flags),
98 &SignalProxy_async_callback,
102 void Mount::remount(const Glib::RefPtr<MountOperation>& operation, MountMountFlags flags)
104 g_mount_remount(gobj(),
105 static_cast<GMountMountFlags>(flags),
112 void Mount::remount(MountMountFlags flags)
114 g_mount_remount(gobj(),
115 static_cast<GMountMountFlags>(flags),
122 void Mount::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
124 // Create a copy of the slot.
125 // A pointer to it will be passed through the callback's data parameter
126 // and deleted in the callback.
127 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
129 g_mount_eject(gobj(),
130 GMountUnmountFlags(flags),
132 &SignalProxy_async_callback,
136 void Mount::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
138 // Create a copy of the slot.
139 // A pointer to it will be passed through the callback's data parameter
140 // and deleted in the callback.
141 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
143 g_mount_eject(gobj(),
144 GMountUnmountFlags(flags),
146 &SignalProxy_async_callback,
150 void Mount::eject(MountUnmountFlags flags)
152 g_mount_eject(gobj(),
153 GMountUnmountFlags(flags),
160 void Mount::guess_content_type(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan)
162 // Create a copy of the slot.
163 // A pointer to it will be passed through the callback's data parameter
164 // and deleted in the callback.
165 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
167 g_mount_guess_content_type(gobj(),
170 &SignalProxy_async_callback,
174 void Mount::guess_content_type(const SlotAsyncReady& slot, bool force_rescan)
176 // Create a copy of the slot.
177 // A pointer to it will be passed through the callback's data parameter
178 // and deleted in the callback.
179 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
181 g_mount_guess_content_type(gobj(),
184 &SignalProxy_async_callback,
188 void Mount::guess_content_type(bool force_rescan)
190 g_mount_guess_content_type(gobj(),
205 static const Glib::SignalProxyInfo Mount_signal_changed_info =
208 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
209 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
213 static const Glib::SignalProxyInfo Mount_signal_unmounted_info =
216 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
217 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
221 } // anonymous namespace
227 Glib::RefPtr<Gio::Mount> wrap(GMount* object, bool take_copy)
229 return Glib::RefPtr<Gio::Mount>( dynamic_cast<Gio::Mount*> (Glib::wrap_auto_interface<Gio::Mount> ((GObject*)(object), take_copy)) );
230 //We use dynamic_cast<> in case of multiple inheritance.
240 /* The *_Class implementation: */
242 const Glib::Interface_Class& Mount_Class::init()
244 if(!gtype_) // create the GType if necessary
246 // Glib::Interface_Class has to know the interface init function
247 // in order to add interfaces to implementing types.
248 class_init_func_ = &Mount_Class::iface_init_function;
250 // We can not derive from another interface, and it is not necessary anyway.
251 gtype_ = g_mount_get_type();
257 void Mount_Class::iface_init_function(void* g_iface, void*)
259 BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
261 //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
262 //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
263 g_assert(klass != 0);
265 #ifdef GLIBMM_VFUNCS_ENABLED
266 #endif //GLIBMM_VFUNCS_ENABLED
268 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
269 klass->changed = &changed_callback;
270 klass->unmounted = &unmounted_callback;
271 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
274 #ifdef GLIBMM_VFUNCS_ENABLED
275 #endif //GLIBMM_VFUNCS_ENABLED
277 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
278 void Mount_Class::changed_callback(GMount* self)
280 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
281 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
283 // Non-gtkmmproc-generated custom classes implicitly call the default
284 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
285 // generated classes can use this optimisation, which avoids the unnecessary
286 // parameter conversions if there is no possibility of the virtual function
288 if(obj_base && obj_base->is_derived_())
290 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
291 if(obj) // This can be NULL during destruction.
293 #ifdef GLIBMM_EXCEPTIONS_ENABLED
294 try // Trap C++ exceptions which would normally be lost because this is a C callback.
296 #endif //GLIBMM_EXCEPTIONS_ENABLED
297 // Call the virtual member method, which derived classes might override.
300 #ifdef GLIBMM_EXCEPTIONS_ENABLED
304 Glib::exception_handlers_invoke();
306 #endif //GLIBMM_EXCEPTIONS_ENABLED
310 BaseClassType *const base = static_cast<BaseClassType*>(
311 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
312 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
315 // Call the original underlying C function:
316 if(base && base->changed)
317 (*base->changed)(self);
319 void Mount_Class::unmounted_callback(GMount* self)
321 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
322 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
324 // Non-gtkmmproc-generated custom classes implicitly call the default
325 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
326 // generated classes can use this optimisation, which avoids the unnecessary
327 // parameter conversions if there is no possibility of the virtual function
329 if(obj_base && obj_base->is_derived_())
331 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
332 if(obj) // This can be NULL during destruction.
334 #ifdef GLIBMM_EXCEPTIONS_ENABLED
335 try // Trap C++ exceptions which would normally be lost because this is a C callback.
337 #endif //GLIBMM_EXCEPTIONS_ENABLED
338 // Call the virtual member method, which derived classes might override.
341 #ifdef GLIBMM_EXCEPTIONS_ENABLED
345 Glib::exception_handlers_invoke();
347 #endif //GLIBMM_EXCEPTIONS_ENABLED
351 BaseClassType *const base = static_cast<BaseClassType*>(
352 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
353 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
356 // Call the original underlying C function:
357 if(base && base->unmounted)
358 (*base->unmounted)(self);
360 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
363 Glib::ObjectBase* Mount_Class::wrap_new(GObject* object)
365 return new Mount((GMount*)(object));
369 /* The implementation: */
373 Glib::Interface(mount_class_.init())
376 Mount::Mount(GMount* castitem)
378 Glib::Interface((GObject*)(castitem))
381 Mount::Mount(const Glib::Interface_Class& interface_class)
382 : Glib::Interface(interface_class)
390 void Mount::add_interface(GType gtype_implementer)
392 mount_class_.init().add_interface(gtype_implementer);
395 Mount::CppClassType Mount::mount_class_; // initialize static member
397 GType Mount::get_type()
399 return mount_class_.init().get_type();
402 GType Mount::get_base_type()
404 return g_mount_get_type();
408 Glib::RefPtr<File> Mount::get_root()
411 Glib::RefPtr<File> retvalue = Glib::wrap(g_mount_get_root(gobj()));
413 retvalue->reference(); //The function does not do a ref for us.
418 Glib::RefPtr<const File> Mount::get_root() const
420 return const_cast<Mount*>(this)->get_root();
423 std::string Mount::get_name() const
425 return Glib::convert_return_gchar_ptr_to_stdstring(g_mount_get_name(const_cast<GMount*>(gobj())));
428 Glib::RefPtr<Icon> Mount::get_icon()
431 Glib::RefPtr<Icon> retvalue = Glib::wrap(g_mount_get_icon(gobj()));
433 retvalue->reference(); //The function does not do a ref for us.
438 Glib::RefPtr<const Icon> Mount::get_icon() const
440 return const_cast<Mount*>(this)->get_icon();
443 std::string Mount::get_uuid() const
445 return Glib::convert_return_gchar_ptr_to_stdstring(g_mount_get_uuid(const_cast<GMount*>(gobj())));
448 Glib::RefPtr<Volume> Mount::get_volume()
451 Glib::RefPtr<Volume> retvalue = Glib::wrap(g_mount_get_volume(gobj()));
453 retvalue->reference(); //The function does not do a ref for us.
458 Glib::RefPtr<const Volume> Mount::get_volume() const
460 return const_cast<Mount*>(this)->get_volume();
463 Glib::RefPtr<Drive> Mount::get_drive()
466 Glib::RefPtr<Drive> retvalue = Glib::wrap(g_mount_get_drive(gobj()));
468 retvalue->reference(); //The function does not do a ref for us.
473 Glib::RefPtr<const Drive> Mount::get_drive() const
475 return const_cast<Mount*>(this)->get_drive();
478 bool Mount::can_unmount() const
480 return g_mount_can_unmount(const_cast<GMount*>(gobj()));
483 bool Mount::can_eject() const
485 return g_mount_can_eject(const_cast<GMount*>(gobj()));
488 #ifdef GLIBMM_EXCEPTIONS_ENABLED
489 bool Mount::unmount_finish(const Glib::RefPtr<AsyncResult>& result)
491 bool Mount::unmount_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
492 #endif //GLIBMM_EXCEPTIONS_ENABLED
495 bool retvalue = g_mount_unmount_finish(gobj(), Glib::unwrap(result), &(gerror));
496 #ifdef GLIBMM_EXCEPTIONS_ENABLED
498 ::Glib::Error::throw_exception(gerror);
501 error = ::Glib::Error::throw_exception(gerror);
502 #endif //GLIBMM_EXCEPTIONS_ENABLED
508 #ifdef GLIBMM_EXCEPTIONS_ENABLED
509 bool Mount::remount_finish(const Glib::RefPtr<AsyncResult>& result)
511 bool Mount::remount_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
512 #endif //GLIBMM_EXCEPTIONS_ENABLED
515 bool retvalue = g_mount_remount_finish(gobj(), Glib::unwrap(result), &(gerror));
516 #ifdef GLIBMM_EXCEPTIONS_ENABLED
518 ::Glib::Error::throw_exception(gerror);
521 error = ::Glib::Error::throw_exception(gerror);
522 #endif //GLIBMM_EXCEPTIONS_ENABLED
528 #ifdef GLIBMM_EXCEPTIONS_ENABLED
529 bool Mount::eject_finish(const Glib::RefPtr<AsyncResult>& result)
531 bool Mount::eject_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
532 #endif //GLIBMM_EXCEPTIONS_ENABLED
535 bool retvalue = g_mount_eject_finish(gobj(), Glib::unwrap(result), &(gerror));
536 #ifdef GLIBMM_EXCEPTIONS_ENABLED
538 ::Glib::Error::throw_exception(gerror);
541 error = ::Glib::Error::throw_exception(gerror);
542 #endif //GLIBMM_EXCEPTIONS_ENABLED
548 #ifdef GLIBMM_EXCEPTIONS_ENABLED
549 Glib::StringArrayHandle Mount::guess_content_type_finish(const Glib::RefPtr<AsyncResult>& result)
551 Glib::StringArrayHandle Mount::guess_content_type_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
552 #endif //GLIBMM_EXCEPTIONS_ENABLED
555 Glib::StringArrayHandle retvalue = Glib::StringArrayHandle(g_mount_guess_content_type_finish(gobj(), Glib::unwrap(result), &(gerror)), Glib::OWNERSHIP_DEEP);
556 #ifdef GLIBMM_EXCEPTIONS_ENABLED
558 ::Glib::Error::throw_exception(gerror);
561 error = ::Glib::Error::throw_exception(gerror);
562 #endif //GLIBMM_EXCEPTIONS_ENABLED
569 Glib::SignalProxy0< void > Mount::signal_changed()
571 return Glib::SignalProxy0< void >(this, &Mount_signal_changed_info);
575 Glib::SignalProxy0< void > Mount::signal_unmounted()
577 return Glib::SignalProxy0< void >(this, &Mount_signal_unmounted_info);
581 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
582 void Gio::Mount::on_changed()
584 BaseClassType *const base = static_cast<BaseClassType*>(
585 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
586 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
589 if(base && base->changed)
590 (*base->changed)(gobj());
592 void Gio::Mount::on_unmounted()
594 BaseClassType *const base = static_cast<BaseClassType*>(
595 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
596 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
599 if(base && base->unmounted)
600 (*base->unmounted)(gobj());
602 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
604 #ifdef GLIBMM_VFUNCS_ENABLED
605 #endif //GLIBMM_VFUNCS_ENABLED