• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.1 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, see <http://www.gnu.org/licenses/>.
16  */
17 #include <glib-object.h>
18 
19 /* see http://bugzilla.gnome.org/show_bug.cgi?id=337128 for the purpose of this test */
20 
21 #define MY_G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)       { \
22   const GInterfaceInfo g_implement_interface_info = { \
23       (GInterfaceInitFunc) iface_init, \
24       NULL, \
25       NULL \
26     }; \
27   g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \
28 }
29 
30 #define MY_DEFINE_TYPE(TN, t_n, T_P) \
31 	G_DEFINE_TYPE_WITH_CODE (TN, t_n, T_P, \
32 				 MY_G_IMPLEMENT_INTERFACE (G_TYPE_INTERFACE, NULL))
33 
34 typedef struct _TypeName {
35   GObject parent_instance;
36   const char *name;
37 } TypeName;
38 
39 typedef struct _TypeNameClass {
40   GObjectClass parent_parent;
41 } TypeNameClass;
42 
43 GType           type_name_get_type          (void);
44 
MY_DEFINE_TYPE(TypeName,type_name,G_TYPE_OBJECT)45 MY_DEFINE_TYPE (TypeName, type_name, G_TYPE_OBJECT)
46 
47 static void     type_name_init              (TypeName      *self)
48 {
49 }
50 
type_name_class_init(TypeNameClass * klass)51 static void     type_name_class_init        (TypeNameClass *klass)
52 {
53 }
54 
55 int
main(void)56 main (void)
57 {
58   return 0;
59 }
60