Use G_DEFINE_TYPE to simplify code.
authorPeng Huang <shawn.p.huang@gmail.com>
Sat, 30 Jan 2010 15:19:32 +0000 (23:19 +0800)
committerPeng Huang <shawn.p.huang@gmail.com>
Sat, 30 Jan 2010 15:19:32 +0000 (23:19 +0800)
30 files changed:
bus/connection.c
bus/dbusimpl.c
bus/engineproxy.c
bus/factoryproxy.c
bus/ibusimpl.c
bus/inputcontext.c
bus/matchrule.c
bus/registry.c
bus/server.c
src/ibusattribute.c
src/ibusattrlist.c
src/ibusbus.c
src/ibuscomponent.c
src/ibusconnection.c
src/ibusengine.c
src/ibusenginedesc.c
src/ibusfactory.c
src/ibusinputcontext.c
src/ibuskeymap.c
src/ibuslookuptable.c
src/ibusobject.c
src/ibusobservedpath.c
src/ibuspanelservice.c
src/ibusproperty.c
src/ibusproplist.c
src/ibusproxy.c
src/ibusserializable.c
src/ibusserver.c
src/ibusservice.c
src/ibustext.c

index a14119101a926fd0e87ce960014901ab71faf44c..c1f6fcd90ffcdaaf94161b671c22b1f4ee5a11a4 100644 (file)
@@ -34,7 +34,6 @@ typedef struct _BusConnectionPrivate BusConnectionPrivate;
 // static guint            _signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void     bus_connection_init         (BusConnection          *connection);
 static void     bus_connection_destroy      (BusConnection          *connection);
 static gboolean bus_connection_authenticate_unix_user
                                             (IBusConnection         *connection,
index a82b13d83e54f19f187eee9cbe8392c61a560dda..89a788c25e44c9ccab551870de1b18c71743c40f 100644 (file)
@@ -40,7 +40,6 @@ enum {
 static guint dbus_signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void     bus_dbus_impl_init              (BusDBusImpl        *dbus);
 static void     bus_dbus_impl_destroy           (BusDBusImpl        *dbus);
 static gboolean bus_dbus_impl_ibus_message      (BusDBusImpl        *dbus,
                                                  BusConnection      *connection,
index e8b1f726f6f2dec94faa6fa63be7700c4ef0fc1f..a1753d06cd190d39b9a2100b9e0f0a5bb678f19d 100644 (file)
@@ -52,7 +52,6 @@ static guint    engine_signals[LAST_SIGNAL] = { 0 };
 // static guint            engine_signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void     bus_engine_proxy_init           (BusEngineProxy         *engine);
 static void     bus_engine_proxy_real_destroy   (BusEngineProxy         *engine);
 
 static gboolean bus_engine_proxy_ibus_signal    (IBusProxy              *proxy,
index 0c3cac4b2aeb6be226fb8f5e6abb3f6aff5fd17f..41abf2ca07190e2da50e6f0b63d9735c61f96e1d 100644 (file)
@@ -26,7 +26,6 @@
 #include "option.h"
 
 /* functions prototype */
-static void      bus_factory_proxy_init         (BusFactoryProxy        *factory);
 static void      bus_factory_proxy_destroy      (BusFactoryProxy        *factory);
 
 G_DEFINE_TYPE (BusFactoryProxy, bus_factory_proxy, IBUS_TYPE_PROXY)
index 47bab4fe9d922a0135275d289960fe39da14fe2d..404975d3065bd2a2a747e961730f9a144d09293d 100644 (file)
@@ -47,7 +47,6 @@ enum {
 // static guint            _signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void     bus_ibus_impl_init              (BusIBusImpl        *ibus);
 static void     bus_ibus_impl_destroy           (BusIBusImpl        *ibus);
 static gboolean bus_ibus_impl_ibus_message      (BusIBusImpl        *ibus,
                                                  BusConnection      *connection,
index c2e2c84174673d16f0eb90fa3fcc334e61fa196e..26eb1d54f2b6b54743b934461839401b828f3901 100644 (file)
@@ -64,7 +64,6 @@ typedef struct _BusInputContextPrivate BusInputContextPrivate;
 static guint    context_signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void     bus_input_context_init          (BusInputContext        *context);
 static void     bus_input_context_destroy       (BusInputContext        *context);
 static gboolean bus_input_context_ibus_message  (BusInputContext        *context,
                                                  BusConnection          *connection,
index 836d2c623ce7b4fdecd29b27b82ccd79d2a31d66..840a9127154aa67e6642c55e7c6359dc26224534 100644 (file)
@@ -25,7 +25,6 @@
    (G_TYPE_INSTANCE_GET_PRIVATE ((o), BUS_TYPE_CONFIG_PROXY, BusMatchRulePrivate))
 
 
-static void      bus_match_rule_init            (BusMatchRule       *rule);
 static void      bus_match_rule_destroy         (BusMatchRule       *rule);
 static void      _connection_destroy_cb         (BusConnection      *connection,
                                                  BusMatchRule       *rule);
index 080b54f4d037972fd62fb9d61804b9d6705b3051..3f452422d84948cc511957cdba32d0be8bd270d9 100644 (file)
@@ -34,7 +34,6 @@ enum {
 static guint             _signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void              bus_registry_init              (BusRegistry        *registry);
 static void              bus_registry_destroy           (BusRegistry        *registry);
 static void              bus_registry_load              (BusRegistry        *registry);
 static void              bus_registry_load_in_dir       (BusRegistry        *registry,
index fa9e36115dcda96f7cbf5912e70ffb319cd17b81..6c1478092212ba771d684c680d64d9541bd4e6c8 100644 (file)
@@ -29,7 +29,6 @@
 #include "ibusimpl.h"
 
 /* functions prototype */
-static void      bus_server_init        (BusServer          *server);
 static void      bus_server_destroy     (BusServer          *server);
 static void      bus_server_new_connection
                                         (BusServer          *server,
index f8720edbc36f2c7d2a5dfebdf6d69ad9894ca748..3a7c7a37f5f012f533a70357c897079335cb7431 100644 (file)
@@ -21,8 +21,6 @@
 #include "ibusattribute.h"
 
 /* functions prototype */
-static void         ibus_attribute_class_init   (IBusAttributeClass     *klass);
-static void         ibus_attribute_init         (IBusAttribute          *attr);
 // static void         ibus_attribute_destroy      (IBusAttribute          *attr);
 static gboolean     ibus_attribute_serialize    (IBusAttribute          *attr,
                                                  IBusMessageIter        *iter);
@@ -31,42 +29,13 @@ static gboolean     ibus_attribute_deserialize  (IBusAttribute          *attr,
 static gboolean     ibus_attribute_copy         (IBusAttribute          *dest,
                                                  const IBusAttribute    *src);
 
-static IBusSerializableClass *parent_class = NULL;
-
-GType
-ibus_attribute_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusAttributeClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_attribute_class_init,
-        NULL,               /* class finialize */
-        NULL,               /* class data */
-        sizeof (IBusAttribute),
-        0,
-        (GInstanceInitFunc) ibus_attribute_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERIALIZABLE,
-                                       "IBusAttribute",
-                                       &type_info,
-                                       0);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusAttribute, ibus_attribute, IBUS_TYPE_SERIALIZABLE)
 
 static void
 ibus_attribute_class_init (IBusAttributeClass *klass)
 {
     IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (klass);
 
-    parent_class = (IBusSerializableClass *) g_type_class_peek_parent (klass);
-
     // object_class->destroy = (IBusObjectDestroyFunc) ibus_attribute_destroy;
 
     serializable_class->serialize   = (IBusSerializableSerializeFunc) ibus_attribute_serialize;
@@ -84,7 +53,7 @@ ibus_attribute_init (IBusAttribute *attr)
 // static void
 // ibus_attribute_destroy (IBusAttribute *attr)
 // {
-//     IBUS_OBJECT (parent_class)->destroy ((IBusObject *)attr);
+//     IBUS_OBJECT (ibus_attribute_parent_class)->destroy ((IBusObject *)attr);
 // }
 
 static gboolean
@@ -93,7 +62,7 @@ ibus_attribute_serialize (IBusAttribute   *attr,
 {
     gboolean retval;
 
-    retval = parent_class->serialize ((IBusSerializable *) attr, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_attribute_parent_class)->serialize ((IBusSerializable *) attr, iter);
     g_return_val_if_fail (retval, FALSE);
 
     g_return_val_if_fail (IBUS_IS_ATTRIBUTE (attr), FALSE);
@@ -119,7 +88,7 @@ ibus_attribute_deserialize (IBusAttribute   *attr,
 {
     gboolean retval;
 
-    retval = parent_class->deserialize ((IBusSerializable *) attr, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_attribute_parent_class)->deserialize ((IBusSerializable *) attr, iter);
     g_return_val_if_fail (retval, FALSE);
 
     g_return_val_if_fail (IBUS_IS_ATTRIBUTE (attr), FALSE);
@@ -150,7 +119,7 @@ ibus_attribute_copy (IBusAttribute       *dest,
 {
     gboolean retval;
 
-    retval = parent_class->copy ((IBusSerializable *)dest,
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_attribute_parent_class)->copy ((IBusSerializable *)dest,
                                  (IBusSerializable *)src);
     g_return_val_if_fail (retval, FALSE);
 
index cbdea98ae4e85b7c5474d710c48fa8452191b9dc..c1ebe16f4b7ff251235c513b8ed9da59a919b243 100644 (file)
@@ -21,8 +21,6 @@
 #include "ibusattrlist.h"
 
 /* functions prototype */
-static void         ibus_attr_list_class_init   (IBusAttrListClass      *klass);
-static void         ibus_attr_list_init         (IBusAttrList           *attr_list);
 static void         ibus_attr_list_destroy      (IBusAttrList           *attr_list);
 static gboolean     ibus_attr_list_serialize    (IBusAttrList           *attr_list,
                                                  IBusMessageIter        *iter);
@@ -31,34 +29,7 @@ static gboolean     ibus_attr_list_deserialize  (IBusAttrList           *attr_li
 static gboolean     ibus_attr_list_copy         (IBusAttrList           *dest,
                                                  const IBusAttrList     *src);
 
-static IBusSerializableClass *parent_class = NULL;
-
-GType
-ibus_attr_list_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusAttrListClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_attr_list_class_init,
-        NULL,               /* class finialize */
-        NULL,               /* class data */
-        sizeof (IBusAttrList),
-        0,
-        (GInstanceInitFunc) ibus_attr_list_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERIALIZABLE,
-                                       "IBusAttrList",
-                                       &type_info,
-                                       0);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusAttrList, ibus_attr_list, IBUS_TYPE_SERIALIZABLE)
 
 static void
 ibus_attr_list_class_init (IBusAttrListClass *klass)
@@ -66,8 +37,6 @@ ibus_attr_list_class_init (IBusAttrListClass *klass)
     IBusObjectClass *object_class = IBUS_OBJECT_CLASS (klass);
     IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (klass);
 
-    parent_class = (IBusSerializableClass *) g_type_class_peek_parent (klass);
-
     object_class->destroy = (IBusObjectDestroyFunc) ibus_attr_list_destroy;
 
     serializable_class->serialize   = (IBusSerializableSerializeFunc) ibus_attr_list_serialize;
@@ -101,7 +70,7 @@ ibus_attr_list_destroy (IBusAttrList *attr_list)
 
     g_array_free (attr_list->attributes, TRUE);
 
-    IBUS_OBJECT_CLASS (parent_class)->destroy ((IBusObject *)attr_list);
+    IBUS_OBJECT_CLASS (ibus_attr_list_parent_class)->destroy ((IBusObject *)attr_list);
 }
 
 static gboolean
@@ -112,7 +81,7 @@ ibus_attr_list_serialize (IBusAttrList    *attr_list,
     gboolean retval;
     guint i;
 
-    retval = parent_class->serialize ((IBusSerializable *)attr_list, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_attr_list_parent_class)->serialize ((IBusSerializable *)attr_list, iter);
     g_return_val_if_fail (retval, FALSE);
 
     g_return_val_if_fail (IBUS_IS_ATTR_LIST (attr_list), FALSE);
@@ -147,7 +116,7 @@ ibus_attr_list_deserialize (IBusAttrList    *attr_list,
     DBusMessageIter array_iter;
     gboolean retval;
 
-    retval = parent_class->deserialize ((IBusSerializable *)attr_list, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_attr_list_parent_class)->deserialize ((IBusSerializable *)attr_list, iter);
     g_return_val_if_fail (retval, FALSE);
 
     retval = ibus_message_iter_recurse (iter, IBUS_TYPE_ARRAY, &array_iter);
@@ -176,7 +145,7 @@ ibus_attr_list_copy (IBusAttrList       *dest,
 {
     gboolean retval;
 
-    retval = parent_class->copy ((IBusSerializable *)dest,
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_attr_list_parent_class)->copy ((IBusSerializable *)dest,
                                  (IBusSerializable *)src);
     g_return_val_if_fail (retval, FALSE);
 
index df9b57912b11efe516b9967bc517e6b9b2cbc956..9a522dade69c4e3f717e047eac87d39b09c0ad89 100644 (file)
@@ -53,41 +53,13 @@ typedef struct _IBusBusPrivate IBusBusPrivate;
 static guint    bus_signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void     ibus_bus_class_init     (IBusBusClass   *klass);
-static void     ibus_bus_init           (IBusBus        *bus);
 static void     ibus_bus_destroy        (IBusObject     *object);
 static void     ibus_bus_watch_dbus_signal
                                         (IBusBus        *bus);
 static void     ibus_bus_unwatch_dbus_signal
                                         (IBusBus        *bus);
-static IBusObjectClass  *parent_class = NULL;
 
-GType
-ibus_bus_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusBusClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_bus_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusBus),
-        0,
-        (GInstanceInitFunc) ibus_bus_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_OBJECT,
-                    "IBusBus",
-                    &type_info,
-                    (GTypeFlags)0);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusBus, ibus_bus, IBUS_TYPE_OBJECT)
 
 IBusBus *
 ibus_bus_new (void)
@@ -102,8 +74,6 @@ ibus_bus_class_init (IBusBusClass *klass)
 {
     IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass);
 
-    parent_class = (IBusObjectClass *) g_type_class_peek_parent (klass);
-
     g_type_class_add_private (klass, sizeof (IBusBusPrivate));
 
     ibus_object_class->destroy = ibus_bus_destroy;
@@ -289,7 +259,7 @@ ibus_bus_destroy (IBusObject *object)
         priv->connection = NULL;
     }
 
-    IBUS_OBJECT_CLASS (parent_class)->destroy (object);
+    IBUS_OBJECT_CLASS (ibus_bus_parent_class)->destroy (object);
 }
 
 gboolean
index 4cb16a61a135bde4c52ec42d061774d1b0df97ee..6e268aee4acb9fc34766efeca563e1c33d959f8a 100644 (file)
@@ -39,8 +39,6 @@ typedef struct _IBusComponentPrivate IBusComponentPrivate;
 // static guint            _signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void         ibus_component_class_init   (IBusComponentClass     *klass);
-static void         ibus_component_init         (IBusComponent          *component);
 static void         ibus_component_destroy      (IBusComponent          *component);
 static gboolean     ibus_component_serialize    (IBusComponent          *component,
                                                  IBusMessageIter        *iter);
@@ -60,35 +58,7 @@ static void         ibus_component_parse_observed_paths
                                                  XMLNode                *node,
                                                  gboolean                access_fs);
 
-static IBusSerializableClass  *parent_class = NULL;
-
-GType
-ibus_component_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusComponentClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_component_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusComponent),
-        0,
-        (GInstanceInitFunc) ibus_component_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERIALIZABLE,
-                    "IBusComponent",
-                    &type_info,
-                    (GTypeFlags)0);
-    }
-
-    return type;
-}
-
+G_DEFINE_TYPE (IBusComponent, ibus_component, IBUS_TYPE_SERIALIZABLE)
 
 static void
 ibus_component_class_init (IBusComponentClass *klass)
@@ -96,8 +66,6 @@ ibus_component_class_init (IBusComponentClass *klass)
     IBusObjectClass *object_class = IBUS_OBJECT_CLASS (klass);
     IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (klass);
 
-    parent_class = (IBusSerializableClass *) g_type_class_peek_parent (klass);
-
     object_class->destroy = (IBusObjectDestroyFunc) ibus_component_destroy;
 
     serializable_class->serialize   = (IBusSerializableSerializeFunc) ibus_component_serialize;
@@ -159,7 +127,7 @@ ibus_component_destroy (IBusComponent *component)
     g_list_free (component->engines);
     component->engines = NULL;
 
-    IBUS_OBJECT_CLASS (parent_class)->destroy (IBUS_OBJECT (component));
+    IBUS_OBJECT_CLASS (ibus_component_parent_class)->destroy (IBUS_OBJECT (component));
 }
 
 static gboolean
@@ -170,7 +138,7 @@ ibus_component_serialize (IBusComponent   *component,
     IBusMessageIter array_iter;
     GList *p;
 
-    retval = parent_class->serialize ((IBusSerializable *)component, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_component_parent_class)->serialize ((IBusSerializable *)component, iter);
     g_return_val_if_fail (retval, FALSE);
 
     retval = ibus_message_iter_append (iter, G_TYPE_STRING, &component->name);
@@ -230,7 +198,7 @@ ibus_component_deserialize (IBusComponent   *component,
     gchar *str;
     IBusMessageIter array_iter;
 
-    retval = parent_class->deserialize ((IBusSerializable *)component, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_component_parent_class)->deserialize ((IBusSerializable *)component, iter);
     g_return_val_if_fail (retval, FALSE);
 
     retval = ibus_message_iter_get (iter, G_TYPE_STRING, &str);
@@ -310,7 +278,7 @@ ibus_component_copy (IBusComponent       *dest,
 {
     gboolean retval;
 
-    retval = parent_class->copy ((IBusSerializable *)dest,
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_component_parent_class)->copy ((IBusSerializable *)dest,
                                  (IBusSerializable *)src);
     g_return_val_if_fail (retval, FALSE);
 
index 5d16418766e68ed21ccbc10bebeb4ac00944d8a6..1a6f1879a3bd6760c145432d8ae12d95dab35334 100644 (file)
@@ -47,8 +47,6 @@ typedef struct _IBusConnectionPrivate IBusConnectionPrivate;
 static guint            connection_signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void     ibus_connection_class_init  (IBusConnectionClass    *klass);
-static void     ibus_connection_init        (IBusConnection         *connection);
 static void     ibus_connection_destroy     (IBusConnection         *connection);
 
 static gboolean ibus_connection_authenticate_unix_user
@@ -64,35 +62,9 @@ static DBusHandlerResult
                                               IBusMessage           *message,
                                               IBusConnection        *connection);
 
-static IBusObjectClass  *parent_class = NULL;
 static GHashTable       *_connections = NULL;
 
-GType
-ibus_connection_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusConnectionClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_connection_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusConnection),
-        0,
-        (GInstanceInitFunc) ibus_connection_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_OBJECT,
-                    "IBusConnection",
-                    &type_info,
-                    (GTypeFlags)0);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusConnection, ibus_connection, IBUS_TYPE_OBJECT)
 
 IBusConnection *
 ibus_connection_new (void)
@@ -107,8 +79,6 @@ ibus_connection_class_init (IBusConnectionClass *klass)
 {
     IBusObjectClass *object_class = IBUS_OBJECT_CLASS (klass);
 
-    parent_class = (IBusObjectClass *) g_type_class_peek_parent (klass);
-
     g_type_class_add_private (klass, sizeof (IBusConnectionPrivate));
 
     object_class->destroy = (IBusObjectDestroyFunc) ibus_connection_destroy;
@@ -267,7 +237,7 @@ ibus_connection_destroy (IBusConnection *connection)
         }
     } while (0);
 
-    parent_class->destroy (IBUS_OBJECT (connection));
+    IBUS_OBJECT_CLASS (ibus_connection_parent_class)->destroy (IBUS_OBJECT (connection));
 }
 
 static gboolean
index 50e02b4eae328afbcdf994afd731fe2d078b46f8..5195a8e264909903868e5459c5e6bbdd1d2eab77 100644 (file)
@@ -64,8 +64,6 @@ typedef struct _IBusEnginePrivate IBusEnginePrivate;
 static guint            engine_signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void     ibus_engine_class_init      (IBusEngineClass    *klass);
-static void     ibus_engine_init            (IBusEngine         *engine);
 static void     ibus_engine_destroy         (IBusEngine         *engine);
 static void     ibus_engine_set_property    (IBusEngine         *engine,
                                              guint               prop_id,
@@ -116,33 +114,7 @@ static void     ibus_engine_property_hide   (IBusEngine         *engine,
                                              const gchar        *prop_name);
 
 
-static IBusServiceClass  *parent_class = NULL;
-
-GType
-ibus_engine_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusEngineClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_engine_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusEngine),
-        0,
-        (GInstanceInitFunc) ibus_engine_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERVICE,
-                    "IBusEngine",
-                    &type_info,
-                    (GTypeFlags) 0);
-    }
-    return type;
-}
+G_DEFINE_TYPE (IBusEngine, ibus_engine, IBUS_TYPE_SERVICE)
 
 IBusEngine *
 ibus_engine_new (const gchar    *name,
@@ -169,8 +141,6 @@ ibus_engine_class_init (IBusEngineClass *klass)
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
     IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass);
 
-    parent_class = (IBusServiceClass *) g_type_class_peek_parent (klass);
-
     g_type_class_add_private (klass, sizeof (IBusEnginePrivate));
 
     gobject_class->set_property = (GObjectSetPropertyFunc) ibus_engine_set_property;
@@ -591,7 +561,7 @@ ibus_engine_destroy (IBusEngine *engine)
         priv->connection = NULL;
     }
 
-    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (engine));
+    IBUS_OBJECT_CLASS(ibus_engine_parent_class)->destroy (IBUS_OBJECT (engine));
 }
 
 static void
