/* moonshot-identity-request.c generated by valac 0.34.9, the Vala compiler
 * generated from moonshot-identity-request.vala, do not modify */

/*
 * Copyright (c) 2011-2016, JANET(UK)
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of JANET(UK) nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
*/

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


#define TYPE_IDENTITY_REQUEST (identity_request_get_type ())
#define IDENTITY_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_REQUEST, IdentityRequest))
#define IDENTITY_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_REQUEST, IdentityRequestClass))
#define IS_IDENTITY_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_REQUEST))
#define IS_IDENTITY_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_REQUEST))
#define IDENTITY_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_REQUEST, IdentityRequestClass))

typedef struct _IdentityRequest IdentityRequest;
typedef struct _IdentityRequestClass IdentityRequestClass;
typedef struct _IdentityRequestPrivate IdentityRequestPrivate;

#define TYPE_ID_CARD (id_card_get_type ())
#define ID_CARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ID_CARD, IdCard))
#define ID_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ID_CARD, IdCardClass))
#define IS_ID_CARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ID_CARD))
#define IS_ID_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ID_CARD))
#define ID_CARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ID_CARD, IdCardClass))

typedef struct _IdCard IdCard;
typedef struct _IdCardClass IdCardClass;

#define TYPE_IDENTITY_MANAGER_APP (identity_manager_app_get_type ())
#define IDENTITY_MANAGER_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_MANAGER_APP, IdentityManagerApp))
#define IDENTITY_MANAGER_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_MANAGER_APP, IdentityManagerAppClass))
#define IS_IDENTITY_MANAGER_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_MANAGER_APP))
#define IS_IDENTITY_MANAGER_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_MANAGER_APP))
#define IDENTITY_MANAGER_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_MANAGER_APP, IdentityManagerAppClass))

typedef struct _IdentityManagerApp IdentityManagerApp;
typedef struct _IdentityManagerAppClass IdentityManagerAppClass;

#define TYPE_MOONSHOT_LOGGER (moonshot_logger_get_type ())
#define MOONSHOT_LOGGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MOONSHOT_LOGGER, MoonshotLogger))
#define MOONSHOT_LOGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MOONSHOT_LOGGER, MoonshotLoggerClass))
#define IS_MOONSHOT_LOGGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MOONSHOT_LOGGER))
#define IS_MOONSHOT_LOGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MOONSHOT_LOGGER))
#define MOONSHOT_LOGGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MOONSHOT_LOGGER, MoonshotLoggerClass))

typedef struct _MoonshotLogger MoonshotLogger;
typedef struct _MoonshotLoggerClass MoonshotLoggerClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _identity_manager_app_unref0(var) ((var == NULL) ? NULL : (var = (identity_manager_app_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define __g_slist_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__g_object_unref0_ (var), NULL)))
typedef struct _IdentityManagerAppPrivate IdentityManagerAppPrivate;

#define TYPE_IDENTITY_MANAGER_MODEL (identity_manager_model_get_type ())
#define IDENTITY_MANAGER_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_MANAGER_MODEL, IdentityManagerModel))
#define IDENTITY_MANAGER_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_MANAGER_MODEL, IdentityManagerModelClass))
#define IS_IDENTITY_MANAGER_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_MANAGER_MODEL))
#define IS_IDENTITY_MANAGER_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_MANAGER_MODEL))
#define IDENTITY_MANAGER_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_MANAGER_MODEL, IdentityManagerModelClass))

typedef struct _IdentityManagerModel IdentityManagerModel;
typedef struct _IdentityManagerModelClass IdentityManagerModelClass;

#define TYPE_IDENTITY_MANAGER_VIEW (identity_manager_view_get_type ())
#define IDENTITY_MANAGER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerView))
#define IDENTITY_MANAGER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerViewClass))
#define IS_IDENTITY_MANAGER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_MANAGER_VIEW))
#define IS_IDENTITY_MANAGER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_MANAGER_VIEW))
#define IDENTITY_MANAGER_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerViewClass))

typedef struct _IdentityManagerView IdentityManagerView;
typedef struct _IdentityManagerViewClass IdentityManagerViewClass;

typedef void (*ReturnIdentityCallback) (IdentityRequest* request, void* user_data);
struct _IdentityRequest {
	GObject parent_instance;
	IdentityRequestPrivate * priv;
	IdCard* id_card;
	gboolean complete;
	gboolean select_default;
	gchar* nai;
	gchar* password;
	gchar* service;
	GSList* candidates;
};

