[gnome-builder/wip/beniofel/meson] Ide: add ide_task_return_object for python
- From: Ben Iofel <beniofel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/beniofel/meson] Ide: add ide_task_return_object for python
- Date: Mon, 29 Feb 2016 19:39:38 +0000 (UTC)
commit cdf4198a31dc3b6ef5786b59686a275b9d03aacc
Author: Ben Iofel <iofelben gmail com>
Date: Mon Feb 29 14:38:04 2016 -0500
Ide: add ide_task_return_object for python
libide/Makefile.am | 2 ++
libide/util/ide-task.c | 34 ++++++++++++++++++++++++++++++++++
libide/util/ide-task.h | 30 ++++++++++++++++++++++++++++++
plugins/meson/meson_build.py | 3 +--
4 files changed, 67 insertions(+), 2 deletions(-)
---
diff --git a/libide/Makefile.am b/libide/Makefile.am
index af028a8..11afecf 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -163,6 +163,7 @@ libide_1_0_la_public_headers = \
util/ide-pango.h \
util/ide-posix.h \
util/ide-rgba.h \
+ util/ide-task.h \
$(NULL)
libide_1_0_la_public_sources = \
@@ -312,6 +313,7 @@ libide_1_0_la_public_sources = \
util/ide-pango.c \
util/ide-posix.c \
util/ide-rgba.c \
+ util/ide-task.c \
$(NULL)
libide_1_0_la_SOURCES = \
diff --git a/libide/util/ide-task.c b/libide/util/ide-task.c
new file mode 100644
index 0000000..e0267e5
--- /dev/null
+++ b/libide/util/ide-task.c
@@ -0,0 +1,34 @@
+/* ide-task.c
+ *
+ * Copyright (C) 2016 Ben Iofel <iofelben gmail com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ide-task.h"
+
+/**
+ * ide_task_return_object:
+ * @task: a #GTask
+ * @obj: (allow-none) (transfer full): the result
+ * @destroy: (allow-none): a #GDestroyNotify function
+ *
+ * Wrapper for g_task_return_pointer since PyGObject doesn't support gpointer
+ */
+void ide_task_return_object (GTask *task,
+ GObject *obj,
+ GDestroyNotify destroy)
+{
+ g_task_return_pointer (task, obj, destroy);
+}
diff --git a/libide/util/ide-task.h b/libide/util/ide-task.h
new file mode 100644
index 0000000..df3cfbe
--- /dev/null
+++ b/libide/util/ide-task.h
@@ -0,0 +1,30 @@
+/* ide-task.h
+ *
+ * Copyright (C) 2016 Ben Iofel <iofelben gmail com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_TASK_H
+#define IDE_TASK_H
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+void ide_task_return_object(GTask *task, GObject *obj, GDestroyNotify destroy);
+
+G_END_DECLS
+
+#endif /* IDE_TASK_H */
diff --git a/plugins/meson/meson_build.py b/plugins/meson/meson_build.py
index bec6b8c..0722901 100644
--- a/plugins/meson/meson_build.py
+++ b/plugins/meson/meson_build.py
@@ -52,13 +52,12 @@ class MesonBuilder(Ide.Builder):
res = MesonBuildResult()
task = Gio.Task.new(self, cancellable, callback)
- task.return_pointer(res)
+ Ide.task_return_object(task, res)
return (res)
def do_build_finish(self, result):
return result.propagate_pointer()
-
class MesonBuildResult(Ide.BuildResult):
pass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]