@@ -683,7 +653,8 @@ ibus_engine_ibus_message (IBusEngine     *engine,
     name = ibus_message_get_member (message);
 
     if (interface != NULL && g_strcmp0 (interface, IBUS_INTERFACE_ENGINE) != 0)
-        return parent_class->ibus_message ((IBusService *) engine, connection, message);
+        return IBUS_SERVICE_CLASS (ibus_engine_parent_class)->ibus_message (
+                        (IBusService *) engine, connection, message);
 
     do {
         if (g_strcmp0 (name, "ProcessKeyEvent") == 0) {
index d71d1574fe1e0f111539e022168ddbf185c13356..5563cc0ce81f2bbdbb2984d1c627b58f27fc8f8c 100644 (file)
@@ -39,8 +39,6 @@ typedef struct _IBusEngineDescPrivate IBusEngineDescPrivate;
 // static guint            _signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void         ibus_engine_desc_class_init     (IBusEngineDescClass    *klass);
-static void         ibus_engine_desc_init           (IBusEngineDesc         *desc);
 static void         ibus_engine_desc_destroy        (IBusEngineDesc         *desc);
 static gboolean     ibus_engine_desc_serialize      (IBusEngineDesc         *desc,
                                                      IBusMessageIter        *iter);
@@ -51,34 +49,7 @@ static gboolean     ibus_engine_desc_copy           (IBusEngineDesc         *des
 static gboolean     ibus_engine_desc_parse_xml_node (IBusEngineDesc         *desc,
                                                      XMLNode                *node);
 
-static IBusSerializableClass  *parent_class = NULL;
-
-GType
-ibus_engine_desc_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusEngineDescClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_engine_desc_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusEngineDesc),
-        0,
-        (GInstanceInitFunc) ibus_engine_desc_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERIALIZABLE,
-                    "IBusEngineDesc",
-                    &type_info,
-                    (GTypeFlags)0);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusEngineDesc, ibus_engine_desc, IBUS_TYPE_SERIALIZABLE)
 
 
 static void
@@ -87,8 +58,6 @@ ibus_engine_desc_class_init (IBusEngineDescClass *klass)
     IBusObjectClass *object_class = IBUS_OBJECT_CLASS (klass);
     IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (klass);
 
-    parent_class = (IBusSerializableClass *) g_type_class_peek_parent (klass);
-
     object_class->destroy = (IBusObjectDestroyFunc) ibus_engine_desc_destroy;
 
     serializable_class->serialize   = (IBusSerializableSerializeFunc) ibus_engine_desc_serialize;
@@ -125,7 +94,7 @@ ibus_engine_desc_destroy (IBusEngineDesc *desc)
     g_free (desc->icon);
     g_free (desc->layout);
 
-    IBUS_OBJECT_CLASS (parent_class)->destroy (IBUS_OBJECT (desc));
+    IBUS_OBJECT_CLASS (ibus_engine_desc_parent_class)->destroy (IBUS_OBJECT (desc));
 }
 
 static gboolean
