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

/* -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-*/
/*-
 * Copyright (c) 2011-2015 Maya Developers (http://launchpad.net/maya)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by: Jaap Broekhuizen
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <granite.h>
#include <gee.h>
#include <libical-glib/libical-glib.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include <libecal/libecal.h>
#include <folks/folks.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 MAYA_VIEW_EVENT_EDITION_TYPE_GUESTS_PANEL (maya_view_event_edition_guests_panel_get_type ())
#define MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAYA_VIEW_EVENT_EDITION_TYPE_GUESTS_PANEL, MayaViewEventEditionGuestsPanel))
#define MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAYA_VIEW_EVENT_EDITION_TYPE_GUESTS_PANEL, MayaViewEventEditionGuestsPanelClass))
#define MAYA_VIEW_EVENT_EDITION_IS_GUESTS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAYA_VIEW_EVENT_EDITION_TYPE_GUESTS_PANEL))
#define MAYA_VIEW_EVENT_EDITION_IS_GUESTS_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAYA_VIEW_EVENT_EDITION_TYPE_GUESTS_PANEL))
#define MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAYA_VIEW_EVENT_EDITION_TYPE_GUESTS_PANEL, MayaViewEventEditionGuestsPanelClass))

typedef struct _MayaViewEventEditionGuestsPanel MayaViewEventEditionGuestsPanel;
typedef struct _MayaViewEventEditionGuestsPanelClass MayaViewEventEditionGuestsPanelClass;
typedef struct _MayaViewEventEditionGuestsPanelPrivate MayaViewEventEditionGuestsPanelPrivate;

#define MAYA_VIEW_TYPE_EVENT_DIALOG (maya_view_event_dialog_get_type ())
#define MAYA_VIEW_EVENT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAYA_VIEW_TYPE_EVENT_DIALOG, MayaViewEventDialog))
#define MAYA_VIEW_EVENT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAYA_VIEW_TYPE_EVENT_DIALOG, MayaViewEventDialogClass))
#define MAYA_VIEW_IS_EVENT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAYA_VIEW_TYPE_EVENT_DIALOG))
#define MAYA_VIEW_IS_EVENT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAYA_VIEW_TYPE_EVENT_DIALOG))
#define MAYA_VIEW_EVENT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAYA_VIEW_TYPE_EVENT_DIALOG, MayaViewEventDialogClass))

typedef struct _MayaViewEventDialog MayaViewEventDialog;
typedef struct _MayaViewEventDialogClass MayaViewEventDialogClass;
enum  {
	MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_0_PROPERTY,
	MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_GUESTS_PROPERTY,
	MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_NUM_PROPERTIES
};
static GParamSpec* maya_view_event_edition_guests_panel_properties[MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_NUM_PROPERTIES];
typedef enum  {
	MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_ICON = 0,
	MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_NAME,
	MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_STATUS,
	MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_N_COLUMNS
} MayaViewEventEditionGuestsPanelCOLUMNS;

#define MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_TYPE_COLUMNS (maya_view_event_edition_guests_panel_columns_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _MayaViewEventDialogPrivate MayaViewEventDialogPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

#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 _Block13Data Block13Data;
typedef struct _MayaViewEventEditionGuestGridPrivate MayaViewEventEditionGuestGridPrivate;
typedef struct _MayaViewEventEditionGuestsPanelLoadContactsData MayaViewEventEditionGuestsPanelLoadContactsData;

struct _MayaViewEventEditionGuestsPanel {
	GtkGrid parent_instance;
	MayaViewEventEditionGuestsPanelPrivate * priv;
};

struct _MayaViewEventEditionGuestsPanelClass {
	GtkGridClass parent_class;
};

struct _MayaViewEventEditionGuestsPanelPrivate {
	MayaViewEventDialog* parent_dialog;
	GtkEntry* guest_entry;
	GtkEntryCompletion* guest_completion;
	GtkListBox* guest_list;
	GeeArrayList* attendees;
	GtkListStore* guest_store;
};

struct _MayaViewEventDialog {
	GraniteDialog parent_instance;
	MayaViewEventDialogPrivate * priv;
	gboolean can_edit;
};

struct _MayaViewEventDialogClass {
	GraniteDialogClass parent_class;
};

struct _Block13Data {
	int _ref_count_;
	MayaViewEventEditionGuestsPanel* self;
	MayaViewEventEditionGuestGrid* guest_element;
};

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

struct _MayaViewEventEditionGuestGridClass {
	GtkGridClass parent_class;
};

struct _MayaViewEventEditionGuestsPanelLoadContactsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	MayaViewEventEditionGuestsPanel* self;
	FolksIndividualAggregator* aggregator;
	FolksIndividualAggregator* _tmp0_;
	FolksIndividualAggregator* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	FolksIndividualAggregator* _tmp4_;
	GeeMap* _tmp5_;
	GeeMap* _tmp6_;
	FolksIndividualAggregator* _tmp7_;
	FolksIndividualAggregator* _tmp8_;
};

static gint MayaViewEventEditionGuestsPanel_private_offset;
static gpointer maya_view_event_edition_guests_panel_parent_class = NULL;

VALA_EXTERN GType maya_view_event_edition_guests_panel_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MayaViewEventEditionGuestsPanel, g_object_unref)
VALA_EXTERN GType maya_view_event_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MayaViewEventDialog, g_object_unref)
static GType maya_view_event_edition_guests_panel_columns_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
VALA_EXTERN MayaViewEventEditionGuestsPanel* maya_view_event_edition_guests_panel_new (MayaViewEventDialog* parent_dialog);
VALA_EXTERN MayaViewEventEditionGuestsPanel* maya_view_event_edition_guests_panel_construct (GType object_type,
                                                                                 MayaViewEventDialog* parent_dialog);
static void maya_view_event_edition_guests_panel_load_contacts (MayaViewEventEditionGuestsPanel* self,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
static void maya_view_event_edition_guests_panel_load_contacts_finish (MayaViewEventEditionGuestsPanel* self,
                                                                GAsyncResult* _res_);
static gboolean __lambda15_ (MayaViewEventEditionGuestsPanel* self,
                      GtkTreeModel* model,
                      GtkTreeIter* iter);
static gboolean maya_view_event_edition_guests_panel_suggestion_selected (MayaViewEventEditionGuestsPanel* self,
                                                                   GtkTreeModel* model,
                                                                   GtkTreeIter* iter);
static gboolean ___lambda15__gtk_entry_completion_match_selected (GtkEntryCompletion* _sender,
                                                           GtkTreeModel* model,
                                                           GtkTreeIter* iter,
                                                           gpointer self);
static gboolean __lambda19_ (MayaViewEventEditionGuestsPanel* self,
                      GtkEntryCompletion* completion,
                      const gchar* key,
                      GtkTreeIter* iter);
static gboolean ___lambda19__gtk_entry_completion_match_func (GtkEntryCompletion* completion,
                                                       const gchar* key,
                                                       GtkTreeIter* iter,
                                                       gpointer self);
static void __lambda20_ (MayaViewEventEditionGuestsPanel* self);
static void maya_view_event_edition_guests_panel_add_guest (MayaViewEventEditionGuestsPanel* self,
                                                     ICalProperty* attendee);
static void ___lambda20__gtk_entry_activate (GtkEntry* _sender,
                                      gpointer self);
VALA_EXTERN ECalComponent* maya_view_event_dialog_get_ecal (MayaViewEventDialog* self);
static void maya_view_event_edition_guests_panel_apply_contact_store_model (MayaViewEventEditionGuestsPanel* self,
                                                                     GeeMap* contacts);
VALA_EXTERN void maya_view_event_edition_guests_panel_save (MayaViewEventEditionGuestsPanel* self);
VALA_EXTERN GType maya_view_event_edition_guest_grid_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MayaViewEventEditionGuestGrid, g_object_unref)
static Block13Data* block13_data_ref (Block13Data* _data13_);
static void block13_data_unref (void * _userdata_);
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 __lambda18_ (Block13Data* _data13_);
static void ___lambda18__maya_view_event_edition_guest_grid_removed (MayaViewEventEditionGuestGrid* _sender,
                                                              gpointer self);
static void maya_view_event_edition_guests_panel_load_contacts_data_free (gpointer _data);
static gboolean maya_view_event_edition_guests_panel_load_contacts_co (MayaViewEventEditionGuestsPanelLoadContactsData* _data_);
static void ___lambda14_ (MayaViewEventEditionGuestsPanel* self);
static void ____lambda14__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
VALA_EXTERN const gchar* maya_view_event_edition_guests_panel_get_guests (MayaViewEventEditionGuestsPanel* self);
VALA_EXTERN void maya_view_event_edition_guests_panel_set_guests (MayaViewEventEditionGuestsPanel* self,
                                                      const gchar* value);
static void maya_view_event_edition_guests_panel_finalize (GObject * obj);
static GType maya_view_event_edition_guests_panel_get_type_once (void);
static void _vala_maya_view_event_edition_guests_panel_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec);
static void _vala_maya_view_event_edition_guests_panel_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec);

static inline gpointer
maya_view_event_edition_guests_panel_get_instance_private (MayaViewEventEditionGuestsPanel* self)
{
	return G_STRUCT_MEMBER_P (self, MayaViewEventEditionGuestsPanel_private_offset);
}

static GType
maya_view_event_edition_guests_panel_columns_get_type_once (void)
{
	static const GEnumValue values[] = {{MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_ICON, "MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_ICON", "icon"}, {MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_NAME, "MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_NAME", "name"}, {MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_STATUS, "MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_STATUS", "status"}, {MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_N_COLUMNS, "MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_COLUMNS_N_COLUMNS", "n-columns"}, {0, NULL, NULL}};
	GType maya_view_event_edition_guests_panel_columns_type_id;
	maya_view_event_edition_guests_panel_columns_type_id = g_enum_register_static ("MayaViewEventEditionGuestsPanelCOLUMNS", values);
	return maya_view_event_edition_guests_panel_columns_type_id;
}

static GType
maya_view_event_edition_guests_panel_columns_get_type (void)
{
	static volatile gsize maya_view_event_edition_guests_panel_columns_type_id__once = 0;
	if (g_once_init_enter (&maya_view_event_edition_guests_panel_columns_type_id__once)) {
		GType maya_view_event_edition_guests_panel_columns_type_id;
		maya_view_event_edition_guests_panel_columns_type_id = maya_view_event_edition_guests_panel_columns_get_type_once ();
		g_once_init_leave (&maya_view_event_edition_guests_panel_columns_type_id__once, maya_view_event_edition_guests_panel_columns_type_id);
	}
	return maya_view_event_edition_guests_panel_columns_type_id__once;
}

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

static gboolean
__lambda15_ (MayaViewEventEditionGuestsPanel* self,
             GtkTreeModel* model,
             GtkTreeIter* iter)
{
	GtkTreeIter _tmp0_;
	gboolean result;
	g_return_val_if_fail (model != NULL, FALSE);
	g_return_val_if_fail (iter != NULL, FALSE);
	_tmp0_ = *iter;
	result = maya_view_event_edition_guests_panel_suggestion_selected (self, model, &_tmp0_);
	return result;
}

static gboolean
___lambda15__gtk_entry_completion_match_selected (GtkEntryCompletion* _sender,
                                                  GtkTreeModel* model,
                                                  GtkTreeIter* iter,
                                                  gpointer self)
{
	gboolean result;
	result = __lambda15_ ((MayaViewEventEditionGuestsPanel*) self, model, iter);
	return result;
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gboolean
__lambda19_ (MayaViewEventEditionGuestsPanel* self,
             GtkEntryCompletion* completion,
             const gchar* key,
             GtkTreeIter* iter)
{
	GValue val1 = {0};
	GValue val2 = {0};
	GtkListStore* model = NULL;
	GtkTreeModel* _tmp0_;
	GtkListStore* _tmp1_;
	GtkListStore* _tmp2_;
	GtkTreeIter _tmp3_;
	GValue _tmp4_ = {0};
	GtkListStore* _tmp5_;
	GtkTreeIter _tmp6_;
	GValue _tmp7_ = {0};
	gboolean _tmp8_ = FALSE;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gboolean _tmp12_;
	gboolean result;
	g_return_val_if_fail (completion != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	g_return_val_if_fail (iter != NULL, FALSE);
	_tmp0_ = gtk_entry_completion_get_model (completion);
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_list_store_get_type (), GtkListStore));
	model = _tmp1_;
	_tmp2_ = model;
	_tmp3_ = *iter;
	gtk_tree_model_get_value ((GtkTreeModel*) _tmp2_, &_tmp3_, 0, &_tmp4_);
	G_IS_VALUE (&val1) ? (g_value_unset (&val1), NULL) : NULL;
	val1 = _tmp4_;
	_tmp5_ = model;
	_tmp6_ = *iter;
	gtk_tree_model_get_value ((GtkTreeModel*) _tmp5_, &_tmp6_, 1, &_tmp7_);
	G_IS_VALUE (&val2) ? (g_value_unset (&val2), NULL) : NULL;
	val2 = _tmp7_;
	_tmp9_ = g_value_get_string (&val1);
	_tmp10_ = g_utf8_casefold (_tmp9_, (gssize) -1);
	_tmp11_ = _tmp10_;
	_tmp12_ = string_contains (_tmp11_, key);
	_g_free0 (_tmp11_);
	if (_tmp12_) {
		_tmp8_ = TRUE;
	} else {
		const gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		_tmp13_ = g_value_get_string (&val2);
		_tmp14_ = g_utf8_casefold (_tmp13_, (gssize) -1);
		_tmp15_ = _tmp14_;
		_tmp8_ = string_contains (_tmp15_, key);
		_g_free0 (_tmp15_);
	}
	if (_tmp8_) {
		result = TRUE;
		_g_object_unref0 (model);
		G_IS_VALUE (&val2) ? (g_value_unset (&val2), NULL) : NULL;
		G_IS_VALUE (&val1) ? (g_value_unset (&val1), NULL) : NULL;
		return result;
	}
	result = FALSE;
	_g_object_unref0 (model);
	G_IS_VALUE (&val2) ? (g_value_unset (&val2), NULL) : NULL;
	G_IS_VALUE (&val1) ? (g_value_unset (&val1), NULL) : NULL;
	return result;
}

static gboolean
___lambda19__gtk_entry_completion_match_func (GtkEntryCompletion* completion,
                                              const gchar* key,
                                              GtkTreeIter* iter,
                                              gpointer self)
{
	gboolean result;
	result = __lambda19_ ((MayaViewEventEditionGuestsPanel*) self, completion, key, iter);
	return result;
}

static void
__lambda20_ (MayaViewEventEditionGuestsPanel* self)
{
	ICalProperty* attendee = NULL;
	ICalProperty* _tmp0_;
	ICalProperty* _tmp1_;
	GtkEntry* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	ICalProperty* _tmp5_;
	ICalProperty* _tmp6_;
	GtkEntry* _tmp7_;
	_tmp0_ = i_cal_property_new (I_CAL_ATTENDEE_PROPERTY);
	attendee = _tmp0_;
	_tmp1_ = attendee;
	_tmp2_ = self->priv->guest_entry;
	_tmp3_ = gtk_entry_get_text (_tmp2_);
	_tmp4_ = _tmp3_;
	i_cal_property_set_attendee (_tmp1_, _tmp4_);
	_tmp5_ = attendee;
	attendee = NULL;
	_tmp6_ = _tmp5_;
	maya_view_event_edition_guests_panel_add_guest (self, _tmp6_);
	_g_object_unref0 (_tmp6_);
	_tmp7_ = self->priv->guest_entry;
	g_signal_emit_by_name ((GtkEditable*) _tmp7_, "delete-text", 0, -1);
	_g_object_unref0 (attendee);
}

static void
___lambda20__gtk_entry_activate (GtkEntry* _sender,
                                 gpointer self)
{
	__lambda20_ ((MayaViewEventEditionGuestsPanel*) self);
}

MayaViewEventEditionGuestsPanel*
maya_view_event_edition_guests_panel_construct (GType object_type,
                                                MayaViewEventDialog* parent_dialog)
{
	MayaViewEventEditionGuestsPanel * self = NULL;
	MayaViewEventDialog* _tmp0_;
	GeeArrayList* _tmp1_;
	GtkListStore* _tmp2_;
	GraniteHeaderLabel* guest_label = NULL;
	GraniteHeaderLabel* _tmp3_;
	GtkLabel* no_guests_label = NULL;
	GtkLabel* _tmp4_;
	GtkLabel* _tmp5_;
	GtkStyleContext* no_guests_context = NULL;
	GtkLabel* _tmp6_;
	GtkStyleContext* _tmp7_;
	GtkStyleContext* _tmp8_;
	GtkStyleContext* _tmp9_;
	GtkListBox* _tmp10_;
	GtkListBox* _tmp11_;
	GtkListBox* _tmp12_;
	GtkLabel* _tmp13_;
	GtkScrolledWindow* guest_scrolledwindow = NULL;
	GtkScrolledWindow* _tmp14_;
	GtkScrolledWindow* _tmp15_;
	GtkListBox* _tmp16_;
	GtkScrolledWindow* _tmp17_;
	GtkFrame* frame = NULL;
	GtkFrame* _tmp18_;
	GtkFrame* _tmp19_;
	GtkScrolledWindow* _tmp20_;
	GtkEntryCompletion* _tmp21_;
	GtkEntryCompletion* _tmp22_;
	GtkEntryCompletion* _tmp23_;
	GtkListStore* _tmp24_;
	GtkEntryCompletion* _tmp25_;
	GtkEntryCompletion* _tmp26_;
	GtkEntryCompletion* _tmp27_;
	GtkEntryCompletion* _tmp28_;
	GtkSearchEntry* _tmp29_;
	GtkEntry* _tmp30_;
	GtkEntry* _tmp31_;
	GtkEntry* _tmp32_;
	GtkEntryCompletion* _tmp33_;
	GtkEntry* _tmp34_;
	GraniteHeaderLabel* _tmp35_;
	GtkEntry* _tmp36_;
	GtkFrame* _tmp37_;
	ECalComponent* _tmp38_;
	ECalComponent* _tmp39_;
	g_return_val_if_fail (parent_dialog != NULL, NULL);
	self = (MayaViewEventEditionGuestsPanel*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (parent_dialog);
	_g_object_unref0 (self->priv->parent_dialog);
	self->priv->parent_dialog = _tmp0_;
	_tmp1_ = gee_array_list_new (i_cal_property_get_type (), NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->attendees);
	self->priv->attendees = _tmp1_;
	gtk_widget_set_margin_start ((GtkWidget*) self, 12);
	gtk_widget_set_margin_end ((GtkWidget*) self, 12);
	gtk_grid_set_row_spacing ((GtkGrid*) self, 6);
	gtk_widget_set_sensitive ((GtkWidget*) self, parent_dialog->can_edit);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	_tmp2_ = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING, -1);
	_g_object_unref0 (self->priv->guest_store);
	self->priv->guest_store = _tmp2_;
	_tmp3_ = granite_header_label_new (_ ("Participants:"));
	g_object_ref_sink (_tmp3_);
	guest_label = _tmp3_;
	maya_view_event_edition_guests_panel_load_contacts (self, NULL, NULL);
	_tmp4_ = (GtkLabel*) gtk_label_new (_ ("No Participants"));
	g_object_ref_sink (_tmp4_);
	no_guests_label = _tmp4_;
	_tmp5_ = no_guests_label;
	gtk_widget_show ((GtkWidget*) _tmp5_);
	_tmp6_ = no_guests_label;
	_tmp7_ = gtk_widget_get_style_context ((GtkWidget*) _tmp6_);
	no_guests_context = _tmp7_;
	_tmp8_ = no_guests_context;
	gtk_style_context_add_class (_tmp8_, GRANITE_STYLE_CLASS_H3_LABEL);
	_tmp9_ = no_guests_context;
	gtk_style_context_add_class (_tmp9_, GTK_STYLE_CLASS_DIM_LABEL);
	_tmp10_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->guest_list);
	self->priv->guest_list = _tmp10_;
	_tmp11_ = self->priv->guest_list;
	gtk_list_box_set_selection_mode (_tmp11_, GTK_SELECTION_NONE);
	_tmp12_ = self->priv->guest_list;
	_tmp13_ = no_guests_label;
	gtk_list_box_set_placeholder (_tmp12_, (GtkWidget*) _tmp13_);
	_tmp14_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp14_);
	guest_scrolledwindow = _tmp14_;
	_tmp15_ = guest_scrolledwindow;
	_tmp16_ = self->priv->guest_list;
	gtk_container_add ((GtkContainer*) _tmp15_, (GtkWidget*) _tmp16_);
	_tmp17_ = guest_scrolledwindow;
	g_object_set ((GtkWidget*) _tmp17_, "expand", TRUE, NULL);
	_tmp18_ = (GtkFrame*) gtk_frame_new (NULL);
	g_object_ref_sink (_tmp18_);
	frame = _tmp18_;
	_tmp19_ = frame;
	_tmp20_ = guest_scrolledwindow;
	gtk_container_add ((GtkContainer*) _tmp19_, (GtkWidget*) _tmp20_);
	_tmp21_ = gtk_entry_completion_new ();
	_g_object_unref0 (self->priv->guest_completion);
	self->priv->guest_completion = _tmp21_;
	_tmp22_ = self->priv->guest_completion;
	gtk_entry_completion_set_minimum_key_length (_tmp22_, 3);
	_tmp23_ = self->priv->guest_completion;
	_tmp24_ = self->priv->guest_store;
	gtk_entry_completion_set_model (_tmp23_, (GtkTreeModel*) _tmp24_);
	_tmp25_ = self->priv->guest_completion;
	gtk_entry_completion_set_text_column (_tmp25_, 0);
	_tmp26_ = self->priv->guest_completion;
	gtk_entry_completion_set_text_column (_tmp26_, 1);
	_tmp27_ = self->priv->guest_completion;
	g_signal_connect_object (_tmp27_, "match-selected", (GCallback) ___lambda15__gtk_entry_completion_match_selected, self, 0);
	_tmp28_ = self->priv->guest_completion;
	gtk_entry_completion_set_match_func (_tmp28_, ___lambda19__gtk_entry_completion_match_func, g_object_ref (self), g_object_unref);
	_tmp29_ = (GtkSearchEntry*) gtk_search_entry_new ();
	g_object_ref_sink (_tmp29_);
	_g_object_unref0 (self->priv->guest_entry);
	self->priv->guest_entry = (GtkEntry*) _tmp29_;
	_tmp30_ = self->priv->guest_entry;
	gtk_entry_set_placeholder_text (_tmp30_, _ ("Invite"));
	_tmp31_ = self->priv->guest_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp31_, TRUE);
	_tmp32_ = self->priv->guest_entry;
	_tmp33_ = self->priv->guest_completion;
	gtk_entry_set_completion (_tmp32_, _tmp33_);
	_tmp34_ = self->priv->guest_entry;
	g_signal_connect_object (_tmp34_, "activate", (GCallback) ___lambda20__gtk_entry_activate, self, 0);
	_tmp35_ = guest_label;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp35_);
	_tmp36_ = self->priv->guest_entry;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp36_);
	_tmp37_ = frame;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp37_);
	_tmp38_ = maya_view_event_dialog_get_ecal (parent_dialog);
	_tmp39_ = _tmp38_;
	if (_tmp39_ != NULL) {
		ICalComponent* comp = NULL;
		ECalComponent* _tmp40_;
		ECalComponent* _tmp41_;
		ICalComponent* _tmp42_;
		gint count = 0;
		ICalComponent* _tmp43_;
		ICalProperty* property = NULL;
		ICalComponent* _tmp44_;
		ICalProperty* _tmp45_;
		_tmp40_ = maya_view_event_dialog_get_ecal (parent_dialog);
		_tmp41_ = _tmp40_;
		_tmp42_ = e_cal_component_get_icalcomponent (_tmp41_);
		comp = _tmp42_;
		_tmp43_ = comp;
		count = i_cal_component_count_properties (_tmp43_, I_CAL_ATTENDEE_PROPERTY);
		_tmp44_ = comp;
		_tmp45_ = i_cal_component_get_first_property (_tmp44_, I_CAL_ATTENDEE_PROPERTY);
		_g_object_unref0 (property);
		property = _tmp45_;
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp46_ = FALSE;
				_tmp46_ = TRUE;
				while (TRUE) {
					ICalProperty* _tmp48_;
					const gchar* _tmp49_;
					ICalComponent* _tmp51_;
					ICalProperty* _tmp52_;
					if (!_tmp46_) {
						gint _tmp47_;
						_tmp47_ = i;
						i = _tmp47_ + 1;
					}
					_tmp46_ = FALSE;
					if (!(i < count)) {
						break;
					}
					_tmp48_ = property;
					_tmp49_ = i_cal_property_get_attendee (_tmp48_);
					if (_tmp49_ != NULL) {
						ICalProperty* _tmp50_;
						_tmp50_ = property;
						maya_view_event_edition_guests_panel_add_guest (self, _tmp50_);
					}
					_tmp51_ = comp;
					_tmp52_ = i_cal_component_get_next_property (_tmp51_, I_CAL_ATTENDEE_PROPERTY);
					_g_object_unref0 (property);
					property = _tmp52_;
				}
			}
		}
		_g_object_unref0 (property);
	}
	gtk_widget_show_all ((GtkWidget*) self);
	_g_object_unref0 (frame);
	_g_object_unref0 (guest_scrolledwindow);
	_g_object_unref0 (no_guests_label);
	_g_object_unref0 (guest_label);
	return self;
}

MayaViewEventEditionGuestsPanel*
maya_view_event_edition_guests_panel_new (MayaViewEventDialog* parent_dialog)
{
	return maya_view_event_edition_guests_panel_construct (MAYA_VIEW_EVENT_EDITION_TYPE_GUESTS_PANEL, parent_dialog);
}

/**
     * Add the contacts to the EntryCompletion model.
     */
