Merge branch 'test-ip_mreq_source-android-only' into 'master'
[glib.git] / tests / gobject / deftype.c
blob773aaa1bd425a9f2961096343b6a0aad5ed25034
1 /* deftype.c
2 * Copyright (C) 2006 Behdad Esfahbod
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.
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.
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/>.
17 #include <glib-object.h>
19 /* see http://bugzilla.gnome.org/show_bug.cgi?id=337128 for the purpose of this test */
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); \
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))
34 typedef struct _TypeName {
35 GObject parent_instance;
36 const char *name;
37 } TypeName;
39 typedef struct _TypeNameClass {
40 GObjectClass parent_parent;
41 } TypeNameClass;
43 GType type_name_get_type (void);
45 MY_DEFINE_TYPE (TypeName, type_name, G_TYPE_OBJECT)
47 static void type_name_init (TypeName *self)
51 static void type_name_class_init (TypeNameClass *klass)
55 int
56 main (void)
58 return 0;