1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <giomm/drive.h>
5 #include <giomm/private/drive_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.
27 #include <glibmm/error.h>
28 #include <glibmm/exceptionhandler.h>
29 #include "slot_async.h"
34 void Drive::eject(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);
42 static_cast<GMountUnmountFlags>(flags),
44 &SignalProxy_async_callback,
48 void Drive::eject(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);
56 static_cast<GMountUnmountFlags>(flags),
58 &SignalProxy_async_callback,
62 void Drive::eject(MountUnmountFlags flags)
65 static_cast<GMountUnmountFlags>(flags),
71 void Drive::poll_for_media(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
73 // Create a copy of the slot.
74 // A pointer to it will be passed through the callback's data parameter
75 // and deleted in the callback.
76 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
78 g_drive_poll_for_media(gobj(),
80 &SignalProxy_async_callback,
84 void Drive::poll_for_media(const SlotAsyncReady& slot)
86 // Create a copy of the slot.
87 // A pointer to it will be passed through the callback's data parameter
88 // and deleted in the callback.
89 SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
91 g_drive_poll_for_media(gobj(),
93 &SignalProxy_async_callback,
97 void Drive::poll_for_media()
99 g_drive_poll_for_media(gobj(),
110 } // anonymous namespace
116 Glib::RefPtr<Gio::Drive> wrap(GDrive* object, bool take_copy)
118 return Glib::RefPtr<Gio::Drive>( dynamic_cast<Gio::Drive*> (Glib::wrap_auto_interface<Gio::Drive> ((GObject*)(object), take_copy)) );
119 //We use dynamic_cast<> in case of multiple inheritance.
129 /* The *_Class implementation: */
131 const Glib::Interface_Class& Drive_Class::init()
133 if(!gtype_) // create the GType if necessary
135 // Glib::Interface_Class has to know the interface init function
136 // in order to add interfaces to implementing types.
137 class_init_func_ = &Drive_Class::iface_init_function;
139 // We can not derive from another interface, and it is not necessary anyway.
140 gtype_ = g_drive_get_type();
146 void Drive_Class::iface_init_function(void* g_iface, void*)
148 BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
150 //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
151 //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
152 g_assert(klass != 0);
154 #ifdef GLIBMM_VFUNCS_ENABLED
155 #endif //GLIBMM_VFUNCS_ENABLED
157 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
158 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
161 #ifdef GLIBMM_VFUNCS_ENABLED
162 #endif //GLIBMM_VFUNCS_ENABLED
164 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
165 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
168 Glib::ObjectBase* Drive_Class::wrap_new(GObject* object)
170 return new Drive((GDrive*)(object));
174 /* The implementation: */
178 Glib::Interface(drive_class_.init())
181 Drive::Drive(GDrive* castitem)
183 Glib::Interface((GObject*)(castitem))
186 Drive::Drive(const Glib::Interface_Class& interface_class)
187 : Glib::Interface(interface_class)
195 void Drive::add_interface(GType gtype_implementer)
197 drive_class_.init().add_interface(gtype_implementer);
200 Drive::CppClassType Drive::drive_class_; // initialize static member
202 GType Drive::get_type()
204 return drive_class_.init().get_type();
207 GType Drive::get_base_type()
209 return g_drive_get_type();
213 Glib::ustring Drive::get_name() const
215 return Glib::convert_return_gchar_ptr_to_ustring(g_drive_get_name(const_cast<GDrive*>(gobj())));
218 Glib::RefPtr<Icon> Drive::get_icon()
221 Glib::RefPtr<Icon> retvalue = Glib::wrap(g_drive_get_icon(gobj()));
223 retvalue->reference(); //The function does not do a ref for us.
228 Glib::RefPtr<const Icon> Drive::get_icon() const
230 return const_cast<Drive*>(this)->get_icon();
233 bool Drive::has_volumes() const
235 return g_drive_has_volumes(const_cast<GDrive*>(gobj()));
238 Glib::ListHandle< Glib::RefPtr<Volume> > Drive::get_volumes()
240 return Glib::ListHandle< Glib::RefPtr<Volume> >(g_drive_get_volumes(gobj()), Glib::OWNERSHIP_SHALLOW);
243 bool Drive::is_media_removable() const
245 return g_drive_is_media_removable(const_cast<GDrive*>(gobj()));
248 bool Drive::has_media() const
250 return g_drive_has_media(const_cast<GDrive*>(gobj()));
253 bool Drive::is_media_check_automatic() const
255 return g_drive_is_media_check_automatic(const_cast<GDrive*>(gobj()));
258 bool Drive::can_poll_for_media() const
260 return g_drive_can_poll_for_media(const_cast<GDrive*>(gobj()));
263 bool Drive::can_eject() const
265 return g_drive_can_eject(const_cast<GDrive*>(gobj()));
268 #ifdef GLIBMM_EXCEPTIONS_ENABLED
269 bool Drive::eject_finish(const Glib::RefPtr<AsyncResult>& result)
271 bool Drive::eject_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
272 #endif //GLIBMM_EXCEPTIONS_ENABLED
275 bool retvalue = g_drive_eject_finish(gobj(), Glib::unwrap(result), &(gerror));
276 #ifdef GLIBMM_EXCEPTIONS_ENABLED
278 ::Glib::Error::throw_exception(gerror);
281 error = ::Glib::Error::throw_exception(gerror);
282 #endif //GLIBMM_EXCEPTIONS_ENABLED
288 #ifdef GLIBMM_EXCEPTIONS_ENABLED
289 bool Drive::poll_for_media_finish(const Glib::RefPtr<AsyncResult>& result)
291 bool Drive::poll_for_media_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
292 #endif //GLIBMM_EXCEPTIONS_ENABLED
295 bool retvalue = g_drive_poll_for_media_finish(gobj(), Glib::unwrap(result), &(gerror));
296 #ifdef GLIBMM_EXCEPTIONS_ENABLED
298 ::Glib::Error::throw_exception(gerror);
301 error = ::Glib::Error::throw_exception(gerror);
302 #endif //GLIBMM_EXCEPTIONS_ENABLED
308 std::string Drive::get_identifier(const std::string& kind) const
310 return Glib::convert_return_gchar_ptr_to_stdstring(g_drive_get_identifier(const_cast<GDrive*>(gobj()), kind.c_str()));
313 Glib::StringArrayHandle Drive::enumerate_identifiers() const
315 return Glib::StringArrayHandle(g_drive_enumerate_identifiers(const_cast<GDrive*>(gobj())));
319 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
320 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
322 #ifdef GLIBMM_VFUNCS_ENABLED
323 #endif //GLIBMM_VFUNCS_ENABLED