Ardour  8.7-13-g8ab7c05382
glib_event_source.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Paul Davis <paul@linuxaudiosystems.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __libpbd_glib_event_source_h__
20 #define __libpbd_glib_event_source_h__
21 
22 #include <boost/function.hpp>
23 
24 #include <glib.h>
25 #include <glibmm/main.h>
26 #include "pbd/libpbd_visibility.h"
27 
29 {
30  public:
31  GlibEventLoopCallback (boost::function<void()> callback);
33 
34  static gboolean c_prepare (GSource*, gint* timeout);
35  void attach (Glib::RefPtr<Glib::MainContext>);
36 
37  private:
39  GSource c;
41  };
42 
43  bool cpp_prepare();
44 
46  GSourceFuncs funcs;
47  boost::function<void()> _callback;
48 };
49 
50 #endif /* __libpbd_glib_event_source_h__ */
boost::function< void()> _callback
void attach(Glib::RefPtr< Glib::MainContext >)
static gboolean c_prepare(GSource *, gint *timeout)
GlibEventLoopCallback(boost::function< void()> callback)
GSourceWithParent * gsource
#define LIBPBD_API