/* command-linking.c generated by valac 0.34.0.3-63fa6, the Vala compiler
 * generated from command-linking.vala, do not modify */

/*
 * Copyright (C) 2011 Philip Withnall
 *
 * 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:
 *       Philip Withnall <philip@tecnocode.co.uk>
 */

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <folks/folks.h>
#include <stdio.h>
#include <readline/readline.h>


#define FOLKS_INSPECT_TYPE_COMMAND (folks_inspect_command_get_type ())
#define FOLKS_INSPECT_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_TYPE_COMMAND, FolksInspectCommand))
#define FOLKS_INSPECT_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_TYPE_COMMAND, FolksInspectCommandClass))
#define FOLKS_INSPECT_IS_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_TYPE_COMMAND))
#define FOLKS_INSPECT_IS_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_TYPE_COMMAND))
#define FOLKS_INSPECT_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_TYPE_COMMAND, FolksInspectCommandClass))

typedef struct _FolksInspectCommand FolksInspectCommand;
typedef struct _FolksInspectCommandClass FolksInspectCommandClass;
typedef struct _FolksInspectCommandPrivate FolksInspectCommandPrivate;

#define FOLKS_INSPECT_TYPE_CLIENT (folks_inspect_client_get_type ())
#define FOLKS_INSPECT_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_TYPE_CLIENT, FolksInspectClient))
#define FOLKS_INSPECT_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_TYPE_CLIENT, FolksInspectClientClass))
#define FOLKS_INSPECT_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_TYPE_CLIENT))
#define FOLKS_INSPECT_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_TYPE_CLIENT))
#define FOLKS_INSPECT_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_TYPE_CLIENT, FolksInspectClientClass))

typedef struct _FolksInspectClient FolksInspectClient;
typedef struct _FolksInspectClientClass FolksInspectClientClass;

#define FOLKS_INSPECT_COMMANDS_TYPE_LINKING (folks_inspect_commands_linking_get_type ())
#define FOLKS_INSPECT_COMMANDS_LINKING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_COMMANDS_TYPE_LINKING, FolksInspectCommandsLinking))
#define FOLKS_INSPECT_COMMANDS_LINKING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_COMMANDS_TYPE_LINKING, FolksInspectCommandsLinkingClass))
#define FOLKS_INSPECT_COMMANDS_IS_LINKING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_COMMANDS_TYPE_LINKING))
#define FOLKS_INSPECT_COMMANDS_IS_LINKING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_COMMANDS_TYPE_LINKING))
#define FOLKS_INSPECT_COMMANDS_LINKING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_COMMANDS_TYPE_LINKING, FolksInspectCommandsLinkingClass))

