[gnio/connection-factory: 3/6] Register GTcpConnection with connection factory



commit f2fba756617123a7128dc7b5ef9a7eaf284af767
Author: Alexander Larsson <alexl redhat com>
Date:   Fri May 8 15:00:09 2009 +0200

    Register GTcpConnection with connection factory
---
 gio/gsocketconnection.c |    5 +++--
 gio/gtcpconnection.c    |   21 +++++++++++++++++++--
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/gio/gsocketconnection.c b/gio/gsocketconnection.c
index 60687e3..4c177a3 100644
--- a/gio/gsocketconnection.c
+++ b/gio/gsocketconnection.c
@@ -39,6 +39,7 @@
 #include "giostream.h"
 
 #include "gunixconnection.h"
+#include "gtcpconnection.h"
 
 
 static void g_socket_connection_iface_init (GIOStreamIface *iface);
@@ -297,11 +298,11 @@ g_socket_connection_factory_register_type (GType g_type,
 static void
 init_builtin_types (void)
 {
-#ifndef G_OS_WIN32
   volatile GType a_type;
-
+#ifndef G_OS_WIN32
   a_type = g_unix_connection_get_type ();
 #endif
+  a_type = g_tcp_connection_get_type ();
 }
 
 GType
diff --git a/gio/gtcpconnection.c b/gio/gtcpconnection.c
index 87ad7d7..a0edce7 100644
--- a/gio/gtcpconnection.c
+++ b/gio/gtcpconnection.c
@@ -28,8 +28,25 @@
 
 #include "gsocketconnection.h"
 
-G_DEFINE_TYPE (GTcpConnection, g_tcp_connection,
-               G_TYPE_SOCKET_CONNECTION);
+G_DEFINE_TYPE_WITH_CODE (GTcpConnection, g_tcp_connection,
+			 G_TYPE_SOCKET_CONNECTION,
+  g_socket_connection_factory_register_type (g_define_type_id,
+					     G_SOCKET_FAMILY_IPV4,
+					     G_SOCKET_TYPE_STREAM,
+					     NULL);
+  g_socket_connection_factory_register_type (g_define_type_id,
+					     G_SOCKET_FAMILY_IPV6,
+					     G_SOCKET_TYPE_STREAM,
+					     NULL);
+  g_socket_connection_factory_register_type (g_define_type_id,
+					     G_SOCKET_FAMILY_IPV4,
+					     G_SOCKET_TYPE_STREAM,
+					     "tcp");
+  g_socket_connection_factory_register_type (g_define_type_id,
+					     G_SOCKET_FAMILY_IPV6,
+					     G_SOCKET_TYPE_STREAM,
+					     "tcp");
+			 );
 
 static void
 g_tcp_connection_init (GTcpConnection *connection)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]