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

#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <json-glib/json-glib.h>
#include <stdlib.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 struct _TootleEntityPrivate TootleEntityPrivate;

#define TOOTLE_API_TYPE_LIST (tootle_api_list_get_type ())
#define TOOTLE_API_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_LIST, TootleAPIList))
#define TOOTLE_API_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_LIST, TootleAPIListClass))
#define TOOTLE_API_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_LIST))
#define TOOTLE_API_IS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_LIST))
#define TOOTLE_API_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_LIST, TootleAPIListClass))

typedef struct _TootleAPIList TootleAPIList;
typedef struct _TootleAPIListClass TootleAPIListClass;
typedef struct _TootleAPIListPrivate TootleAPIListPrivate;
enum  {
	TOOTLE_API_LIST_0_PROPERTY,
	TOOTLE_API_LIST_ID_PROPERTY,
	TOOTLE_API_LIST_TITLE_PROPERTY,
	TOOTLE_API_LIST_NUM_PROPERTIES
};
static GParamSpec* tootle_api_list_properties[TOOTLE_API_LIST_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TOOTLE_VIEWS_LISTS_TYPE_ROW (tootle_views_lists_row_get_type ())
#define TOOTLE_VIEWS_LISTS_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_VIEWS_LISTS_TYPE_ROW, TootleViewsListsRow))
#define TOOTLE_VIEWS_LISTS_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_VIEWS_LISTS_TYPE_ROW, TootleViewsListsRowClass))
#define TOOTLE_VIEWS_LISTS_IS_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_VIEWS_LISTS_TYPE_ROW))
#define TOOTLE_VIEWS_LISTS_IS_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_VIEWS_LISTS_TYPE_ROW))
#define TOOTLE_VIEWS_LISTS_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_VIEWS_LISTS_TYPE_ROW, TootleViewsListsRowClass))

typedef struct _TootleViewsListsRow TootleViewsListsRow;
typedef struct _TootleViewsListsRowClass TootleViewsListsRowClass;

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);
};

struct _TootleEntity {
	GObject parent_instance;
	TootleEntityPrivate * priv;
};

struct _TootleEntityClass {
	GObjectClass parent_class;
	gboolean (*is_local) (TootleEntity* self, TootleInstanceAccount* account);
};

struct _TootleAPIList {
	TootleEntity parent_instance;
	TootleAPIListPrivate * priv;
};

struct _TootleAPIListClass {
	TootleEntityClass parent_class;
};

struct _TootleAPIListPrivate {
	gchar* _id;
	gchar* _title;
};

static gint TootleAPIList_private_offset;
static gpointer tootle_api_list_parent_class = NULL;
static TootleWidgetizableIface * tootle_api_list_tootle_widgetizable_parent_iface = NULL;

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 ;
GType tootle_api_list_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIList, g_object_unref)
TootleAPIList* tootle_api_list_from (JsonNode* node,
                                     GError** error);
TootleEntity* tootle_entity_from_json (GType type,
                                       JsonNode* node,
                                       GError** error);
static GtkWidget* tootle_api_list_real_to_widget (TootleWidgetizable* base,
                                           GError** error);
TootleViewsListsRow* tootle_views_lists_row_new (TootleAPIList* list);
TootleViewsListsRow* tootle_views_lists_row_construct (GType object_type,
                                                       TootleAPIList* list);
GType tootle_views_lists_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleViewsListsRow, g_object_unref)
TootleAPIList* tootle_api_list_new (void);
TootleAPIList* tootle_api_list_construct (GType object_type);
TootleEntity* tootle_entity_new (void);
TootleEntity* tootle_entity_construct (GType object_type);
const gchar* tootle_api_list_get_id (TootleAPIList* self);
void tootle_api_list_set_id (TootleAPIList* self,
                             const gchar* value);
const gchar* tootle_api_list_get_title (TootleAPIList* self);
void tootle_api_list_set_title (TootleAPIList* self,
                                const gchar* value);
GtkWidget* tootle_widgetizable_to_widget (TootleWidgetizable* self,
                                          GError** error);