static void
maya_view_event_edition_guests_panel_apply_contact_store_model (MayaViewEventEditionGuestsPanel* self,
                                                                GeeMap* contacts)
{
	GtkTreeIter contact = {0};
	GeeMapIterator* map_iterator = NULL;
	GeeMapIterator* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (contacts != NULL);
	_tmp0_ = gee_map_map_iterator (contacts);
	map_iterator = _tmp0_;
	while (TRUE) {
		GeeMapIterator* _tmp1_;
		_tmp1_ = map_iterator;
		if (!gee_map_iterator_next (_tmp1_)) {
			break;
		}
		{
			GeeIterator* _address_it = NULL;
			GeeMapIterator* _tmp2_;
			gpointer _tmp3_;
			FolksIndividual* _tmp4_;
			GeeSet* _tmp5_;
			GeeSet* _tmp6_;
			GeeIterator* _tmp7_;
			GeeIterator* _tmp8_;
			_tmp2_ = map_iterator;
			_tmp3_ = gee_map_iterator_get_value (_tmp2_);
			_tmp4_ = (FolksIndividual*) _tmp3_;
			_tmp5_ = folks_email_details_get_email_addresses ((FolksEmailDetails*) _tmp4_);
			_tmp6_ = _tmp5_;
			_tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_);
			_tmp8_ = _tmp7_;
			_g_object_unref0 (_tmp4_);
			_address_it = _tmp8_;
			while (TRUE) {
				GeeIterator* _tmp9_;
				FolksEmailFieldDetails* address = NULL;
				GeeIterator* _tmp10_;
				gpointer _tmp11_;
				GtkListStore* _tmp12_;
				GtkTreeIter _tmp13_ = {0};
				GtkListStore* _tmp14_;
				GtkTreeIter _tmp15_;
				GeeMapIterator* _tmp16_;
				gpointer _tmp17_;
				FolksIndividual* _tmp18_;
				const gchar* _tmp19_;
				const gchar* _tmp20_;
				FolksEmailFieldDetails* _tmp21_;
				gconstpointer _tmp22_;
				gconstpointer _tmp23_;
				_tmp9_ = _address_it;
				if (!gee_iterator_next (_tmp9_)) {
					break;
				}
				_tmp10_ = _address_it;
				_tmp11_ = gee_iterator_get (_tmp10_);
				address = (FolksEmailFieldDetails*) _tmp11_;
				_tmp12_ = self->priv->guest_store;
				gtk_list_store_append (_tmp12_, &_tmp13_);
				contact = _tmp13_;
				_tmp14_ = self->priv->guest_store;
				_tmp15_ = contact;
				_tmp16_ = map_iterator;
				_tmp17_ = gee_map_iterator_get_value (_tmp16_);
				_tmp18_ = (FolksIndividual*) _tmp17_;
				_tmp19_ = folks_name_details_get_full_name ((FolksNameDetails*) _tmp18_);
				_tmp20_ = _tmp19_;
				_tmp21_ = address;
				_tmp22_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp21_);
				_tmp23_ = _tmp22_;
				gtk_list_store_set (_tmp14_, &_tmp15_, 0, _tmp20_, 1, (const gchar*) _tmp23_, -1);
				_g_object_unref0 (_tmp18_);
				_g_object_unref0 (address);
			}
			_g_object_unref0 (_address_it);
		}
	}
	_g_object_unref0 (map_iterator);
}

