[Telepathy-commits] [telepathy-glib/master] Example CMs: be exemplary about class private data

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Mar 3 06:19:13 PST 2009


Using opaque types with compiler type-checking seems cleaner than casting
a gpointer, particularly in code likely to be copied.
---
 examples/cm/channelspecific/connection-manager.h   |    8 +++++++-
 .../cm/echo-message-parts/connection-manager.h     |    8 ++++++--
 examples/cm/echo/connection-manager.h              |    8 +++++++-
 examples/cm/extended/connection-manager.h          |    8 +++++++-
 examples/cm/no-protocols/connection-manager.h      |    8 +++++++-
 5 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/examples/cm/channelspecific/connection-manager.h b/examples/cm/channelspecific/connection-manager.h
index eaf2a2c..b30105c 100644
--- a/examples/cm/channelspecific/connection-manager.h
+++ b/examples/cm/channelspecific/connection-manager.h
@@ -18,17 +18,23 @@
 G_BEGIN_DECLS
 
 typedef struct _ExampleCSHConnectionManager ExampleCSHConnectionManager;
+typedef struct _ExampleCSHConnectionManagerPrivate
+    ExampleCSHConnectionManagerPrivate;
 typedef struct _ExampleCSHConnectionManagerClass
     ExampleCSHConnectionManagerClass;
+typedef struct _ExampleCSHConnectionManagerClassPrivate
+    ExampleCSHConnectionManagerClassPrivate;
 
 struct _ExampleCSHConnectionManagerClass {
     TpBaseConnectionManagerClass parent_class;
+
+    ExampleCSHConnectionManagerClassPrivate *priv;
 };
 
 struct _ExampleCSHConnectionManager {
     TpBaseConnectionManager parent;
 
-    gpointer priv;
+    ExampleCSHConnectionManagerPrivate *priv;
 };
 
 GType example_csh_connection_manager_get_type (void);
diff --git a/examples/cm/echo-message-parts/connection-manager.h b/examples/cm/echo-message-parts/connection-manager.h
index 8fcd360..645ac95 100644
--- a/examples/cm/echo-message-parts/connection-manager.h
+++ b/examples/cm/echo-message-parts/connection-manager.h
@@ -17,19 +17,23 @@ G_BEGIN_DECLS
 
 typedef struct _ExampleEcho2ConnectionManager
     ExampleEcho2ConnectionManager;
+typedef struct _ExampleEcho2ConnectionManagerPrivate
+    ExampleEcho2ConnectionManagerPrivate;
 typedef struct _ExampleEcho2ConnectionManagerClass
     ExampleEcho2ConnectionManagerClass;
+typedef struct _ExampleEcho2ConnectionManagerClassPrivate
+    ExampleEcho2ConnectionManagerClassPrivate;
 
 struct _ExampleEcho2ConnectionManagerClass {
     TpBaseConnectionManagerClass parent_class;
 
-    gpointer priv;
+    ExampleEcho2ConnectionManagerClassPrivate *priv;
 };
 
 struct _ExampleEcho2ConnectionManager {
     TpBaseConnectionManager parent;
 
-    gpointer priv;
+    ExampleEcho2ConnectionManagerPrivate *priv;
 };
 
 GType example_echo_2_connection_manager_get_type (void);
diff --git a/examples/cm/echo/connection-manager.h b/examples/cm/echo/connection-manager.h
index 7cbf615..0483873 100644
--- a/examples/cm/echo/connection-manager.h
+++ b/examples/cm/echo/connection-manager.h
@@ -16,17 +16,23 @@
 G_BEGIN_DECLS
 
 typedef struct _ExampleEchoConnectionManager ExampleEchoConnectionManager;
+typedef struct _ExampleEchoConnectionManagerPrivate
+    ExampleEchoConnectionManagerPrivate;
 typedef struct _ExampleEchoConnectionManagerClass
     ExampleEchoConnectionManagerClass;
+typedef struct _ExampleEchoConnectionManagerClassPrivate
+    ExampleEchoConnectionManagerClassPrivate;
 
 struct _ExampleEchoConnectionManagerClass {
     TpBaseConnectionManagerClass parent_class;
+
+    ExampleEchoConnectionManagerClassPrivate *priv;
 };
 
 struct _ExampleEchoConnectionManager {
     TpBaseConnectionManager parent;
 
-    gpointer priv;
+    ExampleEchoConnectionManagerPrivate *priv;
 };
 
 GType example_echo_connection_manager_get_type (void);
diff --git a/examples/cm/extended/connection-manager.h b/examples/cm/extended/connection-manager.h
index caae01a..b3345f4 100644
--- a/examples/cm/extended/connection-manager.h
+++ b/examples/cm/extended/connection-manager.h
@@ -17,17 +17,23 @@ G_BEGIN_DECLS
 
 typedef struct _ExampleExtendedConnectionManager
     ExampleExtendedConnectionManager;
+typedef struct _ExampleExtendedConnectionManagerPrivate
+    ExampleExtendedConnectionManagerPrivate;
 typedef struct _ExampleExtendedConnectionManagerClass
     ExampleExtendedConnectionManagerClass;
+typedef struct _ExampleExtendedConnectionManagerClassPrivate
+    ExampleExtendedConnectionManagerClassPrivate;
 
 struct _ExampleExtendedConnectionManagerClass {
     TpBaseConnectionManagerClass parent_class;
+
+    ExampleExtendedConnectionManagerClassPrivate *priv;
 };
 
 struct _ExampleExtendedConnectionManager {
     TpBaseConnectionManager parent;
 
-    gpointer priv;
+    ExampleExtendedConnectionManagerPrivate *priv;
 };
 
 GType example_extended_connection_manager_get_type (void);
diff --git a/examples/cm/no-protocols/connection-manager.h b/examples/cm/no-protocols/connection-manager.h
index 57a6a9f..cf5716f 100644
--- a/examples/cm/no-protocols/connection-manager.h
+++ b/examples/cm/no-protocols/connection-manager.h
@@ -19,17 +19,23 @@ G_BEGIN_DECLS
 
 typedef struct _ExampleNoProtocolsConnectionManager
     ExampleNoProtocolsConnectionManager;
+typedef struct _ExampleNoProtocolsConnectionManagerPrivate
+    ExampleNoProtocolsConnectionManagerPrivate;
 typedef struct _ExampleNoProtocolsConnectionManagerClass
     ExampleNoProtocolsConnectionManagerClass;
+typedef struct _ExampleNoProtocolsConnectionManagerClassPrivate
+    ExampleNoProtocolsConnectionManagerClassPrivate;
 
 struct _ExampleNoProtocolsConnectionManagerClass {
     TpBaseConnectionManagerClass parent_class;
+
+    ExampleNoProtocolsConnectionManagerClassPrivate *priv;
 };
 
 struct _ExampleNoProtocolsConnectionManager {
     TpBaseConnectionManager parent;
 
-    gpointer priv;
+    ExampleNoProtocolsConnectionManagerPrivate *priv;
 };
 
 GType example_no_protocols_connection_manager_get_type (void);
-- 
1.5.6.5




More information about the telepathy-commits mailing list