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

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

#define TUBA_DIALOGS_NEW_ACCOUNT_SHOULD_AUTO_AUTH TRUE
#define TUBA_DIALOGS_NEW_ACCOUNT_AUTO_AUTH_DESCRIPTION _ ("Allow access to your account in the browser.")
#define TUBA_DIALOGS_NEW_ACCOUNT_CODE_AUTH_DESCRIPTION _ ("Copy the authorization code from the browser and paste it below.")
#define TUBA_DIALOGS_NEW_ACCOUNT_SCOPES "read write follow push"
#define TUBA_DIALOGS_NEW_ACCOUNT_ADMIN_SCOPES "admin:read admin:write admin:read:reports admin:write:reports admin:re" \
"ad:ip_blocks admin:write:ip_blocks admin:read:domain_blocks admin:writ" \
"e:domain_blocks admin:read:domain_allows admin:write:domain_allows adm" \
"in:read:email_domain_blocks admin:write:email_domain_blocks admin:read" \
":canonical_email_blocks admin:write:canonical_email_blocks"
#define BUILD_NAME "Tuba"
#define BUILD_WEBSITE "https://codeberg.org/GeopJr/Tuba"
#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_DIALOGS_TYPE_NEW_ACCOUNT (tuba_dialogs_new_account_get_type ())
#define TUBA_DIALOGS_NEW_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_DIALOGS_TYPE_NEW_ACCOUNT, TubaDialogsNewAccount))
#define TUBA_DIALOGS_NEW_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_DIALOGS_TYPE_NEW_ACCOUNT, TubaDialogsNewAccountClass))
#define TUBA_DIALOGS_IS_NEW_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_DIALOGS_TYPE_NEW_ACCOUNT))
#define TUBA_DIALOGS_IS_NEW_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_DIALOGS_TYPE_NEW_ACCOUNT))
#define TUBA_DIALOGS_NEW_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_DIALOGS_TYPE_NEW_ACCOUNT, TubaDialogsNewAccountClass))

typedef struct _TubaDialogsNewAccount TubaDialogsNewAccount;
typedef struct _TubaDialogsNewAccountClass TubaDialogsNewAccountClass;
typedef struct _TubaDialogsNewAccountPrivate TubaDialogsNewAccountPrivate;

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

#define TUBA_WIDGETS_TYPE_LABEL_WITH_WIDGETS (tuba_widgets_label_with_widgets_get_type ())
#define TUBA_WIDGETS_LABEL_WITH_WIDGETS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_LABEL_WITH_WIDGETS, TubaWidgetsLabelWithWidgets))
#define TUBA_WIDGETS_LABEL_WITH_WIDGETS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_LABEL_WITH_WIDGETS, TubaWidgetsLabelWithWidgetsClass))
#define TUBA_WIDGETS_IS_LABEL_WITH_WIDGETS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_LABEL_WITH_WIDGETS))
#define TUBA_WIDGETS_IS_LABEL_WITH_WIDGETS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_LABEL_WITH_WIDGETS))
#define TUBA_WIDGETS_LABEL_WITH_WIDGETS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_LABEL_WITH_WIDGETS, TubaWidgetsLabelWithWidgetsClass))

typedef struct _TubaWidgetsLabelWithWidgets TubaWidgetsLabelWithWidgets;
typedef struct _TubaWidgetsLabelWithWidgetsClass TubaWidgetsLabelWithWidgetsClass;

#define TUBA_WIDGETS_TYPE_EMOJI_LABEL (tuba_widgets_emoji_label_get_type ())
#define TUBA_WIDGETS_EMOJI_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_EMOJI_LABEL, TubaWidgetsEmojiLabel))
#define TUBA_WIDGETS_EMOJI_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_EMOJI_LABEL, TubaWidgetsEmojiLabelClass))
#define TUBA_WIDGETS_IS_EMOJI_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_EMOJI_LABEL))
#define TUBA_WIDGETS_IS_EMOJI_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_EMOJI_LABEL))
#define TUBA_WIDGETS_EMOJI_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_EMOJI_LABEL, TubaWidgetsEmojiLabelClass))

typedef struct _TubaWidgetsEmojiLabel TubaWidgetsEmojiLabel;
typedef struct _TubaWidgetsEmojiLabelClass TubaWidgetsEmojiLabelClass;
enum  {
	TUBA_DIALOGS_NEW_ACCOUNT_0_PROPERTY,
	TUBA_DIALOGS_NEW_ACCOUNT_IS_WORKING_PROPERTY,
	TUBA_DIALOGS_NEW_ACCOUNT_REDIRECT_URI_PROPERTY,
	TUBA_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY,
	TUBA_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY,
	TUBA_DIALOGS_NEW_ACCOUNT_CAN_ACCESS_SETTINGS_PROPERTY,
	TUBA_DIALOGS_NEW_ACCOUNT_ADMIN_MODE_PROPERTY,
	TUBA_DIALOGS_NEW_ACCOUNT_NUM_PROPERTIES
};
static GParamSpec* tuba_dialogs_new_account_properties[TUBA_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)))
typedef enum  {
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_NONE = 1 << 0,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_QUOTE = 1 << 1,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_EMOJI_REACTIONS = 1 << 2,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_BUBBLE = 1 << 3,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_GROUP_NOTIFICATIONS = 1 << 4,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_FEATURE_TAGS = 1 << 5,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_ENDORSE_USERS = 1 << 6,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_MUTUALS = 1 << 7,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_TRANSLATION = 1 << 8,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_ICESHRIMP = 1 << 9,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_GLITCH = 1 << 10,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_LOCAL_ONLY = 1 << 11,
	TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_GOTOSOCIAL = 1 << 12
} TubaInstanceAccountInstanceFeatures;

#define TUBA_INSTANCE_ACCOUNT_TYPE_INSTANCE_FEATURES (tuba_instance_account_instance_features_get_type ())

#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_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

#define TUBA_TYPE_OOPSIE (tuba_oopsie_get_type ())
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#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;
typedef struct _TubaDialogsNewAccountStepData TubaDialogsNewAccountStepData;
#define _g_uri_unref0(var) ((var == NULL) ? NULL : (var = (g_uri_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_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 _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
typedef struct _TubaDialogsNewAccountRegisterClientData TubaDialogsNewAccountRegisterClientData;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
typedef struct _TubaDialogsNewAccountRequestTokenData TubaDialogsNewAccountRequestTokenData;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))

#define TUBA_DIALOGS_NEW_ACCOUNT_TYPE_SETTINGS_DIALOG (tuba_dialogs_new_account_settings_dialog_get_type ())
#define TUBA_DIALOGS_NEW_ACCOUNT_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_DIALOGS_NEW_ACCOUNT_TYPE_SETTINGS_DIALOG, TubaDialogsNewAccountSettingsDialog))
#define TUBA_DIALOGS_NEW_ACCOUNT_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_DIALOGS_NEW_ACCOUNT_TYPE_SETTINGS_DIALOG, TubaDialogsNewAccountSettingsDialogClass))
#define TUBA_DIALOGS_NEW_ACCOUNT_IS_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_DIALOGS_NEW_ACCOUNT_TYPE_SETTINGS_DIALOG))
#define TUBA_DIALOGS_NEW_ACCOUNT_IS_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_DIALOGS_NEW_ACCOUNT_TYPE_SETTINGS_DIALOG))
#define TUBA_DIALOGS_NEW_ACCOUNT_SETTINGS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_DIALOGS_NEW_ACCOUNT_TYPE_SETTINGS_DIALOG, TubaDialogsNewAccountSettingsDialogClass))

typedef struct _TubaDialogsNewAccountSettingsDialog TubaDialogsNewAccountSettingsDialog;
typedef struct _TubaDialogsNewAccountSettingsDialogClass TubaDialogsNewAccountSettingsDialogClass;

#define TUBA_TYPE_SETTINGS (tuba_settings_get_type ())
#define TUBA_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_SETTINGS, TubaSettings))
#define TUBA_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_SETTINGS, TubaSettingsClass))
#define TUBA_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_SETTINGS))
#define TUBA_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_SETTINGS))
#define TUBA_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_SETTINGS, TubaSettingsClass))

typedef struct _TubaSettings TubaSettings;
typedef struct _TubaSettingsClass TubaSettingsClass;
typedef struct _TubaDialogsNewAccountSettingsDialogPrivate TubaDialogsNewAccountSettingsDialogPrivate;
enum  {
	TUBA_DIALOGS_NEW_ACCOUNT_SETTINGS_DIALOG_0_PROPERTY,
	TUBA_DIALOGS_NEW_ACCOUNT_SETTINGS_DIALOG_NUM_PROPERTIES
};
static GParamSpec* tuba_dialogs_new_account_settings_dialog_properties[TUBA_DIALOGS_NEW_ACCOUNT_SETTINGS_DIALOG_NUM_PROPERTIES];
enum  {
	TUBA_DIALOGS_NEW_ACCOUNT_SETTINGS_DIALOG_ADMIN_CHANGED_SIGNAL,
	TUBA_DIALOGS_NEW_ACCOUNT_SETTINGS_DIALOG_NUM_SIGNALS
};
static guint tuba_dialogs_new_account_settings_dialog_signals[TUBA_DIALOGS_NEW_ACCOUNT_SETTINGS_DIALOG_NUM_SIGNALS] = {0};

struct _TubaDialogsNewAccount {
	AdwWindow parent_instance;
	TubaDialogsNewAccountPrivate * priv;
};

struct _TubaDialogsNewAccountClass {
	AdwWindowClass parent_class;
};

struct _TubaDialogsNewAccountPrivate {
	gboolean _is_working;
	gchar* _redirect_uri;
	gboolean _use_auto_auth;
	TubaInstanceAccount* _account;
	gboolean _can_access_settings;
	gboolean _admin_mode;
	TubaInstanceAccount* _updating_account;
	AdwToastOverlay* toast_overlay;
	AdwNavigationView* deck;
	AdwNavigationPage* instance_step;
	AdwNavigationPage* code_step;
	AdwNavigationPage* done_step;
	AdwEntryRow* instance_entry;
	GtkLabel* instance_entry_error;
	AdwEntryRow* code_entry;
	GtkLabel* code_entry_error;
	AdwStatusPage* auth_page;
	TubaWidgetsEmojiLabel* done_page_emoji_label;
	GtkLabel* manual_auth_label;
};

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 _TubaDialogsNewAccountStepData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TubaDialogsNewAccount* self;
	AdwNavigationView* _tmp0_;
	AdwNavigationPage* _tmp1_;
	AdwNavigationPage* _tmp2_;
	AdwNavigationPage* _tmp3_;
	TubaAccountStore* _tmp4_;
	TubaInstanceAccount* _tmp5_;
	gboolean _tmp6_;
	TubaInstanceAccount* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	TubaInstanceAccount* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	GError* _inner_error0_;
};

struct _TubaDialogsNewAccountRegisterClientData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TubaDialogsNewAccount* self;
	TubaRequestV2* msg;
	TubaInstanceAccount* _tmp0_;
	TubaInstanceAccount* _tmp1_;
	TubaRequestV2* _tmp2_;
	TubaRequestV2* _tmp3_;
	TubaRequestV2* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	TubaRequestV2* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	TubaRequestV2* _tmp10_;
	GInputStream* in_stream;
	TubaRequestV2* _tmp11_;
	GInputStream* _tmp12_;
	JsonParser* parser;
	GInputStream* _tmp13_;
	JsonParser* _tmp14_;
	JsonObject* root;
	TubaNetwork* _tmp15_;
	JsonParser* _tmp16_;
	JsonObject* _tmp17_;
	JsonObject* _tmp18_;
	const gchar* _tmp19_;
	GError* _tmp20_;
	TubaInstanceAccount* _tmp21_;
	JsonObject* _tmp22_;
	const gchar* _tmp23_;
	TubaInstanceAccount* _tmp24_;
	JsonObject* _tmp25_;
	const gchar* _tmp26_;
	AdwNavigationView* _tmp27_;
	AdwNavigationPage* _tmp28_;
	AdwNavigationPage* _tmp29_;
	AdwNavigationPage* _tmp30_;
	AdwNavigationView* _tmp31_;
	AdwNavigationPage* _tmp32_;
	TubaInstanceAccount* _tmp33_;
	AdwNavigationView* _tmp34_;
	AdwNavigationPage* _tmp35_;
	GError* _inner_error0_;
};

