#include <gio/gio.h>

#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
# define SECTION __attribute__ ((section (".gresource.g_test1"), aligned (8)))
#else
# define SECTION
#endif

static const SECTION union { const guint8 data[172]; const double alignment; void * const ptr;}  _g_test1_resource_data = { {
  0x47, 0x56, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x18, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x28, 0x03, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
  0x01, 0x00, 0x00, 0x00, 0xe4, 0x26, 0xc2, 0x05, 
  0x02, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 
  0x0c, 0x00, 0x4c, 0x00, 0x80, 0x00, 0x00, 0x00, 
  0x84, 0x00, 0x00, 0x00, 0xc3, 0xf3, 0xe3, 0x6f, 
  0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 
  0x09, 0x00, 0x76, 0x00, 0x90, 0x00, 0x00, 0x00, 
  0xa6, 0x00, 0x00, 0x00, 0xd4, 0xb5, 0x02, 0x00, 
  0xff, 0xff, 0xff, 0xff, 0xa6, 0x00, 0x00, 0x00, 
  0x01, 0x00, 0x4c, 0x00, 0xa8, 0x00, 0x00, 0x00, 
  0xac, 0x00, 0x00, 0x00, 0x61, 0x75, 0x74, 0x6f, 
  0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x2f, 
  0x01, 0x00, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 
  0x31, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 
  0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x74, 0x65, 0x73, 0x74, 0x31, 0x0a, 0x00, 0x00, 
  0x28, 0x75, 0x75, 0x61, 0x79, 0x29, 0x2f, 0x00, 
  0x00, 0x00, 0x00, 0x00
} };

#ifdef G_HAS_CONSTRUCTORS

#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
#endif
G_DEFINE_CONSTRUCTOR(resource_constructor)
#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
#endif
G_DEFINE_DESTRUCTOR(resource_destructor)

#else
#warning "Constructor not supported on this compiler, linking in resources will not work"
#endif


GResource *_g_test1_resource = NULL;

static void _g_test1_unregister_resource (void)
{
  if (_g_test1_resource)
    {
      g_resources_unregister (_g_test1_resource);
      g_resource_unref (_g_test1_resource);
      _g_test1_resource = NULL;
    }
}

static void _g_test1_register_resource (void)
{
  if (_g_test1_resource == NULL)
    {
      GBytes *bytes = g_bytes_new_static (_g_test1_resource_data.data, sizeof (_g_test1_resource_data.data));
      _g_test1_resource = g_resource_new_from_data (bytes, NULL);
      if (_g_test1_resource)
        g_resources_register (_g_test1_resource);
       g_bytes_unref (bytes);
    }
}

static void resource_constructor (void)
{
  _g_test1_register_resource ();
}

static void resource_destructor (void)
{
  _g_test1_unregister_resource ();
}