/**
     * Save the values in the dialog into the component.
     */
void
maya_view_event_edition_guests_panel_save (MayaViewEventEditionGuestsPanel* self)
{
	ICalComponent* comp = NULL;
	MayaViewEventDialog* _tmp0_;
	ECalComponent* _tmp1_;
	ECalComponent* _tmp2_;
	ICalComponent* _tmp3_;
	gint count = 0;
	ICalComponent* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->parent_dialog;
	_tmp1_ = maya_view_event_dialog_get_ecal (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = e_cal_component_get_icalcomponent (_tmp2_);
	comp = _tmp3_;
	_tmp4_ = comp;
	count = i_cal_component_count_properties (_tmp4_, I_CAL_ATTENDEE_PROPERTY);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				ICalProperty* remove_prop = NULL;
				ICalProperty* found_prop = NULL;
				ICalProperty* _tmp11_;
				ICalProperty* _tmp12_;
				gboolean can_remove = FALSE;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				if (!(i < count)) {
					break;
				}
				if (i == 0) {
					ICalComponent* _tmp7_;
					ICalProperty* _tmp8_;
					_tmp7_ = comp;
					_tmp8_ = i_cal_component_get_first_property (_tmp7_, I_CAL_ATTENDEE_PROPERTY);
					_g_object_unref0 (remove_prop);
					remove_prop = _tmp8_;
				} else {
					ICalComponent* _tmp9_;
					ICalProperty* _tmp10_;
					_tmp9_ = comp;
					_tmp10_ = i_cal_component_get_next_property (_tmp9_, I_CAL_ATTENDEE_PROPERTY);
					_g_object_unref0 (remove_prop);
					remove_prop = _tmp10_;
				}
				_tmp11_ = remove_prop;
				_tmp12_ = _g_object_ref0 (_tmp11_);
				found_prop = _tmp12_;
				can_remove = TRUE;
				{
					GeeArrayList* _attendee_list = NULL;
					GeeArrayList* _tmp13_;
					gint _attendee_size = 0;
					GeeArrayList* _tmp14_;
					gint _tmp15_;
					gint _tmp16_;
					gint _attendee_index = 0;
					_tmp13_ = self->priv->attendees;
					_attendee_list = _tmp13_;
					_tmp14_ = _attendee_list;
					_tmp15_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp14_);
					_tmp16_ = _tmp15_;
					_attendee_size = _tmp16_;
					_attendee_index = -1;
					while (TRUE) {
						gint _tmp17_;
						gint _tmp18_;
						ICalProperty* attendee = NULL;
						GeeArrayList* _tmp19_;
						gpointer _tmp20_;
						ICalProperty* _tmp21_;
						const gchar* _tmp22_;
						ICalProperty* _tmp23_;
						const gchar* _tmp24_;
						_attendee_index = _attendee_index + 1;
						_tmp17_ = _attendee_index;
						_tmp18_ = _attendee_size;
						if (!(_tmp17_ < _tmp18_)) {
							break;
						}
						_tmp19_ = _attendee_list;
						_tmp20_ = gee_abstract_list_get ((GeeAbstractList*) _tmp19_, _attendee_index);
						attendee = (ICalProperty*) _tmp20_;
						_tmp21_ = attendee;
						_tmp22_ = i_cal_property_get_uid (_tmp21_);
						_tmp23_ = remove_prop;
						_tmp24_ = i_cal_property_get_uid (_tmp23_);
						if (g_strcmp0 (_tmp22_, _tmp24_) == 0) {
							ICalProperty* _tmp25_;
							ICalProperty* _tmp26_;
							can_remove = FALSE;
							_tmp25_ = attendee;
							_tmp26_ = _g_object_ref0 (_tmp25_);
							_g_object_unref0 (found_prop);
							found_prop = _tmp26_;
						}
					}
				}
				if (can_remove == TRUE) {
					ICalComponent* _tmp27_;
					ICalProperty* _tmp28_;
					_tmp27_ = comp;
					_tmp28_ = remove_prop;
					i_cal_component_remove_property (_tmp27_, _tmp28_);
				} else {
					ICalProperty* _tmp29_;
					ICalProperty* _tmp30_;
					_tmp29_ = found_prop;
					_tmp30_ = remove_prop;
					if (_tmp29_ != _tmp30_) {
						GeeArrayList* _tmp31_;
						ICalProperty* _tmp32_;
						_tmp31_ = self->priv->attendees;
						_tmp32_ = found_prop;
						gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp31_, _tmp32_);
					}
				}
				_g_object_unref0 (found_prop);
				_g_object_unref0 (remove_prop);
			}
		}
	}
	{
		GeeArrayList* _attendee_list = NULL;
		GeeArrayList* _tmp33_;
		gint _attendee_size = 0;
		GeeArrayList* _tmp34_;
		gint _tmp35_;
		gint _tmp36_;
		gint _attendee_index = 0;
		_tmp33_ = self->priv->attendees;
		_attendee_list = _tmp33_;
		_tmp34_ = _attendee_list;
		_tmp35_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp34_);
		_tmp36_ = _tmp35_;
		_attendee_size = _tmp36_;
		_attendee_index = -1;
		while (TRUE) {
			gint _tmp37_;
			gint _tmp38_;
			ICalProperty* attendee = NULL;
			GeeArrayList* _tmp39_;
			gpointer _tmp40_;
			ICalComponent* _tmp41_;
			ICalProperty* _tmp42_;
			ICalProperty* _tmp43_;
			ICalProperty* _tmp44_;
			_attendee_index = _attendee_index + 1;
			_tmp37_ = _attendee_index;
			_tmp38_ = _attendee_size;
			if (!(_tmp37_ < _tmp38_)) {
				break;
			}
			_tmp39_ = _attendee_list;
			_tmp40_ = gee_abstract_list_get ((GeeAbstractList*) _tmp39_, _attendee_index);
			attendee = (ICalProperty*) _tmp40_;
			_tmp41_ = comp;
			_tmp42_ = attendee;
			_tmp43_ = i_cal_property_clone (_tmp42_);
			_tmp44_ = _tmp43_;
			i_cal_component_add_property (_tmp41_, _tmp44_);
			_g_object_unref0 (_tmp44_);
		}
	}
}

