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

#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include "dino_i18n.h"
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gee.h>
#include "libdino.h"

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

#define DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS (dino_ui_preferences_window_accounts_get_type ())
#define DINO_UI_PREFERENCES_WINDOW_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS, DinoUiPreferencesWindowAccounts))
#define DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS, DinoUiPreferencesWindowAccountsClass))
#define DINO_UI_IS_PREFERENCES_WINDOW_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS))
#define DINO_UI_IS_PREFERENCES_WINDOW_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS))
#define DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS, DinoUiPreferencesWindowAccountsClass))

typedef struct _DinoUiPreferencesWindowAccounts DinoUiPreferencesWindowAccounts;
typedef struct _DinoUiPreferencesWindowAccountsClass DinoUiPreferencesWindowAccountsClass;
typedef struct _DinoUiPreferencesWindowAccountsPrivate DinoUiPreferencesWindowAccountsPrivate;

#define DINO_UI_VIEW_MODEL_TYPE_PREFERENCES_WINDOW (dino_ui_view_model_preferences_window_get_type ())
#define DINO_UI_VIEW_MODEL_PREFERENCES_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_VIEW_MODEL_TYPE_PREFERENCES_WINDOW, DinoUiViewModelPreferencesWindow))
#define DINO_UI_VIEW_MODEL_PREFERENCES_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_VIEW_MODEL_TYPE_PREFERENCES_WINDOW, DinoUiViewModelPreferencesWindowClass))
#define DINO_UI_VIEW_MODEL_IS_PREFERENCES_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_VIEW_MODEL_TYPE_PREFERENCES_WINDOW))
#define DINO_UI_VIEW_MODEL_IS_PREFERENCES_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_VIEW_MODEL_TYPE_PREFERENCES_WINDOW))
#define DINO_UI_VIEW_MODEL_PREFERENCES_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_VIEW_MODEL_TYPE_PREFERENCES_WINDOW, DinoUiViewModelPreferencesWindowClass))

