Fix crash on startup if an LV2 plugin has a bad .ttl file.
[ardour.git] / libs / glibmm2 / gio / giomm / drive.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <giomm/drive.h>
5 #include <giomm/private/drive_p.h>
6
7 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
8
9 /* Copyright (C) 2007 The gtkmm Development Team
10  *
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.
15  *
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.
20  *
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.
24  */
25
26 #include <gio/gio.h>
27 #include <glibmm/error.h>
28 #include <glibmm/exceptionhandler.h>
29 #include "slot_async.h"
30
31 namespace Gio
32 {
33
34 void Drive::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
35 {
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);
40
41   g_drive_eject(gobj(),
42                 static_cast<GMountUnmountFlags>(flags), 
43                 cancellable->gobj(),
44                 &SignalProxy_async_callback,
45                 slot_copy);
46 }
47
48 void Drive::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
49 {
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);
54
55   g_drive_eject(gobj(),
56                 static_cast<GMountUnmountFlags>(flags), 
57                 NULL, // cancellable
58                 &SignalProxy_async_callback,
59                 slot_copy);
60 }
61
62 void Drive::eject(MountUnmountFlags flags)
63 {
64   g_drive_eject(gobj(),
65                 static_cast<GMountUnmountFlags>(flags), 
66                 NULL, // cancellable
67                 NULL,
68                 NULL);
69 }
70
71 void Drive::poll_for_media(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
72 {
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);
77
78   g_drive_poll_for_media(gobj(),
79                          cancellable->gobj(),
80                          &SignalProxy_async_callback,
81                          slot_copy);
82 }
83
84 void Drive::poll_for_media(const SlotAsyncReady& slot)
85 {
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);
90
91   g_drive_poll_for_media(gobj(),
92                          NULL, // cancellable
93                          &SignalProxy_async_callback,
94                          slot_copy);
95 }
96
97 void Drive::poll_for_media()
98 {
99   g_drive_poll_for_media(gobj(),
100                          NULL, // cancellable
101                          NULL,
102                          NULL);
103 }
104
105 } // namespace Gio
106
107
108 namespace
109 {
110 } // anonymous namespace
111
112
113 namespace Glib
114 {
115
116 Glib::RefPtr<Gio::Drive> wrap(GDrive* object, bool take_copy)
117 {
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.
120 }
121
122 } // namespace Glib
123
124
125 namespace Gio
126 {
127
128
129 /* The *_Class implementation: */
130
131 const Glib::Interface_Class& Drive_Class::init()
132 {
133   if(!gtype_) // create the GType if necessary
134   {
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;
138
139     // We can not derive from another interface, and it is not necessary anyway.
140     gtype_ = g_drive_get_type();
141   }
142
143   return *this;
144 }
145
146 void Drive_Class::iface_init_function(void* g_iface, void*)
147 {
148   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
149
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); 
153
154 #ifdef GLIBMM_VFUNCS_ENABLED
155 #endif //GLIBMM_VFUNCS_ENABLED
156
157 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
158 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
159 }
160
161 #ifdef GLIBMM_VFUNCS_ENABLED
162 #endif //GLIBMM_VFUNCS_ENABLED
163
164 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
165 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
166
167
168 Glib::ObjectBase* Drive_Class::wrap_new(GObject* object)
169 {
170   return new Drive((GDrive*)(object));
171 }
172
173
174 /* The implementation: */
175
176 Drive::Drive()
177 :
178   Glib::Interface(drive_class_.init())
179 {}
180
181 Drive::Drive(GDrive* castitem)
182 :
183   Glib::Interface((GObject*)(castitem))
184 {}
185
186 Drive::Drive(const Glib::Interface_Class& interface_class)
187 : Glib::Interface(interface_class)
188 {
189 }
190
191 Drive::~Drive()
192 {}
193
194 // static
195 void Drive::add_interface(GType gtype_implementer)
196 {
197   drive_class_.init().add_interface(gtype_implementer);
198 }
199
200 Drive::CppClassType Drive::drive_class_; // initialize static member
201
202 GType Drive::get_type()
203 {
204   return drive_class_.init().get_type();
205 }
206
207 GType Drive::get_base_type()
208 {
209   return g_drive_get_type();
210 }
211
212
213 Glib::ustring Drive::get_name() const
214 {
215   return Glib::convert_return_gchar_ptr_to_ustring(g_drive_get_name(const_cast<GDrive*>(gobj())));
216 }
217
218 Glib::RefPtr<Icon> Drive::get_icon()
219 {
220
221   Glib::RefPtr<Icon> retvalue = Glib::wrap(g_drive_get_icon(gobj()));
222   if(retvalue)
223     retvalue->reference(); //The function does not do a ref for us.
224   return retvalue;
225
226 }
227
228 Glib::RefPtr<const Icon> Drive::get_icon() const
229 {
230   return const_cast<Drive*>(this)->get_icon();
231 }
232
233 bool Drive::has_volumes() const
234 {
235   return g_drive_has_volumes(const_cast<GDrive*>(gobj()));
236 }
237
238 Glib::ListHandle< Glib::RefPtr<Volume> > Drive::get_volumes()
239 {
240   return Glib::ListHandle< Glib::RefPtr<Volume> >(g_drive_get_volumes(gobj()), Glib::OWNERSHIP_SHALLOW);
241 }
242
243 bool Drive::is_media_removable() const
244 {
245   return g_drive_is_media_removable(const_cast<GDrive*>(gobj()));
246 }
247
248 bool Drive::has_media() const
249 {
250   return g_drive_has_media(const_cast<GDrive*>(gobj()));
251 }
252
253 bool Drive::is_media_check_automatic() const
254 {
255   return g_drive_is_media_check_automatic(const_cast<GDrive*>(gobj()));
256 }
257
258 bool Drive::can_poll_for_media() const
259 {
260   return g_drive_can_poll_for_media(const_cast<GDrive*>(gobj()));
261 }
262
263 bool Drive::can_eject() const
264 {
265   return g_drive_can_eject(const_cast<GDrive*>(gobj()));
266 }
267
268 #ifdef GLIBMM_EXCEPTIONS_ENABLED
269 bool Drive::eject_finish(const Glib::RefPtr<AsyncResult>& result)
270 #else
271 bool Drive::eject_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
272 #endif //GLIBMM_EXCEPTIONS_ENABLED
273 {
274   GError* gerror = 0;
275   bool retvalue = g_drive_eject_finish(gobj(), Glib::unwrap(result), &(gerror));
276 #ifdef GLIBMM_EXCEPTIONS_ENABLED
277   if(gerror)
278     ::Glib::Error::throw_exception(gerror);
279 #else
280   if(gerror)
281     error = ::Glib::Error::throw_exception(gerror);
282 #endif //GLIBMM_EXCEPTIONS_ENABLED
283
284   return retvalue;
285
286 }
287
288 #ifdef GLIBMM_EXCEPTIONS_ENABLED
289 bool Drive::poll_for_media_finish(const Glib::RefPtr<AsyncResult>& result)
290 #else
291 bool Drive::poll_for_media_finish(const Glib::RefPtr<AsyncResult>& result, std::auto_ptr<Glib::Error>& error)
292 #endif //GLIBMM_EXCEPTIONS_ENABLED
293 {
294   GError* gerror = 0;
295   bool retvalue = g_drive_poll_for_media_finish(gobj(), Glib::unwrap(result), &(gerror));
296 #ifdef GLIBMM_EXCEPTIONS_ENABLED
297   if(gerror)
298     ::Glib::Error::throw_exception(gerror);
299 #else
300   if(gerror)
301     error = ::Glib::Error::throw_exception(gerror);
302 #endif //GLIBMM_EXCEPTIONS_ENABLED
303
304   return retvalue;
305
306 }
307
308 std::string Drive::get_identifier(const std::string& kind) const
309 {
310   return Glib::convert_return_gchar_ptr_to_stdstring(g_drive_get_identifier(const_cast<GDrive*>(gobj()), kind.c_str()));
311 }
312
313 Glib::StringArrayHandle Drive::enumerate_identifiers() const
314 {
315   return Glib::StringArrayHandle(g_drive_enumerate_identifiers(const_cast<GDrive*>(gobj())));
316 }
317
318
319 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
320 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
321
322 #ifdef GLIBMM_VFUNCS_ENABLED
323 #endif //GLIBMM_VFUNCS_ENABLED
324
325
326 } // namespace Gio
327
328