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

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

#define TOOTLE_DIALOGS_TYPE_NEW_ACCOUNT (tootle_dialogs_new_account_get_type ())
#define TOOTLE_DIALOGS_NEW_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_DIALOGS_TYPE_NEW_ACCOUNT, TootleDialogsNewAccount))
#define TOOTLE_DIALOGS_NEW_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_DIALOGS_TYPE_NEW_ACCOUNT, TootleDialogsNewAccountClass))
#define TOOTLE_DIALOGS_IS_NEW_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_DIALOGS_TYPE_NEW_ACCOUNT))
#define TOOTLE_DIALOGS_IS_NEW_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_DIALOGS_TYPE_NEW_ACCOUNT))
#define TOOTLE_DIALOGS_NEW_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_DIALOGS_TYPE_NEW_ACCOUNT, TootleDialogsNewAccountClass))

typedef struct _TootleDialogsNewAccount TootleDialogsNewAccount;
typedef struct _TootleDialogsNewAccountClass TootleDialogsNewAccountClass;
typedef struct _TootleDialogsNewAccountPrivate TootleDialogsNewAccountPrivate;

#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;
enum  {
	TOOTLE_DIALOGS_NEW_ACCOUNT_0_PROPERTY,
	TOOTLE_DIALOGS_NEW_ACCOUNT_IS_WORKING_PROPERTY,
	TOOTLE_DIALOGS_NEW_ACCOUNT_REDIRECT_URI_PROPERTY,
	TOOTLE_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY,
	TOOTLE_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY,
	TOOTLE_DIALOGS_NEW_ACCOUNT_NUM_PROPERTIES
};
static GParamSpec* tootle_dialogs_new_account_properties[TOOTLE_DIALOGS_NEW_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_DIALOGS_TYPE_MAIN_WINDOW (tootle_dialogs_main_window_get_type ())
#define TOOTLE_DIALOGS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_DIALOGS_TYPE_MAIN_WINDOW, TootleDialogsMainWindow))
#define TOOTLE_DIALOGS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_DIALOGS_TYPE_MAIN_WINDOW, TootleDialogsMainWindowClass))
#define TOOTLE_DIALOGS_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_DIALOGS_TYPE_MAIN_WINDOW))
#define TOOTLE_DIALOGS_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_DIALOGS_TYPE_MAIN_WINDOW))
#define TOOTLE_DIALOGS_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_DIALOGS_TYPE_MAIN_WINDOW, TootleDialogsMainWindowClass))

typedef struct _TootleDialogsMainWindow TootleDialogsMainWindow;
typedef struct _TootleDialogsMainWindowClass TootleDialogsMainWindowClass;

#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 struct _TootleApplicationPrivate TootleApplicationPrivate;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (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;
typedef struct _TootleDialogsNewAccountStepData TootleDialogsNewAccountStepData;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

#define TOOTLE_TYPE_REQUEST (tootle_request_get_type ())
#define TOOTLE_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_REQUEST, TootleRequest))
#define TOOTLE_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_REQUEST, TootleRequestClass))
#define TOOTLE_IS_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_REQUEST))
#define TOOTLE_IS_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_REQUEST))
#define TOOTLE_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_REQUEST, TootleRequestClass))

typedef struct _TootleRequest TootleRequest;
typedef struct _TootleRequestClass TootleRequestClass;

#define TOOTLE_TYPE_NETWORK (tootle_network_get_type ())
#define TOOTLE_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_NETWORK, TootleNetwork))
#define TOOTLE_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_NETWORK, TootleNetworkClass))
#define TOOTLE_IS_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_NETWORK))
#define TOOTLE_IS_NETWORK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_NETWORK))
#define TOOTLE_NETWORK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_NETWORK, TootleNetworkClass))

typedef struct _TootleNetwork TootleNetwork;
typedef struct _TootleNetworkClass TootleNetworkClass;
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
typedef struct _TootleDialogsNewAccountRegisterClientData TootleDialogsNewAccountRegisterClientData;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
typedef struct _TootleDialogsNewAccountRequestTokenData TootleDialogsNewAccountRequestTokenData;
#define __vala_SoupURI_free0(var) ((var == NULL) ? NULL : (var = (_vala_SoupURI_free (var), NULL)))

struct _TootleDialogsNewAccount {
	HdyWindow parent_instance;
	TootleDialogsNewAccountPrivate * priv;
};

struct _TootleDialogsNewAccountClass {
	HdyWindowClass parent_class;
};

struct _TootleDialogsNewAccountPrivate {
	gboolean _is_working;
	gchar* _redirect_uri;
	gboolean _use_auto_auth;
	TootleInstanceAccount* _account;
	GtkButton* back_button;
	GtkButton* next_button;
	GtkStack* stack;
	GtkBox* instance_step;
	GtkBox* code_step;
	GtkBox* done_step;
	GtkEntry* instance_entry;
	GtkEntry* code_entry;
	GtkLabel* code_label;
	GtkLabel* hello_label;
};

struct _TootleApplication {
	GtkApplication parent_instance;
	TootleApplicationPrivate * priv;
	GtkCssProvider* css_provider;
	GtkCssProvider* zoom_css_provider;
	gchar** ACCEL_ABOUT;
	gint ACCEL_ABOUT_length1;
	gchar** ACCEL_NEW_POST;
	gint ACCEL_NEW_POST_length1;
	gchar** ACCEL_BACK;
	gint ACCEL_BACK_length1;
	gchar** ACCEL_REFRESH;
	gint ACCEL_REFRESH_length1;
	gchar** ACCEL_SEARCH;
	gint ACCEL_SEARCH_length1;
	gchar** ACCEL_TIMELINE_0;
	gint ACCEL_TIMELINE_0_length1;
	gchar** ACCEL_TIMELINE_1;
	gint ACCEL_TIMELINE_1_length1;
	gchar** ACCEL_TIMELINE_2;
	gint ACCEL_TIMELINE_2_length1;
	gchar** ACCEL_TIMELINE_3;
	gint ACCEL_TIMELINE_3_length1;
};

struct _TootleApplicationClass {
	GtkApplicationClass parent_class;
};

typedef enum  {
	TOOTLE_OOPSIE_USER,
	TOOTLE_OOPSIE_PARSING,
	TOOTLE_OOPSIE_INSTANCE,
	TOOTLE_OOPSIE_INTERNAL
} TootleOopsie;
#define TOOTLE_OOPSIE tootle_oopsie_quark ()
struct _TootleDialogsNewAccountStepData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TootleDialogsNewAccount* self;
	GtkStack* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkBox* _tmp3_;
	TootleAccounts* _tmp4_;
	TootleAccounts* _tmp5_;
	TootleApplication* _tmp6_;
	GtkStack* _tmp7_;
	GtkWidget* _tmp8_;
	GtkWidget* _tmp9_;
	GtkBox* _tmp10_;
	gboolean _tmp11_;
	TootleInstanceAccount* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	TootleInstanceAccount* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	GError* _inner_error0_;
};