typedef struct _FolksInspectCommandsLinking FolksInspectCommandsLinking;
typedef struct _FolksInspectCommandsLinkingClass FolksInspectCommandsLinkingClass;
typedef struct _FolksInspectCommandsLinkingPrivate FolksInspectCommandsLinkingPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _folks_inspect_command_unref0(var) ((var == NULL) ? NULL : (var = (folks_inspect_command_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _FolksInspectCommandsLinkingRunData FolksInspectCommandsLinkingRunData;

struct _FolksInspectCommand {
	GTypeInstance parent_instance;
	volatile int ref_count;
	FolksInspectCommandPrivate * priv;
	FolksInspectClient* client;
};

struct _FolksInspectCommandClass {
	GTypeClass parent_class;
	void (*finalize) (FolksInspectCommand *self);
	void (*run) (FolksInspectCommand* self, const gchar* command_string, GAsyncReadyCallback _callback_, gpointer _user_data_);
	gint (*run_finish) (FolksInspectCommand* self, GAsyncResult* _res_);
	gchar** (*complete_subcommand) (FolksInspectCommand* self, const gchar* subcommand, int* result_length1);
	const gchar* (*get_name) (FolksInspectCommand* self);
	const gchar* (*get_description) (FolksInspectCommand* self);
	const gchar* (*get_help) (FolksInspectCommand* self);
};

struct _FolksInspectCommandsLinking {
	FolksInspectCommand parent_instance;
	FolksInspectCommandsLinkingPrivate * priv;
};

struct _FolksInspectCommandsLinkingClass {
	FolksInspectCommandClass parent_class;
};

struct _FolksInspectCommandsLinkingRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FolksInspectCommandsLinking* self;
	gchar* command_string;
	gint result;
	gchar** parts;
	gchar** _tmp0_;
	gint parts_length1;
	gint _parts_size_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	const gchar* _tmp9_;
	gboolean _tmp10_;
	gboolean _tmp11_;
	gchar** _tmp12_;
	gint _tmp12__length1;
	const gchar* _tmp13_;
	gchar** _tmp14_;
	gint _tmp14__length1;
	const gchar* _tmp15_;
	GeeHashSet* personas;
	GeeHashSet* _tmp16_;
	gchar** _tmp17_;
	gint _tmp17__length1;
	gchar** _tmp18_;
	gint _tmp18__length1;
	const gchar* _tmp19_;
	guint i;
	gboolean _tmp20_;
	guint _tmp21_;
	guint _tmp22_;
	gchar** _tmp23_;
	gint _tmp23__length1;
	gboolean _tmp24_;
	gchar** _tmp25_;
	gint _tmp25__length1;
	guint _tmp26_;
	const gchar* _tmp27_;
	gchar** _tmp28_;
	gint _tmp28__length1;
	guint _tmp29_;
	const gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar** _tmp33_;
	gint _tmp33__length1;
	const gchar* _tmp34_;
	gchar** _tmp35_;
	gint _tmp35__length1;
	guint _tmp36_;
	const gchar* _tmp37_;
	gchar** _tmp38_;
	gint _tmp38__length1;
	guint _tmp39_;
	const gchar* _tmp40_;
	gboolean found;
	gchar** _tmp41_;
	gint _tmp41__length1;
	const gchar* _tmp42_;
	gchar* uid;
	gchar** _tmp43_;
	gint _tmp43__length1;
	guint _tmp44_;
	const gchar* _tmp45_;
	gchar* _tmp46_;
	GeeIterator* _individual_it;
	FolksInspectClient* _tmp47_;
	FolksIndividualAggregator* _tmp48_;
	FolksIndividualAggregator* _tmp49_;
	GeeMap* _tmp50_;
	GeeMap* _tmp51_;
	GeeCollection* _tmp52_;
	GeeCollection* _tmp53_;
	GeeCollection* _tmp54_;
	GeeIterator* _tmp55_;
	GeeIterator* _tmp56_;
	GeeIterator* _tmp57_;
	gboolean _tmp58_;
	FolksIndividual* individual;
	GeeIterator* _tmp59_;
	gpointer _tmp60_;
	GeeIterator* _persona_it;
	FolksIndividual* _tmp61_;
	GeeSet* _tmp62_;
	GeeSet* _tmp63_;
	GeeIterator* _tmp64_;
	GeeIterator* _tmp65_;
	gboolean _tmp66_;
	FolksPersona* persona;
	GeeIterator* _tmp67_;
	gpointer _tmp68_;
	FolksPersona* _tmp69_;
	const gchar* _tmp70_;
	const gchar* _tmp71_;
	const gchar* _tmp72_;
	GeeHashSet* _tmp73_;
	FolksPersona* _tmp74_;
	gboolean _tmp75_;
	gboolean _tmp76_;
	gchar** _tmp77_;
	gint _tmp77__length1;
	guint _tmp78_;
	const gchar* _tmp79_;
	gchar* id;
	gchar** _tmp80_;
	gint _tmp80__length1;
	guint _tmp81_;
	const gchar* _tmp82_;
	gchar* _tmp83_;
	GeeIterator* _vala1__individual_it;
	FolksInspectClient* _tmp84_;
	FolksIndividualAggregator* _tmp85_;
	FolksIndividualAggregator* _tmp86_;
	GeeMap* _tmp87_;
	GeeMap* _tmp88_;
	GeeCollection* _tmp89_;
	GeeCollection* _tmp90_;
	GeeCollection* _tmp91_;
	GeeIterator* _tmp92_;
	GeeIterator* _tmp93_;
	GeeIterator* _tmp94_;
	gboolean _tmp95_;
	FolksIndividual* _vala1_individual;
	GeeIterator* _tmp96_;
	gpointer _tmp97_;
	FolksIndividual* _tmp98_;
	const gchar* _tmp99_;
	const gchar* _tmp100_;
	const gchar* _tmp101_;
	GeeIterator* _vala1__persona_it;
	FolksIndividual* _tmp102_;
	GeeSet* _tmp103_;
	GeeSet* _tmp104_;
	GeeIterator* _tmp105_;
	GeeIterator* _tmp106_;
	gboolean _tmp107_;
	FolksPersona* _vala1_persona;
	GeeIterator* _tmp108_;
	gpointer _tmp109_;
	GeeHashSet* _tmp110_;
	FolksPersona* _tmp111_;
	gboolean _tmp112_;
	gchar** _tmp113_;
	gint _tmp113__length1;
	guint _tmp114_;
	const gchar* _tmp115_;
	FolksInspectClient* _tmp116_;
	FolksIndividualAggregator* _tmp117_;
	FolksIndividualAggregator* _tmp118_;
	GeeHashSet* _tmp119_;
	GError* e;
	GError* _tmp120_;
	GQuark _tmp121_;
	GError* _tmp122_;
	gint _tmp123_;
	GeeHashSet* _tmp124_;
	gint _tmp125_;
	gint _tmp126_;
	GError* _tmp127_;
	const gchar* _tmp128_;
	GeeHashSet* _tmp129_;
	gint _tmp130_;
	gint _tmp131_;
	gchar** _tmp132_;
	gint _tmp132__length1;
	const gchar* _tmp133_;
	gchar** _tmp134_;
	gint _tmp134__length1;
	FolksIndividual* ind;
	FolksInspectClient* _tmp135_;
	FolksIndividualAggregator* _tmp136_;
	FolksIndividualAggregator* _tmp137_;
	GeeMap* _tmp138_;
	GeeMap* _tmp139_;
	gchar** _tmp140_;
	gint _tmp140__length1;
	const gchar* _tmp141_;
	gpointer _tmp142_;
	FolksIndividual* _tmp143_;
	gchar** _tmp144_;
	gint _tmp144__length1;
	const gchar* _tmp145_;
	FolksInspectClient* _tmp146_;
	FolksIndividualAggregator* _tmp147_;
	FolksIndividualAggregator* _tmp148_;
	FolksIndividual* _tmp149_;
	GError* _vala1_e;
	GError* _tmp150_;
	GQuark _tmp151_;
	GError* _tmp152_;
	gint _tmp153_;
	FolksIndividual* _tmp154_;
	const gchar* _tmp155_;
	const gchar* _tmp156_;
	GError* _tmp157_;
	const gchar* _tmp158_;
	FolksIndividual* _tmp159_;
	const gchar* _tmp160_;
	const gchar* _tmp161_;
	GError * _inner_error_;
};


static gpointer folks_inspect_commands_linking_parent_class = NULL;
static gchar** folks_inspect_commands_linking_subcommand_completions;
static gchar** folks_inspect_commands_linking_subcommand_completions = NULL;
static guint folks_inspect_commands_linking_completion_count;
static guint folks_inspect_commands_linking_completion_count = 0U;
static gchar* folks_inspect_commands_linking_prefix;
static gchar* folks_inspect_commands_linking_prefix = NULL;

gpointer folks_inspect_command_ref (gpointer instance);
void folks_inspect_command_unref (gpointer instance);
GParamSpec* folks_inspect_param_spec_command (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void folks_inspect_value_set_command (GValue* value, gpointer v_object);
void folks_inspect_value_take_command (GValue* value, gpointer v_object);
gpointer folks_inspect_value_get_command (const GValue* value);
GType folks_inspect_command_get_type (void) G_GNUC_CONST;
GType folks_inspect_client_get_type (void) G_GNUC_CONST;
GType folks_inspect_commands_linking_get_type (void) G_GNUC_CONST;
enum  {
	FOLKS_INSPECT_COMMANDS_LINKING_DUMMY_PROPERTY
};
FolksInspectCommandsLinking* folks_inspect_commands_linking_new (FolksInspectClient* client);
FolksInspectCommandsLinking* folks_inspect_commands_linking_construct (GType object_type, FolksInspectClient* client);
FolksInspectCommand* folks_inspect_command_construct (GType object_type, FolksInspectClient* client);
static void folks_inspect_commands_linking_real_run_data_free (gpointer _data);
static void folks_inspect_commands_linking_real_run (FolksInspectCommand* base, const gchar* command_string, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean folks_inspect_commands_linking_real_run_co (FolksInspectCommandsLinkingRunData* _data_);
gboolean folks_inspect_utils_validate_subcommand (const gchar* command, const gchar* command_string, const gchar* subcommand, gchar** valid_subcommands, int valid_subcommands_length1);
const gchar* folks_inspect_command_get_name (FolksInspectCommand* self);
void folks_inspect_utils_print_line (const gchar* format, ...);
FolksIndividualAggregator* folks_inspect_client_get_aggregator (FolksInspectClient* self);
static void folks_inspect_commands_linking_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
gchar* folks_inspect_commands_linking_subcommand_name_completion_cb (const gchar* word, gint state);
gchar* folks_inspect_utils_persona_uid_completion_cb (const gchar* word, gint state);
static gchar* _folks_inspect_utils_persona_uid_completion_cb_rl_compentry_func_t (const gchar* str, gint a);
static gchar** _vala_array_dup4 (gchar** self, int length);
gchar* folks_inspect_utils_individual_id_completion_cb (const gchar* word, gint state);
static gchar* _folks_inspect_utils_individual_id_completion_cb_rl_compentry_func_t (const gchar* str, gint a);
static gchar** _vala_array_dup5 (gchar** self, int length);
static gchar** _vala_array_dup6 (gchar** self, int length);
static gchar** _vala_array_dup7 (gchar** self, int length);
static gchar** folks_inspect_commands_linking_real_complete_subcommand (FolksInspectCommand* base, const gchar* subcommand, int* result_length1);
static gchar* _folks_inspect_commands_linking_subcommand_name_completion_cb_rl_compentry_func_t (const gchar* str, gint a);
static gchar** _vala_array_dup8 (gchar** self, int length);
static void folks_inspect_commands_linking_finalize (FolksInspectCommand* 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 gchar* FOLKS_INSPECT_COMMANDS_LINKING__valid_subcommands[3] = {"link-personas", "link-individuals", "unlink-individual"};

FolksInspectCommandsLinking* folks_inspect_commands_linking_construct (GType object_type, FolksInspectClient* client) {
	FolksInspectCommandsLinking* self = NULL;
	FolksInspectClient* _tmp0_ = NULL;
	g_return_val_if_fail (client != NULL, NULL);
	_tmp0_ = client;
	self = (FolksInspectCommandsLinking*) folks_inspect_command_construct (object_type, _tmp0_);
	return self;
}


FolksInspectCommandsLinking* folks_inspect_commands_linking_new (FolksInspectClient* client) {
	return folks_inspect_commands_linking_construct (FOLKS_INSPECT_COMMANDS_TYPE_LINKING, client);
}


static void folks_inspect_commands_linking_real_run_data_free (gpointer _data) {
	FolksInspectCommandsLinkingRunData* _data_;
	_data_ = _data;
	_g_free0 (_data_->command_string);
	_folks_inspect_command_unref0 (_data_->self);
	g_slice_free (FolksInspectCommandsLinkingRunData, _data_);
}


static gpointer _folks_inspect_command_ref0 (gpointer self) {
	return self ? folks_inspect_command_ref (self) : NULL;
}


static void folks_inspect_commands_linking_real_run (FolksInspectCommand* base, const gchar* command_string, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksInspectCommandsLinking * self;
	FolksInspectCommandsLinkingRunData* _data_;
	FolksInspectCommandsLinking* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	self = (FolksInspectCommandsLinking*) base;
	_data_ = g_slice_new0 (FolksInspectCommandsLinkingRunData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, folks_inspect_commands_linking_real_run);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, folks_inspect_commands_linking_real_run_data_free);
	_tmp0_ = _folks_inspect_command_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = command_string;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (_data_->command_string);
	_data_->command_string = _tmp2_;
	folks_inspect_commands_linking_real_run_co (_data_);
}


static gint folks_inspect_commands_linking_real_run_finish (FolksInspectCommand* base, GAsyncResult* _res_) {
	gint result;
	FolksInspectCommandsLinkingRunData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	return result;
}


static gchar* string_strip (const gchar* self) {
	gchar* result = NULL;
	gchar* _result_ = NULL;
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	g_strstrip (_tmp1_);
	result = _result_;
	return result;
}


static void folks_inspect_commands_linking_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksInspectCommandsLinkingRunData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	folks_inspect_commands_linking_real_run_co (_data_);
}


static gboolean folks_inspect_commands_linking_real_run_co (FolksInspectCommandsLinkingRunData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = g_new0 (gchar*, 0 + 1);
	_data_->parts_length1 = 0;
	_data_->_parts_size_ = 0;
	_data_->parts = _data_->_tmp0_;
	_data_->parts_length1 = 0;
	_data_->_parts_size_ = _data_->parts_length1;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _data_->command_string;
	if (_data_->_tmp1_ != NULL) {
		_data_->_tmp2_ = NULL;
		_data_->_tmp2_ = _data_->command_string;
		_data_->_tmp3_ = NULL;
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = _data_->_tmp3_ = g_strsplit (_data_->_tmp2_, " ", 0);
		_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
		_data_->parts = _data_->_tmp4_;
		_data_->parts_length1 = _vala_array_length (_data_->_tmp3_);
		_data_->_parts_size_ = _data_->parts_length1;
	}
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = folks_inspect_command_get_name ((FolksInspectCommand*) _data_->self);
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = _data_->command_string;
	_data_->_tmp8_ = NULL;
	_data_->_tmp8__length1 = 0;
	_data_->_tmp8_ = _data_->parts;
	_data_->_tmp8__length1 = _data_->parts_length1;
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = _data_->_tmp8_[0];
	_data_->_tmp10_ = FALSE;
	_data_->_tmp10_ = folks_inspect_utils_validate_subcommand (_data_->_tmp6_, _data_->_tmp7_, _data_->_tmp9_, FOLKS_INSPECT_COMMANDS_LINKING__valid_subcommands, G_N_ELEMENTS (FOLKS_INSPECT_COMMANDS_LINKING__valid_subcommands));
	if (!_data_->_tmp10_) {
		_data_->result = 1;
		_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp12_ = NULL;
	_data_->_tmp12__length1 = 0;
	_data_->_tmp12_ = _data_->parts;
	_data_->_tmp12__length1 = _data_->parts_length1;
	_data_->_tmp13_ = NULL;
	_data_->_tmp13_ = _data_->_tmp12_[0];
	if (g_strcmp0 (_data_->_tmp13_, "link-personas") == 0) {
		_data_->_tmp11_ = TRUE;
	} else {
		_data_->_tmp14_ = NULL;
		_data_->_tmp14__length1 = 0;
		_data_->_tmp14_ = _data_->parts;
		_data_->_tmp14__length1 = _data_->parts_length1;
		_data_->_tmp15_ = NULL;
		_data_->_tmp15_ = _data_->_tmp14_[0];
		_data_->_tmp11_ = g_strcmp0 (_data_->_tmp15_, "link-individuals") == 0;
	}
	if (_data_->_tmp11_) {
		_data_->_tmp16_ = NULL;
		_data_->_tmp16_ = gee_hash_set_new (FOLKS_TYPE_PERSONA, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
		_data_->personas = _data_->_tmp16_;
		_data_->_tmp17_ = NULL;
		_data_->_tmp17__length1 = 0;
		_data_->_tmp17_ = _data_->parts;
		_data_->_tmp17__length1 = _data_->parts_length1;
		if (_data_->_tmp17__length1 < 2) {
			_data_->_tmp18_ = NULL;
			_data_->_tmp18__length1 = 0;
			_data_->_tmp18_ = _data_->parts;
			_data_->_tmp18__length1 = _data_->parts_length1;
			_data_->_tmp19_ = NULL;
			_data_->_tmp19_ = _data_->_tmp18_[0];
			if (g_strcmp0 (_data_->_tmp19_, "link-personas") == 0) {
				folks_inspect_utils_print_line ("%s", "Must pass at least one persona to a " "'link-personas' subcommand.");
			} else {
				folks_inspect_utils_print_line ("%s", "Must pass at least one individual to a " "'link-individuals' subcommand.");
			}
			_data_->result = 1;
			_g_object_unref0 (_data_->personas);
			_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		{
			_data_->i = (guint) 1;
			{
				_data_->_tmp20_ = TRUE;
				while (TRUE) {
					if (!_data_->_tmp20_) {
						_data_->_tmp21_ = 0U;
						_data_->_tmp21_ = _data_->i;
						_data_->i = _data_->_tmp21_ + 1;
					}
					_data_->_tmp20_ = FALSE;
					_data_->_tmp22_ = 0U;
					_data_->_tmp22_ = _data_->i;
					_data_->_tmp23_ = NULL;
					_data_->_tmp23__length1 = 0;
					_data_->_tmp23_ = _data_->parts;
					_data_->_tmp23__length1 = _data_->parts_length1;
					if (!(_data_->_tmp22_ < ((guint) _data_->_tmp23__length1))) {
						break;
					}
					_data_->_tmp25_ = NULL;
					_data_->_tmp25__length1 = 0;
					_data_->_tmp25_ = _data_->parts;
					_data_->_tmp25__length1 = _data_->parts_length1;
					_data_->_tmp26_ = 0U;
					_data_->_tmp26_ = _data_->i;
					_data_->_tmp27_ = NULL;
					_data_->_tmp27_ = _data_->_tmp25_[_data_->_tmp26_];
					if (_data_->_tmp27_ == NULL) {
						_data_->_tmp24_ = TRUE;
					} else {
						_data_->_tmp28_ = NULL;
						_data_->_tmp28__length1 = 0;
						_data_->_tmp28_ = _data_->parts;
						_data_->_tmp28__length1 = _data_->parts_length1;
						_data_->_tmp29_ = 0U;
						_data_->_tmp29_ = _data_->i;
						_data_->_tmp30_ = NULL;
						_data_->_tmp30_ = _data_->_tmp28_[_data_->_tmp29_];
						_data_->_tmp31_ = NULL;
						_data_->_tmp31_ = string_strip (_data_->_tmp30_);
						_data_->_tmp32_ = NULL;
						_data_->_tmp32_ = _data_->_tmp31_;
						_data_->_tmp24_ = g_strcmp0 (_data_->_tmp32_, "") == 0;
						_g_free0 (_data_->_tmp32_);
					}
					if (_data_->_tmp24_) {
						_data_->_tmp33_ = NULL;
						_data_->_tmp33__length1 = 0;
						_data_->_tmp33_ = _data_->parts;
						_data_->_tmp33__length1 = _data_->parts_length1;
						_data_->_tmp34_ = NULL;
						_data_->_tmp34_ = _data_->_tmp33_[0];
						if (g_strcmp0 (_data_->_tmp34_, "link-personas") == 0) {
							_data_->_tmp35_ = NULL;
							_data_->_tmp35__length1 = 0;
							_data_->_tmp35_ = _data_->parts;
							_data_->_tmp35__length1 = _data_->parts_length1;
							_data_->_tmp36_ = 0U;
							_data_->_tmp36_ = _data_->i;
							_data_->_tmp37_ = NULL;
							_data_->_tmp37_ = _data_->_tmp35_[_data_->_tmp36_];
							folks_inspect_utils_print_line ("Unrecognised persona UID '%s'.", _data_->_tmp37_);
						} else {
							_data_->_tmp38_ = NULL;
							_data_->_tmp38__length1 = 0;
							_data_->_tmp38_ = _data_->parts;
							_data_->_tmp38__length1 = _data_->parts_length1;
							_data_->_tmp39_ = 0U;
							_data_->_tmp39_ = _data_->i;
							_data_->_tmp40_ = NULL;
							_data_->_tmp40_ = _data_->_tmp38_[_data_->_tmp39_];
							folks_inspect_utils_print_line ("Unrecognised individual ID '%s'.", _data_->_tmp40_);
						}
						_data_->result = 1;
						_g_object_unref0 (_data_->personas);
						_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
						if (_data_->_state_ == 0) {
							g_simple_async_result_complete_in_idle (_data_->_async_result);
						} else {
							g_simple_async_result_complete (_data_->_async_result);
						}
						g_object_unref (_data_->_async_result);
						return FALSE;
					}
					_data_->found = FALSE;
					_data_->_tmp41_ = NULL;
					_data_->_tmp41__length1 = 0;
					_data_->_tmp41_ = _data_->parts;
					_data_->_tmp41__length1 = _data_->parts_length1;
					_data_->_tmp42_ = NULL;
					_data_->_tmp42_ = _data_->_tmp41_[0];
					if (g_strcmp0 (_data_->_tmp42_, "link-personas") == 0) {
						_data_->_tmp43_ = NULL;
						_data_->_tmp43__length1 = 0;
						_data_->_tmp43_ = _data_->parts;
						_data_->_tmp43__length1 = _data_->parts_length1;
						_data_->_tmp44_ = 0U;
						_data_->_tmp44_ = _data_->i;
						_data_->_tmp45_ = NULL;
						_data_->_tmp45_ = _data_->_tmp43_[_data_->_tmp44_];
						_data_->_tmp46_ = NULL;
						_data_->_tmp46_ = string_strip (_data_->_tmp45_);
						_data_->uid = _data_->_tmp46_;
						{
							_data_->_tmp47_ = NULL;
							_data_->_tmp47_ = ((FolksInspectCommand*) _data_->self)->client;
							_data_->_tmp48_ = NULL;
							_data_->_tmp48_ = folks_inspect_client_get_aggregator (_data_->_tmp47_);
							_data_->_tmp49_ = NULL;
							_data_->_tmp49_ = _data_->_tmp48_;
							_data_->_tmp50_ = NULL;
							_data_->_tmp50_ = folks_individual_aggregator_get_individuals (_data_->_tmp49_);
							_data_->_tmp51_ = NULL;
							_data_->_tmp51_ = _data_->_tmp50_;
							_data_->_tmp52_ = NULL;
							_data_->_tmp52_ = gee_map_get_values (_data_->_tmp51_);
							_data_->_tmp53_ = NULL;
							_data_->_tmp53_ = _data_->_tmp52_;
							_data_->_tmp54_ = NULL;
							_data_->_tmp54_ = _data_->_tmp53_;
							_data_->_tmp55_ = NULL;
							_data_->_tmp55_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp54_);
							_data_->_tmp56_ = NULL;
							_data_->_tmp56_ = _data_->_tmp55_;
							_g_object_unref0 (_data_->_tmp54_);
							_data_->_individual_it = _data_->_tmp56_;
							while (TRUE) {
								_data_->_tmp57_ = NULL;
								_data_->_tmp57_ = _data_->_individual_it;
								_data_->_tmp58_ = FALSE;
								_data_->_tmp58_ = gee_iterator_next (_data_->_tmp57_);
								if (!_data_->_tmp58_) {
									break;
								}
								_data_->_tmp59_ = NULL;
								_data_->_tmp59_ = _data_->_individual_it;
								_data_->_tmp60_ = NULL;
								_data_->_tmp60_ = gee_iterator_get (_data_->_tmp59_);
								_data_->individual = (FolksIndividual*) _data_->_tmp60_;
								{
									_data_->_tmp61_ = NULL;
									_data_->_tmp61_ = _data_->individual;
									_data_->_tmp62_ = NULL;
									_data_->_tmp62_ = folks_individual_get_personas (_data_->_tmp61_);
									_data_->_tmp63_ = NULL;
									_data_->_tmp63_ = _data_->_tmp62_;
									_data_->_tmp64_ = NULL;
									_data_->_tmp64_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp63_);
									_data_->_persona_it = _data_->_tmp64_;
									while (TRUE) {
										_data_->_tmp65_ = NULL;
										_data_->_tmp65_ = _data_->_persona_it;
										_data_->_tmp66_ = FALSE;
										_data_->_tmp66_ = gee_iterator_next (_data_->_tmp65_);
										if (!_data_->_tmp66_) {
											break;
										}
										_data_->_tmp67_ = NULL;
										_data_->_tmp67_ = _data_->_persona_it;
										_data_->_tmp68_ = NULL;
										_data_->_tmp68_ = gee_iterator_get (_data_->_tmp67_);
										_data_->persona = (FolksPersona*) _data_->_tmp68_;
										_data_->_tmp69_ = NULL;
										_data_->_tmp69_ = _data_->persona;
										_data_->_tmp70_ = NULL;
										_data_->_tmp70_ = folks_persona_get_uid (_data_->_tmp69_);
										_data_->_tmp71_ = NULL;
										_data_->_tmp71_ = _data_->_tmp70_;
										_data_->_tmp72_ = NULL;
										_data_->_tmp72_ = _data_->uid;
										if (g_strcmp0 (_data_->_tmp71_, _data_->_tmp72_) == 0) {
											_data_->_tmp73_ = NULL;
											_data_->_tmp73_ = _data_->personas;
											_data_->_tmp74_ = NULL;
											_data_->_tmp74_ = _data_->persona;
											gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp73_, _data_->_tmp74_);
											_data_->found = TRUE;
											_g_object_unref0 (_data_->persona);
											break;
										}
										_g_object_unref0 (_data_->persona);
									}
									_g_object_unref0 (_data_->_persona_it);
								}
								_data_->_tmp75_ = FALSE;
								_data_->_tmp75_ = _data_->found;
								if (_data_->_tmp75_ == TRUE) {
									_g_object_unref0 (_data_->individual);
									break;
								}
								_g_object_unref0 (_data_->individual);
							}
							_g_object_unref0 (_data_->_individual_it);
						}
						_data_->_tmp76_ = FALSE;
						_data_->_tmp76_ = _data_->found;
						if (_data_->_tmp76_ == FALSE) {
							_data_->_tmp77_ = NULL;
							_data_->_tmp77__length1 = 0;
							_data_->_tmp77_ = _data_->parts;
							_data_->_tmp77__length1 = _data_->parts_length1;
							_data_->_tmp78_ = 0U;
							_data_->_tmp78_ = _data_->i;
							_data_->_tmp79_ = NULL;
							_data_->_tmp79_ = _data_->_tmp77_[_data_->_tmp78_];
							folks_inspect_utils_print_line ("Unrecognised persona UID '%s'.", _data_->_tmp79_);
							_data_->result = 1;
							_g_free0 (_data_->uid);
							_g_object_unref0 (_data_->personas);
							_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
							if (_data_->_state_ == 0) {
								g_simple_async_result_complete_in_idle (_data_->_async_result);
							} else {
								g_simple_async_result_complete (_data_->_async_result);
							}
							g_object_unref (_data_->_async_result);
							return FALSE;
						}
						_g_free0 (_data_->uid);
					} else {
						_data_->_tmp80_ = NULL;
						_data_->_tmp80__length1 = 0;
						_data_->_tmp80_ = _data_->parts;
						_data_->_tmp80__length1 = _data_->parts_length1;
						_data_->_tmp81_ = 0U;
						_data_->_tmp81_ = _data_->i;
						_data_->_tmp82_ = NULL;
						_data_->_tmp82_ = _data_->_tmp80_[_data_->_tmp81_];
						_data_->_tmp83_ = NULL;
						_data_->_tmp83_ = string_strip (_data_->_tmp82_);
						_data_->id = _data_->_tmp83_;
						{
							_data_->_tmp84_ = NULL;
							_data_->_tmp84_ = ((FolksInspectCommand*) _data_->self)->client;
							_data_->_tmp85_ = NULL;
							_data_->_tmp85_ = folks_inspect_client_get_aggregator (_data_->_tmp84_);
							_data_->_tmp86_ = NULL;
							_data_->_tmp86_ = _data_->_tmp85_;
							_data_->_tmp87_ = NULL;
							_data_->_tmp87_ = folks_individual_aggregator_get_individuals (_data_->_tmp86_);
							_data_->_tmp88_ = NULL;
							_data_->_tmp88_ = _data_->_tmp87_;
							_data_->_tmp89_ = NULL;
							_data_->_tmp89_ = gee_map_get_values (_data_->_tmp88_);
							_data_->_tmp90_ = NULL;
							_data_->_tmp90_ = _data_->_tmp89_;
							_data_->_tmp91_ = NULL;
							_data_->_tmp91_ = _data_->_tmp90_;
							_data_->_tmp92_ = NULL;
							_data_->_tmp92_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp91_);
							_data_->_tmp93_ = NULL;
							_data_->_tmp93_ = _data_->_tmp92_;
							_g_object_unref0 (_data_->_tmp91_);
							_data_->_vala1__individual_it = _data_->_tmp93_;
							while (TRUE) {
								_data_->_tmp94_ = NULL;
								_data_->_tmp94_ = _data_->_vala1__individual_it;
								_data_->_tmp95_ = FALSE;
								_data_->_tmp95_ = gee_iterator_next (_data_->_tmp94_);
								if (!_data_->_tmp95_) {
									break;
								}
								_data_->_tmp96_ = NULL;
								_data_->_tmp96_ = _data_->_vala1__individual_it;
								_data_->_tmp97_ = NULL;
								_data_->_tmp97_ = gee_iterator_get (_data_->_tmp96_);
								_data_->_vala1_individual = (FolksIndividual*) _data_->_tmp97_;
								_data_->_tmp98_ = NULL;
								_data_->_tmp98_ = _data_->_vala1_individual;
								_data_->_tmp99_ = NULL;
								_data_->_tmp99_ = folks_individual_get_id (_data_->_tmp98_);
								_data_->_tmp100_ = NULL;
								_data_->_tmp100_ = _data_->_tmp99_;
								_data_->_tmp101_ = NULL;
								_data_->_tmp101_ = _data_->id;
								if (g_strcmp0 (_data_->_tmp100_, _data_->_tmp101_) == 0) {
									{
										_data_->_tmp102_ = NULL;
										_data_->_tmp102_ = _data_->_vala1_individual;
										_data_->_tmp103_ = NULL;
										_data_->_tmp103_ = folks_individual_get_personas (_data_->_tmp102_);
										_data_->_tmp104_ = NULL;
										_data_->_tmp104_ = _data_->_tmp103_;
										_data_->_tmp105_ = NULL;
										_data_->_tmp105_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp104_);
										_data_->_vala1__persona_it = _data_->_tmp105_;
										while (TRUE) {
											_data_->_tmp106_ = NULL;
											_data_->_tmp106_ = _data_->_vala1__persona_it;
											_data_->_tmp107_ = FALSE;
											_data_->_tmp107_ = gee_iterator_next (_data_->_tmp106_);
											if (!_data_->_tmp107_) {
												break;
											}
											_data_->_tmp108_ = NULL;
											_data_->_tmp108_ = _data_->_vala1__persona_it;
											_data_->_tmp109_ = NULL;
											_data_->_tmp109_ = gee_iterator_get (_data_->_tmp108_);
											_data_->_vala1_persona = (FolksPersona*) _data_->_tmp109_;
											_data_->_tmp110_ = NULL;
											_data_->_tmp110_ = _data_->personas;
											_data_->_tmp111_ = NULL;
											_data_->_tmp111_ = _data_->_vala1_persona;
											gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp110_, _data_->_tmp111_);
											_g_object_unref0 (_data_->_vala1_persona);
										}
										_g_object_unref0 (_data_->_vala1__persona_it);
									}
									_data_->found = TRUE;
									_g_object_unref0 (_data_->_vala1_individual);
									break;
								}
								_g_object_unref0 (_data_->_vala1_individual);
							}
							_g_object_unref0 (_data_->_vala1__individual_it);
						}
						_data_->_tmp112_ = FALSE;
						_data_->_tmp112_ = _data_->found;
						if (_data_->_tmp112_ == FALSE) {
							_data_->_tmp113_ = NULL;
							_data_->_tmp113__length1 = 0;
							_data_->_tmp113_ = _data_->parts;
							_data_->_tmp113__length1 = _data_->parts_length1;
							_data_->_tmp114_ = 0U;
							_data_->_tmp114_ = _data_->i;
							_data_->_tmp115_ = NULL;
							_data_->_tmp115_ = _data_->_tmp113_[_data_->_tmp114_];
							folks_inspect_utils_print_line ("Unrecognised individual ID '%s'.", _data_->_tmp115_);
							_data_->result = 1;
							_g_free0 (_data_->id);
							_g_object_unref0 (_data_->personas);
							_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
							if (_data_->_state_ == 0) {
								g_simple_async_result_complete_in_idle (_data_->_async_result);
							} else {
								g_simple_async_result_complete (_data_->_async_result);
							}
							g_object_unref (_data_->_async_result);
							return FALSE;
						}
						_g_free0 (_data_->id);
					}
				}
			}
		}
		{
			_data_->_tmp116_ = NULL;
			_data_->_tmp116_ = ((FolksInspectCommand*) _data_->self)->client;
			_data_->_tmp117_ = NULL;
			_data_->_tmp117_ = folks_inspect_client_get_aggregator (_data_->_tmp116_);
			_data_->_tmp118_ = NULL;
			_data_->_tmp118_ = _data_->_tmp117_;
			_data_->_tmp119_ = NULL;
			_data_->_tmp119_ = _data_->personas;
			_data_->_state_ = 1;
			folks_individual_aggregator_link_personas (_data_->_tmp118_, (GeeSet*) _data_->_tmp119_, folks_inspect_commands_linking_run_ready, _data_);
			return FALSE;
			_state_1:
			folks_individual_aggregator_link_personas_finish (_data_->_tmp118_, _data_->_res_, &_data_->_inner_error_);
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				if (_data_->_inner_error_->domain == FOLKS_INDIVIDUAL_AGGREGATOR_ERROR) {
					goto __catch0_folks_individual_aggregator_error;
				}
				_g_object_unref0 (_data_->personas);
				_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
				g_clear_error (&_data_->_inner_error_);
				return FALSE;
			}
		}
		goto __finally0;
		__catch0_folks_individual_aggregator_error:
		{
			_data_->e = _data_->_inner_error_;
			_data_->_inner_error_ = NULL;
			_data_->_tmp120_ = NULL;
			_data_->_tmp120_ = _data_->e;
			_data_->_tmp121_ = 0U;
			_data_->_tmp121_ = _data_->_tmp120_->domain;
			_data_->_tmp122_ = NULL;
			_data_->_tmp122_ = _data_->e;
			_data_->_tmp123_ = 0;
			_data_->_tmp123_ = _data_->_tmp122_->code;
			_data_->_tmp124_ = NULL;
			_data_->_tmp124_ = _data_->personas;
			_data_->_tmp125_ = 0;
			_data_->_tmp125_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp124_);
			_data_->_tmp126_ = 0;
			_data_->_tmp126_ = _data_->_tmp125_;
			_data_->_tmp127_ = NULL;
			_data_->_tmp127_ = _data_->e;
			_data_->_tmp128_ = NULL;
			_data_->_tmp128_ = _data_->_tmp127_->message;
			folks_inspect_utils_print_line ("Error (domain: %u, code: %u) linking %u " "personas: %s", _data_->_tmp121_, _data_->_tmp123_, _data_->_tmp126_, _data_->_tmp128_);
			_data_->result = 1;
			_g_error_free0 (_data_->e);
			_g_object_unref0 (_data_->personas);
			_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_object_unref0 (_data_->personas);
			_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
		_data_->_tmp129_ = NULL;
		_data_->_tmp129_ = _data_->personas;
		_data_->_tmp130_ = 0;
		_data_->_tmp130_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp129_);
		_data_->_tmp131_ = 0;
		_data_->_tmp131_ = _data_->_tmp130_;
		folks_inspect_utils_print_line ("Linking of %u personas was successful.", (guint) _data_->_tmp131_);
		_g_object_unref0 (_data_->personas);
	} else {
		_data_->_tmp132_ = NULL;
		_data_->_tmp132__length1 = 0;
		_data_->_tmp132_ = _data_->parts;
		_data_->_tmp132__length1 = _data_->parts_length1;
		_data_->_tmp133_ = NULL;
		_data_->_tmp133_ = _data_->_tmp132_[0];
		if (g_strcmp0 (_data_->_tmp133_, "unlink-individual") == 0) {
			_data_->_tmp134_ = NULL;
			_data_->_tmp134__length1 = 0;
			_data_->_tmp134_ = _data_->parts;
			_data_->_tmp134__length1 = _data_->parts_length1;
			if (_data_->_tmp134__length1 != 2) {
				folks_inspect_utils_print_line ("%s", "Must pass exactly one individual ID to an " "'unlink-individual' subcommand.");
				_data_->result = 1;
				_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
				if (_data_->_state_ == 0) {
					g_simple_async_result_complete_in_idle (_data_->_async_result);
				} else {
					g_simple_async_result_complete (_data_->_async_result);
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp135_ = NULL;
			_data_->_tmp135_ = ((FolksInspectCommand*) _data_->self)->client;
			_data_->_tmp136_ = NULL;
			_data_->_tmp136_ = folks_inspect_client_get_aggregator (_data_->_tmp135_);
			_data_->_tmp137_ = NULL;
			_data_->_tmp137_ = _data_->_tmp136_;
			_data_->_tmp138_ = NULL;
			_data_->_tmp138_ = folks_individual_aggregator_get_individuals (_data_->_tmp137_);
			_data_->_tmp139_ = NULL;
			_data_->_tmp139_ = _data_->_tmp138_;
			_data_->_tmp140_ = NULL;
			_data_->_tmp140__length1 = 0;
			_data_->_tmp140_ = _data_->parts;
			_data_->_tmp140__length1 = _data_->parts_length1;
			_data_->_tmp141_ = NULL;
			_data_->_tmp141_ = _data_->_tmp140_[1];
			_data_->_tmp142_ = NULL;
			_data_->_tmp142_ = gee_map_get (_data_->_tmp139_, _data_->_tmp141_);
			_data_->ind = (FolksIndividual*) _data_->_tmp142_;
			_data_->_tmp143_ = NULL;
			_data_->_tmp143_ = _data_->ind;
			if (_data_->_tmp143_ == NULL) {
				_data_->_tmp144_ = NULL;
				_data_->_tmp144__length1 = 0;
				_data_->_tmp144_ = _data_->parts;
				_data_->_tmp144__length1 = _data_->parts_length1;
				_data_->_tmp145_ = NULL;
				_data_->_tmp145_ = _data_->_tmp144_[1];
				folks_inspect_utils_print_line ("Unrecognised individual ID '%s'.", _data_->_tmp145_);
				_data_->result = 1;
				_g_object_unref0 (_data_->ind);
				_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
				if (_data_->_state_ == 0) {
					g_simple_async_result_complete_in_idle (_data_->_async_result);
				} else {
					g_simple_async_result_complete (_data_->_async_result);
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			{
				_data_->_tmp146_ = NULL;
				_data_->_tmp146_ = ((FolksInspectCommand*) _data_->self)->client;
				_data_->_tmp147_ = NULL;
				_data_->_tmp147_ = folks_inspect_client_get_aggregator (_data_->_tmp146_);
				_data_->_tmp148_ = NULL;
				_data_->_tmp148_ = _data_->_tmp147_;
				_data_->_tmp149_ = NULL;
				_data_->_tmp149_ = _data_->ind;
				_data_->_state_ = 2;
				folks_individual_aggregator_unlink_individual (_data_->_tmp148_, _data_->_tmp149_, folks_inspect_commands_linking_run_ready, _data_);
				return FALSE;
				_state_2:
				folks_individual_aggregator_unlink_individual_finish (_data_->_tmp148_, _data_->_res_, &_data_->_inner_error_);
				if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
					goto __catch1_g_error;
				}
			}
			goto __finally1;
			__catch1_g_error:
			{
				_data_->_vala1_e = _data_->_inner_error_;
				_data_->_inner_error_ = NULL;
				_data_->_tmp150_ = NULL;
				_data_->_tmp150_ = _data_->_vala1_e;
				_data_->_tmp151_ = 0U;
				_data_->_tmp151_ = _data_->_tmp150_->domain;
				_data_->_tmp152_ = NULL;
				_data_->_tmp152_ = _data_->_vala1_e;
				_data_->_tmp153_ = 0;
				_data_->_tmp153_ = _data_->_tmp152_->code;
				_data_->_tmp154_ = NULL;
				_data_->_tmp154_ = _data_->ind;
				_data_->_tmp155_ = NULL;
				_data_->_tmp155_ = folks_individual_get_id (_data_->_tmp154_);
				_data_->_tmp156_ = NULL;
				_data_->_tmp156_ = _data_->_tmp155_;
				_data_->_tmp157_ = NULL;
				_data_->_tmp157_ = _data_->_vala1_e;
				_data_->_tmp158_ = NULL;
				_data_->_tmp158_ = _data_->_tmp157_->message;
				folks_inspect_utils_print_line ("Error (domain: %u, code: %u) unlinking " "individual '%s': %s", _data_->_tmp151_, _data_->_tmp153_, _data_->_tmp156_, _data_->_tmp158_);
				_data_->result = 1;
				_g_error_free0 (_data_->_vala1_e);
				_g_object_unref0 (_data_->ind);
				_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
				if (_data_->_state_ == 0) {
					g_simple_async_result_complete_in_idle (_data_->_async_result);
				} else {
					g_simple_async_result_complete (_data_->_async_result);
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			__finally1:
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				_g_object_unref0 (_data_->ind);
				_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
				g_clear_error (&_data_->_inner_error_);
				return FALSE;
			}
			_data_->_tmp159_ = NULL;
			_data_->_tmp159_ = _data_->ind;
			_data_->_tmp160_ = NULL;
			_data_->_tmp160_ = folks_individual_get_id (_data_->_tmp159_);
			_data_->_tmp161_ = NULL;
			_data_->_tmp161_ = _data_->_tmp160_;
			folks_inspect_utils_print_line ("Unlinking of individual '%s' was successful.", _data_->_tmp161_);
			_g_object_unref0 (_data_->ind);
		} else {
			g_assert_not_reached ();
		}
	}
	_data_->result = 0;
	_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static gchar* _folks_inspect_utils_persona_uid_completion_cb_rl_compentry_func_t (const gchar* str, gint a) {
	gchar* result;
	result = folks_inspect_utils_persona_uid_completion_cb (str, a);
	return result;
}


static gchar** _vala_array_dup4 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_ = NULL;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static gchar* _folks_inspect_utils_individual_id_completion_cb_rl_compentry_func_t (const gchar* str, gint a) {
	gchar* result;
	result = folks_inspect_utils_individual_id_completion_cb (str, a);
	return result;
}


static gchar** _vala_array_dup5 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_ = NULL;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static gchar* string_slice (const gchar* self, glong start, glong end) {
	gchar* result = NULL;
	glong string_length = 0L;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	glong _tmp2_ = 0L;
	glong _tmp5_ = 0L;
	gboolean _tmp8_ = FALSE;
	glong _tmp9_ = 0L;
	gboolean _tmp12_ = FALSE;
	glong _tmp13_ = 0L;
	glong _tmp16_ = 0L;
	glong _tmp17_ = 0L;
	glong _tmp18_ = 0L;
	glong _tmp19_ = 0L;
	glong _tmp20_ = 0L;
	gchar* _tmp21_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	_tmp2_ = start;
	if (_tmp2_ < ((glong) 0)) {
		glong _tmp3_ = 0L;
		glong _tmp4_ = 0L;
		_tmp3_ = string_length;
		_tmp4_ = start;
		start = _tmp3_ + _tmp4_;
	}
	_tmp5_ = end;
	if (_tmp5_ < ((glong) 0)) {
		glong _tmp6_ = 0L;
		glong _tmp7_ = 0L;
		_tmp6_ = string_length;
		_tmp7_ = end;
		end = _tmp6_ + _tmp7_;
	}
	_tmp9_ = start;
	if (_tmp9_ >= ((glong) 0)) {
		glong _tmp10_ = 0L;
		glong _tmp11_ = 0L;
		_tmp10_ = start;
		_tmp11_ = string_length;
		_tmp8_ = _tmp10_ <= _tmp11_;
	} else {
		_tmp8_ = FALSE;
	}
	g_return_val_if_fail (_tmp8_, NULL);
	_tmp13_ = end;
	if (_tmp13_ >= ((glong) 0)) {
		glong _tmp14_ = 0L;
		glong _tmp15_ = 0L;
		_tmp14_ = end;
		_tmp15_ = string_length;
		_tmp12_ = _tmp14_ <= _tmp15_;
	} else {
		_tmp12_ = FALSE;
	}
	g_return_val_if_fail (_tmp12_, NULL);
	_tmp16_ = start;
	_tmp17_ = end;
	g_return_val_if_fail (_tmp16_ <= _tmp17_, NULL);
	_tmp18_ = start;
	_tmp19_ = end;
	_tmp20_ = start;
	_tmp21_ = g_strndup (((gchar*) self) + _tmp18_, (gsize) (_tmp19_ - _tmp20_));
	result = _tmp21_;
	return result;
}


static gchar** _vala_array_dup6 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_ = NULL;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static gchar** _vala_array_dup7 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_ = NULL;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


gchar* folks_inspect_commands_linking_subcommand_name_completion_cb (const gchar* word, gint state) {
	gchar* result = NULL;
	gint _tmp0_ = 0;
	gchar* _tmp64_ = NULL;
	g_return_val_if_fail (word != NULL, NULL);
	_tmp0_ = state;
	if (_tmp0_ == 0) {
		gchar** parts = NULL;
		const gchar* _tmp1_ = NULL;
		gchar** _tmp2_ = NULL;
		gchar** _tmp3_ = NULL;
		gint parts_length1 = 0;
		gint _parts_size_ = 0;
		gboolean _tmp4_ = FALSE;
		gchar** _tmp5_ = NULL;
		gint _tmp5__length1 = 0;
		_tmp1_ = word;
		_tmp3_ = _tmp2_ = g_strsplit (_tmp1_, " ", 0);
		parts = _tmp3_;
		parts_length1 = _vala_array_length (_tmp2_);
		_parts_size_ = parts_length1;
		_tmp5_ = parts;
		_tmp5__length1 = parts_length1;
		if (_tmp5__length1 > 0) {
			gboolean _tmp6_ = FALSE;
			gchar** _tmp7_ = NULL;
			gint _tmp7__length1 = 0;
			const gchar* _tmp8_ = NULL;
			_tmp7_ = parts;
			_tmp7__length1 = parts_length1;
			_tmp8_ = _tmp7_[0];
			if (g_strcmp0 (_tmp8_, "link-personas") == 0) {
				_tmp6_ = TRUE;
			} else {
				gchar** _tmp9_ = NULL;
				gint _tmp9__length1 = 0;
				const gchar* _tmp10_ = NULL;
				_tmp9_ = parts;
				_tmp9__length1 = parts_length1;
				_tmp10_ = _tmp9_[0];
				_tmp6_ = g_strcmp0 (_tmp10_, "link-individuals") == 0;
			}
			_tmp4_ = _tmp6_;
		} else {
			_tmp4_ = FALSE;
		}
		if (_tmp4_) {
			gchar* last_part = NULL;
			gchar** _tmp11_ = NULL;
			gint _tmp11__length1 = 0;
			gchar** _tmp12_ = NULL;
			gint _tmp12__length1 = 0;
			const gchar* _tmp13_ = NULL;
			gchar* _tmp14_ = NULL;
			gchar** _tmp15_ = NULL;
			gint _tmp15__length1 = 0;
			const gchar* _tmp16_ = NULL;
			const gchar* _tmp25_ = NULL;
			_tmp11_ = parts;
			_tmp11__length1 = parts_length1;
			_tmp12_ = parts;
			_tmp12__length1 = parts_length1;
			_tmp13_ = _tmp11_[_tmp12__length1 - 1];
			_tmp14_ = g_strdup (_tmp13_);
			last_part = _tmp14_;
			_tmp15_ = parts;
			_tmp15__length1 = parts_length1;
			_tmp16_ = _tmp15_[0];
			if (g_strcmp0 (_tmp16_, "link-personas") == 0) {
				const gchar* _tmp17_ = NULL;
				gchar** _tmp18_ = NULL;
				gchar** _tmp19_ = NULL;
				gchar** _tmp20_ = NULL;
				gint _tmp20__length1 = 0;
				_tmp17_ = last_part;
				_tmp19_ = _tmp18_ = rl_completion_matches (_tmp17_, _folks_inspect_utils_persona_uid_completion_cb_rl_compentry_func_t);
				_tmp20_ = (_tmp19_ != NULL) ? _vala_array_dup4 (_tmp19_, _vala_array_length (_tmp18_)) : ((gpointer) _tmp19_);
				_tmp20__length1 = _vala_array_length (_tmp18_);
				folks_inspect_commands_linking_subcommand_completions = (_vala_array_free (folks_inspect_commands_linking_subcommand_completions, _vala_array_length (folks_inspect_commands_linking_subcommand_completions), (GDestroyNotify) g_free), NULL);
				folks_inspect_commands_linking_subcommand_completions = _tmp20_;
			} else {
				const gchar* _tmp21_ = NULL;
				gchar** _tmp22_ = NULL;
				gchar** _tmp23_ = NULL;
				gchar** _tmp24_ = NULL;
				gint _tmp24__length1 = 0;
				_tmp21_ = last_part;
				_tmp23_ = _tmp22_ = rl_completion_matches (_tmp21_, _folks_inspect_utils_individual_id_completion_cb_rl_compentry_func_t);
				_tmp24_ = (_tmp23_ != NULL) ? _vala_array_dup5 (_tmp23_, _vala_array_length (_tmp22_)) : ((gpointer) _tmp23_);
				_tmp24__length1 = _vala_array_length (_tmp22_);
				folks_inspect_commands_linking_subcommand_completions = (_vala_array_free (folks_inspect_commands_linking_subcommand_completions, _vala_array_length (folks_inspect_commands_linking_subcommand_completions), (GDestroyNotify) g_free), NULL);
				folks_inspect_commands_linking_subcommand_completions = _tmp24_;
			}
			_tmp25_ = last_part;
			if (g_strcmp0 (_tmp25_, "") == 0) {
				const gchar* _tmp26_ = NULL;
				gchar* _tmp27_ = NULL;
				_tmp26_ = word;
				_tmp27_ = g_strdup (_tmp26_);
				_g_free0 (folks_inspect_commands_linking_prefix);
				folks_inspect_commands_linking_prefix = _tmp27_;
			} else {
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_ = NULL;
				gint _tmp30_ = 0;
				gint _tmp31_ = 0;
				gchar* _tmp32_ = NULL;
				_tmp28_ = word;
				_tmp29_ = last_part;
				_tmp30_ = strlen (_tmp29_);
				_tmp31_ = _tmp30_;
				_tmp32_ = string_slice (_tmp28_, (glong) 0, (glong) (-_tmp31_));
				_g_free0 (folks_inspect_commands_linking_prefix);
				folks_inspect_commands_linking_prefix = _tmp32_;
			}
			_g_free0 (last_part);
		} else {
			gboolean _tmp33_ = FALSE;
			gchar** _tmp34_ = NULL;
			gint _tmp34__length1 = 0;
			_tmp34_ = parts;
			_tmp34__length1 = parts_length1;
			if (_tmp34__length1 > 0) {
				gchar** _tmp35_ = NULL;
				gint _tmp35__length1 = 0;
				const gchar* _tmp36_ = NULL;
				_tmp35_ = parts;
				_tmp35__length1 = parts_length1;
				_tmp36_ = _tmp35_[0];
				_tmp33_ = g_strcmp0 (_tmp36_, "unlink-individual") == 0;
			} else {
				_tmp33_ = FALSE;
			}
			if (_tmp33_) {
				gchar** _tmp37_ = NULL;
				gint _tmp37__length1 = 0;
				gchar** _tmp39_ = NULL;
				gint _tmp39__length1 = 0;
				const gchar* _tmp40_ = NULL;
				gchar** _tmp41_ = NULL;
				gchar** _tmp42_ = NULL;
				gchar** _tmp43_ = NULL;
				gint _tmp43__length1 = 0;
				gchar* _tmp44_ = NULL;
				_tmp37_ = parts;
				_tmp37__length1 = parts_length1;
				if (_tmp37__length1 != 2) {
					gchar* _tmp38_ = NULL;
					folks_inspect_commands_linking_subcommand_completions = (_vala_array_free (folks_inspect_commands_linking_subcommand_completions, _vala_array_length (folks_inspect_commands_linking_subcommand_completions), (GDestroyNotify) g_free), NULL);
					folks_inspect_commands_linking_subcommand_completions = NULL;
					folks_inspect_commands_linking_completion_count = (guint) 0;
					_tmp38_ = g_strdup ("");
					_g_free0 (folks_inspect_commands_linking_prefix);
					folks_inspect_commands_linking_prefix = _tmp38_;
					result = NULL;
					parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
					return result;
				}
				_tmp39_ = parts;
				_tmp39__length1 = parts_length1;
				_tmp40_ = _tmp39_[1];
				_tmp42_ = _tmp41_ = rl_completion_matches (_tmp40_, _folks_inspect_utils_individual_id_completion_cb_rl_compentry_func_t);
				_tmp43_ = (_tmp42_ != NULL) ? _vala_array_dup6 (_tmp42_, _vala_array_length (_tmp41_)) : ((gpointer) _tmp42_);
				_tmp43__length1 = _vala_array_length (_tmp41_);
				folks_inspect_commands_linking_subcommand_completions = (_vala_array_free (folks_inspect_commands_linking_subcommand_completions, _vala_array_length (folks_inspect_commands_linking_subcommand_completions), (GDestroyNotify) g_free), NULL);
				folks_inspect_commands_linking_subcommand_completions = _tmp43_;
				_tmp44_ = g_strdup ("unlink-individual ");
				_g_free0 (folks_inspect_commands_linking_prefix);
				folks_inspect_commands_linking_prefix = _tmp44_;
			} else {
				gchar** _tmp45_ = NULL;
				gint _tmp45__length1 = 0;
				gchar* _tmp46_ = NULL;
				_tmp45_ = (FOLKS_INSPECT_COMMANDS_LINKING__valid_subcommands != NULL) ? _vala_array_dup7 (FOLKS_INSPECT_COMMANDS_LINKING__valid_subcommands, G_N_ELEMENTS (FOLKS_INSPECT_COMMANDS_LINKING__valid_subcommands)) : ((gpointer) FOLKS_INSPECT_COMMANDS_LINKING__valid_subcommands);
				_tmp45__length1 = G_N_ELEMENTS (FOLKS_INSPECT_COMMANDS_LINKING__valid_subcommands);
				folks_inspect_commands_linking_subcommand_completions = (_vala_array_free (folks_inspect_commands_linking_subcommand_completions, _vala_array_length (folks_inspect_commands_linking_subcommand_completions), (GDestroyNotify) g_free), NULL);
				folks_inspect_commands_linking_subcommand_completions = _tmp45_;
				_tmp46_ = g_strdup ("");
				_g_free0 (folks_inspect_commands_linking_prefix);
				folks_inspect_commands_linking_prefix = _tmp46_;
			}
		}
		folks_inspect_commands_linking_completion_count = (guint) 0;
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	}
	while (TRUE) {
		guint _tmp47_ = 0U;
		gchar** _tmp48_ = NULL;
		gint _tmp48__length1 = 0;
		gchar* completion = NULL;
		gchar** _tmp49_ = NULL;
		gint _tmp49__length1 = 0;
		guint _tmp50_ = 0U;
		const gchar* _tmp51_ = NULL;
		gchar* _tmp52_ = NULL;
		gchar* candidate = NULL;
		const gchar* _tmp53_ = NULL;
		const gchar* _tmp54_ = NULL;
		gchar* _tmp55_ = NULL;
		guint _tmp56_ = 0U;
		gboolean _tmp57_ = FALSE;
		gboolean _tmp58_ = FALSE;
		const gchar* _tmp59_ = NULL;
		_tmp47_ = folks_inspect_commands_linking_completion_count;
		_tmp48_ = folks_inspect_commands_linking_subcommand_completions;
		_tmp48__length1 = _vala_array_length (folks_inspect_commands_linking_subcommand_completions);
		if (!(_tmp47_ < ((guint) _tmp48__length1))) {
			break;
		}
		_tmp49_ = folks_inspect_commands_linking_subcommand_completions;
		_tmp49__length1 = _vala_array_length (folks_inspect_commands_linking_subcommand_completions);
		_tmp50_ = folks_inspect_commands_linking_completion_count;
		_tmp51_ = _tmp49_[_tmp50_];
		_tmp52_ = g_strdup (_tmp51_);
		completion = _tmp52_;
		_tmp53_ = folks_inspect_commands_linking_prefix;
		_tmp54_ = completion;
		_tmp55_ = g_strconcat (_tmp53_, _tmp54_, NULL);
		candidate = _tmp55_;
		_tmp56_ = folks_inspect_commands_linking_completion_count;
		folks_inspect_commands_linking_completion_count = _tmp56_ + 1;
		_tmp59_ = completion;
		if (_tmp59_ != NULL) {
			const gchar* _tmp60_ = NULL;
			_tmp60_ = completion;
			_tmp58_ = g_strcmp0 (_tmp60_, "") != 0;
		} else {
			_tmp58_ = FALSE;
		}
		if (_tmp58_) {
			const gchar* _tmp61_ = NULL;
			const gchar* _tmp62_ = NULL;
			gboolean _tmp63_ = FALSE;
			_tmp61_ = candidate;
			_tmp62_ = word;
			_tmp63_ = g_str_has_prefix (_tmp61_, _tmp62_);
			_tmp57_ = _tmp63_;
		} else {
			_tmp57_ = FALSE;
		}
		if (_tmp57_) {
			result = completion;
			_g_free0 (candidate);
			return result;
		}
		_g_free0 (candidate);
		_g_free0 (completion);
	}
	folks_inspect_commands_linking_subcommand_completions = (_vala_array_free (folks_inspect_commands_linking_subcommand_completions, _vala_array_length (folks_inspect_commands_linking_subcommand_completions), (GDestroyNotify) g_free), NULL);
	folks_inspect_commands_linking_subcommand_completions = NULL;
	folks_inspect_commands_linking_completion_count = (guint) 0;
	_tmp64_ = g_strdup ("");
	_g_free0 (folks_inspect_commands_linking_prefix);
	folks_inspect_commands_linking_prefix = _tmp64_;
	result = NULL;
	return result;
}


static gchar* _folks_inspect_commands_linking_subcommand_name_completion_cb_rl_compentry_func_t (const gchar* str, gint a) {
	gchar* result;
	result = folks_inspect_commands_linking_subcommand_name_completion_cb (str, a);
	return result;
}


static gchar** _vala_array_dup8 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_ = NULL;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static gchar** folks_inspect_commands_linking_real_complete_subcommand (FolksInspectCommand* base, const gchar* subcommand, int* result_length1) {
	FolksInspectCommandsLinking * self;
	gchar** result = NULL;
	const gchar* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gchar** _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	gchar** _tmp4_ = NULL;
	gint _tmp4__length1 = 0;
	self = (FolksInspectCommandsLinking*) base;
	g_return_val_if_fail (subcommand != NULL, NULL);
	_tmp0_ = subcommand;
	_tmp2_ = _tmp1_ = rl_completion_matches (_tmp0_, _folks_inspect_commands_linking_subcommand_name_completion_cb_rl_compentry_func_t);
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup8 (_tmp2_, _vala_array_length (_tmp1_)) : ((gpointer) _tmp2_);
	_tmp3__length1 = _vala_array_length (_tmp1_);
	_tmp4_ = _tmp3_;
	_tmp4__length1 = _tmp3__length1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	return result;
}


static const gchar* folks_inspect_commands_linking_real_get_name (FolksInspectCommand* base) {
	const gchar* result;
	FolksInspectCommandsLinking* self;
	self = (FolksInspectCommandsLinking*) base;
	result = "linking";
	return result;
}


static const gchar* folks_inspect_commands_linking_real_get_description (FolksInspectCommand* base) {
	const gchar* result;
	FolksInspectCommandsLinking* self;
	self = (FolksInspectCommandsLinking*) base;
	result = "Link and unlink personas";
	return result;
}


static const gchar* folks_inspect_commands_linking_real_get_help (FolksInspectCommand* base) {
	const gchar* result;
	FolksInspectCommandsLinking* self;
	self = (FolksInspectCommandsLinking*) base;
	result = "linking link-personas [persona 1 UID] " "[persona 2 UID] …           " "Link the given personas.\n" "linking link-individuals [individual 1 ID] " "[individual 2 ID] …    " "Link the personas in the given individuals.\n" "linking unlink-individual " "[individual ID]                         " "Unlink the given individual.";
	return result;
}


static void folks_inspect_commands_linking_class_init (FolksInspectCommandsLinkingClass * klass) {
	folks_inspect_commands_linking_parent_class = g_type_class_peek_parent (klass);
	((FolksInspectCommandClass *) klass)->finalize = folks_inspect_commands_linking_finalize;
	((FolksInspectCommandClass *) klass)->run = folks_inspect_commands_linking_real_run;
	((FolksInspectCommandClass *) klass)->run_finish = folks_inspect_commands_linking_real_run_finish;
	((FolksInspectCommandClass *) klass)->complete_subcommand = folks_inspect_commands_linking_real_complete_subcommand;
	FOLKS_INSPECT_COMMAND_CLASS (klass)->get_name = folks_inspect_commands_linking_real_get_name;
	FOLKS_INSPECT_COMMAND_CLASS (klass)->get_description = folks_inspect_commands_linking_real_get_description;
	FOLKS_INSPECT_COMMAND_CLASS (klass)->get_help = folks_inspect_commands_linking_real_get_help;
}


static void folks_inspect_commands_linking_instance_init (FolksInspectCommandsLinking * self) {
}


static void folks_inspect_commands_linking_finalize (FolksInspectCommand* obj) {
	FolksInspectCommandsLinking * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLKS_INSPECT_COMMANDS_TYPE_LINKING, FolksInspectCommandsLinking);
	FOLKS_INSPECT_COMMAND_CLASS (folks_inspect_commands_linking_parent_class)->finalize (obj);
}


GType folks_inspect_commands_linking_get_type (void) {
	static volatile gsize folks_inspect_commands_linking_type_id__volatile = 0;
	if (g_once_init_enter (&folks_inspect_commands_linking_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FolksInspectCommandsLinkingClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_inspect_commands_linking_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksInspectCommandsLinking), 0, (GInstanceInitFunc) folks_inspect_commands_linking_instance_init, NULL };
		GType folks_inspect_commands_linking_type_id;
		folks_inspect_commands_linking_type_id = g_type_register_static (FOLKS_INSPECT_TYPE_COMMAND, "FolksInspectCommandsLinking", &g_define_type_info, 0);
		g_once_init_leave (&folks_inspect_commands_linking_type_id__volatile, folks_inspect_commands_linking_type_id);
	}
	return folks_inspect_commands_linking_type_id__volatile;
}


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;
}



