summaryrefslogtreecommitdiff
path: root/adw/src/helpers/async_callback.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'adw/src/helpers/async_callback.cpp')
-rw-r--r--adw/src/helpers/async_callback.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/adw/src/helpers/async_callback.cpp b/adw/src/helpers/async_callback.cpp
new file mode 100644
index 0000000..4f148f0
--- /dev/null
+++ b/adw/src/helpers/async_callback.cpp
@@ -0,0 +1,28 @@
+#include "adwaitamm/helpers/async_callback.hpp"
+
+#include <glibmm/exceptionhandler.h>
+#include <glibmm/object.h>
+
+#include <giomm/asyncresult.h>
+
+#include <memory>
+
+namespace Adwaita::helpers
+{
+
+ auto async_callback(GObject *, GAsyncResult * result, void * data) noexcept -> void
+ {
+ auto slot = std::unique_ptr<Gio::SlotAsyncReady>(static_cast<Gio::SlotAsyncReady *>(data));
+
+ try
+ {
+ auto actual_result = Glib::wrap(result, true);
+ (*slot)(actual_result);
+ }
+ catch (...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ }
+
+} // namespace Adwaita::helpers \ No newline at end of file