struct _TubaDialogsNewAccountRequestTokenData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TubaDialogsNewAccount* self;
	AdwEntryRow* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GError* _tmp3_;
	TubaRequestV2* token_req;
	TubaInstanceAccount* _tmp4_;
	TubaInstanceAccount* _tmp5_;
	TubaRequestV2* _tmp6_;
	TubaRequestV2* _tmp7_;
	TubaInstanceAccount* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	TubaRequestV2* _tmp11_;
	TubaInstanceAccount* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	TubaRequestV2* _tmp15_;
	const gchar* _tmp16_;
	TubaRequestV2* _tmp17_;
	TubaRequestV2* _tmp18_;
	AdwEntryRow* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	GInputStream* in_stream;
	TubaRequestV2* _tmp22_;
	GInputStream* _tmp23_;
	JsonParser* parser;
	GInputStream* _tmp24_;
	JsonParser* _tmp25_;
	JsonObject* root;
	TubaNetwork* _tmp26_;
	JsonParser* _tmp27_;
	JsonObject* _tmp28_;
	TubaInstanceAccount* _tmp29_;
	JsonObject* _tmp30_;
	const gchar* _tmp31_;
	TubaInstanceAccount* _tmp32_;
	const gchar* _tmp33_;
	const gchar* _tmp34_;
	GError* _tmp35_;
	TubaInstanceAccount* _tmp36_;
	TubaInstanceAccount* _tmp37_;
	gboolean _tmp38_;
	TubaInstanceAccount* _tmp39_;
	TubaAccountStore* _tmp40_;
	TubaInstanceAccount* _tmp41_;
	TubaInstanceAccount* _tmp42_;
	TubaInstanceAccount* _tmp43_;
	TubaInstanceAccount* _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	TubaInstanceAccount* _tmp47_;
	TubaInstanceAccount* _tmp48_;
	const gchar* _tmp49_;
	const gchar* _tmp50_;
	TubaInstanceAccount* _tmp51_;
	TubaInstanceAccount* _tmp52_;
	const gchar* _tmp53_;
	const gchar* _tmp54_;
	TubaInstanceAccount* _tmp55_;
	TubaInstanceAccount* _tmp56_;
	gboolean _tmp57_;
	gboolean _tmp58_;
	TubaInstanceAccount* _tmp59_;
	TubaInstanceAccount* _tmp60_;
	const gchar* _tmp61_;
	const gchar* _tmp62_;
	TubaAccountStore* _tmp63_;
	TubaInstanceAccount* _tmp64_;
	TubaInstanceAccount* _tmp65_;
	TubaInstanceAccount* _tmp66_;
	TubaAccountStore* _tmp67_;
	TubaInstanceAccount* _tmp68_;
	JsonNode* _tmp69_;
	JsonNode* _tmp70_;
	TubaInstanceAccount* _tmp71_;
	TubaInstanceAccountInstanceFeatures _tmp72_;
	TubaInstanceAccountInstanceFeatures _tmp73_;
	TubaInstanceAccount* _tmp74_;
	TubaInstanceAccount* _tmp75_;
	TubaAccountStore* _tmp76_;
	TubaInstanceAccount* _tmp77_;
	TubaWidgetsEmojiLabel* _tmp78_;
	TubaInstanceAccount* _tmp79_;
	GeeHashMap* _tmp80_;
	GeeHashMap* _tmp81_;
	GeeHashMap* _tmp82_;
	TubaWidgetsEmojiLabel* _tmp83_;
	TubaInstanceAccount* _tmp84_;
	const gchar* _tmp85_;
	const gchar* _tmp86_;
	gchar* _tmp87_;
	gchar* _tmp88_;
	AdwNavigationView* _tmp89_;
	AdwNavigationPage* _tmp90_;
	TubaAccountStore* _tmp91_;
	TubaInstanceAccount* _tmp92_;
	GError* _inner_error0_;
};

struct _TubaDialogsNewAccountSettingsDialog {
	AdwDialog parent_instance;
	TubaDialogsNewAccountSettingsDialogPrivate * priv;
};

struct _TubaDialogsNewAccountSettingsDialogClass {
	AdwDialogClass parent_class;
};

struct _TubaDialogsNewAccountSettingsDialogPrivate {
	AdwEntryRow* proxy_entry;
	AdwSwitchRow* admin_row;
	GtkButton* apply_button;
	gboolean original_admin_val;
};

static gint TubaDialogsNewAccount_private_offset;
static gpointer tuba_dialogs_new_account_parent_class = NULL;
VALA_EXTERN TubaApplication* tuba_app;
VALA_EXTERN TubaAccountStore* tuba_accounts;
VALA_EXTERN TubaNetwork* tuba_network;
VALA_EXTERN TubaSettings* tuba_settings;
static gint TubaDialogsNewAccountSettingsDialog_private_offset;
static gpointer tuba_dialogs_new_account_settings_dialog_parent_class = NULL;

VALA_EXTERN GType tuba_dialogs_new_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaDialogsNewAccount, g_object_unref)
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_widgets_label_with_widgets_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsLabelWithWidgets, g_object_unref)
VALA_EXTERN GType tuba_widgets_emoji_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsEmojiLabel, g_object_unref)
VALA_EXTERN TubaInstanceAccount* tuba_instance_account_new_empty (const gchar* instance);
VALA_EXTERN TubaInstanceAccount* tuba_instance_account_construct_empty (GType object_type,
                                                            const gchar* instance);
VALA_EXTERN gchar* tuba_dialogs_new_account_get_full_scopes (TubaDialogsNewAccount* self);
VALA_EXTERN gboolean tuba_dialogs_new_account_get_admin_mode (TubaDialogsNewAccount* self);
VALA_EXTERN TubaInstanceAccount* tuba_dialogs_new_account_get_account (TubaDialogsNewAccount* self);
VALA_EXTERN GType tuba_instance_account_instance_features_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TubaInstanceAccountInstanceFeatures tuba_instance_account_get_tuba_instance_features (TubaInstanceAccount* self);
VALA_EXTERN TubaDialogsNewAccount* tuba_dialogs_new_account_new (gboolean can_access_settings,
                                                     TubaInstanceAccount* account_to_update);
VALA_EXTERN TubaDialogsNewAccount* tuba_dialogs_new_account_construct (GType object_type,
                                                           gboolean can_access_settings,
                                                           TubaInstanceAccount* account_to_update);
VALA_EXTERN GType tuba_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaApplication, g_object_unref)
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 void tuba_dialogs_new_account_set_can_access_settings (TubaDialogsNewAccount* self,
                                                       gboolean value);
VALA_EXTERN void tuba_application_set_add_account_window (TubaApplication* self,
                                              TubaDialogsNewAccount* value);
static gboolean __lambda199_ (TubaDialogsNewAccount* self,
                       GBinding* b,
                       GValue* src,
                       GValue* target);
static gboolean ___lambda199__gbinding_transform_func (GBinding* binding,
                                                GValue* from_value,
                                                GValue* to_value,
                                                gpointer self);
static void tuba_dialogs_new_account_add_toast (TubaDialogsNewAccount* self,
                                         const gchar* content,
                                         guint timeout,
                                         const gchar* action_name,
                                         GVariant* action_target,
                                         const gchar* action_label);
static void _tuba_dialogs_new_account_add_toast_tuba_application_toast (TubaApplication* _sender,
                                                                 const gchar* title,
                                                                 guint timeout,
                                                                 const gchar* action_name,
                                                                 GVariant* action_target,
                                                                 const gchar* action_label,
                                                                 gpointer self);
VALA_EXTERN gboolean tuba_dialogs_new_account_on_manual_auth (TubaDialogsNewAccount* self,
                                                  const gchar* url);
static gboolean _tuba_dialogs_new_account_on_manual_auth_gtk_label_activate_link (GtkLabel* _sender,
                                                                           const gchar* uri,
                                                                           gpointer self);
static void tuba_dialogs_new_account_set_updating_account (TubaDialogsNewAccount* self,
                                                    TubaInstanceAccount* value);
static void tuba_dialogs_new_account_reset (TubaDialogsNewAccount* self);
static TubaInstanceAccount* tuba_dialogs_new_account_get_updating_account (TubaDialogsNewAccount* self);
VALA_EXTERN const gchar* tuba_instance_account_get_instance (TubaInstanceAccount* self);
static void tuba_dialogs_new_account_on_next_clicked (TubaDialogsNewAccount* self);
VALA_EXTERN void tuba_dialogs_new_account_set_use_auto_auth (TubaDialogsNewAccount* self,
                                                 gboolean value);
static void tuba_dialogs_new_account_register_client (TubaDialogsNewAccount* self,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static void tuba_dialogs_new_account_register_client_finish (TubaDialogsNewAccount* self,
                                                      GAsyncResult* _res_,
                                                      GError** error);
static gboolean tuba_dialogs_new_account_real_close_request (GtkWindow* base);
static gchar* tuba_dialogs_new_account_setup_redirect_uri (TubaDialogsNewAccount* self);
VALA_EXTERN gboolean tuba_dialogs_new_account_get_use_auto_auth (TubaDialogsNewAccount* self);
VALA_EXTERN GQuark tuba_oopsie_quark (void);
VALA_EXTERN GType tuba_oopsie_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void tuba_dialogs_new_account_clear_errors (TubaDialogsNewAccount* self);
VALA_EXTERN void tuba_dialogs_new_account_set_account (TubaDialogsNewAccount* self,
                                           TubaInstanceAccount* value);
static void tuba_dialogs_new_account_oopsie (TubaDialogsNewAccount* self,
                                      const gchar* title,
                                      const gchar* msg);
VALA_EXTERN AdwAlertDialog* tuba_application_inform (TubaApplication* self,
                                         const gchar* text,
                                         const gchar* msg);
static void tuba_dialogs_new_account_step_data_free (gpointer _data);
static void tuba_dialogs_new_account_step (TubaDialogsNewAccount* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static void tuba_dialogs_new_account_step_finish (TubaDialogsNewAccount* self,
                                           GAsyncResult* _res_,
                                           GError** error);
static gboolean tuba_dialogs_new_account_step_co (TubaDialogsNewAccountStepData* _data_);
static void tuba_dialogs_new_account_setup_instance (TubaDialogsNewAccount* self,
                                              GError** error);
VALA_EXTERN GType tuba_account_store_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAccountStore, g_object_unref)
VALA_EXTERN void tuba_account_store_guess_backend (TubaAccountStore* self,
                                       TubaInstanceAccount* account,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
VALA_EXTERN void tuba_account_store_guess_backend_finish (TubaAccountStore* self,
                                              GAsyncResult* _res_,
                                              GError** error);
static void tuba_dialogs_new_account_step_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
VALA_EXTERN const gchar* tuba_instance_account_get_client_secret (TubaInstanceAccount* self);
VALA_EXTERN const gchar* tuba_instance_account_get_client_id (TubaInstanceAccount* self);
static void tuba_dialogs_new_account_request_token (TubaDialogsNewAccount* self,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static void tuba_dialogs_new_account_request_token_finish (TubaDialogsNewAccount* self,
                                                    GAsyncResult* _res_,
                                                    GError** error);
VALA_EXTERN void tuba_instance_account_set_instance (TubaInstanceAccount* self,
                                         const gchar* value);
static void tuba_dialogs_new_account_register_client_data_free (gpointer _data);
static gboolean tuba_dialogs_new_account_register_client_co (TubaDialogsNewAccountRegisterClientData* _data_);
VALA_EXTERN GType tuba_request_v2_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaRequestV2, g_object_unref)
VALA_EXTERN GType tuba_request_v2_method_get_type (void) G_GNUC_CONST ;
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_add_form_data (TubaRequestV2* self,
                                    const gchar* name,
                                    const gchar* val);
VALA_EXTERN void tuba_dialogs_new_account_set_redirect_uri (TubaDialogsNewAccount* self,
                                                const gchar* value);
VALA_EXTERN void tuba_request_v2_exec (TubaRequestV2* self,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_);
VALA_EXTERN GInputStream* tuba_request_v2_exec_finish (TubaRequestV2* self,
                                           GAsyncResult* _res_,
                                           SoupMessageHeaders** response_headers,
                                           GError** error);
static void tuba_dialogs_new_account_register_client_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 JsonObject* tuba_network_parse (TubaNetwork* self,
                                JsonParser* parser);
VALA_EXTERN void tuba_instance_account_set_client_id (TubaInstanceAccount* self,
                                          const gchar* value);
VALA_EXTERN void tuba_instance_account_set_client_secret (TubaInstanceAccount* self,
                                              const gchar* value);
static void tuba_dialogs_new_account_open_confirmation_page (TubaDialogsNewAccount* self);
VALA_EXTERN const gchar* tuba_dialogs_new_account_get_redirect_uri (TubaDialogsNewAccount* self);
VALA_EXTERN void tuba_utils_host_open_url (const gchar* _uri,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_);
VALA_EXTERN gboolean tuba_utils_host_open_url_finish (GAsyncResult* _res_);
static void tuba_dialogs_new_account_request_token_data_free (gpointer _data);
static gboolean tuba_dialogs_new_account_request_token_co (TubaDialogsNewAccountRequestTokenData* _data_);
static void tuba_dialogs_new_account_request_token_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
VALA_EXTERN void tuba_instance_account_set_access_token (TubaInstanceAccount* self,
                                             const gchar* value);
VALA_EXTERN const gchar* tuba_instance_account_get_access_token (TubaInstanceAccount* self);
VALA_EXTERN void tuba_instance_account_verify_credentials (TubaInstanceAccount* self,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
VALA_EXTERN void tuba_instance_account_verify_credentials_finish (TubaInstanceAccount* self,
                                                      GAsyncResult* _res_,
                                                      GError** error);
VALA_EXTERN void tuba_instance_account_set_admin_mode (TubaInstanceAccount* self,
                                           gboolean value);
VALA_EXTERN void tuba_account_store_revoke_token_dangerous (TubaAccountStore* self,
                                                TubaInstanceAccount* account,
                                                gboolean should_handle_error,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
VALA_EXTERN void tuba_account_store_revoke_token_dangerous_finish (TubaAccountStore* self,
                                                       GAsyncResult* _res_);
VALA_EXTERN void tuba_instance_account_set_tuba_revoked (TubaInstanceAccount* self,
                                             gboolean value);
VALA_EXTERN gboolean tuba_instance_account_get_admin_mode (TubaInstanceAccount* self);
VALA_EXTERN const gchar* tuba_instance_account_get_backend (TubaInstanceAccount* self);
VALA_EXTERN void tuba_instance_account_set_backend (TubaInstanceAccount* self,
                                        const gchar* value);
VALA_EXTERN void tuba_account_store_update_account (TubaAccountStore* self,
                                        TubaInstanceAccount* account,
                                        GError** error);
VALA_EXTERN TubaInstanceAccount* tuba_account_store_create_account (TubaAccountStore* self,
                                                        JsonNode* node,
                                                        TubaInstanceAccountInstanceFeatures* instance_features,
                                                        GError** error);
VALA_EXTERN JsonNode* tuba_entity_to_json (TubaEntity* self);
static void _vala_JsonNode_free (JsonNode* self);
VALA_EXTERN void tuba_account_store_add (TubaAccountStore* self,
                             TubaInstanceAccount* account,
                             GError** error);
VALA_EXTERN GeeHashMap* tuba_api_account_get_emojis_map (TubaAPIAccount* self);
VALA_EXTERN void tuba_widgets_emoji_label_set_instance_emojis (TubaWidgetsEmojiLabel* self,
                                                   GeeHashMap* value);
VALA_EXTERN const gchar* tuba_api_account_get_display_name (TubaAPIAccount* self);
VALA_EXTERN void tuba_widgets_emoji_label_set_content (TubaWidgetsEmojiLabel* self,
                                           const gchar* value);
VALA_EXTERN void tuba_account_store_activate (TubaAccountStore* self,
                                  TubaInstanceAccount* account,
                                  gboolean clear_cache);
VALA_EXTERN void tuba_dialogs_new_account_redirect (TubaDialogsNewAccount* self,
                                        GUri* uri);
VALA_EXTERN void tuba_dialogs_new_account_set_is_working (TubaDialogsNewAccount* self,
                                              gboolean value);
VALA_EXTERN void tuba_dialogs_new_account_mark_errors (TubaDialogsNewAccount* self,
                                           const gchar* error_message);
static void _tuba_dialogs_new_account_clear_errors_gtk_editable_changed (GtkEditable* _sender,
                                                                  gpointer self);
VALA_EXTERN gboolean tuba_dialogs_new_account_get_is_working (TubaDialogsNewAccount* self);
static void __lambda201_ (TubaDialogsNewAccount* self,
                   GObject* obj,
                   GAsyncResult* res);
static void ___lambda201__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void _tuba_dialogs_new_account_on_next_clicked_adw_entry_row_entry_activated (AdwEntryRow* _sender,
                                                                              gpointer self);
static void tuba_dialogs_new_account_on_done_clicked (TubaDialogsNewAccount* self);
VALA_EXTERN void tuba_application_present_window (TubaApplication* self,
                                      gboolean destroy_main);
static void _tuba_dialogs_new_account_on_done_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                   gpointer self);
static void tuba_dialogs_new_account_on_back_clicked (TubaDialogsNewAccount* self);
static void _tuba_dialogs_new_account_on_back_clicked_adw_navigation_view_popped (AdwNavigationView* _sender,
                                                                           AdwNavigationPage* page,
                                                                           gpointer self);
static void tuba_dialogs_new_account_on_settings_clicked (TubaDialogsNewAccount* self);
static GType tuba_dialogs_new_account_settings_dialog_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaDialogsNewAccountSettingsDialog, g_object_unref)
VALA_EXTERN gboolean tuba_dialogs_new_account_get_can_access_settings (TubaDialogsNewAccount* self);
VALA_EXTERN GType tuba_settings_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaSettings, g_object_unref)
VALA_EXTERN const gchar* tuba_settings_get_proxy (TubaSettings* self);
static TubaDialogsNewAccountSettingsDialog* tuba_dialogs_new_account_settings_dialog_new (gboolean can_access_settings,
                                                                                   const gchar* proxy_val,
                                                                                   gboolean admin_val);
static TubaDialogsNewAccountSettingsDialog* tuba_dialogs_new_account_settings_dialog_construct (GType object_type,
                                                                                         gboolean can_access_settings,
                                                                                         const gchar* proxy_val,
                                                                                         gboolean admin_val);
static void tuba_dialogs_new_account_on_admin_change (TubaDialogsNewAccount* self,
                                               gboolean new_val);
static void _tuba_dialogs_new_account_on_admin_change_tuba_dialogs_new_account_settings_dialog_admin_changed (TubaDialogsNewAccountSettingsDialog* _sender,
                                                                                                       gboolean new_admin_val,
                                                                                                       gpointer self);
static void _tuba_dialogs_new_account_on_settings_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                       gpointer self);
VALA_EXTERN void tuba_dialogs_new_account_set_admin_mode (TubaDialogsNewAccount* self,
                                              gboolean value);
