diff options
author | Benjamin Otte <otte@redhat.com> | 2017-11-28 01:58:56 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2017-12-03 05:46:48 +0100 |
commit | cc078005707b36de996cd57301cbfd8742ac692c (patch) | |
tree | d2b49842ced12dd6631ee818acf6651e23921cb0 /gdk/gdkcontentdeserializer.c | |
parent | c146132a4a0adcd0372c8c0ee032da660483018c (diff) | |
download | gtk+-cc078005707b36de996cd57301cbfd8742ac692c.tar.gz |
gdk: Allow setting task data on (de)serializers
This mirrors GTask.
Diffstat (limited to 'gdk/gdkcontentdeserializer.c')
-rw-r--r-- | gdk/gdkcontentdeserializer.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gdk/gdkcontentdeserializer.c b/gdk/gdkcontentdeserializer.c index 6c931e0978..f6a3f6f2bf 100644 --- a/gdk/gdkcontentdeserializer.c +++ b/gdk/gdkcontentdeserializer.c @@ -59,6 +59,9 @@ struct _GdkContentDeserializer GAsyncReadyCallback callback; gpointer callback_data; + gpointer task_data; + GDestroyNotify task_notify; + GError *error; gboolean returned; }; @@ -100,6 +103,9 @@ gdk_content_deserializer_finalize (GObject *object) g_clear_object (&deserializer->cancellable); g_clear_error (&deserializer->error); + if (deserializer->task_notify) + deserializer->task_notify (deserializer->task_data); + G_OBJECT_CLASS (gdk_content_deserializer_parent_class)->finalize (object); } @@ -200,6 +206,28 @@ gdk_content_deserializer_get_user_data (GdkContentDeserializer *deserializer) return deserializer->user_data; } +void +gdk_content_deserializer_set_task_data (GdkContentDeserializer *deserializer, + gpointer data, + GDestroyNotify notify) +{ + g_return_if_fail (GDK_IS_CONTENT_DESERIALIZER (deserializer)); + + if (deserializer->task_notify) + deserializer->task_notify (deserializer->task_data); + + deserializer->task_data = data; + deserializer->task_notify = notify; +} + +gpointer +gdk_content_deserializer_get_task_data (GdkContentDeserializer *deserializer) +{ + g_return_val_if_fail (GDK_IS_CONTENT_DESERIALIZER (deserializer), NULL); + + return deserializer->task_data; +} + static gboolean gdk_content_deserializer_emit_callback (gpointer data) { |