typedef struct _DinoUiViewModelPreferencesWindow DinoUiViewModelPreferencesWindow;
typedef struct _DinoUiViewModelPreferencesWindowClass DinoUiViewModelPreferencesWindowClass;
enum  {
	DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_0_PROPERTY,
	DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_MODEL_PROPERTY,
	DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_NUM_PROPERTIES
};
static GParamSpec* dino_ui_preferences_window_accounts_properties[DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG (dino_ui_manage_accounts_add_account_dialog_get_type ())
#define DINO_UI_MANAGE_ACCOUNTS_ADD_ACCOUNT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG, DinoUiManageAccountsAddAccountDialog))
#define DINO_UI_MANAGE_ACCOUNTS_ADD_ACCOUNT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG, DinoUiManageAccountsAddAccountDialogClass))
#define DINO_UI_MANAGE_ACCOUNTS_IS_ADD_ACCOUNT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG))
#define DINO_UI_MANAGE_ACCOUNTS_IS_ADD_ACCOUNT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG))
#define DINO_UI_MANAGE_ACCOUNTS_ADD_ACCOUNT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_MANAGE_ACCOUNTS_TYPE_ADD_ACCOUNT_DIALOG, DinoUiManageAccountsAddAccountDialogClass))

typedef struct _DinoUiManageAccountsAddAccountDialog DinoUiManageAccountsAddAccountDialog;
typedef struct _DinoUiManageAccountsAddAccountDialogClass DinoUiManageAccountsAddAccountDialogClass;
typedef struct _DinoUiViewModelPreferencesWindowPrivate DinoUiViewModelPreferencesWindowPrivate;

#define DINO_UI_VIEW_MODEL_TYPE_ACCOUNT_DETAILS (dino_ui_view_model_account_details_get_type ())
#define DINO_UI_VIEW_MODEL_ACCOUNT_DETAILS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_VIEW_MODEL_TYPE_ACCOUNT_DETAILS, DinoUiViewModelAccountDetails))
#define DINO_UI_VIEW_MODEL_ACCOUNT_DETAILS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_VIEW_MODEL_TYPE_ACCOUNT_DETAILS, DinoUiViewModelAccountDetailsClass))
#define DINO_UI_VIEW_MODEL_IS_ACCOUNT_DETAILS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_VIEW_MODEL_TYPE_ACCOUNT_DETAILS))
#define DINO_UI_VIEW_MODEL_IS_ACCOUNT_DETAILS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_VIEW_MODEL_TYPE_ACCOUNT_DETAILS))
#define DINO_UI_VIEW_MODEL_ACCOUNT_DETAILS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_VIEW_MODEL_TYPE_ACCOUNT_DETAILS, DinoUiViewModelAccountDetailsClass))

typedef struct _DinoUiViewModelAccountDetails DinoUiViewModelAccountDetails;
typedef struct _DinoUiViewModelAccountDetailsClass DinoUiViewModelAccountDetailsClass;
typedef struct _Block82Data Block82Data;

#define DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL (dino_ui_view_model_avatar_picture_model_get_type ())
#define DINO_UI_VIEW_MODEL_AVATAR_PICTURE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL, DinoUiViewModelAvatarPictureModel))
#define DINO_UI_VIEW_MODEL_AVATAR_PICTURE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL, DinoUiViewModelAvatarPictureModelClass))
#define DINO_UI_VIEW_MODEL_IS_AVATAR_PICTURE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL))
#define DINO_UI_VIEW_MODEL_IS_AVATAR_PICTURE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL))
#define DINO_UI_VIEW_MODEL_AVATAR_PICTURE_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_VIEW_MODEL_TYPE_AVATAR_PICTURE_MODEL, DinoUiViewModelAvatarPictureModelClass))

typedef struct _DinoUiViewModelAvatarPictureModel DinoUiViewModelAvatarPictureModel;
typedef struct _DinoUiViewModelAvatarPictureModelClass DinoUiViewModelAvatarPictureModelClass;

#define DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL (dino_ui_view_model_compat_avatar_picture_model_get_type ())
#define DINO_UI_VIEW_MODEL_COMPAT_AVATAR_PICTURE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL, DinoUiViewModelCompatAvatarPictureModel))
#define DINO_UI_VIEW_MODEL_COMPAT_AVATAR_PICTURE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL, DinoUiViewModelCompatAvatarPictureModelClass))
#define DINO_UI_VIEW_MODEL_IS_COMPAT_AVATAR_PICTURE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL))
#define DINO_UI_VIEW_MODEL_IS_COMPAT_AVATAR_PICTURE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL))
#define DINO_UI_VIEW_MODEL_COMPAT_AVATAR_PICTURE_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_VIEW_MODEL_TYPE_COMPAT_AVATAR_PICTURE_MODEL, DinoUiViewModelCompatAvatarPictureModelClass))

typedef struct _DinoUiViewModelCompatAvatarPictureModel DinoUiViewModelCompatAvatarPictureModel;
typedef struct _DinoUiViewModelCompatAvatarPictureModelClass DinoUiViewModelCompatAvatarPictureModelClass;

#define DINO_UI_TYPE_AVATAR_PICTURE (dino_ui_avatar_picture_get_type ())
#define DINO_UI_AVATAR_PICTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_AVATAR_PICTURE, DinoUiAvatarPicture))
#define DINO_UI_AVATAR_PICTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_AVATAR_PICTURE, DinoUiAvatarPictureClass))
#define DINO_UI_IS_AVATAR_PICTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_AVATAR_PICTURE))
#define DINO_UI_IS_AVATAR_PICTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_AVATAR_PICTURE))
#define DINO_UI_AVATAR_PICTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_AVATAR_PICTURE, DinoUiAvatarPictureClass))

typedef struct _DinoUiAvatarPicture DinoUiAvatarPicture;
typedef struct _DinoUiAvatarPictureClass DinoUiAvatarPictureClass;
enum  {
	DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_ACCOUNT_CHOSEN_SIGNAL,
	DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_NUM_SIGNALS
};
static guint dino_ui_preferences_window_accounts_signals[DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_NUM_SIGNALS] = {0};

struct _DinoUiPreferencesWindowAccounts {
	AdwPreferencesPage parent_instance;
	DinoUiPreferencesWindowAccountsPrivate * priv;
	AdwPreferencesGroup* active_accounts;
	AdwPreferencesGroup* disabled_accounts;
};

struct _DinoUiPreferencesWindowAccountsClass {
	AdwPreferencesPageClass parent_class;
};

struct _DinoUiPreferencesWindowAccountsPrivate {
	DinoUiViewModelPreferencesWindow* _model;
};

struct _DinoUiViewModelPreferencesWindow {
	GObject parent_instance;
	DinoUiViewModelPreferencesWindowPrivate * priv;
	GeeHashMap* account_details;
	DinoStreamInteractor* stream_interactor;
	DinoDatabase* db;
};

struct _DinoUiViewModelPreferencesWindowClass {
	GObjectClass parent_class;
};

struct _Block82Data {
	int _ref_count_;
	DinoUiPreferencesWindowAccounts* self;
	DinoUiViewModelAccountDetails* account_details;
};

static gint DinoUiPreferencesWindowAccounts_private_offset;
static gpointer dino_ui_preferences_window_accounts_parent_class = NULL;

VALA_EXTERN GType dino_ui_preferences_window_accounts_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiPreferencesWindowAccounts, g_object_unref)
VALA_EXTERN GType dino_ui_view_model_preferences_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiViewModelPreferencesWindow, g_object_unref)
static void dino_ui_preferences_window_accounts_refresh (DinoUiPreferencesWindowAccounts* self);
static void __lambda255_ (DinoUiPreferencesWindowAccounts* self);
VALA_EXTERN GType dino_ui_manage_accounts_add_account_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiManageAccountsAddAccountDialog, g_object_unref)
VALA_EXTERN DinoUiViewModelPreferencesWindow* dino_ui_preferences_window_accounts_get_model (DinoUiPreferencesWindowAccounts* self);
VALA_EXTERN GType dino_ui_view_model_account_details_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiViewModelAccountDetails, g_object_unref)
VALA_EXTERN DinoUiManageAccountsAddAccountDialog* dino_ui_manage_accounts_add_account_dialog_new (DinoStreamInteractor* stream_interactor,
                                                                                      DinoDatabase* db);