static void tuba_dialogs_new_account_settings_dialog_modified (TubaDialogsNewAccountSettingsDialog* self);
static void _tuba_dialogs_new_account_settings_dialog_modified_g_object_notify (GObject* _sender,
                                                                         GParamSpec* pspec,
                                                                         gpointer self);
static void _tuba_dialogs_new_account_settings_dialog_modified_gtk_editable_changed (GtkEditable* _sender,
                                                                              gpointer self);
static void tuba_dialogs_new_account_settings_dialog_on_cancel (TubaDialogsNewAccountSettingsDialog* self);
static void tuba_dialogs_new_account_settings_dialog_on_apply (TubaDialogsNewAccountSettingsDialog* self);
VALA_EXTERN void tuba_settings_set_proxy (TubaSettings* self,
                              const gchar* value);
static GObject * tuba_dialogs_new_account_settings_dialog_constructor (GType type,
                                                                guint n_construct_properties,
                                                                GObjectConstructParam * construct_properties);
static void _tuba_dialogs_new_account_settings_dialog_on_cancel_gtk_button_clicked (GtkButton* _sender,
                                                                             gpointer self);
static void _tuba_dialogs_new_account_settings_dialog_on_apply_gtk_button_clicked (GtkButton* _sender,
                                                                            gpointer self);
static void tuba_dialogs_new_account_settings_dialog_finalize (GObject * obj);
static GType tuba_dialogs_new_account_settings_dialog_get_type_once (void);
static void tuba_dialogs_new_account_finalize (GObject * obj);
static GType tuba_dialogs_new_account_get_type_once (void);
static void _vala_tuba_dialogs_new_account_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_tuba_dialogs_new_account_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
tuba_dialogs_new_account_get_instance_private (TubaDialogsNewAccount* self)
{
	return G_STRUCT_MEMBER_P (self, TubaDialogsNewAccount_private_offset);
}

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

