summaryrefslogtreecommitdiff
path: root/tests/test-unknown.c
blob: f1c3139c6e3ff16b1c17634060b49a31591fd755 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include "test-unknown.h"

enum {
  PROP_SOME_PROPERTY = 1,
};


static void
test_interface_base_init (gpointer g_iface)
{
  static gboolean initialized = FALSE;
  
  if (!initialized)
    {
      g_object_interface_install_property (g_iface,
					   g_param_spec_string ("some-property",
								"some-property",
								"A simple test property",
								NULL,
								G_PARAM_READWRITE));
      initialized = TRUE;
    }
}


GType
test_interface_get_type (void)
{
  static GType gtype = 0;

  if (!gtype)
    {
      static const GTypeInfo info =
      {
        sizeof (TestInterfaceIface), /* class_size */
	test_interface_base_init,   /* base_init */
        NULL,           /* base_finalize */
        NULL,
        NULL,           /* class_finalize */
        NULL,           /* class_data */
        0,
        0,              /* n_preallocs */
        NULL
      };

      gtype =
        g_type_register_static (G_TYPE_INTERFACE, "TestInterface",
                                &info, 0);

      g_type_interface_add_prerequisite (gtype, G_TYPE_OBJECT);
    }

  return gtype;
}

static void test_unknown_iface_method (TestInterface *iface)
{
}

static void
test_unknown_test_interface_init (TestInterfaceIface *iface)
{
  iface->iface_method = test_unknown_iface_method;
}

G_DEFINE_TYPE_WITH_CODE (TestUnknown, test_unknown, G_TYPE_OBJECT,
			 G_IMPLEMENT_INTERFACE (TEST_TYPE_INTERFACE,
						test_unknown_test_interface_init));

static void test_unknown_init (TestUnknown *self) {}


static void
test_unknown_get_property (GObject              *object,
                           guint                 prop_id,
                           GValue               *value,
                           GParamSpec           *pspec)
{

}

static void
test_unknown_set_property (GObject              *object,
                           guint                 prop_id,
                           const GValue         *value,
                           GParamSpec           *pspec)
{

}

static void test_unknown_class_init (TestUnknownClass *klass)
{
  GObjectClass *gobject_class = (GObjectClass*) klass;

  gobject_class->get_property = test_unknown_get_property;
  gobject_class->set_property = test_unknown_set_property;


  g_object_class_install_property (G_OBJECT_CLASS (klass),
                                   PROP_SOME_PROPERTY,
                                   g_param_spec_string ("some-property",
                                                        "some-property",
                                                        "A simple test property",
                                                        NULL,
                                                        G_PARAM_READWRITE));
}

void test_interface_iface_method (TestInterface *instance)
{
  TestInterfaceIface *iface = TEST_INTERFACE_GET_IFACE (instance);

  (* iface->iface_method) (instance);
}