VALA_EXTERN DinoUiManageAccountsAddAccountDialog* dino_ui_manage_accounts_add_account_dialog_construct (GType object_type,
                                                                                            DinoStreamInteractor* stream_interactor,
                                                                                            DinoDatabase* db);
static void __lambda256_ (DinoUiPreferencesWindowAccounts* self,
                   DinoEntitiesAccount* account);
static void ___lambda256__dino_ui_manage_accounts_add_account_dialog_added (DinoUiManageAccountsAddAccountDialog* _sender,
                                                                     DinoEntitiesAccount* account,
                                                                     gpointer self);
static void ___lambda255__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static Block82Data* block82_data_ref (Block82Data* _data82_);
static void block82_data_unref (void * _userdata_);
VALA_EXTERN gchar* dino_ui_view_model_account_details_get_bare_jid (DinoUiViewModelAccountDetails* self);
VALA_EXTERN GType dino_ui_view_model_avatar_picture_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiViewModelAvatarPictureModel, g_object_unref)
VALA_EXTERN GType dino_ui_view_model_compat_avatar_picture_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiViewModelCompatAvatarPictureModel, g_object_unref)
VALA_EXTERN DinoUiViewModelCompatAvatarPictureModel* dino_ui_view_model_account_details_get_avatar_model (DinoUiViewModelAccountDetails* self);
VALA_EXTERN GType dino_ui_avatar_picture_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiAvatarPicture, g_object_unref)
VALA_EXTERN DinoUiAvatarPicture* dino_ui_avatar_picture_new (void);
VALA_EXTERN DinoUiAvatarPicture* dino_ui_avatar_picture_construct (GType object_type);
VALA_EXTERN void dino_ui_avatar_picture_set_model (DinoUiAvatarPicture* self,
                                       DinoUiViewModelAvatarPictureModel* value);
VALA_EXTERN DinoEntitiesAccount* dino_ui_view_model_account_details_get_account (DinoUiViewModelAccountDetails* self);
static void ____lambda257_ (Block82Data* _data82_);
static void _____lambda257__adw_action_row_activated (AdwActionRow* _sender,
                                               gpointer self);
VALA_EXTERN DinoUiPreferencesWindowAccounts* dino_ui_preferences_window_accounts_new (void);
VALA_EXTERN DinoUiPreferencesWindowAccounts* dino_ui_preferences_window_accounts_construct (GType object_type);
VALA_EXTERN void dino_ui_preferences_window_accounts_set_model (DinoUiPreferencesWindowAccounts* self,
                                                    DinoUiViewModelPreferencesWindow* value);
static GObject * dino_ui_preferences_window_accounts_constructor (GType type,
                                                           guint n_construct_properties,
                                                           GObjectConstructParam * construct_properties);
