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

/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: 2011-2026 elementary, Inc. (https://elementary.io)
 *
 * Authored by: Jaap Broekhuizen
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <libical-glib/libical-glib.h>
#include <handy.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <folks/folks.h>
#include <gee.h>
#include <granite.h>
#include <pango/pango.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>

#define MAYA_VIEW_EVENT_EDITION_GUEST_GRID_ICON_SIZE 32
#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 MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID (maya_view_event_edition_guest_grid_get_type ())
#define MAYA_VIEW_EVENT_EDITION_GUEST_GRID(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID, MayaViewEventEditionGuestGrid))
#define MAYA_VIEW_EVENT_EDITION_GUEST_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID, MayaViewEventEditionGuestGridClass))
#define MAYA_VIEW_EVENT_EDITION_IS_GUEST_GRID(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID))
#define MAYA_VIEW_EVENT_EDITION_IS_GUEST_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID))
#define MAYA_VIEW_EVENT_EDITION_GUEST_GRID_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID, MayaViewEventEditionGuestGridClass))

typedef struct _MayaViewEventEditionGuestGrid MayaViewEventEditionGuestGrid;
typedef struct _MayaViewEventEditionGuestGridClass MayaViewEventEditionGuestGridClass;
typedef struct _MayaViewEventEditionGuestGridPrivate MayaViewEventEditionGuestGridPrivate;
enum  {
	MAYA_VIEW_EVENT_EDITION_GUEST_GRID_0_PROPERTY,
	MAYA_VIEW_EVENT_EDITION_GUEST_GRID_ATTENDEE_PROPERTY,
	MAYA_VIEW_EVENT_EDITION_GUEST_GRID_NUM_PROPERTIES
};
static GParamSpec* maya_view_event_edition_guest_grid_properties[MAYA_VIEW_EVENT_EDITION_GUEST_GRID_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))
typedef struct _Block10Data Block10Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef struct _MayaViewEventEditionGuestGridGetContactByMailData MayaViewEventEditionGuestGridGetContactByMailData;
enum  {
	MAYA_VIEW_EVENT_EDITION_GUEST_GRID_REMOVED_SIGNAL,
	MAYA_VIEW_EVENT_EDITION_GUEST_GRID_NUM_SIGNALS
};
static guint maya_view_event_edition_guest_grid_signals[MAYA_VIEW_EVENT_EDITION_GUEST_GRID_NUM_SIGNALS] = {0};

struct _MayaViewEventEditionGuestGrid {
	GtkGrid parent_instance;
	MayaViewEventEditionGuestGridPrivate * priv;
};

struct _MayaViewEventEditionGuestGridClass {
	GtkGridClass parent_class;
};

struct _MayaViewEventEditionGuestGridPrivate {
	ICalProperty* _attendee;
	GtkLabel* mail_label;
	GtkLabel* name_label;
	HdyAvatar* avatar;
};

struct _Block10Data {
	int _ref_count_;
	MayaViewEventEditionGuestGrid* self;
	gchar* mail_address;
	gpointer _async_data_;
};