struct _TootleDialogsNewAccountRegisterClientData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TootleDialogsNewAccount* self;
	TootleRequest* msg;
	TootleRequest* _tmp0_;
	TootleRequest* _tmp1_;
	TootleInstanceAccount* _tmp2_;
	TootleRequest* _tmp3_;
	TootleRequest* _tmp4_;
	TootleRequest* _tmp5_;
	TootleRequest* _tmp6_;
	TootleRequest* _tmp7_;
	TootleRequest* _tmp8_;
	TootleRequest* _tmp9_;
	TootleRequest* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	TootleRequest* _tmp13_;
	TootleRequest* _tmp14_;
	TootleRequest* _tmp15_;
	TootleRequest* _tmp16_;
	TootleRequest* _tmp17_;
	JsonObject* root;
	TootleNetwork* _tmp18_;
	TootleRequest* _tmp19_;
	JsonObject* _tmp20_;
	TootleInstanceAccount* _tmp21_;
	JsonObject* _tmp22_;
	const gchar* _tmp23_;
	TootleInstanceAccount* _tmp24_;
	JsonObject* _tmp25_;
	const gchar* _tmp26_;
	GtkStack* _tmp27_;
	GtkBox* _tmp28_;
	GError* _inner_error0_;
};

struct _TootleDialogsNewAccountRequestTokenData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TootleDialogsNewAccount* self;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GError* _tmp3_;
	TootleRequest* token_req;
	TootleRequest* _tmp4_;
	TootleRequest* _tmp5_;
	TootleInstanceAccount* _tmp6_;
	TootleRequest* _tmp7_;
	TootleRequest* _tmp8_;
	TootleInstanceAccount* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	TootleRequest* _tmp12_;
	TootleRequest* _tmp13_;
	TootleInstanceAccount* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	TootleRequest* _tmp17_;
	TootleRequest* _tmp18_;
	const gchar* _tmp19_;
	TootleRequest* _tmp20_;
	TootleRequest* _tmp21_;
	TootleRequest* _tmp22_;
	TootleRequest* _tmp23_;
	GtkEntry* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	TootleRequest* _tmp27_;
	TootleRequest* _tmp28_;
	TootleRequest* _tmp29_;
	TootleRequest* _tmp30_;
	TootleRequest* _tmp31_;
	JsonObject* root;
	TootleNetwork* _tmp32_;
	TootleRequest* _tmp33_;
	JsonObject* _tmp34_;
	TootleInstanceAccount* _tmp35_;
	JsonObject* _tmp36_;
	const gchar* _tmp37_;
	TootleInstanceAccount* _tmp38_;
	const gchar* _tmp39_;
	const gchar* _tmp40_;
	GError* _tmp41_;
	TootleRequest* profile_req;
	TootleRequest* _tmp42_;
	TootleRequest* _tmp43_;
	TootleInstanceAccount* _tmp44_;
	TootleRequest* _tmp45_;
	TootleRequest* _tmp46_;
	TootleRequest* _tmp47_;
	TootleRequest* _tmp48_;
	TootleRequest* _tmp49_;
	JsonNode* node;
	TootleNetwork* _tmp50_;
	TootleRequest* _tmp51_;
	JsonNode* _tmp52_;
	TootleAPIAccount* profile;
	JsonNode* _tmp53_;
	TootleAPIAccount* _tmp54_;
	TootleInstanceAccount* _tmp55_;
	TootleAPIAccount* _tmp56_;
	TootleAccounts* _tmp57_;
	TootleInstanceAccount* _tmp58_;
	GtkLabel* _tmp59_;
	TootleInstanceAccount* _tmp60_;
	gchar* _tmp61_;
	gchar* _tmp62_;
	gchar* _tmp63_;
	gchar* _tmp64_;
	gchar* _tmp65_;
	GtkStack* _tmp66_;
	GtkBox* _tmp67_;
	GError* _inner_error0_;
};

static gint TootleDialogsNewAccount_private_offset;
static gpointer tootle_dialogs_new_account_parent_class = NULL;
extern TootleDialogsMainWindow* tootle_window;
extern TootleApplication* tootle_app;
extern TootleDialogsNewAccount* tootle_new_account_window;
extern TootleAccounts* tootle_accounts;
extern TootleNetwork* tootle_network;

GType tootle_dialogs_new_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleDialogsNewAccount, g_object_unref)
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)
#define TOOTLE_DIALOGS_NEW_ACCOUNT_scopes "read%20write%20follow"
TootleInstanceAccount* tootle_instance_account_new_empty (const gchar* instance);
TootleInstanceAccount* tootle_instance_account_construct_empty (GType object_type,
                                                                const gchar* instance);
TootleDialogsNewAccount* tootle_dialogs_new_account_new (void);
TootleDialogsNewAccount* tootle_dialogs_new_account_construct (GType object_type);
GType tootle_dialogs_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleDialogsMainWindow, g_object_unref)
GType tootle_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleApplication, g_object_unref)
static void tootle_dialogs_new_account_reset (TootleDialogsNewAccount* self);
static gboolean tootle_dialogs_new_account_real_delete_event (GtkWidget* base,
                                                       GdkEventAny* event);
gboolean tootle_application_on_window_closed (TootleApplication* self);
static gchar* tootle_dialogs_new_account_setup_redirect_uri (TootleDialogsNewAccount* self);
gboolean tootle_dialogs_new_account_get_use_auto_auth (TootleDialogsNewAccount* self);
GQuark tootle_oopsie_quark (void);
#define BUILD_DOMAIN "com.github.bleakgrey.tootle"
void tootle_dialogs_new_account_set_use_auto_auth (TootleDialogsNewAccount* self,
                                                   gboolean value);
static gboolean tootle_dialogs_new_account_on_activate_code_label_link (TootleDialogsNewAccount* self,
                                                                 const gchar* uri);
static gboolean _tootle_dialogs_new_account_on_activate_code_label_link_gtk_label_activate_link (GtkLabel* _sender,
                                                                                          const gchar* uri,
                                                                                          gpointer self);
TootleInstanceAccount* tootle_dialogs_new_account_get_account (TootleDialogsNewAccount* self);
const gchar* tootle_instance_account_get_instance (TootleInstanceAccount* self);
void tootle_dialogs_new_account_set_account (TootleDialogsNewAccount* self,
                                             TootleInstanceAccount* value);
static void tootle_dialogs_new_account_invalidate (TootleDialogsNewAccount* self);
gboolean tootle_dialogs_new_account_get_is_working (TootleDialogsNewAccount* self);
static void tootle_dialogs_new_account_oopsie (TootleDialogsNewAccount* self,
                                        const gchar* title,
                                        const gchar* msg);
void tootle_application_inform (TootleApplication* self,
                                GtkMessageType type,
                                const gchar* text,
                                const gchar* msg,
                                GtkWindow* win);
static void tootle_dialogs_new_account_step_data_free (gpointer _data);
static void tootle_dialogs_new_account_step (TootleDialogsNewAccount* self,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
static void tootle_dialogs_new_account_step_finish (TootleDialogsNewAccount* self,
                                             GAsyncResult* _res_,
                                             GError** error);
static gboolean tootle_dialogs_new_account_step_co (TootleDialogsNewAccountStepData* _data_);
GType tootle_accounts_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAccounts, g_object_unref)
gboolean tootle_accounts_is_empty (TootleAccounts* self);
void tootle_accounts_switch_account (TootleAccounts* self,
                                     gint id);
void tootle_application_present_window (TootleApplication* self);
static void tootle_dialogs_new_account_setup_instance (TootleDialogsNewAccount* self,
                                                GError** error);
const gchar* tootle_instance_account_get_client_secret (TootleInstanceAccount* self);
const gchar* tootle_instance_account_get_client_id (TootleInstanceAccount* self);
static void tootle_dialogs_new_account_register_client (TootleDialogsNewAccount* self,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_);
static void tootle_dialogs_new_account_register_client_finish (TootleDialogsNewAccount* self,
                                                        GAsyncResult* _res_,
                                                        GError** error);