static void _dino_ui_preferences_window_accounts___lambda258_ (DinoUiPreferencesWindowAccounts* self);
static void _dino_ui_preferences_window_accounts_refresh_dino_ui_view_model_preferences_window_update (DinoUiViewModelPreferencesWindow* _sender,
                                                                                                gpointer self);
static void __dino_ui_preferences_window_accounts___lambda258__g_object_notify (GObject* _sender,
                                                                         GParamSpec* pspec,
                                                                         gpointer self);
static void dino_ui_preferences_window_accounts_finalize (GObject * obj);
static GType dino_ui_preferences_window_accounts_get_type_once (void);
static void _vala_dino_ui_preferences_window_accounts_get_property (GObject * object,
                                                             guint property_id,
                                                             GValue * value,
                                                             GParamSpec * pspec);
static void _vala_dino_ui_preferences_window_accounts_set_property (GObject * object,
                                                             guint property_id,
                                                             const GValue * value,
                                                             GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_ui_preferences_window_accounts_get_instance_private (DinoUiPreferencesWindowAccounts* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiPreferencesWindowAccounts_private_offset);
}

static void
__lambda256_ (DinoUiPreferencesWindowAccounts* self,
              DinoEntitiesAccount* account)
{
	g_return_if_fail (account != NULL);
	dino_ui_preferences_window_accounts_refresh (self);
}

static void
___lambda256__dino_ui_manage_accounts_add_account_dialog_added (DinoUiManageAccountsAddAccountDialog* _sender,
                                                                DinoEntitiesAccount* account,
                                                                gpointer self)
{
	__lambda256_ ((DinoUiPreferencesWindowAccounts*) self, account);
}

static void
__lambda255_ (DinoUiPreferencesWindowAccounts* self)
{
	DinoUiManageAccountsAddAccountDialog* add_account_dialog = NULL;
	DinoUiViewModelPreferencesWindow* _tmp0_;
	DinoStreamInteractor* _tmp1_;
	DinoUiViewModelPreferencesWindow* _tmp2_;
	DinoDatabase* _tmp3_;
	DinoUiManageAccountsAddAccountDialog* _tmp4_;
	GtkRoot* _tmp5_;
	_tmp0_ = self->priv->_model;
	_tmp1_ = _tmp0_->stream_interactor;
	_tmp2_ = self->priv->_model;
	_tmp3_ = _tmp2_->db;
	_tmp4_ = dino_ui_manage_accounts_add_account_dialog_new (_tmp1_, _tmp3_);
	g_object_ref_sink (_tmp4_);
	add_account_dialog = _tmp4_;
	_tmp5_ = gtk_widget_get_root ((GtkWidget*) self);
	gtk_window_set_transient_for ((GtkWindow*) add_account_dialog, G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, gtk_window_get_type (), GtkWindow));
	g_signal_connect_object (add_account_dialog, "added", (GCallback) ___lambda256__dino_ui_manage_accounts_add_account_dialog_added, self, 0);
	gtk_window_present ((GtkWindow*) add_account_dialog);
	_g_object_unref0 (add_account_dialog);
}

static void
___lambda255__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda255_ ((DinoUiPreferencesWindowAccounts*) self);
}

static Block82Data*
block82_data_ref (Block82Data* _data82_)
{
	g_atomic_int_inc (&_data82_->_ref_count_);
	return _data82_;
}

static void
block82_data_unref (void * _userdata_)
{
	Block82Data* _data82_;
	_data82_ = (Block82Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data82_->_ref_count_)) {
		DinoUiPreferencesWindowAccounts* self;
		self = _data82_->self;
		_g_object_unref0 (_data82_->account_details);
		_g_object_unref0 (self);
		g_slice_free (Block82Data, _data82_);
	}
}

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

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

static void
____lambda257_ (Block82Data* _data82_)
{
	DinoUiPreferencesWindowAccounts* self;
	DinoUiViewModelAccountDetails* _tmp0_;
	DinoEntitiesAccount* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	self = _data82_->self;
	_tmp0_ = _data82_->account_details;
	_tmp1_ = dino_ui_view_model_account_details_get_account (_tmp0_);
	_tmp2_ = _tmp1_;
	g_signal_emit (self, dino_ui_preferences_window_accounts_signals[DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_ACCOUNT_CHOSEN_SIGNAL], 0, _tmp2_);
}