@@ -134,7 +103,7 @@ ibus_engine_desc_serialize (IBusEngineDesc  *desc,
 {
     gboolean retval;
 
-    retval = parent_class->serialize ((IBusSerializable *)desc, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_engine_desc_parent_class)->serialize ((IBusSerializable *)desc, iter);
     g_return_val_if_fail (retval, FALSE);
 
     retval = ibus_message_iter_append (iter, G_TYPE_STRING, &desc->name);
@@ -174,7 +143,7 @@ ibus_engine_desc_deserialize (IBusEngineDesc  *desc,
     gboolean retval;
     gchar *str;
 
-    retval = parent_class->deserialize ((IBusSerializable *)desc, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_engine_desc_parent_class)->deserialize ((IBusSerializable *)desc, iter);
     g_return_val_if_fail (retval, FALSE);
 
     retval = ibus_message_iter_get (iter, G_TYPE_STRING, &str);
@@ -230,7 +199,7 @@ ibus_engine_desc_copy (IBusEngineDesc       *dest,
 {
     gboolean retval;
 
-    retval = parent_class->copy ((IBusSerializable *)dest,
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_engine_desc_parent_class)->copy ((IBusSerializable *)dest,
                                  (IBusSerializable *)src);
     g_return_val_if_fail (retval, FALSE);
 
index 8a0fefeae3e1e3d735169e0b22c40e61c875e901..aec215baee2cd4a00e7b0fb1614dc31b967f1560 100644 (file)
@@ -41,8 +41,6 @@ struct _IBusFactoryPrivate {
 typedef struct _IBusFactoryPrivate IBusFactoryPrivate;
 
 /* functions prototype */
-static void     ibus_factory_class_init     (IBusFactoryClass   *klass);
-static void     ibus_factory_init           (IBusFactory        *factory);
 static void     ibus_factory_destroy        (IBusFactory        *factory);
 static gboolean ibus_factory_ibus_message   (IBusFactory        *factory,
                                              IBusConnection     *connection,
@@ -51,33 +49,7 @@ static gboolean ibus_factory_ibus_message   (IBusFactory        *factory,
 static void     _engine_destroy_cb          (IBusEngine         *engine,
                                              IBusFactory        *factory);
 
-static IBusServiceClass *factory_parent_class = NULL;
-
-GType
-ibus_factory_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusFactoryClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_factory_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusFactory),
-        0,
-        (GInstanceInitFunc) ibus_factory_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERVICE,
-                    "IBusFactory",
-                    &type_info,
-                    (GTypeFlags) 0);
-    }
-    return type;
-}
+G_DEFINE_TYPE (IBusFactory, ibus_factory, IBUS_TYPE_SERVICE)
 
 IBusFactory *
 ibus_factory_new (IBusConnection *connection)
@@ -104,8 +76,6 @@ ibus_factory_class_init (IBusFactoryClass *klass)
     // GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
     IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass);
 
-    factory_parent_class = (IBusServiceClass *) g_type_class_peek_parent (klass);
-
     g_type_class_add_private (klass, sizeof (IBusFactoryPrivate));
 
     ibus_object_class->destroy = (IBusObjectDestroyFunc) ibus_factory_destroy;
@@ -152,7 +122,7 @@ ibus_factory_destroy (IBusFactory *factory)
         g_object_unref (priv->connection);
     }
 
-    IBUS_OBJECT_CLASS(factory_parent_class)->destroy (IBUS_OBJECT (factory));
+    IBUS_OBJECT_CLASS(ibus_factory_parent_class)->destroy (IBUS_OBJECT (factory));
 }
 
 static void
@@ -241,9 +211,10 @@ ibus_factory_ibus_message (IBusFactory    *factory,
         return TRUE;
     }
 
-    return factory_parent_class->ibus_message ((IBusService *)factory,
-                                               connection,
-                                               message);
+    return IBUS_SERVICE_CLASS (ibus_factory_parent_class)->ibus_message (
+                                (IBusService *)factory,
+                                connection,
+                                message);
 }
 
 void
