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

/*
 * Copyright (C) 2010 Collabora Ltd.
 *
 * 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.withnall@collabora.co.uk>
 */

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


#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;
typedef struct _FolksInspectClientPrivate FolksInspectClientPrivate;

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

#define FOLKS_INSPECT_TYPE_SIGNAL_MANAGER (folks_inspect_signal_manager_get_type ())
#define FOLKS_INSPECT_SIGNAL_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_TYPE_SIGNAL_MANAGER, FolksInspectSignalManager))
#define FOLKS_INSPECT_SIGNAL_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_TYPE_SIGNAL_MANAGER, FolksInspectSignalManagerClass))
#define FOLKS_INSPECT_IS_SIGNAL_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_TYPE_SIGNAL_MANAGER))
#define FOLKS_INSPECT_IS_SIGNAL_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_TYPE_SIGNAL_MANAGER))
#define FOLKS_INSPECT_SIGNAL_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_TYPE_SIGNAL_MANAGER, FolksInspectSignalManagerClass))

typedef struct _FolksInspectSignalManager FolksInspectSignalManager;
typedef struct _FolksInspectSignalManagerClass FolksInspectSignalManagerClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define FOLKS_INSPECT_COMMANDS_TYPE_QUIT (folks_inspect_commands_quit_get_type ())
#define FOLKS_INSPECT_COMMANDS_QUIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_COMMANDS_TYPE_QUIT, FolksInspectCommandsQuit))
#define FOLKS_INSPECT_COMMANDS_QUIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_COMMANDS_TYPE_QUIT, FolksInspectCommandsQuitClass))
#define FOLKS_INSPECT_COMMANDS_IS_QUIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_COMMANDS_TYPE_QUIT))
#define FOLKS_INSPECT_COMMANDS_IS_QUIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_COMMANDS_TYPE_QUIT))
#define FOLKS_INSPECT_COMMANDS_QUIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_COMMANDS_TYPE_QUIT, FolksInspectCommandsQuitClass))

typedef struct _FolksInspectCommandsQuit FolksInspectCommandsQuit;
typedef struct _FolksInspectCommandsQuitClass FolksInspectCommandsQuitClass;
#define _folks_inspect_command_unref0(var) ((var == NULL) ? NULL : (var = (folks_inspect_command_unref (var), NULL)))

#define FOLKS_INSPECT_COMMANDS_TYPE_HELP (folks_inspect_commands_help_get_type ())
#define FOLKS_INSPECT_COMMANDS_HELP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_COMMANDS_TYPE_HELP, FolksInspectCommandsHelp))
#define FOLKS_INSPECT_COMMANDS_HELP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_COMMANDS_TYPE_HELP, FolksInspectCommandsHelpClass))
#define FOLKS_INSPECT_COMMANDS_IS_HELP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_COMMANDS_TYPE_HELP))
#define FOLKS_INSPECT_COMMANDS_IS_HELP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_COMMANDS_TYPE_HELP))
#define FOLKS_INSPECT_COMMANDS_HELP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_COMMANDS_TYPE_HELP, FolksInspectCommandsHelpClass))

typedef struct _FolksInspectCommandsHelp FolksInspectCommandsHelp;
typedef struct _FolksInspectCommandsHelpClass FolksInspectCommandsHelpClass;

#define FOLKS_INSPECT_COMMANDS_TYPE_INDIVIDUALS (folks_inspect_commands_individuals_get_type ())
#define FOLKS_INSPECT_COMMANDS_INDIVIDUALS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_COMMANDS_TYPE_INDIVIDUALS, FolksInspectCommandsIndividuals))
#define FOLKS_INSPECT_COMMANDS_INDIVIDUALS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_COMMANDS_TYPE_INDIVIDUALS, FolksInspectCommandsIndividualsClass))
#define FOLKS_INSPECT_COMMANDS_IS_INDIVIDUALS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_COMMANDS_TYPE_INDIVIDUALS))
#define FOLKS_INSPECT_COMMANDS_IS_INDIVIDUALS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_COMMANDS_TYPE_INDIVIDUALS))
#define FOLKS_INSPECT_COMMANDS_INDIVIDUALS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_COMMANDS_TYPE_INDIVIDUALS, FolksInspectCommandsIndividualsClass))

typedef struct _FolksInspectCommandsIndividuals FolksInspectCommandsIndividuals;
typedef struct _FolksInspectCommandsIndividualsClass FolksInspectCommandsIndividualsClass;

#define FOLKS_INSPECT_COMMANDS_TYPE_PERSONAS (folks_inspect_commands_personas_get_type ())
#define FOLKS_INSPECT_COMMANDS_PERSONAS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_COMMANDS_TYPE_PERSONAS, FolksInspectCommandsPersonas))
#define FOLKS_INSPECT_COMMANDS_PERSONAS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_COMMANDS_TYPE_PERSONAS, FolksInspectCommandsPersonasClass))
#define FOLKS_INSPECT_COMMANDS_IS_PERSONAS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_COMMANDS_TYPE_PERSONAS))
#define FOLKS_INSPECT_COMMANDS_IS_PERSONAS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_COMMANDS_TYPE_PERSONAS))
#define FOLKS_INSPECT_COMMANDS_PERSONAS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_COMMANDS_TYPE_PERSONAS, FolksInspectCommandsPersonasClass))

