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

#include <glib-object.h>
#include <gtk/gtk.h>
#include <json-glib/json-glib.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <libsoup/soup.h>
#include <adwaita.h>
#include <glib/gi18n-lib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TUBA_TYPE_WIDGETIZABLE (tuba_widgetizable_get_type ())
#define TUBA_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_WIDGETIZABLE, TubaWidgetizable))
#define TUBA_IS_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_WIDGETIZABLE))
#define TUBA_WIDGETIZABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TUBA_TYPE_WIDGETIZABLE, TubaWidgetizableIface))

typedef struct _TubaWidgetizable TubaWidgetizable;
typedef struct _TubaWidgetizableIface TubaWidgetizableIface;

#define TUBA_TYPE_ENTITY (tuba_entity_get_type ())
#define TUBA_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ENTITY, TubaEntity))
#define TUBA_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ENTITY, TubaEntityClass))
#define TUBA_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ENTITY))
#define TUBA_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ENTITY))
#define TUBA_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ENTITY, TubaEntityClass))

typedef struct _TubaEntity TubaEntity;
typedef struct _TubaEntityClass TubaEntityClass;

#define TUBA_API_TYPE_ACCOUNT (tuba_api_account_get_type ())
#define TUBA_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccount))
#define TUBA_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))
#define TUBA_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))

typedef struct _TubaAPIAccount TubaAPIAccount;
typedef struct _TubaAPIAccountClass TubaAPIAccountClass;

#define TUBA_TYPE_INSTANCE_ACCOUNT (tuba_instance_account_get_type ())
#define TUBA_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccount))
#define TUBA_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))
#define TUBA_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))

typedef struct _TubaInstanceAccount TubaInstanceAccount;
typedef struct _TubaInstanceAccountClass TubaInstanceAccountClass;
typedef struct _TubaEntityPrivate TubaEntityPrivate;

#define TUBA_API_TYPE_MENTION (tuba_api_mention_get_type ())
#define TUBA_API_MENTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_MENTION, TubaAPIMention))
#define TUBA_API_MENTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_MENTION, TubaAPIMentionClass))
#define TUBA_API_IS_MENTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_MENTION))
#define TUBA_API_IS_MENTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_MENTION))
#define TUBA_API_MENTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_MENTION, TubaAPIMentionClass))

typedef struct _TubaAPIMention TubaAPIMention;
typedef struct _TubaAPIMentionClass TubaAPIMentionClass;
typedef struct _TubaAPIMentionPrivate TubaAPIMentionPrivate;
enum  {
	TUBA_API_MENTION_0_PROPERTY,
	TUBA_API_MENTION_ID_PROPERTY,
	TUBA_API_MENTION_USERNAME_PROPERTY,
	TUBA_API_MENTION_ACCT_PROPERTY,
	TUBA_API_MENTION_URL_PROPERTY,
	TUBA_API_MENTION_HANDLE_PROPERTY,
	TUBA_API_MENTION_NUM_PROPERTIES
};
static GParamSpec* tuba_api_mention_properties[TUBA_API_MENTION_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 TUBA_TYPE_REQUEST_V2 (tuba_request_v2_get_type ())
#define TUBA_REQUEST_V2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_REQUEST_V2, TubaRequestV2))
#define TUBA_REQUEST_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_REQUEST_V2, TubaRequestV2Class))
#define TUBA_IS_REQUEST_V2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_REQUEST_V2))
#define TUBA_IS_REQUEST_V2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_REQUEST_V2))
#define TUBA_REQUEST_V2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_REQUEST_V2, TubaRequestV2Class))

typedef struct _TubaRequestV2 TubaRequestV2;
typedef struct _TubaRequestV2Class TubaRequestV2Class;
typedef enum  {
	TUBA_REQUEST_V2_METHOD_GET,
	TUBA_REQUEST_V2_METHOD_POST,
	TUBA_REQUEST_V2_METHOD_PUT,
	TUBA_REQUEST_V2_METHOD_DELETE,
	TUBA_REQUEST_V2_METHOD_PATCH
} TubaRequestV2Method;

#define TUBA_REQUEST_V2_TYPE_METHOD (tuba_request_v2_method_get_type ())

#define TUBA_TYPE_ACCOUNT_STORE (tuba_account_store_get_type ())
#define TUBA_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStore))
#define TUBA_ACCOUNT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStoreClass))
#define TUBA_IS_ACCOUNT_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ACCOUNT_STORE))
#define TUBA_IS_ACCOUNT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ACCOUNT_STORE))
#define TUBA_ACCOUNT_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ACCOUNT_STORE, TubaAccountStoreClass))

typedef struct _TubaAccountStore TubaAccountStore;
typedef struct _TubaAccountStoreClass TubaAccountStoreClass;

#define TUBA_TYPE_OOPSIE (tuba_oopsie_get_type ())

#define TUBA_TYPE_NETWORK (tuba_network_get_type ())
#define TUBA_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_NETWORK, TubaNetwork))
#define TUBA_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_NETWORK, TubaNetworkClass))
#define TUBA_IS_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_NETWORK))
#define TUBA_IS_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_NETWORK))
#define TUBA_NETWORK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_NETWORK, TubaNetworkClass))

typedef struct _TubaNetwork TubaNetwork;
typedef struct _TubaNetworkClass TubaNetworkClass;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))