static void tootle_api_list_finalize (GObject * obj);
static GType tootle_api_list_get_type_once (void);
static void _vala_tootle_api_list_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static void _vala_tootle_api_list_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
tootle_api_list_get_instance_private (TootleAPIList* self)
{
	return G_STRUCT_MEMBER_P (self, TootleAPIList_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

TootleAPIList*
tootle_api_list_from (JsonNode* node,
                      GError** error)
{
	TootleEntity* _tmp0_ = NULL;
	TootleEntity* _tmp1_;
	TootleAPIList* _tmp2_;
	GError* _inner_error0_ = NULL;
	TootleAPIList* result = NULL;
	g_return_val_if_fail (node != NULL, NULL);
	_tmp1_ = tootle_entity_from_json (TOOTLE_API_TYPE_LIST, node, &_inner_error0_);
	_tmp0_ = _tmp1_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp2_ = _g_object_ref0 (TOOTLE_API_IS_LIST (_tmp0_) ? ((TootleAPIList*) _tmp0_) : NULL);
	result = _tmp2_;
	_g_object_unref0 (_tmp0_);
	return result;
}

static GtkWidget*
tootle_api_list_real_to_widget (TootleWidgetizable* base,
                                GError** error)
{
	TootleAPIList * self;
	TootleViewsListsRow* _tmp0_;
	GtkWidget* result = NULL;
	self = (TootleAPIList*) base;
	_tmp0_ = tootle_views_lists_row_new (self);
	g_object_ref_sink (_tmp0_);
	result = (GtkWidget*) _tmp0_;
	return result;
}

TootleAPIList*
tootle_api_list_construct (GType object_type)
{
	TootleAPIList * self = NULL;
	self = (TootleAPIList*) tootle_entity_construct (object_type);
	return self;
}

TootleAPIList*
tootle_api_list_new (void)
{
	return tootle_api_list_construct (TOOTLE_API_TYPE_LIST);
}

const gchar*
tootle_api_list_get_id (TootleAPIList* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_id;
	result = _tmp0_;
	return result;
}

void
tootle_api_list_set_id (TootleAPIList* self,
                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_api_list_get_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_id);
		self->priv->_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_api_list_properties[TOOTLE_API_LIST_ID_PROPERTY]);
	}
}

const gchar*
tootle_api_list_get_title (TootleAPIList* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_title;
	result = _tmp0_;
	return result;
}

void
tootle_api_list_set_title (TootleAPIList* self,
                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_api_list_get_title (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_title);
		self->priv->_title = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_api_list_properties[TOOTLE_API_LIST_TITLE_PROPERTY]);
	}
}

static void
tootle_api_list_class_init (TootleAPIListClass * klass,
                            gpointer klass_data)
{
	tootle_api_list_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TootleAPIList_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tootle_api_list_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tootle_api_list_set_property;
	G_OBJECT_CLASS (klass)->finalize = tootle_api_list_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_API_LIST_ID_PROPERTY, tootle_api_list_properties[TOOTLE_API_LIST_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_API_LIST_TITLE_PROPERTY, tootle_api_list_properties[TOOTLE_API_LIST_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
tootle_api_list_tootle_widgetizable_interface_init (TootleWidgetizableIface * iface,
                                                    gpointer iface_data)
{
	tootle_api_list_tootle_widgetizable_parent_iface = g_type_interface_peek_parent (iface);
	iface->to_widget = (GtkWidget* (*) (TootleWidgetizable*, GError**)) tootle_api_list_real_to_widget;
}

static void
tootle_api_list_instance_init (TootleAPIList * self,
                               gpointer klass)
{
	self->priv = tootle_api_list_get_instance_private (self);
}

static void
tootle_api_list_finalize (GObject * obj)
{
	TootleAPIList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_API_TYPE_LIST, TootleAPIList);
	_g_free0 (self->priv->_id);
	_g_free0 (self->priv->_title);
	G_OBJECT_CLASS (tootle_api_list_parent_class)->finalize (obj);
}

static GType
tootle_api_list_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleAPIListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_api_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TootleAPIList), 0, (GInstanceInitFunc) tootle_api_list_instance_init, NULL };
	static const GInterfaceInfo tootle_widgetizable_info = { (GInterfaceInitFunc) tootle_api_list_tootle_widgetizable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType tootle_api_list_type_id;
	tootle_api_list_type_id = g_type_register_static (TOOTLE_TYPE_ENTITY, "TootleAPIList", &g_define_type_info, 0);
	g_type_add_interface_static (tootle_api_list_type_id, TOOTLE_TYPE_WIDGETIZABLE, &tootle_widgetizable_info);
	TootleAPIList_private_offset = g_type_add_instance_private (tootle_api_list_type_id, sizeof (TootleAPIListPrivate));
	return tootle_api_list_type_id;
}

GType
tootle_api_list_get_type (void)
{
	static volatile gsize tootle_api_list_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_api_list_type_id__volatile)) {
		GType tootle_api_list_type_id;
		tootle_api_list_type_id = tootle_api_list_get_type_once ();
		g_once_init_leave (&tootle_api_list_type_id__volatile, tootle_api_list_type_id);
	}
	return tootle_api_list_type_id__volatile;
}

static void
_vala_tootle_api_list_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	TootleAPIList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_API_TYPE_LIST, TootleAPIList);
	switch (property_id) {
		case TOOTLE_API_LIST_ID_PROPERTY:
		g_value_set_string (value, tootle_api_list_get_id (self));
		break;
		case TOOTLE_API_LIST_TITLE_PROPERTY:
		g_value_set_string (value, tootle_api_list_get_title (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tootle_api_list_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	TootleAPIList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_API_TYPE_LIST, TootleAPIList);
	switch (property_id) {
		case TOOTLE_API_LIST_ID_PROPERTY:
		tootle_api_list_set_id (self, g_value_get_string (value));
		break;
		case TOOTLE_API_LIST_TITLE_PROPERTY:
		tootle_api_list_set_title (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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;
}