typedef struct _FolksInspectCommandsPersonas FolksInspectCommandsPersonas;
typedef struct _FolksInspectCommandsPersonasClass FolksInspectCommandsPersonasClass;

#define FOLKS_INSPECT_COMMANDS_TYPE_BACKENDS (folks_inspect_commands_backends_get_type ())
#define FOLKS_INSPECT_COMMANDS_BACKENDS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_COMMANDS_TYPE_BACKENDS, FolksInspectCommandsBackends))
#define FOLKS_INSPECT_COMMANDS_BACKENDS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_COMMANDS_TYPE_BACKENDS, FolksInspectCommandsBackendsClass))
#define FOLKS_INSPECT_COMMANDS_IS_BACKENDS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_COMMANDS_TYPE_BACKENDS))
#define FOLKS_INSPECT_COMMANDS_IS_BACKENDS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_COMMANDS_TYPE_BACKENDS))
#define FOLKS_INSPECT_COMMANDS_BACKENDS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_COMMANDS_TYPE_BACKENDS, FolksInspectCommandsBackendsClass))

typedef struct _FolksInspectCommandsBackends FolksInspectCommandsBackends;
typedef struct _FolksInspectCommandsBackendsClass FolksInspectCommandsBackendsClass;

#define FOLKS_INSPECT_COMMANDS_TYPE_PERSONA_STORES (folks_inspect_commands_persona_stores_get_type ())
#define FOLKS_INSPECT_COMMANDS_PERSONA_STORES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_COMMANDS_TYPE_PERSONA_STORES, FolksInspectCommandsPersonaStores))
#define FOLKS_INSPECT_COMMANDS_PERSONA_STORES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_COMMANDS_TYPE_PERSONA_STORES, FolksInspectCommandsPersonaStoresClass))
#define FOLKS_INSPECT_COMMANDS_IS_PERSONA_STORES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_COMMANDS_TYPE_PERSONA_STORES))
#define FOLKS_INSPECT_COMMANDS_IS_PERSONA_STORES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_COMMANDS_TYPE_PERSONA_STORES))
#define FOLKS_INSPECT_COMMANDS_PERSONA_STORES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_COMMANDS_TYPE_PERSONA_STORES, FolksInspectCommandsPersonaStoresClass))

typedef struct _FolksInspectCommandsPersonaStores FolksInspectCommandsPersonaStores;
typedef struct _FolksInspectCommandsPersonaStoresClass FolksInspectCommandsPersonaStoresClass;

#define FOLKS_INSPECT_COMMANDS_TYPE_SIGNALS (folks_inspect_commands_signals_get_type ())
#define FOLKS_INSPECT_COMMANDS_SIGNALS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_COMMANDS_TYPE_SIGNALS, FolksInspectCommandsSignals))
#define FOLKS_INSPECT_COMMANDS_SIGNALS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_COMMANDS_TYPE_SIGNALS, FolksInspectCommandsSignalsClass))
#define FOLKS_INSPECT_COMMANDS_IS_SIGNALS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_COMMANDS_TYPE_SIGNALS))
#define FOLKS_INSPECT_COMMANDS_IS_SIGNALS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_COMMANDS_TYPE_SIGNALS))
#define FOLKS_INSPECT_COMMANDS_SIGNALS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_COMMANDS_TYPE_SIGNALS, FolksInspectCommandsSignalsClass))

typedef struct _FolksInspectCommandsSignals FolksInspectCommandsSignals;
typedef struct _FolksInspectCommandsSignalsClass FolksInspectCommandsSignalsClass;

#define FOLKS_INSPECT_COMMANDS_TYPE_DEBUG (folks_inspect_commands_debug_get_type ())
#define FOLKS_INSPECT_COMMANDS_DEBUG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_INSPECT_COMMANDS_TYPE_DEBUG, FolksInspectCommandsDebug))
#define FOLKS_INSPECT_COMMANDS_DEBUG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_INSPECT_COMMANDS_TYPE_DEBUG, FolksInspectCommandsDebugClass))
#define FOLKS_INSPECT_COMMANDS_IS_DEBUG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_INSPECT_COMMANDS_TYPE_DEBUG))
#define FOLKS_INSPECT_COMMANDS_IS_DEBUG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_INSPECT_COMMANDS_TYPE_DEBUG))
#define FOLKS_INSPECT_COMMANDS_DEBUG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_INSPECT_COMMANDS_TYPE_DEBUG, FolksInspectCommandsDebugClass))

typedef struct _FolksInspectCommandsDebug FolksInspectCommandsDebug;
typedef struct _FolksInspectCommandsDebugClass FolksInspectCommandsDebugClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _FolksInspectCommandPrivate FolksInspectCommandPrivate;
typedef struct _FolksInspectParamSpecCommand FolksInspectParamSpecCommand;

struct _FolksInspectClient {
	GObject parent_instance;
	FolksInspectClientPrivate * priv;
	GeeHashMap* commands;
};

struct _FolksInspectClientClass {
	GObjectClass parent_class;
};

struct _FolksInspectClientPrivate {
	GMainLoop* main_loop;
	GThread* folks_thread;
	FolksIndividualAggregator* _aggregator;
	FolksBackendStore* _backend_store;
	FolksInspectSignalManager* _signal_manager;
};

struct _Block1Data {
	int _ref_count_;
	FolksInspectClient * self;
	FolksBackend* backend;
};

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);
	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 _FolksInspectParamSpecCommand {
	GParamSpec parent_instance;
};