gchar*
tuba_dialogs_new_account_get_full_scopes (TubaDialogsNewAccount* self)
{
	gchar* scopes = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp6_ = FALSE;
	TubaInstanceAccount* _tmp7_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (TUBA_DIALOGS_NEW_ACCOUNT_SCOPES);
	scopes = _tmp0_;
	_tmp1_ = self->priv->_admin_mode;
	if (_tmp1_) {
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp2_ = scopes;
		_tmp3_ = string_to_string (_tmp2_);
		_tmp4_ = string_to_string (TUBA_DIALOGS_NEW_ACCOUNT_ADMIN_SCOPES);
		_tmp5_ = g_strconcat (_tmp3_, " ", _tmp4_, NULL);
		_g_free0 (scopes);
		scopes = _tmp5_;
	}
	_tmp7_ = self->priv->_account;
	if (_tmp7_ != NULL) {
		TubaInstanceAccount* _tmp8_;
		TubaInstanceAccountInstanceFeatures _tmp9_;
		TubaInstanceAccountInstanceFeatures _tmp10_;
		_tmp8_ = self->priv->_account;
		_tmp9_ = tuba_instance_account_get_tuba_instance_features (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp6_ = (_tmp10_ & TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_ICESHRIMP) == TUBA_INSTANCE_ACCOUNT_INSTANCE_FEATURES_ICESHRIMP;
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp11_ = scopes;
		_tmp12_ = string_to_string (_tmp11_);
		_tmp13_ = g_strconcat (_tmp12_, " iceshrimp", NULL);
		_g_free0 (scopes);
		scopes = _tmp13_;
	}
	result = scopes;
	return result;
}

static gboolean
__lambda199_ (TubaDialogsNewAccount* self,
              GBinding* b,
              GValue* src,
              GValue* target)
{
	const gchar* _tmp0_ = NULL;
	gboolean result;
	g_return_val_if_fail (b != NULL, FALSE);
	g_return_val_if_fail (src != NULL, FALSE);
	g_return_val_if_fail (target != NULL, FALSE);
	if (g_value_get_boolean (src)) {
		_tmp0_ = TUBA_DIALOGS_NEW_ACCOUNT_AUTO_AUTH_DESCRIPTION;
	} else {
		_tmp0_ = TUBA_DIALOGS_NEW_ACCOUNT_CODE_AUTH_DESCRIPTION;
	}
	g_value_set_string (target, _tmp0_);
	result = TRUE;
	return result;
}

static gboolean
___lambda199__gbinding_transform_func (GBinding* binding,
                                       GValue* from_value,
                                       GValue* to_value,
                                       gpointer self)
{
	gboolean result;
	result = __lambda199_ ((TubaDialogsNewAccount*) self, binding, from_value, to_value);
	return result;
}

static void
_tuba_dialogs_new_account_add_toast_tuba_application_toast (TubaApplication* _sender,
                                                            const gchar* title,
                                                            guint timeout,
                                                            const gchar* action_name,
                                                            GVariant* action_target,
                                                            const gchar* action_label,
                                                            gpointer self)
{
	tuba_dialogs_new_account_add_toast ((TubaDialogsNewAccount*) self, title, timeout, action_name, action_target, action_label);
}

static gboolean
_tuba_dialogs_new_account_on_manual_auth_gtk_label_activate_link (GtkLabel* _sender,
                                                                  const gchar* uri,
                                                                  gpointer self)
{
	gboolean result;
	result = tuba_dialogs_new_account_on_manual_auth ((TubaDialogsNewAccount*) self, uri);
	return result;
}

TubaDialogsNewAccount*
tuba_dialogs_new_account_construct (GType object_type,
                                    gboolean can_access_settings,
                                    TubaInstanceAccount* account_to_update)
{
	TubaDialogsNewAccount * self = NULL;
	TubaApplication* _tmp0_;
	TubaDialogsMainWindow* _tmp1_;
	TubaDialogsMainWindow* _tmp2_;
	TubaApplication* _tmp3_;
	TubaApplication* _tmp4_;
	AdwStatusPage* _tmp5_;
	GtkLabel* _tmp7_;
	AdwEntryRow* _tmp8_;
	TubaInstanceAccount* _tmp9_;
	_tmp0_ = tuba_app;
	_tmp1_ = tuba_application_get_main_window (_tmp0_);
	_tmp2_ = _tmp1_;
	self = (TubaDialogsNewAccount*) g_object_new (object_type, "transient-for", _tmp2_, NULL);
	tuba_dialogs_new_account_set_can_access_settings (self, can_access_settings);
	_tmp3_ = tuba_app;
	tuba_application_set_add_account_window (_tmp3_, self);
	_tmp4_ = tuba_app;
	gtk_application_add_window ((GtkApplication*) _tmp4_, (GtkWindow*) self);
	_tmp5_ = self->priv->auth_page;
	g_object_bind_property_with_closures ((GObject*) self, "use-auto-auth", (GObject*) _tmp5_, "description", G_BINDING_SYNC_CREATE, (GClosure*) ((___lambda199__gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda199__gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	if (!can_access_settings) {
		TubaApplication* _tmp6_;
		_tmp6_ = tuba_app;
		g_signal_connect_object (_tmp6_, "toast", (GCallback) _tuba_dialogs_new_account_add_toast_tuba_application_toast, self, 0);
	} else {
		gtk_widget_class_add_binding_action (G_TYPE_INSTANCE_GET_CLASS (self, gtk_widget_get_type (), GtkWidgetClass), GDK_KEY_Escape, 0, "window.close", NULL, NULL);
	}
	_tmp7_ = self->priv->manual_auth_label;
	g_signal_connect_object (_tmp7_, "activate-link", (GCallback) _tuba_dialogs_new_account_on_manual_auth_gtk_label_activate_link, self, 0);
	if (account_to_update != NULL) {
		tuba_dialogs_new_account_set_updating_account (self, account_to_update);
	}
	tuba_dialogs_new_account_reset (self);
	gtk_window_present ((GtkWindow*) self);
	_tmp8_ = self->priv->instance_entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp8_);
	_tmp9_ = self->priv->_updating_account;
	if (_tmp9_ != NULL) {
		AdwEntryRow* _tmp10_;
		TubaInstanceAccount* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		_tmp10_ = self->priv->instance_entry;
		_tmp11_ = self->priv->_updating_account;
		_tmp12_ = tuba_instance_account_get_instance (_tmp11_);
		_tmp13_ = _tmp12_;
		gtk_editable_set_text ((GtkEditable*) _tmp10_, _tmp13_);
		tuba_dialogs_new_account_on_next_clicked (self);
	}
	return self;
}

TubaDialogsNewAccount*
tuba_dialogs_new_account_new (gboolean can_access_settings,
                              TubaInstanceAccount* account_to_update)
{
	return tuba_dialogs_new_account_construct (TUBA_DIALOGS_TYPE_NEW_ACCOUNT, can_access_settings, account_to_update);
}

static gpointer
_g_variant_ref0 (gpointer self)
{
	return self ? g_variant_ref (self) : NULL;
}

static void
tuba_dialogs_new_account_add_toast (TubaDialogsNewAccount* self,
                                    const gchar* content,
                                    guint timeout,
                                    const gchar* action_name,
                                    GVariant* action_target,
                                    const gchar* action_label)
{
	AdwToastOverlay* _tmp0_;
	gchar* _tmp1_;
	GVariant* _tmp2_;
	gchar* _tmp3_;
	AdwToast* _tmp4_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content != NULL);
	_tmp0_ = self->priv->toast_overlay;
	_tmp1_ = g_strdup (action_name);
	_tmp2_ = _g_variant_ref0 (action_target);
	_tmp3_ = g_strdup (action_label);
	_tmp4_ = adw_toast_new (content);
	adw_toast_set_timeout (_tmp4_, timeout);
	adw_toast_set_action_name (_tmp4_, _tmp1_);
	_g_free0 (_tmp1_);
	g_object_set (_tmp4_, "action-target", _tmp2_, NULL);
	_g_variant_unref0 (_tmp2_);
	adw_toast_set_button_label (_tmp4_, _tmp3_);
	_g_free0 (_tmp3_);
	adw_toast_overlay_add_toast (_tmp0_, _tmp4_);
}

gboolean
tuba_dialogs_new_account_on_manual_auth (TubaDialogsNewAccount* self,
                                         const gchar* url)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (url != NULL, FALSE);
	if (g_strcmp0 (url, "manual_auth") == 0) {
		tuba_dialogs_new_account_set_use_auto_auth (self, FALSE);
		tuba_dialogs_new_account_register_client (self, NULL, NULL);
	} else {
		const gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp0_ = string_to_string (url);
		_tmp1_ = g_strconcat ("Expected \"manual_auth\", instead got \"", _tmp0_, "\"", NULL);
		_tmp2_ = _tmp1_;
		g_warning ("NewAccount.vala:107: %s", _tmp2_);
		_g_free0 (_tmp2_);
	}
	result = TRUE;
	return result;
}

static gboolean
tuba_dialogs_new_account_real_close_request (GtkWindow* base)
{
	TubaDialogsNewAccount * self;
	TubaApplication* _tmp0_;
	gboolean result;
	self = (TubaDialogsNewAccount*) base;
	g_warning ("NewAccount.vala:114: Close Request");
	_tmp0_ = tuba_app;
	tuba_application_set_add_account_window (_tmp0_, NULL);
	result = GTK_WINDOW_CLASS (tuba_dialogs_new_account_parent_class)->close_request ((GtkWindow*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_window_get_type (), AdwWindow));
	return result;
}

static gchar*
tuba_dialogs_new_account_setup_redirect_uri (TubaDialogsNewAccount* self)
{
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	{
		gboolean _tmp0_;
		gchar* _tmp2_;
		_tmp0_ = self->priv->_use_auto_auth;
		if (!_tmp0_) {
			GError* _tmp1_;
			_tmp1_ = g_error_new_literal (TUBA_OOPSIE, TUBA_OOPSIE_INTERNAL, "Using manual auth method");
			_inner_error0_ = _tmp1_;
			goto __catch0_g_error;
		}
		_tmp2_ = g_strdup ("tuba://auth_code");
		result = _tmp2_;
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		g_warning ("NewAccount.vala:126: %s", _tmp4_);
		tuba_dialogs_new_account_set_use_auto_auth (self, FALSE);
		_tmp5_ = g_strdup ("urn:ietf:wg:oauth:2.0:oob");
		result = _tmp5_;
		_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 void
tuba_dialogs_new_account_reset (TubaDialogsNewAccount* self)
{
	TubaInstanceAccount* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	TubaInstanceAccount* _tmp3_;
	TubaInstanceAccount* _tmp4_;
	TubaInstanceAccount* _tmp5_;
	g_return_if_fail (self != NULL);
	g_debug ("NewAccount.vala:133: Reset state");
	tuba_dialogs_new_account_clear_errors (self);
	tuba_dialogs_new_account_set_use_auto_auth (self, TUBA_DIALOGS_NEW_ACCOUNT_SHOULD_AUTO_AUTH);
	_tmp0_ = self->priv->_account;
	_tmp1_ = tuba_instance_account_get_instance (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = tuba_instance_account_new_empty (_tmp2_);
	_tmp4_ = _tmp3_;
	tuba_dialogs_new_account_set_account (self, _tmp4_);
	_g_object_unref0 (_tmp4_);
	_tmp5_ = self->priv->_updating_account;
	if (_tmp5_ == NULL) {
		AdwNavigationView* _tmp6_;
		AdwNavigationPage* _tmp7_;
		_tmp6_ = self->priv->deck;
		_tmp7_ = self->priv->instance_step;
		adw_navigation_view_pop_to_page (_tmp6_, _tmp7_);
	}
}

static void
tuba_dialogs_new_account_oopsie (TubaDialogsNewAccount* self,
                                 const gchar* title,
                                 const gchar* msg)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	AdwAlertDialog* dlg = NULL;
	TubaApplication* _tmp4_;
	AdwAlertDialog* _tmp5_;
	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:143: %s", _tmp3_);
	_g_free0 (_tmp3_);
	_tmp4_ = tuba_app;
	_tmp5_ = tuba_application_inform (_tmp4_, title, msg);
	dlg = _tmp5_;
	adw_dialog_present ((AdwDialog*) dlg, (GtkWidget*) self);
	_g_object_unref0 (dlg);
}

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

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

static void
tuba_dialogs_new_account_step (TubaDialogsNewAccount* self,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	TubaDialogsNewAccountStepData* _data_;
	TubaDialogsNewAccount* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TubaDialogsNewAccountStepData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_dialogs_new_account_step_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tuba_dialogs_new_account_step_co (_data_);
}

static void
tuba_dialogs_new_account_step_finish (TubaDialogsNewAccount* self,
                                      GAsyncResult* _res_,
                                      GError** error)
{
	TubaDialogsNewAccountStepData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
tuba_dialogs_new_account_step_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	TubaDialogsNewAccountStepData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_dialogs_new_account_step_co (_data_);
}

static gboolean
tuba_dialogs_new_account_step_co (TubaDialogsNewAccountStepData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->deck;
	_data_->_tmp1_ = adw_navigation_view_get_visible_page (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = _data_->self->priv->instance_step;
	if (_data_->_tmp2_ == _data_->_tmp3_) {
		tuba_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_->_tmp4_ = tuba_accounts;
		_data_->_tmp5_ = _data_->self->priv->_account;
		_data_->_state_ = 1;
		tuba_account_store_guess_backend (_data_->_tmp4_, _data_->_tmp5_, tuba_dialogs_new_account_step_ready, _data_);
		return FALSE;
		_state_1:
		tuba_account_store_guess_backend_finish (_data_->_tmp4_, _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;
		}
	}
	_data_->_tmp7_ = _data_->self->priv->_account;
	_data_->_tmp8_ = tuba_instance_account_get_client_secret (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	if (_data_->_tmp9_ == NULL) {
		_data_->_tmp6_ = TRUE;
	} else {
		_data_->_tmp10_ = _data_->self->priv->_account;
		_data_->_tmp11_ = tuba_instance_account_get_client_id (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp6_ = _data_->_tmp12_ == NULL;
	}
	if (_data_->_tmp6_) {
		_data_->_state_ = 2;
		tuba_dialogs_new_account_register_client (_data_->self, tuba_dialogs_new_account_step_ready, _data_);
		return FALSE;
		_state_2:
		tuba_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_ = 3;
	tuba_dialogs_new_account_request_token (_data_->self, tuba_dialogs_new_account_step_ready, _data_);
	return FALSE;
	_state_3:
	tuba_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*
bool_to_string (gboolean self)
{
	gchar* result;
	if (self) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("true");
		result = _tmp0_;
		return result;
	} else {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("false");
		result = _tmp1_;
		return result;
	}
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	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 glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static void
tuba_dialogs_new_account_setup_instance (TubaDialogsNewAccount* self,
                                         GError** error)
{
	gboolean skip_strict_validation = FALSE;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* final_string = NULL;
	AdwEntryRow* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* final_string_no_scheme = NULL;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp49_ = NULL;
	TubaInstanceAccount* _tmp50_;
	TubaInstanceAccount* _tmp55_;
	AdwEntryRow* _tmp56_;
	const gchar* _tmp57_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_getenv ("TUBA_SKIP_STRICT_VALIDATION");
	skip_strict_validation = g_strcmp0 (_tmp0_, "1") == 0;
	_tmp1_ = bool_to_string (skip_strict_validation);
	_tmp2_ = _tmp1_;
	g_debug ("NewAccount.vala:164: Checking instance URL (strict: %s)", _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = self->priv->instance_entry;
	_tmp4_ = gtk_editable_get_text ((GtkEditable*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strdup (_tmp5_);
	final_string = _tmp6_;
	_tmp7_ = final_string;
	if (!string_contains (_tmp7_, "://")) {
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp8_ = final_string;
		_tmp9_ = string_to_string (_tmp8_);
		_tmp10_ = g_strconcat ("https://", _tmp9_, NULL);
		_g_free0 (final_string);
		final_string = _tmp10_;
	}
	_tmp11_ = final_string;
	_tmp12_ = g_strdup (_tmp11_);
	final_string_no_scheme = _tmp12_;
	{
		GUri* instance_uri = NULL;
		const gchar* _tmp13_;
		GUri* _tmp14_;
		gchar* scheme = NULL;
		GUri* _tmp15_;
		const gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* host = NULL;
		GUri* _tmp18_;
		const gchar* _tmp19_;
		gchar* _tmp20_;
		gint port = 0;
		GUri* _tmp21_;
		gchar* userinfo = NULL;
		GUri* _tmp22_;
		const gchar* _tmp23_;
		gchar* _tmp24_;
		GUri* _tmp33_;
		const gchar* _tmp34_;
		const gchar* _tmp35_;
		GUri* _tmp36_;
		GUri* _tmp37_;
		gchar* _tmp38_;
		gchar* _tmp39_;
		gchar* _tmp40_;
		const gchar* _tmp41_;
		const gchar* _tmp42_;
		const gchar* _tmp43_;
		const gchar* _tmp44_;
		gchar* _tmp45_;
		_tmp13_ = final_string;
		_tmp14_ = g_uri_parse (_tmp13_, G_URI_FLAGS_NONE, &_inner_error0_);
		instance_uri = _tmp14_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp15_ = instance_uri;
		_tmp16_ = g_uri_get_scheme (_tmp15_);
		_tmp17_ = g_strdup (_tmp16_);
		scheme = _tmp17_;
		_tmp18_ = instance_uri;
		_tmp19_ = g_uri_get_host (_tmp18_);
		_tmp20_ = g_strdup (_tmp19_);
		host = _tmp20_;
		_tmp21_ = instance_uri;
		port = g_uri_get_port (_tmp21_);
		_tmp22_ = instance_uri;
		_tmp23_ = g_uri_get_userinfo (_tmp22_);
		_tmp24_ = g_strdup (_tmp23_);
		userinfo = _tmp24_;
		if (!skip_strict_validation) {
			gchar* _tmp25_;
			const gchar* _tmp26_;
			_tmp25_ = g_strdup ("https");
			_g_free0 (scheme);
			scheme = _tmp25_;
			port = -1;
			_g_free0 (userinfo);
			userinfo = NULL;
			_tmp26_ = host;
			if (!string_contains (_tmp26_, ".")) {
				const gchar* _tmp27_;
				const gchar* _tmp28_;
				gchar* _tmp29_;
				gchar* _tmp30_;
				GError* _tmp31_;
				GError* _tmp32_;
				_tmp27_ = host;
				_tmp28_ = string_to_string (_tmp27_);
				_tmp29_ = g_strconcat ("Host '", _tmp28_, "' is missing a dot", NULL);
				_tmp30_ = _tmp29_;
				_tmp31_ = g_error_new_literal ((GQuark) -1, 1, _tmp30_);
				_tmp32_ = _tmp31_;
				_g_free0 (_tmp30_);
				_inner_error0_ = _tmp32_;
				_g_free0 (userinfo);
				_g_free0 (host);
				_g_free0 (scheme);
				_g_uri_unref0 (instance_uri);
				goto __catch0_g_error;
			}
		}
		_tmp33_ = instance_uri;
		_tmp34_ = userinfo;
		_tmp35_ = host;
		_tmp36_ = g_uri_build (g_uri_get_flags (_tmp33_), "", _tmp34_, _tmp35_, port, "", NULL, NULL);
		_tmp37_ = _tmp36_;
		_tmp38_ = g_uri_to_string (_tmp37_);
		_tmp39_ = _tmp38_;
		_tmp40_ = string_substring (_tmp39_, (glong) 3, (glong) -1);
		_g_free0 (final_string_no_scheme);
		final_string_no_scheme = _tmp40_;
		_g_free0 (_tmp39_);
		_g_uri_unref0 (_tmp37_);
		_tmp41_ = scheme;
		_tmp42_ = string_to_string (_tmp41_);
		_tmp43_ = final_string_no_scheme;
		_tmp44_ = string_to_string (_tmp43_);
		_tmp45_ = g_strconcat (_tmp42_, "://", _tmp44_, NULL);
		_g_free0 (final_string);
		final_string = _tmp45_;
		_g_free0 (userinfo);
		_g_free0 (host);
		_g_free0 (scheme);
		_g_uri_unref0 (instance_uri);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp46_;
		const gchar* _tmp47_;
		GError* _tmp48_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp46_ = e;
		_tmp47_ = _tmp46_->message;
		g_warning ("NewAccount.vala:199: Couldn't parse instance URI: %s", _tmp47_);
		_tmp48_ = g_error_new_literal (TUBA_OOPSIE, TUBA_OOPSIE_USER, _ ("Please enter a valid instance URL"));
		_inner_error0_ = _tmp48_;
		_g_error_free0 (e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (final_string_no_scheme);
		_g_free0 (final_string);
		return;
	}
	_tmp50_ = self->priv->_updating_account;
	if (_tmp50_ == NULL) {
		const gchar* _tmp51_;
		_tmp51_ = final_string;
		_tmp49_ = _tmp51_;
	} else {
		TubaInstanceAccount* _tmp52_;
		const gchar* _tmp53_;
		const gchar* _tmp54_;
		_tmp52_ = self->priv->_updating_account;
		_tmp53_ = tuba_instance_account_get_instance (_tmp52_);
		_tmp54_ = _tmp53_;
		_tmp49_ = _tmp54_;
	}
	_tmp55_ = self->priv->_account;
	tuba_instance_account_set_instance (_tmp55_, _tmp49_);
	_tmp56_ = self->priv->instance_entry;
	_tmp57_ = final_string_no_scheme;
	gtk_editable_set_text ((GtkEditable*) _tmp56_, _tmp57_);
	_g_free0 (final_string_no_scheme);
	_g_free0 (final_string);
}

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

static void
tuba_dialogs_new_account_register_client (TubaDialogsNewAccount* self,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	TubaDialogsNewAccountRegisterClientData* _data_;
	TubaDialogsNewAccount* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TubaDialogsNewAccountRegisterClientData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_dialogs_new_account_register_client_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tuba_dialogs_new_account_register_client_co (_data_);
}

static void
tuba_dialogs_new_account_register_client_finish (TubaDialogsNewAccount* self,
                                                 GAsyncResult* _res_,
                                                 GError** error)
{
	TubaDialogsNewAccountRegisterClientData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
tuba_dialogs_new_account_register_client_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	TubaDialogsNewAccountRegisterClientData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_dialogs_new_account_register_client_co (_data_);
}

static gboolean
tuba_dialogs_new_account_register_client_co (TubaDialogsNewAccountRegisterClientData* _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:
	g_debug ("NewAccount.vala:208: Registering client");
	_data_->_tmp0_ = _data_->self->priv->_account;
	_data_->_tmp1_ = _g_object_ref0 (_data_->_tmp0_);
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = tuba_request_v2_new ("/api/v1/apps", TUBA_REQUEST_V2_METHOD_POST);
	tuba_request_v2_set_account (_data_->_tmp2_, _data_->_tmp1_);
	_g_object_unref0 (_data_->_tmp1_);
	_data_->msg = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->msg;
	tuba_request_v2_add_form_data (_data_->_tmp3_, "client_name", BUILD_NAME);
	_data_->_tmp4_ = _data_->msg;
	_data_->_tmp5_ = tuba_dialogs_new_account_setup_redirect_uri (_data_->self);
	_data_->_tmp6_ = _data_->_tmp5_;
	tuba_dialogs_new_account_set_redirect_uri (_data_->self, _data_->_tmp6_);
	tuba_request_v2_add_form_data (_data_->_tmp4_, "redirect_uris", _data_->_tmp6_);
	_g_free0 (_data_->_tmp6_);
	_data_->_tmp7_ = _data_->msg;
	_data_->_tmp8_ = tuba_dialogs_new_account_get_full_scopes (_data_->self);
	_data_->_tmp9_ = _data_->_tmp8_;
	tuba_request_v2_add_form_data (_data_->_tmp7_, "scopes", _data_->_tmp9_);
	_g_free0 (_data_->_tmp9_);
	_data_->_tmp10_ = _data_->msg;
	tuba_request_v2_add_form_data (_data_->_tmp10_, "website", BUILD_WEBSITE);
	_data_->_tmp11_ = _data_->msg;
	_data_->_state_ = 1;
	tuba_request_v2_exec (_data_->_tmp11_, tuba_dialogs_new_account_register_client_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp12_ = tuba_request_v2_exec_finish (_data_->_tmp11_, _data_->_res_, NULL, &_data_->_inner_error0_);
	_data_->in_stream = _data_->_tmp12_;
	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_->_tmp13_ = _data_->in_stream;
	_data_->_state_ = 2;
	tuba_network_get_parser_from_inputstream_async (_data_->_tmp13_, NULL, tuba_dialogs_new_account_register_client_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp14_ = tuba_network_get_parser_from_inputstream_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->parser = _data_->_tmp14_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->msg);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp15_ = tuba_network;
	_data_->_tmp16_ = _data_->parser;
	_data_->_tmp17_ = tuba_network_parse (_data_->_tmp15_, _data_->_tmp16_);
	_data_->root = _data_->_tmp17_;
	_data_->_tmp18_ = _data_->root;
	_data_->_tmp19_ = json_object_get_string_member (_data_->_tmp18_, "name");
	if (g_strcmp0 (_data_->_tmp19_, BUILD_NAME) != 0) {
		_data_->_tmp20_ = g_error_new_literal (TUBA_OOPSIE, TUBA_OOPSIE_INSTANCE, "Misconfigured Instance");
		_data_->_inner_error0_ = _data_->_tmp20_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_json_object_unref0 (_data_->root);
		_g_object_unref0 (_data_->parser);
		_g_object_unref0 (_data_->in_stream);
		_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");
	tuba_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");
	tuba_instance_account_set_client_secret (_data_->_tmp24_, _data_->_tmp26_);
	g_debug ("NewAccount.vala:225: OK: Instance registered client");
	_data_->_tmp27_ = _data_->self->priv->deck;
	_data_->_tmp28_ = adw_navigation_view_get_visible_page (_data_->_tmp27_);
	_data_->_tmp29_ = _data_->_tmp28_;
	_data_->_tmp30_ = _data_->self->priv->code_step;
	if (_data_->_tmp29_ != _data_->_tmp30_) {
		_data_->_tmp31_ = _data_->self->priv->deck;
		_data_->_tmp32_ = _data_->self->priv->code_step;
		adw_navigation_view_push (_data_->_tmp31_, _data_->_tmp32_);
		_data_->_tmp33_ = _data_->self->priv->_updating_account;
		if (_data_->_tmp33_ != NULL) {
			_data_->_tmp34_ = _data_->self->priv->deck;
			_data_->_tmp35_ = _data_->self->priv->instance_step;
			adw_navigation_view_remove (_data_->_tmp34_, _data_->_tmp35_);
		}
	}
	tuba_dialogs_new_account_open_confirmation_page (_data_->self);
	_json_object_unref0 (_data_->root);
	_g_object_unref0 (_data_->parser);
	_g_object_unref0 (_data_->in_stream);
	_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
tuba_dialogs_new_account_open_confirmation_page (TubaDialogsNewAccount* self)
{
	gchar* esc_scopes = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* esc_redirect = NULL;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* pars = NULL;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	TubaInstanceAccount* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* url = NULL;
	TubaInstanceAccount* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	g_return_if_fail (self != NULL);
	g_debug ("NewAccount.vala:235: Opening permission request page");
	_tmp0_ = tuba_dialogs_new_account_get_full_scopes (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_uri_escape_string (_tmp1_, NULL, TRUE);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	esc_scopes = _tmp3_;
	_tmp4_ = self->priv->_redirect_uri;
	_tmp5_ = g_uri_escape_string (_tmp4_, NULL, TRUE);
	esc_redirect = _tmp5_;
	_tmp6_ = string_to_string (esc_scopes);
	_tmp7_ = string_to_string (esc_redirect);
	_tmp8_ = self->priv->_account;
	_tmp9_ = tuba_instance_account_get_client_id (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = g_uri_escape_string (_tmp10_, NULL, TRUE);
	_tmp12_ = _tmp11_;
	_tmp13_ = string_to_string (_tmp12_);
	_tmp14_ = g_strconcat ("scope=", _tmp6_, "&response_type=code&redirect_uri=", _tmp7_, "&client_id=", _tmp13_, NULL);
	_tmp15_ = _tmp14_;
	_g_free0 (_tmp12_);
	pars = _tmp15_;
	_tmp16_ = self->priv->_account;
	_tmp17_ = tuba_instance_account_get_instance (_tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = string_to_string (_tmp18_);
	_tmp20_ = string_to_string (pars);
	_tmp21_ = g_strconcat (_tmp19_, "/oauth/authorize?", _tmp20_, NULL);
	url = _tmp21_;
	tuba_utils_host_open_url (url, NULL, NULL);
	_g_free0 (url);
	_g_free0 (pars);
	_g_free0 (esc_redirect);
	_g_free0 (esc_scopes);
}

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

static void
tuba_dialogs_new_account_request_token (TubaDialogsNewAccount* self,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	TubaDialogsNewAccountRequestTokenData* _data_;
	TubaDialogsNewAccount* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (TubaDialogsNewAccountRequestTokenData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tuba_dialogs_new_account_request_token_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	tuba_dialogs_new_account_request_token_co (_data_);
}

static void
tuba_dialogs_new_account_request_token_finish (TubaDialogsNewAccount* self,
                                               GAsyncResult* _res_,
                                               GError** error)
{
	TubaDialogsNewAccountRequestTokenData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
tuba_dialogs_new_account_request_token_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	TubaDialogsNewAccountRequestTokenData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tuba_dialogs_new_account_request_token_co (_data_);
}

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

static gboolean
tuba_dialogs_new_account_request_token_co (TubaDialogsNewAccountRequestTokenData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->code_entry;
	_data_->_tmp1_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (g_utf8_strlen (_data_->_tmp2_, (gssize) -1) <= 10) {
		_data_->_tmp3_ = g_error_new_literal (TUBA_OOPSIE, TUBA_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_debug ("NewAccount.vala:248: Requesting access token");
	_data_->_tmp4_ = _data_->self->priv->_account;
	_data_->_tmp5_ = _g_object_ref0 (_data_->_tmp4_);
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = tuba_request_v2_new ("/oauth/token", TUBA_REQUEST_V2_METHOD_POST);
	tuba_request_v2_set_account (_data_->_tmp6_, _data_->_tmp5_);
	_g_object_unref0 (_data_->_tmp5_);
	_data_->token_req = _data_->_tmp6_;
	_data_->_tmp7_ = _data_->token_req;
	_data_->_tmp8_ = _data_->self->priv->_account;
	_data_->_tmp9_ = tuba_instance_account_get_client_id (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	tuba_request_v2_add_form_data (_data_->_tmp7_, "client_id", _data_->_tmp10_);
	_data_->_tmp11_ = _data_->token_req;
	_data_->_tmp12_ = _data_->self->priv->_account;
	_data_->_tmp13_ = tuba_instance_account_get_client_secret (_data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	tuba_request_v2_add_form_data (_data_->_tmp11_, "client_secret", _data_->_tmp14_);
	_data_->_tmp15_ = _data_->token_req;
	_data_->_tmp16_ = _data_->self->priv->_redirect_uri;
	tuba_request_v2_add_form_data (_data_->_tmp15_, "redirect_uri", _data_->_tmp16_);
	_data_->_tmp17_ = _data_->token_req;
	tuba_request_v2_add_form_data (_data_->_tmp17_, "grant_type", "authorization_code");
	_data_->_tmp18_ = _data_->token_req;
	_data_->_tmp19_ = _data_->self->priv->code_entry;
	_data_->_tmp20_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp19_);
	_data_->_tmp21_ = _data_->_tmp20_;
	tuba_request_v2_add_form_data (_data_->_tmp18_, "code", _data_->_tmp21_);
	_data_->_tmp22_ = _data_->token_req;
	_data_->_state_ = 1;
	tuba_request_v2_exec (_data_->_tmp22_, tuba_dialogs_new_account_request_token_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp23_ = tuba_request_v2_exec_finish (_data_->_tmp22_, _data_->_res_, NULL, &_data_->_inner_error0_);
	_data_->in_stream = _data_->_tmp23_;
	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_->_tmp24_ = _data_->in_stream;
	_data_->_state_ = 2;
	tuba_network_get_parser_from_inputstream_async (_data_->_tmp24_, NULL, tuba_dialogs_new_account_request_token_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp25_ = tuba_network_get_parser_from_inputstream_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->parser = _data_->_tmp25_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->token_req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp26_ = tuba_network;
	_data_->_tmp27_ = _data_->parser;
	_data_->_tmp28_ = tuba_network_parse (_data_->_tmp26_, _data_->_tmp27_);
	_data_->root = _data_->_tmp28_;
	_data_->_tmp29_ = _data_->self->priv->_account;
	_data_->_tmp30_ = _data_->root;
	_data_->_tmp31_ = json_object_get_string_member (_data_->_tmp30_, "access_token");
	tuba_instance_account_set_access_token (_data_->_tmp29_, _data_->_tmp31_);
	_data_->_tmp32_ = _data_->self->priv->_account;
	_data_->_tmp33_ = tuba_instance_account_get_access_token (_data_->_tmp32_);
	_data_->_tmp34_ = _data_->_tmp33_;
	if (_data_->_tmp34_ == NULL) {
		_data_->_tmp35_ = g_error_new_literal (TUBA_OOPSIE, TUBA_OOPSIE_INSTANCE, _ ("Instance failed to authorize the access token"));
		_data_->_inner_error0_ = _data_->_tmp35_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_json_object_unref0 (_data_->root);
		_g_object_unref0 (_data_->parser);
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->token_req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp36_ = _data_->self->priv->_account;
	_data_->_state_ = 3;
	tuba_instance_account_verify_credentials (_data_->_tmp36_, tuba_dialogs_new_account_request_token_ready, _data_);
	return FALSE;
	_state_3:
	tuba_instance_account_verify_credentials_finish (_data_->_tmp36_, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_json_object_unref0 (_data_->root);
		_g_object_unref0 (_data_->parser);
		_g_object_unref0 (_data_->in_stream);
		_g_object_unref0 (_data_->token_req);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp37_ = _data_->self->priv->_account;
	_data_->_tmp38_ = _data_->self->priv->_admin_mode;
	tuba_instance_account_set_admin_mode (_data_->_tmp37_, _data_->_tmp38_);
	_data_->_tmp39_ = _data_->self->priv->_updating_account;
	if (_data_->_tmp39_ != NULL) {
		_data_->_tmp40_ = tuba_accounts;
		_data_->_tmp41_ = _data_->self->priv->_updating_account;
		_data_->_state_ = 4;
		tuba_account_store_revoke_token_dangerous (_data_->_tmp40_, _data_->_tmp41_, FALSE, tuba_dialogs_new_account_request_token_ready, _data_);
		return FALSE;
		_state_4:
		tuba_account_store_revoke_token_dangerous_finish (_data_->_tmp40_, _data_->_res_);
		_data_->_tmp42_ = _data_->self->priv->_updating_account;
		tuba_instance_account_set_tuba_revoked (_data_->_tmp42_, FALSE);
		_data_->_tmp43_ = _data_->self->priv->_updating_account;
		_data_->_tmp44_ = _data_->self->priv->_account;
		_data_->_tmp45_ = tuba_instance_account_get_client_id (_data_->_tmp44_);
		_data_->_tmp46_ = _data_->_tmp45_;
		tuba_instance_account_set_client_id (_data_->_tmp43_, _data_->_tmp46_);
		_data_->_tmp47_ = _data_->self->priv->_updating_account;
		_data_->_tmp48_ = _data_->self->priv->_account;
		_data_->_tmp49_ = tuba_instance_account_get_client_secret (_data_->_tmp48_);
		_data_->_tmp50_ = _data_->_tmp49_;
		tuba_instance_account_set_client_secret (_data_->_tmp47_, _data_->_tmp50_);
		_data_->_tmp51_ = _data_->self->priv->_updating_account;
		_data_->_tmp52_ = _data_->self->priv->_account;
		_data_->_tmp53_ = tuba_instance_account_get_access_token (_data_->_tmp52_);
		_data_->_tmp54_ = _data_->_tmp53_;
		tuba_instance_account_set_access_token (_data_->_tmp51_, _data_->_tmp54_);
		_data_->_tmp55_ = _data_->self->priv->_updating_account;
		_data_->_tmp56_ = _data_->self->priv->_account;
		_data_->_tmp57_ = tuba_instance_account_get_admin_mode (_data_->_tmp56_);
		_data_->_tmp58_ = _data_->_tmp57_;
		tuba_instance_account_set_admin_mode (_data_->_tmp55_, _data_->_tmp58_);
		_data_->_tmp59_ = _data_->self->priv->_updating_account;
		_data_->_tmp60_ = _data_->self->priv->_account;
		_data_->_tmp61_ = tuba_instance_account_get_backend (_data_->_tmp60_);
		_data_->_tmp62_ = _data_->_tmp61_;
		tuba_instance_account_set_backend (_data_->_tmp59_, _data_->_tmp62_);
		_data_->_tmp63_ = tuba_accounts;
		_data_->_tmp64_ = _data_->self->priv->_updating_account;
		tuba_account_store_update_account (_data_->_tmp63_, _data_->_tmp64_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_json_object_unref0 (_data_->root);
			_g_object_unref0 (_data_->parser);
			_g_object_unref0 (_data_->in_stream);
			_g_object_unref0 (_data_->token_req);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp65_ = _data_->self->priv->_updating_account;
		tuba_dialogs_new_account_set_account (_data_->self, _data_->_tmp65_);
	} else {
		_data_->_tmp67_ = tuba_accounts;
		_data_->_tmp68_ = _data_->self->priv->_account;
		_data_->_tmp69_ = tuba_entity_to_json ((TubaEntity*) _data_->_tmp68_);
		_data_->_tmp70_ = _data_->_tmp69_;
		_data_->_tmp71_ = _data_->self->priv->_account;
		_data_->_tmp72_ = tuba_instance_account_get_tuba_instance_features (_data_->_tmp71_);
		_data_->_tmp73_ = _data_->_tmp72_;
		_data_->_tmp74_ = tuba_account_store_create_account (_data_->_tmp67_, _data_->_tmp70_, &_data_->_tmp73_, &_data_->_inner_error0_);
		_data_->_tmp75_ = _data_->_tmp74_;
		__vala_JsonNode_free0 (_data_->_tmp70_);
		_data_->_tmp66_ = _data_->_tmp75_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_json_object_unref0 (_data_->root);
			_g_object_unref0 (_data_->parser);
			_g_object_unref0 (_data_->in_stream);
			_g_object_unref0 (_data_->token_req);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		tuba_dialogs_new_account_set_account (_data_->self, _data_->_tmp66_);
		g_debug ("NewAccount.vala:280: Saving account");
		_data_->_tmp76_ = tuba_accounts;
		_data_->_tmp77_ = _data_->self->priv->_account;
		tuba_account_store_add (_data_->_tmp76_, _data_->_tmp77_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->_tmp66_);
			_json_object_unref0 (_data_->root);
			_g_object_unref0 (_data_->parser);
			_g_object_unref0 (_data_->in_stream);
			_g_object_unref0 (_data_->token_req);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_object_unref0 (_data_->_tmp66_);
	}
	_data_->_tmp78_ = _data_->self->priv->done_page_emoji_label;
	_data_->_tmp79_ = _data_->self->priv->_account;
	_data_->_tmp80_ = tuba_api_account_get_emojis_map ((TubaAPIAccount*) _data_->_tmp79_);
	_data_->_tmp81_ = _data_->_tmp80_;
	_data_->_tmp82_ = _data_->_tmp81_;
	tuba_widgets_emoji_label_set_instance_emojis (_data_->_tmp78_, _data_->_tmp82_);
	_g_object_unref0 (_data_->_tmp82_);
	_data_->_tmp83_ = _data_->self->priv->done_page_emoji_label;
	_data_->_tmp84_ = _data_->self->priv->_account;
	_data_->_tmp85_ = tuba_api_account_get_display_name ((TubaAPIAccount*) _data_->_tmp84_);
	_data_->_tmp86_ = _data_->_tmp85_;
	_data_->_tmp87_ = g_strdup_printf (_ ("Hello, %s!"), _data_->_tmp86_);
	_data_->_tmp88_ = _data_->_tmp87_;
	tuba_widgets_emoji_label_set_content (_data_->_tmp83_, _data_->_tmp88_);
	_g_free0 (_data_->_tmp88_);
	_data_->_tmp89_ = _data_->self->priv->deck;
	_data_->_tmp90_ = _data_->self->priv->done_step;
	adw_navigation_view_push (_data_->_tmp89_, _data_->_tmp90_);
	g_debug ("NewAccount.vala:288: Switching to account");
	_data_->_tmp91_ = tuba_accounts;
	_data_->_tmp92_ = _data_->self->priv->_account;
	tuba_account_store_activate (_data_->_tmp91_, _data_->_tmp92_, TRUE);
	_json_object_unref0 (_data_->root);
	_g_object_unref0 (_data_->parser);
	_g_object_unref0 (_data_->in_stream);
	_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;
}

void
tuba_dialogs_new_account_redirect (TubaDialogsNewAccount* self,
                                   GUri* uri)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* code_from_params = NULL;
	gchar* _tmp4_;
	AdwEntryRow* _tmp13_;
	const gchar* _tmp14_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (uri != NULL);
	gtk_window_present ((GtkWindow*) self);
	_tmp0_ = g_uri_to_string (uri);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat ("Received uri: ", _tmp1_, NULL);
	_tmp3_ = _tmp2_;
	g_debug ("NewAccount.vala:294: %s", _tmp3_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	_tmp4_ = g_strdup ("");
	code_from_params = _tmp4_;
	{
		GHashTable* uri_params = NULL;
		const gchar* _tmp5_;
		GHashTable* _tmp6_;
		GHashTable* _tmp7_;
		_tmp5_ = g_uri_get_query (uri);
		_tmp6_ = g_uri_parse_params (_tmp5_, (gsize) -1, "&;", 0, &_inner_error0_);
		uri_params = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_URI_ERROR) {
				goto __catch0_g_uri_error;
			}
			_g_free0 (code_from_params);
			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;
		}
		_tmp7_ = uri_params;
		if (g_hash_table_contains (_tmp7_, "code")) {
			GHashTable* _tmp8_;
			gconstpointer _tmp9_;
			gchar* _tmp10_;
			_tmp8_ = uri_params;
			_tmp9_ = g_hash_table_lookup (_tmp8_, "code");
			_tmp10_ = g_strdup ((const gchar*) _tmp9_);
			_g_free0 (code_from_params);
			code_from_params = _tmp10_;
		}
		_g_hash_table_unref0 (uri_params);
	}
	goto __finally0;
	__catch0_g_uri_error:
	{
		GError* e = NULL;
		GError* _tmp11_;
		const gchar* _tmp12_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp11_ = e;
		_tmp12_ = _tmp11_->message;
		g_warning ("NewAccount.vala:302: %s", _tmp12_);
		_g_error_free0 (e);
		_g_free0 (code_from_params);
		return;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (code_from_params);
		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;
	}
	_tmp13_ = self->priv->code_entry;
	_tmp14_ = code_from_params;
	gtk_editable_set_text ((GtkEditable*) _tmp13_, _tmp14_);
	tuba_dialogs_new_account_set_is_working (self, FALSE);
	tuba_dialogs_new_account_on_next_clicked (self);
	_g_free0 (code_from_params);
}

void
tuba_dialogs_new_account_mark_errors (TubaDialogsNewAccount* self,
                                      const gchar* error_message)
{
	AdwEntryRow* _tmp0_;
	GtkLabel* _tmp1_;
	AdwEntryRow* _tmp2_;
	GtkLabel* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (error_message != NULL);
	_tmp0_ = self->priv->instance_entry;
	gtk_widget_add_css_class ((GtkWidget*) _tmp0_, "error");
	_tmp1_ = self->priv->instance_entry_error;
	gtk_label_set_label (_tmp1_, error_message);
	_tmp2_ = self->priv->code_entry;
	gtk_widget_add_css_class ((GtkWidget*) _tmp2_, "error");
	_tmp3_ = self->priv->code_entry_error;
	gtk_label_set_label (_tmp3_, error_message);
}

void
tuba_dialogs_new_account_clear_errors (TubaDialogsNewAccount* self)
{
	AdwEntryRow* _tmp0_;
	GtkLabel* _tmp1_;
	AdwEntryRow* _tmp2_;
	GtkLabel* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->instance_entry;
	gtk_widget_remove_css_class ((GtkWidget*) _tmp0_, "error");
	_tmp1_ = self->priv->instance_entry_error;
	gtk_label_set_label (_tmp1_, "");
	_tmp2_ = self->priv->code_entry;
	gtk_widget_remove_css_class ((GtkWidget*) _tmp2_, "error");
	_tmp3_ = self->priv->code_entry_error;
	gtk_label_set_label (_tmp3_, "");
}

static void
_tuba_dialogs_new_account_clear_errors_gtk_editable_changed (GtkEditable* _sender,
                                                             gpointer self)
{
	tuba_dialogs_new_account_clear_errors ((TubaDialogsNewAccount*) self);
}

static void
__lambda201_ (TubaDialogsNewAccount* self,
              GObject* obj,
              GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		tuba_dialogs_new_account_step_finish (self, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (g_error_matches (_inner_error0_, TUBA_OOPSIE, TUBA_OOPSIE_INSTANCE)) {
				goto __catch0_tuba_oopsie_instance;
			}
			goto __catch0_g_error;
		}
		tuba_dialogs_new_account_clear_errors (self);
	}
	goto __finally0;
	__catch0_tuba_oopsie_instance:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		GError* _tmp2_;
		const gchar* _tmp3_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		tuba_dialogs_new_account_oopsie (self, _ ("Server returned an error"), _tmp1_);
		_tmp2_ = e;
		_tmp3_ = _tmp2_->message;
		tuba_dialogs_new_account_mark_errors (self, _tmp3_);
		_g_error_free0 (e);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp4_;
		const gchar* _tmp5_;
		GError* _tmp6_;
		const gchar* _tmp7_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp4_ = e;
		_tmp5_ = _tmp4_->message;
		tuba_dialogs_new_account_oopsie (self, _tmp5_, "");
		_tmp6_ = e;
		_tmp7_ = _tmp6_->message;
		tuba_dialogs_new_account_mark_errors (self, _tmp7_);
		_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;
	}
	tuba_dialogs_new_account_set_is_working (self, FALSE);
}

static void
___lambda201__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	__lambda201_ ((TubaDialogsNewAccount*) self, source_object, res);
	g_object_unref (self);
}

static void
tuba_dialogs_new_account_on_next_clicked (TubaDialogsNewAccount* self)
{
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	tuba_dialogs_new_account_clear_errors (self);
	_tmp0_ = self->priv->_is_working;
	if (_tmp0_) {
		return;
	}
	tuba_dialogs_new_account_set_is_working (self, TRUE);
	tuba_dialogs_new_account_step (self, ___lambda201__gasync_ready_callback, g_object_ref (self));
}

static void
_tuba_dialogs_new_account_on_next_clicked_adw_entry_row_entry_activated (AdwEntryRow* _sender,
                                                                         gpointer self)
{
	tuba_dialogs_new_account_on_next_clicked ((TubaDialogsNewAccount*) self);
}

static void
tuba_dialogs_new_account_on_done_clicked (TubaDialogsNewAccount* self)
{
	TubaApplication* _tmp0_;
	TubaApplication* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tuba_app;
	tuba_application_present_window (_tmp0_, FALSE);
	_tmp1_ = tuba_app;
	tuba_application_set_add_account_window (_tmp1_, NULL);
	gtk_window_destroy ((GtkWindow*) self);
}

static void
_tuba_dialogs_new_account_on_done_clicked_gtk_button_clicked (GtkButton* _sender,
                                                              gpointer self)
{
	tuba_dialogs_new_account_on_done_clicked ((TubaDialogsNewAccount*) self);
}

static void
tuba_dialogs_new_account_on_back_clicked (TubaDialogsNewAccount* self)
{
	g_return_if_fail (self != NULL);
	tuba_dialogs_new_account_reset (self);
}

static void
_tuba_dialogs_new_account_on_back_clicked_adw_navigation_view_popped (AdwNavigationView* _sender,
                                                                      AdwNavigationPage* page,
                                                                      gpointer self)
{
	tuba_dialogs_new_account_on_back_clicked ((TubaDialogsNewAccount*) self);
}

static void
_tuba_dialogs_new_account_on_admin_change_tuba_dialogs_new_account_settings_dialog_admin_changed (TubaDialogsNewAccountSettingsDialog* _sender,
                                                                                                  gboolean new_admin_val,
                                                                                                  gpointer self)
{
	tuba_dialogs_new_account_on_admin_change ((TubaDialogsNewAccount*) self, new_admin_val);
}

static void
tuba_dialogs_new_account_on_settings_clicked (TubaDialogsNewAccount* self)
{
	TubaDialogsNewAccountSettingsDialog* settings_dialog = NULL;
	gboolean _tmp0_;
	TubaSettings* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp4_;
	TubaDialogsNewAccountSettingsDialog* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_can_access_settings;
	_tmp1_ = tuba_settings;
	_tmp2_ = tuba_settings_get_proxy (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->_admin_mode;
	_tmp5_ = tuba_dialogs_new_account_settings_dialog_new (_tmp0_, _tmp3_, _tmp4_);
	g_object_ref_sink (_tmp5_);
	settings_dialog = _tmp5_;
	g_signal_connect_object (settings_dialog, "admin-changed", (GCallback) _tuba_dialogs_new_account_on_admin_change_tuba_dialogs_new_account_settings_dialog_admin_changed, self, 0);
	adw_dialog_present ((AdwDialog*) settings_dialog, (GtkWidget*) self);
	_g_object_unref0 (settings_dialog);
}

static void
_tuba_dialogs_new_account_on_settings_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                  gpointer self)
{
	tuba_dialogs_new_account_on_settings_clicked ((TubaDialogsNewAccount*) self);
}

static void
tuba_dialogs_new_account_on_admin_change (TubaDialogsNewAccount* self,
                                          gboolean new_val)
{
	g_return_if_fail (self != NULL);
	tuba_dialogs_new_account_set_admin_mode (self, new_val);
}

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

void
tuba_dialogs_new_account_set_is_working (TubaDialogsNewAccount* self,
                                         gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_dialogs_new_account_get_is_working (self);
	if (old_value != value) {
		self->priv->_is_working = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_new_account_properties[TUBA_DIALOGS_NEW_ACCOUNT_IS_WORKING_PROPERTY]);
	}
}

const gchar*
tuba_dialogs_new_account_get_redirect_uri (TubaDialogsNewAccount* 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
tuba_dialogs_new_account_set_redirect_uri (TubaDialogsNewAccount* self,
                                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_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, tuba_dialogs_new_account_properties[TUBA_DIALOGS_NEW_ACCOUNT_REDIRECT_URI_PROPERTY]);
	}
}

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

void
tuba_dialogs_new_account_set_use_auto_auth (TubaDialogsNewAccount* self,
                                            gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_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, tuba_dialogs_new_account_properties[TUBA_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY]);
	}
}

TubaInstanceAccount*
tuba_dialogs_new_account_get_account (TubaDialogsNewAccount* self)
{
	TubaInstanceAccount* result;
	TubaInstanceAccount* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_account;
	result = _tmp0_;
	return result;
}

void
tuba_dialogs_new_account_set_account (TubaDialogsNewAccount* self,
                                      TubaInstanceAccount* value)
{
	TubaInstanceAccount* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_dialogs_new_account_get_account (self);
	if (old_value != value) {
		TubaInstanceAccount* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_account);
		self->priv->_account = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_new_account_properties[TUBA_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY]);
	}
}

gboolean
tuba_dialogs_new_account_get_can_access_settings (TubaDialogsNewAccount* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_can_access_settings;
	return result;
}

void
tuba_dialogs_new_account_set_can_access_settings (TubaDialogsNewAccount* self,
                                                  gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_dialogs_new_account_get_can_access_settings (self);
	if (old_value != value) {
		self->priv->_can_access_settings = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_new_account_properties[TUBA_DIALOGS_NEW_ACCOUNT_CAN_ACCESS_SETTINGS_PROPERTY]);
	}
}

gboolean
tuba_dialogs_new_account_get_admin_mode (TubaDialogsNewAccount* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_admin_mode;
	return result;
}

void
tuba_dialogs_new_account_set_admin_mode (TubaDialogsNewAccount* self,
                                         gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_dialogs_new_account_get_admin_mode (self);
	if (old_value != value) {
		self->priv->_admin_mode = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_dialogs_new_account_properties[TUBA_DIALOGS_NEW_ACCOUNT_ADMIN_MODE_PROPERTY]);
	}
}

static TubaInstanceAccount*
tuba_dialogs_new_account_get_updating_account (TubaDialogsNewAccount* self)
{
	TubaInstanceAccount* result;
	TubaInstanceAccount* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_updating_account;
	result = _tmp0_;
	return result;
}

static void
tuba_dialogs_new_account_set_updating_account (TubaDialogsNewAccount* self,
                                               TubaInstanceAccount* value)
{
	TubaInstanceAccount* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_updating_account);
	self->priv->_updating_account = _tmp0_;
}

static inline gpointer
tuba_dialogs_new_account_settings_dialog_get_instance_private (TubaDialogsNewAccountSettingsDialog* self)
{
	return G_STRUCT_MEMBER_P (self, TubaDialogsNewAccountSettingsDialog_private_offset);
}

static void
_tuba_dialogs_new_account_settings_dialog_modified_g_object_notify (GObject* _sender,
                                                                    GParamSpec* pspec,
                                                                    gpointer self)
{
	tuba_dialogs_new_account_settings_dialog_modified ((TubaDialogsNewAccountSettingsDialog*) self);
}

static void
_tuba_dialogs_new_account_settings_dialog_modified_gtk_editable_changed (GtkEditable* _sender,
                                                                         gpointer self)
{
	tuba_dialogs_new_account_settings_dialog_modified ((TubaDialogsNewAccountSettingsDialog*) self);
}

static TubaDialogsNewAccountSettingsDialog*
tuba_dialogs_new_account_settings_dialog_construct (GType object_type,
                                                    gboolean can_access_settings,
                                                    const gchar* proxy_val,
                                                    gboolean admin_val)
{
	TubaDialogsNewAccountSettingsDialog * self = NULL;
	AdwSwitchRow* _tmp2_;
	AdwSwitchRow* _tmp3_;
	AdwEntryRow* _tmp4_;
	g_return_val_if_fail (proxy_val != NULL, NULL);
	self = (TubaDialogsNewAccountSettingsDialog*) g_object_new (object_type, NULL);
	if (!can_access_settings) {
		AdwEntryRow* _tmp0_;
		AdwEntryRow* _tmp1_;
		_tmp0_ = self->priv->proxy_entry;
		gtk_widget_set_visible ((GtkWidget*) _tmp0_, TRUE);
		_tmp1_ = self->priv->proxy_entry;
		gtk_editable_set_text ((GtkEditable*) _tmp1_, proxy_val);
	}
	self->priv->original_admin_val = admin_val;
	_tmp2_ = self->priv->admin_row;
	adw_switch_row_set_active (_tmp2_, admin_val);
	_tmp3_ = self->priv->admin_row;
	g_signal_connect_object ((GObject*) _tmp3_, "notify::active", (GCallback) _tuba_dialogs_new_account_settings_dialog_modified_g_object_notify, self, 0);
	_tmp4_ = self->priv->proxy_entry;
	g_signal_connect_object ((GtkEditable*) _tmp4_, "changed", (GCallback) _tuba_dialogs_new_account_settings_dialog_modified_gtk_editable_changed, self, 0);
	return self;
}

static TubaDialogsNewAccountSettingsDialog*
tuba_dialogs_new_account_settings_dialog_new (gboolean can_access_settings,
                                              const gchar* proxy_val,
                                              gboolean admin_val)
{
	return tuba_dialogs_new_account_settings_dialog_construct (TUBA_DIALOGS_NEW_ACCOUNT_TYPE_SETTINGS_DIALOG, can_access_settings, proxy_val, admin_val);
}

static void
tuba_dialogs_new_account_settings_dialog_modified (TubaDialogsNewAccountSettingsDialog* self)
{
	gboolean _tmp0_ = FALSE;
	AdwSwitchRow* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GtkButton* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->admin_row;
	_tmp2_ = adw_switch_row_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != self->priv->original_admin_val) {
		_tmp0_ = TRUE;
	} else {
		TubaSettings* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		AdwEntryRow* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		_tmp4_ = tuba_settings;
		_tmp5_ = tuba_settings_get_proxy (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = self->priv->proxy_entry;
		_tmp8_ = gtk_editable_get_text ((GtkEditable*) _tmp7_);
		_tmp9_ = _tmp8_;
		_tmp0_ = g_strcmp0 (_tmp6_, _tmp9_) != 0;
	}
	_tmp10_ = self->priv->apply_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp10_, _tmp0_);
}

static void
tuba_dialogs_new_account_settings_dialog_on_cancel (TubaDialogsNewAccountSettingsDialog* self)
{
	g_return_if_fail (self != NULL);
	adw_dialog_force_close ((AdwDialog*) self);
}

static void
tuba_dialogs_new_account_settings_dialog_on_apply (TubaDialogsNewAccountSettingsDialog* self)
{
	gboolean _tmp0_ = FALSE;
	AdwEntryRow* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	AdwSwitchRow* _tmp14_;
	gboolean _tmp15_;
	gboolean _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->proxy_entry;
	_tmp2_ = gtk_widget_get_visible ((GtkWidget*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		TubaSettings* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		AdwEntryRow* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		_tmp4_ = tuba_settings;
		_tmp5_ = tuba_settings_get_proxy (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = self->priv->proxy_entry;
		_tmp8_ = gtk_editable_get_text ((GtkEditable*) _tmp7_);
		_tmp9_ = _tmp8_;
		_tmp0_ = g_strcmp0 (_tmp6_, _tmp9_) != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		TubaSettings* _tmp10_;
		AdwEntryRow* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		_tmp10_ = tuba_settings;
		_tmp11_ = self->priv->proxy_entry;
		_tmp12_ = gtk_editable_get_text ((GtkEditable*) _tmp11_);
		_tmp13_ = _tmp12_;
		tuba_settings_set_proxy (_tmp10_, _tmp13_);
	}
	_tmp14_ = self->priv->admin_row;
	_tmp15_ = adw_switch_row_get_active (_tmp14_);
	_tmp16_ = _tmp15_;
	if (_tmp16_ != self->priv->original_admin_val) {
		AdwSwitchRow* _tmp17_;
		gboolean _tmp18_;
		gboolean _tmp19_;
		_tmp17_ = self->priv->admin_row;
		_tmp18_ = adw_switch_row_get_active (_tmp17_);
		_tmp19_ = _tmp18_;
		g_signal_emit (self, tuba_dialogs_new_account_settings_dialog_signals[TUBA_DIALOGS_NEW_ACCOUNT_SETTINGS_DIALOG_ADMIN_CHANGED_SIGNAL], 0, _tmp19_);
	}
	tuba_dialogs_new_account_settings_dialog_on_cancel (self);
}

static void
_tuba_dialogs_new_account_settings_dialog_on_cancel_gtk_button_clicked (GtkButton* _sender,
                                                                        gpointer self)
{
	tuba_dialogs_new_account_settings_dialog_on_cancel ((TubaDialogsNewAccountSettingsDialog*) self);
}

static void
_tuba_dialogs_new_account_settings_dialog_on_apply_gtk_button_clicked (GtkButton* _sender,
                                                                       gpointer self)
{
	tuba_dialogs_new_account_settings_dialog_on_apply ((TubaDialogsNewAccountSettingsDialog*) self);
}

static GObject *
tuba_dialogs_new_account_settings_dialog_constructor (GType type,
                                                      guint n_construct_properties,
                                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaDialogsNewAccountSettingsDialog * self;
	GtkButton* cancel_button = NULL;
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	gchar* _tmp2_;
	gchar** _tmp3_;
	GtkButton* _tmp4_ = NULL;
	GtkButton* _tmp5_;
	AdwPreferencesPage* page = NULL;
	AdwPreferencesPage* _tmp6_ = NULL;
	AdwHeaderBar* headerbar = NULL;
	AdwHeaderBar* _tmp7_ = NULL;
	AdwHeaderBar* _tmp8_;
	GtkButton* _tmp9_;
	AdwHeaderBar* _tmp10_;
	GtkButton* _tmp11_;
	AdwToolbarView* toolbar_view = NULL;
	AdwPreferencesPage* _tmp12_;
	GtkWidget* _tmp13_;
	AdwToolbarView* _tmp14_ = NULL;
	AdwToolbarView* _tmp15_;
	AdwHeaderBar* _tmp16_;
	AdwPreferencesGroup* group = NULL;
	AdwPreferencesGroup* _tmp17_;
	gchar* _tmp18_;
	AdwEntryRow* _tmp19_ = NULL;
	AdwPreferencesGroup* _tmp20_;
	AdwEntryRow* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	AdwSwitchRow* _tmp24_ = NULL;
	AdwPreferencesGroup* _tmp25_;
	AdwSwitchRow* _tmp26_;
	AdwPreferencesPage* _tmp27_;
	AdwPreferencesGroup* _tmp28_;
	AdwToolbarView* _tmp29_;
	parent_class = G_OBJECT_CLASS (tuba_dialogs_new_account_settings_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_DIALOGS_NEW_ACCOUNT_TYPE_SETTINGS_DIALOG, TubaDialogsNewAccountSettingsDialog);
	adw_dialog_set_title ((AdwDialog*) self, _ ("Settings"));
	adw_dialog_set_content_width ((AdwDialog*) self, 460);
	adw_dialog_set_content_height ((AdwDialog*) self, 220);
	_tmp0_ = (GtkButton*) gtk_button_new_with_label (_ ("Cancel"));
	g_object_ref_sink (_tmp0_);
	cancel_button = _tmp0_;
	_tmp1_ = cancel_button;
	g_signal_connect_object (_tmp1_, "clicked", (GCallback) _tuba_dialogs_new_account_settings_dialog_on_cancel_gtk_button_clicked, self, 0);
	_tmp2_ = g_strdup ("suggested-action");
	_tmp3_ = g_new0 (gchar*, 1 + 1);
	_tmp3_[0] = _tmp2_;
	_tmp4_ = (GtkButton*) gtk_button_new_with_label (_ ("Apply"));
	gtk_widget_set_css_classes ((GtkWidget*) _tmp4_, _tmp3_);
	_tmp3_ = (_vala_array_free (_tmp3_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, FALSE);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->apply_button);
	self->priv->apply_button = _tmp4_;
	_tmp5_ = self->priv->apply_button;
	g_signal_connect_object (_tmp5_, "clicked", (GCallback) _tuba_dialogs_new_account_settings_dialog_on_apply_gtk_button_clicked, self, 0);
	_tmp6_ = (AdwPreferencesPage*) adw_preferences_page_new ();
	gtk_widget_set_valign ((GtkWidget*) _tmp6_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp6_);
	page = _tmp6_;
	_tmp7_ = (AdwHeaderBar*) adw_header_bar_new ();
	adw_header_bar_set_show_end_title_buttons (_tmp7_, FALSE);
	adw_header_bar_set_show_start_title_buttons (_tmp7_, FALSE);
	g_object_ref_sink (_tmp7_);
	headerbar = _tmp7_;
	_tmp8_ = headerbar;
	_tmp9_ = cancel_button;
	adw_header_bar_pack_start (_tmp8_, (GtkWidget*) _tmp9_);
	_tmp10_ = headerbar;
	_tmp11_ = self->priv->apply_button;
	adw_header_bar_pack_end (_tmp10_, (GtkWidget*) _tmp11_);
	_tmp12_ = page;
	_tmp13_ = _g_object_ref0 ((GtkWidget*) _tmp12_);
	_tmp14_ = (AdwToolbarView*) adw_toolbar_view_new ();
	adw_toolbar_view_set_content (_tmp14_, _tmp13_);
	_g_object_unref0 (_tmp13_);
	g_object_ref_sink (_tmp14_);
	toolbar_view = _tmp14_;
	_tmp15_ = toolbar_view;
	_tmp16_ = headerbar;
	adw_toolbar_view_add_top_bar (_tmp15_, (GtkWidget*) _tmp16_);
	_tmp17_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
	g_object_ref_sink (_tmp17_);
	group = _tmp17_;
	_tmp18_ = g_strdup (_ ("Proxy"));
	_tmp19_ = (AdwEntryRow*) adw_entry_row_new ();
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp19_, _tmp18_);
	_g_free0 (_tmp18_);
	gtk_widget_set_visible ((GtkWidget*) _tmp19_, FALSE);
	adw_entry_row_set_input_purpose (_tmp19_, GTK_INPUT_PURPOSE_URL);
	adw_entry_row_set_show_apply_button (_tmp19_, FALSE);
	g_object_ref_sink (_tmp19_);
	_g_object_unref0 (self->priv->proxy_entry);
	self->priv->proxy_entry = _tmp19_;
	_tmp20_ = group;
	_tmp21_ = self->priv->proxy_entry;
	adw_preferences_group_add (_tmp20_, (GtkWidget*) _tmp21_);
	_tmp22_ = g_strdup (_ ("Admin Mode"));
	_tmp23_ = g_strdup (_ ("Enables the Admin Dashboard and requests the needed permissions to use" \
" the Admin API"));
	_tmp24_ = (AdwSwitchRow*) adw_switch_row_new ();
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp24_, _tmp22_);
	_g_free0 (_tmp22_);
	adw_action_row_set_subtitle ((AdwActionRow*) _tmp24_, _tmp23_);
	_g_free0 (_tmp23_);
	g_object_ref_sink (_tmp24_);
	_g_object_unref0 (self->priv->admin_row);
	self->priv->admin_row = _tmp24_;
	_tmp25_ = group;
	_tmp26_ = self->priv->admin_row;
	adw_preferences_group_add (_tmp25_, (GtkWidget*) _tmp26_);
	_tmp27_ = page;
	_tmp28_ = group;
	adw_preferences_page_add (_tmp27_, _tmp28_);
	_tmp29_ = toolbar_view;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp29_);
	_g_object_unref0 (group);
	_g_object_unref0 (toolbar_view);
	_g_object_unref0 (headerbar);
	_g_object_unref0 (page);
	_g_object_unref0 (cancel_button);
	return obj;
}

static void
tuba_dialogs_new_account_settings_dialog_class_init (TubaDialogsNewAccountSettingsDialogClass * klass,
                                                     gpointer klass_data)
{
	tuba_dialogs_new_account_settings_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaDialogsNewAccountSettingsDialog_private_offset);
	G_OBJECT_CLASS (klass)->constructor = tuba_dialogs_new_account_settings_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_dialogs_new_account_settings_dialog_finalize;
	tuba_dialogs_new_account_settings_dialog_signals[TUBA_DIALOGS_NEW_ACCOUNT_SETTINGS_DIALOG_ADMIN_CHANGED_SIGNAL] = g_signal_new ("admin-changed", TUBA_DIALOGS_NEW_ACCOUNT_TYPE_SETTINGS_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
}

static void
tuba_dialogs_new_account_settings_dialog_instance_init (TubaDialogsNewAccountSettingsDialog * self,
                                                        gpointer klass)
{
	self->priv = tuba_dialogs_new_account_settings_dialog_get_instance_private (self);
	self->priv->original_admin_val = FALSE;
}

static void
tuba_dialogs_new_account_settings_dialog_finalize (GObject * obj)
{
	TubaDialogsNewAccountSettingsDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_DIALOGS_NEW_ACCOUNT_TYPE_SETTINGS_DIALOG, TubaDialogsNewAccountSettingsDialog);
	_g_object_unref0 (self->priv->proxy_entry);
	_g_object_unref0 (self->priv->admin_row);
	_g_object_unref0 (self->priv->apply_button);
	G_OBJECT_CLASS (tuba_dialogs_new_account_settings_dialog_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_dialogs_new_account_settings_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaDialogsNewAccountSettingsDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_dialogs_new_account_settings_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaDialogsNewAccountSettingsDialog), 0, (GInstanceInitFunc) tuba_dialogs_new_account_settings_dialog_instance_init, NULL };
	GType tuba_dialogs_new_account_settings_dialog_type_id;
	tuba_dialogs_new_account_settings_dialog_type_id = g_type_register_static (adw_dialog_get_type (), "TubaDialogsNewAccountSettingsDialog", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaDialogsNewAccountSettingsDialog_private_offset = g_type_add_instance_private (tuba_dialogs_new_account_settings_dialog_type_id, sizeof (TubaDialogsNewAccountSettingsDialogPrivate));
	return tuba_dialogs_new_account_settings_dialog_type_id;
}

static GType
tuba_dialogs_new_account_settings_dialog_get_type (void)
{
	static GType tuba_dialogs_new_account_settings_dialog_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_dialogs_new_account_settings_dialog_type_id__once)) {
		GType tuba_dialogs_new_account_settings_dialog_type_id;
		tuba_dialogs_new_account_settings_dialog_type_id = tuba_dialogs_new_account_settings_dialog_get_type_once ();
		g_once_init_leave_pointer (&tuba_dialogs_new_account_settings_dialog_type_id__once, tuba_dialogs_new_account_settings_dialog_type_id);
	}
	return tuba_dialogs_new_account_settings_dialog_type_id__once;
}

static void
tuba_dialogs_new_account_class_init (TubaDialogsNewAccountClass * klass,
                                     gpointer klass_data)
{
	tuba_dialogs_new_account_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaDialogsNewAccount_private_offset);
	((GtkWindowClass *) klass)->close_request = (gboolean (*) (GtkWindow*)) tuba_dialogs_new_account_real_close_request;
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_dialogs_new_account_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_dialogs_new_account_set_property;
	G_OBJECT_CLASS (klass)->finalize = tuba_dialogs_new_account_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_NEW_ACCOUNT_IS_WORKING_PROPERTY, tuba_dialogs_new_account_properties[TUBA_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), TUBA_DIALOGS_NEW_ACCOUNT_REDIRECT_URI_PROPERTY, tuba_dialogs_new_account_properties[TUBA_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), TUBA_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY, tuba_dialogs_new_account_properties[TUBA_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY] = g_param_spec_boolean ("use-auto-auth", "use-auto-auth", "use-auto-auth", TUBA_DIALOGS_NEW_ACCOUNT_SHOULD_AUTO_AUTH, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY, tuba_dialogs_new_account_properties[TUBA_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY] = g_param_spec_object ("account", "account", "account", TUBA_TYPE_INSTANCE_ACCOUNT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_NEW_ACCOUNT_CAN_ACCESS_SETTINGS_PROPERTY, tuba_dialogs_new_account_properties[TUBA_DIALOGS_NEW_ACCOUNT_CAN_ACCESS_SETTINGS_PROPERTY] = g_param_spec_boolean ("can-access-settings", "can-access-settings", "can-access-settings", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_DIALOGS_NEW_ACCOUNT_ADMIN_MODE_PROPERTY, tuba_dialogs_new_account_properties[TUBA_DIALOGS_NEW_ACCOUNT_ADMIN_MODE_PROPERTY] = g_param_spec_boolean ("admin-mode", "admin-mode", "admin-mode", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/dev/geopjr/Tuba/ui/dialogs/new_account.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "toast_overlay", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, toast_overlay));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "deck", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, deck));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "instance_step", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, instance_step));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "code_step", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, code_step));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "done_step", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, done_step));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "instance_entry", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, instance_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "instance_entry_error", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, instance_entry_error));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "code_entry", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, code_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "code_entry_error", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, code_entry_error));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "auth_page", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, auth_page));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "done_page_emoji_label", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, done_page_emoji_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "manual_auth_label", FALSE, TubaDialogsNewAccount_private_offset + G_STRUCT_OFFSET (TubaDialogsNewAccountPrivate, manual_auth_label));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "clear_errors", G_CALLBACK(_tuba_dialogs_new_account_clear_errors_gtk_editable_changed));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_next_clicked", G_CALLBACK(_tuba_dialogs_new_account_on_next_clicked_adw_entry_row_entry_activated));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_done_clicked", G_CALLBACK(_tuba_dialogs_new_account_on_done_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_back_clicked", G_CALLBACK(_tuba_dialogs_new_account_on_back_clicked_adw_navigation_view_popped));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_settings_clicked", G_CALLBACK(_tuba_dialogs_new_account_on_settings_clicked_gtk_button_clicked));
	g_type_ensure (TUBA_WIDGETS_TYPE_EMOJI_LABEL);
}