struct _MayaViewEventEditionGuestGridGetContactByMailData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	MayaViewEventEditionGuestGrid* self;
	gchar* mail_address;
	Block10Data* _data10_;
	FolksIndividualAggregator* aggregator;
	FolksIndividualAggregator* _tmp0_;
	FolksIndividualAggregator* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	FolksIndividualAggregator* _tmp4_;
	FolksIndividualAggregator* _tmp5_;
	GError* e;
	GError* _tmp6_;
	const gchar* _tmp7_;
	GeeMapIterator* map_iterator;
	FolksIndividualAggregator* _tmp8_;
	GeeMap* _tmp9_;
	GeeMap* _tmp10_;
	GeeMapIterator* _tmp11_;
	GeeMapIterator* _tmp12_;
	GeeIterator* _address_it;
	GeeMapIterator* _tmp13_;
	gpointer _tmp14_;
	FolksIndividual* _tmp15_;
	GeeSet* _tmp16_;
	GeeSet* _tmp17_;
	GeeIterator* _tmp18_;
	GeeIterator* _tmp19_;
	GeeIterator* _tmp20_;
	FolksEmailFieldDetails* address;
	GeeIterator* _tmp21_;
	gpointer _tmp22_;
	FolksEmailFieldDetails* _tmp23_;
	gconstpointer _tmp24_;
	gconstpointer _tmp25_;
	FolksIndividual* individual;
	GeeMapIterator* _tmp26_;
	gpointer _tmp27_;
	FolksIndividual* _tmp28_;
	HdyAvatar* _tmp29_;
	FolksIndividual* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	FolksIndividual* _tmp33_;
	GLoadableIcon* _tmp34_;
	GLoadableIcon* _tmp35_;
	HdyAvatar* _tmp36_;
	FolksIndividual* _tmp37_;
	GLoadableIcon* _tmp38_;
	GLoadableIcon* _tmp39_;
	gboolean _tmp40_;
	FolksIndividual* _tmp41_;
	const gchar* _tmp42_;
	const gchar* _tmp43_;
	FolksIndividual* _tmp44_;
	const gchar* _tmp45_;
	const gchar* _tmp46_;
	GtkLabel* _tmp47_;
	FolksIndividual* _tmp48_;
	const gchar* _tmp49_;
	const gchar* _tmp50_;
	gchar* _tmp51_;
	gchar* _tmp52_;
	GtkLabel* _tmp53_;
	ICalProperty* _tmp54_;
	const gchar* _tmp55_;
	gchar* _tmp56_;
	gchar* _tmp57_;
	gchar* _tmp58_;
	gchar* _tmp59_;
	GError* _inner_error0_;
};

static gint MayaViewEventEditionGuestGrid_private_offset;
static gpointer maya_view_event_edition_guest_grid_parent_class = NULL;

VALA_EXTERN GType maya_view_event_edition_guest_grid_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MayaViewEventEditionGuestGrid, g_object_unref)
VALA_EXTERN MayaViewEventEditionGuestGrid* maya_view_event_edition_guest_grid_new (ICalProperty* attendee);
VALA_EXTERN MayaViewEventEditionGuestGrid* maya_view_event_edition_guest_grid_construct (GType object_type,
                                                                             ICalProperty* attendee);
static void maya_view_event_edition_guest_grid_get_contact_by_mail_data_free (gpointer _data);
static void maya_view_event_edition_guest_grid_get_contact_by_mail (MayaViewEventEditionGuestGrid* self,
                                                             const gchar* mail_address,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
static void maya_view_event_edition_guest_grid_get_contact_by_mail_finish (MayaViewEventEditionGuestGrid* self,
                                                                    GAsyncResult* _res_);
static gboolean maya_view_event_edition_guest_grid_get_contact_by_mail_co (MayaViewEventEditionGuestGridGetContactByMailData* _data_);
static Block10Data* block10_data_ref (Block10Data* _data10_);
static void block10_data_unref (void * _userdata_);
static void ___lambda10_ (Block10Data* _data10_);
static void ____lambda10__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void maya_view_event_edition_guest_grid_get_contact_by_mail_ready (GObject* source_object,
                                                                   GAsyncResult* _res_,
                                                                   gpointer _user_data_);
VALA_EXTERN ICalProperty* maya_view_event_edition_guest_grid_get_attendee (MayaViewEventEditionGuestGrid* self);
static void maya_view_event_edition_guest_grid_set_attendee (MayaViewEventEditionGuestGrid* self,
                                                      ICalProperty* value);
static GObject * maya_view_event_edition_guest_grid_constructor (GType type,
                                                          guint n_construct_properties,
                                                          GObjectConstructParam * construct_properties);
static void _maya_view_event_edition_guest_grid___lambda11_ (MayaViewEventEditionGuestGrid* self);
static void __maya_view_event_edition_guest_grid___lambda11__gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self);
static void maya_view_event_edition_guest_grid_finalize (GObject * obj);
static GType maya_view_event_edition_guest_grid_get_type_once (void);
static void _vala_maya_view_event_edition_guest_grid_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);
static void _vala_maya_view_event_edition_guest_grid_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 gssize _vala_array_length (gpointer array);