extern FolksInspectClient* main_client;
FolksInspectClient* main_client = NULL;
static gpointer folks_inspect_client_parent_class = NULL;
static gpointer folks_inspect_command_parent_class = NULL;

GType folks_inspect_client_get_type (void) G_GNUC_CONST;
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_signal_manager_get_type (void) G_GNUC_CONST;
#define FOLKS_INSPECT_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FOLKS_INSPECT_TYPE_CLIENT, FolksInspectClientPrivate))
enum  {
	FOLKS_INSPECT_CLIENT_DUMMY_PROPERTY,
	FOLKS_INSPECT_CLIENT_AGGREGATOR,
	FOLKS_INSPECT_CLIENT_BACKEND_STORE,
	FOLKS_INSPECT_CLIENT_SIGNAL_MANAGER
};
gint folks_inspect_client_main (gchar** args, int args_length1);
FolksInspectClient* folks_inspect_client_new (void);
FolksInspectClient* folks_inspect_client_construct (GType object_type);
void folks_inspect_client_run_interactive (FolksInspectClient* self);
static void* folks_inspect_client_folks_thread_main (FolksInspectClient* self);
FolksInspectSignalManager* folks_inspect_signal_manager_new (void);
FolksInspectSignalManager* folks_inspect_signal_manager_construct (GType object_type);
static void folks_inspect_client_set_signal_manager (FolksInspectClient* self, FolksInspectSignalManager* value);
static void folks_inspect_client_set_aggregator (FolksInspectClient* self, FolksIndividualAggregator* value);
FolksIndividualAggregator* folks_inspect_client_get_aggregator (FolksInspectClient* self);
static void folks_inspect_client_set_backend_store (FolksInspectClient* self, FolksBackendStore* value);
FolksBackendStore* folks_inspect_client_get_backend_store (FolksInspectClient* self);
static void _lambda0_ (FolksBackendStore* bs, FolksBackend* b, FolksInspectClient* self);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (Block1Data* _data1_);
static void _lambda1_ (GObject* obj, GAsyncResult* _result_, Block1Data* _data1_);
static void __lambda1__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static void __lambda0__folks_backend_store_backend_available (FolksBackendStore* _sender, FolksBackend* backend, gpointer self);
void folks_inspect_utils_init (void);
FolksInspectCommandsQuit* folks_inspect_commands_quit_new (FolksInspectClient* client);
FolksInspectCommandsQuit* folks_inspect_commands_quit_construct (GType object_type, FolksInspectClient* client);
GType folks_inspect_commands_quit_get_type (void) G_GNUC_CONST;
FolksInspectCommandsHelp* folks_inspect_commands_help_new (FolksInspectClient* client);
FolksInspectCommandsHelp* folks_inspect_commands_help_construct (GType object_type, FolksInspectClient* client);
GType folks_inspect_commands_help_get_type (void) G_GNUC_CONST;
FolksInspectCommandsIndividuals* folks_inspect_commands_individuals_new (FolksInspectClient* client);
FolksInspectCommandsIndividuals* folks_inspect_commands_individuals_construct (GType object_type, FolksInspectClient* client);
GType folks_inspect_commands_individuals_get_type (void) G_GNUC_CONST;
FolksInspectCommandsPersonas* folks_inspect_commands_personas_new (FolksInspectClient* client);
FolksInspectCommandsPersonas* folks_inspect_commands_personas_construct (GType object_type, FolksInspectClient* client);
GType folks_inspect_commands_personas_get_type (void) G_GNUC_CONST;
FolksInspectCommandsBackends* folks_inspect_commands_backends_new (FolksInspectClient* client);
FolksInspectCommandsBackends* folks_inspect_commands_backends_construct (GType object_type, FolksInspectClient* client);
GType folks_inspect_commands_backends_get_type (void) G_GNUC_CONST;
FolksInspectCommandsPersonaStores* folks_inspect_commands_persona_stores_new (FolksInspectClient* client);
FolksInspectCommandsPersonaStores* folks_inspect_commands_persona_stores_construct (GType object_type, FolksInspectClient* client);
GType folks_inspect_commands_persona_stores_get_type (void) G_GNUC_CONST;
FolksInspectCommandsSignals* folks_inspect_commands_signals_new (FolksInspectClient* client);
FolksInspectCommandsSignals* folks_inspect_commands_signals_construct (GType object_type, FolksInspectClient* client);
GType folks_inspect_commands_signals_get_type (void) G_GNUC_CONST;
FolksInspectCommandsDebug* folks_inspect_commands_debug_new (FolksInspectClient* client);
FolksInspectCommandsDebug* folks_inspect_commands_debug_construct (GType object_type, FolksInspectClient* client);
GType folks_inspect_commands_debug_get_type (void) G_GNUC_CONST;
static gpointer _folks_inspect_client_folks_thread_main_gthread_func (gpointer self);
static gchar** folks_inspect_client_completion_cb (const gchar* word, gint start, gint end);
static gchar** _folks_inspect_client_completion_cb_rl_completion_func_t (const gchar* str, gint a, gint b);
static FolksInspectCommand* folks_inspect_client_parse_command_line (const gchar* command_line, gchar** command_name, gchar** subcommand);
void folks_inspect_command_run (FolksInspectCommand* self, const gchar* command_string);
gchar* folks_inspect_utils_command_name_completion_cb (const gchar* word, gint state);
static gchar* _folks_inspect_utils_command_name_completion_cb_rl_compentry_func_t (const gchar* str, gint a);
static gchar** _vala_array_dup7 (gchar** self, int length);
gchar** folks_inspect_command_complete_subcommand (FolksInspectCommand* self, const gchar* subcommand, int* result_length1);
FolksInspectSignalManager* folks_inspect_client_get_signal_manager (FolksInspectClient* self);
static void folks_inspect_client_finalize (GObject* obj);
static void _vala_folks_inspect_client_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_folks_inspect_client_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
enum  {
	FOLKS_INSPECT_COMMAND_DUMMY_PROPERTY
};
FolksInspectCommand* folks_inspect_command_construct (GType object_type, FolksInspectClient* client);
static void folks_inspect_command_real_run (FolksInspectCommand* self, const gchar* command_string);
static gchar** folks_inspect_command_real_complete_subcommand (FolksInspectCommand* self, const gchar* subcommand, int* result_length1);
const gchar* folks_inspect_command_get_name (FolksInspectCommand* self);
const gchar* folks_inspect_command_get_description (FolksInspectCommand* self);
const gchar* folks_inspect_command_get_help (FolksInspectCommand* self);
static void folks_inspect_command_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);


