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

#include <adwaita.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>

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

#define TUBA_WIDGETS_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK (tuba_widgets_admin_email_domain_block_get_type ())
#define TUBA_WIDGETS_ADMIN_EMAIL_DOMAIN_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK, TubaWidgetsAdminEmailDomainBlock))
#define TUBA_WIDGETS_ADMIN_EMAIL_DOMAIN_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK, TubaWidgetsAdminEmailDomainBlockClass))
#define TUBA_WIDGETS_ADMIN_IS_EMAIL_DOMAIN_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK))
#define TUBA_WIDGETS_ADMIN_IS_EMAIL_DOMAIN_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK))
#define TUBA_WIDGETS_ADMIN_EMAIL_DOMAIN_BLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK, TubaWidgetsAdminEmailDomainBlockClass))

typedef struct _TubaWidgetsAdminEmailDomainBlock TubaWidgetsAdminEmailDomainBlock;
typedef struct _TubaWidgetsAdminEmailDomainBlockClass TubaWidgetsAdminEmailDomainBlockClass;
typedef struct _TubaWidgetsAdminEmailDomainBlockPrivate TubaWidgetsAdminEmailDomainBlockPrivate;
enum  {
	TUBA_WIDGETS_ADMIN_EMAIL_DOMAIN_BLOCK_0_PROPERTY,
	TUBA_WIDGETS_ADMIN_EMAIL_DOMAIN_BLOCK_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_admin_email_domain_block_properties[TUBA_WIDGETS_ADMIN_EMAIL_DOMAIN_BLOCK_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

#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_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK (tuba_api_admin_email_domain_block_get_type ())
#define TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK, TubaAPIAdminEmailDomainBlock))
#define TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK, TubaAPIAdminEmailDomainBlockClass))
#define TUBA_API_ADMIN_IS_EMAIL_DOMAIN_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK))
#define TUBA_API_ADMIN_IS_EMAIL_DOMAIN_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK))
#define TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK, TubaAPIAdminEmailDomainBlockClass))

typedef struct _TubaAPIAdminEmailDomainBlock TubaAPIAdminEmailDomainBlock;
typedef struct _TubaAPIAdminEmailDomainBlockClass TubaAPIAdminEmailDomainBlockClass;
typedef struct _Block104Data Block104Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_TYPE_HISTORY (tuba_api_admin_email_domain_block_history_get_type ())
#define TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_TYPE_HISTORY, TubaAPIAdminEmailDomainBlockHistory))
#define TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_TYPE_HISTORY, TubaAPIAdminEmailDomainBlockHistoryClass))
#define TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_IS_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_TYPE_HISTORY))
#define TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_IS_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_TYPE_HISTORY))
#define TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_HISTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_ADMIN_EMAIL_DOMAIN_BLOCK_TYPE_HISTORY, TubaAPIAdminEmailDomainBlockHistoryClass))

typedef struct _TubaAPIAdminEmailDomainBlockHistory TubaAPIAdminEmailDomainBlockHistory;
typedef struct _TubaAPIAdminEmailDomainBlockHistoryClass TubaAPIAdminEmailDomainBlockHistoryClass;
enum  {
	TUBA_WIDGETS_ADMIN_EMAIL_DOMAIN_BLOCK_REMOVED_SIGNAL,
	TUBA_WIDGETS_ADMIN_EMAIL_DOMAIN_BLOCK_NUM_SIGNALS
};
static guint tuba_widgets_admin_email_domain_block_signals[TUBA_WIDGETS_ADMIN_EMAIL_DOMAIN_BLOCK_NUM_SIGNALS] = {0};

struct _TubaWidgetsAdminEmailDomainBlock {
	AdwActionRow parent_instance;
	TubaWidgetsAdminEmailDomainBlockPrivate * priv;
};

struct _TubaWidgetsAdminEmailDomainBlockClass {
	AdwActionRowClass parent_class;
};

struct _TubaWidgetsAdminEmailDomainBlockPrivate {
	gchar* email_domain_block_id;
};

struct _Block104Data {
	int _ref_count_;
	TubaWidgetsAdminEmailDomainBlock* self;
	gint total_attempts;
};

static gint TubaWidgetsAdminEmailDomainBlock_private_offset;
static gpointer tuba_widgets_admin_email_domain_block_parent_class = NULL;

VALA_EXTERN GType tuba_widgets_admin_email_domain_block_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsAdminEmailDomainBlock, 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_admin_email_domain_block_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAdminEmailDomainBlock, g_object_unref)
VALA_EXTERN TubaWidgetsAdminEmailDomainBlock* tuba_widgets_admin_email_domain_block_new (TubaAPIAdminEmailDomainBlock* email_domain_block);
VALA_EXTERN TubaWidgetsAdminEmailDomainBlock* tuba_widgets_admin_email_domain_block_construct (GType object_type,
                                                                                   TubaAPIAdminEmailDomainBlock* email_domain_block);
static Block104Data* block104_data_ref (Block104Data* _data104_);
static void block104_data_unref (void * _userdata_);
VALA_EXTERN const gchar* tuba_api_admin_email_domain_block_get_id (TubaAPIAdminEmailDomainBlock* self);
VALA_EXTERN const gchar* tuba_api_admin_email_domain_block_get_domain (TubaAPIAdminEmailDomainBlock* self);
VALA_EXTERN GType tuba_api_admin_email_domain_block_history_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAdminEmailDomainBlockHistory, g_object_unref)
VALA_EXTERN GeeArrayList* tuba_api_admin_email_domain_block_get_history (TubaAPIAdminEmailDomainBlock* self);
static gboolean ___lambda115_ (Block104Data* _data104_,
                        TubaAPIAdminEmailDomainBlockHistory* entity);