index 66744c79294e766c4b5d72b9a5502771702edb76..907544b9c60037e0ff0a134c05d84570de325f79 100644 (file)
@@ -63,39 +63,11 @@ static guint            context_signals[LAST_SIGNAL] = { 0 };
 // static guint            context_signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void     ibus_input_context_class_init   (IBusInputContextClass  *klass);
-static void     ibus_input_context_init         (IBusInputContext       *context);
 static void     ibus_input_context_real_destroy (IBusInputContext       *context);
 static gboolean ibus_input_context_ibus_signal  (IBusProxy              *proxy,
                                                  DBusMessage            *message);
 
-static IBusProxyClass  *parent_class = NULL;
-
-GType
-ibus_input_context_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusInputContextClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_input_context_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusInputContext),
-        0,
-        (GInstanceInitFunc) ibus_input_context_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_PROXY,
-                    "IBusInputContext",
-                    &type_info,
-                    (GTypeFlags)0);
-    }
-    return type;
-}
+G_DEFINE_TYPE (IBusInputContext, ibus_input_context, IBUS_TYPE_PROXY)
 
 IBusInputContext *
 ibus_input_context_new (const gchar     *path,
@@ -133,9 +105,6 @@ ibus_input_context_class_init (IBusInputContextClass *klass)
     IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass);
     IBusProxyClass *proxy_class = IBUS_PROXY_CLASS (klass);
 
-
-    parent_class = (IBusProxyClass *) g_type_class_peek_parent (klass);
-
     g_type_class_add_private (klass, sizeof (IBusInputContextPrivate));
 
     ibus_object_class->destroy = (IBusObjectDestroyFunc) ibus_input_context_real_destroy;
@@ -524,7 +493,7 @@ ibus_input_context_real_destroy (IBusInputContext *context)
                          G_TYPE_INVALID);
     }
 
-    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (context));
+    IBUS_OBJECT_CLASS(ibus_input_context_parent_class)->destroy (IBUS_OBJECT (context));
 }
 
 static gboolean
index 57f2c25bb56b730258fa7709250532b55b85c496..6abade07221bdf0ea0fb254d454a22413841dec5 100644 (file)
 #include "ibuskeymap.h"
 
 /* functions prototype */
-static void         ibus_keymap_class_init      (IBusKeymapClass        *klass);
-static void         ibus_keymap_init            (IBusKeymap             *keymap);
 static void         ibus_keymap_destroy         (IBusKeymap             *keymap);
 static gboolean     ibus_keymap_load            (const gchar            *name,
                                                  KEYMAP                  keymap);
-static IBusObjectClass *parent_class = NULL;
 static GHashTable      *keymaps = NULL;
 