gint folks_inspect_client_main (gchar** args, int args_length1) {
	gint result = 0;
	FolksInspectClient* _tmp0_ = NULL;
	_tmp0_ = folks_inspect_client_new ();
	_g_object_unref0 (main_client);
	main_client = _tmp0_;
	folks_inspect_client_run_interactive (main_client);
	result = 0;
	return result;
}


int main (int argc, char ** argv) {
	g_type_init ();
	return folks_inspect_client_main (argv, argc);
}


static Block1Data* block1_data_ref (Block1Data* _data1_) {
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}


static void block1_data_unref (Block1Data* _data1_) {
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		_g_object_unref0 (_data1_->self);
		_g_object_unref0 (_data1_->backend);
		g_slice_free (Block1Data, _data1_);
	}
}


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


static void _lambda1_ (GObject* obj, GAsyncResult* _result_, Block1Data* _data1_) {
	FolksInspectClient * self;
	GError * _inner_error_ = NULL;
	self = _data1_->self;
	g_return_if_fail (_result_ != NULL);
	folks_backend_prepare_finish (_data1_->backend, _result_, &_inner_error_);
	if (_inner_error_ != NULL) {
		goto __catch0_g_error;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError * e;
		const gchar* _tmp0_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp0_ = folks_backend_get_name (_data1_->backend);
		g_warning ("inspect.vala:70: Error preparing Backend '%s': %s", _tmp0_, e->message);
		_g_error_free0 (e);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		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);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void __lambda1__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	_lambda1_ (source_object, res, self);
	block1_data_unref (self);
}


