gio: more implementations of GFileDescriptorBased

Implement GFileDescriptorBased in GSocket{Input,Output}Stream and
GUnix{Input,Output}Stream.

https://bugzilla.gnome.org/show_bug.cgi?id=616852
This commit is contained in:
Dan Winship
2011-09-03 09:03:17 -04:00
parent f218353e04
commit 759c0e935d
4 changed files with 75 additions and 5 deletions

View File

@@ -36,6 +36,7 @@
#include "gunixinputstream.h"
#include "gcancellable.h"
#include "gasynchelper.h"
#include "gfiledescriptorbased.h"
#include "glibintl.h"
@@ -61,11 +62,14 @@ enum {
};
static void g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface);
static void g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
G_DEFINE_TYPE_WITH_CODE (GUnixInputStream, g_unix_input_stream, G_TYPE_INPUT_STREAM,
G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM,
g_unix_input_stream_pollable_iface_init)
);
G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
g_unix_input_stream_file_descriptor_based_iface_init)
)
struct _GUnixInputStreamPrivate {
int fd;
@@ -189,6 +193,12 @@ g_unix_input_stream_pollable_iface_init (GPollableInputStreamInterface *iface)
iface->create_source = g_unix_input_stream_pollable_create_source;
}
static void
g_unix_input_stream_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface)
{
iface->get_fd = (int (*) (GFileDescriptorBased *))g_unix_input_stream_get_fd;
}
static void
g_unix_input_stream_set_property (GObject *object,
guint prop_id,