-GType
-ibus_keymap_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusKeymapClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_keymap_class_init,
-        NULL,               /* class finialize */
-        NULL,               /* class data */
-        sizeof (IBusKeymap),
-        0,
-        (GInstanceInitFunc) ibus_keymap_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_OBJECT,
-                                       "IBusKeymap",
-                                       &type_info,
-                                       0);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusKeymap, ibus_keymap, IBUS_TYPE_OBJECT)
 
 static void
 ibus_keymap_class_init (IBusKeymapClass *klass)
 {
     IBusObjectClass *object_class = IBUS_OBJECT_CLASS (klass);
 
-    parent_class = (IBusObjectClass *) g_type_class_peek_parent (klass);
-
     object_class->destroy = (IBusObjectDestroyFunc) ibus_keymap_destroy;
 }
 
@@ -90,7 +60,7 @@ ibus_keymap_destroy (IBusKeymap *keymap)
         g_free (keymap->name);
         keymap->name = NULL;
     }
-    IBUS_OBJECT_CLASS (parent_class)->destroy ((IBusObject *)keymap);
+    IBUS_OBJECT_CLASS (ibus_keymap_parent_class)->destroy ((IBusObject *)keymap);
 }
 
 #define SKIP_SPACE(p)   \
index 10c3f345377cb775d41e0da8e2f9af8ac2347392..6c7d9b8e02160f7343be841f98758063d6462e76 100644 (file)
@@ -21,8 +21,6 @@
 #include "ibuslookuptable.h"
 
 /* functions prototype */
-static void         ibus_lookup_table_class_init    (IBusLookupTableClass   *klass);
-static void         ibus_lookup_table_init          (IBusLookupTable        *table);
 static void         ibus_lookup_table_destroy       (IBusLookupTable        *table);
 static gboolean     ibus_lookup_table_serialize     (IBusLookupTable        *table,
                                                      IBusMessageIter        *iter);
@@ -31,34 +29,7 @@ static gboolean     ibus_lookup_table_deserialize   (IBusLookupTable        *tab
 static gboolean     ibus_lookup_table_copy          (IBusLookupTable        *dest,
                                                      IBusLookupTable        *src);
 
-static IBusSerializableClass *parent_class = NULL;
-
-GType
-ibus_lookup_table_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusLookupTableClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_lookup_table_class_init,
-        NULL,               /* class finialize */
-        NULL,               /* class data */
-        sizeof (IBusLookupTable),
-        0,
-        (GInstanceInitFunc) ibus_lookup_table_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERIALIZABLE,
-                                       "IBusLookupTable",
-                                       &type_info,
-                                       0);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusLookupTable, ibus_lookup_table, IBUS_TYPE_SERIALIZABLE)
 
 static void
 ibus_lookup_table_class_init (IBusLookupTableClass *klass)
@@ -66,8 +37,6 @@ ibus_lookup_table_class_init (IBusLookupTableClass *klass)
     IBusObjectClass *object_class = IBUS_OBJECT_CLASS (klass);
     IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (klass);
 
-    parent_class = (IBusSerializableClass *) g_type_class_peek_parent (klass);
-
     object_class->destroy = (IBusObjectDestroyFunc) ibus_lookup_table_destroy;
 
     serializable_class->serialize   = (IBusSerializableSerializeFunc) ibus_lookup_table_serialize;
@@ -109,7 +78,7 @@ ibus_lookup_table_destroy (IBusLookupTable *table)
         g_free (p);
     }
 
-    IBUS_OBJECT_CLASS (parent_class)->destroy ((IBusObject *) table);
+    IBUS_OBJECT_CLASS (ibus_lookup_table_parent_class)->destroy ((IBusObject *) table);
 }
 
 static gboolean