static void _lambda0_ (FolksBackendStore* bs, FolksBackend* b, FolksInspectClient* self) {
	Block1Data* _data1_;
	FolksBackend* _tmp0_;
	g_return_if_fail (bs != NULL);
	g_return_if_fail (b != NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (FOLKS_BACKEND (b));
	_data1_->backend = _tmp0_;
	folks_backend_prepare (_data1_->backend, __lambda1__gasync_ready_callback, block1_data_ref (_data1_));
	block1_data_unref (_data1_);
	_data1_ = NULL;
}


static void __lambda0__folks_backend_store_backend_available (FolksBackendStore* _sender, FolksBackend* backend, gpointer self) {
	_lambda0_ (_sender, backend, self);
}


static void* folks_inspect_client_folks_thread_main (FolksInspectClient* self) {
	void* result = NULL;
	GMainLoop* _tmp0_ = NULL;
	FolksInspectSignalManager* _tmp1_ = NULL;
	FolksInspectSignalManager* _tmp2_;
	FolksIndividualAggregator* _tmp3_ = NULL;
	FolksIndividualAggregator* _tmp4_;
	FolksBackendStore* _tmp5_ = NULL;
	FolksBackendStore* _tmp6_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_main_loop_new (NULL, FALSE);
	_g_main_loop_unref0 (self->priv->main_loop);
	self->priv->main_loop = _tmp0_;
	_tmp1_ = folks_inspect_signal_manager_new ();
	_tmp2_ = _tmp1_;
	folks_inspect_client_set_signal_manager (self, _tmp2_);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = folks_individual_aggregator_new ();
	_tmp4_ = _tmp3_;
	folks_inspect_client_set_aggregator (self, _tmp4_);
	_g_object_unref0 (_tmp4_);
	folks_individual_aggregator_prepare (self->priv->_aggregator, NULL, NULL);
	_tmp5_ = folks_backend_store_dup ();
	_tmp6_ = _tmp5_;
	folks_inspect_client_set_backend_store (self, _tmp6_);
	_g_object_unref0 (_tmp6_);
	g_signal_connect_object (self->priv->_backend_store, "backend-available", (GCallback) __lambda0__folks_backend_store_backend_available, self, 0);
	folks_backend_store_load_backends (self->priv->_backend_store, NULL, NULL);
	g_main_loop_run (self->priv->main_loop);
	result = NULL;
	return result;
}


static gpointer _folks_inspect_client_folks_thread_main_gthread_func (gpointer self) {
	gpointer result;
	result = folks_inspect_client_folks_thread_main (self);
	return result;
}


FolksInspectClient* folks_inspect_client_construct (GType object_type) {
	FolksInspectClient * self = NULL;
	GeeHashMap* _tmp0_ = NULL;
	FolksInspectCommandsQuit* _tmp1_ = NULL;
	FolksInspectCommandsQuit* _tmp2_;
	FolksInspectCommandsHelp* _tmp3_ = NULL;
	FolksInspectCommandsHelp* _tmp4_;
	FolksInspectCommandsIndividuals* _tmp5_ = NULL;
	FolksInspectCommandsIndividuals* _tmp6_;
	FolksInspectCommandsPersonas* _tmp7_ = NULL;
	FolksInspectCommandsPersonas* _tmp8_;
	FolksInspectCommandsBackends* _tmp9_ = NULL;
	FolksInspectCommandsBackends* _tmp10_;
	FolksInspectCommandsPersonaStores* _tmp11_ = NULL;
	FolksInspectCommandsPersonaStores* _tmp12_;
	FolksInspectCommandsSignals* _tmp13_ = NULL;
	FolksInspectCommandsSignals* _tmp14_;
	FolksInspectCommandsDebug* _tmp15_ = NULL;
	FolksInspectCommandsDebug* _tmp16_;
	GThread* _tmp17_ = NULL;
	GThread* _tmp18_;
	GError * _inner_error_ = NULL;
	self = (FolksInspectClient*) g_object_new (object_type, NULL);
	folks_inspect_utils_init ();
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, FOLKS_INSPECT_TYPE_COMMAND, (GBoxedCopyFunc) folks_inspect_command_ref, folks_inspect_command_unref, g_str_hash, g_str_equal, NULL);
	_g_object_unref0 (self->commands);
	self->commands = _tmp0_;
	_tmp1_ = folks_inspect_commands_quit_new (self);
	_tmp2_ = _tmp1_;
	gee_abstract_map_set ((GeeAbstractMap*) self->commands, "quit", (FolksInspectCommand*) _tmp2_);
	_folks_inspect_command_unref0 (_tmp2_);
	_tmp3_ = folks_inspect_commands_help_new (self);
	_tmp4_ = _tmp3_;
	gee_abstract_map_set ((GeeAbstractMap*) self->commands, "help", (FolksInspectCommand*) _tmp4_);
	_folks_inspect_command_unref0 (_tmp4_);
	_tmp5_ = folks_inspect_commands_individuals_new (self);
	_tmp6_ = _tmp5_;
	gee_abstract_map_set ((GeeAbstractMap*) self->commands, "individuals", (FolksInspectCommand*) _tmp6_);
	_folks_inspect_command_unref0 (_tmp6_);
	_tmp7_ = folks_inspect_commands_personas_new (self);
	_tmp8_ = _tmp7_;
	gee_abstract_map_set ((GeeAbstractMap*) self->commands, "personas", (FolksInspectCommand*) _tmp8_);
	_folks_inspect_command_unref0 (_tmp8_);
	_tmp9_ = folks_inspect_commands_backends_new (self);
	_tmp10_ = _tmp9_;
	gee_abstract_map_set ((GeeAbstractMap*) self->commands, "backends", (FolksInspectCommand*) _tmp10_);
	_folks_inspect_command_unref0 (_tmp10_);
	_tmp11_ = folks_inspect_commands_persona_stores_new (self);
	_tmp12_ = _tmp11_;
	gee_abstract_map_set ((GeeAbstractMap*) self->commands, "persona-stores", (FolksInspectCommand*) _tmp12_);
	_folks_inspect_command_unref0 (_tmp12_);
	_tmp13_ = folks_inspect_commands_signals_new (self);
	_tmp14_ = _tmp13_;
	gee_abstract_map_set ((GeeAbstractMap*) self->commands, "signals", (FolksInspectCommand*) _tmp14_);
	_folks_inspect_command_unref0 (_tmp14_);
	_tmp15_ = folks_inspect_commands_debug_new (self);
	_tmp16_ = _tmp15_;
	gee_abstract_map_set ((GeeAbstractMap*) self->commands, "debug", (FolksInspectCommand*) _tmp16_);
	_folks_inspect_command_unref0 (_tmp16_);
	_tmp17_ = g_thread_create (_folks_inspect_client_folks_thread_main_gthread_func, self, TRUE, &_inner_error_);
	_tmp18_ = _tmp17_;
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == G_THREAD_ERROR) {
			goto __catch1_g_thread_error;
		}
		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);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	self->priv->folks_thread = _tmp18_;
	goto __finally1;
	__catch1_g_thread_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		fprintf (stdout, "Couldn't create aggregator thread: %s", e->message);
		exit (1);
		_g_error_free0 (e);
	}
	__finally1:
	if (_inner_error_ != NULL) {
		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);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	return self;
}


FolksInspectClient* folks_inspect_client_new (void) {
	return folks_inspect_client_construct (FOLKS_INSPECT_TYPE_CLIENT);
}


static gchar** _folks_inspect_client_completion_cb_rl_completion_func_t (const gchar* str, gint a, gint b) {
	gchar** result;
	result = folks_inspect_client_completion_cb (str, a, b);
	return result;
}


