Blame tests/gobject/deftype.c

Packit ae235b
/* deftype.c
Packit ae235b
 * Copyright (C) 2006 Behdad Esfahbod
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General
Packit ae235b
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
#include <glib-object.h>
Packit ae235b
Packit ae235b
/* see http://bugzilla.gnome.org/show_bug.cgi?id=337128 for the purpose of this test */
Packit ae235b
Packit ae235b
#define MY_G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)       { \
Packit ae235b
  const GInterfaceInfo g_implement_interface_info = { \
Packit ae235b
      (GInterfaceInitFunc) iface_init, \
Packit ae235b
      NULL, \
Packit ae235b
      NULL \
Packit ae235b
    }; \
Packit ae235b
  g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \
Packit ae235b
}
Packit ae235b
Packit ae235b
#define MY_DEFINE_TYPE(TN, t_n, T_P) \
Packit ae235b
	G_DEFINE_TYPE_WITH_CODE (TN, t_n, T_P, \
Packit ae235b
				 MY_G_IMPLEMENT_INTERFACE (G_TYPE_INTERFACE, NULL))
Packit ae235b
Packit ae235b
typedef struct _TypeName {
Packit ae235b
  GObject parent_instance;
Packit ae235b
  const char *name;
Packit ae235b
} TypeName;
Packit ae235b
Packit ae235b
typedef struct _TypeNameClass {
Packit ae235b
  GObjectClass parent_parent;
Packit ae235b
} TypeNameClass;
Packit ae235b
Packit ae235b
GType           type_name_get_type          (void);
Packit ae235b
Packit ae235b
MY_DEFINE_TYPE (TypeName, type_name, G_TYPE_OBJECT)
Packit ae235b
Packit ae235b
static void     type_name_init              (TypeName      *self)
Packit ae235b
{
Packit ae235b
}
Packit ae235b
Packit ae235b
static void     type_name_class_init        (TypeNameClass *klass)
Packit ae235b
{
Packit ae235b
}
Packit ae235b
Packit ae235b
int
Packit ae235b
main (void)
Packit ae235b
{
Packit ae235b
  return 0;
Packit ae235b
}