static Block13Data*
block13_data_ref (Block13Data* _data13_)
{
	g_atomic_int_inc (&_data13_->_ref_count_);
	return _data13_;
}

static void
block13_data_unref (void * _userdata_)
{
	Block13Data* _data13_;
	_data13_ = (Block13Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data13_->_ref_count_)) {
		MayaViewEventEditionGuestsPanel* self;
		self = _data13_->self;
		_g_object_unref0 (_data13_->guest_element);
		_g_object_unref0 (self);
		g_slice_free (Block13Data, _data13_);
	}
}

static void
__lambda18_ (Block13Data* _data13_)
{
	MayaViewEventEditionGuestsPanel* self;
	GeeArrayList* _tmp0_;
	ICalProperty* _tmp1_;
	self = _data13_->self;
	_tmp0_ = self->priv->attendees;
	_tmp1_ = _data13_->guest_element->attendee;
	gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp0_, _tmp1_);
}

static void
___lambda18__maya_view_event_edition_guest_grid_removed (MayaViewEventEditionGuestGrid* _sender,
                                                         gpointer self)
{
	__lambda18_ (self);
}

static void
maya_view_event_edition_guests_panel_add_guest (MayaViewEventEditionGuestsPanel* self,
                                                ICalProperty* attendee)
{
	Block13Data* _data13_;
	GtkListBoxRow* row = NULL;
	GtkListBoxRow* _tmp0_;
	MayaViewEventEditionGuestGrid* _tmp1_;
	GtkListBox* _tmp2_;
	GeeArrayList* _tmp3_;
	ICalProperty* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (attendee != NULL);
	_data13_ = g_slice_new0 (Block13Data);
	_data13_->_ref_count_ = 1;
	_data13_->self = g_object_ref (self);
	_tmp0_ = (GtkListBoxRow*) gtk_list_box_row_new ();
	g_object_ref_sink (_tmp0_);
	row = _tmp0_;
	_tmp1_ = maya_view_event_edition_guest_grid_new (attendee);
	g_object_ref_sink (_tmp1_);
	_data13_->guest_element = _tmp1_;
	gtk_container_add ((GtkContainer*) row, (GtkWidget*) _data13_->guest_element);
	_tmp2_ = self->priv->guest_list;
	gtk_container_add ((GtkContainer*) _tmp2_, (GtkWidget*) row);
	_tmp3_ = self->priv->attendees;
	_tmp4_ = _data13_->guest_element->attendee;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, _tmp4_);
	g_signal_connect_data (_data13_->guest_element, "removed", (GCallback) ___lambda18__maya_view_event_edition_guest_grid_removed, block13_data_ref (_data13_), (GClosureNotify) block13_data_unref, 0);
	gtk_widget_show_all ((GtkWidget*) row);
	_g_object_unref0 (row);
	block13_data_unref (_data13_);
	_data13_ = NULL;
}