struct _IdentityRequestClass {
	GObjectClass parent_class;
};

struct _IdentityRequestPrivate {
	IdentityManagerApp* parent_app;
	ReturnIdentityCallback callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
};

struct _IdentityManagerApp {
	GTypeInstance parent_instance;
	volatile int ref_count;
	IdentityManagerAppPrivate * priv;
	IdentityManagerModel* model;
	IdCard* default_id_card;
	gboolean explicitly_launched;
	IdentityManagerView* view;
};

struct _IdentityManagerAppClass {
	GTypeClass parent_class;
	void (*finalize) (IdentityManagerApp *self);
};


static gpointer identity_request_parent_class = NULL;
static MoonshotLogger* identity_request_logger;
static MoonshotLogger* identity_request_logger = NULL;

GType identity_request_get_type (void) G_GNUC_CONST;
GType id_card_get_type (void) G_GNUC_CONST;
gpointer identity_manager_app_ref (gpointer instance);
void identity_manager_app_unref (gpointer instance);
GParamSpec* param_spec_identity_manager_app (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_identity_manager_app (GValue* value, gpointer v_object);
void value_take_identity_manager_app (GValue* value, gpointer v_object);
gpointer value_get_identity_manager_app (const GValue* value);
GType identity_manager_app_get_type (void) G_GNUC_CONST;
#define IDENTITY_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_IDENTITY_REQUEST, IdentityRequestPrivate))
enum  {
	IDENTITY_REQUEST_DUMMY_PROPERTY
};
GType moonshot_logger_get_type (void) G_GNUC_CONST;
MoonshotLogger* get_logger (const gchar* name);
static void _g_object_unref0_ (gpointer var);
static void _g_slist_free__g_object_unref0_ (GSList* self);
IdentityRequest* identity_request_new (IdentityManagerApp* app, const gchar* nai, const gchar* password, const gchar* service);
IdentityRequest* identity_request_construct (GType object_type, IdentityManagerApp* app, const gchar* nai, const gchar* password, const gchar* service);
IdentityRequest* identity_request_new_default (IdentityManagerApp* app);
IdentityRequest* identity_request_construct_default (GType object_type, IdentityManagerApp* app);
void identity_request_set_callback (IdentityRequest* self, ReturnIdentityCallback cb, void* cb_target, GDestroyNotify cb_target_destroy_notify);
gboolean identity_request_execute (IdentityRequest* self);
void identity_manager_app_select_identity (IdentityManagerApp* self, IdentityRequest* request);
void identity_request_return_identity (IdentityRequest* self, IdCard* id_card, gboolean update_card);
GeeArrayList* id_card_get_services (IdCard* self);
void moonshot_logger_trace (MoonshotLogger* self, const gchar* message, GError* e);
GType identity_manager_model_get_type (void) G_GNUC_CONST;
GType identity_manager_view_get_type (void) G_GNUC_CONST;
IdCard* identity_manager_model_update_card (IdentityManagerModel* self, IdCard* card);
static void identity_request_finalize (GObject* obj);


static void _g_object_unref0_ (gpointer var) {
#line 45 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
#line 191 "moonshot-identity-request.c"
}


static void _g_slist_free__g_object_unref0_ (GSList* self) {
#line 45 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_slist_foreach (self, (GFunc) _g_object_unref0_, NULL);
#line 45 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_slist_free (self);
#line 200 "moonshot-identity-request.c"
}


static gpointer _identity_manager_app_ref0 (gpointer self) {
#line 54 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	return self ? identity_manager_app_ref (self) : NULL;
#line 207 "moonshot-identity-request.c"
}


IdentityRequest* identity_request_construct (GType object_type, IdentityManagerApp* app, const gchar* nai, const gchar* password, const gchar* service) {
	IdentityRequest * self = NULL;
	IdentityManagerApp* _tmp0_ = NULL;
	IdentityManagerApp* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	gchar* _tmp7_ = NULL;
#line 49 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_return_val_if_fail (app != NULL, NULL);
#line 49 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_return_val_if_fail (nai != NULL, NULL);
#line 49 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_return_val_if_fail (password != NULL, NULL);
#line 49 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_return_val_if_fail (service != NULL, NULL);
#line 49 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self = (IdentityRequest*) g_object_new (object_type, NULL);
#line 54 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp0_ = app;
#line 54 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp1_ = _identity_manager_app_ref0 (_tmp0_);
#line 54 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_identity_manager_app_unref0 (self->priv->parent_app);
#line 54 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->parent_app = _tmp1_;
#line 55 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp2_ = nai;
#line 55 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp3_ = g_strdup (_tmp2_);
#line 55 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_g_free0 (self->nai);
#line 55 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->nai = _tmp3_;
#line 56 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp4_ = password;
#line 56 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp5_ = g_strdup (_tmp4_);
#line 56 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_g_free0 (self->password);
#line 56 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->password = _tmp5_;
#line 57 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp6_ = service;
#line 57 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp7_ = g_strdup (_tmp6_);
#line 57 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_g_free0 (self->service);
#line 57 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->service = _tmp7_;
#line 49 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	return self;
#line 265 "moonshot-identity-request.c"
}


IdentityRequest* identity_request_new (IdentityManagerApp* app, const gchar* nai, const gchar* password, const gchar* service) {
#line 49 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	return identity_request_construct (TYPE_IDENTITY_REQUEST, app, nai, password, service);
#line 272 "moonshot-identity-request.c"
}


IdentityRequest* identity_request_construct_default (GType object_type, IdentityManagerApp* app) {
	IdentityRequest * self = NULL;
	IdentityManagerApp* _tmp0_ = NULL;
	IdentityManagerApp* _tmp1_ = NULL;
#line 60 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_return_val_if_fail (app != NULL, NULL);
#line 60 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self = (IdentityRequest*) g_object_new (object_type, NULL);
#line 62 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp0_ = app;
#line 62 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp1_ = _identity_manager_app_ref0 (_tmp0_);
#line 62 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_identity_manager_app_unref0 (self->priv->parent_app);
#line 62 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->parent_app = _tmp1_;
#line 63 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->select_default = TRUE;
#line 60 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	return self;
#line 296 "moonshot-identity-request.c"
}


IdentityRequest* identity_request_new_default (IdentityManagerApp* app) {
#line 60 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	return identity_request_construct_default (TYPE_IDENTITY_REQUEST, app);
#line 303 "moonshot-identity-request.c"
}


void identity_request_set_callback (IdentityRequest* self, ReturnIdentityCallback cb, void* cb_target, GDestroyNotify cb_target_destroy_notify) {
	ReturnIdentityCallback _tmp0_ = NULL;
	void* _tmp0__target = NULL;
	GDestroyNotify _tmp0__target_destroy_notify = NULL;
#line 66 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_return_if_fail (self != NULL);
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp0_ = cb;
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp0__target = cb_target;
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp0__target_destroy_notify = cb_target_destroy_notify;
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	cb = NULL;
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	cb_target = NULL;
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	cb_target_destroy_notify = NULL;
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	(self->priv->callback_target_destroy_notify == NULL) ? NULL : (self->priv->callback_target_destroy_notify (self->priv->callback_target), NULL);
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback = NULL;
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback_target = NULL;
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback_target_destroy_notify = NULL;
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback = _tmp0_;
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback_target = _tmp0__target;
#line 69 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback_target_destroy_notify = _tmp0__target_destroy_notify;
#line 66 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	(cb_target_destroy_notify == NULL) ? NULL : (cb_target_destroy_notify (cb_target), NULL);
#line 66 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	cb = NULL;
#line 66 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	cb_target = NULL;
#line 66 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	cb_target_destroy_notify = NULL;
#line 347 "moonshot-identity-request.c"
}


gboolean identity_request_execute (IdentityRequest* self) {
	gboolean result = FALSE;
	IdentityManagerApp* _tmp0_ = NULL;
#line 75 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 76 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp0_ = self->priv->parent_app;
#line 76 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	identity_manager_app_select_identity (_tmp0_, self);
#line 81 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	result = FALSE;
#line 81 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	return result;
#line 364 "moonshot-identity-request.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 85 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	return self ? g_object_ref (self) : NULL;
#line 371 "moonshot-identity-request.c"
}


static gchar* bool_to_string (gboolean self) {
	gchar* result = NULL;
#line 37 "/usr/share/vala-0.34/vapi/glib-2.0.vapi"
	if (self) {
#line 379 "moonshot-identity-request.c"
		gchar* _tmp0_ = NULL;
#line 38 "/usr/share/vala-0.34/vapi/glib-2.0.vapi"
		_tmp0_ = g_strdup ("true");
#line 38 "/usr/share/vala-0.34/vapi/glib-2.0.vapi"
		result = _tmp0_;
#line 38 "/usr/share/vala-0.34/vapi/glib-2.0.vapi"
		return result;
#line 387 "moonshot-identity-request.c"
	} else {
		gchar* _tmp1_ = NULL;
#line 40 "/usr/share/vala-0.34/vapi/glib-2.0.vapi"
		_tmp1_ = g_strdup ("false");
#line 40 "/usr/share/vala-0.34/vapi/glib-2.0.vapi"
		result = _tmp1_;
#line 40 "/usr/share/vala-0.34/vapi/glib-2.0.vapi"
		return result;
#line 396 "moonshot-identity-request.c"
	}
}


void identity_request_return_identity (IdentityRequest* self, IdCard* id_card, gboolean update_card) {
	IdCard* _tmp0_ = NULL;
	IdCard* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	ReturnIdentityCallback _tmp31_ = NULL;
	void* _tmp31__target = NULL;
	MoonshotLogger* _tmp32_ = NULL;
	ReturnIdentityCallback _tmp33_ = NULL;
	void* _tmp33__target = NULL;
#line 84 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_return_if_fail (self != NULL);
#line 85 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp0_ = id_card;
#line 85 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp1_ = _g_object_ref0 (_tmp0_);
#line 85 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_g_object_unref0 (self->id_card);
#line 85 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->id_card = _tmp1_;
#line 86 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->complete = TRUE;
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp5_ = update_card;
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	if (_tmp5_) {
#line 429 "moonshot-identity-request.c"
		IdCard* _tmp6_ = NULL;
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp6_ = id_card;
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp4_ = _tmp6_ != NULL;
#line 435 "moonshot-identity-request.c"
	} else {
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp4_ = FALSE;
#line 439 "moonshot-identity-request.c"
	}
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	if (_tmp4_) {
#line 443 "moonshot-identity-request.c"
		const gchar* _tmp7_ = NULL;
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp7_ = self->service;
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp3_ = _tmp7_ != NULL;
#line 449 "moonshot-identity-request.c"
	} else {
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp3_ = FALSE;
#line 453 "moonshot-identity-request.c"
	}
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	if (_tmp3_) {
#line 457 "moonshot-identity-request.c"
		const gchar* _tmp8_ = NULL;
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp8_ = self->service;
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp2_ = g_strcmp0 (_tmp8_, "") != 0;
#line 463 "moonshot-identity-request.c"
	} else {
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp2_ = FALSE;
#line 467 "moonshot-identity-request.c"
	}
#line 89 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	if (_tmp2_) {
#line 471 "moonshot-identity-request.c"
		gboolean duplicate_service = FALSE;
		IdCard* _tmp9_ = NULL;
		GeeArrayList* _tmp10_ = NULL;
		GeeArrayList* _tmp11_ = NULL;
		const gchar* _tmp12_ = NULL;
		gboolean _tmp13_ = FALSE;
		MoonshotLogger* _tmp14_ = NULL;
		gboolean _tmp15_ = FALSE;
		gchar* _tmp16_ = NULL;
		gchar* _tmp17_ = NULL;
		gchar* _tmp18_ = NULL;
		gchar* _tmp19_ = NULL;
		gboolean _tmp20_ = FALSE;
#line 91 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp9_ = id_card;
#line 91 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp10_ = id_card_get_services (_tmp9_);
#line 91 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp11_ = _tmp10_;
#line 91 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp12_ = self->service;
#line 91 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp13_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp11_, _tmp12_);
#line 91 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		duplicate_service = _tmp13_;
#line 92 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp14_ = identity_request_logger;
#line 92 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp15_ = duplicate_service;
#line 92 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp16_ = bool_to_string (_tmp15_);
#line 92 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp17_ = _tmp16_;
#line 92 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp18_ = g_strconcat ("return_identity: duplicate_service=", _tmp17_, NULL);
#line 92 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp19_ = _tmp18_;
#line 92 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		moonshot_logger_trace (_tmp14_, _tmp19_, NULL);
#line 92 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_g_free0 (_tmp19_);
#line 92 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_g_free0 (_tmp17_);
#line 93 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		_tmp20_ = duplicate_service;
#line 93 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
		if (_tmp20_ == FALSE) {
#line 519 "moonshot-identity-request.c"
			MoonshotLogger* _tmp21_ = NULL;
			IdCard* _tmp22_ = NULL;
			GeeArrayList* _tmp23_ = NULL;
			GeeArrayList* _tmp24_ = NULL;
			const gchar* _tmp25_ = NULL;
			MoonshotLogger* _tmp26_ = NULL;
			IdentityManagerApp* _tmp27_ = NULL;
			IdentityManagerModel* _tmp28_ = NULL;
			IdCard* _tmp29_ = NULL;
			IdCard* _tmp30_ = NULL;
#line 95 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			_tmp21_ = identity_request_logger;
#line 95 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			moonshot_logger_trace (_tmp21_, "return_identity: calling add_service", NULL);
#line 96 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			_tmp22_ = id_card;
#line 96 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			_tmp23_ = id_card_get_services (_tmp22_);
#line 96 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			_tmp24_ = _tmp23_;
#line 96 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			_tmp25_ = self->service;
#line 96 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp24_, _tmp25_);
#line 97 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			_tmp26_ = identity_request_logger;
#line 97 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			moonshot_logger_trace (_tmp26_, "return_identity: back from add_service", NULL);
#line 99 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			_tmp27_ = self->priv->parent_app;
#line 99 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			_tmp28_ = _tmp27_->model;
#line 99 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			_tmp29_ = id_card;
#line 99 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			_tmp30_ = identity_manager_model_update_card (_tmp28_, _tmp29_);
#line 99 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			_g_object_unref0 (self->id_card);
#line 99 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
			self->id_card = _tmp30_;
#line 560 "moonshot-identity-request.c"
		}
	}
#line 103 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp31_ = self->priv->callback;
#line 103 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp31__target = self->priv->callback_target;
#line 103 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_return_if_fail (_tmp31_ != NULL);
#line 104 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp32_ = identity_request_logger;
#line 104 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	moonshot_logger_trace (_tmp32_, "return_identity: invoking callback", NULL);
#line 105 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp33_ = self->priv->callback;
#line 105 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp33__target = self->priv->callback_target;
#line 105 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp33_ (self, _tmp33__target);
#line 579 "moonshot-identity-request.c"
}