VALA_EXTERN const gchar* tuba_api_admin_email_domain_block_history_get_accounts (TubaAPIAdminEmailDomainBlockHistory* self);
VALA_EXTERN const gchar* tuba_api_admin_email_domain_block_history_get_uses (TubaAPIAdminEmailDomainBlockHistory* self);
static gboolean ____lambda115__gee_forall_func (gpointer g,
                                         gpointer self);
VALA_EXTERN void tuba_widgets_admin_email_domain_block_on_remove (TubaWidgetsAdminEmailDomainBlock* self);
static void _tuba_widgets_admin_email_domain_block_on_remove_gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self);
static void tuba_widgets_admin_email_domain_block_finalize (GObject * obj);
static GType tuba_widgets_admin_email_domain_block_get_type_once (void);
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_widgets_admin_email_domain_block_get_instance_private (TubaWidgetsAdminEmailDomainBlock* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsAdminEmailDomainBlock_private_offset);
}

static Block104Data*
block104_data_ref (Block104Data* _data104_)
{
	g_atomic_int_inc (&_data104_->_ref_count_);
	return _data104_;
}

static void
block104_data_unref (void * _userdata_)
{
	Block104Data* _data104_;
	_data104_ = (Block104Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data104_->_ref_count_)) {
		TubaWidgetsAdminEmailDomainBlock* self;
		self = _data104_->self;
		_g_object_unref0 (self);
		g_slice_free (Block104Data, _data104_);
	}
}

static gboolean
___lambda115_ (Block104Data* _data104_,
               TubaAPIAdminEmailDomainBlockHistory* entity)
{
	TubaWidgetsAdminEmailDomainBlock* self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean result;
	self = _data104_->self;
	g_return_val_if_fail (entity != NULL, FALSE);
	_tmp0_ = tuba_api_admin_email_domain_block_history_get_accounts (entity);
	_tmp1_ = _tmp0_;
	_tmp2_ = tuba_api_admin_email_domain_block_history_get_uses (entity);
	_tmp3_ = _tmp2_;
	_data104_->total_attempts += atoi (_tmp1_) + atoi (_tmp3_);
	result = TRUE;
	_g_object_unref0 (entity);
	return result;
}

static gboolean
____lambda115__gee_forall_func (gpointer g,
                                gpointer self)
{
	gboolean result;
	result = ___lambda115_ (self, (TubaAPIAdminEmailDomainBlockHistory*) g);
	return result;
}

static void
_tuba_widgets_admin_email_domain_block_on_remove_gtk_button_clicked (GtkButton* _sender,
                                                                     gpointer self)
{
	tuba_widgets_admin_email_domain_block_on_remove ((TubaWidgetsAdminEmailDomainBlock*) self);
}