static inline gpointer
maya_view_event_edition_guest_grid_get_instance_private (MayaViewEventEditionGuestGrid* self)
{
	return G_STRUCT_MEMBER_P (self, MayaViewEventEditionGuestGrid_private_offset);
}

MayaViewEventEditionGuestGrid*
maya_view_event_edition_guest_grid_construct (GType object_type,
                                              ICalProperty* attendee)
{
	MayaViewEventEditionGuestGrid * self = NULL;
	ICalProperty* _tmp0_;
	ICalProperty* _tmp1_;
	g_return_val_if_fail (attendee != NULL, NULL);
	_tmp0_ = i_cal_property_clone (attendee);
	_tmp1_ = _tmp0_;
	self = (MayaViewEventEditionGuestGrid*) g_object_new (object_type, "attendee", _tmp1_, NULL);
	_g_object_unref0 (_tmp1_);
	return self;
}

MayaViewEventEditionGuestGrid*
maya_view_event_edition_guest_grid_new (ICalProperty* attendee)
{
	return maya_view_event_edition_guest_grid_construct (MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID, attendee);
}

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

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

static void
maya_view_event_edition_guest_grid_get_contact_by_mail (MayaViewEventEditionGuestGrid* self,
                                                        const gchar* mail_address,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_)
{
	MayaViewEventEditionGuestGridGetContactByMailData* _data_;
	MayaViewEventEditionGuestGrid* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (mail_address != NULL);
	_data_ = g_slice_new0 (MayaViewEventEditionGuestGridGetContactByMailData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, maya_view_event_edition_guest_grid_get_contact_by_mail_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (mail_address);
	_g_free0 (_data_->mail_address);
	_data_->mail_address = _tmp1_;
	maya_view_event_edition_guest_grid_get_contact_by_mail_co (_data_);
}

static void
maya_view_event_edition_guest_grid_get_contact_by_mail_finish (MayaViewEventEditionGuestGrid* self,
                                                               GAsyncResult* _res_)
{
	MayaViewEventEditionGuestGridGetContactByMailData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block10Data*
block10_data_ref (Block10Data* _data10_)
{
	g_atomic_int_inc (&_data10_->_ref_count_);
	return _data10_;
}

static void
block10_data_unref (void * _userdata_)
{
	Block10Data* _data10_;
	_data10_ = (Block10Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
		MayaViewEventEditionGuestGrid* self;
		self = _data10_->self;
		_g_free0 (_data10_->mail_address);
		_g_object_unref0 (self);
		g_slice_free (Block10Data, _data10_);
	}
}

static void
___lambda10_ (Block10Data* _data10_)
{
	MayaViewEventEditionGuestGrid* self;
	self = _data10_->self;
	maya_view_event_edition_guest_grid_get_contact_by_mail (self, _data10_->mail_address, NULL, NULL);
}

static void
____lambda10__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	___lambda10_ (self);
}

static void
maya_view_event_edition_guest_grid_get_contact_by_mail_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_)
{
	MayaViewEventEditionGuestGridGetContactByMailData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	maya_view_event_edition_guest_grid_get_contact_by_mail_co (_data_);
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static gboolean
maya_view_event_edition_guest_grid_get_contact_by_mail_co (MayaViewEventEditionGuestGridGetContactByMailData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data10_ = g_slice_new0 (Block10Data);
	_data_->_data10_->_ref_count_ = 1;
	_data_->_data10_->self = g_object_ref (_data_->self);
	_g_free0 (_data_->_data10_->mail_address);
	_data_->_data10_->mail_address = _data_->mail_address;
	_data_->_data10_->_async_data_ = _data_;
	_data_->_tmp0_ = folks_individual_aggregator_dup ();
	_data_->aggregator = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->aggregator;
	_data_->_tmp2_ = folks_individual_aggregator_get_is_prepared (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	if (!_data_->_tmp3_) {
		_data_->_tmp4_ = _data_->aggregator;
		g_signal_connect_data ((GObject*) _data_->_tmp4_, "notify::is-quiescent", (GCallback) ____lambda10__g_object_notify, block10_data_ref (_data_->_data10_), (GClosureNotify) block10_data_unref, 0);
		{
			_data_->_tmp5_ = _data_->aggregator;
			_data_->_state_ = 1;
			folks_individual_aggregator_prepare (_data_->_tmp5_, maya_view_event_edition_guest_grid_get_contact_by_mail_ready, _data_);
			return FALSE;
			_state_1:
			folks_individual_aggregator_prepare_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			_data_->e = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp6_ = _data_->e;
			_data_->_tmp7_ = _data_->_tmp6_->message;
			g_critical ("GuestGrid.vala:99: %s", _data_->_tmp7_);
			_g_error_free0 (_data_->e);
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->aggregator);
			block10_data_unref (_data_->_data10_);
			_data_->_data10_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_object_unref0 (_data_->aggregator);
		block10_data_unref (_data_->_data10_);
		_data_->_data10_ = NULL;
		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_->_tmp8_ = _data_->aggregator;
	_data_->_tmp9_ = folks_individual_aggregator_get_individuals (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = gee_map_map_iterator (_data_->_tmp10_);
	_data_->map_iterator = _data_->_tmp11_;
	while (TRUE) {
		_data_->_tmp12_ = _data_->map_iterator;
		if (!gee_map_iterator_next (_data_->_tmp12_)) {
			break;
		}
		{
			_data_->_tmp13_ = _data_->map_iterator;
			_data_->_tmp14_ = gee_map_iterator_get_value (_data_->_tmp13_);
			_data_->_tmp15_ = (FolksIndividual*) _data_->_tmp14_;
			_data_->_tmp16_ = folks_email_details_get_email_addresses ((FolksEmailDetails*) _data_->_tmp15_);
			_data_->_tmp17_ = _data_->_tmp16_;
			_data_->_tmp18_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp17_);
			_data_->_tmp19_ = _data_->_tmp18_;
			_g_object_unref0 (_data_->_tmp15_);
			_data_->_address_it = _data_->_tmp19_;
			while (TRUE) {
				_data_->_tmp20_ = _data_->_address_it;
				if (!gee_iterator_next (_data_->_tmp20_)) {
					break;
				}
				_data_->_tmp21_ = _data_->_address_it;
				_data_->_tmp22_ = gee_iterator_get (_data_->_tmp21_);
				_data_->address = (FolksEmailFieldDetails*) _data_->_tmp22_;
				_data_->_tmp23_ = _data_->address;
				_data_->_tmp24_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp23_);
				_data_->_tmp25_ = _data_->_tmp24_;
				if (g_strcmp0 ((const gchar*) _data_->_tmp25_, _data_->_data10_->mail_address) != 0) {
					_g_object_unref0 (_data_->address);
					continue;
				}
				_data_->_tmp26_ = _data_->map_iterator;
				_data_->_tmp27_ = gee_map_iterator_get_value (_data_->_tmp26_);
				_data_->individual = (FolksIndividual*) _data_->_tmp27_;
				_data_->_tmp28_ = _data_->individual;
				if (_data_->_tmp28_ == NULL) {
					_g_object_unref0 (_data_->individual);
					_g_object_unref0 (_data_->address);
					continue;
				}
				_data_->_tmp29_ = _data_->self->priv->avatar;
				_data_->_tmp30_ = _data_->individual;
				_data_->_tmp31_ = folks_individual_get_display_name (_data_->_tmp30_);
				_data_->_tmp32_ = _data_->_tmp31_;
				hdy_avatar_set_text (_data_->_tmp29_, _data_->_tmp32_);
				_data_->_tmp33_ = _data_->individual;
				_data_->_tmp34_ = folks_avatar_details_get_avatar ((FolksAvatarDetails*) _data_->_tmp33_);
				_data_->_tmp35_ = _data_->_tmp34_;
				if (_data_->_tmp35_ != NULL) {
					_data_->_tmp36_ = _data_->self->priv->avatar;
					_data_->_tmp37_ = _data_->individual;
					_data_->_tmp38_ = folks_avatar_details_get_avatar ((FolksAvatarDetails*) _data_->_tmp37_);
					_data_->_tmp39_ = _data_->_tmp38_;
					hdy_avatar_set_loadable_icon (_data_->_tmp36_, _data_->_tmp39_);
				}
				_data_->_tmp41_ = _data_->individual;
				_data_->_tmp42_ = folks_name_details_get_full_name ((FolksNameDetails*) _data_->_tmp41_);
				_data_->_tmp43_ = _data_->_tmp42_;
				if (_data_->_tmp43_ != NULL) {
					_data_->_tmp44_ = _data_->individual;
					_data_->_tmp45_ = folks_name_details_get_full_name ((FolksNameDetails*) _data_->_tmp44_);
					_data_->_tmp46_ = _data_->_tmp45_;
					_data_->_tmp40_ = g_strcmp0 (_data_->_tmp46_, "") != 0;
				} else {
					_data_->_tmp40_ = FALSE;
				}
				if (_data_->_tmp40_) {
					_data_->_tmp47_ = _data_->self->priv->name_label;
					_data_->_tmp48_ = _data_->individual;
					_data_->_tmp49_ = folks_name_details_get_full_name ((FolksNameDetails*) _data_->_tmp48_);
					_data_->_tmp50_ = _data_->_tmp49_;
					_data_->_tmp51_ = g_markup_escape_text (_data_->_tmp50_, (gssize) -1);
					_data_->_tmp52_ = _data_->_tmp51_;
					gtk_label_set_label (_data_->_tmp47_, _data_->_tmp52_);
					_g_free0 (_data_->_tmp52_);
					_data_->_tmp53_ = _data_->self->priv->mail_label;
					_data_->_tmp54_ = _data_->self->priv->_attendee;
					_data_->_tmp55_ = i_cal_property_get_attendee (_data_->_tmp54_);
					_data_->_tmp56_ = string_replace (_data_->_tmp55_, "mailto:", "");
					_data_->_tmp57_ = _data_->_tmp56_;
					_data_->_tmp58_ = g_markup_escape_text (_data_->_tmp57_, (gssize) -1);
					_data_->_tmp59_ = _data_->_tmp58_;
					gtk_label_set_label (_data_->_tmp53_, _data_->_tmp59_);
					_g_free0 (_data_->_tmp59_);
					_g_free0 (_data_->_tmp57_);
				}
				_g_object_unref0 (_data_->individual);
				_g_object_unref0 (_data_->address);
			}
			_g_object_unref0 (_data_->_address_it);
		}
	}
	_g_object_unref0 (_data_->map_iterator);
	_g_object_unref0 (_data_->aggregator);
	block10_data_unref (_data_->_data10_);
	_data_->_data10_ = NULL;
	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;
}

ICalProperty*
maya_view_event_edition_guest_grid_get_attendee (MayaViewEventEditionGuestGrid* self)
{
	ICalProperty* result;
	ICalProperty* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_attendee;
	result = _tmp0_;
	return result;
}

static void
maya_view_event_edition_guest_grid_set_attendee (MayaViewEventEditionGuestGrid* self,
                                                 ICalProperty* value)
{
	ICalProperty* old_value;
	g_return_if_fail (self != NULL);
	old_value = maya_view_event_edition_guest_grid_get_attendee (self);
	if (old_value != value) {
		ICalProperty* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_attendee);
		self->priv->_attendee = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, maya_view_event_edition_guest_grid_properties[MAYA_VIEW_EVENT_EDITION_GUEST_GRID_ATTENDEE_PROPERTY]);
	}
}