@@ -120,7 +89,7 @@ ibus_lookup_table_serialize (IBusLookupTable *table,
     gboolean retval;
     guint i;
 
-    retval = parent_class->serialize ((IBusSerializable *)table, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_lookup_table_parent_class)->serialize ((IBusSerializable *)table, iter);
     g_return_val_if_fail (retval, FALSE);
 
     g_return_val_if_fail (IBUS_IS_LOOKUP_TABLE (table), FALSE);
@@ -192,7 +161,7 @@ ibus_lookup_table_deserialize (IBusLookupTable *table,
     DBusMessageIter array_iter;
     gboolean retval;
 
-    retval = parent_class->deserialize ((IBusSerializable *)table, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_lookup_table_parent_class)->deserialize ((IBusSerializable *)table, iter);
     g_return_val_if_fail (retval, FALSE);
 
     g_return_val_if_fail (IBUS_IS_LOOKUP_TABLE (table), FALSE);
@@ -257,7 +226,7 @@ ibus_lookup_table_copy (IBusLookupTable *dest,
     gboolean retval;
     guint i;
 
-    retval = parent_class->copy ((IBusSerializable *)dest, (IBusSerializable *)src);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_lookup_table_parent_class)->copy ((IBusSerializable *)dest, (IBusSerializable *)src);
     g_return_val_if_fail (retval, FALSE);
 
     g_return_val_if_fail (IBUS_IS_LOOKUP_TABLE (dest), FALSE);
index c7d061c600083fc557386196a84385a482959734..f6723ae6a37ae57a27ddd191ce24ac9d823c95ea 100644 (file)
@@ -44,8 +44,6 @@ static guint            _count = 0;
 #endif
 
 /* functions prototype */
-static void      ibus_object_class_init     (IBusObjectClass    *klass);
-static void      ibus_object_init           (IBusObject         *obj);
 static GObject  *ibus_object_constructor    (GType               type,
                                              guint               n,
                                              GObjectConstructParam
@@ -54,35 +52,7 @@ static void      ibus_object_dispose        (IBusObject         *obj);
 static void      ibus_object_finalize       (IBusObject         *obj);
 static void      ibus_object_real_destroy   (IBusObject         *obj);
 
-static GObjectClass *parent_class = NULL;
-
-
-GType
-ibus_object_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusObjectClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_object_class_init,
-        NULL,               /* class finialize */
-        NULL,               /* class data */
-        sizeof (IBusObject),
-        0,
-        (GInstanceInitFunc) ibus_object_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (G_TYPE_INITIALLY_UNOWNED,
-                    "IBusObject",
-                    &type_info,
-                    G_TYPE_FLAG_ABSTRACT);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusObject, ibus_object, G_TYPE_INITIALLY_UNOWNED)
 
 /**
  * ibus_object_new:
@@ -102,8 +72,6 @@ ibus_object_class_init     (IBusObjectClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-    parent_class = (GObjectClass *) g_type_class_peek_parent (klass);
-
     g_type_class_add_private (klass, sizeof (IBusObjectPrivate));
 
     gobject_class->constructor = ibus_object_constructor;
@@ -155,7 +123,7 @@ ibus_object_constructor (GType                   type,
 {
     GObject *object;
 
-    object = parent_class->constructor (type, n ,args);
+    object = G_OBJECT_CLASS (ibus_object_parent_class)->constructor (type, n ,args);
 
 #ifdef DEBUG_MEMORY
     if (object != NULL) {
@@ -185,7 +153,7 @@ ibus_object_dispose (IBusObject *obj)
         IBUS_OBJECT_UNSET_FLAGS (obj, IBUS_IN_DESTRUCTION);
     }
 
-    G_OBJECT_CLASS(parent_class)->dispose (G_OBJECT (obj));
+    G_OBJECT_CLASS(ibus_object_parent_class)->dispose (G_OBJECT (obj));
 }
 
 static void
@@ -200,7 +168,7 @@ ibus_object_finalize (IBusObject *obj)
     g_debug ("Finalize %s, count = %d, all = %d", G_OBJECT_TYPE_NAME (obj), count, _count);
 #endif
 
-    G_OBJECT_CLASS(parent_class)->finalize (G_OBJECT (obj));
+    G_OBJECT_CLASS(ibus_object_parent_class)->finalize (G_OBJECT (obj));
 }
 
 static void
index 87a2653070d643de7ef3a47f6fbbee420e47b353..a71b48b263fed57ba6441628994d4edfeaf4e1da 100644 (file)
@@ -40,8 +40,6 @@ typedef struct _IBusObservedPathPrivate IBusObservedPathPrivate;
 // static guint            _signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void      ibus_observed_path_class_init      (IBusObservedPathClass  *klass);
-static void      ibus_observed_path_init            (IBusObservedPath       *path);
 static void      ibus_observed_path_destroy         (IBusObservedPath       *path);
 static gboolean  ibus_observed_path_serialize       (IBusObservedPath       *path,
                                                      IBusMessageIter        *iter);
@@ -52,35 +50,7 @@ static gboolean  ibus_observed_path_copy            (IBusObservedPath       *des
 static gboolean  ibus_observed_path_parse_xml_node  (IBusObservedPath       *path,
                                                      XMLNode                *node);
 
-static IBusSerializableClass  *parent_class = NULL;
-
-GType
-ibus_observed_path_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusObservedPathClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_observed_path_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusObservedPath),
-        0,
-        (GInstanceInitFunc) ibus_observed_path_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERIALIZABLE,
-                    "IBusObservedPath",
-                    &type_info,
-                    (GTypeFlags)0);
-    }
-
-    return type;
-}
-
+G_DEFINE_TYPE (IBusObservedPath, ibus_observed_path, IBUS_TYPE_SERIALIZABLE)
 
 static void
 ibus_observed_path_class_init (IBusObservedPathClass *klass)
@@ -88,8 +58,6 @@ ibus_observed_path_class_init (IBusObservedPathClass *klass)
     IBusObjectClass *object_class = IBUS_OBJECT_CLASS (klass);
     IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (klass);
 
-    parent_class = (IBusSerializableClass *) g_type_class_peek_parent (klass);
-
     // g_type_class_add_private (klass, sizeof (IBusObservedPathPrivate));
 
     object_class->destroy = (IBusObjectDestroyFunc) ibus_observed_path_destroy;
@@ -112,7 +80,7 @@ static void
 ibus_observed_path_destroy (IBusObservedPath *path)
 {
     g_free (path->path);
-    IBUS_OBJECT_CLASS (parent_class)->destroy (IBUS_OBJECT (path));
+    IBUS_OBJECT_CLASS (ibus_observed_path_parent_class)->destroy (IBUS_OBJECT (path));
 }
 
 static gboolean
@@ -121,7 +89,7 @@ ibus_observed_path_serialize (IBusObservedPath *path,
 {
     gboolean retval;
 
-    retval = parent_class->serialize ((IBusSerializable *)path, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_observed_path_parent_class)->serialize ((IBusSerializable *)path, iter);
     g_return_val_if_fail (retval, FALSE);
 
     retval = ibus_message_iter_append (iter, G_TYPE_STRING, &(path->path));
@@ -140,7 +108,7 @@ ibus_observed_path_deserialize (IBusObservedPath *path,
     gboolean retval;
     gchar *str;
 
-    retval = parent_class->deserialize ((IBusSerializable *)path, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_observed_path_parent_class)->deserialize ((IBusSerializable *)path, iter);
     g_return_val_if_fail (retval, FALSE);
 
     retval = ibus_message_iter_get (iter, G_TYPE_STRING, &str);
@@ -161,7 +129,7 @@ ibus_observed_path_copy (IBusObservedPath       *dest,
 {
     gboolean retval;
 
-    retval = parent_class->copy ((IBusSerializable *)dest, (IBusSerializable *)src);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_observed_path_parent_class)->copy ((IBusSerializable *)dest, (IBusSerializable *)src);
     g_return_val_if_fail (retval, FALSE);
 
     dest->path = g_strdup (src->path);
index 4a8eb0e67e267858068f6810cad540c3ad5dd011..8420f2cc6f87f0b949bf04b8f42a27b6e35aa936 100644 (file)
@@ -27,8 +27,6 @@ enum {
 };
 
 /* functions prototype */
-static void     ibus_panel_service_class_init            (IBusPanelServiceClass *klass);
-static void     ibus_panel_service_init                  (IBusPanelService      *panel);
 static void     ibus_panel_service_service_set_property  (IBusPanelService      *panel,
                                                           guint                  prop_id,
                                                           const GValue          *value,
@@ -75,33 +73,7 @@ static gboolean ibus_panel_service_update_property       (IBusPanelService
                                                           IBusProperty          *prop,
                                                           IBusError            **error);
 
-static IBusServiceClass  *parent_class = NULL;
-
-GType
-ibus_panel_service_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusPanelServiceClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_panel_service_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusPanelService),
-        0,
-        (GInstanceInitFunc) ibus_panel_service_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERVICE,
-                                       "IBusPanelService",
-                                       &type_info,
-                                       (GTypeFlags)0);
-    }
-    return type;
-}
+G_DEFINE_TYPE (IBusPanelService, ibus_panel_service, IBUS_TYPE_SERVICE)
 
 IBusPanelService *
 ibus_panel_service_new (IBusConnection *connection)
@@ -123,8 +95,6 @@ ibus_panel_service_class_init (IBusPanelServiceClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-    parent_class = (IBusServiceClass *) g_type_class_peek_parent (klass);
-
     gobject_class->set_property = (GObjectSetPropertyFunc) ibus_panel_service_service_set_property;
     gobject_class->get_property = (GObjectGetPropertyFunc) ibus_panel_service_service_get_property;
 
@@ -222,7 +192,7 @@ ibus_panel_service_service_get_property (IBusPanelService *panel,
 static void
 ibus_panel_service_real_destroy (IBusPanelService *panel)
 {
-    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (panel));
+    IBUS_OBJECT_CLASS(ibus_panel_service_parent_class)->destroy (IBUS_OBJECT (panel));
 }
 
 static gboolean
index 8827a223c7399407526f259b5475da4f9144dd3c..c0e44304b6a0c6eed1701b9f203803daf68027a3 100644 (file)
@@ -22,8 +22,6 @@
 #include "ibusproplist.h"
 
 /* functions prototype */
-static void         ibus_property_class_init    (IBusPropertyClass  *klass);
-static void         ibus_property_init          (IBusProperty       *prop);
 static void         ibus_property_destroy       (IBusProperty       *prop);
 static gboolean     ibus_property_serialize     (IBusProperty       *prop,
                                                  IBusMessageIter    *iter);
@@ -32,34 +30,7 @@ static gboolean     ibus_property_deserialize   (IBusProperty       *prop,
 static gboolean     ibus_property_copy          (IBusProperty       *dest,
                                                  const IBusProperty *src);
 
-static IBusSerializableClass *parent_class = NULL;
-
-GType
-ibus_property_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusPropertyClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_property_class_init,
-        NULL,               /* class finialize */
-        NULL,               /* class data */
-        sizeof (IBusProperty),
-        0,
-        (GInstanceInitFunc) ibus_property_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERIALIZABLE,
-                                       "IBusProperty",
-                                       &type_info,
-                                       0);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusProperty, ibus_property, IBUS_TYPE_SERIALIZABLE)
 
 static void
 ibus_property_class_init (IBusPropertyClass *klass)
@@ -67,8 +38,6 @@ ibus_property_class_init (IBusPropertyClass *klass)
     IBusObjectClass *object_class = IBUS_OBJECT_CLASS (klass);
     IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (klass);
 
-    parent_class = (IBusSerializableClass *) g_type_class_peek_parent (klass);
-
     object_class->destroy = (IBusObjectDestroyFunc) ibus_property_destroy;
 
     serializable_class->serialize   = (IBusSerializableSerializeFunc) ibus_property_serialize;
@@ -117,7 +86,7 @@ ibus_property_destroy (IBusProperty *prop)
         prop->sub_props = NULL;
     }
 
-    IBUS_OBJECT_CLASS (parent_class)->destroy ((IBusObject *)prop);
+    IBUS_OBJECT_CLASS (ibus_property_parent_class)->destroy ((IBusObject *)prop);
 }
 
 gboolean
