Tizen 2.1 base
[platform/upstream/glib2.0.git] / tests / gobject / deftype.c
1 /* deftype.c
2  * Copyright (C) 2006 Behdad Esfahbod
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
15  * Public 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 #include <glib-object.h>
20
21 /* see http://bugzilla.gnome.org/show_bug.cgi?id=337128 for the purpose of this test */
22
23 #define MY_G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)       { \
24   const GInterfaceInfo g_implement_interface_info = { \
25       (GInterfaceInitFunc) iface_init, \
26       NULL, \
27       NULL \
28     }; \
29   g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \
30 }
31
32 #define MY_DEFINE_TYPE(TN, t_n, T_P) \
33         G_DEFINE_TYPE_WITH_CODE (TN, t_n, T_P, \
34                                  MY_G_IMPLEMENT_INTERFACE (G_TYPE_INTERFACE, NULL))
35
36 typedef struct _TypeName {
37   GObject parent_instance;
38   const char *name;
39 } TypeName;
40
41 typedef struct _TypeNameClass {
42   GObjectClass parent_parent;
43 } TypeNameClass;
44
45 MY_DEFINE_TYPE (TypeName, type_name, G_TYPE_OBJECT)
46
47 static void     type_name_init              (TypeName      *self)
48 {
49 }
50
51 static void     type_name_class_init        (TypeNameClass *klass)
52 {
53 }
54
55 int
56 main (void)
57 {
58   return 0;
59 }