static void
_____lambda257__adw_action_row_activated (AdwActionRow* _sender,
                                          gpointer self)
{
	____lambda257_ (self);
}

static void
dino_ui_preferences_window_accounts_refresh (DinoUiPreferencesWindowAccounts* self)
{
	AdwPreferencesGroup* _tmp0_;
	AdwPreferencesGroup* _tmp2_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	AdwPreferencesGroup* _tmp6_ = NULL;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	AdwPreferencesGroup* _tmp9_ = NULL;
	GtkButton* add_account_button = NULL;
	GtkButton* _tmp10_;
	GtkButton* _tmp11_;
	GtkButton* _tmp12_;
	const gchar* _tmp13_;
	AdwPreferencesGroup* _tmp14_;
	GtkButton* _tmp15_;
	AdwPreferencesGroup* _tmp16_;
	AdwPreferencesGroup* _tmp17_;
	GtkButton* _tmp18_;
	AdwPreferencesGroup* _tmp19_;
	gboolean enabled_account_added = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->active_accounts;
	if (_tmp0_ != NULL) {
		AdwPreferencesGroup* _tmp1_;
		_tmp1_ = self->active_accounts;
		adw_preferences_page_remove ((AdwPreferencesPage*) self, _tmp1_);
	}
	_tmp2_ = self->disabled_accounts;
	if (_tmp2_ != NULL) {
		AdwPreferencesGroup* _tmp3_;
		_tmp3_ = self->disabled_accounts;
		adw_preferences_page_remove ((AdwPreferencesPage*) self, _tmp3_);
	}
	_tmp4_ = dino_gettext ("Accounts");
	_tmp5_ = g_strdup (_tmp4_);
	_tmp6_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
	adw_preferences_group_set_title (_tmp6_, _tmp5_);
	_g_free0 (_tmp5_);
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->active_accounts);
	self->active_accounts = _tmp6_;
	_tmp7_ = dino_gettext ("Disabled accounts");
	_tmp8_ = g_strdup (_tmp7_);
	_tmp9_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
	adw_preferences_group_set_title (_tmp9_, _tmp8_);
	_g_free0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->disabled_accounts);
	self->disabled_accounts = _tmp9_;
	_tmp10_ = (GtkButton*) gtk_button_new_from_icon_name ("list-add-symbolic");
	g_object_ref_sink (_tmp10_);
	add_account_button = _tmp10_;
	_tmp11_ = add_account_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp11_, "flat");
	_tmp12_ = add_account_button;
	_tmp13_ = dino_gettext ("Add Account");
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp12_, _tmp13_);
	_tmp14_ = self->active_accounts;
	_tmp15_ = add_account_button;
	adw_preferences_group_set_header_suffix (_tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = self->active_accounts;
	adw_preferences_page_add ((AdwPreferencesPage*) self, _tmp16_);
	_tmp17_ = self->disabled_accounts;
	adw_preferences_page_add ((AdwPreferencesPage*) self, _tmp17_);
	_tmp18_ = add_account_button;
	g_signal_connect_object (_tmp18_, "clicked", (GCallback) ___lambda255__gtk_button_clicked, self, 0);
	_tmp19_ = self->disabled_accounts;
	gtk_widget_set_visible ((GtkWidget*) _tmp19_, FALSE);
	enabled_account_added = FALSE;
	{
		GeeIterator* _account_details_it = NULL;
		DinoUiViewModelPreferencesWindow* _tmp20_;
		GeeHashMap* _tmp21_;
		GeeCollection* _tmp22_;
		GeeCollection* _tmp23_;
		GeeCollection* _tmp24_;
		GeeIterator* _tmp25_;
		GeeIterator* _tmp26_;
		_tmp20_ = self->priv->_model;
		_tmp21_ = _tmp20_->account_details;
		_tmp22_ = gee_abstract_map_get_values ((GeeAbstractMap*) _tmp21_);
		_tmp23_ = _tmp22_;
		_tmp24_ = _tmp23_;
		_tmp25_ = gee_iterable_iterator ((GeeIterable*) _tmp24_);
		_tmp26_ = _tmp25_;
		_g_object_unref0 (_tmp24_);
		_account_details_it = _tmp26_;
		while (TRUE) {
			Block82Data* _data82_;
			GeeIterator* _tmp27_;
			GeeIterator* _tmp28_;
			gpointer _tmp29_;
			AdwActionRow* row = NULL;
			DinoUiViewModelAccountDetails* _tmp30_;
			gchar* _tmp31_;
			gchar* _tmp32_;
			gchar* _tmp33_;
			const gchar* _tmp34_;
			gchar* _tmp35_;
			AdwActionRow* _tmp36_ = NULL;
			AdwActionRow* _tmp37_;
			AdwActionRow* _tmp38_;
			DinoUiViewModelAccountDetails* _tmp39_;
			DinoUiViewModelCompatAvatarPictureModel* _tmp40_;
			DinoUiViewModelCompatAvatarPictureModel* _tmp41_;
			DinoUiViewModelAvatarPictureModel* _tmp42_;
			DinoUiAvatarPicture* _tmp43_ = NULL;
			DinoUiAvatarPicture* _tmp44_;
			AdwActionRow* _tmp45_;
			GtkImage* _tmp46_;
			GtkImage* _tmp47_;
			AdwActionRow* _tmp48_;
			DinoUiViewModelAccountDetails* _tmp49_;
			DinoEntitiesAccount* _tmp50_;
			DinoEntitiesAccount* _tmp51_;
			gboolean _tmp52_;
			gboolean _tmp53_;
			AdwActionRow* _tmp59_;
			_data82_ = g_slice_new0 (Block82Data);
			_data82_->_ref_count_ = 1;
			_data82_->self = g_object_ref (self);
			_tmp27_ = _account_details_it;
			if (!gee_iterator_next (_tmp27_)) {
				block82_data_unref (_data82_);
				_data82_ = NULL;
				break;
			}
			_tmp28_ = _account_details_it;
			_tmp29_ = gee_iterator_get (_tmp28_);
			_data82_->account_details = (DinoUiViewModelAccountDetails*) _tmp29_;
			_tmp30_ = _data82_->account_details;
			_tmp31_ = dino_ui_view_model_account_details_get_bare_jid (_tmp30_);
			_tmp32_ = _tmp31_;
			_tmp33_ = _tmp32_;
			_tmp34_ = string_to_string (_tmp33_);
			_tmp35_ = g_strdup (_tmp34_);
			_tmp36_ = (AdwActionRow*) adw_action_row_new ();
			adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp36_, _tmp35_);
			_g_free0 (_tmp35_);
			g_object_ref_sink (_tmp36_);
			_tmp37_ = _tmp36_;
			_g_free0 (_tmp33_);
			row = _tmp37_;
			_tmp38_ = row;
			_tmp39_ = _data82_->account_details;
			_tmp40_ = dino_ui_view_model_account_details_get_avatar_model (_tmp39_);
			_tmp41_ = _tmp40_;
			_tmp42_ = _g_object_ref0 ((DinoUiViewModelAvatarPictureModel*) _tmp41_);
			_tmp43_ = dino_ui_avatar_picture_new ();
			gtk_widget_set_valign ((GtkWidget*) _tmp43_, GTK_ALIGN_CENTER);
			g_object_set ((GtkWidget*) _tmp43_, "height-request", 35, NULL);
			g_object_set ((GtkWidget*) _tmp43_, "width-request", 35, NULL);
			dino_ui_avatar_picture_set_model (_tmp43_, _tmp42_);
			_g_object_unref0 (_tmp42_);
			g_object_ref_sink (_tmp43_);
			_tmp44_ = _tmp43_;
			adw_action_row_add_prefix (_tmp38_, (GtkWidget*) _tmp44_);
			_g_object_unref0 (_tmp44_);
			_tmp45_ = row;
			_tmp46_ = (GtkImage*) gtk_image_new_from_icon_name ("go-next-symbolic");
			g_object_ref_sink (_tmp46_);
			_tmp47_ = _tmp46_;
			adw_action_row_add_suffix (_tmp45_, (GtkWidget*) _tmp47_);
			_g_object_unref0 (_tmp47_);
			_tmp48_ = row;
			gtk_list_box_row_set_activatable ((GtkListBoxRow*) _tmp48_, TRUE);
			_tmp49_ = _data82_->account_details;
			_tmp50_ = dino_ui_view_model_account_details_get_account (_tmp49_);
			_tmp51_ = _tmp50_;
			_tmp52_ = dino_entities_account_get_enabled (_tmp51_);
			_tmp53_ = _tmp52_;
			if (_tmp53_) {
				AdwPreferencesGroup* _tmp54_;
				AdwActionRow* _tmp55_;
				_tmp54_ = self->active_accounts;
				_tmp55_ = row;
				adw_preferences_group_add (_tmp54_, (GtkWidget*) _tmp55_);
				enabled_account_added = TRUE;
			} else {
				AdwPreferencesGroup* _tmp56_;
				AdwActionRow* _tmp57_;
				AdwPreferencesGroup* _tmp58_;
				_tmp56_ = self->disabled_accounts;
				_tmp57_ = row;
				adw_preferences_group_add (_tmp56_, (GtkWidget*) _tmp57_);
				_tmp58_ = self->disabled_accounts;
				gtk_widget_set_visible ((GtkWidget*) _tmp58_, TRUE);
			}
			_tmp59_ = row;
			g_signal_connect_data (_tmp59_, "activated", (GCallback) _____lambda257__adw_action_row_activated, block82_data_ref (_data82_), (GClosureNotify) block82_data_unref, 0);
			_g_object_unref0 (row);
			block82_data_unref (_data82_);
			_data82_ = NULL;
		}
		_g_object_unref0 (_account_details_it);
	}
	if (!enabled_account_added) {
		AdwPreferencesGroup* _tmp60_;
		const gchar* _tmp61_;
		gchar* _tmp62_;
		AdwActionRow* _tmp63_ = NULL;
		AdwActionRow* _tmp64_;
		_tmp60_ = self->active_accounts;
		_tmp61_ = dino_gettext ("No active accounts");
		_tmp62_ = g_strdup (_tmp61_);
		_tmp63_ = (AdwActionRow*) adw_action_row_new ();
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp63_, _tmp62_);
		_g_free0 (_tmp62_);
		g_object_ref_sink (_tmp63_);
		_tmp64_ = _tmp63_;
		adw_preferences_group_add (_tmp60_, (GtkWidget*) _tmp64_);
		_g_object_unref0 (_tmp64_);
	}
	_g_object_unref0 (add_account_button);
}