#define TUBA_TYPE_APPLICATION (tuba_application_get_type ())
#define TUBA_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_APPLICATION, TubaApplication))
#define TUBA_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_APPLICATION, TubaApplicationClass))
#define TUBA_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_APPLICATION))
#define TUBA_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_APPLICATION))
#define TUBA_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_APPLICATION, TubaApplicationClass))

typedef struct _TubaApplication TubaApplication;
typedef struct _TubaApplicationClass TubaApplicationClass;

#define TUBA_DIALOGS_TYPE_MAIN_WINDOW (tuba_dialogs_main_window_get_type ())
#define TUBA_DIALOGS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindow))
#define TUBA_DIALOGS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindowClass))
#define TUBA_DIALOGS_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_DIALOGS_TYPE_MAIN_WINDOW))
#define TUBA_DIALOGS_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_DIALOGS_TYPE_MAIN_WINDOW))
#define TUBA_DIALOGS_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_DIALOGS_TYPE_MAIN_WINDOW, TubaDialogsMainWindowClass))

typedef struct _TubaDialogsMainWindow TubaDialogsMainWindow;
typedef struct _TubaDialogsMainWindowClass TubaDialogsMainWindowClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _TubaApiMentionOpenRealData TubaApiMentionOpenRealData;

struct _TubaWidgetizableIface {
	GTypeInterface parent_iface;
	GtkWidget* (*to_widget) (TubaWidgetizable* self);
	void (*open) (TubaWidgetizable* self);
	void (*resolve_open) (TubaWidgetizable* self, TubaInstanceAccount* account);
};

struct _TubaEntity {
	GObject parent_instance;
	TubaEntityPrivate * priv;
};

struct _TubaEntityClass {
	GObjectClass parent_class;
	gboolean (*is_local) (TubaEntity* self, TubaInstanceAccount* account);
	GType (*deserialize_array_type) (TubaEntity* self, const gchar* prop);
};

struct _TubaAPIMention {
	TubaEntity parent_instance;
	TubaAPIMentionPrivate * priv;
};

struct _TubaAPIMentionClass {
	TubaEntityClass parent_class;
};

struct _TubaAPIMentionPrivate {
	gchar* _id;
	gchar* _username;
	gchar* _acct;
	gchar* _url;
};

typedef enum  {
	TUBA_OOPSIE_USER,
	TUBA_OOPSIE_PARSING,
	TUBA_OOPSIE_INSTANCE,
	TUBA_OOPSIE_INTERNAL,
	TUBA_OOPSIE_HTTP_401 = 401,
	TUBA_OOPSIE_HTTP_403 = 403,
	TUBA_OOPSIE_HTTP_404 = 404,
	TUBA_OOPSIE_HTTP_410 = 410,
	TUBA_OOPSIE_HTTP_422 = 422,
	TUBA_OOPSIE_HTTP_429 = 429,
	TUBA_OOPSIE_HTTP_500 = 500,
	TUBA_OOPSIE_HTTP_503 = 503
} TubaOopsie;
#define TUBA_OOPSIE tuba_oopsie_quark ()

