| 1 | #ifndef _GI_GLIB_GLIB_EXTRA_DEF_IMPL_HPP_ |
| 2 | #define _GI_GLIB_GLIB_EXTRA_DEF_IMPL_HPP_ |
| 3 | |
| 4 | namespace gi |
| 5 | { |
| 6 | namespace repository |
| 7 | { |
| 8 | namespace GLib |
| 9 | { |
| 10 | gi::rv<guint>::type |
| 11 | idle_add(GLib::SourceFunc function) GI_NOEXCEPT_DECL(true) |
| 12 | { |
| 13 | return idle_add(GLib::PRIORITY_DEFAULT_IDLE_, function); |
| 14 | } |
| 15 | |
| 16 | gi::rv<guint>::type |
| 17 | idle_add_once(std::function<void()> function) GI_NOEXCEPT_DECL(true) |
| 18 | { |
| 19 | // clang-format off |
| 20 | return idle_add([=] { function(); return false; }); |
| 21 | // clang-format on |
| 22 | } |
| 23 | |
| 24 | gi::rv<guint>::type |
| 25 | timeout_add_seconds(guint interval, GLib::SourceFunc function) |
| 26 | GI_NOEXCEPT_DECL(true) |
| 27 | { |
| 28 | return timeout_add_seconds(GLib::PRIORITY_DEFAULT_, interval, function); |
| 29 | } |
| 30 | |
| 31 | gi::rv<guint>::type |
| 32 | timeout_add_seconds_once(guint interval, std::function<void()> function) |
| 33 | GI_NOEXCEPT_DECL(true) |
| 34 | { |
| 35 | // clang-format off |
| 36 | return timeout_add_seconds(interval, [=] { function(); return false; }); |
| 37 | // clang-format on |
| 38 | } |
| 39 | |
| 40 | gi::rv<guint>::type |
| 41 | timeout_add(guint interval, GLib::SourceFunc function) GI_NOEXCEPT_DECL(true) |
| 42 | { |
| 43 | return timeout_add(GLib::PRIORITY_DEFAULT_, interval, function); |
| 44 | } |
| 45 | |
| 46 | gi::rv<guint>::type |
| 47 | timeout_add_once(guint interval, std::function<void()> function) |
| 48 | GI_NOEXCEPT_DECL(true) |
| 49 | { |
| 50 | // clang-format off |
| 51 | return timeout_add(interval, [=] { function(); return false; }); |
| 52 | // clang-format on |
| 53 | } |
| 54 | |
| 55 | } // namespace GLib |
| 56 | |
| 57 | } // namespace repository |
| 58 | |
| 59 | } // namespace gi |
| 60 | |
| 61 | #endif |