Debian Codegraph @

tests/test-unknown.c

raw
1 #include "test-unknown.h"
2
3 enum {
4 PROP_SOME_PROPERTY = 1,
5 };
6
7
8 static void
9 test_interface_base_init (gpointer g_iface)
10 {
11 static gboolean initialized = FALSE;
12
13 if (!initialized) {
14 g_object_interface_install_property (
15 g_iface, g_param_spec_string ("some-property", "some-property",
16 "A simple test property", NULL,
17 G_PARAM_READWRITE));
18 initialized = TRUE;
19 }
20 }
21
22
23 GType
24 test_interface_get_type (void)
25 {
26 static GType gtype = 0;
27
28 if (!gtype) {
29 static const GTypeInfo info = {
30 sizeof (TestInterfaceIface), /* class_size */
31 test_interface_base_init, /* base_init */
32 NULL, /* base_finalize */
33 NULL,
34 NULL, /* class_finalize */
35 NULL, /* class_data */
36 0,
37 0, /* n_preallocs */
38 NULL
39 };
40
41 gtype = g_type_register_static (G_TYPE_INTERFACE, "TestInterface",
42 &info, 0);
43
44 g_type_interface_add_prerequisite (gtype, G_TYPE_OBJECT);
45 }
46
47 return gtype;
48 }
49
50 static void
51 test_unknown_iface_method (TestInterface *iface)
52 {
53 }
54
55 static void
56 test_unknown_test_interface_init (TestInterfaceIface *iface)
57 {
58 iface->iface_method = test_unknown_iface_method;
59 }
60
61 G_DEFINE_TYPE_WITH_CODE (
62 TestUnknown, test_unknown, G_TYPE_OBJECT,
63 G_IMPLEMENT_INTERFACE (TEST_TYPE_INTERFACE,
64 test_unknown_test_interface_init));
65
66 static void
67 test_unknown_init (TestUnknown *self)
68 {
69 }
70
71
72 static void
73 test_unknown_get_property (GObject *object, guint prop_id, GValue *value,
74 GParamSpec *pspec)
75 {
76 }
77
78 static void
79 test_unknown_set_property (GObject *object, guint prop_id, const GValue *value,
80 GParamSpec *pspec)
81 {
82 }
83
84 static void
85 test_unknown_class_init (TestUnknownClass *klass)
86 {
87 GObjectClass *gobject_class = (GObjectClass *)klass;
88
89 gobject_class->get_property = test_unknown_get_property;
90 gobject_class->set_property = test_unknown_set_property;
91
92
93 g_object_class_install_property (
94 G_OBJECT_CLASS (klass), PROP_SOME_PROPERTY,
95 g_param_spec_string ("some-property", "some-property",
96 "A simple test property", NULL,
97 G_PARAM_READWRITE));
98 }
99
100 void
101 test_interface_iface_method (TestInterface *instance)
102 {
103 TestInterfaceIface *iface = TEST_INTERFACE_GET_IFACE (instance);
104
105 (*iface->iface_method) (instance);
106 }