DinoUiPreferencesWindowAccounts*
dino_ui_preferences_window_accounts_construct (GType object_type)
{
	DinoUiPreferencesWindowAccounts * self = NULL;
	self = (DinoUiPreferencesWindowAccounts*) g_object_new (object_type, NULL);
	return self;
}

DinoUiPreferencesWindowAccounts*
dino_ui_preferences_window_accounts_new (void)
{
	return dino_ui_preferences_window_accounts_construct (DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS);
}

DinoUiViewModelPreferencesWindow*
dino_ui_preferences_window_accounts_get_model (DinoUiPreferencesWindowAccounts* self)
{
	DinoUiViewModelPreferencesWindow* result;
	DinoUiViewModelPreferencesWindow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_model;
	result = _tmp0_;
	return result;
}

void
dino_ui_preferences_window_accounts_set_model (DinoUiPreferencesWindowAccounts* self,
                                               DinoUiViewModelPreferencesWindow* value)
{
	DinoUiViewModelPreferencesWindow* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_preferences_window_accounts_get_model (self);
	if (old_value != value) {
		DinoUiViewModelPreferencesWindow* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_model);
		self->priv->_model = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_ui_preferences_window_accounts_properties[DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_MODEL_PROPERTY]);
	}
}

static void
_dino_ui_preferences_window_accounts_refresh_dino_ui_view_model_preferences_window_update (DinoUiViewModelPreferencesWindow* _sender,
                                                                                           gpointer self)
{
	dino_ui_preferences_window_accounts_refresh ((DinoUiPreferencesWindowAccounts*) self);
}