static void tootle_dialogs_new_account_step_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
static void tootle_dialogs_new_account_request_token (TootleDialogsNewAccount* self,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static void tootle_dialogs_new_account_request_token_finish (TootleDialogsNewAccount* self,
                                                      GAsyncResult* _res_,
                                                      GError** error);
void tootle_instance_account_set_instance (TootleInstanceAccount* self,
                                           const gchar* value);
static void tootle_dialogs_new_account_register_client_data_free (gpointer _data);
static gboolean tootle_dialogs_new_account_register_client_co (TootleDialogsNewAccountRegisterClientData* _data_);
GType tootle_request_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleRequest, g_object_unref)
TootleRequest* tootle_request_new_POST (const gchar* url);
TootleRequest* tootle_request_construct_POST (GType object_type,
                                              const gchar* url);
TootleRequest* tootle_request_with_account (TootleRequest* self,
                                            TootleInstanceAccount* account);
TootleRequest* tootle_request_with_param (TootleRequest* self,
                                          const gchar* name,
                                          const gchar* val);
#define BUILD_NAME "Tootle"
#define BUILD_WEBSITE "https://github.com/bleakgrey/tootle"
void tootle_dialogs_new_account_set_redirect_uri (TootleDialogsNewAccount* self,
                                                  const gchar* value);
void tootle_request_await (TootleRequest* self,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_);
TootleRequest* tootle_request_await_finish (TootleRequest* self,
                                            GAsyncResult* _res_,
                                            GError** error);
static void tootle_dialogs_new_account_register_client_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_);
GType tootle_network_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleNetwork, g_object_unref)
JsonObject* tootle_network_parse (TootleNetwork* self,
                                  SoupMessage* msg,
                                  GError** error);
void tootle_instance_account_set_client_id (TootleInstanceAccount* self,
                                            const gchar* value);
void tootle_instance_account_set_client_secret (TootleInstanceAccount* self,
                                                const gchar* value);
static void tootle_dialogs_new_account_open_confirmation_page (TootleDialogsNewAccount* self);
const gchar* tootle_dialogs_new_account_get_redirect_uri (TootleDialogsNewAccount* self);
gboolean tootle_desktop_open_uri (const gchar* _uri);
static void tootle_dialogs_new_account_request_token_data_free (gpointer _data);
static gboolean tootle_dialogs_new_account_request_token_co (TootleDialogsNewAccountRequestTokenData* _data_);
static void tootle_dialogs_new_account_request_token_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_);
void tootle_instance_account_set_access_token (TootleInstanceAccount* self,
                                               const gchar* value);
const gchar* tootle_instance_account_get_access_token (TootleInstanceAccount* self);
TootleRequest* tootle_request_new_GET (const gchar* url);
TootleRequest* tootle_request_construct_GET (GType object_type,
                                             const gchar* url);
JsonNode* tootle_network_parse_node (TootleNetwork* self,
                                     SoupMessage* msg,
                                     GError** error);
TootleAPIAccount* tootle_api_account_from (JsonNode* node,
                                           GError** error);
static void _vala_JsonNode_free (JsonNode* self);
void tootle_entity_patch (TootleEntity* self,
                          GObject* with);
void tootle_accounts_add (TootleAccounts* self,
                          TootleInstanceAccount* account);
gchar* tootle_instance_account_get_handle (TootleInstanceAccount* self);
void tootle_dialogs_new_account_redirect (TootleDialogsNewAccount* self,
                                          const gchar* uri);
static void _vala_SoupURI_free (SoupURI* self);
void tootle_dialogs_new_account_set_is_working (TootleDialogsNewAccount* self,
                                                gboolean value);
static void tootle_dialogs_new_account_on_next_clicked (TootleDialogsNewAccount* self);
static void __lambda103_ (TootleDialogsNewAccount* self,
                   GObject* obj,
                   GAsyncResult* res);
static void ___lambda103__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void _tootle_dialogs_new_account_on_next_clicked_gtk_entry_activate (GtkEntry* _sender,
                                                                     gpointer self);
static void tootle_dialogs_new_account_on_back_clicked (TootleDialogsNewAccount* self);
static void _tootle_dialogs_new_account_on_back_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                     gpointer self);
static void tootle_dialogs_new_account_finalize (GObject * obj);
static GType tootle_dialogs_new_account_get_type_once (void);
static void _vala_tootle_dialogs_new_account_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec);
static void _vala_tootle_dialogs_new_account_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gint array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gint array_length,
                       GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
tootle_dialogs_new_account_get_instance_private (TootleDialogsNewAccount* self)
{
	return G_STRUCT_MEMBER_P (self, TootleDialogsNewAccount_private_offset);
}

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

