[next] telepathy-glib: Use G_DEFINE_BOXED_TYPE for every boxed type except TpIntset

Simon McVittie smcv at kemper.freedesktop.org
Thu May 3 07:34:43 PDT 2012


Module: telepathy-glib
Branch: next
Commit: 2f377dab66ef074497ff0630508535716d369cb7
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=2f377dab66ef074497ff0630508535716d369cb7

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Thu May  3 15:04:05 2012 +0100

Use G_DEFINE_BOXED_TYPE for every boxed type except TpIntset

TpIntset is a bit weird because of backwards compatibility with TpIntSet,
so we can only replace that one on next.

Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>

---

 docs/reference/telepathy-glib-sections.txt |    3 +
 telepathy-glib/connection-avatars.c        |   15 +------
 telepathy-glib/connection-contact-info.c   |   60 ++++------------------------
 telepathy-glib/connection-manager.c        |   39 ++----------------
 telepathy-glib/connection.h                |    4 ++
 telepathy-glib/handle-set.c                |   17 +-------
 6 files changed, 24 insertions(+), 114 deletions(-)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 2c9c9c2..d7d4cae 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -4263,6 +4263,9 @@ tp_contact_info_field_free
 TP_TYPE_CONTACT_INFO_LIST
 tp_contact_info_list_copy
 tp_contact_info_list_free
+<SUBSECTION Private>
+TpContactInfoSpecList
+TpContactInfoList
 <SUBSECTION contact-list>
 tp_connection_get_contact_list_state
 tp_connection_get_contact_list_persists
diff --git a/telepathy-glib/connection-avatars.c b/telepathy-glib/connection-avatars.c
index fdec530..e9c3e57 100644
--- a/telepathy-glib/connection-avatars.c
+++ b/telepathy-glib/connection-avatars.c
@@ -158,20 +158,9 @@ tp_connection_get_avatar_requirements (TpConnection *self)
  *
  * Since: 0.11.4
  */
-GType
-tp_avatar_requirements_get_type (void)
-{
-  static GType type = 0;
 
-  if (G_UNLIKELY (type == 0))
-    {
-      type = g_boxed_type_register_static (g_intern_static_string ("TpAvatarRequirements"),
-          (GBoxedCopyFunc) tp_avatar_requirements_copy,
-          (GBoxedFreeFunc) tp_avatar_requirements_destroy);
-    }
-
-  return type;
-}
+G_DEFINE_BOXED_TYPE (TpAvatarRequirements, tp_avatar_requirements,
+    tp_avatar_requirements_copy, tp_avatar_requirements_destroy)
 
 /**
  * tp_avatar_requirements_new:
diff --git a/telepathy-glib/connection-contact-info.c b/telepathy-glib/connection-contact-info.c
index 07b213a..3349c8b 100644
--- a/telepathy-glib/connection-contact-info.c
+++ b/telepathy-glib/connection-contact-info.c
@@ -143,20 +143,9 @@ tp_contact_info_field_spec_free (TpContactInfoFieldSpec *self)
  *
  * Since: 0.11.7
  */
-GType
-tp_contact_info_field_spec_get_type (void)
-{
-  static GType type = 0;
 
-  if (G_UNLIKELY (type == 0))
-    {
-      type = g_boxed_type_register_static (g_intern_static_string ("TpContactInfoFieldSpec"),
-          (GBoxedCopyFunc) tp_contact_info_field_spec_copy,
-          (GBoxedFreeFunc) tp_contact_info_field_spec_free);
-    }
-
-  return type;
-}
+G_DEFINE_BOXED_TYPE (TpContactInfoFieldSpec, tp_contact_info_field_spec,
+    tp_contact_info_field_spec_copy, tp_contact_info_field_spec_free)
 
 /**
  * tp_contact_info_spec_list_copy: (skip)
@@ -204,20 +193,9 @@ tp_contact_info_spec_list_free (GList *list)
  *
  * Since: 0.11.7
  */
-GType
-tp_contact_info_spec_list_get_type (void)
-{
-  static GType type = 0;
 
-  if (G_UNLIKELY (type == 0))
-    {
-      type = g_boxed_type_register_static (g_intern_static_string ("TpContactInfoSpecList"),
-          (GBoxedCopyFunc) tp_contact_info_spec_list_copy,
-          (GBoxedFreeFunc) tp_contact_info_spec_list_free);
-    }
-
-  return type;
-}
+G_DEFINE_BOXED_TYPE (TpContactInfoSpecList, tp_contact_info_spec_list,
+    tp_contact_info_spec_list_copy, tp_contact_info_spec_list_free)
 
 /**
  * TpContactInfoField:
@@ -323,20 +301,9 @@ tp_contact_info_field_free (TpContactInfoField *self)
  *
  * Since: 0.11.7
  */
-GType
-tp_contact_info_field_get_type (void)
-{
-  static GType type = 0;
 
-  if (G_UNLIKELY (type == 0))
-    {
-      type = g_boxed_type_register_static (g_intern_static_string ("TpContactInfoField"),
-          (GBoxedCopyFunc) tp_contact_info_field_copy,
-          (GBoxedFreeFunc) tp_contact_info_field_free);
-    }
-
-  return type;
-}
+G_DEFINE_BOXED_TYPE (TpContactInfoField, tp_contact_info_field,
+    tp_contact_info_field_copy, tp_contact_info_field_free)
 
 /**
  * tp_contact_info_list_copy: (skip)
@@ -384,20 +351,9 @@ tp_contact_info_list_free (GList *list)
  *
  * Since: 0.11.7
  */
