/* InstanceAccount.c generated by valac 0.52.4, the Vala compiler
 * generated from InstanceAccount.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>
#include <gee.h>
#include <gio/gio.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;
typedef struct _TootleAPIAccountPrivate TootleAPIAccountPrivate;

#define TOOTLE_TYPE_ISTREAM_LISTENER (tootle_istream_listener_get_type ())
#define TOOTLE_ISTREAM_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_ISTREAM_LISTENER, TootleIStreamListener))
#define TOOTLE_IS_ISTREAM_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_ISTREAM_LISTENER))
#define TOOTLE_ISTREAM_LISTENER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TOOTLE_TYPE_ISTREAM_LISTENER, TootleIStreamListenerIface))

typedef struct _TootleIStreamListener TootleIStreamListener;
typedef struct _TootleIStreamListenerIface TootleIStreamListenerIface;
typedef struct _TootleInstanceAccountPrivate TootleInstanceAccountPrivate;

#define TOOTLE_API_TYPE_NOTIFICATION (tootle_api_notification_get_type ())
#define TOOTLE_API_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_NOTIFICATION, TootleAPINotification))
#define TOOTLE_API_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_NOTIFICATION, TootleAPINotificationClass))
#define TOOTLE_API_IS_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_NOTIFICATION))
#define TOOTLE_API_IS_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_NOTIFICATION))
#define TOOTLE_API_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_NOTIFICATION, TootleAPINotificationClass))

typedef struct _TootleAPINotification TootleAPINotification;
typedef struct _TootleAPINotificationClass TootleAPINotificationClass;
enum  {
	TOOTLE_INSTANCE_ACCOUNT_0_PROPERTY,
	TOOTLE_INSTANCE_ACCOUNT_INSTANCE_PROPERTY,
	TOOTLE_INSTANCE_ACCOUNT_CLIENT_ID_PROPERTY,
	TOOTLE_INSTANCE_ACCOUNT_CLIENT_SECRET_PROPERTY,
	TOOTLE_INSTANCE_ACCOUNT_ACCESS_TOKEN_PROPERTY,
	TOOTLE_INSTANCE_ACCOUNT_LAST_SEEN_NOTIFICATION_PROPERTY,
	TOOTLE_INSTANCE_ACCOUNT_HAS_UNREAD_NOTIFICATIONS_PROPERTY,
	TOOTLE_INSTANCE_ACCOUNT_CACHED_NOTIFICATIONS_PROPERTY,
	TOOTLE_INSTANCE_ACCOUNT_HANDLE_PROPERTY,
	TOOTLE_INSTANCE_ACCOUNT_NUM_PROPERTIES
};
static GParamSpec* tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_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_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;

#define TOOTLE_TYPE_STREAMS (tootle_streams_get_type ())
#define TOOTLE_STREAMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_STREAMS, TootleStreams))
#define TOOTLE_STREAMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_STREAMS, TootleStreamsClass))
#define TOOTLE_IS_STREAMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_STREAMS))
#define TOOTLE_IS_STREAMS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_STREAMS))
#define TOOTLE_STREAMS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_STREAMS, TootleStreamsClass))

typedef struct _TootleStreams TootleStreams;
typedef struct _TootleStreamsClass TootleStreamsClass;

#define TOOTLE_API_TYPE_SEARCH_RESULTS (tootle_api_search_results_get_type ())
#define TOOTLE_API_SEARCH_RESULTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_SEARCH_RESULTS, TootleAPISearchResults))
#define TOOTLE_API_SEARCH_RESULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_SEARCH_RESULTS, TootleAPISearchResultsClass))
#define TOOTLE_API_IS_SEARCH_RESULTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_SEARCH_RESULTS))
#define TOOTLE_API_IS_SEARCH_RESULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_SEARCH_RESULTS))
#define TOOTLE_API_SEARCH_RESULTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_SEARCH_RESULTS, TootleAPISearchResultsClass))

typedef struct _TootleAPISearchResults TootleAPISearchResults;
typedef struct _TootleAPISearchResultsClass TootleAPISearchResultsClass;
typedef struct _TootleInstanceAccountResolveData TootleInstanceAccountResolveData;
typedef enum  {
	TOOTLE_API_NOTIFICATION_TYPE_MENTION,
	TOOTLE_API_NOTIFICATION_TYPE_REBLOG,
	TOOTLE_API_NOTIFICATION_TYPE_REBLOG_REMOTE_USER,
	TOOTLE_API_NOTIFICATION_TYPE_FAVOURITE,
	TOOTLE_API_NOTIFICATION_TYPE_FOLLOW,
	TOOTLE_API_NOTIFICATION_TYPE_FOLLOW_REQUEST,
	TOOTLE_API_NOTIFICATION_TYPE_WATCHLIST
} TootleAPINotificationType;

#define TOOTLE_API_TYPE_NOTIFICATION_TYPE (tootle_api_notification_type_get_type ())

#define TOOTLE_API_TYPE_STATUS (tootle_api_status_get_type ())
#define TOOTLE_API_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_STATUS, TootleAPIStatus))
#define TOOTLE_API_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_STATUS, TootleAPIStatusClass))
#define TOOTLE_API_IS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_STATUS))
#define TOOTLE_API_IS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_STATUS))
#define TOOTLE_API_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_STATUS, TootleAPIStatusClass))

typedef struct _TootleAPIStatus TootleAPIStatus;
typedef struct _TootleAPIStatusClass TootleAPIStatusClass;

#define TOOTLE_TYPE_APPLICATION (tootle_application_get_type ())
#define TOOTLE_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_APPLICATION, TootleApplication))
#define TOOTLE_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_APPLICATION, TootleApplicationClass))
#define TOOTLE_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_APPLICATION))
#define TOOTLE_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_APPLICATION))
#define TOOTLE_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_APPLICATION, TootleApplicationClass))

typedef struct _TootleApplication TootleApplication;
typedef struct _TootleApplicationClass TootleApplicationClass;

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 _TootleAPIAccount {
	TootleEntity parent_instance;
	TootleAPIAccountPrivate * priv;
	gchar* _display_name;
};

struct _TootleAPIAccountClass {
	TootleEntityClass parent_class;
};

struct _TootleIStreamListenerIface {
	GTypeInterface parent_iface;
};

struct _TootleInstanceAccount {
	TootleAPIAccount parent_instance;
	TootleInstanceAccountPrivate * priv;
	gchar* stream;
};

struct _TootleInstanceAccountClass {
	TootleAPIAccountClass parent_class;
};

struct _TootleInstanceAccountPrivate {
	gchar* _instance;
	gchar* _client_id;
	gchar* _client_secret;
	gchar* _access_token;
	gint64 _last_seen_notification;
	gboolean _has_unread_notifications;
	GeeArrayList* _cached_notifications;
};

struct _TootleInstanceAccountResolveData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TootleInstanceAccount* self;
	gchar* url;
	TootleEntity* result;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	TootleAPISearchResults* results;
	TootleAPISearchResults* _tmp3_;
	TootleEntity* entity;
	TootleAPISearchResults* _tmp4_;
	TootleEntity* _tmp5_;
	TootleEntity* _tmp6_;
	GObjectClass* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	GError* _inner_error0_;
};

static gint TootleInstanceAccount_private_offset;
static gpointer tootle_instance_account_parent_class = NULL;
extern TootleAccounts* tootle_accounts;
extern TootleStreams* tootle_streams;
extern TootleApplication* tootle_app;
static TootleIStreamListenerIface * tootle_instance_account_tootle_istream_listener_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_istream_listener_get_type (void) G_GNUC_CONST ;
GType tootle_api_notification_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPINotification, g_object_unref)
void tootle_instance_account_unsubscribe (TootleInstanceAccount* self);
TootleInstanceAccount* tootle_instance_account_from (JsonNode* node,
                                                     GError** error);
TootleEntity* tootle_entity_from_json (GType type,
                                       JsonNode* node,
                                       GError** error);
TootleInstanceAccount* tootle_instance_account_new (void);
TootleInstanceAccount* tootle_instance_account_construct (GType object_type);
TootleAPIAccount* tootle_api_account_new (void);
TootleAPIAccount* tootle_api_account_construct (GType object_type);
static void tootle_instance_account_show_notification (TootleInstanceAccount* self,
                                                TootleAPINotification* obj);
static void _tootle_instance_account_show_notification_tootle_istream_listener_on_notification (TootleIStreamListener* _sender,
                                                                                         TootleAPINotification* n,
                                                                                         gpointer self);
TootleInstanceAccount* tootle_instance_account_new_empty (const gchar* instance);
TootleInstanceAccount* tootle_instance_account_construct_empty (GType object_type,
                                                                const gchar* instance);
TootleInstanceAccount* tootle_instance_account_new_from_account (TootleAPIAccount* account);
TootleInstanceAccount* tootle_instance_account_construct_from_account (GType object_type,
                                                                       TootleAPIAccount* account);
const gchar* tootle_api_account_get_id (TootleAPIAccount* self);
void tootle_entity_patch (TootleEntity* self,
                          GObject* with);
gboolean tootle_instance_account_is_current (TootleInstanceAccount* self);
GType tootle_accounts_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAccounts, g_object_unref)
TootleInstanceAccount* tootle_accounts_get_active (TootleAccounts* self);
const gchar* tootle_instance_account_get_access_token (TootleInstanceAccount* self);
gchar* tootle_instance_account_get_stream_url (TootleInstanceAccount* self);
const gchar* tootle_instance_account_get_instance (TootleInstanceAccount* self);
void tootle_instance_account_subscribe (TootleInstanceAccount* self);
GType tootle_streams_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleStreams, g_object_unref)
void tootle_streams_subscribe (TootleStreams* self,
                               const gchar* url,
                               TootleIStreamListener* s,
                               gchar* * cookie);
void tootle_streams_unsubscribe (TootleStreams* self,
                                 const gchar* cookie,
                                 TootleIStreamListener* s);
static void tootle_instance_account_resolve_data_free (gpointer _data);
void tootle_instance_account_resolve (TootleInstanceAccount* self,
                                      const gchar* url,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
TootleEntity* tootle_instance_account_resolve_finish (TootleInstanceAccount* self,
                                                      GAsyncResult* _res_,
                                                      GError** error);
static gboolean tootle_instance_account_resolve_co (TootleInstanceAccountResolveData* _data_);
GType tootle_api_search_results_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPISearchResults, g_object_unref)
void tootle_api_search_results_request (const gchar* q,
                                        TootleInstanceAccount* account,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
TootleAPISearchResults* tootle_api_search_results_request_finish (GAsyncResult* _res_,
                                                                  GError** error);
static void tootle_instance_account_resolve_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
TootleEntity* tootle_api_search_results_first (TootleAPISearchResults* self,
                                               GError** error);
gchar* tootle_html_utils_remove_tags (const gchar* content);
GType tootle_api_notification_type_get_type (void) G_GNUC_CONST ;
TootleAPINotificationType tootle_api_notification_get_kind (TootleAPINotification* self);
gchar* tootle_api_notification_type_get_desc (TootleAPINotificationType self,
                                              TootleAPIAccount* account);
TootleAPIAccount* tootle_api_notification_get_account (TootleAPINotification* self);
GType tootle_api_status_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIStatus, g_object_unref)
TootleAPIStatus* tootle_api_notification_get_status (TootleAPINotification* self);
gchar* tootle_api_account_get_domain (TootleAPIAccount* self);
const gchar* tootle_api_status_get_content (TootleAPIStatus* self);
GType tootle_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleApplication, g_object_unref)
const gchar* tootle_api_notification_get_id (TootleAPINotification* self);
GeeArrayList* tootle_instance_account_get_cached_notifications (TootleInstanceAccount* self);
void tootle_accounts_save (TootleAccounts* self,
                           gboolean overwrite);
void tootle_instance_account_set_instance (TootleInstanceAccount* self,
                                           const gchar* value);
const gchar* tootle_instance_account_get_client_id (TootleInstanceAccount* self);
void tootle_instance_account_set_client_id (TootleInstanceAccount* self,
                                            const gchar* value);
const gchar* tootle_instance_account_get_client_secret (TootleInstanceAccount* self);
void tootle_instance_account_set_client_secret (TootleInstanceAccount* self,
                                                const gchar* value);
void tootle_instance_account_set_access_token (TootleInstanceAccount* self,
                                               const gchar* value);
gint64 tootle_instance_account_get_last_seen_notification (TootleInstanceAccount* self);
void tootle_instance_account_set_last_seen_notification (TootleInstanceAccount* self,
                                                         gint64 value);
gboolean tootle_instance_account_get_has_unread_notifications (TootleInstanceAccount* self);
void tootle_instance_account_set_has_unread_notifications (TootleInstanceAccount* self,
                                                           gboolean value);
void tootle_instance_account_set_cached_notifications (TootleInstanceAccount* self,
                                                       GeeArrayList* value);
gchar* tootle_instance_account_get_handle (TootleInstanceAccount* self);
const gchar* tootle_api_account_get_username (TootleAPIAccount* self);
static void tootle_instance_account_finalize (GObject * obj);
static GType tootle_instance_account_get_type_once (void);
static void _vala_tootle_instance_account_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_tootle_instance_account_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_instance_account_get_instance_private (TootleInstanceAccount* self)
{
	return G_STRUCT_MEMBER_P (self, TootleInstanceAccount_private_offset);
}

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

TootleInstanceAccount*
tootle_instance_account_from (JsonNode* node,
                              GError** error)
{
	TootleEntity* _tmp0_ = NULL;
	TootleEntity* _tmp1_;
	TootleInstanceAccount* _tmp2_;
	GError* _inner_error0_ = NULL;
	TootleInstanceAccount* result = NULL;
	g_return_val_if_fail (node != NULL, NULL);
	_tmp1_ = tootle_entity_from_json (TOOTLE_TYPE_INSTANCE_ACCOUNT, node, &_inner_error0_);
	_tmp0_ = _tmp1_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp2_ = _g_object_ref0 (TOOTLE_IS_INSTANCE_ACCOUNT (_tmp0_) ? ((TootleInstanceAccount*) _tmp0_) : NULL);
	result = _tmp2_;
	_g_object_unref0 (_tmp0_);
	return result;
}

static void
_tootle_instance_account_show_notification_tootle_istream_listener_on_notification (TootleIStreamListener* _sender,
                                                                                    TootleAPINotification* n,
                                                                                    gpointer self)
{
	tootle_instance_account_show_notification ((TootleInstanceAccount*) self, n);
}

TootleInstanceAccount*
tootle_instance_account_construct (GType object_type)
{
	TootleInstanceAccount * self = NULL;
	self = (TootleInstanceAccount*) tootle_api_account_construct (object_type);
	g_signal_connect_object ((TootleIStreamListener*) self, "on-notification", (GCallback) _tootle_instance_account_show_notification_tootle_istream_listener_on_notification, self, 0);
	return self;
}

TootleInstanceAccount*
tootle_instance_account_new (void)
{
	return tootle_instance_account_construct (TOOTLE_TYPE_INSTANCE_ACCOUNT);
}

TootleInstanceAccount*
tootle_instance_account_construct_empty (GType object_type,
                                         const gchar* instance)
{
	TootleInstanceAccount * self = NULL;
	g_return_val_if_fail (instance != NULL, NULL);
	self = (TootleInstanceAccount*) g_object_new (object_type, "id", "", "instance", instance, NULL);
	return self;
}

TootleInstanceAccount*
tootle_instance_account_new_empty (const gchar* instance)
{
	return tootle_instance_account_construct_empty (TOOTLE_TYPE_INSTANCE_ACCOUNT, instance);
}

TootleInstanceAccount*
tootle_instance_account_construct_from_account (GType object_type,
                                                TootleAPIAccount* account)
{
	TootleInstanceAccount * self = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_val_if_fail (account != NULL, NULL);
	_tmp0_ = tootle_api_account_get_id (account);
	_tmp1_ = _tmp0_;
	self = (TootleInstanceAccount*) g_object_new (object_type, "id", _tmp1_, NULL);
	tootle_entity_patch ((TootleEntity*) self, (GObject*) account);
	return self;
}

TootleInstanceAccount*
tootle_instance_account_new_from_account (TootleAPIAccount* account)
{
	return tootle_instance_account_construct_from_account (TOOTLE_TYPE_INSTANCE_ACCOUNT, account);
}

gboolean
tootle_instance_account_is_current (TootleInstanceAccount* self)
{
	TootleAccounts* _tmp0_;
	TootleInstanceAccount* _tmp1_;
	TootleInstanceAccount* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = tootle_accounts;
	_tmp1_ = tootle_accounts_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_->priv->_access_token;
	_tmp4_ = self->priv->_access_token;
	result = g_strcmp0 (_tmp3_, _tmp4_) == 0;
	return result;
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

gchar*
tootle_instance_account_get_stream_url (TootleInstanceAccount* self)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_instance;
	_tmp1_ = string_to_string (_tmp0_);
	_tmp2_ = self->priv->_access_token;
	_tmp3_ = string_to_string (_tmp2_);
	_tmp4_ = g_strconcat (_tmp1_, "/api/v1/streaming/?stream=user&access_token=", _tmp3_, NULL);
	result = _tmp4_;
	return result;
}

void
tootle_instance_account_subscribe (TootleInstanceAccount* self)
{
	TootleStreams* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = tootle_streams;
	_tmp1_ = tootle_instance_account_get_stream_url (self);
	_tmp2_ = _tmp1_;
	tootle_streams_subscribe (_tmp0_, _tmp2_, (TootleIStreamListener*) self, &_tmp3_);
	_g_free0 (self->stream);
	self->stream = _tmp3_;
	_g_free0 (_tmp2_);
}

void
tootle_instance_account_unsubscribe (TootleInstanceAccount* self)
{
	TootleStreams* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tootle_streams;
	_tmp1_ = self->stream;
	tootle_streams_unsubscribe (_tmp0_, _tmp1_, (TootleIStreamListener*) self);
}

static void
tootle_instance_account_resolve_data_free (gpointer _data)
{
	TootleInstanceAccountResolveData* _data_;
	_data_ = _data;
	_g_free0 (_data_->url);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (TootleInstanceAccountResolveData, _data_);
}

void
tootle_instance_account_resolve (TootleInstanceAccount* self,
                                 const gchar* url,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	TootleInstanceAccountResolveData* _data_;
	TootleInstanceAccount* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (url != NULL);
	_data_ = g_slice_new0 (TootleInstanceAccountResolveData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tootle_instance_account_resolve_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (url);
	_g_free0 (_data_->url);
	_data_->url = _tmp1_;
	tootle_instance_account_resolve_co (_data_);
}

TootleEntity*
tootle_instance_account_resolve_finish (TootleInstanceAccount* self,
                                        GAsyncResult* _res_,
                                        GError** error)
{
	TootleEntity* result;
	TootleInstanceAccountResolveData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
tootle_instance_account_resolve_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	TootleInstanceAccountResolveData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tootle_instance_account_resolve_co (_data_);
}

static gboolean
tootle_instance_account_resolve_co (TootleInstanceAccountResolveData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = string_to_string (_data_->url);
	_data_->_tmp1_ = g_strconcat ("Resolving URL: \"", _data_->_tmp0_, "\"...", NULL);
	_data_->_tmp2_ = _data_->_tmp1_;
	g_message ("InstanceAccount.vala:58: %s", _data_->_tmp2_);
	_g_free0 (_data_->_tmp2_);
	_data_->_state_ = 1;
	tootle_api_search_results_request (_data_->url, _data_->self, tootle_instance_account_resolve_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = tootle_api_search_results_request_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->results = _data_->_tmp3_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = _data_->results;
	_data_->_tmp5_ = tootle_api_search_results_first (_data_->_tmp4_, &_data_->_inner_error0_);
	_data_->entity = _data_->_tmp5_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->results);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp6_ = _data_->entity;
	_data_->_tmp7_ = G_OBJECT_GET_CLASS ((GObject*) _data_->_tmp6_);
	_data_->_tmp8_ = G_OBJECT_CLASS_NAME (_data_->_tmp7_);
	_data_->_tmp9_ = string_to_string (_data_->_tmp8_);
	_data_->_tmp10_ = g_strconcat ("Found ", _data_->_tmp9_, NULL);
	_data_->_tmp11_ = _data_->_tmp10_;
	g_message ("InstanceAccount.vala:61: %s", _data_->_tmp11_);
	_g_free0 (_data_->_tmp11_);
	_data_->result = _data_->entity;
	_g_object_unref0 (_data_->results);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
tootle_instance_account_show_notification (TootleInstanceAccount* self,
                                           TootleAPINotification* obj)
{
	gchar* title = NULL;
	TootleAPINotificationType _tmp0_;
	TootleAPINotificationType _tmp1_;
	TootleAPIAccount* _tmp2_;
	TootleAPIAccount* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GNotification* notification = NULL;
	const gchar* _tmp8_;
	GNotification* _tmp9_;
	TootleAPIStatus* _tmp10_;
	TootleAPIStatus* _tmp11_;
	TootleApplication* _tmp30_;
	TootleApplication* _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	GNotification* _tmp41_;
	TootleAPINotificationType _tmp42_;
	TootleAPINotificationType _tmp43_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (obj != NULL);
	_tmp0_ = tootle_api_notification_get_kind (obj);
	_tmp1_ = _tmp0_;
	_tmp2_ = tootle_api_notification_get_account (obj);
	_tmp3_ = _tmp2_;
	_tmp4_ = tootle_api_notification_type_get_desc (_tmp1_, _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = tootle_html_utils_remove_tags (_tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	title = _tmp7_;
	_tmp8_ = title;
	_tmp9_ = g_notification_new (_tmp8_);
	notification = _tmp9_;
	_tmp10_ = tootle_api_notification_get_status (obj);
	_tmp11_ = _tmp10_;
	if (_tmp11_ != NULL) {
		gchar* body = NULL;
		gchar* _tmp12_;
		const gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		const gchar* _tmp18_;
		gchar* _tmp19_;
		const gchar* _tmp20_;
		TootleAPIStatus* _tmp21_;
		TootleAPIStatus* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		gchar* _tmp27_;
		GNotification* _tmp28_;
		const gchar* _tmp29_;
		_tmp12_ = g_strdup ("");
		body = _tmp12_;
		_tmp13_ = body;
		_tmp14_ = tootle_api_account_get_domain ((TootleAPIAccount*) self);
		_tmp15_ = _tmp14_;
		_tmp16_ = _tmp15_;
		_tmp17_ = g_strconcat (_tmp13_, _tmp16_, NULL);
		_g_free0 (body);
		body = _tmp17_;
		_g_free0 (_tmp16_);
		_tmp18_ = body;
		_tmp19_ = g_strconcat (_tmp18_, "\n", NULL);
		_g_free0 (body);
		body = _tmp19_;
		_tmp20_ = body;
		_tmp21_ = tootle_api_notification_get_status (obj);
		_tmp22_ = _tmp21_;
		_tmp23_ = tootle_api_status_get_content (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = tootle_html_utils_remove_tags (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp27_ = g_strconcat (_tmp20_, _tmp26_, NULL);
		_g_free0 (body);
		body = _tmp27_;
		_g_free0 (_tmp26_);
		_tmp28_ = notification;
		_tmp29_ = body;
		g_notification_set_body (_tmp28_, _tmp29_);
		_g_free0 (body);
	}
	_tmp30_ = tootle_app;
	_tmp31_ = tootle_app;
	_tmp32_ = g_application_get_application_id ((GApplication*) _tmp31_);
	_tmp33_ = _tmp32_;
	_tmp34_ = g_strconcat (_tmp33_, ":", NULL);
	_tmp35_ = _tmp34_;
	_tmp36_ = tootle_api_notification_get_id (obj);
	_tmp37_ = _tmp36_;
	_tmp38_ = string_to_string (_tmp37_);
	_tmp39_ = g_strconcat (_tmp35_, _tmp38_, NULL);
	_tmp40_ = _tmp39_;
	_tmp41_ = notification;
	g_application_send_notification ((GApplication*) _tmp30_, _tmp40_, _tmp41_);
	_g_free0 (_tmp40_);
	_g_free0 (_tmp35_);
	_tmp42_ = tootle_api_notification_get_kind (obj);
	_tmp43_ = _tmp42_;
	if (_tmp43_ == TOOTLE_API_NOTIFICATION_TYPE_WATCHLIST) {
		GeeArrayList* _tmp44_;
		TootleAccounts* _tmp45_;
		_tmp44_ = self->priv->_cached_notifications;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp44_, obj);
		_tmp45_ = tootle_accounts;
		tootle_accounts_save (_tmp45_, TRUE);
	}
	_g_object_unref0 (notification);
	_g_free0 (title);
}

const gchar*
tootle_instance_account_get_instance (TootleInstanceAccount* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_instance;
	result = _tmp0_;
	return result;
}

void
tootle_instance_account_set_instance (TootleInstanceAccount* self,
                                      const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_instance_account_get_instance (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_instance);
		self->priv->_instance = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_INSTANCE_PROPERTY]);
	}
}

const gchar*
tootle_instance_account_get_client_id (TootleInstanceAccount* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_client_id;
	result = _tmp0_;
	return result;
}

void
tootle_instance_account_set_client_id (TootleInstanceAccount* self,
                                       const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_instance_account_get_client_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_client_id);
		self->priv->_client_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_CLIENT_ID_PROPERTY]);
	}
}

const gchar*
tootle_instance_account_get_client_secret (TootleInstanceAccount* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_client_secret;
	result = _tmp0_;
	return result;
}

void
tootle_instance_account_set_client_secret (TootleInstanceAccount* self,
                                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_instance_account_get_client_secret (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_client_secret);
		self->priv->_client_secret = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_CLIENT_SECRET_PROPERTY]);
	}
}

const gchar*
tootle_instance_account_get_access_token (TootleInstanceAccount* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_access_token;
	result = _tmp0_;
	return result;
}

void
tootle_instance_account_set_access_token (TootleInstanceAccount* self,
                                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_instance_account_get_access_token (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_access_token);
		self->priv->_access_token = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_ACCESS_TOKEN_PROPERTY]);
	}
}

gint64
tootle_instance_account_get_last_seen_notification (TootleInstanceAccount* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, 0LL);
	result = self->priv->_last_seen_notification;
	return result;
}

void
tootle_instance_account_set_last_seen_notification (TootleInstanceAccount* self,
                                                    gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_instance_account_get_last_seen_notification (self);
	if (old_value != value) {
		self->priv->_last_seen_notification = value;
		g_object_notify_by_pspec ((GObject *) self, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_LAST_SEEN_NOTIFICATION_PROPERTY]);
	}
}

gboolean
tootle_instance_account_get_has_unread_notifications (TootleInstanceAccount* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_has_unread_notifications;
	return result;
}

void
tootle_instance_account_set_has_unread_notifications (TootleInstanceAccount* self,
                                                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_instance_account_get_has_unread_notifications (self);
	if (old_value != value) {
		self->priv->_has_unread_notifications = value;
		g_object_notify_by_pspec ((GObject *) self, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_HAS_UNREAD_NOTIFICATIONS_PROPERTY]);
	}
}

GeeArrayList*
tootle_instance_account_get_cached_notifications (TootleInstanceAccount* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_cached_notifications;
	result = _tmp0_;
	return result;
}

void
tootle_instance_account_set_cached_notifications (TootleInstanceAccount* self,
                                                  GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_instance_account_get_cached_notifications (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_cached_notifications);
		self->priv->_cached_notifications = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_CACHED_NOTIFICATIONS_PROPERTY]);
	}
}

gchar*
tootle_instance_account_get_handle (TootleInstanceAccount* self)
{
	gchar* result;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = tootle_api_account_get_username ((TootleAPIAccount*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = string_to_string (_tmp1_);
	_tmp3_ = tootle_api_account_get_domain ((TootleAPIAccount*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp6_ = string_to_string (_tmp5_);
	_tmp7_ = g_strconcat ("@", _tmp2_, "@", _tmp6_, NULL);
	_tmp8_ = _tmp7_;
	_g_free0 (_tmp5_);
	result = _tmp8_;
	return result;
}

static void
tootle_instance_account_class_init (TootleInstanceAccountClass * klass,
                                    gpointer klass_data)
{
	tootle_instance_account_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TootleInstanceAccount_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tootle_instance_account_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tootle_instance_account_set_property;
	G_OBJECT_CLASS (klass)->finalize = tootle_instance_account_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_INSTANCE_ACCOUNT_INSTANCE_PROPERTY, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_INSTANCE_PROPERTY] = g_param_spec_string ("instance", "instance", "instance", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_INSTANCE_ACCOUNT_CLIENT_ID_PROPERTY, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_CLIENT_ID_PROPERTY] = g_param_spec_string ("client-id", "client-id", "client-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_INSTANCE_ACCOUNT_CLIENT_SECRET_PROPERTY, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_CLIENT_SECRET_PROPERTY] = g_param_spec_string ("client-secret", "client-secret", "client-secret", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_INSTANCE_ACCOUNT_ACCESS_TOKEN_PROPERTY, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_ACCESS_TOKEN_PROPERTY] = g_param_spec_string ("access-token", "access-token", "access-token", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_INSTANCE_ACCOUNT_LAST_SEEN_NOTIFICATION_PROPERTY, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_LAST_SEEN_NOTIFICATION_PROPERTY] = g_param_spec_int64 ("last-seen-notification", "last-seen-notification", "last-seen-notification", G_MININT64, G_MAXINT64, (gint64) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_INSTANCE_ACCOUNT_HAS_UNREAD_NOTIFICATIONS_PROPERTY, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_HAS_UNREAD_NOTIFICATIONS_PROPERTY] = g_param_spec_boolean ("has-unread-notifications", "has-unread-notifications", "has-unread-notifications", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_INSTANCE_ACCOUNT_CACHED_NOTIFICATIONS_PROPERTY, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_CACHED_NOTIFICATIONS_PROPERTY] = g_param_spec_object ("cached-notifications", "cached-notifications", "cached-notifications", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_INSTANCE_ACCOUNT_HANDLE_PROPERTY, tootle_instance_account_properties[TOOTLE_INSTANCE_ACCOUNT_HANDLE_PROPERTY] = g_param_spec_string ("handle", "handle", "handle", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
tootle_instance_account_tootle_istream_listener_interface_init (TootleIStreamListenerIface * iface,
                                                                gpointer iface_data)
{
	tootle_instance_account_tootle_istream_listener_parent_iface = g_type_interface_peek_parent (iface);
}

static void
tootle_instance_account_instance_init (TootleInstanceAccount * self,
                                       gpointer klass)
{
	GeeArrayList* _tmp0_;
	self->priv = tootle_instance_account_get_instance_private (self);
	self->priv->_last_seen_notification = (gint64) 0;
	self->priv->_has_unread_notifications = FALSE;
	_tmp0_ = gee_array_list_new (TOOTLE_API_TYPE_NOTIFICATION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->_cached_notifications = _tmp0_;
}

static void
tootle_instance_account_finalize (GObject * obj)
{
	TootleInstanceAccount * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccount);
	tootle_instance_account_unsubscribe (self);
	_g_free0 (self->priv->_instance);
	_g_free0 (self->priv->_client_id);
	_g_free0 (self->priv->_client_secret);
	_g_free0 (self->priv->_access_token);
	_g_object_unref0 (self->priv->_cached_notifications);
	_g_free0 (self->stream);
	G_OBJECT_CLASS (tootle_instance_account_parent_class)->finalize (obj);
}

static GType
tootle_instance_account_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleInstanceAccountClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_instance_account_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TootleInstanceAccount), 0, (GInstanceInitFunc) tootle_instance_account_instance_init, NULL };
	static const GInterfaceInfo tootle_istream_listener_info = { (GInterfaceInitFunc) tootle_instance_account_tootle_istream_listener_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType tootle_instance_account_type_id;
	tootle_instance_account_type_id = g_type_register_static (TOOTLE_API_TYPE_ACCOUNT, "TootleInstanceAccount", &g_define_type_info, 0);
	g_type_add_interface_static (tootle_instance_account_type_id, TOOTLE_TYPE_ISTREAM_LISTENER, &tootle_istream_listener_info);
	TootleInstanceAccount_private_offset = g_type_add_instance_private (tootle_instance_account_type_id, sizeof (TootleInstanceAccountPrivate));
	return tootle_instance_account_type_id;
}

GType
tootle_instance_account_get_type (void)
{
	static volatile gsize tootle_instance_account_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_instance_account_type_id__volatile)) {
		GType tootle_instance_account_type_id;
		tootle_instance_account_type_id = tootle_instance_account_get_type_once ();
		g_once_init_leave (&tootle_instance_account_type_id__volatile, tootle_instance_account_type_id);
	}
	return tootle_instance_account_type_id__volatile;
}

static void
_vala_tootle_instance_account_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	TootleInstanceAccount * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccount);
	switch (property_id) {
		case TOOTLE_INSTANCE_ACCOUNT_INSTANCE_PROPERTY:
		g_value_set_string (value, tootle_instance_account_get_instance (self));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_CLIENT_ID_PROPERTY:
		g_value_set_string (value, tootle_instance_account_get_client_id (self));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_CLIENT_SECRET_PROPERTY:
		g_value_set_string (value, tootle_instance_account_get_client_secret (self));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_ACCESS_TOKEN_PROPERTY:
		g_value_set_string (value, tootle_instance_account_get_access_token (self));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_LAST_SEEN_NOTIFICATION_PROPERTY:
		g_value_set_int64 (value, tootle_instance_account_get_last_seen_notification (self));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_HAS_UNREAD_NOTIFICATIONS_PROPERTY:
		g_value_set_boolean (value, tootle_instance_account_get_has_unread_notifications (self));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_CACHED_NOTIFICATIONS_PROPERTY:
		g_value_set_object (value, tootle_instance_account_get_cached_notifications (self));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_HANDLE_PROPERTY:
		g_value_take_string (value, tootle_instance_account_get_handle (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tootle_instance_account_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	TootleInstanceAccount * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccount);
	switch (property_id) {
		case TOOTLE_INSTANCE_ACCOUNT_INSTANCE_PROPERTY:
		tootle_instance_account_set_instance (self, g_value_get_string (value));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_CLIENT_ID_PROPERTY:
		tootle_instance_account_set_client_id (self, g_value_get_string (value));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_CLIENT_SECRET_PROPERTY:
		tootle_instance_account_set_client_secret (self, g_value_get_string (value));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_ACCESS_TOKEN_PROPERTY:
		tootle_instance_account_set_access_token (self, g_value_get_string (value));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_LAST_SEEN_NOTIFICATION_PROPERTY:
		tootle_instance_account_set_last_seen_notification (self, g_value_get_int64 (value));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_HAS_UNREAD_NOTIFICATIONS_PROPERTY:
		tootle_instance_account_set_has_unread_notifications (self, g_value_get_boolean (value));
		break;
		case TOOTLE_INSTANCE_ACCOUNT_CACHED_NOTIFICATIONS_PROPERTY:
		tootle_instance_account_set_cached_notifications (self, g_value_get_object (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;
}