static gboolean
maya_view_event_edition_guests_panel_suggestion_selected (MayaViewEventEditionGuestsPanel* self,
                                                          GtkTreeModel* model,
                                                          GtkTreeIter* iter)
{
	ICalProperty* attendee = NULL;
	ICalProperty* _tmp0_;
	GValue selected_value = {0};
	GtkTreeIter _tmp1_;
	GValue _tmp2_ = {0};
	ICalProperty* _tmp3_;
	const gchar* _tmp4_;
	ICalProperty* _tmp5_;
	ICalProperty* _tmp6_;
	GtkEntry* _tmp7_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (model != NULL, FALSE);
	g_return_val_if_fail (iter != NULL, FALSE);
	_tmp0_ = i_cal_property_new (I_CAL_ATTENDEE_PROPERTY);
	attendee = _tmp0_;
	_tmp1_ = *iter;
	gtk_tree_model_get_value (model, &_tmp1_, 1, &_tmp2_);
	G_IS_VALUE (&selected_value) ? (g_value_unset (&selected_value), NULL) : NULL;
	selected_value = _tmp2_;
	_tmp3_ = attendee;
	_tmp4_ = g_value_get_string (&selected_value);
	i_cal_property_set_attendee (_tmp3_, _tmp4_);
	_tmp5_ = attendee;
	attendee = NULL;
	_tmp6_ = _tmp5_;
	maya_view_event_edition_guests_panel_add_guest (self, _tmp6_);
	_g_object_unref0 (_tmp6_);
	_tmp7_ = self->priv->guest_entry;
	g_signal_emit_by_name ((GtkEditable*) _tmp7_, "delete-text", 0, -1);
	result = TRUE;
	G_IS_VALUE (&selected_value) ? (g_value_unset (&selected_value), NULL) : NULL;
	_g_object_unref0 (attendee);
	return result;
}

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

