From 760e1f906741fde098a4b4d4c852eb18e45cc8e3 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 29 May 2012 10:14:50 +0200 Subject: [PATCH] TpHandleRepoIface: Use G_DEFINE_INTERFACE https://bugs.freedesktop.org/show_bug.cgi?id=50341 --- telepathy-glib/handle-repo-internal.h | 3 ++ telepathy-glib/handle-repo.c | 57 ++++++++------------------------- 2 files changed, 16 insertions(+), 44 deletions(-) diff --git a/telepathy-glib/handle-repo-internal.h b/telepathy-glib/handle-repo-internal.h index 722f59c..9441fc0 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 5fc49bd..4918831 100644 --- a/telepathy-glib/handle-repo.c +++ b/telepathy-glib/handle-repo.c @@ -38,50 +38,7 @@ #include -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); +} -- 1.7.9.5