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

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gee.h>
#include <glib.h>
#include "libdino.h"
#include <gio/gio.h>
#include "dino_i18n.h"
#include <stdlib.h>
#include <string.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_ENCRYPTION (dino_ui_preferences_window_encryption_get_type ())
#define DINO_UI_PREFERENCES_WINDOW_ENCRYPTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_PREFERENCES_WINDOW_ENCRYPTION, DinoUiPreferencesWindowEncryption))
#define DINO_UI_PREFERENCES_WINDOW_ENCRYPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_PREFERENCES_WINDOW_ENCRYPTION, DinoUiPreferencesWindowEncryptionClass))
#define DINO_UI_IS_PREFERENCES_WINDOW_ENCRYPTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_PREFERENCES_WINDOW_ENCRYPTION))
#define DINO_UI_IS_PREFERENCES_WINDOW_ENCRYPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_PREFERENCES_WINDOW_ENCRYPTION))
#define DINO_UI_PREFERENCES_WINDOW_ENCRYPTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_PREFERENCES_WINDOW_ENCRYPTION, DinoUiPreferencesWindowEncryptionClass))

typedef struct _DinoUiPreferencesWindowEncryption DinoUiPreferencesWindowEncryption;
typedef struct _DinoUiPreferencesWindowEncryptionClass DinoUiPreferencesWindowEncryptionClass;
typedef struct _DinoUiPreferencesWindowEncryptionPrivate DinoUiPreferencesWindowEncryptionPrivate;