static void
maya_view_event_edition_guests_panel_load_contacts (MayaViewEventEditionGuestsPanel* self,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	MayaViewEventEditionGuestsPanelLoadContactsData* _data_;
	MayaViewEventEditionGuestsPanel* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (MayaViewEventEditionGuestsPanelLoadContactsData);
	_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_guests_panel_load_contacts_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	maya_view_event_edition_guests_panel_load_contacts_co (_data_);
}

static void
maya_view_event_edition_guests_panel_load_contacts_finish (MayaViewEventEditionGuestsPanel* self,
                                                           GAsyncResult* _res_)
{
	MayaViewEventEditionGuestsPanelLoadContactsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
___lambda14_ (MayaViewEventEditionGuestsPanel* self)
{
	maya_view_event_edition_guests_panel_load_contacts (self, NULL, NULL);
}

static void
____lambda14__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	___lambda14_ ((MayaViewEventEditionGuestsPanel*) self);
}

static gboolean
maya_view_event_edition_guests_panel_load_contacts_co (MayaViewEventEditionGuestsPanelLoadContactsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_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;
		_data_->_tmp5_ = folks_individual_aggregator_get_individuals (_data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		maya_view_event_edition_guests_panel_apply_contact_store_model (_data_->self, _data_->_tmp6_);
	} else {
		_data_->_tmp7_ = _data_->aggregator;
		g_signal_connect_object ((GObject*) _data_->_tmp7_, "notify::is-quiescent", (GCallback) ____lambda14__g_object_notify, _data_->self, 0);
		_data_->_tmp8_ = _data_->aggregator;
		folks_individual_aggregator_prepare (_data_->_tmp8_, NULL, NULL);
	}
	_g_object_unref0 (_data_->aggregator);
	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;
}