static void
tuba_dialogs_new_account_instance_init (TubaDialogsNewAccount * self,
                                        gpointer klass)
{
	TubaInstanceAccount* _tmp0_;
	self->priv = tuba_dialogs_new_account_get_instance_private (self);
	self->priv->_is_working = FALSE;
	self->priv->_use_auto_auth = TUBA_DIALOGS_NEW_ACCOUNT_SHOULD_AUTO_AUTH;
	_tmp0_ = tuba_instance_account_new_empty ("");
	self->priv->_account = _tmp0_;
	self->priv->_can_access_settings = FALSE;
	self->priv->_admin_mode = FALSE;
	self->priv->_updating_account = NULL;
	g_type_ensure (TUBA_WIDGETS_TYPE_EMOJI_LABEL);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
tuba_dialogs_new_account_finalize (GObject * obj)
{
	TubaDialogsNewAccount * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_DIALOGS_TYPE_NEW_ACCOUNT, TubaDialogsNewAccount);
	_g_free0 (self->priv->_redirect_uri);
	_g_object_unref0 (self->priv->_account);
	_g_object_unref0 (self->priv->_updating_account);
	G_OBJECT_CLASS (tuba_dialogs_new_account_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_dialogs_new_account_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaDialogsNewAccountClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_dialogs_new_account_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaDialogsNewAccount), 0, (GInstanceInitFunc) tuba_dialogs_new_account_instance_init, NULL };
	GType tuba_dialogs_new_account_type_id;
	tuba_dialogs_new_account_type_id = g_type_register_static (adw_window_get_type (), "TubaDialogsNewAccount", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaDialogsNewAccount_private_offset = g_type_add_instance_private (tuba_dialogs_new_account_type_id, sizeof (TubaDialogsNewAccountPrivate));
	return tuba_dialogs_new_account_type_id;
}