static gchar* __readline (const gchar* prompt) {
	gchar* result = NULL;
	void* _tmp0_ = NULL;
	void* cstr;
	gchar* _tmp1_ = NULL;
	gchar* str;
	_tmp0_ = readline (prompt);
	cstr = _tmp0_;
	if (cstr == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = g_strdup ((const gchar*) cstr);
	str = _tmp1_;
	free (cstr);
	result = str;
	return result;
}


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


void folks_inspect_client_run_interactive (FolksInspectClient* self) {
	g_return_if_fail (self != NULL);
	rl_readline_name = "folks-inspect";
	rl_attempted_completion_function = _folks_inspect_client_completion_cb_rl_completion_func_t;
	while (TRUE) {
		gchar* _tmp0_ = NULL;
		gchar* command_line;
		gchar* _tmp1_ = NULL;
		gchar* subcommand = NULL;
		gchar* command_name = NULL;
		gchar* _tmp2_ = NULL;
		gchar* _tmp3_ = NULL;
		FolksInspectCommand* _tmp4_ = NULL;
		FolksInspectCommand* command;
		_tmp0_ = __readline ("> ");
		command_line = _tmp0_;
		if (command_line == NULL) {
			_g_free0 (command_line);
			continue;
		}
		_tmp1_ = string_strip (command_line);
		_g_free0 (command_line);
		command_line = _tmp1_;
		if (g_strcmp0 (command_line, "") == 0) {
			_g_free0 (command_line);
			continue;
		}
		_tmp4_ = folks_inspect_client_parse_command_line (command_line, &_tmp2_, &_tmp3_);
		_g_free0 (command_name);
		command_name = _tmp2_;
		_g_free0 (subcommand);
		subcommand = _tmp3_;
		command = _tmp4_;
		if (command != NULL) {
			folks_inspect_command_run (command, subcommand);
		} else {
			fprintf (stdout, "Unrecognised command '%s'.\n", command_name);
		}
		add_history (command_line);
		_folks_inspect_command_unref0 (command);
		_g_free0 (command_name);
		_g_free0 (subcommand);
		_g_free0 (command_line);
	}
}


static FolksInspectCommand* folks_inspect_client_parse_command_line (const gchar* command_line, gchar** command_name, gchar** subcommand) {
	gchar* _command_name = NULL;
	gchar* _subcommand = NULL;
	FolksInspectCommand* result = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_ = NULL;
	gchar** parts;
	gint parts_length1;
	gint _parts_size_;
	gchar* _tmp2_;
	gboolean _tmp3_ = FALSE;
	gpointer _tmp5_ = NULL;
	g_return_val_if_fail (command_line != NULL, NULL);
	_tmp1_ = _tmp0_ = g_strsplit (command_line, " ", 2);
	parts = _tmp1_;
	parts_length1 = _vala_array_length (_tmp0_);
	_parts_size_ = _vala_array_length (_tmp0_);
	if (parts_length1 < 1) {
		result = NULL;
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		if (command_name) {
			*command_name = _command_name;
		} else {
			_g_free0 (_command_name);
		}
		if (subcommand) {
			*subcommand = _subcommand;
		} else {
			_g_free0 (_subcommand);
		}
		return result;
	}
	_tmp2_ = g_strdup (parts[0]);
	_g_free0 (_command_name);
	_command_name = _tmp2_;
	if (parts_length1 == 2) {
		_tmp3_ = g_strcmp0 (parts[1], "") != 0;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		gchar* _tmp4_;
		_tmp4_ = g_strdup (parts[1]);
		_g_free0 (_subcommand);
		_subcommand = _tmp4_;
	} else {
		_g_free0 (_subcommand);
		_subcommand = NULL;
	}
	_tmp5_ = gee_abstract_map_get ((GeeAbstractMap*) main_client->commands, parts[0]);
	result = (FolksInspectCommand*) _tmp5_;
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	if (command_name) {
		*command_name = _command_name;
	} else {
		_g_free0 (_command_name);
	}
	if (subcommand) {
		*subcommand = _subcommand;
	} else {
		_g_free0 (_subcommand);
	}
	return result;
}


static gchar* _folks_inspect_utils_command_name_completion_cb_rl_compentry_func_t (const gchar* str, gint a) {
	gchar* result;
	result = folks_inspect_utils_command_name_completion_cb (str, a);
	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++) {
		result[i] = g_strdup (self[i]);
	}
	return result;
}


static gchar** folks_inspect_client_completion_cb (const gchar* word, gint start, gint end) {
	gchar** result = NULL;
	gchar* command_name = NULL;
	gchar* subcommand = NULL;
	gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	FolksInspectCommand* _tmp6_ = NULL;
	FolksInspectCommand* command;
	g_return_val_if_fail (word != NULL, NULL);
	if (start == 0) {
		gchar** _tmp0_;
		gchar** _tmp1_ = NULL;
		gchar** _tmp2_;
		gchar** _tmp3_;
		_tmp1_ = _tmp0_ = rl_completion_matches (word, _folks_inspect_utils_command_name_completion_cb_rl_compentry_func_t);
		_tmp2_ = (_tmp3_ = _tmp1_, (_tmp3_ == NULL) ? ((gpointer) _tmp3_) : _vala_array_dup7 (_tmp3_, _vala_array_length (_tmp0_)));
		result = _tmp2_;
		return result;
	}
	_tmp6_ = folks_inspect_client_parse_command_line (rl_line_buffer, &_tmp4_, &_tmp5_);
	_g_free0 (command_name);
	command_name = _tmp4_;
	_g_free0 (subcommand);
	subcommand = _tmp5_;
	command = _tmp6_;
	if (command != NULL) {
		gint _tmp8_;
		gchar** _tmp9_ = NULL;
		if (subcommand == NULL) {
			gchar* _tmp7_;
			_tmp7_ = g_strdup ("");
			_g_free0 (subcommand);
			subcommand = _tmp7_;
		}
		_tmp9_ = folks_inspect_command_complete_subcommand (command, subcommand, &_tmp8_);
		result = _tmp9_;
		_folks_inspect_command_unref0 (command);
		_g_free0 (subcommand);
		_g_free0 (command_name);
		return result;
	}
	result = NULL;
	_folks_inspect_command_unref0 (command);
	_g_free0 (subcommand);
	_g_free0 (command_name);
	return result;
}


