Fix crash on startup if an LV2 plugin has a bad .ttl file.
[ardour.git] / libs / glibmm2 / gio / src / volume.ccg
1 // -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
3 /* Copyright (C) 2007 The gtkmm Development Team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20
21 #include <glibmm/error.h>
22 #include <glibmm/exceptionhandler.h>
23 #include <giomm/file.h>
24 #include <giomm/drive.h>
25 #include <gio/gio.h>
26 #include "slot_async.h"
27
28 namespace Gio {
29
30 void
31 Volume::mount(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags)
32 {
33   // Create a copy of the slot.
34   // A pointer to it will be passed through the callback's data parameter
35   // and deleted in the callback.
36   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
37
38   g_volume_mount(gobj(),
39                  static_cast<GMountMountFlags>(flags),
40                  mount_operation->gobj(),
41                  cancellable->gobj(),
42                  &SignalProxy_async_callback,
43                  slot_copy);
44
45 }
46
47 void
48 Volume::mount(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, MountMountFlags 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_volume_mount(gobj(),
56                  static_cast<GMountMountFlags>(flags),
57                  mount_operation->gobj(),
58                  NULL, // cancellable
59                  &SignalProxy_async_callback,
60                  slot_copy);
61 }
62
63 void
64 Volume::mount(const Glib::RefPtr<MountOperation>& mount_operation, MountMountFlags flags)
65 {
66   g_volume_mount(gobj(),
67                  static_cast<GMountMountFlags>(flags),
68                  mount_operation->gobj(),
69                  NULL, // cancellable
70                  NULL,
71                  NULL);
72 }
73
74 void
75 Volume::mount(MountMountFlags flags)
76 {
77   g_volume_mount(gobj(),
78                  static_cast<GMountMountFlags>(flags),
79                  NULL,
80                  NULL, // cancellable
81                  NULL,
82                  NULL);
83 }
84
85
86 void Volume::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
87 {
88   // Create a copy of the slot.
89   // A pointer to it will be passed through the callback's data parameter
90   // and deleted in the callback.
91   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
92
93   g_volume_eject(gobj(),
94                  static_cast<GMountUnmountFlags>(flags), 
95                  cancellable->gobj(),
96                  &SignalProxy_async_callback,
97                  slot_copy);
98 }
99
100 void Volume::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
101 {
102   // Create a copy of the slot.
103   // A pointer to it will be passed through the callback's data parameter
104   // and deleted in the callback.
105   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
106
107   g_volume_eject(gobj(),
108                  static_cast<GMountUnmountFlags>(flags), 
109                  NULL,
110                  &SignalProxy_async_callback,
111                  slot_copy);
112 }
113
114 void Volume::eject(MountUnmountFlags flags)
115 {
116   g_volume_eject(gobj(),
117                  static_cast<GMountUnmountFlags>(flags), 
118                  NULL,
119                  NULL,
120                  NULL);
121 }
122
123 } // namespace Gio
124