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

#include <glib-object.h>
#include <gee.h>
#include <glib.h>
#include <string.h>

#define TOOTLE_TYPE_IACCOUNT_LISTENER (tootle_iaccount_listener_get_type ())
#define TOOTLE_IACCOUNT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_IACCOUNT_LISTENER, TootleIAccountListener))
#define TOOTLE_IS_IACCOUNT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_IACCOUNT_LISTENER))
#define TOOTLE_IACCOUNT_LISTENER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TOOTLE_TYPE_IACCOUNT_LISTENER, TootleIAccountListenerIface))

typedef struct _TootleIAccountListener TootleIAccountListener;
typedef struct _TootleIAccountListenerIface TootleIAccountListenerIface;

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

#define TOOTLE_TYPE_ACCOUNTS (tootle_accounts_get_type ())
#define TOOTLE_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_ACCOUNTS, TootleAccounts))
#define TOOTLE_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_ACCOUNTS, TootleAccountsClass))
#define TOOTLE_IS_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_ACCOUNTS))
#define TOOTLE_IS_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_ACCOUNTS))
#define TOOTLE_ACCOUNTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_ACCOUNTS, TootleAccountsClass))

typedef struct _TootleAccounts TootleAccounts;
typedef struct _TootleAccountsClass TootleAccountsClass;

struct _TootleIAccountListenerIface {
	GTypeInterface parent_iface;
	void (*on_account_changed) (TootleIAccountListener* self, TootleInstanceAccount* account);
	void (*on_accounts_changed) (TootleIAccountListener* self, GeeArrayList* accounts);
};

extern TootleAccounts* tootle_accounts;

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_iaccount_listener_get_type (void) G_GNUC_CONST ;
void tootle_iaccount_listener_account_listener_init (TootleIAccountListener* self);
GType tootle_accounts_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAccounts, g_object_unref)
static void _tootle_iaccount_listener_on_active_acc_update (TootleIAccountListener* self,
                                                     GParamSpec* s);
static void __tootle_iaccount_listener_on_active_acc_update_g_object_notify (GObject* _sender,
                                                                      GParamSpec* pspec,
                                                                      gpointer self);
GeeArrayList* tootle_accounts_get_saved (TootleAccounts* self);
static void _tootle_iaccount_listener_on_saved_accs_update (TootleIAccountListener* self,
                                                     GParamSpec* s);
static void __tootle_iaccount_listener_on_saved_accs_update_g_object_notify (GObject* _sender,
                                                                      GParamSpec* pspec,
                                                                      gpointer self);
void tootle_iaccount_listener_on_account_changed (TootleIAccountListener* self,
                                                  TootleInstanceAccount* account);
TootleInstanceAccount* tootle_accounts_get_active (TootleAccounts* self);
void tootle_iaccount_listener_account_listener_free (TootleIAccountListener* self);
void tootle_iaccount_listener_on_accounts_changed (TootleIAccountListener* self,
                                                   GeeArrayList* accounts);
static void tootle_iaccount_listener_real_on_account_changed (TootleIAccountListener* self,
                                                       TootleInstanceAccount* account);
static void tootle_iaccount_listener_real_on_accounts_changed (TootleIAccountListener* self,
                                                        GeeArrayList* accounts);
static GType tootle_iaccount_listener_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static void
__tootle_iaccount_listener_on_active_acc_update_g_object_notify (GObject* _sender,
                                                                 GParamSpec* pspec,
                                                                 gpointer self)
{
	_tootle_iaccount_listener_on_active_acc_update ((TootleIAccountListener*) self, pspec);
}

static void
__tootle_iaccount_listener_on_saved_accs_update_g_object_notify (GObject* _sender,
                                                                 GParamSpec* pspec,
                                                                 gpointer self)
{
	_tootle_iaccount_listener_on_saved_accs_update ((TootleIAccountListener*) self, pspec);
}

void
tootle_iaccount_listener_account_listener_init (TootleIAccountListener* self)
{
	TootleAccounts* _tmp0_;
	TootleAccounts* _tmp1_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _tmp3_;
	TootleAccounts* _tmp4_;
	TootleInstanceAccount* _tmp5_;
	TootleInstanceAccount* _tmp6_;
	_tmp0_ = tootle_accounts;
	g_signal_connect_object ((GObject*) _tmp0_, "notify::active", (GCallback) __tootle_iaccount_listener_on_active_acc_update_g_object_notify, self, 0);
	_tmp1_ = tootle_accounts;
	_tmp2_ = tootle_accounts_get_saved (_tmp1_);
	_tmp3_ = _tmp2_;
	g_signal_connect_object ((GObject*) _tmp3_, "notify::size", (GCallback) __tootle_iaccount_listener_on_saved_accs_update_g_object_notify, self, 0);
	_tmp4_ = tootle_accounts;
	_tmp5_ = tootle_accounts_get_active (_tmp4_);
	_tmp6_ = _tmp5_;
	tootle_iaccount_listener_on_account_changed (self, _tmp6_);
}