static void
_dino_ui_preferences_window_accounts___lambda258_ (DinoUiPreferencesWindowAccounts* self)
{
	DinoUiViewModelPreferencesWindow* _tmp0_;
	_tmp0_ = self->priv->_model;
	g_signal_connect_object (_tmp0_, "update", (GCallback) _dino_ui_preferences_window_accounts_refresh_dino_ui_view_model_preferences_window_update, self, 0);
}

static void
__dino_ui_preferences_window_accounts___lambda258__g_object_notify (GObject* _sender,
                                                                    GParamSpec* pspec,
                                                                    gpointer self)
{
	_dino_ui_preferences_window_accounts___lambda258_ ((DinoUiPreferencesWindowAccounts*) self);
}

static GObject *
dino_ui_preferences_window_accounts_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DinoUiPreferencesWindowAccounts * self;
	const gchar* _tmp0_;
	parent_class = G_OBJECT_CLASS (dino_ui_preferences_window_accounts_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS, DinoUiPreferencesWindowAccounts);
	_tmp0_ = dino_gettext ("Accounts");
	adw_preferences_page_set_title ((AdwPreferencesPage*) self, _tmp0_);
	adw_preferences_page_set_icon_name ((AdwPreferencesPage*) self, "system-users-symbolic");
	g_signal_connect_object ((GObject*) self, "notify::model", (GCallback) __dino_ui_preferences_window_accounts___lambda258__g_object_notify, self, 0);
	return obj;
}

