Some error handling/reporting fixes.
[pygobject.git] / tests / test-unknown.c
blobf1c3139c6e3ff16b1c17634060b49a31591fd755
1 #include "test-unknown.h"
3 enum {
4 PROP_SOME_PROPERTY = 1,
5 };
8 static void
9 test_interface_base_init (gpointer g_iface)
11 static gboolean initialized = FALSE;
13 if (!initialized)
15 g_object_interface_install_property (g_iface,
16 g_param_spec_string ("some-property",
17 "some-property",
18 "A simple test property",
19 NULL,
20 G_PARAM_READWRITE));
21 initialized = TRUE;
26 GType
27 test_interface_get_type (void)
29 static GType gtype = 0;
31 if (!gtype)
33 static const GTypeInfo info =
35 sizeof (TestInterfaceIface), /* class_size */
36 test_interface_base_init, /* base_init */
37 NULL, /* base_finalize */
38 NULL,
39 NULL, /* class_finalize */
40 NULL, /* class_data */
42 0, /* n_preallocs */
43 NULL
46 gtype =
47 g_type_register_static (G_TYPE_INTERFACE, "TestInterface",
48 &info, 0);
50 g_type_interface_add_prerequisite (gtype, G_TYPE_OBJECT);
53 return gtype;
56 static void test_unknown_iface_method (TestInterface *iface)
60 static void
61 test_unknown_test_interface_init (TestInterfaceIface *iface)
63 iface->iface_method = test_unknown_iface_method;
66 G_DEFINE_TYPE_WITH_CODE (TestUnknown, test_unknown, G_TYPE_OBJECT,
67 G_IMPLEMENT_INTERFACE (TEST_TYPE_INTERFACE,
68 test_unknown_test_interface_init));
70 static void test_unknown_init (TestUnknown *self) {}
73 static void
74 test_unknown_get_property (GObject *object,
75 guint prop_id,
76 GValue *value,
77 GParamSpec *pspec)
82 static void
83 test_unknown_set_property (GObject *object,
84 guint prop_id,
85 const GValue *value,
86 GParamSpec *pspec)
91 static void test_unknown_class_init (TestUnknownClass *klass)
93 GObjectClass *gobject_class = (GObjectClass*) klass;
95 gobject_class->get_property = test_unknown_get_property;
96 gobject_class->set_property = test_unknown_set_property;
99 g_object_class_install_property (G_OBJECT_CLASS (klass),
100 PROP_SOME_PROPERTY,
101 g_param_spec_string ("some-property",
102 "some-property",
103 "A simple test property",
104 NULL,
105 G_PARAM_READWRITE));
108 void test_interface_iface_method (TestInterface *instance)
110 TestInterfaceIface *iface = TEST_INTERFACE_GET_IFACE (instance);
112 (* iface->iface_method) (instance);