#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_ENCRYPTION_0_PROPERTY,
	DINO_UI_PREFERENCES_WINDOW_ENCRYPTION_MODEL_PROPERTY,
	DINO_UI_PREFERENCES_WINDOW_ENCRYPTION_NUM_PROPERTIES
};
static GParamSpec* dino_ui_preferences_window_encryption_properties[DINO_UI_PREFERENCES_WINDOW_ENCRYPTION_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
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;

#define DINO_UI_TYPE_APPLICATION (dino_ui_application_get_type ())
#define DINO_UI_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_UI_TYPE_APPLICATION, DinoUiApplication))
#define DINO_UI_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_UI_TYPE_APPLICATION, DinoUiApplicationClass))
#define DINO_UI_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_UI_TYPE_APPLICATION))
#define DINO_UI_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_UI_TYPE_APPLICATION))
#define DINO_UI_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_UI_TYPE_APPLICATION, DinoUiApplicationClass))

typedef struct _DinoUiApplication DinoUiApplication;
typedef struct _DinoUiApplicationClass DinoUiApplicationClass;

struct _DinoUiPreferencesWindowEncryption {
	AdwPreferencesPage parent_instance;
	DinoUiPreferencesWindowEncryptionPrivate * priv;
};

struct _DinoUiPreferencesWindowEncryptionClass {
	AdwPreferencesPageClass parent_class;
};

struct _DinoUiPreferencesWindowEncryptionPrivate {
	GtkDropDown* drop_down;
	AdwPreferencesGroup* accounts_group;
	GeeArrayList* added_widgets;
	DinoUiViewModelPreferencesWindow* _model;
};

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

struct _DinoUiViewModelPreferencesWindowClass {
	GObjectClass parent_class;
};

static gint DinoUiPreferencesWindowEncryption_private_offset;
static gpointer dino_ui_preferences_window_encryption_parent_class = NULL;

VALA_EXTERN GType dino_ui_preferences_window_encryption_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiPreferencesWindowEncryption, 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_encryption_repopulate_account_selector (DinoUiPreferencesWindowEncryption* self);
VALA_EXTERN DinoUiViewModelPreferencesWindow* dino_ui_preferences_window_encryption_get_model (DinoUiPreferencesWindowEncryption* 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 GtkSingleSelection* dino_ui_view_model_preferences_window_get_active_accounts_selection (DinoUiViewModelPreferencesWindow* self);
static void ___lambda259_ (DinoUiPreferencesWindowEncryption* self);
static void dino_ui_preferences_window_encryption_set_account (DinoUiPreferencesWindowEncryption* self,
                                                        DinoEntitiesAccount* account);
VALA_EXTERN DinoEntitiesAccount* dino_ui_view_model_account_details_get_account (DinoUiViewModelAccountDetails* self);
static void ____lambda259__g_object_notify (GObject* _sender,
                                     GParamSpec* pspec,
                                     gpointer self);
static void dino_ui_preferences_window_encryption_unset_account (DinoUiPreferencesWindowEncryption* self);
VALA_EXTERN GType dino_ui_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DinoUiApplication, g_object_unref)
VALA_EXTERN DinoUiPreferencesWindowEncryption* dino_ui_preferences_window_encryption_new (void);
VALA_EXTERN DinoUiPreferencesWindowEncryption* dino_ui_preferences_window_encryption_construct (GType object_type);
VALA_EXTERN void dino_ui_preferences_window_encryption_set_model (DinoUiPreferencesWindowEncryption* self,
                                                      DinoUiViewModelPreferencesWindow* value);
static GObject * dino_ui_preferences_window_encryption_constructor (GType type,
                                                             guint n_construct_properties,
                                                             GObjectConstructParam * construct_properties);
static void _dino_ui_preferences_window_encryption___lambda260_ (DinoUiPreferencesWindowEncryption* self);
static void __lambda261_ (DinoUiPreferencesWindowEncryption* self);
static void ___lambda261__dino_ui_view_model_preferences_window_update (DinoUiViewModelPreferencesWindow* _sender,
                                                                 gpointer self);
static void __dino_ui_preferences_window_encryption___lambda260__g_object_notify (GObject* _sender,
                                                                           GParamSpec* pspec,
                                                                           gpointer self);
static void dino_ui_preferences_window_encryption_finalize (GObject * obj);
static GType dino_ui_preferences_window_encryption_get_type_once (void);
static void _vala_dino_ui_preferences_window_encryption_get_property (GObject * object,
                                                               guint property_id,
                                                               GValue * value,
                                                               GParamSpec * pspec);
static void _vala_dino_ui_preferences_window_encryption_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 _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_ui_preferences_window_encryption_get_instance_private (DinoUiPreferencesWindowEncryption* self)
{
	return G_STRUCT_MEMBER_P (self, DinoUiPreferencesWindowEncryption_private_offset);
}

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

static void
___lambda259_ (DinoUiPreferencesWindowEncryption* self)
{
	DinoUiViewModelAccountDetails* account_details = NULL;
	GtkDropDown* _tmp0_;
	GObject* _tmp1_;
	GObject* _tmp2_;
	DinoUiViewModelAccountDetails* _tmp3_;
	DinoUiViewModelAccountDetails* _tmp4_;
	DinoUiViewModelAccountDetails* _tmp5_;
	DinoEntitiesAccount* _tmp6_;
	DinoEntitiesAccount* _tmp7_;
	_tmp0_ = self->priv->drop_down;
	_tmp1_ = gtk_drop_down_get_selected_item (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, DINO_UI_VIEW_MODEL_TYPE_ACCOUNT_DETAILS, DinoUiViewModelAccountDetails));
	account_details = _tmp3_;
	_tmp4_ = account_details;
	if (_tmp4_ == NULL) {
		_g_object_unref0 (account_details);
		return;
	}
	_tmp5_ = account_details;
	_tmp6_ = dino_ui_view_model_account_details_get_account (_tmp5_);
	_tmp7_ = _tmp6_;
	dino_ui_preferences_window_encryption_set_account (self, _tmp7_);
	_g_object_unref0 (account_details);
}

static void
____lambda259__g_object_notify (GObject* _sender,
                                GParamSpec* pspec,
                                gpointer self)
{
	___lambda259_ ((DinoUiPreferencesWindowEncryption*) self);
}