struct _TubaApiMentionOpenRealData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TubaAPIMention* self;
	TubaRequestV2* req;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	TubaAccountStore* _tmp4_;
	TubaInstanceAccount* _tmp5_;
	TubaInstanceAccount* _tmp6_;
	TubaInstanceAccount* _tmp7_;
	TubaRequestV2* _tmp8_;
	TubaRequestV2* _tmp9_;
	GInputStream* in_stream;
	TubaRequestV2* _tmp10_;
	GInputStream* _tmp11_;
	JsonParser* parser;
	GInputStream* _tmp12_;
	JsonParser* _tmp13_;
	JsonNode* node;
	TubaNetwork* _tmp14_;
	JsonParser* _tmp15_;
	JsonNode* _tmp16_;
	TubaAPIAccount* _tmp17_;
	JsonNode* _tmp18_;
	TubaAPIAccount* _tmp19_;
	GError* e;
	GError* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	GError* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	AdwAlertDialog* dlg;
	TubaApplication* _tmp28_;
	GError* _tmp29_;
	const gchar* _tmp30_;
	AdwAlertDialog* _tmp31_;
	AdwAlertDialog* _tmp32_;
	TubaApplication* _tmp33_;
	TubaDialogsMainWindow* _tmp34_;
	TubaDialogsMainWindow* _tmp35_;
	GError* _inner_error0_;
};

static gint TubaAPIMention_private_offset;
static gpointer tuba_api_mention_parent_class = NULL;
VALA_EXTERN TubaAccountStore* tuba_accounts;
VALA_EXTERN TubaNetwork* tuba_network;
VALA_EXTERN TubaApplication* tuba_app;
static TubaWidgetizableIface * tuba_api_mention_tuba_widgetizable_parent_iface = NULL;

VALA_EXTERN GType tuba_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaEntity, g_object_unref)
VALA_EXTERN GType tuba_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAccount, g_object_unref)
VALA_EXTERN GType tuba_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaInstanceAccount, g_object_unref)
VALA_EXTERN GType tuba_widgetizable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetizable, g_object_unref)
VALA_EXTERN GType tuba_api_mention_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIMention, g_object_unref)
VALA_EXTERN TubaAPIMention* tuba_api_mention_new_from_account (TubaAPIAccount* account);
VALA_EXTERN TubaAPIMention* tuba_api_mention_construct_from_account (GType object_type,
                                                         TubaAPIAccount* account);
VALA_EXTERN const gchar* tuba_api_account_get_id (TubaAPIAccount* self);
VALA_EXTERN const gchar* tuba_api_account_get_username (TubaAPIAccount* self);
VALA_EXTERN const gchar* tuba_api_account_get_acct (TubaAPIAccount* self);
VALA_EXTERN const gchar* tuba_api_account_get_url (TubaAPIAccount* self);
static void tuba_api_mention_real_open (TubaWidgetizable* base);
static void tuba_api_mention_open_real (TubaAPIMention* self,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_);
static void tuba_api_mention_open_real_finish (TubaAPIMention* self,
                                        GAsyncResult* _res_);
static void tuba_api_mention_open_real_data_free (gpointer _data);
static gboolean tuba_api_mention_open_real_co (TubaApiMentionOpenRealData* _data_);
VALA_EXTERN GType tuba_request_v2_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaRequestV2, g_object_unref)
VALA_EXTERN const gchar* tuba_api_mention_get_id (TubaAPIMention* self);
VALA_EXTERN GType tuba_request_v2_method_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType tuba_account_store_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAccountStore, g_object_unref)
VALA_EXTERN TubaInstanceAccount* tuba_account_store_get_active (TubaAccountStore* self);
VALA_EXTERN TubaRequestV2* tuba_request_v2_new (const gchar* url,
                                    TubaRequestV2Method method);
VALA_EXTERN TubaRequestV2* tuba_request_v2_construct (GType object_type,
                                          const gchar* url,
                                          TubaRequestV2Method method);
VALA_EXTERN void tuba_request_v2_set_account (TubaRequestV2* self,
                                  TubaInstanceAccount* value);
