/* helper-create-many-contacts.c generated by valac 0.29.3.10-b87a, the Vala compiler
 * generated from helper-create-many-contacts.vala, do not modify */

/*
 * Copyright © 2013 Intel Corporation
 *
 * This library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *    Simon McVittie <simon.mcvittie@collabora.co.uk>
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <libedataserver/libedataserver.h>
#include <libebook/libebook.h>
#include <libebook-contacts/libebook-contacts.h>
#include <glib/gstdio.h>
#include <locale.h>
#include <stdio.h>
#include <gobject/gvaluecollector.h>


#define TYPE_MAIN (main_get_type ())
#define MAIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN, Main))
#define MAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN, MainClass))
#define IS_MAIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN))
#define IS_MAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN))
#define MAIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN, MainClass))

typedef struct _Main Main;
typedef struct _MainClass MainClass;
typedef struct _MainPrivate MainPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define __g_slist_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__g_object_unref0_ (var), NULL)))
#define __g_slist_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__g_free0_ (var), NULL)))
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))
typedef struct _ParamSpecMain ParamSpecMain;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _Main {
	GTypeInstance parent_instance;
	volatile int ref_count;
	MainPrivate * priv;
};

struct _MainClass {
	GTypeClass parent_class;
	void (*finalize) (Main *self);
};

struct _ParamSpecMain {
	GParamSpec parent_instance;
};


static gpointer main_parent_class = NULL;
static gint main__n_contacts;
static gint main__n_contacts = 2000;
static gchar* main__uid;
static gchar* main__uid = NULL;

gpointer main_ref (gpointer instance);
void main_unref (gpointer instance);
GParamSpec* param_spec_main (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_main (GValue* value, gpointer v_object);
void value_take_main (GValue* value, gpointer v_object);
gpointer value_get_main (const GValue* value);
GType main_get_type (void) G_GNUC_CONST;
enum  {
	MAIN_DUMMY_PROPERTY
};
static void _main_add_many (guint n_contacts, const gchar* uid, GError** error);
static void _g_object_unref0_ (gpointer var);
static void _g_slist_free__g_object_unref0_ (GSList* self);
static void _g_free0_ (gpointer var);
static void _g_slist_free__g_free0_ (GSList* self);
gint main_main (gchar** args, int args_length1);
Main* main_new (void);
Main* main_construct (GType object_type);
static void main_finalize (Main* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);

static const GOptionEntry MAIN__options[3] = {{"n-contacts", 'n', 0, G_OPTION_ARG_INT, &main__n_contacts, "Number of contacts", "CONTACTS"}, {"uid", 'u', 0, G_OPTION_ARG_STRING, &main__uid, "Address book uid", "UID"}, {NULL}};

static void _g_object_unref0_ (gpointer var) {
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
#line 111 "helper-create-many-contacts.c"
}


static void _g_slist_free__g_object_unref0_ (GSList* self) {
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_slist_foreach (self, (GFunc) _g_object_unref0_, NULL);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_slist_free (self);
#line 120 "helper-create-many-contacts.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 88 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	return self ? g_object_ref (self) : NULL;
#line 127 "helper-create-many-contacts.c"
}


static void _g_free0_ (gpointer var) {
#line 110 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	var = (g_free (var), NULL);
#line 134 "helper-create-many-contacts.c"
}


static void _g_slist_free__g_free0_ (GSList* self) {
#line 110 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_slist_foreach (self, (GFunc) _g_free0_, NULL);
#line 110 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_slist_free (self);
#line 143 "helper-create-many-contacts.c"
}


static void _main_add_many (guint n_contacts, const gchar* uid, GError** error) {
	ESourceRegistry* registry = NULL;
	ESourceRegistry* _tmp0_ = NULL;
	ESource* source = NULL;
	ESourceRegistry* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	ESource* _tmp3_ = NULL;
	ESource* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	const gchar* _tmp7_ = NULL;
	EBookClient* book_client = NULL;
	ESource* _tmp8_ = NULL;
	EBookClient* _tmp9_ = NULL;
	GSList* contacts = NULL;
	gchar* envvar = NULL;
	const gchar* _tmp10_ = NULL;
	gchar* _tmp11_ = NULL;
	guint n = 0U;
	const gchar* _tmp12_ = NULL;
	guint _tmp51_ = 0U;
	GSList* uids = NULL;
	GSList* _tmp56_ = NULL;
	guint _tmp57_ = 0U;
	GError * _inner_error_ = NULL;
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_return_if_fail (uid != NULL);
#line 46 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp0_ = e_source_registry_new_sync (NULL, &_inner_error_);
#line 46 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	registry = _tmp0_;
#line 46 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 46 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_propagate_error (error, _inner_error_);
#line 46 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		return;
#line 184 "helper-create-many-contacts.c"
	}
#line 47 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp1_ = registry;
#line 47 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp2_ = uid;
#line 47 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp3_ = e_source_registry_ref_source (_tmp1_, _tmp2_);
#line 47 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	source = _tmp3_;
#line 48 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp4_ = source;
#line 48 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp5_ = e_source_get_uid (_tmp4_);
#line 48 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp6_ = _tmp5_;
#line 48 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp7_ = uid;
#line 48 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_vala_assert (g_strcmp0 (_tmp6_, _tmp7_) == 0, "source.uid == uid");
#line 49 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp8_ = source;
#line 49 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp9_ = e_book_client_connect_sync (_tmp8_, (guint32) 1, NULL, &_inner_error_);
#line 49 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	book_client = _tmp9_;
#line 49 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 49 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_propagate_error (error, _inner_error_);
#line 49 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_object_unref0 (source);
#line 49 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_object_unref0 (registry);
#line 49 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		return;
#line 220 "helper-create-many-contacts.c"
	}
#line 50 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	contacts = NULL;
#line 52 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp10_ = g_getenv ("FOLKS_TESTS_REAL_VCARDS");
#line 52 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp11_ = g_strdup (_tmp10_);
#line 52 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	envvar = _tmp11_;
#line 54 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	n = (guint) 0;
#line 56 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp12_ = envvar;
#line 56 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (_tmp12_ != NULL) {
#line 236 "helper-create-many-contacts.c"
		gchar** cards = NULL;
		gint cards_length1 = 0;
		gint _cards_size_ = 0;
		gchar** _tmp23_ = NULL;
		gint _tmp23__length1 = 0;
		{
			gchar* text = NULL;
			const gchar* _tmp13_ = NULL;
			gchar* _tmp14_ = NULL;
			GRegex* regex = NULL;
			GRegex* _tmp15_ = NULL;
			gchar** _tmp16_ = NULL;
			GRegex* _tmp17_ = NULL;
			const gchar* _tmp18_ = NULL;
			gchar** _tmp19_ = NULL;
			gchar** _tmp20_ = NULL;
			gint _tmp16__length1 = 0;
			gint __tmp16__size_ = 0;
			gchar** _tmp21_ = NULL;
			gint _tmp21__length1 = 0;
#line 65 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp13_ = envvar;
#line 65 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			g_file_get_contents ((const gchar*) _tmp13_, &_tmp14_, NULL, &_inner_error_);
#line 65 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_g_free0 (text);
#line 65 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			text = _tmp14_;
#line 65 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 65 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
				_g_free0 (text);
#line 269 "helper-create-many-contacts.c"
				goto __catch0_g_error;
			}
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp15_ = g_regex_new ("(?<=\r\nEND:VCARD)\r\n+(?=BEGIN:VCARD\r\n)", (G_REGEX_OPTIMIZE | G_REGEX_CASELESS) | G_REGEX_NEWLINE_LF, 0, &_inner_error_);
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			regex = _tmp15_;
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
				_g_free0 (text);
#line 280 "helper-create-many-contacts.c"
				goto __catch0_g_error;
			}
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp17_ = regex;
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp18_ = text;
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp20_ = _tmp19_ = g_regex_split_full (_tmp17_, _tmp18_, (gssize) -1, 0, 0, 0, &_inner_error_);
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp16_ = _tmp20_;
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp16__length1 = _vala_array_length (_tmp19_);
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			__tmp16__size_ = _tmp16__length1;
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
				_g_regex_unref0 (regex);
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
				_g_free0 (text);
#line 301 "helper-create-many-contacts.c"
				goto __catch0_g_error;
			}
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp21_ = _tmp16_;
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp21__length1 = _tmp16__length1;
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp16_ = NULL;
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp16__length1 = 0;
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			cards = (_vala_array_free (cards, cards_length1, (GDestroyNotify) g_free), NULL);
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			cards = _tmp21_;
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			cards_length1 = _tmp21__length1;
#line 70 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_cards_size_ = cards_length1;
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp16_ = (_vala_array_free (_tmp16_, _tmp16__length1, (GDestroyNotify) g_free), NULL);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_g_regex_unref0 (regex);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_g_free0 (text);
#line 326 "helper-create-many-contacts.c"
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			const gchar* _tmp22_ = NULL;
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			e = _inner_error_;
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_inner_error_ = NULL;
#line 74 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_tmp22_ = e->message;
#line 74 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			g_error ("helper-create-many-contacts.vala:74: %s", _tmp22_);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_g_error_free0 (e);
#line 343 "helper-create-many-contacts.c"
		}
		__finally0:
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			g_propagate_error (error, _inner_error_);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			cards = (_vala_array_free (cards, cards_length1, (GDestroyNotify) g_free), NULL);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_g_free0 (envvar);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			__g_slist_free__g_object_unref0_0 (contacts);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_g_object_unref0 (book_client);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_g_object_unref0 (source);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_g_object_unref0 (registry);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			return;
#line 364 "helper-create-many-contacts.c"
		}
#line 77 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp23_ = cards;
#line 77 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp23__length1 = cards_length1;
#line 370 "helper-create-many-contacts.c"
		{
			gchar** card_collection = NULL;
			gint card_collection_length1 = 0;
			gint _card_collection_size_ = 0;
			gint card_it = 0;
#line 77 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			card_collection = _tmp23_;
#line 77 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			card_collection_length1 = _tmp23__length1;
#line 77 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			for (card_it = 0; card_it < _tmp23__length1; card_it = card_it + 1) {
#line 382 "helper-create-many-contacts.c"
				gchar* _tmp24_ = NULL;
				gchar* card = NULL;
#line 77 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
				_tmp24_ = g_strdup (card_collection[card_it]);
#line 77 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
				card = _tmp24_;
#line 389 "helper-create-many-contacts.c"
				{
					guint _tmp25_ = 0U;
					guint _tmp26_ = 0U;
					EContact* contact = NULL;
					const gchar* _tmp27_ = NULL;
					EContact* _tmp28_ = NULL;
					EContact* _tmp29_ = NULL;
					EContact* _tmp30_ = NULL;
					EContact* _tmp31_ = NULL;
					guint _tmp32_ = 0U;
#line 79 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					_tmp25_ = n;
#line 79 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					_tmp26_ = n_contacts;
#line 79 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					if (_tmp25_ >= _tmp26_) {
#line 80 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
						_g_free0 (card);
#line 80 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
						break;
#line 410 "helper-create-many-contacts.c"
					}
#line 82 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					_tmp27_ = card;
#line 82 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					_tmp28_ = e_contact_new_from_vcard (_tmp27_);
#line 82 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					contact = _tmp28_;
#line 86 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					_tmp29_ = contact;
#line 86 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					g_object_set (_tmp29_, "id", NULL, NULL);
#line 88 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					_tmp30_ = contact;
#line 88 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					_tmp31_ = _g_object_ref0 (_tmp30_);
#line 88 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					contacts = g_slist_prepend (contacts, _tmp31_);
#line 89 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					_tmp32_ = n;
#line 89 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					n = _tmp32_ + 1;
#line 77 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					_g_object_unref0 (contact);
#line 77 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
					_g_free0 (card);
#line 436 "helper-create-many-contacts.c"
				}
			}
		}
#line 56 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		cards = (_vala_array_free (cards, cards_length1, (GDestroyNotify) g_free), NULL);
#line 442 "helper-create-many-contacts.c"
	}
#line 93 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	while (TRUE) {
#line 446 "helper-create-many-contacts.c"
		guint _tmp33_ = 0U;
		guint _tmp34_ = 0U;
		EContact* contact = NULL;
		EContact* _tmp35_ = NULL;
		EContact* _tmp36_ = NULL;
		guint _tmp37_ = 0U;
		gchar* _tmp38_ = NULL;
		gchar* _tmp39_ = NULL;
		EContact* _tmp40_ = NULL;
		guint _tmp41_ = 0U;
		gchar* _tmp42_ = NULL;
		gchar* _tmp43_ = NULL;
		EContact* _tmp44_ = NULL;
		guint _tmp45_ = 0U;
		gchar* _tmp46_ = NULL;
		gchar* _tmp47_ = NULL;
		EContact* _tmp48_ = NULL;
		EContact* _tmp49_ = NULL;
		guint _tmp50_ = 0U;
#line 93 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp33_ = n;
#line 93 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp34_ = n_contacts;
#line 93 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		if (!(_tmp33_ < _tmp34_)) {
#line 93 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			break;
#line 474 "helper-create-many-contacts.c"
		}
#line 95 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp35_ = e_contact_new ();
#line 95 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		contact = _tmp35_;
#line 97 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp36_ = contact;
#line 97 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp37_ = n;
#line 97 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp38_ = g_strdup_printf ("Contact %u", _tmp37_);
#line 97 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp39_ = _tmp38_;
#line 97 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_object_set (_tmp36_, "full-name", _tmp39_, NULL);
#line 97 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_free0 (_tmp39_);
#line 98 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp40_ = contact;
#line 98 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp41_ = n;
#line 98 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp42_ = g_strdup_printf ("contact%u@example.com", _tmp41_);
#line 98 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp43_ = _tmp42_;
#line 98 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_object_set (_tmp40_, "email-1", _tmp43_, NULL);
#line 98 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_free0 (_tmp43_);
#line 99 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp44_ = contact;
#line 99 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp45_ = n;
#line 99 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp46_ = g_strdup_printf ("%u", _tmp45_);
#line 99 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp47_ = _tmp46_;
#line 99 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_object_set (_tmp44_, "im-icq-home-1", _tmp47_, NULL);
#line 99 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_free0 (_tmp47_);
#line 101 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp48_ = contact;
#line 101 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp49_ = _g_object_ref0 (_tmp48_);
#line 101 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		contacts = g_slist_prepend (contacts, _tmp49_);
#line 102 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp50_ = n;
#line 102 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		n = _tmp50_ + 1;
#line 93 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_object_unref0 (contact);
#line 528 "helper-create-many-contacts.c"
	}
#line 105 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp51_ = n;
#line 105 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_debug ("helper-create-many-contacts.vala:105: Importing %u contacts", _tmp51_);
#line 534 "helper-create-many-contacts.c"
	{
		EBookClient* _tmp52_ = NULL;
		GSList* _tmp53_ = NULL;
		GSList* _tmp54_ = NULL;
#line 110 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp52_ = book_client;
#line 110 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp53_ = contacts;
#line 110 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		e_book_client_add_contacts_sync (_tmp52_, _tmp53_, &_tmp54_, NULL, &_inner_error_);
#line 110 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		__g_slist_free__g_free0_0 (uids);
#line 110 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		uids = _tmp54_;
#line 110 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 551 "helper-create-many-contacts.c"
			goto __catch1_g_error;
		}
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp55_ = NULL;
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		e = _inner_error_;
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_inner_error_ = NULL;
#line 114 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp55_ = e->message;
#line 114 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_error ("helper-create-many-contacts.vala:114: %s", _tmp55_);
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_error_free0 (e);
#line 570 "helper-create-many-contacts.c"
	}
	__finally1:
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_propagate_error (error, _inner_error_);
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		__g_slist_free__g_free0_0 (uids);
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_free0 (envvar);
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		__g_slist_free__g_object_unref0_0 (contacts);
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_object_unref0 (book_client);
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_object_unref0 (source);
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_object_unref0 (registry);
#line 108 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		return;
#line 591 "helper-create-many-contacts.c"
	}
#line 117 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp56_ = uids;
#line 117 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp57_ = g_slist_length (_tmp56_);
#line 117 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_debug ("helper-create-many-contacts.vala:117: Imported %u contacts", _tmp57_);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	__g_slist_free__g_free0_0 (uids);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_g_free0 (envvar);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	__g_slist_free__g_object_unref0_0 (contacts);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_g_object_unref0 (book_client);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_g_object_unref0 (source);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_g_object_unref0 (registry);
#line 611 "helper-create-many-contacts.c"
}


gint main_main (gchar** args, int args_length1) {
	gint result = 0;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp8_ = NULL;
	GError * _inner_error_ = NULL;
#line 132 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	setlocale (LC_ALL, "");
#line 134 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp0_ = g_getenv ("FOLKS_TESTS_SANDBOXED_DBUS");
#line 134 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (g_strcmp0 (_tmp0_, "no-services") != 0) {
#line 135 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_error ("helper-create-many-contacts.vala:135: %s", "e-d-s helpers must be run in a private D-Bus session with " "e-d-s services");
#line 628 "helper-create-many-contacts.c"
	}
	{
		GOptionContext* context = NULL;
		GOptionContext* _tmp1_ = NULL;
		GOptionContext* _tmp2_ = NULL;
		GOptionContext* _tmp3_ = NULL;
		GOptionContext* _tmp4_ = NULL;
#line 140 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp1_ = g_option_context_new ("- Create many e-d-s contacts");
#line 140 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		context = _tmp1_;
#line 141 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp2_ = context;
#line 141 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_option_context_set_help_enabled (_tmp2_, TRUE);
#line 142 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp3_ = context;
#line 142 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_option_context_add_main_entries (_tmp3_, MAIN__options, NULL);
#line 143 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp4_ = context;
#line 143 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_option_context_parse (_tmp4_, &args_length1, &args, &_inner_error_);
#line 143 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 143 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_g_option_context_free0 (context);
#line 143 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			if (_inner_error_->domain == G_OPTION_ERROR) {
#line 658 "helper-create-many-contacts.c"
				goto __catch2_g_option_error;
			}
#line 143 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			_g_option_context_free0 (context);
#line 143 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 143 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			g_clear_error (&_inner_error_);
#line 143 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			return 0;
#line 669 "helper-create-many-contacts.c"
		}
#line 138 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_option_context_free0 (context);
#line 673 "helper-create-many-contacts.c"
	}
	goto __finally2;
	__catch2_g_option_error:
	{
		GError* e = NULL;
		FILE* _tmp5_ = NULL;
		GError* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
#line 138 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		e = _inner_error_;
#line 138 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_inner_error_ = NULL;
#line 147 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp5_ = stderr;
#line 147 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp6_ = e;
#line 147 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp7_ = _tmp6_->message;
#line 147 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		fprintf (_tmp5_, "Error parsing arguments: %s\n", _tmp7_);
#line 148 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		result = 2;
#line 148 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_error_free0 (e);
#line 148 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		return result;
#line 700 "helper-create-many-contacts.c"
	}
	__finally2:
#line 138 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 138 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 138 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_clear_error (&_inner_error_);
#line 138 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		return 0;
#line 711 "helper-create-many-contacts.c"
	}
#line 151 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp8_ = main__uid;
#line 151 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (g_strcmp0 (_tmp8_, "") == 0) {
#line 717 "helper-create-many-contacts.c"
		FILE* _tmp9_ = NULL;
#line 153 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp9_ = stderr;
#line 153 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		fprintf (_tmp9_, "The --uid=UID option is required\n");
#line 154 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		result = 2;
#line 154 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		return result;
#line 727 "helper-create-many-contacts.c"
	}
	{
		gint _tmp10_ = 0;
		const gchar* _tmp11_ = NULL;
#line 159 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp10_ = main__n_contacts;
#line 159 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp11_ = main__uid;
#line 159 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_main_add_many ((guint) _tmp10_, _tmp11_, &_inner_error_);
#line 159 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 740 "helper-create-many-contacts.c"
			goto __catch3_g_error;
		}
	}
	goto __finally3;
	__catch3_g_error:
	{
		GError* e = NULL;
		FILE* _tmp12_ = NULL;
		GError* _tmp13_ = NULL;
		const gchar* _tmp14_ = NULL;
#line 157 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		e = _inner_error_;
#line 157 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_inner_error_ = NULL;
#line 163 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp12_ = stderr;
#line 163 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp13_ = e;
#line 163 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_tmp14_ = _tmp13_->message;
#line 163 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		fprintf (_tmp12_, "Error: %s\n", _tmp14_);
#line 164 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		result = 1;
#line 164 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		_g_error_free0 (e);
#line 164 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		return result;
#line 769 "helper-create-many-contacts.c"
	}
	__finally3:
#line 157 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 157 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 157 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_clear_error (&_inner_error_);
#line 157 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		return 0;
#line 780 "helper-create-many-contacts.c"
	}
#line 167 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	result = 0;
#line 167 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	return result;
#line 786 "helper-create-many-contacts.c"
}


int main (int argc, char ** argv) {
#if !GLIB_CHECK_VERSION (2,35,0)
	g_type_init ();
#endif
#line 130 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	return main_main (argv, argc);
#line 796 "helper-create-many-contacts.c"
}


Main* main_construct (GType object_type) {
	Main* self = NULL;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	self = (Main*) g_type_create_instance (object_type);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	return self;
#line 806 "helper-create-many-contacts.c"
}


Main* main_new (void) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	return main_construct (TYPE_MAIN);
#line 813 "helper-create-many-contacts.c"
}


static void value_main_init (GValue* value) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	value->data[0].v_pointer = NULL;
#line 820 "helper-create-many-contacts.c"
}


static void value_main_free_value (GValue* value) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (value->data[0].v_pointer) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		main_unref (value->data[0].v_pointer);
#line 829 "helper-create-many-contacts.c"
	}
}


static void value_main_copy_value (const GValue* src_value, GValue* dest_value) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (src_value->data[0].v_pointer) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		dest_value->data[0].v_pointer = main_ref (src_value->data[0].v_pointer);
#line 839 "helper-create-many-contacts.c"
	} else {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		dest_value->data[0].v_pointer = NULL;
#line 843 "helper-create-many-contacts.c"
	}
}


static gpointer value_main_peek_pointer (const GValue* value) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	return value->data[0].v_pointer;
#line 851 "helper-create-many-contacts.c"
}


static gchar* value_main_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (collect_values[0].v_pointer) {
#line 858 "helper-create-many-contacts.c"
		Main* object;
		object = collect_values[0].v_pointer;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		if (object->parent_instance.g_class == NULL) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 865 "helper-create-many-contacts.c"
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 869 "helper-create-many-contacts.c"
		}
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		value->data[0].v_pointer = main_ref (object);
#line 873 "helper-create-many-contacts.c"
	} else {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		value->data[0].v_pointer = NULL;
#line 877 "helper-create-many-contacts.c"
	}
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	return NULL;
#line 881 "helper-create-many-contacts.c"
}


static gchar* value_main_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	Main** object_p;
	object_p = collect_values[0].v_pointer;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (!object_p) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
#line 892 "helper-create-many-contacts.c"
	}
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (!value->data[0].v_pointer) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		*object_p = NULL;
#line 898 "helper-create-many-contacts.c"
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		*object_p = value->data[0].v_pointer;
#line 902 "helper-create-many-contacts.c"
	} else {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		*object_p = main_ref (value->data[0].v_pointer);
#line 906 "helper-create-many-contacts.c"
	}
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	return NULL;
#line 910 "helper-create-many-contacts.c"
}


GParamSpec* param_spec_main (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ParamSpecMain* spec;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_MAIN), NULL);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	G_PARAM_SPEC (spec)->value_type = object_type;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	return G_PARAM_SPEC (spec);
#line 924 "helper-create-many-contacts.c"
}


gpointer value_get_main (const GValue* value) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN), NULL);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	return value->data[0].v_pointer;
#line 933 "helper-create-many-contacts.c"
}


void value_set_main (GValue* value, gpointer v_object) {
	Main* old;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN));
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	old = value->data[0].v_pointer;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (v_object) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN));
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		value->data[0].v_pointer = v_object;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		main_ref (value->data[0].v_pointer);
#line 953 "helper-create-many-contacts.c"
	} else {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		value->data[0].v_pointer = NULL;
#line 957 "helper-create-many-contacts.c"
	}
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (old) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		main_unref (old);
#line 963 "helper-create-many-contacts.c"
	}
}


void value_take_main (GValue* value, gpointer v_object) {
	Main* old;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN));
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	old = value->data[0].v_pointer;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (v_object) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN));
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		value->data[0].v_pointer = v_object;
#line 982 "helper-create-many-contacts.c"
	} else {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		value->data[0].v_pointer = NULL;
#line 986 "helper-create-many-contacts.c"
	}
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (old) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		main_unref (old);
#line 992 "helper-create-many-contacts.c"
	}
}


static void main_class_init (MainClass * klass) {
	gchar* _tmp0_ = NULL;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	main_parent_class = g_type_class_peek_parent (klass);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	((MainClass *) klass)->finalize = main_finalize;
#line 121 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	_tmp0_ = g_strdup ("");
#line 121 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	main__uid = _tmp0_;
#line 1007 "helper-create-many-contacts.c"
}


static void main_instance_init (Main * self) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	self->ref_count = 1;
#line 1014 "helper-create-many-contacts.c"
}


static void main_finalize (Main* obj) {
	Main * self;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN, Main);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_signal_handlers_destroy (self);
#line 1024 "helper-create-many-contacts.c"
}


/**
 * helper-create-many-contacts --uid=UID [--n-contacts=N]
 *
 * Add N contacts (default 2000) to the Evolution Data Server address book
 * with the given UID.
 *
 * This utility must be called in a Folks test environment, with
 * DBUS_SESSION_BUS_ADDRESS pointing to a temporary D-Bus session and
 * XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_CACHE_HOME pointing into a temporary
 * directory.
 *
 * By default, we use N numbered contacts with some easy test data (currently
 * full name, one email address and one ICQ number).
 *
 * If the environment variable $FOLKS_TESTS_REAL_VCARDS is set, it is a file
 * containing multiple vCards in text format. Put a source of test data there
 * (e.g. a copy of your personal address book). The first contacts in that
 * file will be used as the first contacts in the address book: if there
 * are more than N only the first N will be used, and if there are fewer than
 * N, the difference will be made up with numbered contacts.
 */
GType main_get_type (void) {
	static volatile gsize main_type_id__volatile = 0;
	if (g_once_init_enter (&main_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_main_init, value_main_free_value, value_main_copy_value, value_main_peek_pointer, "p", value_main_collect_value, "p", value_main_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (MainClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) main_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Main), 0, (GInstanceInitFunc) main_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType main_type_id;
		main_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Main", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&main_type_id__volatile, main_type_id);
	}
	return main_type_id__volatile;
}


gpointer main_ref (gpointer instance) {
	Main* self;
	self = instance;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	g_atomic_int_inc (&self->ref_count);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	return instance;
#line 1070 "helper-create-many-contacts.c"
}


void main_unref (gpointer instance) {
	Main* self;
	self = instance;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		MAIN_GET_CLASS (self)->finalize (self);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-create-many-contacts.vala"
		g_type_free_instance ((GTypeInstance *) self);
#line 1083 "helper-create-many-contacts.c"
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int 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, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