static void
dino_ui_preferences_window_encryption_repopulate_account_selector (DinoUiPreferencesWindowEncryption* self)
{
	GtkDropDown* _tmp0_;
	AdwPreferencesGroup* _tmp3_;
	DinoUiViewModelPreferencesWindow* _tmp4_;
	GeeHashMap* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	DinoUiViewModelPreferencesWindow* _tmp8_;
	GtkSingleSelection* _tmp9_;
	GtkSingleSelection* _tmp10_;
	AdwPreferencesGroup* _tmp33_;
	GtkDropDown* _tmp34_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->drop_down;
	if (_tmp0_ != NULL) {
		AdwPreferencesGroup* _tmp1_;
		GtkDropDown* _tmp2_;
		_tmp1_ = self->priv->accounts_group;
		_tmp2_ = self->priv->drop_down;
		adw_preferences_group_remove (_tmp1_, (GtkWidget*) _tmp2_);
		_g_object_unref0 (self->priv->drop_down);
		self->priv->drop_down = NULL;
	}
	_tmp3_ = self->priv->accounts_group;
	_tmp4_ = self->priv->_model;
	_tmp5_ = _tmp4_->account_details;
	_tmp6_ = gee_abstract_map_get_size ((GeeAbstractMap*) _tmp5_);
	_tmp7_ = _tmp6_;
	gtk_widget_set_visible ((GtkWidget*) _tmp3_, _tmp7_ != 1);
	_tmp8_ = self->priv->_model;
	_tmp9_ = dino_ui_view_model_preferences_window_get_active_accounts_selection (_tmp8_);
	_tmp10_ = _tmp9_;
	if (g_list_model_get_n_items ((GListModel*) _tmp10_) > ((guint) 0)) {
		DinoUiViewModelPreferencesWindow* _tmp11_;
		GtkSingleSelection* _tmp12_;
		GtkSingleSelection* _tmp13_;
		GListModel* _tmp14_;
		GtkDropDown* _tmp15_ = NULL;
		GtkDropDown* _tmp16_;
		GtkBuilderListItemFactory* _tmp17_;
		GtkBuilderListItemFactory* _tmp18_;
		GtkDropDown* _tmp19_;
		GtkDropDown* _tmp20_;
		DinoUiViewModelPreferencesWindow* _tmp21_;
		GtkSingleSelection* _tmp22_;
		GtkSingleSelection* _tmp23_;
		GObject* _tmp24_;
		DinoUiViewModelAccountDetails* _tmp25_;
		DinoEntitiesAccount* _tmp26_;
		DinoEntitiesAccount* _tmp27_;
		_tmp11_ = self->priv->_model;
		_tmp12_ = dino_ui_view_model_preferences_window_get_active_accounts_selection (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = _g_object_ref0 ((GListModel*) _tmp13_);
		_tmp15_ = (GtkDropDown*) gtk_drop_down_new (_tmp14_, NULL);
		gtk_widget_set_halign ((GtkWidget*) _tmp15_, GTK_ALIGN_CENTER);
		g_object_ref_sink (_tmp15_);
		_g_object_unref0 (self->priv->drop_down);
		self->priv->drop_down = _tmp15_;
		_tmp16_ = self->priv->drop_down;
		_tmp17_ = (GtkBuilderListItemFactory*) gtk_builder_list_item_factory_new_from_resource (NULL, "/im/dino/Dino/account_picker_row.ui");
		_tmp18_ = _tmp17_;
		gtk_drop_down_set_factory (_tmp16_, (GtkListItemFactory*) _tmp18_);
		_g_object_unref0 (_tmp18_);
		_tmp19_ = self->priv->drop_down;
		g_signal_connect_object ((GObject*) _tmp19_, "notify::selected-item", (GCallback) ____lambda259__g_object_notify, self, 0);
		_tmp20_ = self->priv->drop_down;
		gtk_drop_down_set_selected (_tmp20_, (guint) 0);
		_tmp21_ = self->priv->_model;
		_tmp22_ = dino_ui_view_model_preferences_window_get_active_accounts_selection (_tmp21_);
		_tmp23_ = _tmp22_;
		_tmp24_ = g_list_model_get_item ((GListModel*) _tmp23_, (guint) 0);
		_tmp25_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, DINO_UI_VIEW_MODEL_TYPE_ACCOUNT_DETAILS, DinoUiViewModelAccountDetails);
		_tmp26_ = dino_ui_view_model_account_details_get_account (_tmp25_);
		_tmp27_ = _tmp26_;
		dino_ui_preferences_window_encryption_set_account (self, _tmp27_);
		_g_object_unref0 (_tmp25_);
	} else {
		const gchar* _tmp28_;
		gchar* _tmp29_;
		gchar** _tmp30_;
		gchar** _tmp31_;
		gint _tmp31__length1;
		GtkDropDown* _tmp32_ = NULL;
		_tmp28_ = dino_gettext ("No active accounts");
		_tmp29_ = g_strdup (_tmp28_);
		_tmp30_ = g_new0 (gchar*, 1 + 1);
		_tmp30_[0] = _tmp29_;
		_tmp31_ = _tmp30_;
		_tmp31__length1 = 1;
		_tmp32_ = (GtkDropDown*) gtk_drop_down_new_from_strings (_tmp31_);
		gtk_widget_set_halign ((GtkWidget*) _tmp32_, GTK_ALIGN_CENTER);
		g_object_ref_sink (_tmp32_);
		_g_object_unref0 (self->priv->drop_down);
		self->priv->drop_down = _tmp32_;
		_tmp31_ = (_vala_array_free (_tmp31_, _tmp31__length1, (GDestroyNotify) g_free), NULL);
		dino_ui_preferences_window_encryption_unset_account (self);
	}
	_tmp33_ = self->priv->accounts_group;
	_tmp34_ = self->priv->drop_down;
	adw_preferences_group_add (_tmp33_, (GtkWidget*) _tmp34_);
}

