[gobject-introspection] tests: Add GType property TestObj:gtype



commit 7b8ef1e9b3ae3c616c03c3b8d9571f5dba026923
Author: Bastian Winkler <buz netbuz org>
Date:   Thu Apr 19 08:01:18 2012 +0200

    tests: Add GType property TestObj:gtype
    
    Needed for https://bugzilla.gnome.org/show_bug.cgi?id=674351
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674366
    
    Signed-off-by: Martin Pitt <martinpitt gnome org>

 tests/scanner/Regress-1.0-expected.gir |    6 ++++++
 tests/scanner/regress.c                |   24 +++++++++++++++++++++++-
 tests/scanner/regress.h                |    1 +
 3 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index f88fd9e..4a1b49a 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -956,6 +956,9 @@ raise an error.</doc>
       <property name="float" writable="1" transfer-ownership="none">
         <type name="gfloat"/>
       </property>
+      <property name="gtype" writable="1" transfer-ownership="none">
+        <type name="GType"/>
+      </property>
       <property name="hash-table" writable="1" transfer-ownership="container">
         <type name="GLib.HashTable">
           <type name="utf8"/>
@@ -1018,6 +1021,9 @@ raise an error.</doc>
       <field name="string">
         <type name="utf8" c:type="char*"/>
       </field>
+      <field name="gtype">
+        <type name="GType" c:type="GType"/>
+      </field>
       <glib:signal name="all"
                    when="first"
                    no-recurse="1"
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 5f12960..5254fa3 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -1816,7 +1816,8 @@ enum
   PROP_TEST_OBJ_INT,
   PROP_TEST_OBJ_FLOAT,
   PROP_TEST_OBJ_DOUBLE,
-  PROP_TEST_OBJ_STRING
+  PROP_TEST_OBJ_STRING,
+  PROP_TEST_OBJ_GTYPE
 };
 
 static void
@@ -1876,6 +1877,10 @@ regress_test_obj_set_property (GObject      *object,
       self->string = g_value_dup_string (value);
       break;
 
+    case PROP_TEST_OBJ_GTYPE:
+      self->gtype = g_value_get_gtype (value);
+      break;
+
     default:
       /* We don't have any other property... */
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1929,6 +1934,10 @@ regress_test_obj_get_property (GObject    *object,
       g_value_set_string (value, self->string);
       break;
 
+    case PROP_TEST_OBJ_GTYPE:
+      g_value_set_gtype (value, self->gtype);
+      break;
+
     default:
       /* We don't have any other property... */
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -2258,6 +2267,18 @@ regress_test_obj_class_init (RegressTestObjClass *klass)
                                    pspec);
 
 
+  /**
+   * TestObj:gtype:
+   */
+  pspec = g_param_spec_gtype ("gtype",
+                              "GType property",
+                              "A GType property",
+                              G_TYPE_NONE,
+                              G_PARAM_READWRITE);
+  g_object_class_install_property (gobject_class,
+                                   PROP_TEST_OBJ_GTYPE,
+                                   pspec);
+
   klass->matrix = regress_test_obj_default_matrix;
 }
 
@@ -2267,6 +2288,7 @@ regress_test_obj_init (RegressTestObj *obj)
   obj->bare = NULL;
   obj->boxed = NULL;
   obj->hash_table = NULL;
+  obj->gtype = G_TYPE_INVALID;
 }
 
 /**
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 1740145..c2a25c1 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -353,6 +353,7 @@ struct _RegressTestObj
   float some_float;
   double some_double;
   char* string;
+  GType gtype;
 };
 
 struct _RegressTestObjClass



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