@@ -126,7 +95,7 @@ ibus_property_serialize (IBusProperty    *prop,
 {
     gboolean retval;
 
-    retval = parent_class->serialize ((IBusSerializable *) prop, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_property_parent_class)->serialize ((IBusSerializable *) prop, iter);
     g_return_val_if_fail (retval, FALSE);
 
     g_return_val_if_fail (IBUS_IS_PROPERTY (prop), FALSE);
@@ -168,7 +137,7 @@ ibus_property_deserialize (IBusProperty    *prop,
     gboolean retval;
     gchar *p;
 
-    retval = parent_class->deserialize ((IBusSerializable *) prop, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_property_parent_class)->deserialize ((IBusSerializable *) prop, iter);
     g_return_val_if_fail (retval, FALSE);
 
     retval = ibus_message_iter_get (iter, G_TYPE_STRING, &p);
@@ -221,7 +190,7 @@ ibus_property_copy (IBusProperty       *dest,
 {
     gboolean retval;
 
-    retval = parent_class->copy ((IBusSerializable *) dest, (IBusSerializable *) src);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_property_parent_class)->copy ((IBusSerializable *) dest, (IBusSerializable *) src);
     g_return_val_if_fail (retval, FALSE);
 
     g_return_val_if_fail (IBUS_IS_PROPERTY (dest), FALSE);
index b3a2dc0f4b4364d0e055b8e794de518cddf079c5..958db8e48f7cad3d8ed83bf1aab3cebb0a244b64 100644 (file)
@@ -21,8 +21,6 @@
 #include "ibusproplist.h"
 
 /* functions prototype */
-static void         ibus_prop_list_class_init   (IBusPropListClass  *klass);
-static void         ibus_prop_list_init         (IBusPropList       *prop_list);
 static void         ibus_prop_list_destroy      (IBusPropList       *prop_list);
 static gboolean     ibus_prop_list_serialize    (IBusPropList       *prop_list,
                                                  IBusMessageIter    *iter);
@@ -31,34 +29,7 @@ static gboolean     ibus_prop_list_deserialize  (IBusPropList       *prop_list,
 static gboolean     ibus_prop_list_copy         (IBusPropList       *dest,
                                                  const IBusPropList *src);
 
-static IBusSerializableClass *parent_class = NULL;
-
-GType
-ibus_prop_list_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusPropListClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_prop_list_class_init,
-        NULL,               /* class finialize */
-        NULL,               /* class data */
-        sizeof (IBusProperty),
-        0,
-        (GInstanceInitFunc) ibus_prop_list_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERIALIZABLE,
-                                       "IBusPropList",
-                                       &type_info,
-                                       0);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusPropList, ibus_prop_list, IBUS_TYPE_SERIALIZABLE)
 
 static void
 ibus_prop_list_class_init (IBusPropListClass *klass)
@@ -66,8 +37,6 @@ ibus_prop_list_class_init (IBusPropListClass *klass)
     IBusObjectClass *object_class = IBUS_OBJECT_CLASS (klass);
     IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (klass);
 
-    parent_class = (IBusSerializableClass *) g_type_class_peek_parent (klass);
-
     object_class->destroy = (IBusObjectDestroyFunc) ibus_prop_list_destroy;
 
     serializable_class->serialize   = (IBusSerializableSerializeFunc) ibus_prop_list_serialize;
@@ -96,7 +65,7 @@ ibus_prop_list_destroy (IBusPropList *prop_list)
     }
     g_free (p);
 
-    IBUS_OBJECT_CLASS (parent_class)->destroy ((IBusObject *) prop_list);
+    IBUS_OBJECT_CLASS (ibus_prop_list_parent_class)->destroy ((IBusObject *) prop_list);
 }
 
 static gboolean
@@ -108,7 +77,7 @@ ibus_prop_list_serialize (IBusPropList    *prop_list,
     IBusProperty *prop;
     guint i;
 
-    retval = parent_class->serialize ((IBusSerializable *) prop_list, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_prop_list_parent_class)->serialize ((IBusSerializable *) prop_list, iter);
     g_return_val_if_fail (retval, FALSE);
 
     retval = ibus_message_iter_open_container (iter, IBUS_TYPE_ARRAY, "v", &array_iter);
@@ -136,7 +105,7 @@ ibus_prop_list_deserialize (IBusPropList    *prop_list,
     IBusMessageIter array_iter;
     IBusProperty *prop;
 
-    retval = parent_class->deserialize ((IBusSerializable *) prop_list, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_prop_list_parent_class)->deserialize ((IBusSerializable *) prop_list, iter);
     g_return_val_if_fail (retval, FALSE);
 
     g_return_val_if_fail (IBUS_IS_PROP_LIST (prop_list), FALSE);
@@ -167,7 +136,7 @@ ibus_prop_list_copy (IBusPropList       *dest,
     IBusProperty *prop;
     guint i;
 
-    retval = parent_class->copy ((IBusSerializable *) dest,
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_prop_list_parent_class)->copy ((IBusSerializable *) dest,
                                  (const IBusSerializable *) src);
     g_return_val_if_fail (retval, FALSE);
 
index 27987382809b652ca191a88369f8894668f55ee9..6ff1560931659a24ae3850993f65d81220b6c5cf 100644 (file)
@@ -54,8 +54,6 @@ typedef struct _IBusProxyPrivate IBusProxyPrivate;
 static guint            proxy_signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void      ibus_proxy_class_init  (IBusProxyClass *klass);
-static void      ibus_proxy_init        (IBusProxy      *proxy);
 static GObject  *ibus_proxy_constructor (GType           type,
                                          guint           n_construct_params,
                                          GObjectConstructParam *construct_params);
@@ -72,33 +70,7 @@ static void      ibus_proxy_get_property(IBusProxy       *proxy,
 static gboolean  ibus_proxy_ibus_signal (IBusProxy       *proxy,
                                          IBusMessage     *message);
 
-static IBusObjectClass  *parent_class = NULL;
-
-GType
-ibus_proxy_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusProxyClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_proxy_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusProxy),
-        0,
-        (GInstanceInitFunc) ibus_proxy_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_OBJECT,
-                    "IBusProxy",
-                    &type_info,
-                    (GTypeFlags)0);
-    }
-    return type;
-}
+G_DEFINE_TYPE (IBusProxy, ibus_proxy, IBUS_TYPE_OBJECT)
 
 IBusProxy *
 ibus_proxy_new (const gchar     *name,
@@ -126,8 +98,6 @@ ibus_proxy_class_init (IBusProxyClass *klass)
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
     IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass);
 
-    parent_class = (IBusObjectClass *) g_type_class_peek_parent (klass);
-
     g_type_class_add_private (klass, sizeof (IBusProxyPrivate));
 
     gobject_class->constructor = ibus_proxy_constructor;
@@ -260,7 +230,7 @@ ibus_proxy_constructor (GType           type,
     IBusProxy *proxy;
     IBusProxyPrivate *priv;
 
-    obj = G_OBJECT_CLASS (parent_class)->constructor (type, n_construct_params, construct_params);
+    obj = G_OBJECT_CLASS (ibus_proxy_parent_class)->constructor (type, n_construct_params, construct_params);
 
     proxy = IBUS_PROXY (obj);
     priv = IBUS_PROXY_GET_PRIVATE (proxy);
@@ -427,7 +397,7 @@ ibus_proxy_destroy (IBusProxy *proxy)
         priv->connection = NULL;
     }
 
-    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (proxy));
+    IBUS_OBJECT_CLASS(ibus_proxy_parent_class)->destroy (IBUS_OBJECT (proxy));
 }
 
 static void