static void
dino_ui_preferences_window_encryption_unset_account (DinoUiPreferencesWindowEncryption* self)
{
	GeeArrayList* _tmp9_;
	g_return_if_fail (self != NULL);
	{
		GeeArrayList* _widget_list = NULL;
		GeeArrayList* _tmp0_;
		gint _widget_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _widget_index = 0;
		_tmp0_ = self->priv->added_widgets;
		_widget_list = _tmp0_;
		_tmp1_ = _widget_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_widget_size = _tmp3_;
		_widget_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			AdwPreferencesGroup* widget = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			AdwPreferencesGroup* _tmp8_;
			_widget_index = _widget_index + 1;
			_tmp4_ = _widget_index;
			_tmp5_ = _widget_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _widget_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _widget_index);
			widget = (AdwPreferencesGroup*) _tmp7_;
			_tmp8_ = widget;
			adw_preferences_page_remove ((AdwPreferencesPage*) self, _tmp8_);
			_g_object_unref0 (widget);
		}
	}
	_tmp9_ = self->priv->added_widgets;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp9_);
}

static void
dino_ui_preferences_window_encryption_set_account (DinoUiPreferencesWindowEncryption* self,
                                                   DinoEntitiesAccount* account)
{
	DinoUiApplication* app = NULL;
	GApplication* _tmp0_;
	DinoUiApplication* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (account != NULL);
	dino_ui_preferences_window_encryption_unset_account (self);
	_tmp0_ = g_application_get_default ();
	_tmp1_ = _g_object_ref0 (DINO_UI_IS_APPLICATION (_tmp0_) ? ((DinoUiApplication*) _tmp0_) : NULL);
	app = _tmp1_;
	{
		GeeArrayList* _e_list = NULL;
		DinoUiApplication* _tmp2_;
		DinoPluginsRegistry* _tmp3_;
		DinoPluginsRegistry* _tmp4_;
		GeeArrayList* _tmp5_;
		gint _e_size = 0;
		GeeArrayList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _e_index = 0;
		_tmp2_ = app;
		_tmp3_ = dino_application_get_plugin_registry ((DinoApplication*) _tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_->encryption_preferences_entries;
		_e_list = _tmp5_;
		_tmp6_ = _e_list;
		_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_e_size = _tmp8_;
		_e_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			DinoPluginsEncryptionPreferencesEntry* e = NULL;
			GeeArrayList* _tmp11_;
			gpointer _tmp12_;
			AdwPreferencesGroup* widget = NULL;
			DinoPluginsEncryptionPreferencesEntry* _tmp13_;
			GObject* _tmp14_;
			AdwPreferencesGroup* _tmp15_;
			GeeArrayList* _tmp16_;
			AdwPreferencesGroup* _tmp17_;
			_e_index = _e_index + 1;
			_tmp9_ = _e_index;
			_tmp10_ = _e_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _e_list;
			_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp11_, _e_index);
			e = (DinoPluginsEncryptionPreferencesEntry*) _tmp12_;
			_tmp13_ = e;
			_tmp14_ = dino_plugins_encryption_preferences_entry_get_widget (_tmp13_, account, DINO_PLUGINS_WIDGET_TYPE_GTK4);
			widget = G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, adw_preferences_group_get_type (), AdwPreferencesGroup);
			_tmp15_ = widget;
			adw_preferences_page_add ((AdwPreferencesPage*) self, _tmp15_);
			_tmp16_ = self->priv->added_widgets;
			_tmp17_ = widget;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_);
			_g_object_unref0 (widget);
			_g_object_unref0 (e);
		}
	}
	_g_object_unref0 (app);
}

