|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. |
|
3 * |
|
4 * This library is free software; you can redistribute it and/or |
|
5 * modify it under the terms of the GNU Lesser General Public |
|
6 * License as published by the Free Software Foundation; either |
|
7 * version 2 of the License, or (at your option) any later version. |
|
8 * |
|
9 * This library is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
12 * Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public |
|
15 * License along with this library; if not, write to the |
|
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
17 * Boston, MA 02111-1307, USA. |
|
18 * |
|
19 * Description: |
|
20 * |
|
21 */ |
|
22 |
|
23 #include "mambaz.h" |
|
24 |
|
25 extern GType baz_type; |
|
26 |
|
27 static void |
|
28 maman_ibaz_base_init (gpointer g_class) |
|
29 { |
|
30 |
|
31 } |
|
32 |
|
33 GType |
|
34 maman_ibaz_get_type (void) |
|
35 { |
|
36 static GType type = 0; |
|
37 if (type == 0) { |
|
38 static const GTypeInfo info = { |
|
39 sizeof (MamanIbazInterface), |
|
40 maman_ibaz_base_init, /* base_init */ |
|
41 NULL, /* base_finalize */ |
|
42 NULL, /* class_init */ |
|
43 NULL, /* class_finalize */ |
|
44 NULL, /* class_data */ |
|
45 0, |
|
46 0, /* n_preallocs */ |
|
47 NULL /* instance_init */ |
|
48 }; |
|
49 type = g_type_register_static (G_TYPE_INTERFACE, "MamanIbaz", &info, 0); |
|
50 } |
|
51 return type; |
|
52 } |
|
53 |
|
54 void maman_ibaz_do_action (MamanIbaz *self) |
|
55 { |
|
56 |
|
57 MAMAN_IBAZ_GET_INTERFACE (self)->do_action (self); |
|
58 } |
|
59 |
|
60 //that was the interface class |
|
61 |
|
62 static void baz_do_action (MamanBaz *self) |
|
63 { |
|
64 self->instance_member = 10; |
|
65 } |
|
66 |
|
67 void |
|
68 baz_interface_init (gpointer g_iface, |
|
69 gpointer iface_data) |
|
70 { |
|
71 MamanIbazInterface *iface = (MamanIbazInterface *)g_iface; |
|
72 iface->do_action = (void (*) (MamanIbaz *self))baz_do_action; |
|
73 } |
|
74 |
|
75 void |
|
76 baz_instance_init (GTypeInstance *instance, |
|
77 gpointer g_class) |
|
78 { |
|
79 MamanBaz *self = MAMAN_BAZ(instance); |
|
80 self->instance_member = 0xdeadbeaf; |
|
81 } |
|
82 |
|
83 |
|
84 |