FolksIndividualAggregator* folks_inspect_client_get_aggregator (FolksInspectClient* self) {
	FolksIndividualAggregator* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_aggregator;
	return result;
}


static void folks_inspect_client_set_aggregator (FolksInspectClient* self, FolksIndividualAggregator* value) {
	FolksIndividualAggregator* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_aggregator);
	self->priv->_aggregator = _tmp0_;
	g_object_notify ((GObject *) self, "aggregator");
}


FolksBackendStore* folks_inspect_client_get_backend_store (FolksInspectClient* self) {
	FolksBackendStore* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_backend_store;
	return result;
}


static void folks_inspect_client_set_backend_store (FolksInspectClient* self, FolksBackendStore* value) {
	FolksBackendStore* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_backend_store);
	self->priv->_backend_store = _tmp0_;
	g_object_notify ((GObject *) self, "backend-store");
}


FolksInspectSignalManager* folks_inspect_client_get_signal_manager (FolksInspectClient* self) {
	FolksInspectSignalManager* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_signal_manager;
	return result;
}


static void folks_inspect_client_set_signal_manager (FolksInspectClient* self, FolksInspectSignalManager* value) {
	FolksInspectSignalManager* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_signal_manager);
	self->priv->_signal_manager = _tmp0_;
	g_object_notify ((GObject *) self, "signal-manager");
}


