/* helper-delete-contacts.c generated by valac 0.28.0.16-b1323, the Vala compiler
 * generated from helper-delete-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 <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_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)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_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 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_remove_all (const gchar* uid, GError** error);
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 const GOptionEntry MAIN__options[2] = {{"uid", 'u', 0, G_OPTION_ARG_STRING, &main__uid, "Address book uid", "UID"}, {NULL}};

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


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


static void _main_remove_all (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* uids = NULL;
	EBookClient* _tmp10_ = NULL;
	GSList* _tmp11_ = NULL;
	EBookClient* _tmp12_ = NULL;
	GSList* _tmp13_ = NULL;
	GError * _inner_error_ = NULL;
#line 34 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	g_return_if_fail (uid != NULL);
#line 36 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp0_ = e_source_registry_new_sync (NULL, &_inner_error_);
#line 36 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	registry = _tmp0_;
#line 36 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 36 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		g_propagate_error (error, _inner_error_);
#line 36 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		return;
#line 144 "helper-delete-contacts.c"
	}
#line 37 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp1_ = registry;
#line 37 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp2_ = uid;
#line 37 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp3_ = e_source_registry_ref_source (_tmp1_, _tmp2_);
#line 37 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	source = _tmp3_;
#line 38 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp4_ = source;
#line 38 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp5_ = e_source_get_uid (_tmp4_);
#line 38 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp6_ = _tmp5_;
#line 38 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp7_ = uid;
#line 38 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_vala_assert (g_strcmp0 (_tmp6_, _tmp7_) == 0, "source.uid == uid");
#line 39 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp8_ = source;
#line 39 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp9_ = e_book_client_connect_sync (_tmp8_, (guint32) 1, NULL, &_inner_error_);
#line 39 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	book_client = _tmp9_;
#line 39 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 39 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		g_propagate_error (error, _inner_error_);
#line 39 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_g_object_unref0 (source);
#line 39 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_g_object_unref0 (registry);
#line 39 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		return;
#line 180 "helper-delete-contacts.c"
	}
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp10_ = book_client;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	e_book_client_get_contacts_uids_sync (_tmp10_, "(contains \"x-evolution-any-field\" \"\")", &_tmp11_, NULL, &_inner_error_);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	__g_slist_free__g_free0_0 (uids);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	uids = _tmp11_;
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		g_propagate_error (error, _inner_error_);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		__g_slist_free__g_free0_0 (uids);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_g_object_unref0 (book_client);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_g_object_unref0 (source);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_g_object_unref0 (registry);
#line 42 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		return;
#line 204 "helper-delete-contacts.c"
	}
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp12_ = book_client;
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp13_ = uids;
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	e_book_client_remove_contacts_sync (_tmp12_, _tmp13_, NULL, &_inner_error_);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		g_propagate_error (error, _inner_error_);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		__g_slist_free__g_free0_0 (uids);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_g_object_unref0 (book_client);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_g_object_unref0 (source);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_g_object_unref0 (registry);
#line 44 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		return;
#line 226 "helper-delete-contacts.c"
	}
#line 34 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	__g_slist_free__g_free0_0 (uids);
#line 34 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_g_object_unref0 (book_client);
#line 34 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_g_object_unref0 (source);
#line 34 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_g_object_unref0 (registry);
#line 236 "helper-delete-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 56 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	setlocale (LC_ALL, "");
#line 58 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp0_ = g_getenv ("FOLKS_TESTS_SANDBOXED_DBUS");
#line 58 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	if (g_strcmp0 (_tmp0_, "no-services") != 0) {
#line 59 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		g_error ("helper-delete-contacts.vala:59: %s", "e-d-s helpers must be run in a private D-Bus session with " "e-d-s services");
#line 253 "helper-delete-contacts.c"
	}
	{
		GOptionContext* context = NULL;
		GOptionContext* _tmp1_ = NULL;
		GOptionContext* _tmp2_ = NULL;
		GOptionContext* _tmp3_ = NULL;
		GOptionContext* _tmp4_ = NULL;
#line 64 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp1_ = g_option_context_new ("- Delete all e-d-s contacts");
#line 64 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		context = _tmp1_;
#line 65 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp2_ = context;
#line 65 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		g_option_context_set_help_enabled (_tmp2_, TRUE);
#line 66 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp3_ = context;
#line 66 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		g_option_context_add_main_entries (_tmp3_, MAIN__options, NULL);
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp4_ = context;
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		g_option_context_parse (_tmp4_, &args_length1, &args, &_inner_error_);
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
			_g_option_context_free0 (context);
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
			if (_inner_error_->domain == G_OPTION_ERROR) {
#line 283 "helper-delete-contacts.c"
				goto __catch0_g_option_error;
			}
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
			_g_option_context_free0 (context);
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-delete-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 67 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
			g_clear_error (&_inner_error_);
#line 67 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
			return 0;
#line 294 "helper-delete-contacts.c"
		}
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_g_option_context_free0 (context);
#line 298 "helper-delete-contacts.c"
	}
	goto __finally0;
	__catch0_g_option_error:
	{
		GError* e = NULL;
		FILE* _tmp5_ = NULL;
		GError* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		e = _inner_error_;
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_inner_error_ = NULL;
#line 71 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp5_ = stderr;
#line 71 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp6_ = e;
#line 71 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp7_ = _tmp6_->message;
#line 71 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		fprintf (_tmp5_, "Error parsing arguments: %s\n", _tmp7_);
#line 72 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		result = 2;
#line 72 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_g_error_free0 (e);
#line 72 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		return result;
#line 325 "helper-delete-contacts.c"
	}
	__finally0:
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-delete-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 62 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		g_clear_error (&_inner_error_);
#line 62 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		return 0;
#line 336 "helper-delete-contacts.c"
	}
#line 75 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	_tmp8_ = main__uid;
#line 75 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	if (g_strcmp0 (_tmp8_, "") == 0) {
#line 342 "helper-delete-contacts.c"
		FILE* _tmp9_ = NULL;
#line 77 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp9_ = stderr;
#line 77 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		fprintf (_tmp9_, "The --uid=UID option is required\n");
#line 78 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		result = 2;
#line 78 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		return result;
#line 352 "helper-delete-contacts.c"
	}
	{
		const gchar* _tmp10_ = NULL;
#line 83 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp10_ = main__uid;
#line 83 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_main_remove_all (_tmp10_, &_inner_error_);
#line 83 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 362 "helper-delete-contacts.c"
			goto __catch1_g_error;
		}
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* e = NULL;
		FILE* _tmp11_ = NULL;
		GError* _tmp12_ = NULL;
		const gchar* _tmp13_ = NULL;
#line 81 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		e = _inner_error_;
#line 81 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_inner_error_ = NULL;
#line 87 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp11_ = stderr;
#line 87 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp12_ = e;
#line 87 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_tmp13_ = _tmp12_->message;
#line 87 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		fprintf (_tmp11_, "Error: %s\n", _tmp13_);
#line 88 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		result = 1;
#line 88 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		_g_error_free0 (e);
#line 88 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		return result;
#line 391 "helper-delete-contacts.c"
	}
	__finally1:
#line 81 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 81 "/opt/gnome3/source/folks/tests/eds/helper-delete-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 81 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		g_clear_error (&_inner_error_);
#line 81 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		return 0;
#line 402 "helper-delete-contacts.c"
	}
#line 91 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	result = 0;
#line 91 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	return result;
#line 408 "helper-delete-contacts.c"
}


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


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


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


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


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


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


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


static gchar* value_main_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	if (collect_values[0].v_pointer) {
#line 480 "helper-delete-contacts.c"
		Main* object;
		object = collect_values[0].v_pointer;
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		if (object->parent_instance.g_class == NULL) {
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 487 "helper-delete-contacts.c"
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-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 491 "helper-delete-contacts.c"
		}
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		value->data[0].v_pointer = main_ref (object);
#line 495 "helper-delete-contacts.c"
	} else {
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		value->data[0].v_pointer = NULL;
#line 499 "helper-delete-contacts.c"
	}
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	return NULL;
#line 503 "helper-delete-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 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	if (!object_p) {
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
#line 514 "helper-delete-contacts.c"
	}
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	if (!value->data[0].v_pointer) {
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		*object_p = NULL;
#line 520 "helper-delete-contacts.c"
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		*object_p = value->data[0].v_pointer;
#line 524 "helper-delete-contacts.c"
	} else {
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
		*object_p = main_ref (value->data[0].v_pointer);
#line 528 "helper-delete-contacts.c"
	}
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	return NULL;
#line 532 "helper-delete-contacts.c"
}


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


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


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


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


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


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


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


/**
 * helper-delete-contacts --uid=UID
 *
 * Delete every contact from 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.
 */
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 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	g_atomic_int_inc (&self->ref_count);
#line 32 "/opt/gnome3/source/folks/tests/eds/helper-delete-contacts.vala"
	return instance;
#line 682 "helper-delete-contacts.c"
}


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



