[evolution-data-server] Add a private struct to CamelTcpStream



commit a705c754af671915b4b8c27a724fd9526e5881c7
Author: Federico Mena Quintero <federico novell com>
Date:   Wed May 19 15:03:52 2010 -0500

    Add a private struct to CamelTcpStream
    
    We will use it to store the info for the SOCKS host/port.
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 camel/camel-tcp-stream.c |   31 +++++++++++++++++++++++++++++++
 camel/camel-tcp-stream.h |    3 +++
 2 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-tcp-stream.c b/camel/camel-tcp-stream.c
index a033254..bbc57f0 100644
--- a/camel/camel-tcp-stream.c
+++ b/camel/camel-tcp-stream.c
@@ -37,14 +37,45 @@
 
 G_DEFINE_TYPE (CamelTcpStream, camel_tcp_stream, CAMEL_TYPE_STREAM)
 
+struct _CamelTcpStreamPrivate {
+	gchar *socks_host;
+	gint socks_port;
+};
+
+#define CAMEL_TCP_STREAM_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), CAMEL_TYPE_TCP_STREAM, CamelTcpStreamPrivate))
+
+static void
+camel_tcp_stream_finalize (GObject *object)
+{
+	CamelTcpStream *stream = CAMEL_TCP_STREAM (object);
+	CamelTcpStreamPrivate *priv = stream->priv;
+
+	priv = stream->priv;
+	g_free (priv->socks_host);
+	priv->socks_host = NULL;
+
+	G_OBJECT_CLASS (camel_tcp_stream_parent_class)->finalize (object);
+}
+
 static void
 camel_tcp_stream_class_init (CamelTcpStreamClass *class)
 {
+	GObjectClass *object_class;
+
+	g_type_class_add_private (class, sizeof (CamelTcpStreamPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->finalize = camel_tcp_stream_finalize;
 }
 
 static void
 camel_tcp_stream_init (CamelTcpStream *tcp_stream)
 {
+	tcp_stream->priv = CAMEL_TCP_STREAM_GET_PRIVATE (cpi);
+	tcp_stream->priv->socks_host = NULL;
+	tcp_stream->priv->socks_port = 0;
 }
 
 /**
diff --git a/camel/camel-tcp-stream.h b/camel/camel-tcp-stream.h
index 17cb492..62fd30a 100644
--- a/camel/camel-tcp-stream.h
+++ b/camel/camel-tcp-stream.h
@@ -69,6 +69,7 @@ G_BEGIN_DECLS
 
 typedef struct _CamelTcpStream CamelTcpStream;
 typedef struct _CamelTcpStreamClass CamelTcpStreamClass;
+typedef struct _CamelTcpStreamPrivate CamelTcpStreamPrivate;
 
 typedef enum {
 	CAMEL_SOCKOPT_NONBLOCKING,     /* nonblocking io */
@@ -114,6 +115,8 @@ typedef struct _CamelSockOptData {
 
 struct _CamelTcpStream {
 	CamelStream parent;
+
+	CamelTcpStreamPrivate *priv;
 };
 
 struct _CamelTcpStreamClass {



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