[gobject-introspection] Add test for virtual method with a default implementation



commit 9d7fc78264ce85de3fd021dd4a12313749afa582
Author: Tomeu Vizoso <tomeu sugarlabs org>
Date:   Tue Apr 27 10:22:33 2010 +0200

    Add test for virtual method with a default implementation

 gir/gimarshallingtests.c |   24 ++++++++++++++++++++++++
 gir/gimarshallingtests.h |    7 +++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/gir/gimarshallingtests.c b/gir/gimarshallingtests.c
index 4720950..839b7b3 100644
--- a/gir/gimarshallingtests.c
+++ b/gir/gimarshallingtests.c
@@ -2621,6 +2621,9 @@ enum
 	PROP_INT_
 };
 
+static void g_i_marshalling_tests_object_real_method_with_default_implementation (
+        GIMarshallingTestsObject *self, gint8 in);
+
 G_DEFINE_TYPE (GIMarshallingTestsObject, g_i_marshalling_tests_object, G_TYPE_OBJECT);
 
 static void
@@ -2679,6 +2682,8 @@ g_i_marshalling_tests_object_class_init (GIMarshallingTestsObjectClass *klass)
 	g_object_class_install_property (object_class, PROP_INT_,
          g_param_spec_int ("int", "Integer", "An integer", G_MININT, G_MAXINT, 0,
               G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
+
+    klass->method_with_default_implementation = g_i_marshalling_tests_object_real_method_with_default_implementation;
 }
 
 
@@ -2777,6 +2782,25 @@ g_i_marshalling_tests_object_method_int8_in (GIMarshallingTestsObject *self, gin
   G_I_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_int8_in (self, in);
 }
 
+/**
+ * g_i_marshalling_tests_object_method_with_default_implementation:
+ * @in: (in):
+ */
+void
+g_i_marshalling_tests_object_method_with_default_implementation (GIMarshallingTestsObject *self, gint8 in)
+{
+    G_I_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->method_with_default_implementation (self, in);
+}
+
+static void
+g_i_marshalling_tests_object_real_method_with_default_implementation (GIMarshallingTestsObject *self, gint8 in)
+{
+    GValue val;
+    g_value_init (&val, G_TYPE_INT);
+    g_value_set_int (&val, in);
+    g_object_set_property (G_OBJECT (self), "int", &val);
+}
+
 
 /**
  * g_i_marshalling_tests__object_none_return:
diff --git a/gir/gimarshallingtests.h b/gir/gimarshallingtests.h
index acdbbba..298f544 100644
--- a/gir/gimarshallingtests.h
+++ b/gir/gimarshallingtests.h
@@ -536,6 +536,12 @@ struct _GIMarshallingTestsObjectClass
      * @in: (in):
      */
     void (* method_int8_in) (GIMarshallingTestsObject *self, gint8 in);
+
+    /**
+     * GIMarshallingTestsObjectClass::method_with_default_implementation:
+     * @in: (in):
+     */
+    void (* method_with_default_implementation) (GIMarshallingTestsObject *self, gint8 in);
 };
 
 struct _GIMarshallingTestsObject
@@ -557,6 +563,7 @@ void g_i_marshalling_tests_object_method_array_inout (GIMarshallingTestsObject *
 const gint *g_i_marshalling_tests_object_method_array_return (GIMarshallingTestsObject *object, gint *length);
 
 void g_i_marshalling_tests_object_method_int8_in (GIMarshallingTestsObject *object, gint8 in);
+void g_i_marshalling_tests_object_method_with_default_implementation (GIMarshallingTestsObject *object, gint8 in);
 
 
 GIMarshallingTestsObject *g_i_marshalling_tests__object_none_return (void);



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