[gnome-builder] snippets: add snippet for async callback
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] snippets: add snippet for async callback
- Date: Tue, 9 Jul 2019 00:44:32 +0000 (UTC)
commit c7a6f08b5f6846bfad26e89efed77aa8cf79f67b
Author: Christian Hergert <chergert redhat com>
Date: Mon Jul 8 17:33:42 2019 -0700
snippets: add snippet for async callback
src/plugins/snippets/snippets/gobject.snippets | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/snippets/snippets/gobject.snippets b/src/plugins/snippets/snippets/gobject.snippets
index dd20246d3..2c1b1dde4 100644
--- a/src/plugins/snippets/snippets/gobject.snippets
+++ b/src/plugins/snippets/snippets/gobject.snippets
@@ -587,6 +587,23 @@ snippet vtfinish
gboolean (*${1:do_someting}_finish) (${2:$filename|stripsuffix|camelize} *self,
${$1|space} GAsyncResult *result,
${$1|space} GError **error);
+snippet readycallback
+- scope c
+- desc Create a GAsyncReadyCallback function
+ static void
+ ${$filename|stripsuffix|functify}_${1:do_something_cb} (GObject *object,
+ ${$filename|stripsuffix|functify|space} ${$1|space} GAsyncResult *result,
+ ${$filename|stripsuffix|functify|space} ${$1|space} gpointer user_data)
+ {
+ g_autoptr(GTask) task = user_data;
+ g_autoptr(GError) error = NULL;
+
+ g_assert (G_IS_OBJECT (object));
+ g_assert (G_IS_ASYNC_RESULT (result));
+ g_assert (G_IS_TASK (task));
+
+ g_task_return_boolean (task, TRUE);
+ }
snippet Private
- desc Define a local for the GObject's private data.
- scope c, chdr
@@ -643,4 +660,4 @@ snippet gobj_set_property
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
- }
\ No newline at end of file
+ }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]