summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.co.uk>2012-05-29 10:14:50 +0200
committerXavier Claessens <xavier.claessens@collabora.co.uk>2012-06-28 13:50:00 +0200
commit9b28efdc5aa735dd5482f0f050031594f20d3e9a (patch)
tree746dbe58eb85d40096dc3f52174e11ef360be3f9
parent16b839c3490a081ae9583dc08d4fcb0f6d818b4c (diff)
downloadtelepathy-glib-9b28efdc5aa735dd5482f0f050031594f20d3e9a.tar.gz
TpHandleRepoIface: Use G_DEFINE_INTERFACE
https://bugs.freedesktop.org/show_bug.cgi?id=50341
-rw-r--r--telepathy-glib/handle-repo-internal.h3
-rw-r--r--telepathy-glib/handle-repo.c57
2 files changed, 16 insertions, 44 deletions
diff --git a/telepathy-glib/handle-repo-internal.h b/telepathy-glib/handle-repo-internal.h
index 722f59c9b..9441fc089 100644
--- a/telepathy-glib/handle-repo-internal.h
+++ b/telepathy-glib/handle-repo-internal.h
@@ -29,6 +29,9 @@
G_BEGIN_DECLS
+/* G_DEFINE_INTERFACE wants that name */
+typedef struct _TpHandleRepoIfaceClass TpHandleRepoIfaceInterface;
+
/* <-- this is no longer a gtkdoc comment because this is not public API
* TpHandleRepoIfaceClass:
* @parent_class: Fields shared with GTypeInterface
diff --git a/telepathy-glib/handle-repo.c b/telepathy-glib/handle-repo.c
index 5fc49bd46..49188316f 100644
--- a/telepathy-glib/handle-repo.c
+++ b/telepathy-glib/handle-repo.c
@@ -38,50 +38,7 @@
#include <telepathy-glib/handle-repo-internal.h>
-static void
-repo_base_init (gpointer klass)
-{
- static gboolean initialized = FALSE;
-
- if (!initialized)
- {
- GParamSpec *param_spec;
-
- initialized = TRUE;
-
- param_spec = g_param_spec_uint ("handle-type", "Handle type",
- "The TpHandleType held in this handle repository.",
- 0, G_MAXUINT32, 0,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_interface_install_property (klass, param_spec);
- }
-}
-
-GType
-tp_handle_repo_iface_get_type (void)
-{
- static GType type = 0;
- if (G_UNLIKELY (type == 0))
- {
- static const GTypeInfo info = {
- sizeof (TpHandleRepoIfaceClass),
- repo_base_init,
- NULL, /* base_finalize */
- NULL, /* class_init */
- NULL, /* class_finalize */
- NULL, /* class_data */
- 0,
- 0, /* n_preallocs */
- NULL /* instance_init */
- };
-
- type = g_type_register_static (G_TYPE_INTERFACE, "TpHandleRepoIface",
- &info, 0);
- }
-
- return type;
-}
-
+G_DEFINE_INTERFACE (TpHandleRepoIface, tp_handle_repo_iface, G_TYPE_OBJECT);
/**
* tp_handle_is_valid: (skip)
@@ -419,3 +376,15 @@ tp_handle_get_qdata (TpHandleRepoIface *repo, TpHandle handle,
return TP_HANDLE_REPO_IFACE_GET_CLASS (repo)->get_qdata (repo,
handle, key_id);
}
+
+static void
+tp_handle_repo_iface_default_init (TpHandleRepoIfaceInterface *iface)
+{
+ GParamSpec *param_spec;
+
+ param_spec = g_param_spec_uint ("handle-type", "Handle type",
+ "The TpHandleType held in this handle repository.",
+ 0, G_MAXUINT32, 0,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_interface_install_property (iface, param_spec);
+}