static void identity_request_class_init (IdentityRequestClass * klass) {
	MoonshotLogger* _tmp0_ = NULL;
#line 34 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	identity_request_parent_class = g_type_class_peek_parent (klass);
#line 34 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	g_type_class_add_private (klass, sizeof (IdentityRequestPrivate));
#line 34 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	G_OBJECT_CLASS (klass)->finalize = identity_request_finalize;
#line 35 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_tmp0_ = get_logger ("IdentityRequest");
#line 35 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	identity_request_logger = _tmp0_;
#line 595 "moonshot-identity-request.c"
}


static void identity_request_instance_init (IdentityRequest * self) {
#line 34 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv = IDENTITY_REQUEST_GET_PRIVATE (self);
#line 37 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->id_card = NULL;
#line 38 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->complete = FALSE;
#line 39 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->select_default = FALSE;
#line 47 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback = NULL;
#line 47 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback_target = self;
#line 47 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback_target_destroy_notify = NULL;
#line 614 "moonshot-identity-request.c"
}


static void identity_request_finalize (GObject* obj) {
	IdentityRequest * self;
#line 34 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_IDENTITY_REQUEST, IdentityRequest);
#line 37 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_g_object_unref0 (self->id_card);
#line 41 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_identity_manager_app_unref0 (self->priv->parent_app);
#line 42 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_g_free0 (self->nai);
#line 43 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_g_free0 (self->password);
#line 44 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	_g_free0 (self->service);
#line 45 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	__g_slist_free__g_object_unref0_0 (self->candidates);
#line 47 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	(self->priv->callback_target_destroy_notify == NULL) ? NULL : (self->priv->callback_target_destroy_notify (self->priv->callback_target), NULL);
#line 47 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback = NULL;
#line 47 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback_target = NULL;
#line 47 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	self->priv->callback_target_destroy_notify = NULL;
#line 34 "/home/hartmans/moonshot/moonshot/ui/src/moonshot-identity-request.vala"
	G_OBJECT_CLASS (identity_request_parent_class)->finalize (obj);
#line 644 "moonshot-identity-request.c"
}


GType identity_request_get_type (void) {
	static volatile gsize identity_request_type_id__volatile = 0;
	if (g_once_init_enter (&identity_request_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (IdentityRequestClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) identity_request_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IdentityRequest), 0, (GInstanceInitFunc) identity_request_instance_init, NULL };
		GType identity_request_type_id;
		identity_request_type_id = g_type_register_static (G_TYPE_OBJECT, "IdentityRequest", &g_define_type_info, 0);
		g_once_init_leave (&identity_request_type_id__volatile, identity_request_type_id);
	}
	return identity_request_type_id__volatile;
}