index 5b87a2596804489205c2eb19bb805f1ff588612a..b758fa8033012790b32d74cce491dd117062aaf8 100644 (file)
@@ -51,7 +51,6 @@ static gboolean  ibus_serializable_real_copy        (IBusSerializable       *des
 
 static IBusObjectClass *parent_class = NULL;
 
-
 GType
 ibus_serializable_get_type (void)
 {
index 079da8fda93bd0ec9426bad0b0880835bcb40506..94c1048815e294e529fe7dd10528dc6de2b8125d 100644 (file)
@@ -47,8 +47,6 @@ typedef struct _IBusServerPrivate IBusServerPrivate;
 static guint            server_signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void     ibus_server_class_init  (IBusServerClass    *klass);
-static void     ibus_server_init        (IBusServer         *server);
 static void     ibus_server_destroy     (IBusServer         *server);
 static void     ibus_server_set_property(IBusServer         *server,
                                          guint               prop_id,
@@ -65,34 +63,7 @@ static void     ibus_server_new_connection
                                         (IBusServer         *server,
                                          IBusConnection     *connection);
 
-static IBusObjectClass  *parent_class = NULL;
-
-GType
-ibus_server_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusServerClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_server_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusServer),
-        0,
-        (GInstanceInitFunc) ibus_server_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_OBJECT,
-                    "IBusServer",
-                    &type_info,
-                    (GTypeFlags)0);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusServer, ibus_server, IBUS_TYPE_OBJECT)
 
 IBusServer *
 ibus_server_new (void)
@@ -119,8 +90,6 @@ ibus_server_class_init (IBusServerClass *klass)
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
     IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass);
 
-    parent_class = (IBusObjectClass *) g_type_class_peek_parent (klass);
-
     g_type_class_add_private (klass, sizeof (IBusServerPrivate));
 
     gobject_class->set_property = (GObjectSetPropertyFunc) ibus_server_set_property;
@@ -189,7 +158,7 @@ ibus_server_destroy (IBusServer *server)
         priv->server = NULL;
     }
 
-    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (server));
+    IBUS_OBJECT_CLASS(ibus_server_parent_class)->destroy (IBUS_OBJECT (server));
 }
 
 static void
index c194c0730af8c074a494f485d77e102d501b2ef2..0af0c93d6ef0e052a7293c522c7163650718a042 100644 (file)
@@ -46,8 +46,6 @@ typedef struct _IBusServicePrivate IBusServicePrivate;
 static guint            service_signals[LAST_SIGNAL] = { 0 };
 
 /* functions prototype */
-static void     ibus_service_class_init     (IBusServiceClass   *klass);
-static void     ibus_service_init           (IBusService        *service);
 static void     ibus_service_destroy        (IBusService        *service);
 static void     ibus_service_set_property   (IBusService        *service,
                                              guint              prop_id,
@@ -64,33 +62,7 @@ static gboolean ibus_service_ibus_signal    (IBusService        *service,
                                              IBusConnection     *connection,
                                              IBusMessage        *message);
 
-static IBusObjectClass  *parent_class = NULL;
-
-GType
-ibus_service_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusServiceClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_service_class_init,
-        NULL,               /* class finalize */
-        NULL,               /* class data */
-        sizeof (IBusService),
-        0,
-        (GInstanceInitFunc) ibus_service_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_OBJECT,
-                    "IBusService",
-                    &type_info,
-                    (GTypeFlags) 0);
-    }
-    return type;
-}
+G_DEFINE_TYPE (IBusService, ibus_service, IBUS_TYPE_OBJECT)
 
 IBusService *
 ibus_service_new (const gchar *path)
@@ -108,8 +80,6 @@ ibus_service_class_init (IBusServiceClass *klass)
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
     IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass);
 
-    parent_class = (IBusObjectClass *) g_type_class_peek_parent (klass);
-
     g_type_class_add_private (klass, sizeof (IBusServicePrivate));
 
     gobject_class->set_property = (GObjectSetPropertyFunc) ibus_service_set_property;
@@ -206,7 +176,7 @@ ibus_service_destroy (IBusService *service)
     g_free (priv->path);
     priv->path = NULL;
 
-    IBUS_OBJECT_CLASS(parent_class)->destroy (IBUS_OBJECT (service));
+    IBUS_OBJECT_CLASS(ibus_service_parent_class)->destroy (IBUS_OBJECT (service));
 }
 
 static void
index b13b17b8c168dd77bb51561f99885c722fada17e..78d5d054b35efcf2565c61d700e4ef496fa4dd6f 100644 (file)
@@ -21,8 +21,6 @@
 #include "ibustext.h"
 
 /* functions prototype */
-static void         ibus_text_class_init   (IBusTextClass       *klass);
-static void         ibus_text_init         (IBusText            *text);
 static void         ibus_text_destroy      (IBusText            *text);
 static gboolean     ibus_text_serialize    (IBusText            *text,
                                             IBusMessageIter     *iter);
@@ -31,34 +29,7 @@ static gboolean     ibus_text_deserialize  (IBusText            *text,
 static gboolean     ibus_text_copy         (IBusText            *dest,
                                             const IBusText      *src);
 
-static IBusSerializableClass *parent_class = NULL;
-
-GType
-ibus_text_get_type (void)
-{
-    static GType type = 0;
-
-    static const GTypeInfo type_info = {
-        sizeof (IBusTextClass),
-        (GBaseInitFunc)     NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc)    ibus_text_class_init,
-        NULL,               /* class finialize */
-        NULL,               /* class data */
-        sizeof (IBusText),
-        0,
-        (GInstanceInitFunc) ibus_text_init,
-    };
-
-    if (type == 0) {
-        type = g_type_register_static (IBUS_TYPE_SERIALIZABLE,
-                                       "IBusText",
-                                       &type_info,
-                                       0);
-    }
-
-    return type;
-}
+G_DEFINE_TYPE (IBusText, ibus_text, IBUS_TYPE_SERIALIZABLE)
 
 static void
 ibus_text_class_init (IBusTextClass *klass)
@@ -66,7 +37,7 @@ ibus_text_class_init (IBusTextClass *klass)
     IBusObjectClass *object_class = IBUS_OBJECT_CLASS (klass);
     IBusSerializableClass *serializable_class = IBUS_SERIALIZABLE_CLASS (klass);
 
-    parent_class = (IBusSerializableClass *) g_type_class_peek_parent (klass);
+    ibus_text_parent_class = (IBusSerializableClass *) g_type_class_peek_parent (klass);
 
     object_class->destroy = (IBusObjectDestroyFunc) ibus_text_destroy;
 
@@ -98,7 +69,7 @@ ibus_text_destroy (IBusText *text)
         text->attrs = NULL;
     }
 
-    IBUS_OBJECT_CLASS (parent_class)->destroy ((IBusObject *)text);
+    IBUS_OBJECT_CLASS (ibus_text_parent_class)->destroy ((IBusObject *)text);
 }
 
 static gboolean
@@ -107,7 +78,8 @@ ibus_text_serialize (IBusText        *text,
 {
     gboolean retval;
 
-    retval = parent_class->serialize ((IBusSerializable *)text, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_text_parent_class)->serialize (
+                        (IBusSerializable *)text, iter);
     g_return_val_if_fail (retval, FALSE);
 
     retval = ibus_message_iter_append (iter, G_TYPE_STRING, &text->text);
@@ -131,7 +103,8 @@ ibus_text_deserialize (IBusText        *text,
     gboolean retval;
     gchar *str;
 
-    retval = parent_class->deserialize ((IBusSerializable *)text, iter);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_text_parent_class)->deserialize (
+                            (IBusSerializable *)text, iter);
     g_return_val_if_fail (retval, FALSE);
 
     retval = ibus_message_iter_get (iter, G_TYPE_STRING, &str);
@@ -160,8 +133,9 @@ ibus_text_copy (IBusText       *dest,
 {
     gboolean retval;
 
-    retval = parent_class->copy ((IBusSerializable *)dest,
-                                 (IBusSerializable *)src);
+    retval = IBUS_SERIALIZABLE_CLASS (ibus_text_parent_class)->copy (
+                            (IBusSerializable *)dest,
+                            (IBusSerializable *)src);
     g_return_val_if_fail (retval, FALSE);
 
     g_return_val_if_fail (IBUS_IS_TEXT (dest), FALSE);