const gchar*
maya_view_event_edition_guests_panel_get_guests (MayaViewEventEditionGuestsPanel* self)
{
	const gchar* result;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->guest_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	result = _tmp1_;
	return result;
}

void
maya_view_event_edition_guests_panel_set_guests (MayaViewEventEditionGuestsPanel* self,
                                                 const gchar* value)
{
	GtkEntry* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->guest_entry;
	gtk_entry_set_text (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, maya_view_event_edition_guests_panel_properties[MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_GUESTS_PROPERTY]);
}

static void
maya_view_event_edition_guests_panel_class_init (MayaViewEventEditionGuestsPanelClass * klass,
                                                 gpointer klass_data)
{
	maya_view_event_edition_guests_panel_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MayaViewEventEditionGuestsPanel_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_maya_view_event_edition_guests_panel_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_maya_view_event_edition_guests_panel_set_property;
	G_OBJECT_CLASS (klass)->finalize = maya_view_event_edition_guests_panel_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_GUESTS_PROPERTY, maya_view_event_edition_guests_panel_properties[MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_GUESTS_PROPERTY] = g_param_spec_string ("guests", "guests", "guests", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
maya_view_event_edition_guests_panel_instance_init (MayaViewEventEditionGuestsPanel * self,
                                                    gpointer klass)
{
	self->priv = maya_view_event_edition_guests_panel_get_instance_private (self);
}

static void
maya_view_event_edition_guests_panel_finalize (GObject * obj)
{
	MayaViewEventEditionGuestsPanel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAYA_VIEW_EVENT_EDITION_TYPE_GUESTS_PANEL, MayaViewEventEditionGuestsPanel);
	_g_object_unref0 (self->priv->parent_dialog);
	_g_object_unref0 (self->priv->guest_entry);
	_g_object_unref0 (self->priv->guest_completion);
	_g_object_unref0 (self->priv->guest_list);
	_g_object_unref0 (self->priv->attendees);
	_g_object_unref0 (self->priv->guest_store);
	G_OBJECT_CLASS (maya_view_event_edition_guests_panel_parent_class)->finalize (obj);
}

static GType
maya_view_event_edition_guests_panel_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MayaViewEventEditionGuestsPanelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) maya_view_event_edition_guests_panel_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MayaViewEventEditionGuestsPanel), 0, (GInstanceInitFunc) maya_view_event_edition_guests_panel_instance_init, NULL };
	GType maya_view_event_edition_guests_panel_type_id;
	maya_view_event_edition_guests_panel_type_id = g_type_register_static (gtk_grid_get_type (), "MayaViewEventEditionGuestsPanel", &g_define_type_info, 0);
	MayaViewEventEditionGuestsPanel_private_offset = g_type_add_instance_private (maya_view_event_edition_guests_panel_type_id, sizeof (MayaViewEventEditionGuestsPanelPrivate));
	return maya_view_event_edition_guests_panel_type_id;
}