TubaWidgetsAdminEmailDomainBlock*
tuba_widgets_admin_email_domain_block_construct (GType object_type,
                                                 TubaAPIAdminEmailDomainBlock* email_domain_block)
{
	TubaWidgetsAdminEmailDomainBlock * self = NULL;
	Block104Data* _data104_;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GeeArrayList* _tmp5_;
	GeeArrayList* _tmp6_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GtkButton* delete_button = NULL;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar** _tmp14_;
	gchar* _tmp15_;
	GtkButton* _tmp16_ = NULL;
	g_return_val_if_fail (email_domain_block != NULL, NULL);
	_data104_ = g_slice_new0 (Block104Data);
	_data104_->_ref_count_ = 1;
	self = (TubaWidgetsAdminEmailDomainBlock*) g_object_new (object_type, NULL);
	_data104_->self = g_object_ref (self);
	_tmp0_ = tuba_api_admin_email_domain_block_get_id (email_domain_block);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (self->priv->email_domain_block_id);
	self->priv->email_domain_block_id = _tmp2_;
	_tmp3_ = tuba_api_admin_email_domain_block_get_domain (email_domain_block);
	_tmp4_ = _tmp3_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) self, _tmp4_);
	_data104_->total_attempts = 0;
	_tmp5_ = tuba_api_admin_email_domain_block_get_history (email_domain_block);
	_tmp6_ = _tmp5_;
	if (_tmp6_ != NULL) {
		GeeArrayList* _tmp7_;
		GeeArrayList* _tmp8_;
		_tmp7_ = tuba_api_admin_email_domain_block_get_history (email_domain_block);
		_tmp8_ = _tmp7_;
		gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp8_, ____lambda115__gee_forall_func, _data104_);
	}
	_tmp9_ = g_strdup_printf (_ ("%d Sign-up Attempts"), _data104_->total_attempts);
	_tmp10_ = _tmp9_;
	adw_action_row_set_subtitle ((AdwActionRow*) self, _tmp10_);
	_g_free0 (_tmp10_);
	_tmp11_ = g_strdup ("circular");
	_tmp12_ = g_strdup ("flat");
	_tmp13_ = g_strdup ("error");
	_tmp14_ = g_new0 (gchar*, 3 + 1);
	_tmp14_[0] = _tmp11_;
	_tmp14_[1] = _tmp12_;
	_tmp14_[2] = _tmp13_;
	_tmp15_ = g_strdup (_ ("Delete"));
	_tmp16_ = (GtkButton*) gtk_button_new_from_icon_name ("user-trash-symbolic");
	gtk_widget_set_css_classes ((GtkWidget*) _tmp16_, _tmp14_);
	_tmp14_ = (_vala_array_free (_tmp14_, 3, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp16_, _tmp15_);
	_g_free0 (_tmp15_);
	gtk_widget_set_valign ((GtkWidget*) _tmp16_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp16_);
	delete_button = _tmp16_;
	g_signal_connect_object (delete_button, "clicked", (GCallback) _tuba_widgets_admin_email_domain_block_on_remove_gtk_button_clicked, self, 0);
	adw_action_row_add_suffix ((AdwActionRow*) self, (GtkWidget*) delete_button);
	_g_object_unref0 (delete_button);
	block104_data_unref (_data104_);
	_data104_ = NULL;
	return self;
}

TubaWidgetsAdminEmailDomainBlock*
tuba_widgets_admin_email_domain_block_new (TubaAPIAdminEmailDomainBlock* email_domain_block)
{
	return tuba_widgets_admin_email_domain_block_construct (TUBA_WIDGETS_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK, email_domain_block);
}

void
tuba_widgets_admin_email_domain_block_on_remove (TubaWidgetsAdminEmailDomainBlock* self)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->email_domain_block_id;
	g_signal_emit (self, tuba_widgets_admin_email_domain_block_signals[TUBA_WIDGETS_ADMIN_EMAIL_DOMAIN_BLOCK_REMOVED_SIGNAL], 0, _tmp0_);
}

static void
tuba_widgets_admin_email_domain_block_class_init (TubaWidgetsAdminEmailDomainBlockClass * klass,
                                                  gpointer klass_data)
{
	tuba_widgets_admin_email_domain_block_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsAdminEmailDomainBlock_private_offset);
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_admin_email_domain_block_finalize;
	tuba_widgets_admin_email_domain_block_signals[TUBA_WIDGETS_ADMIN_EMAIL_DOMAIN_BLOCK_REMOVED_SIGNAL] = g_signal_new ("removed", TUBA_WIDGETS_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
tuba_widgets_admin_email_domain_block_instance_init (TubaWidgetsAdminEmailDomainBlock * self,
                                                     gpointer klass)
{
	self->priv = tuba_widgets_admin_email_domain_block_get_instance_private (self);
}

static void
tuba_widgets_admin_email_domain_block_finalize (GObject * obj)
{
	TubaWidgetsAdminEmailDomainBlock * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_ADMIN_TYPE_EMAIL_DOMAIN_BLOCK, TubaWidgetsAdminEmailDomainBlock);
	g_debug ("EmailDomainBlock.vala:5: Destroying EmailDomainBlock");
	_g_free0 (self->priv->email_domain_block_id);
	G_OBJECT_CLASS (tuba_widgets_admin_email_domain_block_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_admin_email_domain_block_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsAdminEmailDomainBlockClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_admin_email_domain_block_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsAdminEmailDomainBlock), 0, (GInstanceInitFunc) tuba_widgets_admin_email_domain_block_instance_init, NULL };
	GType tuba_widgets_admin_email_domain_block_type_id;
	tuba_widgets_admin_email_domain_block_type_id = g_type_register_static (adw_action_row_get_type (), "TubaWidgetsAdminEmailDomainBlock", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaWidgetsAdminEmailDomainBlock_private_offset = g_type_add_instance_private (tuba_widgets_admin_email_domain_block_type_id, sizeof (TubaWidgetsAdminEmailDomainBlockPrivate));
	return tuba_widgets_admin_email_domain_block_type_id;
}

GType
tuba_widgets_admin_email_domain_block_get_type (void)
{
	static GType tuba_widgets_admin_email_domain_block_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_widgets_admin_email_domain_block_type_id__once)) {
		GType tuba_widgets_admin_email_domain_block_type_id;
		tuba_widgets_admin_email_domain_block_type_id = tuba_widgets_admin_email_domain_block_get_type_once ();
		g_once_init_leave_pointer (&tuba_widgets_admin_email_domain_block_type_id__once, tuba_widgets_admin_email_domain_block_type_id);
	}
	return tuba_widgets_admin_email_domain_block_type_id__once;
}

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