-GType
-tp_contact_info_list_get_type (void)
-{
-  static GType type = 0;
 
-  if (G_UNLIKELY (type == 0))
-    {
-      type = g_boxed_type_register_static (g_intern_static_string ("TpContactInfoList"),
-          (GBoxedCopyFunc) tp_contact_info_list_copy,
-          (GBoxedFreeFunc) tp_contact_info_list_free);
-    }
-
-  return type;
-}
+G_DEFINE_BOXED_TYPE (TpContactInfoList, tp_contact_info_list,
+    tp_contact_info_list_copy, tp_contact_info_list_free)
 
 /**
  * TP_CONNECTION_FEATURE_CONTACT_INFO:
diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c
index 2808a10..05fea46 100644
--- a/telepathy-glib/connection-manager.c
+++ b/telepathy-glib/connection-manager.c
@@ -407,23 +407,8 @@ tp_connection_manager_protocol_free (TpConnectionManagerProtocol *proto)
  * Since: 0.11.3
  */
 
-
-GType
-tp_connection_manager_param_get_type (void)
-{
-  static GType type = 0;
-
-  if (G_UNLIKELY (type == 0))
-    {
-      type = g_boxed_type_register_static (
-          g_intern_static_string ("TpConnectionManagerParam"),
-          (GBoxedCopyFunc) tp_connection_manager_param_copy,
-          (GBoxedFreeFunc) tp_connection_manager_param_free);
-    }
-
-  return type;
-}
-
+G_DEFINE_BOXED_TYPE (TpConnectionManagerParam, tp_connection_manager_param,
+    tp_connection_manager_param_copy, tp_connection_manager_param_free)
 
 /**
  * TP_TYPE_CONNECTION_MANAGER_PROTOCOL:
@@ -433,23 +418,9 @@ tp_connection_manager_param_get_type (void)
  * Since: 0.11.3
  */
 
-
-GType
-tp_connection_manager_protocol_get_type (void)
-{
-  static GType type = 0;
-
-  if (G_UNLIKELY (type == 0))
-    {
-      type = g_boxed_type_register_static (
-          g_intern_static_string ("TpConnectionManagerProtocol"),
-          (GBoxedCopyFunc) tp_connection_manager_protocol_copy,
-          (GBoxedFreeFunc) tp_connection_manager_protocol_free);
-    }
-
-  return type;
-}
-
+G_DEFINE_BOXED_TYPE (TpConnectionManagerProtocol,
+    tp_connection_manager_protocol,
+    tp_connection_manager_protocol_copy, tp_connection_manager_protocol_free)
 
 typedef struct {
     TpConnectionManager *cm;
diff --git a/telepathy-glib/connection.h b/telepathy-glib/connection.h
index 71a739c..ea36129 100644
--- a/telepathy-glib/connection.h
+++ b/telepathy-glib/connection.h
@@ -48,6 +48,8 @@ TpContactInfoFieldSpec *tp_contact_info_field_spec_copy (
     const TpContactInfoFieldSpec *self);
 void tp_contact_info_field_spec_free (TpContactInfoFieldSpec *self);
 
+typedef GList TpContactInfoSpecList;
+
 #define TP_TYPE_CONTACT_INFO_SPEC_LIST (tp_contact_info_spec_list_get_type ())
 GType tp_contact_info_spec_list_get_type (void);
 GList *tp_contact_info_spec_list_copy (GList *list);
@@ -71,6 +73,8 @@ TpContactInfoField *tp_contact_info_field_new (const gchar *field_name,
 TpContactInfoField *tp_contact_info_field_copy (const TpContactInfoField *self);
 void tp_contact_info_field_free (TpContactInfoField *self);
 
+typedef GList TpContactInfoList;
+
 #define TP_TYPE_CONTACT_INFO_LIST (tp_contact_info_list_get_type ())
 GType tp_contact_info_list_get_type (void);
 GList *tp_contact_info_list_copy (GList *list);
diff --git a/telepathy-glib/handle-set.c b/telepathy-glib/handle-set.c
index d2c72c4..ef40112 100644
--- a/telepathy-glib/handle-set.c
+++ b/telepathy-glib/handle-set.c
@@ -53,21 +53,8 @@ struct _TpHandleSet
  * Since: 0.11.6
  */
 
-GType
-tp_handle_set_get_type (void)
-{
-  static GType type = 0;
-
-  if (G_UNLIKELY (type == 0))
-    {
-      type = g_boxed_type_register_static (
-          g_intern_static_string ("TpHandleSet"),
-          (GBoxedCopyFunc) tp_handle_set_copy,
-          (GBoxedFreeFunc) tp_handle_set_destroy);
-    }
-
-  return type;
-}
+G_DEFINE_BOXED_TYPE (TpHandleSet, tp_handle_set, tp_handle_set_copy,
+    tp_handle_set_destroy)
 
 /**
  * tp_handle_set_new: (skip)



More information about the telepathy-commits mailing list