TootleDialogsNewAccount*
tootle_dialogs_new_account_construct (GType object_type)
{
	TootleDialogsNewAccount * self = NULL;
	TootleDialogsMainWindow* _tmp0_;
	GdkScreen* _tmp1_;
	TootleApplication* _tmp2_;
	GtkCssProvider* _tmp3_;
	TootleDialogsNewAccount* _tmp4_;
	GtkLabel* _tmp5_;
	_tmp0_ = tootle_window;
	self = (TootleDialogsNewAccount*) g_object_new (object_type, "transient-for", _tmp0_, NULL);
	_tmp1_ = gdk_screen_get_default ();
	_tmp2_ = tootle_app;
	_tmp3_ = _tmp2_->css_provider;
	gtk_style_context_add_provider_for_screen (_tmp1_, (GtkStyleProvider*) _tmp3_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
	tootle_dialogs_new_account_reset (self);
	gtk_window_present ((GtkWindow*) self);
	_tmp4_ = _g_object_ref0 (self);
	_g_object_unref0 (tootle_new_account_window);
	tootle_new_account_window = _tmp4_;
	_tmp5_ = self->priv->code_label;
	g_object_bind_property_with_closures ((GObject*) self, "use-auto-auth", (GObject*) _tmp5_, "visible", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	return self;
}

TootleDialogsNewAccount*
tootle_dialogs_new_account_new (void)
{
	return tootle_dialogs_new_account_construct (TOOTLE_DIALOGS_TYPE_NEW_ACCOUNT);
}

static gboolean
tootle_dialogs_new_account_real_delete_event (GtkWidget* base,
                                              GdkEventAny* event)
{
	TootleDialogsNewAccount * self;
	TootleApplication* _tmp0_;
	gboolean result = FALSE;
	self = (TootleDialogsNewAccount*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	_g_object_unref0 (tootle_new_account_window);
	tootle_new_account_window = NULL;
	_tmp0_ = tootle_app;
	result = tootle_application_on_window_closed (_tmp0_);
	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;
}

static gchar*
tootle_dialogs_new_account_setup_redirect_uri (TootleDialogsNewAccount* self)
{
	GError* _inner_error0_ = NULL;
	gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	{
		gboolean _tmp0_;
		const gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp0_ = self->priv->_use_auto_auth;
		if (!_tmp0_) {
			GError* _tmp1_;
			_tmp1_ = g_error_new_literal (TOOTLE_OOPSIE, TOOTLE_OOPSIE_INTERNAL, "Using manual auth method");
			_inner_error0_ = _tmp1_;
			goto __catch0_g_error;
		}
		_tmp2_ = string_to_string (BUILD_DOMAIN);
		_tmp3_ = g_strconcat ("xdg-mime default ", _tmp2_, ".desktop x-scheme-handler/tootle", NULL);
		_tmp4_ = _tmp3_;
		g_spawn_command_line_sync (_tmp4_, NULL, NULL, NULL, &_inner_error0_);
		_g_free0 (_tmp4_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		g_message ("NewAccount.vala:58: Successfully associated MIME type for automatic au" \
"thorization");
		_tmp5_ = g_strdup ("tootle://auth_code");
		result = _tmp5_;
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp6_ = e;
		_tmp7_ = _tmp6_->message;
		g_warning ("NewAccount.vala:62: %s", _tmp7_);
		tootle_dialogs_new_account_set_use_auto_auth (self, FALSE);
		_tmp8_ = g_strdup ("urn:ietf:wg:oauth:2.0:oob");
		result = _tmp8_;
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static gboolean
tootle_dialogs_new_account_on_activate_code_label_link (TootleDialogsNewAccount* self,
                                                        const gchar* uri)
{
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (uri != NULL, FALSE);
	tootle_dialogs_new_account_set_use_auto_auth (self, FALSE);
	tootle_dialogs_new_account_reset (self);
	result = TRUE;
	return result;
}

static gboolean
_tootle_dialogs_new_account_on_activate_code_label_link_gtk_label_activate_link (GtkLabel* _sender,
                                                                                 const gchar* uri,
                                                                                 gpointer self)
{
	gboolean result;
	result = tootle_dialogs_new_account_on_activate_code_label_link ((TootleDialogsNewAccount*) self, uri);
	return result;
}

static void
tootle_dialogs_new_account_reset (TootleDialogsNewAccount* self)
{
	TootleInstanceAccount* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	TootleInstanceAccount* _tmp3_;
	TootleInstanceAccount* _tmp4_;
	GtkStack* _tmp5_;
	GtkBox* _tmp6_;
	g_return_if_fail (self != NULL);
	g_message ("NewAccount.vala:76: Reset state");
	_tmp0_ = self->priv->_account;
	_tmp1_ = tootle_instance_account_get_instance (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = tootle_instance_account_new_empty (_tmp2_);
	_tmp4_ = _tmp3_;
	tootle_dialogs_new_account_set_account (self, _tmp4_);
	_g_object_unref0 (_tmp4_);
	_tmp5_ = self->priv->stack;
	_tmp6_ = self->priv->instance_step;
	gtk_stack_set_visible_child (_tmp5_, (GtkWidget*) _tmp6_);
	tootle_dialogs_new_account_invalidate (self);
}

static void
tootle_dialogs_new_account_invalidate (TootleDialogsNewAccount* self)
{
	GtkButton* _tmp0_;
	gboolean _tmp1_;
	const gchar* _tmp2_ = NULL;
	GtkStack* _tmp3_;
	GtkWidget* _tmp4_;
	GtkWidget* _tmp5_;
	GtkBox* _tmp6_;
	GtkButton* _tmp7_;
	const gchar* _tmp8_ = NULL;
	GtkStack* _tmp9_;
	GtkWidget* _tmp10_;
	GtkWidget* _tmp11_;
	GtkBox* _tmp12_;
	GtkButton* _tmp13_;
	GtkButton* _tmp14_;
	GtkStack* _tmp15_;
	GtkWidget* _tmp16_;
	GtkWidget* _tmp17_;
	GtkBox* _tmp18_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->next_button;
	_tmp1_ = self->priv->_is_working;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, !_tmp1_);
	_tmp3_ = self->priv->stack;
	_tmp4_ = gtk_stack_get_visible_child (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->done_step;
	if (_tmp5_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_widget_get_type (), GtkWidget)) {
		_tmp2_ = _ ("Close");
	} else {
		_tmp2_ = _ ("Next");
	}
	_tmp7_ = self->priv->next_button;
	gtk_button_set_label (_tmp7_, _tmp2_);
	_tmp9_ = self->priv->stack;
	_tmp10_ = gtk_stack_get_visible_child (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = self->priv->done_step;
	if (_tmp11_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, gtk_widget_get_type (), GtkWidget)) {
		_tmp8_ = _ ("Add Another");
	} else {
		_tmp8_ = _ ("Back");
	}
	_tmp13_ = self->priv->back_button;
	gtk_button_set_label (_tmp13_, _tmp8_);
	_tmp14_ = self->priv->back_button;
	_tmp15_ = self->priv->stack;
	_tmp16_ = gtk_stack_get_visible_child (_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = self->priv->instance_step;
	gtk_widget_set_visible ((GtkWidget*) _tmp14_, _tmp17_ != G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, gtk_widget_get_type (), GtkWidget));
}

static void
tootle_dialogs_new_account_oopsie (TootleDialogsNewAccount* self,
                                   const gchar* title,
                                   const gchar* msg)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	TootleApplication* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (title != NULL);
	g_return_if_fail (msg != NULL);
	_tmp0_ = string_to_string (title);
	_tmp1_ = string_to_string (msg);
	_tmp2_ = g_strconcat (_tmp0_, "   ", _tmp1_, NULL);
	_tmp3_ = _tmp2_;
	g_warning ("NewAccount.vala:90: %s", _tmp3_);
	_g_free0 (_tmp3_);
	_tmp4_ = tootle_app;
	tootle_application_inform (_tmp4_, GTK_MESSAGE_ERROR, title, msg, (GtkWindow*) self);
}

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

static void
tootle_dialogs_new_account_step (TootleDialogsNewAccount* self,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	TootleDialogsNewAccountStepData* _data_;
	TootleDialogsNewAccount* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TootleDialogsNewAccountStepData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tootle_dialogs_new_account_step_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tootle_dialogs_new_account_step_co (_data_);
}

static void
tootle_dialogs_new_account_step_finish (TootleDialogsNewAccount* self,
                                        GAsyncResult* _res_,
                                        GError** error)
{
	TootleDialogsNewAccountStepData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
tootle_dialogs_new_account_step_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	TootleDialogsNewAccountStepData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tootle_dialogs_new_account_step_co (_data_);
}

static gboolean
tootle_dialogs_new_account_step_co (TootleDialogsNewAccountStepData* _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->stack;
	_data_->_tmp1_ = gtk_stack_get_visible_child (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = _data_->self->priv->done_step;
	if (_data_->_tmp2_ == G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp3_, gtk_widget_get_type (), GtkWidget)) {
		_data_->_tmp4_ = tootle_accounts;
		if (tootle_accounts_is_empty (_data_->_tmp4_)) {
			_data_->_tmp5_ = tootle_accounts;
			tootle_accounts_switch_account (_data_->_tmp5_, 0);
		}
		_data_->_tmp6_ = tootle_app;
		tootle_application_present_window (_data_->_tmp6_);
		gtk_widget_destroy ((GtkWidget*) _data_->self);
		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;
	}
	_data_->_tmp7_ = _data_->self->priv->stack;
	_data_->_tmp8_ = gtk_stack_get_visible_child (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = _data_->self->priv->instance_step;
	if (_data_->_tmp9_ == G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp10_, gtk_widget_get_type (), GtkWidget)) {
		tootle_dialogs_new_account_setup_instance (_data_->self, &_data_->_inner_error0_);
		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_->_tmp12_ = _data_->self->priv->_account;
	_data_->_tmp13_ = tootle_instance_account_get_client_secret (_data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	if (_data_->_tmp14_ == NULL) {
		_data_->_tmp11_ = TRUE;
	} else {
		_data_->_tmp15_ = _data_->self->priv->_account;
		_data_->_tmp16_ = tootle_instance_account_get_client_id (_data_->_tmp15_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp11_ = _data_->_tmp17_ == NULL;
	}
	if (_data_->_tmp11_) {
		_data_->_state_ = 1;
		tootle_dialogs_new_account_register_client (_data_->self, tootle_dialogs_new_account_step_ready, _data_);
		return FALSE;
		_state_1:
		tootle_dialogs_new_account_register_client_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		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;
		}
		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;
	}
	_data_->_state_ = 2;
	tootle_dialogs_new_account_request_token (_data_->self, tootle_dialogs_new_account_step_ready, _data_);
	return FALSE;
	_state_2:
	tootle_dialogs_new_account_request_token_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
	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;
	}
	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 gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static void
tootle_dialogs_new_account_setup_instance (TootleDialogsNewAccount* self,
                                           GError** error)
{
	gchar* str = NULL;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	TootleInstanceAccount* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	GtkEntry* _tmp15_;
	const gchar* _tmp16_;
	gboolean _tmp17_ = FALSE;
	const gchar* _tmp18_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_message ("NewAccount.vala:116: Checking instance URL");
	_tmp0_ = self->priv->instance_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_replace (_tmp2_, "/", "");
	_tmp4_ = _tmp3_;
	_tmp5_ = string_replace (_tmp4_, ":", "");
	_tmp6_ = _tmp5_;
	_tmp7_ = string_replace (_tmp6_, "https", "");
	_tmp8_ = _tmp7_;
	_tmp9_ = string_replace (_tmp8_, "http", "");
	_tmp10_ = _tmp9_;
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	str = _tmp10_;
	_tmp11_ = self->priv->_account;
	_tmp12_ = str;
	_tmp13_ = g_strconcat ("https://", _tmp12_, NULL);
	_tmp14_ = _tmp13_;
	tootle_instance_account_set_instance (_tmp11_, _tmp14_);
	_g_free0 (_tmp14_);
	_tmp15_ = self->priv->instance_entry;
	_tmp16_ = str;
	gtk_entry_set_text (_tmp15_, _tmp16_);
	_tmp18_ = str;
	if (g_utf8_strlen (_tmp18_, (gssize) -1) <= 0) {
		_tmp17_ = TRUE;
	} else {
		TootleInstanceAccount* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		_tmp19_ = self->priv->_account;
		_tmp20_ = tootle_instance_account_get_instance (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp17_ = !string_contains (_tmp21_, ".");
	}
	if (_tmp17_) {
		GError* _tmp22_;
		_tmp22_ = g_error_new_literal (TOOTLE_OOPSIE, TOOTLE_OOPSIE_USER, _ ("Please enter a valid instance URL"));
		_inner_error0_ = _tmp22_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (str);
		return;
	}
	_g_free0 (str);
}

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

static void
tootle_dialogs_new_account_register_client (TootleDialogsNewAccount* self,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	TootleDialogsNewAccountRegisterClientData* _data_;
	TootleDialogsNewAccount* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TootleDialogsNewAccountRegisterClientData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tootle_dialogs_new_account_register_client_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tootle_dialogs_new_account_register_client_co (_data_);
}

static void
tootle_dialogs_new_account_register_client_finish (TootleDialogsNewAccount* self,
                                                   GAsyncResult* _res_,
                                                   GError** error)
{
	TootleDialogsNewAccountRegisterClientData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
tootle_dialogs_new_account_register_client_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_)
{
	TootleDialogsNewAccountRegisterClientData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tootle_dialogs_new_account_register_client_co (_data_);
}

static gboolean
tootle_dialogs_new_account_register_client_co (TootleDialogsNewAccountRegisterClientData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_message ("NewAccount.vala:131: Registering client");
	_data_->_tmp0_ = tootle_request_new_POST ("/api/v1/apps");
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = _data_->self->priv->_account;
	_data_->_tmp3_ = tootle_request_with_account (_data_->_tmp1_, _data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = tootle_request_with_param (_data_->_tmp4_, "client_name", BUILD_NAME);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = tootle_request_with_param (_data_->_tmp6_, "website", BUILD_WEBSITE);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = tootle_request_with_param (_data_->_tmp8_, "scopes", TOOTLE_DIALOGS_NEW_ACCOUNT_scopes);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = tootle_dialogs_new_account_setup_redirect_uri (_data_->self);
	_data_->_tmp12_ = _data_->_tmp11_;
	tootle_dialogs_new_account_set_redirect_uri (_data_->self, _data_->_tmp12_);
	_data_->_tmp13_ = tootle_request_with_param (_data_->_tmp10_, "redirect_uris", _data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	_g_free0 (_data_->_tmp12_);
	_g_object_unref0 (_data_->_tmp10_);
	_g_object_unref0 (_data_->_tmp8_);
	_g_object_unref0 (_data_->_tmp6_);
	_g_object_unref0 (_data_->_tmp4_);
	_g_object_unref0 (_data_->_tmp1_);
	_data_->msg = _data_->_tmp14_;
	_data_->_tmp15_ = _data_->msg;
	_data_->_state_ = 1;
	tootle_request_await (_data_->_tmp15_, tootle_dialogs_new_account_register_client_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp16_ = tootle_request_await_finish (_data_->_tmp15_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp17_ = _data_->_tmp16_;
	_g_object_unref0 (_data_->_tmp17_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->msg);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp18_ = tootle_network;
	_data_->_tmp19_ = _data_->msg;
	_data_->_tmp20_ = tootle_network_parse (_data_->_tmp18_, (SoupMessage*) _data_->_tmp19_, &_data_->_inner_error0_);
	_data_->root = _data_->_tmp20_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->msg);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp21_ = _data_->self->priv->_account;
	_data_->_tmp22_ = _data_->root;
	_data_->_tmp23_ = json_object_get_string_member (_data_->_tmp22_, "client_id");
	tootle_instance_account_set_client_id (_data_->_tmp21_, _data_->_tmp23_);
	_data_->_tmp24_ = _data_->self->priv->_account;
	_data_->_tmp25_ = _data_->root;
	_data_->_tmp26_ = json_object_get_string_member (_data_->_tmp25_, "client_secret");
	tootle_instance_account_set_client_secret (_data_->_tmp24_, _data_->_tmp26_);
	g_message ("NewAccount.vala:144: OK: Instance registered client");
	_data_->_tmp27_ = _data_->self->priv->stack;
	_data_->_tmp28_ = _data_->self->priv->code_step;
	gtk_stack_set_visible_child (_data_->_tmp27_, (GtkWidget*) _data_->_tmp28_);
	tootle_dialogs_new_account_open_confirmation_page (_data_->self);
	_json_object_unref0 (_data_->root);
	_g_object_unref0 (_data_->msg);
	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_dialogs_new_account_open_confirmation_page (TootleDialogsNewAccount* self)
{
	gchar* pars = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	TootleInstanceAccount* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* url = NULL;
	TootleInstanceAccount* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	g_return_if_fail (self != NULL);
	g_message ("NewAccount.vala:151: Opening permission request page");
	_tmp0_ = string_to_string (TOOTLE_DIALOGS_NEW_ACCOUNT_scopes);
	_tmp1_ = self->priv->_redirect_uri;
	_tmp2_ = string_to_string (_tmp1_);
	_tmp3_ = self->priv->_account;
	_tmp4_ = tootle_instance_account_get_client_id (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = string_to_string (_tmp5_);
	_tmp7_ = g_strconcat ("scope=", _tmp0_, "&response_type=code&redirect_uri=", _tmp2_, "&client_id=", _tmp6_, NULL);
	pars = _tmp7_;
	_tmp8_ = self->priv->_account;
	_tmp9_ = tootle_instance_account_get_instance (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = string_to_string (_tmp10_);
	_tmp12_ = string_to_string (pars);
	_tmp13_ = g_strconcat (_tmp11_, "/oauth/authorize?", _tmp12_, NULL);
	url = _tmp13_;
	tootle_desktop_open_uri (url);
	_g_free0 (url);
	_g_free0 (pars);
}

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

static void
tootle_dialogs_new_account_request_token (TootleDialogsNewAccount* self,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	TootleDialogsNewAccountRequestTokenData* _data_;
	TootleDialogsNewAccount* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TootleDialogsNewAccountRequestTokenData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tootle_dialogs_new_account_request_token_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tootle_dialogs_new_account_request_token_co (_data_);
}

static void
tootle_dialogs_new_account_request_token_finish (TootleDialogsNewAccount* self,
                                                 GAsyncResult* _res_,
                                                 GError** error)
{
	TootleDialogsNewAccountRequestTokenData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
tootle_dialogs_new_account_request_token_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	TootleDialogsNewAccountRequestTokenData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tootle_dialogs_new_account_request_token_co (_data_);
}

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

static gboolean
tootle_dialogs_new_account_request_token_co (TootleDialogsNewAccountRequestTokenData* _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->code_entry;
	_data_->_tmp1_ = gtk_entry_get_text (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (g_utf8_strlen (_data_->_tmp2_, (gssize) -1) <= 10) {
		_data_->_tmp3_ = g_error_new_literal (TOOTLE_OOPSIE, TOOTLE_OOPSIE_USER, _ ("Please enter a valid authorization code"));
		_data_->_inner_error0_ = _data_->_tmp3_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_message ("NewAccount.vala:162: Requesting access token");
	_data_->_tmp4_ = tootle_request_new_POST ("/oauth/token");
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = _data_->self->priv->_account;
	_data_->_tmp7_ = tootle_request_with_account (_data_->_tmp5_, _data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = _data_->self->priv->_account;
	_data_->_tmp10_ = tootle_instance_account_get_client_id (_data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = tootle_request_with_param (_data_->_tmp8_, "client_id", _data_->_tmp11_);
	_data_->_tmp13_ = _data_->_tmp12_;
	_data_->_tmp14_ = _data_->self->priv->_account;
	_data_->_tmp15_ = tootle_instance_account_get_client_secret (_data_->_tmp14_);
	_data_->_tmp16_ = _data_->_tmp15_;
	_data_->_tmp17_ = tootle_request_with_param (_data_->_tmp13_, "client_secret", _data_->_tmp16_);
	_data_->_tmp18_ = _data_->_tmp17_;
	_data_->_tmp19_ = _data_->self->priv->_redirect_uri;
	_data_->_tmp20_ = tootle_request_with_param (_data_->_tmp18_, "redirect_uri", _data_->_tmp19_);
	_data_->_tmp21_ = _data_->_tmp20_;
	_data_->_tmp22_ = tootle_request_with_param (_data_->_tmp21_, "grant_type", "authorization_code");
	_data_->_tmp23_ = _data_->_tmp22_;
	_data_->_tmp24_ = _data_->self->priv->code_entry;
	_data_->_tmp25_ = gtk_entry_get_text (_data_->_tmp24_);
	_data_->_tmp26_ = _data_->_tmp25_;
	_data_->_tmp27_ = tootle_request_with_param (_data_->_tmp23_, "code", _data_->_tmp26_);
	_data_->_tmp28_ = _data_->_tmp27_;
	_g_object_unref0 (_data_->_tmp23_);
	_g_object_unref0 (_data_->_tmp21_);
	_g_object_unref0 (_data_->_tmp18_);
	_g_object_unref0 (_data_->_tmp13_);
	_g_object_unref0 (_data_->_tmp8_);
	_g_object_unref0 (_data_->_tmp5_);
	_data_->token_req = _data_->_tmp28_;
	_data_->_tmp29_ = _data_->token_req;
	_data_->_state_ = 1;
	tootle_request_await (_data_->_tmp29_, tootle_dialogs_new_account_request_token_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp30_ = tootle_request_await_finish (_data_->_tmp29_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp31_ = _data_->_tmp30_;
	_g_object_unref0 (_data_->_tmp31_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->token_req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp32_ = tootle_network;
	_data_->_tmp33_ = _data_->token_req;
	_data_->_tmp34_ = tootle_network_parse (_data_->_tmp32_, (SoupMessage*) _data_->_tmp33_, &_data_->_inner_error0_);
	_data_->root = _data_->_tmp34_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->token_req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp35_ = _data_->self->priv->_account;
	_data_->_tmp36_ = _data_->root;
	_data_->_tmp37_ = json_object_get_string_member (_data_->_tmp36_, "access_token");
	tootle_instance_account_set_access_token (_data_->_tmp35_, _data_->_tmp37_);
	_data_->_tmp38_ = _data_->self->priv->_account;
	_data_->_tmp39_ = tootle_instance_account_get_access_token (_data_->_tmp38_);
	_data_->_tmp40_ = _data_->_tmp39_;
	if (_data_->_tmp40_ == NULL) {
		_data_->_tmp41_ = g_error_new_literal (TOOTLE_OOPSIE, TOOTLE_OOPSIE_INSTANCE, _ ("Instance failed to authorize the access token"));
		_data_->_inner_error0_ = _data_->_tmp41_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_json_object_unref0 (_data_->root);
		_g_object_unref0 (_data_->token_req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_message ("NewAccount.vala:178: Trying to get the user profile");
	_data_->_tmp42_ = tootle_request_new_GET ("/api/v1/accounts/verify_credentials");
	_data_->_tmp43_ = _data_->_tmp42_;
	_data_->_tmp44_ = _data_->self->priv->_account;
	_data_->_tmp45_ = tootle_request_with_account (_data_->_tmp43_, _data_->_tmp44_);
	_data_->_tmp46_ = _data_->_tmp45_;
	_g_object_unref0 (_data_->_tmp43_);
	_data_->profile_req = _data_->_tmp46_;
	_data_->_tmp47_ = _data_->profile_req;
	_data_->_state_ = 2;
	tootle_request_await (_data_->_tmp47_, tootle_dialogs_new_account_request_token_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp48_ = tootle_request_await_finish (_data_->_tmp47_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp49_ = _data_->_tmp48_;
	_g_object_unref0 (_data_->_tmp49_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->profile_req);
		_json_object_unref0 (_data_->root);
		_g_object_unref0 (_data_->token_req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp50_ = tootle_network;
	_data_->_tmp51_ = _data_->profile_req;
	_data_->_tmp52_ = tootle_network_parse_node (_data_->_tmp50_, (SoupMessage*) _data_->_tmp51_, &_data_->_inner_error0_);
	_data_->node = _data_->_tmp52_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->profile_req);
		_json_object_unref0 (_data_->root);
		_g_object_unref0 (_data_->token_req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp53_ = _data_->node;
	_data_->_tmp54_ = tootle_api_account_from (_data_->_tmp53_, &_data_->_inner_error0_);
	_data_->profile = _data_->_tmp54_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		__vala_JsonNode_free0 (_data_->node);
		_g_object_unref0 (_data_->profile_req);
		_json_object_unref0 (_data_->root);
		_g_object_unref0 (_data_->token_req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp55_ = _data_->self->priv->_account;
	_data_->_tmp56_ = _data_->profile;
	tootle_entity_patch ((TootleEntity*) _data_->_tmp55_, (GObject*) _data_->_tmp56_);
	g_message ("NewAccount.vala:187: Saving account");
	_data_->_tmp57_ = tootle_accounts;
	_data_->_tmp58_ = _data_->self->priv->_account;
	tootle_accounts_add (_data_->_tmp57_, _data_->_tmp58_);
	_data_->_tmp59_ = _data_->self->priv->hello_label;
	_data_->_tmp60_ = _data_->self->priv->_account;
	_data_->_tmp61_ = tootle_instance_account_get_handle (_data_->_tmp60_);
	_data_->_tmp62_ = _data_->_tmp61_;
	_data_->_tmp63_ = _data_->_tmp62_;
	_data_->_tmp64_ = g_strdup_printf (_ ("Hello, %s!"), _data_->_tmp63_);
	_data_->_tmp65_ = _data_->_tmp64_;
	gtk_label_set_label (_data_->_tmp59_, _data_->_tmp65_);
	_g_free0 (_data_->_tmp65_);
	_g_free0 (_data_->_tmp63_);
	_data_->_tmp66_ = _data_->self->priv->stack;
	_data_->_tmp67_ = _data_->self->priv->done_step;
	gtk_stack_set_visible_child (_data_->_tmp66_, (GtkWidget*) _data_->_tmp67_);
	_g_object_unref0 (_data_->profile);
	__vala_JsonNode_free0 (_data_->node);
	_g_object_unref0 (_data_->profile_req);
	_json_object_unref0 (_data_->root);
	_g_object_unref0 (_data_->token_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;
}

static void
_vala_SoupURI_free (SoupURI* self)
{
	g_boxed_free (soup_uri_get_type (), self);
}

void
tootle_dialogs_new_account_redirect (TootleDialogsNewAccount* self,
                                     const gchar* uri)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* query = NULL;
	SoupURI* _tmp3_;
	SoupURI* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar** split = NULL;
	gchar** _tmp8_;
	gchar** _tmp9_;
	gint split_length1;
	gint _split_size_;
	gchar* code = NULL;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	GtkEntry* _tmp12_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (uri != NULL);
	gtk_window_present ((GtkWindow*) self);
	_tmp0_ = string_to_string (uri);
	_tmp1_ = g_strconcat ("Received uri: ", _tmp0_, NULL);
	_tmp2_ = _tmp1_;
	g_message ("NewAccount.vala:196: %s", _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = soup_uri_new (uri);
	_tmp4_ = _tmp3_;
	_tmp5_ = soup_uri_get_query (_tmp4_);
	_tmp6_ = g_strdup (_tmp5_);
	_tmp7_ = _tmp6_;
	__vala_SoupURI_free0 (_tmp4_);
	query = _tmp7_;
	_tmp9_ = _tmp8_ = g_strsplit (query, "=", 0);
	split = _tmp9_;
	split_length1 = _vala_array_length (_tmp8_);
	_split_size_ = split_length1;
	_tmp10_ = split[1];
	_tmp11_ = g_strdup (_tmp10_);
	code = _tmp11_;
	_tmp12_ = self->priv->code_entry;
	gtk_entry_set_text (_tmp12_, code);
	tootle_dialogs_new_account_set_is_working (self, FALSE);
	tootle_dialogs_new_account_on_next_clicked (self);
	_g_free0 (code);
	split = (_vala_array_free (split, split_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (query);
}

static void
__lambda103_ (TootleDialogsNewAccount* self,
              GObject* obj,
              GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		tootle_dialogs_new_account_step_finish (self, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (g_error_matches (_inner_error0_, TOOTLE_OOPSIE, TOOTLE_OOPSIE_INSTANCE)) {
				goto __catch0_tootle_oopsie_instance;
			}
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_tootle_oopsie_instance:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		tootle_dialogs_new_account_oopsie (self, _ ("Server returned an error"), _tmp1_);
		_g_error_free0 (e);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp2_;
		const gchar* _tmp3_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = e;
		_tmp3_ = _tmp2_->message;
		tootle_dialogs_new_account_oopsie (self, _tmp3_, "");
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	tootle_dialogs_new_account_set_is_working (self, FALSE);
	tootle_dialogs_new_account_invalidate (self);
}

static void
___lambda103__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	__lambda103_ ((TootleDialogsNewAccount*) self, source_object, res);
	g_object_unref (self);
}

static void
tootle_dialogs_new_account_on_next_clicked (TootleDialogsNewAccount* self)
{
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_is_working;
	if (_tmp0_) {
		return;
	}
	tootle_dialogs_new_account_set_is_working (self, TRUE);
	tootle_dialogs_new_account_invalidate (self);
	tootle_dialogs_new_account_step (self, ___lambda103__gasync_ready_callback, g_object_ref (self));
}

static void
_tootle_dialogs_new_account_on_next_clicked_gtk_entry_activate (GtkEntry* _sender,
                                                                gpointer self)
{
	tootle_dialogs_new_account_on_next_clicked ((TootleDialogsNewAccount*) self);
}

static void
tootle_dialogs_new_account_on_back_clicked (TootleDialogsNewAccount* self)
{
	g_return_if_fail (self != NULL);
	tootle_dialogs_new_account_reset (self);
}

static void
_tootle_dialogs_new_account_on_back_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                gpointer self)
{
	tootle_dialogs_new_account_on_back_clicked ((TootleDialogsNewAccount*) self);
}

gboolean
tootle_dialogs_new_account_get_is_working (TootleDialogsNewAccount* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_working;
	return result;
}

void
tootle_dialogs_new_account_set_is_working (TootleDialogsNewAccount* self,
                                           gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_dialogs_new_account_get_is_working (self);
	if (old_value != value) {
		self->priv->_is_working = value;
		g_object_notify_by_pspec ((GObject *) self, tootle_dialogs_new_account_properties[TOOTLE_DIALOGS_NEW_ACCOUNT_IS_WORKING_PROPERTY]);
	}
}

const gchar*
tootle_dialogs_new_account_get_redirect_uri (TootleDialogsNewAccount* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_redirect_uri;
	result = _tmp0_;
	return result;
}

void
tootle_dialogs_new_account_set_redirect_uri (TootleDialogsNewAccount* self,
                                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_dialogs_new_account_get_redirect_uri (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_redirect_uri);
		self->priv->_redirect_uri = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_dialogs_new_account_properties[TOOTLE_DIALOGS_NEW_ACCOUNT_REDIRECT_URI_PROPERTY]);
	}
}

gboolean
tootle_dialogs_new_account_get_use_auto_auth (TootleDialogsNewAccount* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_use_auto_auth;
	return result;
}

void
tootle_dialogs_new_account_set_use_auto_auth (TootleDialogsNewAccount* self,
                                              gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_dialogs_new_account_get_use_auto_auth (self);
	if (old_value != value) {
		self->priv->_use_auto_auth = value;
		g_object_notify_by_pspec ((GObject *) self, tootle_dialogs_new_account_properties[TOOTLE_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY]);
	}
}

TootleInstanceAccount*
tootle_dialogs_new_account_get_account (TootleDialogsNewAccount* self)
{
	TootleInstanceAccount* result;
	TootleInstanceAccount* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_account;
	result = _tmp0_;
	return result;
}

void
tootle_dialogs_new_account_set_account (TootleDialogsNewAccount* self,
                                        TootleInstanceAccount* value)
{
	TootleInstanceAccount* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_dialogs_new_account_get_account (self);
	if (old_value != value) {
		TootleInstanceAccount* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_account);
		self->priv->_account = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_dialogs_new_account_properties[TOOTLE_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY]);
	}
}

static void
tootle_dialogs_new_account_class_init (TootleDialogsNewAccountClass * klass,
                                       gpointer klass_data)
{
	tootle_dialogs_new_account_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TootleDialogsNewAccount_private_offset);
	((GtkWidgetClass *) klass)->delete_event = (gboolean (*) (GtkWidget*, GdkEventAny*)) tootle_dialogs_new_account_real_delete_event;
	G_OBJECT_CLASS (klass)->get_property = _vala_tootle_dialogs_new_account_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tootle_dialogs_new_account_set_property;
	G_OBJECT_CLASS (klass)->finalize = tootle_dialogs_new_account_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_DIALOGS_NEW_ACCOUNT_IS_WORKING_PROPERTY, tootle_dialogs_new_account_properties[TOOTLE_DIALOGS_NEW_ACCOUNT_IS_WORKING_PROPERTY] = g_param_spec_boolean ("is-working", "is-working", "is-working", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_DIALOGS_NEW_ACCOUNT_REDIRECT_URI_PROPERTY, tootle_dialogs_new_account_properties[TOOTLE_DIALOGS_NEW_ACCOUNT_REDIRECT_URI_PROPERTY] = g_param_spec_string ("redirect-uri", "redirect-uri", "redirect-uri", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY, tootle_dialogs_new_account_properties[TOOTLE_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY] = g_param_spec_boolean ("use-auto-auth", "use-auto-auth", "use-auto-auth", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY, tootle_dialogs_new_account_properties[TOOTLE_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY] = g_param_spec_object ("account", "account", "account", TOOTLE_TYPE_INSTANCE_ACCOUNT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/com/github/bleakgrey/tootle/ui/dialogs/new_account.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "back_button", FALSE, TootleDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TootleDialogsNewAccountPrivate, back_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "next_button", FALSE, TootleDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TootleDialogsNewAccountPrivate, next_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "stack", FALSE, TootleDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TootleDialogsNewAccountPrivate, stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "instance_step", FALSE, TootleDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TootleDialogsNewAccountPrivate, instance_step));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "code_step", FALSE, TootleDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TootleDialogsNewAccountPrivate, code_step));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "done_step", FALSE, TootleDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TootleDialogsNewAccountPrivate, done_step));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "instance_entry", FALSE, TootleDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TootleDialogsNewAccountPrivate, instance_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "code_entry", FALSE, TootleDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TootleDialogsNewAccountPrivate, code_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "code_label", FALSE, TootleDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TootleDialogsNewAccountPrivate, code_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "hello_label", FALSE, TootleDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TootleDialogsNewAccountPrivate, hello_label));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_activate_code_label_link", G_CALLBACK(_tootle_dialogs_new_account_on_activate_code_label_link_gtk_label_activate_link));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_next_clicked", G_CALLBACK(_tootle_dialogs_new_account_on_next_clicked_gtk_entry_activate));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_back_clicked", G_CALLBACK(_tootle_dialogs_new_account_on_back_clicked_gtk_button_clicked));
}

static void
tootle_dialogs_new_account_instance_init (TootleDialogsNewAccount * self,
                                          gpointer klass)
{
	TootleInstanceAccount* _tmp0_;
	self->priv = tootle_dialogs_new_account_get_instance_private (self);
	self->priv->_is_working = FALSE;
	self->priv->_use_auto_auth = TRUE;
	_tmp0_ = tootle_instance_account_new_empty ("");
	self->priv->_account = _tmp0_;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
tootle_dialogs_new_account_finalize (GObject * obj)
{
	TootleDialogsNewAccount * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_DIALOGS_TYPE_NEW_ACCOUNT, TootleDialogsNewAccount);
	_g_free0 (self->priv->_redirect_uri);
	_g_object_unref0 (self->priv->_account);
	G_OBJECT_CLASS (tootle_dialogs_new_account_parent_class)->finalize (obj);
}

static GType
tootle_dialogs_new_account_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleDialogsNewAccountClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_dialogs_new_account_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TootleDialogsNewAccount), 0, (GInstanceInitFunc) tootle_dialogs_new_account_instance_init, NULL };
	GType tootle_dialogs_new_account_type_id;
	tootle_dialogs_new_account_type_id = g_type_register_static (hdy_window_get_type (), "TootleDialogsNewAccount", &g_define_type_info, 0);
	TootleDialogsNewAccount_private_offset = g_type_add_instance_private (tootle_dialogs_new_account_type_id, sizeof (TootleDialogsNewAccountPrivate));
	return tootle_dialogs_new_account_type_id;
}

GType
tootle_dialogs_new_account_get_type (void)
{
	static volatile gsize tootle_dialogs_new_account_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_dialogs_new_account_type_id__volatile)) {
		GType tootle_dialogs_new_account_type_id;
		tootle_dialogs_new_account_type_id = tootle_dialogs_new_account_get_type_once ();
		g_once_init_leave (&tootle_dialogs_new_account_type_id__volatile, tootle_dialogs_new_account_type_id);
	}
	return tootle_dialogs_new_account_type_id__volatile;
}

static void
_vala_tootle_dialogs_new_account_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec)
{
	TootleDialogsNewAccount * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_DIALOGS_TYPE_NEW_ACCOUNT, TootleDialogsNewAccount);
	switch (property_id) {
		case TOOTLE_DIALOGS_NEW_ACCOUNT_IS_WORKING_PROPERTY:
		g_value_set_boolean (value, tootle_dialogs_new_account_get_is_working (self));
		break;
		case TOOTLE_DIALOGS_NEW_ACCOUNT_REDIRECT_URI_PROPERTY:
		g_value_set_string (value, tootle_dialogs_new_account_get_redirect_uri (self));
		break;
		case TOOTLE_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY:
		g_value_set_boolean (value, tootle_dialogs_new_account_get_use_auto_auth (self));
		break;
		case TOOTLE_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY:
		g_value_set_object (value, tootle_dialogs_new_account_get_account (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tootle_dialogs_new_account_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec)
{
	TootleDialogsNewAccount * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_DIALOGS_TYPE_NEW_ACCOUNT, TootleDialogsNewAccount);
	switch (property_id) {
		case TOOTLE_DIALOGS_NEW_ACCOUNT_IS_WORKING_PROPERTY:
		tootle_dialogs_new_account_set_is_working (self, g_value_get_boolean (value));
		break;
		case TOOTLE_DIALOGS_NEW_ACCOUNT_REDIRECT_URI_PROPERTY:
		tootle_dialogs_new_account_set_redirect_uri (self, g_value_get_string (value));
		break;
		case TOOTLE_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY:
		tootle_dialogs_new_account_set_use_auto_auth (self, g_value_get_boolean (value));
		break;
		case TOOTLE_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY:
		tootle_dialogs_new_account_set_account (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gint array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gint i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gint array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gint
_vala_array_length (gpointer array)
{
	gint length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

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