GType
tuba_dialogs_new_account_get_type (void)
{
	static GType tuba_dialogs_new_account_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_dialogs_new_account_type_id__once)) {
		GType tuba_dialogs_new_account_type_id;
		tuba_dialogs_new_account_type_id = tuba_dialogs_new_account_get_type_once ();
		g_once_init_leave_pointer (&tuba_dialogs_new_account_type_id__once, tuba_dialogs_new_account_type_id);
	}
	return tuba_dialogs_new_account_type_id__once;
}

static void
_vala_tuba_dialogs_new_account_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	TubaDialogsNewAccount * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_DIALOGS_TYPE_NEW_ACCOUNT, TubaDialogsNewAccount);
	switch (property_id) {
		case TUBA_DIALOGS_NEW_ACCOUNT_IS_WORKING_PROPERTY:
		g_value_set_boolean (value, tuba_dialogs_new_account_get_is_working (self));
		break;
		case TUBA_DIALOGS_NEW_ACCOUNT_REDIRECT_URI_PROPERTY:
		g_value_set_string (value, tuba_dialogs_new_account_get_redirect_uri (self));
		break;
		case TUBA_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY:
		g_value_set_boolean (value, tuba_dialogs_new_account_get_use_auto_auth (self));
		break;
		case TUBA_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY:
		g_value_set_object (value, tuba_dialogs_new_account_get_account (self));
		break;
		case TUBA_DIALOGS_NEW_ACCOUNT_CAN_ACCESS_SETTINGS_PROPERTY:
		g_value_set_boolean (value, tuba_dialogs_new_account_get_can_access_settings (self));
		break;
		case TUBA_DIALOGS_NEW_ACCOUNT_ADMIN_MODE_PROPERTY:
		g_value_set_boolean (value, tuba_dialogs_new_account_get_admin_mode (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_dialogs_new_account_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	TubaDialogsNewAccount * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_DIALOGS_TYPE_NEW_ACCOUNT, TubaDialogsNewAccount);
	switch (property_id) {
		case TUBA_DIALOGS_NEW_ACCOUNT_IS_WORKING_PROPERTY:
		tuba_dialogs_new_account_set_is_working (self, g_value_get_boolean (value));
		break;
		case TUBA_DIALOGS_NEW_ACCOUNT_REDIRECT_URI_PROPERTY:
		tuba_dialogs_new_account_set_redirect_uri (self, g_value_get_string (value));
		break;
		case TUBA_DIALOGS_NEW_ACCOUNT_USE_AUTO_AUTH_PROPERTY:
		tuba_dialogs_new_account_set_use_auto_auth (self, g_value_get_boolean (value));
		break;
		case TUBA_DIALOGS_NEW_ACCOUNT_ACCOUNT_PROPERTY:
		tuba_dialogs_new_account_set_account (self, g_value_get_object (value));
		break;
		case TUBA_DIALOGS_NEW_ACCOUNT_CAN_ACCESS_SETTINGS_PROPERTY:
		tuba_dialogs_new_account_set_can_access_settings (self, g_value_get_boolean (value));
		break;
		case TUBA_DIALOGS_NEW_ACCOUNT_ADMIN_MODE_PROPERTY:
		tuba_dialogs_new_account_set_admin_mode (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize 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,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

