[evolution-data-server/wip/mcrha/soup3] ESoupSession: Make the EInputStreamWrapper pollable
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/wip/mcrha/soup3] ESoupSession: Make the EInputStreamWrapper pollable
- Date: Thu, 19 May 2022 14:10:10 +0000 (UTC)
commit b088c38cfbc45d8e6505baef3f5ee9de58ed6bc5
Author: Milan Crha <mcrha redhat com>
Date: Thu May 19 16:09:30 2022 +0200
ESoupSession: Make the EInputStreamWrapper pollable
The libsoup3 is better tested, and workd better, with pollable stream.
src/libedataserver/e-soup-session.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
---
diff --git a/src/libedataserver/e-soup-session.c b/src/libedataserver/e-soup-session.c
index 80b11b3dd..56cff9660 100644
--- a/src/libedataserver/e-soup-session.c
+++ b/src/libedataserver/e-soup-session.c
@@ -1644,7 +1644,10 @@ typedef struct _EInputStreamWrapperClass {
GType e_input_stream_wrapper_get_type (void);
-G_DEFINE_TYPE (EInputStreamWrapper, e_input_stream_wrapper, G_TYPE_INPUT_STREAM)
+static void e_input_stream_wrapper_pollable_iface_init (GPollableInputStreamInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EInputStreamWrapper, e_input_stream_wrapper, G_TYPE_INPUT_STREAM,
+ G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, e_input_stream_wrapper_pollable_iface_init))
#define E_INPUT_STREAM_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), e_input_stream_wrapper_get_type (),
EInputStreamWrapper))
@@ -1680,6 +1683,25 @@ e_input_stream_wrapper_close_fn (GInputStream *stream,
return TRUE;
}
+static gboolean
+e_input_stream_wrapper_is_readable (GPollableInputStream *stream)
+{
+ return TRUE;
+}
+
+static GSource *
+e_input_stream_wrapper_create_source (GPollableInputStream *stream,
+ GCancellable *cancellable)
+{
+ GSource *base_source, *pollable_source;
+
+ base_source = g_timeout_source_new (0);
+ pollable_source = g_pollable_source_new_full (stream, base_source, cancellable);
+ g_source_unref (base_source);
+
+ return pollable_source;
+}
+
static void
e_input_stream_wrapper_dispose (GObject *object)
{
@@ -1706,6 +1728,13 @@ e_input_stream_wrapper_class_init (EInputStreamWrapperClass *klass)
object_class->dispose = e_input_stream_wrapper_dispose;
}
+static void
+e_input_stream_wrapper_pollable_iface_init (GPollableInputStreamInterface *iface)
+{
+ iface->is_readable = e_input_stream_wrapper_is_readable;
+ iface->create_source = e_input_stream_wrapper_create_source;
+}
+
static void
e_input_stream_wrapper_init (EInputStreamWrapper *self)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]