static void folks_inspect_client_class_init (FolksInspectClientClass * klass) {
	folks_inspect_client_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (FolksInspectClientPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_folks_inspect_client_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_folks_inspect_client_set_property;
	G_OBJECT_CLASS (klass)->finalize = folks_inspect_client_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_INSPECT_CLIENT_AGGREGATOR, g_param_spec_object ("aggregator", "aggregator", "aggregator", FOLKS_TYPE_INDIVIDUAL_AGGREGATOR, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_INSPECT_CLIENT_BACKEND_STORE, g_param_spec_object ("backend-store", "backend-store", "backend-store", FOLKS_TYPE_BACKEND_STORE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_INSPECT_CLIENT_SIGNAL_MANAGER, g_param_spec_object ("signal-manager", "signal-manager", "signal-manager", FOLKS_INSPECT_TYPE_SIGNAL_MANAGER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void folks_inspect_client_instance_init (FolksInspectClient * self) {
	self->priv = FOLKS_INSPECT_CLIENT_GET_PRIVATE (self);
}


static void folks_inspect_client_finalize (GObject* obj) {
	FolksInspectClient * self;
	self = FOLKS_INSPECT_CLIENT (obj);
	_g_object_unref0 (self->commands);
	_g_main_loop_unref0 (self->priv->main_loop);
	_g_object_unref0 (self->priv->_aggregator);
	_g_object_unref0 (self->priv->_backend_store);
	_g_object_unref0 (self->priv->_signal_manager);
	G_OBJECT_CLASS (folks_inspect_client_parent_class)->finalize (obj);
}


GType folks_inspect_client_get_type (void) {
	static volatile gsize folks_inspect_client_type_id__volatile = 0;
	if (g_once_init_enter (&folks_inspect_client_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FolksInspectClientClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_inspect_client_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksInspectClient), 0, (GInstanceInitFunc) folks_inspect_client_instance_init, NULL };
		GType folks_inspect_client_type_id;
		folks_inspect_client_type_id = g_type_register_static (G_TYPE_OBJECT, "FolksInspectClient", &g_define_type_info, 0);
		g_once_init_leave (&folks_inspect_client_type_id__volatile, folks_inspect_client_type_id);
	}
	return folks_inspect_client_type_id__volatile;
}


static void _vala_folks_inspect_client_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	FolksInspectClient * self;
	self = FOLKS_INSPECT_CLIENT (object);
	switch (property_id) {
		case FOLKS_INSPECT_CLIENT_AGGREGATOR:
		g_value_set_object (value, folks_inspect_client_get_aggregator (self));
		break;
		case FOLKS_INSPECT_CLIENT_BACKEND_STORE:
		g_value_set_object (value, folks_inspect_client_get_backend_store (self));
		break;
		case FOLKS_INSPECT_CLIENT_SIGNAL_MANAGER:
		g_value_set_object (value, folks_inspect_client_get_signal_manager (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_folks_inspect_client_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	FolksInspectClient * self;
	self = FOLKS_INSPECT_CLIENT (object);
	switch (property_id) {
		case FOLKS_INSPECT_CLIENT_AGGREGATOR:
		folks_inspect_client_set_aggregator (self, g_value_get_object (value));
		break;
		case FOLKS_INSPECT_CLIENT_BACKEND_STORE:
		folks_inspect_client_set_backend_store (self, g_value_get_object (value));
		break;
		case FOLKS_INSPECT_CLIENT_SIGNAL_MANAGER:
		folks_inspect_client_set_signal_manager (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


FolksInspectCommand* folks_inspect_command_construct (GType object_type, FolksInspectClient* client) {
	FolksInspectCommand* self = NULL;
	FolksInspectClient* _tmp0_;
	g_return_val_if_fail (client != NULL, NULL);
	self = (FolksInspectCommand*) g_type_create_instance (object_type);
	_tmp0_ = _g_object_ref0 (client);
	_g_object_unref0 (self->client);
	self->client = _tmp0_;
	return self;
}


static void folks_inspect_command_real_run (FolksInspectCommand* self, const gchar* command_string) {
	g_return_if_fail (self != NULL);
	g_critical ("Type `%s' does not implement abstract method `folks_inspect_command_run'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}


void folks_inspect_command_run (FolksInspectCommand* self, const gchar* command_string) {
	FOLKS_INSPECT_COMMAND_GET_CLASS (self)->run (self, command_string);
}


static gchar** folks_inspect_command_real_complete_subcommand (FolksInspectCommand* self, const gchar* subcommand, int* result_length1) {
	gchar** result = NULL;
	gpointer _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (subcommand != NULL, NULL);
	_tmp0_ = NULL;
	*result_length1 = 0;
	result = _tmp0_;
	return result;
}


gchar** folks_inspect_command_complete_subcommand (FolksInspectCommand* self, const gchar* subcommand, int* result_length1) {
	return FOLKS_INSPECT_COMMAND_GET_CLASS (self)->complete_subcommand (self, subcommand, result_length1);
}


const gchar* folks_inspect_command_get_name (FolksInspectCommand* self) {
	return FOLKS_INSPECT_COMMAND_GET_CLASS (self)->get_name (self);
}


const gchar* folks_inspect_command_get_description (FolksInspectCommand* self) {
	return FOLKS_INSPECT_COMMAND_GET_CLASS (self)->get_description (self);
}


const gchar* folks_inspect_command_get_help (FolksInspectCommand* self) {
	return FOLKS_INSPECT_COMMAND_GET_CLASS (self)->get_help (self);
}


static void folks_inspect_value_command_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void folks_inspect_value_command_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		folks_inspect_command_unref (value->data[0].v_pointer);
	}
}


static void folks_inspect_value_command_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = folks_inspect_command_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer folks_inspect_value_command_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* folks_inspect_value_command_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		FolksInspectCommand* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = folks_inspect_command_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* folks_inspect_value_command_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	FolksInspectCommand** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = folks_inspect_command_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* folks_inspect_param_spec_command (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	FolksInspectParamSpecCommand* spec;
	g_return_val_if_fail (g_type_is_a (object_type, FOLKS_INSPECT_TYPE_COMMAND), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer folks_inspect_value_get_command (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOLKS_INSPECT_TYPE_COMMAND), NULL);
	return value->data[0].v_pointer;
}


void folks_inspect_value_set_command (GValue* value, gpointer v_object) {
	FolksInspectCommand* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOLKS_INSPECT_TYPE_COMMAND));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FOLKS_INSPECT_TYPE_COMMAND));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		folks_inspect_command_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		folks_inspect_command_unref (old);
	}
}


void folks_inspect_value_take_command (GValue* value, gpointer v_object) {
	FolksInspectCommand* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FOLKS_INSPECT_TYPE_COMMAND));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FOLKS_INSPECT_TYPE_COMMAND));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		folks_inspect_command_unref (old);
	}
}


static void folks_inspect_command_class_init (FolksInspectCommandClass * klass) {
	folks_inspect_command_parent_class = g_type_class_peek_parent (klass);
	FOLKS_INSPECT_COMMAND_CLASS (klass)->finalize = folks_inspect_command_finalize;
	FOLKS_INSPECT_COMMAND_CLASS (klass)->run = folks_inspect_command_real_run;
	FOLKS_INSPECT_COMMAND_CLASS (klass)->complete_subcommand = folks_inspect_command_real_complete_subcommand;
}


static void folks_inspect_command_instance_init (FolksInspectCommand * self) {
	self->ref_count = 1;
}


static void folks_inspect_command_finalize (FolksInspectCommand* obj) {
	FolksInspectCommand * self;
	self = FOLKS_INSPECT_COMMAND (obj);
	_g_object_unref0 (self->client);
}


GType folks_inspect_command_get_type (void) {
	static volatile gsize folks_inspect_command_type_id__volatile = 0;
	if (g_once_init_enter (&folks_inspect_command_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { folks_inspect_value_command_init, folks_inspect_value_command_free_value, folks_inspect_value_command_copy_value, folks_inspect_value_command_peek_pointer, "p", folks_inspect_value_command_collect_value, "p", folks_inspect_value_command_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (FolksInspectCommandClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_inspect_command_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksInspectCommand), 0, (GInstanceInitFunc) folks_inspect_command_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 folks_inspect_command_type_id;
		folks_inspect_command_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FolksInspectCommand", &g_define_type_info, &g_define_type_fundamental_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&folks_inspect_command_type_id__volatile, folks_inspect_command_type_id);
	}
	return folks_inspect_command_type_id__volatile;
}


gpointer folks_inspect_command_ref (gpointer instance) {
	FolksInspectCommand* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void folks_inspect_command_unref (gpointer instance) {
	FolksInspectCommand* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		FOLKS_INSPECT_COMMAND_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


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



