Imported Upstream version 3.3.1
[platform/upstream/pygobject2.git] / tests / test-unknown.c
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     {
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;
22     }
23 }
24
25
26 GType
27 test_interface_get_type (void)
28 {
29   static GType gtype = 0;
30
31   if (!gtype)
32     {
33       static const GTypeInfo info =
34       {
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 */
41         0,
42         0,              /* n_preallocs */
43         NULL
44       };
45
46       gtype =
47         g_type_register_static (G_TYPE_INTERFACE, "TestInterface",
48                                 &info, 0);
49
50       g_type_interface_add_prerequisite (gtype, G_TYPE_OBJECT);
51     }
52
53   return gtype;
54 }
55
56 void test_unknown_iface_method (TestInterface *iface)
57 {
58 }
59
60 static void
61 test_unknown_test_interface_init (TestInterfaceIface *iface)
62 {
63   iface->iface_method = test_unknown_iface_method;
64 }
65
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));
69
70 static void test_unknown_init (TestUnknown *self) {}
71
72
73 static void
74 test_unknown_get_property (GObject              *object,
75                            guint                 prop_id,
76                            GValue               *value,
77                            GParamSpec           *pspec)
78 {
79
80 }
81
82 static void
83 test_unknown_set_property (GObject              *object,
84                            guint                 prop_id,
85                            const GValue         *value,
86                            GParamSpec           *pspec)
87 {
88
89 }
90
91 static void test_unknown_class_init (TestUnknownClass *klass)
92 {
93   GObjectClass *gobject_class = (GObjectClass*) klass;
94
95   gobject_class->get_property = test_unknown_get_property;
96   gobject_class->set_property = test_unknown_set_property;
97
98
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));
106 }
107
108 void test_interface_iface_method (TestInterface *instance)
109 {
110   TestInterfaceIface *iface = TEST_INTERFACE_GET_IFACE (instance);
111
112   (* iface->iface_method) (instance);
113 }