static void
_maya_view_event_edition_guest_grid___lambda11_ (MayaViewEventEditionGuestGrid* self)
{
	g_signal_emit (self, maya_view_event_edition_guest_grid_signals[MAYA_VIEW_EVENT_EDITION_GUEST_GRID_REMOVED_SIGNAL], 0);
	gtk_widget_hide ((GtkWidget*) self);
	gtk_widget_destroy ((GtkWidget*) self);
}

static void
__maya_view_event_edition_guest_grid___lambda11__gtk_button_clicked (GtkButton* _sender,
                                                                     gpointer self)
{
	_maya_view_event_edition_guest_grid___lambda11_ ((MayaViewEventEditionGuestGrid*) self);
}

static GObject *
maya_view_event_edition_guest_grid_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	MayaViewEventEditionGuestGrid * self;
	GtkLabel* status_label = NULL;
	GtkLabel* _tmp0_ = NULL;
	GtkLabel* _tmp1_;
	GtkStyleContext* _tmp2_;
	gchar* mail = NULL;
	ICalProperty* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	gchar** _tmp9_;
	gint _tmp9__length1;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	GtkLabel* _tmp13_ = NULL;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	GtkLabel* _tmp17_ = NULL;
	GtkButton* remove_button = NULL;
	GtkButton* _tmp18_ = NULL;
	GtkLabel* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	HdyAvatar* _tmp22_;
	HdyAvatar* _tmp23_;
	GtkLabel* _tmp24_;
	GtkLabel* _tmp25_;
	GtkLabel* _tmp26_;
	GtkButton* _tmp27_;
	ICalProperty* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	ICalParameter* parameter = NULL;
	ICalProperty* _tmp32_;
	ICalParameter* _tmp33_;
	ICalParameter* _tmp34_;
	GtkButton* _tmp45_;
	parent_class = G_OBJECT_CLASS (maya_view_event_edition_guest_grid_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID, MayaViewEventEditionGuestGrid);
	_tmp0_ = (GtkLabel*) gtk_label_new ("");
	gtk_label_set_justify (_tmp0_, GTK_JUSTIFY_RIGHT);
	g_object_ref_sink (_tmp0_);
	status_label = _tmp0_;
	_tmp1_ = status_label;
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) _tmp1_);
	gtk_style_context_add_class (_tmp2_, GRANITE_STYLE_CLASS_H4_LABEL);
	_tmp3_ = self->priv->_attendee;
	_tmp4_ = i_cal_property_get_attendee (_tmp3_);
	_tmp5_ = string_replace (_tmp4_, "mailto:", "");
	mail = _tmp5_;
	_tmp6_ = mail;
	_tmp8_ = _tmp7_ = g_strsplit (_tmp6_, "@", 2);
	_tmp9_ = _tmp8_;
	_tmp9__length1 = _vala_array_length (_tmp7_);
	_tmp10_ = _tmp9_[0];
	_tmp11_ = g_markup_escape_text (_tmp10_, (gssize) -1);
	_tmp12_ = _tmp11_;
	_tmp13_ = (GtkLabel*) gtk_label_new (_tmp12_);
	gtk_label_set_ellipsize (_tmp13_, PANGO_ELLIPSIZE_MIDDLE);
	gtk_label_set_xalign (_tmp13_, (gfloat) 0);
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->name_label);
	self->priv->name_label = _tmp13_;
	_g_free0 (_tmp12_);
	_tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL);
	_tmp14_ = mail;
	_tmp15_ = g_markup_escape_text (_tmp14_, (gssize) -1);
	_tmp16_ = _tmp15_;
	_tmp17_ = (GtkLabel*) gtk_label_new (_tmp16_);
	gtk_label_set_ellipsize (_tmp17_, PANGO_ELLIPSIZE_MIDDLE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp17_, TRUE);
	gtk_label_set_xalign (_tmp17_, (gfloat) 0);
	g_object_ref_sink (_tmp17_);
	_g_object_unref0 (self->priv->mail_label);
	self->priv->mail_label = _tmp17_;
	_g_free0 (_tmp16_);
	_tmp18_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-delete-symbolic", (GtkIconSize) GTK_ICON_SIZE_BUTTON);
	gtk_button_set_relief (_tmp18_, GTK_RELIEF_NONE);
	gtk_widget_set_valign ((GtkWidget*) _tmp18_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp18_);
	remove_button = _tmp18_;
	_tmp19_ = self->priv->name_label;
	_tmp20_ = gtk_label_get_label (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = (HdyAvatar*) hdy_avatar_new (MAYA_VIEW_EVENT_EDITION_GUEST_GRID_ICON_SIZE, _tmp21_, TRUE);
	g_object_ref_sink (_tmp22_);
	_g_object_unref0 (self->priv->avatar);
	self->priv->avatar = _tmp22_;
	gtk_grid_set_column_spacing ((GtkGrid*) self, 12);
	gtk_widget_set_margin_top ((GtkWidget*) self, 6);
	gtk_widget_set_margin_end ((GtkWidget*) self, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) self, 6);
	gtk_widget_set_margin_start ((GtkWidget*) self, 6);
	_tmp23_ = self->priv->avatar;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp23_, 0, 0, 1, 4);
	_tmp24_ = self->priv->name_label;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp24_, 1, 1, 1, 1);
	_tmp25_ = self->priv->mail_label;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp25_, 1, 2, 1, 1);
	_tmp26_ = status_label;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp26_, 2, 1, 1, 2);
	_tmp27_ = remove_button;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp27_, 3, 1, 1, 2);
	_tmp28_ = self->priv->_attendee;
	_tmp29_ = i_cal_property_get_attendee (_tmp28_);
	_tmp30_ = string_replace (_tmp29_, "mailto:", "");
	_tmp31_ = _tmp30_;
	maya_view_event_edition_guest_grid_get_contact_by_mail (self, _tmp31_, NULL, NULL);
	_g_free0 (_tmp31_);
	_tmp32_ = self->priv->_attendee;
	_tmp33_ = i_cal_property_get_first_parameter (_tmp32_, I_CAL_PARTSTAT_PARAMETER);
	parameter = _tmp33_;
	_tmp34_ = parameter;
	if (_tmp34_ != NULL) {
		ICalParameter* _tmp35_;
		_tmp35_ = parameter;
		switch (i_cal_parameter_get_partstat (_tmp35_)) {
			case I_CAL_PARTSTAT_ACCEPTED:
			{
				GtkLabel* _tmp36_;
				GtkLabel* _tmp37_;
				GtkStyleContext* _tmp38_;
				_tmp36_ = status_label;
				gtk_label_set_label (_tmp36_, _ ("Accepted"));
				_tmp37_ = status_label;
				_tmp38_ = gtk_widget_get_style_context ((GtkWidget*) _tmp37_);
				gtk_style_context_add_class (_tmp38_, "success");
				break;
			}
			case I_CAL_PARTSTAT_DECLINED:
			{
				GtkLabel* _tmp39_;
				GtkLabel* _tmp40_;
				GtkStyleContext* _tmp41_;
				_tmp39_ = status_label;
				gtk_label_set_label (_tmp39_, _ ("Declined"));
				_tmp40_ = status_label;
				_tmp41_ = gtk_widget_get_style_context ((GtkWidget*) _tmp40_);
				gtk_style_context_add_class (_tmp41_, GTK_STYLE_CLASS_ERROR);
				break;
			}
			case I_CAL_PARTSTAT_TENTATIVE:
			{
				GtkLabel* _tmp42_;
				GtkLabel* _tmp43_;
				GtkStyleContext* _tmp44_;
				_tmp42_ = status_label;
				gtk_label_set_label (_tmp42_, _ ("Maybe"));
				_tmp43_ = status_label;
				_tmp44_ = gtk_widget_get_style_context ((GtkWidget*) _tmp43_);
				gtk_style_context_add_class (_tmp44_, GTK_STYLE_CLASS_ERROR);
				break;
			}
			default:
			{
				break;
			}
		}
	}
	_tmp45_ = remove_button;
	g_signal_connect_object (_tmp45_, "clicked", (GCallback) __maya_view_event_edition_guest_grid___lambda11__gtk_button_clicked, self, 0);
	_g_object_unref0 (parameter);
	_g_object_unref0 (remove_button);
	_g_free0 (mail);
	_g_object_unref0 (status_label);
	return obj;
}