void
tootle_iaccount_listener_account_listener_free (TootleIAccountListener* self)
{
	TootleAccounts* _tmp0_;
	guint _tmp1_;
	GQuark _tmp2_;
	TootleAccounts* _tmp3_;
	GeeArrayList* _tmp4_;
	GeeArrayList* _tmp5_;
	guint _tmp6_;
	GQuark _tmp7_;
	_tmp0_ = tootle_accounts;
	g_signal_parse_name ("notify::active", G_TYPE_OBJECT, &_tmp1_, &_tmp2_, TRUE);
	g_signal_handlers_disconnect_matched ((GObject*) _tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, _tmp2_, NULL, (GCallback) __tootle_iaccount_listener_on_active_acc_update_g_object_notify, self);
	_tmp3_ = tootle_accounts;
	_tmp4_ = tootle_accounts_get_saved (_tmp3_);
	_tmp5_ = _tmp4_;
	g_signal_parse_name ("notify::size", G_TYPE_OBJECT, &_tmp6_, &_tmp7_, TRUE);
	g_signal_handlers_disconnect_matched ((GObject*) _tmp5_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, _tmp7_, NULL, (GCallback) __tootle_iaccount_listener_on_saved_accs_update_g_object_notify, self);
}

static void
_tootle_iaccount_listener_on_active_acc_update (TootleIAccountListener* self,
                                                GParamSpec* s)
{
	TootleAccounts* _tmp0_;
	TootleInstanceAccount* _tmp1_;
	TootleInstanceAccount* _tmp2_;
	g_return_if_fail (s != NULL);
	_tmp0_ = tootle_accounts;
	_tmp1_ = tootle_accounts_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	tootle_iaccount_listener_on_account_changed (self, _tmp2_);
}

static void
_tootle_iaccount_listener_on_saved_accs_update (TootleIAccountListener* self,
                                                GParamSpec* s)
{
	TootleAccounts* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_;
	g_return_if_fail (s != NULL);
	_tmp0_ = tootle_accounts;
	_tmp1_ = tootle_accounts_get_saved (_tmp0_);
	_tmp2_ = _tmp1_;
	tootle_iaccount_listener_on_accounts_changed (self, _tmp2_);
}

static void
tootle_iaccount_listener_real_on_account_changed (TootleIAccountListener* self,
                                                  TootleInstanceAccount* account)
{
}

void
tootle_iaccount_listener_on_account_changed (TootleIAccountListener* self,
                                             TootleInstanceAccount* account)
{
	TootleIAccountListenerIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = TOOTLE_IACCOUNT_LISTENER_GET_INTERFACE (self);
	if (_iface_->on_account_changed) {
		_iface_->on_account_changed (self, account);
	}
}

static void
tootle_iaccount_listener_real_on_accounts_changed (TootleIAccountListener* self,
                                                   GeeArrayList* accounts)
{
	g_return_if_fail (accounts != NULL);
}

void
tootle_iaccount_listener_on_accounts_changed (TootleIAccountListener* self,
                                              GeeArrayList* accounts)
{
	TootleIAccountListenerIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = TOOTLE_IACCOUNT_LISTENER_GET_INTERFACE (self);
	if (_iface_->on_accounts_changed) {
		_iface_->on_accounts_changed (self, accounts);
	}
}

static void
tootle_iaccount_listener_default_init (TootleIAccountListenerIface * iface,
                                       gpointer iface_data)
{
	iface->on_account_changed = tootle_iaccount_listener_real_on_account_changed;
	iface->on_accounts_changed = tootle_iaccount_listener_real_on_accounts_changed;
}

static GType
tootle_iaccount_listener_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleIAccountListenerIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_iaccount_listener_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType tootle_iaccount_listener_type_id;
	tootle_iaccount_listener_type_id = g_type_register_static (G_TYPE_INTERFACE, "TootleIAccountListener", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (tootle_iaccount_listener_type_id, G_TYPE_OBJECT);
	return tootle_iaccount_listener_type_id;
}

GType
tootle_iaccount_listener_get_type (void)
{
	static volatile gsize tootle_iaccount_listener_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_iaccount_listener_type_id__volatile)) {
		GType tootle_iaccount_listener_type_id;
		tootle_iaccount_listener_type_id = tootle_iaccount_listener_get_type_once ();
		g_once_init_leave (&tootle_iaccount_listener_type_id__volatile, tootle_iaccount_listener_type_id);
	}
	return tootle_iaccount_listener_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;
}