VALA_EXTERN void tuba_request_v2_exec (TubaRequestV2* self,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_);
VALA_EXTERN GQuark tuba_oopsie_quark (void);
VALA_EXTERN GType tuba_oopsie_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GInputStream* tuba_request_v2_exec_finish (TubaRequestV2* self,
                                           GAsyncResult* _res_,
                                           SoupMessageHeaders** response_headers,
                                           GError** error);
static void tuba_api_mention_open_real_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_);
VALA_EXTERN void tuba_network_get_parser_from_inputstream_async (GInputStream* in_stream,
                                                     GCancellable* cancellable,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_);
VALA_EXTERN JsonParser* tuba_network_get_parser_from_inputstream_finish (GAsyncResult* _res_,
                                                             GError** error);
VALA_EXTERN GType tuba_network_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaNetwork, g_object_unref)
VALA_EXTERN JsonNode* tuba_network_parse_node (TubaNetwork* self,
                                   JsonParser* parser);
VALA_EXTERN TubaAPIAccount* tuba_api_account_from (JsonNode* node,
                                       GError** error);
static void _vala_JsonNode_free (JsonNode* self);
VALA_EXTERN void tuba_widgetizable_open (TubaWidgetizable* self);
VALA_EXTERN GType tuba_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaApplication, g_object_unref)
VALA_EXTERN AdwAlertDialog* tuba_application_inform (TubaApplication* self,
                                         const gchar* text,
                                         const gchar* msg);
VALA_EXTERN GType tuba_dialogs_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaDialogsMainWindow, g_object_unref)
VALA_EXTERN TubaDialogsMainWindow* tuba_application_get_main_window (TubaApplication* self);
VALA_EXTERN TubaAPIMention* tuba_api_mention_new (void);
VALA_EXTERN TubaAPIMention* tuba_api_mention_construct (GType object_type);
VALA_EXTERN TubaEntity* tuba_entity_new (void);
VALA_EXTERN TubaEntity* tuba_entity_construct (GType object_type);
VALA_EXTERN void tuba_api_mention_set_id (TubaAPIMention* self,
                              const gchar* value);
VALA_EXTERN const gchar* tuba_api_mention_get_username (TubaAPIMention* self);
VALA_EXTERN void tuba_api_mention_set_username (TubaAPIMention* self,
                                    const gchar* value);
VALA_EXTERN const gchar* tuba_api_mention_get_acct (TubaAPIMention* self);
VALA_EXTERN void tuba_api_mention_set_acct (TubaAPIMention* self,
                                const gchar* value);
VALA_EXTERN const gchar* tuba_api_mention_get_url (TubaAPIMention* self);
VALA_EXTERN void tuba_api_mention_set_url (TubaAPIMention* self,
                               const gchar* value);
VALA_EXTERN gchar* tuba_api_mention_get_handle (TubaAPIMention* self);
static void tuba_api_mention_finalize (GObject * obj);
static GType tuba_api_mention_get_type_once (void);
static void _vala_tuba_api_mention_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec);
static void _vala_tuba_api_mention_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec);

static inline gpointer
tuba_api_mention_get_instance_private (TubaAPIMention* self)
{
	return G_STRUCT_MEMBER_P (self, TubaAPIMention_private_offset);
}

TubaAPIMention*
tuba_api_mention_construct_from_account (GType object_type,
                                         TubaAPIAccount* account)
{
	TubaAPIMention * self = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	g_return_val_if_fail (account != NULL, NULL);
	_tmp0_ = tuba_api_account_get_id (account);
	_tmp1_ = _tmp0_;
	_tmp2_ = tuba_api_account_get_username (account);
	_tmp3_ = _tmp2_;
	_tmp4_ = tuba_api_account_get_acct (account);
	_tmp5_ = _tmp4_;
	_tmp6_ = tuba_api_account_get_url (account);
	_tmp7_ = _tmp6_;
	self = (TubaAPIMention*) g_object_new (object_type, "id", _tmp1_, "username", _tmp3_, "acct", _tmp5_, "url", _tmp7_, NULL);
	return self;
}

TubaAPIMention*
tuba_api_mention_new_from_account (TubaAPIAccount* account)
{
	return tuba_api_mention_construct_from_account (TUBA_API_TYPE_MENTION, account);
}