static void
maya_view_event_edition_guest_grid_class_init (MayaViewEventEditionGuestGridClass * klass,
                                               gpointer klass_data)
{
	maya_view_event_edition_guest_grid_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MayaViewEventEditionGuestGrid_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_maya_view_event_edition_guest_grid_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_maya_view_event_edition_guest_grid_set_property;
	G_OBJECT_CLASS (klass)->constructor = maya_view_event_edition_guest_grid_constructor;
	G_OBJECT_CLASS (klass)->finalize = maya_view_event_edition_guest_grid_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), MAYA_VIEW_EVENT_EDITION_GUEST_GRID_ATTENDEE_PROPERTY, maya_view_event_edition_guest_grid_properties[MAYA_VIEW_EVENT_EDITION_GUEST_GRID_ATTENDEE_PROPERTY] = g_param_spec_object ("attendee", "attendee", "attendee", i_cal_property_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	maya_view_event_edition_guest_grid_signals[MAYA_VIEW_EVENT_EDITION_GUEST_GRID_REMOVED_SIGNAL] = g_signal_new ("removed", MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
maya_view_event_edition_guest_grid_instance_init (MayaViewEventEditionGuestGrid * self,
                                                  gpointer klass)
{
	self->priv = maya_view_event_edition_guest_grid_get_instance_private (self);
}

static void
maya_view_event_edition_guest_grid_finalize (GObject * obj)
{
	MayaViewEventEditionGuestGrid * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID, MayaViewEventEditionGuestGrid);
	_g_object_unref0 (self->priv->_attendee);
	_g_object_unref0 (self->priv->mail_label);
	_g_object_unref0 (self->priv->name_label);
	_g_object_unref0 (self->priv->avatar);
	G_OBJECT_CLASS (maya_view_event_edition_guest_grid_parent_class)->finalize (obj);
}

static GType
maya_view_event_edition_guest_grid_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MayaViewEventEditionGuestGridClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) maya_view_event_edition_guest_grid_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MayaViewEventEditionGuestGrid), 0, (GInstanceInitFunc) maya_view_event_edition_guest_grid_instance_init, NULL };
	GType maya_view_event_edition_guest_grid_type_id;
	maya_view_event_edition_guest_grid_type_id = g_type_register_static (gtk_grid_get_type (), "MayaViewEventEditionGuestGrid", &g_define_type_info, 0);
	MayaViewEventEditionGuestGrid_private_offset = g_type_add_instance_private (maya_view_event_edition_guest_grid_type_id, sizeof (MayaViewEventEditionGuestGridPrivate));
	return maya_view_event_edition_guest_grid_type_id;
}

