[gcr] gcr: Make GcrComparable introspectable as an interface



commit bf9b51ce838f23af2b828eadac854959e289d9ac
Author: Stef Walter <stefw gnome org>
Date:   Sat Nov 2 13:31:20 2013 +0100

    gcr: Make GcrComparable introspectable as an interface

 gcr/gcr-comparable.c |   40 ++++------------------------------------
 1 files changed, 4 insertions(+), 36 deletions(-)
---
diff --git a/gcr/gcr-comparable.c b/gcr/gcr-comparable.c
index fddbdd1..57778bc 100644
--- a/gcr/gcr-comparable.c
+++ b/gcr/gcr-comparable.c
@@ -42,53 +42,21 @@
 
 /**
  * GcrComparableIface:
+ * @parent: type interface
  *
  * The interface to implement for #GcrComparable
  */
 
-/* ---------------------------------------------------------------------------------
- * INTERFACE
- */
+typedef GcrComparableIface GcrComparableInterface;
+G_DEFINE_INTERFACE (GcrComparable, gcr_comparable, G_TYPE_OBJECT);
 
 static void
-gcr_comparable_base_init (gpointer g_class)
+gcr_comparable_default_init (GcrComparableIface *iface)
 {
-       static volatile gsize initialized = 0;
-
-       if (g_once_init_enter (&initialized)) {
-               /* Add properties and signals to the interface */
-               g_once_init_leave (&initialized, 1);
-       }
-}
 
-GType
-gcr_comparable_get_type (void)
-{
-       static GType type = 0;
-       if (!type) {
-               static const GTypeInfo info = {
-                       sizeof (GcrComparableIface),
-                       gcr_comparable_base_init,               /* 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, "GcrComparableIface", &info, 0);
-               g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
-       }
-
-       return type;
 }
 
 
-/* -----------------------------------------------------------------------------
- * PUBLIC
- */
-
 /**
  * gcr_comparable_compare:
  * @self: The comparable object


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