summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-05-22 14:08:45 +0200
committerTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-05-22 14:08:45 +0200
commitf05406e92beede4357d74233d51aa3db45d709ae (patch)
treeac3f4046ce95594fbf682c2da6dce6b8b9aa09a5
parentdae8ba15bbbb1008457a1c1b2338ca18df6c4912 (diff)
Add GInitiallyUnknowned subclass to Everything for testing floating references
-rw-r--r--gir/Everything-1.0-expected.gir23
-rw-r--r--gir/everything.c30
-rw-r--r--gir/everything.h19
3 files changed, 72 insertions, 0 deletions
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index 4a15787..bcd71b2 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -138,6 +138,29 @@ and/or use gtk-doc annotations. -->
c:identifier="TEST_FLAG3"
glib:nick="flag3"/>
</bitfield>
+ <class name="TestFloating"
+ c:type="TestFloating"
+ parent="GObject.InitiallyUnowned"
+ glib:type-name="TestFloating"
+ glib:get-type="test_floating_get_type"
+ glib:type-struct="TestFloatingClass">
+ <constructor name="new" c:identifier="test_floating_new">
+ <return-value transfer-ownership="full">
+ <type name="TestFloating" c:type="TestFloating*"/>
+ </return-value>
+ </constructor>
+ <field name="parent_instance">
+ <type name="GObject.InitiallyUnowned" c:type="GInitiallyUnowned"/>
+ </field>
+ </class>
+ <record name="TestFloatingClass"
+ c:type="TestFloatingClass"
+ glib:is-gtype-struct-for="TestFloating">
+ <field name="parent_class">
+ <type name="GObject.InitiallyUnownedClass"
+ c:type="GInitiallyUnownedClass"/>
+ </field>
+ </record>
<interface name="TestInterface"
c:type="EverythingTestInterface"
glib:type-name="EverythingTestInterface"
diff --git a/gir/everything.c b/gir/everything.c
index 08a8992..a603cc5 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -2180,6 +2180,36 @@ test_wi_802_1x_static_method (int x)
return 2*x;
}
+/* floating gobject */
+G_DEFINE_TYPE(TestFloating, test_floating, G_TYPE_INITIALLY_UNOWNED);
+
+static void
+test_floating_finalize(GObject *object)
+{
+ g_assert(!g_object_is_floating (object));
+
+ G_OBJECT_CLASS(test_floating_parent_class)->finalize(object);
+}
+
+static void
+test_floating_class_init (TestFloatingClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = test_floating_finalize;
+}
+
+static void
+test_floating_init (TestFloating *obj)
+{
+}
+
+TestFloating *
+test_floating_new (void)
+{
+ return g_object_new (TEST_TYPE_FLOATING, NULL);
+}
+
+
/**
* test_torture_signature_0:
* @x:
diff --git a/gir/everything.h b/gir/everything.h
index 3b9e264..509e1c0 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -396,6 +396,25 @@ gboolean test_wi_802_1x_get_testbool (TestWi8021x *obj);
void test_wi_802_1x_set_testbool (TestWi8021x *obj, gboolean v);
int test_wi_802_1x_static_method (int x);
+/* floating gobject */
+#define TEST_TYPE_FLOATING (test_floating_get_type ())
+#define TEST_FLOATING(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_FLOATING, TestFloating))
+#define TEST_IS_FLOATING(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_FLOATING))
+#define TEST_FLOATING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_FLOATING, TestFloatingClass))
+
+typedef struct
+{
+ GInitiallyUnowned parent_instance;
+} TestFloating;
+
+typedef struct
+{
+ GInitiallyUnownedClass parent_class;
+} TestFloatingClass;
+
+GType test_floating_get_type (void);
+TestFloating* test_floating_new (void);
+
/* Function signature torture tests */
void test_torture_signature_0 (int x,
double *y,