static void
tuba_api_mention_real_open (TubaWidgetizable* base)
{
	TubaAPIMention * self;
	self = (TubaAPIMention*) base;
	tuba_api_mention_open_real (self, NULL, NULL);
}

static void
tuba_api_mention_open_real_data_free (gpointer _data)
{
	TubaApiMentionOpenRealData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (TubaApiMentionOpenRealData, _data_);
}

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

static void
tuba_api_mention_open_real (TubaAPIMention* self,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_)
{
	TubaApiMentionOpenRealData* _data_;
	TubaAPIMention* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TubaApiMentionOpenRealData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_api_mention_open_real_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tuba_api_mention_open_real_co (_data_);
}

static void
tuba_api_mention_open_real_finish (TubaAPIMention* self,
                                   GAsyncResult* _res_)
{
	TubaApiMentionOpenRealData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

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

static void
tuba_api_mention_open_real_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_)
{
	TubaApiMentionOpenRealData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_api_mention_open_real_co (_data_);
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

static gboolean
tuba_api_mention_open_real_co (TubaApiMentionOpenRealData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->_id;
	_data_->_tmp1_ = string_to_string (_data_->_tmp0_);
	_data_->_tmp2_ = g_strconcat ("/api/v1/accounts/", _data_->_tmp1_, NULL);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = tuba_accounts;
	_data_->_tmp5_ = tuba_account_store_get_active (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = _g_object_ref0 (_data_->_tmp6_);
	_data_->_tmp8_ = NULL;
	_data_->_tmp8_ = tuba_request_v2_new (_data_->_tmp3_, TUBA_REQUEST_V2_METHOD_GET);
	tuba_request_v2_set_account (_data_->_tmp8_, _data_->_tmp7_);
	_g_object_unref0 (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_free0 (_data_->_tmp3_);
	_data_->req = _data_->_tmp9_;
	{
		_data_->_tmp10_ = _data_->req;
		_data_->_state_ = 1;
		tuba_request_v2_exec (_data_->_tmp10_, tuba_api_mention_open_real_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp11_ = tuba_request_v2_exec_finish (_data_->_tmp10_, _data_->_res_, NULL, &_data_->_inner_error0_);
		_data_->in_stream = _data_->_tmp11_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			if (g_error_matches (_data_->_inner_error0_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
				goto __catch0_g_io_error_cancelled;
			}
			goto __catch0_g_error;
		}
		_data_->_tmp12_ = _data_->in_stream;
		_data_->_state_ = 2;
		tuba_network_get_parser_from_inputstream_async (_data_->_tmp12_, NULL, tuba_api_mention_open_real_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp13_ = tuba_network_get_parser_from_inputstream_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->parser = _data_->_tmp13_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->in_stream);
			if (g_error_matches (_data_->_inner_error0_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
				goto __catch0_g_io_error_cancelled;
			}
			goto __catch0_g_error;
		}
		_data_->_tmp14_ = tuba_network;
		_data_->_tmp15_ = _data_->parser;
		_data_->_tmp16_ = tuba_network_parse_node (_data_->_tmp14_, _data_->_tmp15_);
		_data_->node = _data_->_tmp16_;
		_data_->_tmp18_ = _data_->node;
		_data_->_tmp19_ = tuba_api_account_from (_data_->_tmp18_, &_data_->_inner_error0_);
		_data_->_tmp17_ = _data_->_tmp19_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			__vala_JsonNode_free0 (_data_->node);
			_g_object_unref0 (_data_->parser);
			_g_object_unref0 (_data_->in_stream);
			if (g_error_matches (_data_->_inner_error0_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
				goto __catch0_g_io_error_cancelled;
			}
			goto __catch0_g_error;
		}
		tuba_widgetizable_open ((TubaWidgetizable*) _data_->_tmp17_);
		_g_object_unref0 (_data_->_tmp17_);
		__vala_JsonNode_free0 (_data_->node);
		_g_object_unref0 (_data_->parser);
		_g_object_unref0 (_data_->in_stream);
	}
	goto __finally0;
	__catch0_g_io_error_cancelled:
	{
		g_clear_error (&_data_->_inner_error0_);
		g_debug ("Mention.vala:36: Message is cancelled.");
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp20_ = _data_->e;
		_data_->_tmp21_ = g_strdup_printf ("%i", _data_->_tmp20_->code);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_tmp23_ = _data_->e;
		_data_->_tmp24_ = _data_->_tmp23_->message;
		_data_->_tmp25_ = string_to_string (_data_->_tmp24_);
		_data_->_tmp26_ = g_strconcat ("Error while opening mention: ", _data_->_tmp22_, " ", _data_->_tmp25_, NULL);
		_data_->_tmp27_ = _data_->_tmp26_;
		g_warning ("Mention.vala:38: %s", _data_->_tmp27_);
		_g_free0 (_data_->_tmp27_);
		_g_free0 (_data_->_tmp22_);
		_data_->_tmp28_ = tuba_app;
		_data_->_tmp29_ = _data_->e;
		_data_->_tmp30_ = _data_->_tmp29_->message;
		_data_->_tmp31_ = tuba_application_inform (_data_->_tmp28_, _ ("Error"), _data_->_tmp30_);
		_data_->dlg = _data_->_tmp31_;
		_data_->_tmp32_ = _data_->dlg;
		_data_->_tmp33_ = tuba_app;
		_data_->_tmp34_ = tuba_application_get_main_window (_data_->_tmp33_);
		_data_->_tmp35_ = _data_->_tmp34_;
		adw_dialog_present ((AdwDialog*) _data_->_tmp32_, (GtkWidget*) _data_->_tmp35_);
		_g_object_unref0 (_data_->dlg);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->req);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->req);
	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;
}

TubaAPIMention*
tuba_api_mention_construct (GType object_type)
{
	TubaAPIMention * self = NULL;
	self = (TubaAPIMention*) tuba_entity_construct (object_type);
	return self;
}

TubaAPIMention*
tuba_api_mention_new (void)
{
	return tuba_api_mention_construct (TUBA_API_TYPE_MENTION);
}

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

void
tuba_api_mention_set_id (TubaAPIMention* self,
                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_api_mention_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, tuba_api_mention_properties[TUBA_API_MENTION_ID_PROPERTY]);
	}
}

const gchar*
tuba_api_mention_get_username (TubaAPIMention* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_username;
	result = _tmp0_;
	return result;
}

void
tuba_api_mention_set_username (TubaAPIMention* self,
                               const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_api_mention_get_username (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_username);
		self->priv->_username = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_api_mention_properties[TUBA_API_MENTION_USERNAME_PROPERTY]);
	}
}