DinoUiPreferencesWindowEncryption*
dino_ui_preferences_window_encryption_construct (GType object_type)
{
	DinoUiPreferencesWindowEncryption * self = NULL;
	self = (DinoUiPreferencesWindowEncryption*) g_object_new (object_type, NULL);
	return self;
}

DinoUiPreferencesWindowEncryption*
dino_ui_preferences_window_encryption_new (void)
{
	return dino_ui_preferences_window_encryption_construct (DINO_UI_TYPE_PREFERENCES_WINDOW_ENCRYPTION);
}

DinoUiViewModelPreferencesWindow*
dino_ui_preferences_window_encryption_get_model (DinoUiPreferencesWindowEncryption* 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_encryption_set_model (DinoUiPreferencesWindowEncryption* self,
                                                 DinoUiViewModelPreferencesWindow* value)
{
	DinoUiViewModelPreferencesWindow* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_ui_preferences_window_encryption_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_encryption_properties[DINO_UI_PREFERENCES_WINDOW_ENCRYPTION_MODEL_PROPERTY]);
	}
}

static void
__lambda261_ (DinoUiPreferencesWindowEncryption* self)
{
	dino_ui_preferences_window_encryption_repopulate_account_selector (self);
}

static void
___lambda261__dino_ui_view_model_preferences_window_update (DinoUiViewModelPreferencesWindow* _sender,
                                                            gpointer self)
{
	__lambda261_ ((DinoUiPreferencesWindowEncryption*) self);
}

static void
_dino_ui_preferences_window_encryption___lambda260_ (DinoUiPreferencesWindowEncryption* self)
{
	DinoUiViewModelPreferencesWindow* _tmp0_;
	_tmp0_ = self->priv->_model;
	g_signal_connect_object (_tmp0_, "update", (GCallback) ___lambda261__dino_ui_view_model_preferences_window_update, self, 0);
}

static void
__dino_ui_preferences_window_encryption___lambda260__g_object_notify (GObject* _sender,
                                                                      GParamSpec* pspec,
                                                                      gpointer self)
{
	_dino_ui_preferences_window_encryption___lambda260_ ((DinoUiPreferencesWindowEncryption*) self);
}

static GObject *
dino_ui_preferences_window_encryption_constructor (GType type,
                                                   guint n_construct_properties,
                                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DinoUiPreferencesWindowEncryption * self;
	AdwPreferencesGroup* _tmp0_;
	parent_class = G_OBJECT_CLASS (dino_ui_preferences_window_encryption_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_PREFERENCES_WINDOW_ENCRYPTION, DinoUiPreferencesWindowEncryption);
	_tmp0_ = self->priv->accounts_group;
	adw_preferences_page_add ((AdwPreferencesPage*) self, _tmp0_);
	g_signal_connect_object ((GObject*) self, "notify::model", (GCallback) __dino_ui_preferences_window_encryption___lambda260__g_object_notify, self, 0);
	return obj;
}