static void
dino_ui_preferences_window_accounts_class_init (DinoUiPreferencesWindowAccountsClass * klass,
                                                gpointer klass_data)
{
	dino_ui_preferences_window_accounts_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiPreferencesWindowAccounts_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_ui_preferences_window_accounts_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dino_ui_preferences_window_accounts_set_property;
	G_OBJECT_CLASS (klass)->constructor = dino_ui_preferences_window_accounts_constructor;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_preferences_window_accounts_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_MODEL_PROPERTY, dino_ui_preferences_window_accounts_properties[DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_MODEL_PROPERTY] = g_param_spec_object ("model", "model", "model", DINO_UI_VIEW_MODEL_TYPE_PREFERENCES_WINDOW, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	dino_ui_preferences_window_accounts_signals[DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_ACCOUNT_CHOSEN_SIGNAL] = g_signal_new ("account-chosen", DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, DINO_ENTITIES_TYPE_ACCOUNT);
}

static void
dino_ui_preferences_window_accounts_instance_init (DinoUiPreferencesWindowAccounts * self,
                                                   gpointer klass)
{
	self->priv = dino_ui_preferences_window_accounts_get_instance_private (self);
}

static void
dino_ui_preferences_window_accounts_finalize (GObject * obj)
{
	DinoUiPreferencesWindowAccounts * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS, DinoUiPreferencesWindowAccounts);
	_g_object_unref0 (self->active_accounts);
	_g_object_unref0 (self->disabled_accounts);
	_g_object_unref0 (self->priv->_model);
	G_OBJECT_CLASS (dino_ui_preferences_window_accounts_parent_class)->finalize (obj);
}

static GType
dino_ui_preferences_window_accounts_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiPreferencesWindowAccountsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_preferences_window_accounts_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiPreferencesWindowAccounts), 0, (GInstanceInitFunc) dino_ui_preferences_window_accounts_instance_init, NULL };
	GType dino_ui_preferences_window_accounts_type_id;
	dino_ui_preferences_window_accounts_type_id = g_type_register_static (adw_preferences_page_get_type (), "DinoUiPreferencesWindowAccounts", &g_define_type_info, 0);
	DinoUiPreferencesWindowAccounts_private_offset = g_type_add_instance_private (dino_ui_preferences_window_accounts_type_id, sizeof (DinoUiPreferencesWindowAccountsPrivate));
	return dino_ui_preferences_window_accounts_type_id;
}

GType
dino_ui_preferences_window_accounts_get_type (void)
{
	static volatile gsize dino_ui_preferences_window_accounts_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_preferences_window_accounts_type_id__once)) {
		GType dino_ui_preferences_window_accounts_type_id;
		dino_ui_preferences_window_accounts_type_id = dino_ui_preferences_window_accounts_get_type_once ();
		g_once_init_leave (&dino_ui_preferences_window_accounts_type_id__once, dino_ui_preferences_window_accounts_type_id);
	}
	return dino_ui_preferences_window_accounts_type_id__once;
}

static void
_vala_dino_ui_preferences_window_accounts_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec)
{
	DinoUiPreferencesWindowAccounts * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS, DinoUiPreferencesWindowAccounts);
	switch (property_id) {
		case DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_MODEL_PROPERTY:
		g_value_set_object (value, dino_ui_preferences_window_accounts_get_model (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dino_ui_preferences_window_accounts_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec)
{
	DinoUiPreferencesWindowAccounts * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_PREFERENCES_WINDOW_ACCOUNTS, DinoUiPreferencesWindowAccounts);
	switch (property_id) {
		case DINO_UI_PREFERENCES_WINDOW_ACCOUNTS_MODEL_PROPERTY:
		dino_ui_preferences_window_accounts_set_model (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