GType
maya_view_event_edition_guests_panel_get_type (void)
{
	static volatile gsize maya_view_event_edition_guests_panel_type_id__once = 0;
	if (g_once_init_enter (&maya_view_event_edition_guests_panel_type_id__once)) {
		GType maya_view_event_edition_guests_panel_type_id;
		maya_view_event_edition_guests_panel_type_id = maya_view_event_edition_guests_panel_get_type_once ();
		g_once_init_leave (&maya_view_event_edition_guests_panel_type_id__once, maya_view_event_edition_guests_panel_type_id);
	}
	return maya_view_event_edition_guests_panel_type_id__once;
}

static void
_vala_maya_view_event_edition_guests_panel_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec)
{
	MayaViewEventEditionGuestsPanel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MAYA_VIEW_EVENT_EDITION_TYPE_GUESTS_PANEL, MayaViewEventEditionGuestsPanel);
	switch (property_id) {
		case MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_GUESTS_PROPERTY:
		g_value_set_string (value, maya_view_event_edition_guests_panel_get_guests (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_maya_view_event_edition_guests_panel_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec)
{
	MayaViewEventEditionGuestsPanel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MAYA_VIEW_EVENT_EDITION_TYPE_GUESTS_PANEL, MayaViewEventEditionGuestsPanel);
	switch (property_id) {
		case MAYA_VIEW_EVENT_EDITION_GUESTS_PANEL_GUESTS_PROPERTY:
		maya_view_event_edition_guests_panel_set_guests (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

