/* Widgetizable.c generated by valac 0.52.4, the Vala compiler
 * generated from Widgetizable.vala, do not modify */

#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <string.h>

#define TOOTLE_TYPE_WIDGETIZABLE (tootle_widgetizable_get_type ())
#define TOOTLE_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_WIDGETIZABLE, TootleWidgetizable))
#define TOOTLE_IS_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_WIDGETIZABLE))
#define TOOTLE_WIDGETIZABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TOOTLE_TYPE_WIDGETIZABLE, TootleWidgetizableIface))

typedef struct _TootleWidgetizable TootleWidgetizable;
typedef struct _TootleWidgetizableIface TootleWidgetizableIface;

#define TOOTLE_TYPE_ENTITY (tootle_entity_get_type ())
#define TOOTLE_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_ENTITY, TootleEntity))
#define TOOTLE_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_ENTITY, TootleEntityClass))
#define TOOTLE_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_ENTITY))
#define TOOTLE_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_ENTITY))
#define TOOTLE_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_ENTITY, TootleEntityClass))

typedef struct _TootleEntity TootleEntity;
typedef struct _TootleEntityClass TootleEntityClass;

#define TOOTLE_API_TYPE_ACCOUNT (tootle_api_account_get_type ())
#define TOOTLE_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccount))
#define TOOTLE_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccountClass))
#define TOOTLE_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_ACCOUNT))
#define TOOTLE_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_ACCOUNT))
#define TOOTLE_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccountClass))

typedef struct _TootleAPIAccount TootleAPIAccount;
typedef struct _TootleAPIAccountClass TootleAPIAccountClass;

#define TOOTLE_TYPE_INSTANCE_ACCOUNT (tootle_instance_account_get_type ())
#define TOOTLE_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccount))
#define TOOTLE_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccountClass))
#define TOOTLE_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT))
#define TOOTLE_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_INSTANCE_ACCOUNT))
#define TOOTLE_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccountClass))

typedef struct _TootleInstanceAccount TootleInstanceAccount;
typedef struct _TootleInstanceAccountClass TootleInstanceAccountClass;

typedef enum  {
	TOOTLE_OOPSIE_USER,
	TOOTLE_OOPSIE_PARSING,
	TOOTLE_OOPSIE_INSTANCE,
	TOOTLE_OOPSIE_INTERNAL
} TootleOopsie;
#define TOOTLE_OOPSIE tootle_oopsie_quark ()
struct _TootleWidgetizableIface {
	GTypeInterface parent_iface;
	GtkWidget* (*to_widget) (TootleWidgetizable* self, GError** error);
	void (*open) (TootleWidgetizable* self);
	void (*resolve_open) (TootleWidgetizable* self, TootleInstanceAccount* account);
};

GQuark tootle_oopsie_quark (void);
GType tootle_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleEntity, g_object_unref)
GType tootle_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIAccount, g_object_unref)
GType tootle_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleInstanceAccount, g_object_unref)
GType tootle_widgetizable_get_type (void) G_GNUC_CONST ;
GtkWidget* tootle_widgetizable_to_widget (TootleWidgetizable* self,
                                          GError** error);
static GtkWidget* tootle_widgetizable_real_to_widget (TootleWidgetizable* self,
                                               GError** error);
void tootle_widgetizable_open (TootleWidgetizable* self);
static void tootle_widgetizable_real_open (TootleWidgetizable* self);
void tootle_widgetizable_resolve_open (TootleWidgetizable* self,
                                       TootleInstanceAccount* account);
static void tootle_widgetizable_real_resolve_open (TootleWidgetizable* self,
                                            TootleInstanceAccount* account);
static GType tootle_widgetizable_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GtkWidget*
tootle_widgetizable_real_to_widget (TootleWidgetizable* self,
                                    GError** error)
{
	GError* _tmp0_;
	GError* _inner_error0_ = NULL;
	_tmp0_ = g_error_new_literal (TOOTLE_OOPSIE, TOOTLE_OOPSIE_INTERNAL, "Widgetizable didn't provide a Widget!");
	_inner_error0_ = _tmp0_;
	if (_inner_error0_->domain == TOOTLE_OOPSIE) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	} else {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
}

GtkWidget*
tootle_widgetizable_to_widget (TootleWidgetizable* self,
                               GError** error)
{
	TootleWidgetizableIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = TOOTLE_WIDGETIZABLE_GET_INTERFACE (self);
	if (_iface_->to_widget) {
		return _iface_->to_widget (self, error);
	}
	return NULL;
}

static void
tootle_widgetizable_real_open (TootleWidgetizable* self)
{
	g_warning ("Widgetizable.vala:8: Widgetizable didn't provide a way to open it!");
}

void
tootle_widgetizable_open (TootleWidgetizable* self)
{
	TootleWidgetizableIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = TOOTLE_WIDGETIZABLE_GET_INTERFACE (self);
	if (_iface_->open) {
		_iface_->open (self);
	}
}

static void
tootle_widgetizable_real_resolve_open (TootleWidgetizable* self,
                                       TootleInstanceAccount* account)
{
	g_return_if_fail (account != NULL);
	tootle_widgetizable_open (self);
}

void
tootle_widgetizable_resolve_open (TootleWidgetizable* self,
                                  TootleInstanceAccount* account)
{
	TootleWidgetizableIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = TOOTLE_WIDGETIZABLE_GET_INTERFACE (self);
	if (_iface_->resolve_open) {
		_iface_->resolve_open (self, account);
	}
}

static void
tootle_widgetizable_default_init (TootleWidgetizableIface * iface,
                                  gpointer iface_data)
{
	iface->to_widget = tootle_widgetizable_real_to_widget;
	iface->open = tootle_widgetizable_real_open;
	iface->resolve_open = tootle_widgetizable_real_resolve_open;
}

static GType
tootle_widgetizable_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleWidgetizableIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_widgetizable_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType tootle_widgetizable_type_id;
	tootle_widgetizable_type_id = g_type_register_static (G_TYPE_INTERFACE, "TootleWidgetizable", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (tootle_widgetizable_type_id, G_TYPE_OBJECT);
	return tootle_widgetizable_type_id;
}

GType
tootle_widgetizable_get_type (void)
{
	static volatile gsize tootle_widgetizable_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_widgetizable_type_id__volatile)) {
		GType tootle_widgetizable_type_id;
		tootle_widgetizable_type_id = tootle_widgetizable_get_type_once ();
		g_once_init_leave (&tootle_widgetizable_type_id__volatile, tootle_widgetizable_type_id);
	}
	return tootle_widgetizable_type_id__volatile;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