GType
maya_view_event_edition_guest_grid_get_type (void)
{
	static volatile gsize maya_view_event_edition_guest_grid_type_id__once = 0;
	if (g_once_init_enter (&maya_view_event_edition_guest_grid_type_id__once)) {
		GType maya_view_event_edition_guest_grid_type_id;
		maya_view_event_edition_guest_grid_type_id = maya_view_event_edition_guest_grid_get_type_once ();
		g_once_init_leave (&maya_view_event_edition_guest_grid_type_id__once, maya_view_event_edition_guest_grid_type_id);
	}
	return maya_view_event_edition_guest_grid_type_id__once;
}

static void
_vala_maya_view_event_edition_guest_grid_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	MayaViewEventEditionGuestGrid * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID, MayaViewEventEditionGuestGrid);
	switch (property_id) {
		case MAYA_VIEW_EVENT_EDITION_GUEST_GRID_ATTENDEE_PROPERTY:
		g_value_set_object (value, maya_view_event_edition_guest_grid_get_attendee (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_maya_view_event_edition_guest_grid_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec)
{
	MayaViewEventEditionGuestGrid * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MAYA_VIEW_EVENT_EDITION_TYPE_GUEST_GRID, MayaViewEventEditionGuestGrid);
	switch (property_id) {
		case MAYA_VIEW_EVENT_EDITION_GUEST_GRID_ATTENDEE_PROPERTY:
		maya_view_event_edition_guest_grid_set_attendee (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 gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