const gchar*
tuba_api_mention_get_acct (TubaAPIMention* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_acct;
	result = _tmp0_;
	return result;
}

void
tuba_api_mention_set_acct (TubaAPIMention* self,
                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_api_mention_get_acct (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_acct);
		self->priv->_acct = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_api_mention_properties[TUBA_API_MENTION_ACCT_PROPERTY]);
	}
}

const gchar*
tuba_api_mention_get_url (TubaAPIMention* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_url;
	result = _tmp0_;
	return result;
}

void
tuba_api_mention_set_url (TubaAPIMention* self,
                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_api_mention_get_url (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_url);
		self->priv->_url = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_api_mention_properties[TUBA_API_MENTION_URL_PROPERTY]);
	}
}

gchar*
tuba_api_mention_get_handle (TubaAPIMention* self)
{
	gchar* result;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_acct;
	_tmp1_ = g_strconcat ("@", _tmp0_, NULL);
	result = _tmp1_;
	return result;
}

static void
tuba_api_mention_class_init (TubaAPIMentionClass * klass,
                             gpointer klass_data)
{
	tuba_api_mention_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaAPIMention_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_api_mention_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_api_mention_set_property;
	G_OBJECT_CLASS (klass)->finalize = tuba_api_mention_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_MENTION_ID_PROPERTY, tuba_api_mention_properties[TUBA_API_MENTION_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_MENTION_USERNAME_PROPERTY, tuba_api_mention_properties[TUBA_API_MENTION_USERNAME_PROPERTY] = g_param_spec_string ("username", "username", "username", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_MENTION_ACCT_PROPERTY, tuba_api_mention_properties[TUBA_API_MENTION_ACCT_PROPERTY] = g_param_spec_string ("acct", "acct", "acct", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_MENTION_URL_PROPERTY, tuba_api_mention_properties[TUBA_API_MENTION_URL_PROPERTY] = g_param_spec_string ("url", "url", "url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_MENTION_HANDLE_PROPERTY, tuba_api_mention_properties[TUBA_API_MENTION_HANDLE_PROPERTY] = g_param_spec_string ("handle", "handle", "handle", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
tuba_api_mention_tuba_widgetizable_interface_init (TubaWidgetizableIface * iface,
                                                   gpointer iface_data)
{
	tuba_api_mention_tuba_widgetizable_parent_iface = g_type_interface_peek_parent (iface);
	iface->open = (void (*) (TubaWidgetizable*)) tuba_api_mention_real_open;
}

static void
tuba_api_mention_instance_init (TubaAPIMention * self,
                                gpointer klass)
{
	self->priv = tuba_api_mention_get_instance_private (self);
}

static void
tuba_api_mention_finalize (GObject * obj)
{
	TubaAPIMention * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_API_TYPE_MENTION, TubaAPIMention);
	_g_free0 (self->priv->_id);
	_g_free0 (self->priv->_username);
	_g_free0 (self->priv->_acct);
	_g_free0 (self->priv->_url);
	G_OBJECT_CLASS (tuba_api_mention_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_api_mention_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaAPIMentionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_api_mention_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaAPIMention), 0, (GInstanceInitFunc) tuba_api_mention_instance_init, NULL };
	static const GInterfaceInfo tuba_widgetizable_info = { (GInterfaceInitFunc) tuba_api_mention_tuba_widgetizable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType tuba_api_mention_type_id;
	tuba_api_mention_type_id = g_type_register_static (TUBA_TYPE_ENTITY, "TubaAPIMention", &g_define_type_info, G_TYPE_FLAG_NONE);
	g_type_add_interface_static (tuba_api_mention_type_id, TUBA_TYPE_WIDGETIZABLE, &tuba_widgetizable_info);
	TubaAPIMention_private_offset = g_type_add_instance_private (tuba_api_mention_type_id, sizeof (TubaAPIMentionPrivate));
	return tuba_api_mention_type_id;
}

GType
tuba_api_mention_get_type (void)
{
	static GType tuba_api_mention_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_api_mention_type_id__once)) {
		GType tuba_api_mention_type_id;
		tuba_api_mention_type_id = tuba_api_mention_get_type_once ();
		g_once_init_leave_pointer (&tuba_api_mention_type_id__once, tuba_api_mention_type_id);
	}
	return tuba_api_mention_type_id__once;
}

static void
_vala_tuba_api_mention_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec)
{
	TubaAPIMention * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_API_TYPE_MENTION, TubaAPIMention);
	switch (property_id) {
		case TUBA_API_MENTION_ID_PROPERTY:
		g_value_set_string (value, tuba_api_mention_get_id (self));
		break;
		case TUBA_API_MENTION_USERNAME_PROPERTY:
		g_value_set_string (value, tuba_api_mention_get_username (self));
		break;
		case TUBA_API_MENTION_ACCT_PROPERTY:
		g_value_set_string (value, tuba_api_mention_get_acct (self));
		break;
		case TUBA_API_MENTION_URL_PROPERTY:
		g_value_set_string (value, tuba_api_mention_get_url (self));
		break;
		case TUBA_API_MENTION_HANDLE_PROPERTY:
		g_value_take_string (value, tuba_api_mention_get_handle (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_api_mention_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec)
{
	TubaAPIMention * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_API_TYPE_MENTION, TubaAPIMention);
	switch (property_id) {
		case TUBA_API_MENTION_ID_PROPERTY:
		tuba_api_mention_set_id (self, g_value_get_string (value));
		break;
		case TUBA_API_MENTION_USERNAME_PROPERTY:
		tuba_api_mention_set_username (self, g_value_get_string (value));
		break;
		case TUBA_API_MENTION_ACCT_PROPERTY:
		tuba_api_mention_set_acct (self, g_value_get_string (value));
		break;
		case TUBA_API_MENTION_URL_PROPERTY:
		tuba_api_mention_set_url (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

