1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <giomm/filemonitor.h>
7 #include <giomm/private/filemonitor_p.h>
8
9
10 /* Copyright (C) 2007 The gtkmm Development Team
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26 #include <glibmm/exceptionhandler.h>
27 #include <giomm/file.h>
28 #include <gio/gio.h>
29
30 namespace Gio
31 {
32
33 } // namespace Gio
34
35 namespace
36 {
37
38
FileMonitor_signal_changed_callback(GFileMonitor * self,GFile * p0,GFile * p1,GFileMonitorEvent p2,void * data)39 static void FileMonitor_signal_changed_callback(GFileMonitor* self, GFile* p0,GFile* p1,GFileMonitorEvent p2,void* data)
40 {
41 using namespace Gio;
42 using SlotType = sigc::slot< void,const Glib::RefPtr<File>&,const Glib::RefPtr<File>&,FileMonitorEvent >;
43
44 auto obj = dynamic_cast<FileMonitor*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
45 // Do not try to call a signal on a disassociated wrapper.
46 if(obj)
47 {
48 try
49 {
50 if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
51 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
52 , Glib::wrap(p1, true)
53 , ((FileMonitorEvent)(p2))
54 );
55 }
56 catch(...)
57 {
58 Glib::exception_handlers_invoke();
59 }
60 }
61 }
62
63 static const Glib::SignalProxyInfo FileMonitor_signal_changed_info =
64 {
65 "changed",
66 (GCallback) &FileMonitor_signal_changed_callback,
67 (GCallback) &FileMonitor_signal_changed_callback
68 };
69
70
71 } // anonymous namespace
72
73
74 namespace Glib
75 {
76
wrap(GFileMonitor * object,bool take_copy)77 Glib::RefPtr<Gio::FileMonitor> wrap(GFileMonitor* object, bool take_copy)
78 {
79 return Glib::RefPtr<Gio::FileMonitor>( dynamic_cast<Gio::FileMonitor*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
80 //We use dynamic_cast<> in case of multiple inheritance.
81 }
82
83 } /* namespace Glib */
84
85
86 namespace Gio
87 {
88
89
90 /* The *_Class implementation: */
91
init()92 const Glib::Class& FileMonitor_Class::init()
93 {
94 if(!gtype_) // create the GType if necessary
95 {
96 // Glib::Class has to know the class init function to clone custom types.
97 class_init_func_ = &FileMonitor_Class::class_init_function;
98
99 // This is actually just optimized away, apparently with no harm.
100 // Make sure that the parent type has been created.
101 //CppClassParent::CppObjectType::get_type();
102
103 // Create the wrapper type, with the same class/instance size as the base type.
104 register_derived_type(g_file_monitor_get_type());
105
106 // Add derived versions of interfaces, if the C type implements any interfaces:
107
108 }
109
110 return *this;
111 }
112
113
class_init_function(void * g_class,void * class_data)114 void FileMonitor_Class::class_init_function(void* g_class, void* class_data)
115 {
116 const auto klass = static_cast<BaseClassType*>(g_class);
117 CppClassParent::class_init_function(klass, class_data);
118
119
120 klass->changed = &changed_callback;
121 }
122
123
changed_callback(GFileMonitor * self,GFile * p0,GFile * p1,GFileMonitorEvent p2)124 void FileMonitor_Class::changed_callback(GFileMonitor* self, GFile* p0, GFile* p1, GFileMonitorEvent p2)
125 {
126 const auto obj_base = static_cast<Glib::ObjectBase*>(
127 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
128
129 // Non-gtkmmproc-generated custom classes implicitly call the default
130 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
131 // generated classes can use this optimisation, which avoids the unnecessary
132 // parameter conversions if there is no possibility of the virtual function
133 // being overridden:
134 if(obj_base && obj_base->is_derived_())
135 {
136 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
137 if(obj) // This can be NULL during destruction.
138 {
139 try // Trap C++ exceptions which would normally be lost because this is a C callback.
140 {
141 // Call the virtual member method, which derived classes might override.
142 obj->on_changed(Glib::wrap(p0, true)
143 , Glib::wrap(p1, true)
144 , ((FileMonitorEvent)(p2))
145 );
146 return;
147 }
148 catch(...)
149 {
150 Glib::exception_handlers_invoke();
151 }
152 }
153 }
154
155 const auto base = static_cast<BaseClassType*>(
156 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
157 );
158
159 // Call the original underlying C function:
160 if(base && base->changed)
161 (*base->changed)(self, p0, p1, p2);
162 }
163
164
wrap_new(GObject * object)165 Glib::ObjectBase* FileMonitor_Class::wrap_new(GObject* object)
166 {
167 return new FileMonitor((GFileMonitor*)object);
168 }
169
170
171 /* The implementation: */
172
gobj_copy()173 GFileMonitor* FileMonitor::gobj_copy()
174 {
175 reference();
176 return gobj();
177 }
178
FileMonitor(const Glib::ConstructParams & construct_params)179 FileMonitor::FileMonitor(const Glib::ConstructParams& construct_params)
180 :
181 Glib::Object(construct_params)
182 {
183
184 }
185
FileMonitor(GFileMonitor * castitem)186 FileMonitor::FileMonitor(GFileMonitor* castitem)
187 :
188 Glib::Object((GObject*)(castitem))
189 {}
190
191
FileMonitor(FileMonitor && src)192 FileMonitor::FileMonitor(FileMonitor&& src) noexcept
193 : Glib::Object(std::move(src))
194 {}
195
operator =(FileMonitor && src)196 FileMonitor& FileMonitor::operator=(FileMonitor&& src) noexcept
197 {
198 Glib::Object::operator=(std::move(src));
199 return *this;
200 }
201
202
~FileMonitor()203 FileMonitor::~FileMonitor() noexcept
204 {}
205
206
207 FileMonitor::CppClassType FileMonitor::filemonitor_class_; // initialize static member
208
get_type()209 GType FileMonitor::get_type()
210 {
211 return filemonitor_class_.init().get_type();
212 }
213
214
get_base_type()215 GType FileMonitor::get_base_type()
216 {
217 return g_file_monitor_get_type();
218 }
219
220
cancel()221 bool FileMonitor::cancel()
222 {
223 return g_file_monitor_cancel(gobj());
224 }
225
is_cancelled() const226 bool FileMonitor::is_cancelled() const
227 {
228 return g_file_monitor_is_cancelled(const_cast<GFileMonitor*>(gobj()));
229 }
230
set_rate_limit(int limit_msecs)231 void FileMonitor::set_rate_limit(int limit_msecs)
232 {
233 g_file_monitor_set_rate_limit(gobj(), limit_msecs);
234 }
235
236
signal_changed()237 Glib::SignalProxy< void,const Glib::RefPtr<File>&,const Glib::RefPtr<File>&,FileMonitorEvent > FileMonitor::signal_changed()
238 {
239 return Glib::SignalProxy< void,const Glib::RefPtr<File>&,const Glib::RefPtr<File>&,FileMonitorEvent >(this, &FileMonitor_signal_changed_info);
240 }
241
242
property_rate_limit()243 Glib::PropertyProxy< int > FileMonitor::property_rate_limit()
244 {
245 return Glib::PropertyProxy< int >(this, "rate-limit");
246 }
247
property_rate_limit() const248 Glib::PropertyProxy_ReadOnly< int > FileMonitor::property_rate_limit() const
249 {
250 return Glib::PropertyProxy_ReadOnly< int >(this, "rate-limit");
251 }
252
property_cancelled() const253 Glib::PropertyProxy_ReadOnly< bool > FileMonitor::property_cancelled() const
254 {
255 return Glib::PropertyProxy_ReadOnly< bool >(this, "cancelled");
256 }
257
258
on_changed(const Glib::RefPtr<File> & file,const Glib::RefPtr<File> & other_file,FileMonitorEvent event_type)259 void Gio::FileMonitor::on_changed(const Glib::RefPtr<File>& file, const Glib::RefPtr<File>& other_file, FileMonitorEvent event_type)
260 {
261 const auto base = static_cast<BaseClassType*>(
262 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
263 );
264
265 if(base && base->changed)
266 (*base->changed)(gobj(),Glib::unwrap(file),Glib::unwrap(other_file),((GFileMonitorEvent)(event_type)));
267 }
268
269
270 } // namespace Gio
271
272
273