static void
dino_ui_preferences_window_encryption_class_init (DinoUiPreferencesWindowEncryptionClass * klass,
                                                  gpointer klass_data)
{
	dino_ui_preferences_window_encryption_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoUiPreferencesWindowEncryption_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_ui_preferences_window_encryption_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dino_ui_preferences_window_encryption_set_property;
	G_OBJECT_CLASS (klass)->constructor = dino_ui_preferences_window_encryption_constructor;
	G_OBJECT_CLASS (klass)->finalize = dino_ui_preferences_window_encryption_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_UI_PREFERENCES_WINDOW_ENCRYPTION_MODEL_PROPERTY, dino_ui_preferences_window_encryption_properties[DINO_UI_PREFERENCES_WINDOW_ENCRYPTION_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));
}

static void
dino_ui_preferences_window_encryption_instance_init (DinoUiPreferencesWindowEncryption * self,
                                                     gpointer klass)
{
	AdwPreferencesGroup* _tmp0_;
	GeeArrayList* _tmp1_;
	self->priv = dino_ui_preferences_window_encryption_get_instance_private (self);
	self->priv->drop_down = NULL;
	_tmp0_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
	g_object_ref_sink (_tmp0_);
	self->priv->accounts_group = _tmp0_;
	_tmp1_ = gee_array_list_new (adw_preferences_group_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->added_widgets = _tmp1_;
}

static void
dino_ui_preferences_window_encryption_finalize (GObject * obj)
{
	DinoUiPreferencesWindowEncryption * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_UI_TYPE_PREFERENCES_WINDOW_ENCRYPTION, DinoUiPreferencesWindowEncryption);
	_g_object_unref0 (self->priv->drop_down);
	_g_object_unref0 (self->priv->accounts_group);
	_g_object_unref0 (self->priv->added_widgets);
	_g_object_unref0 (self->priv->_model);
	G_OBJECT_CLASS (dino_ui_preferences_window_encryption_parent_class)->finalize (obj);
}

static GType
dino_ui_preferences_window_encryption_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoUiPreferencesWindowEncryptionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_ui_preferences_window_encryption_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoUiPreferencesWindowEncryption), 0, (GInstanceInitFunc) dino_ui_preferences_window_encryption_instance_init, NULL };
	GType dino_ui_preferences_window_encryption_type_id;
	dino_ui_preferences_window_encryption_type_id = g_type_register_static (adw_preferences_page_get_type (), "DinoUiPreferencesWindowEncryption", &g_define_type_info, 0);
	DinoUiPreferencesWindowEncryption_private_offset = g_type_add_instance_private (dino_ui_preferences_window_encryption_type_id, sizeof (DinoUiPreferencesWindowEncryptionPrivate));
	return dino_ui_preferences_window_encryption_type_id;
}

GType
dino_ui_preferences_window_encryption_get_type (void)
{
	static volatile gsize dino_ui_preferences_window_encryption_type_id__once = 0;
	if (g_once_init_enter (&dino_ui_preferences_window_encryption_type_id__once)) {
		GType dino_ui_preferences_window_encryption_type_id;
		dino_ui_preferences_window_encryption_type_id = dino_ui_preferences_window_encryption_get_type_once ();
		g_once_init_leave (&dino_ui_preferences_window_encryption_type_id__once, dino_ui_preferences_window_encryption_type_id);
	}
	return dino_ui_preferences_window_encryption_type_id__once;
}

static void
_vala_dino_ui_preferences_window_encryption_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec)
{
	DinoUiPreferencesWindowEncryption * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_PREFERENCES_WINDOW_ENCRYPTION, DinoUiPreferencesWindowEncryption);
	switch (property_id) {
		case DINO_UI_PREFERENCES_WINDOW_ENCRYPTION_MODEL_PROPERTY:
		g_value_set_object (value, dino_ui_preferences_window_encryption_get_model (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dino_ui_preferences_window_encryption_set_property (GObject * object,
                                                          guint property_id,
                                                          const GValue * value,
                                                          GParamSpec * pspec)
{
	DinoUiPreferencesWindowEncryption * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_UI_TYPE_PREFERENCES_WINDOW_ENCRYPTION, DinoUiPreferencesWindowEncryption);
	switch (property_id) {
		case DINO_UI_PREFERENCES_WINDOW_ENCRYPTION_MODEL_PROPERTY:
		dino_ui_preferences_window_encryption_set_model (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     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);
}

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

