/* command-signals.c generated by valac 0.13.4, the Vala compiler
 * generated from command-signals.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 <stdlib.h>
#include <string.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_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;
typedef struct _FolksInspectCommandsSignalsPrivate FolksInspectCommandsSignalsPrivate;

#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_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

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 _FolksInspectCommandsSignals {
	FolksInspectCommand parent_instance;
	FolksInspectCommandsSignalsPrivate * priv;
};

struct _FolksInspectCommandsSignalsClass {
	FolksInspectCommandClass parent_class;
};


static gpointer folks_inspect_commands_signals_parent_class = 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_signals_get_type (void) G_GNUC_CONST;
enum  {
	FOLKS_INSPECT_COMMANDS_SIGNALS_DUMMY_PROPERTY
};
FolksInspectCommandsSignals* folks_inspect_commands_signals_new (FolksInspectClient* client);
FolksInspectCommandsSignals* folks_inspect_commands_signals_construct (GType object_type, FolksInspectClient* client);
FolksInspectCommand* folks_inspect_command_construct (GType object_type, FolksInspectClient* client);
static void folks_inspect_commands_signals_real_run (FolksInspectCommand* base, const gchar* command_string);
GType folks_inspect_signal_manager_get_type (void) G_GNUC_CONST;
FolksInspectSignalManager* folks_inspect_client_get_signal_manager (FolksInspectClient* self);
void folks_inspect_signal_manager_list_signals (FolksInspectSignalManager* self, GType class_type, GObject* class_instance);
void folks_inspect_utils_print_line (const gchar* format, ...);
static gboolean folks_inspect_commands_signals_parse_signal_id (FolksInspectCommandsSignals* self, const gchar* input, GType* class_type, GObject** class_instance, gchar** signal_name, gchar** detail_string);
guint folks_inspect_signal_manager_connect_to_signal (FolksInspectSignalManager* self, GType class_type, GObject* class_instance, const gchar* signal_name, const gchar* detail_string);
guint folks_inspect_signal_manager_disconnect_from_signal (FolksInspectSignalManager* self, GType class_type, GObject* class_instance, const gchar* signal_name, const gchar* detail_string);
void folks_inspect_signal_manager_show_signal_details (FolksInspectSignalManager* self, GType class_type, const gchar* signal_name, const gchar* detail_string);
static gchar** folks_inspect_commands_signals_real_complete_subcommand (FolksInspectCommand* base, const gchar* subcommand, int* result_length1);
gchar* folks_inspect_utils_backend_name_completion_cb (const gchar* word, gint state);
static gchar* _folks_inspect_utils_backend_name_completion_cb_rl_compentry_func_t (const gchar* str, gint a);
static gchar** _vala_array_dup10 (gchar** self, int length);
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);


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


FolksInspectCommandsSignals* folks_inspect_commands_signals_new (FolksInspectClient* client) {
	return folks_inspect_commands_signals_construct (FOLKS_INSPECT_COMMANDS_TYPE_SIGNALS, client);
}


static gchar* string_strip (const gchar* self) {
	gchar* result = NULL;
	gchar* _tmp0_ = NULL;
	gchar* _result_;
	const gchar* _tmp1_;
	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_signals_real_run (FolksInspectCommand* base, const gchar* command_string) {
	FolksInspectCommandsSignals * self;
	const gchar* _tmp0_;
	self = (FolksInspectCommandsSignals*) base;
	_tmp0_ = command_string;
	if (_tmp0_ == NULL) {
		FolksInspectClient* _tmp1_;
		FolksInspectSignalManager* _tmp2_;
		FolksInspectSignalManager* _tmp3_;
		_tmp1_ = ((FolksInspectCommand*) self)->client;
		_tmp2_ = folks_inspect_client_get_signal_manager (_tmp1_);
		_tmp3_ = _tmp2_;
		folks_inspect_signal_manager_list_signals (_tmp3_, G_TYPE_INVALID, NULL);
	} else {
		const gchar* _tmp4_;
		gchar** _tmp5_;
		gchar** _tmp6_ = NULL;
		gchar** parts;
		gint parts_length1;
		gint _parts_size_;
		gchar** _tmp7_;
		gint _tmp7__length1;
		GType class_type = 0UL;
		GObject* class_instance = NULL;
		gchar* signal_name = NULL;
		gchar* detail_string = NULL;
		gboolean _tmp9_ = FALSE;
		gchar** _tmp10_;
		gint _tmp10__length1;
		const gchar* _tmp11_;
		gboolean _tmp14_;
		_tmp4_ = command_string;
		_tmp6_ = _tmp5_ = g_strsplit (_tmp4_, " ", 2);
		parts = _tmp6_;
		parts_length1 = _vala_array_length (_tmp5_);
		_parts_size_ = parts_length1;
		_tmp7_ = parts;
		_tmp7__length1 = parts_length1;
		if (_tmp7__length1 < 1) {
			const gchar* _tmp8_;
			_tmp8_ = command_string;
			folks_inspect_utils_print_line ("Unrecognised 'signals' command '%s'.", _tmp8_);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			return;
		}
		_tmp10_ = parts;
		_tmp10__length1 = parts_length1;
		_tmp11_ = _tmp10_[0];
		if (g_strcmp0 (_tmp11_, "connect") == 0) {
			_tmp9_ = TRUE;
		} else {
			gchar** _tmp12_;
			gint _tmp12__length1;
			const gchar* _tmp13_;
			_tmp12_ = parts;
			_tmp12__length1 = parts_length1;
			_tmp13_ = _tmp12_[0];
			_tmp9_ = g_strcmp0 (_tmp13_, "disconnect") == 0;
		}
		_tmp14_ = _tmp9_;
		if (_tmp14_) {
			gboolean _tmp15_ = FALSE;
			gchar** _tmp16_;
			gint _tmp16__length1;
			const gchar* _tmp17_;
			gboolean _tmp22_;
			gchar** _tmp25_;
			gint _tmp25__length1;
			const gchar* _tmp26_;
			gchar* _tmp27_ = NULL;
			gchar* _tmp28_;
			GType _tmp29_ = 0UL;
			GObject* _tmp30_ = NULL;
			gchar* _tmp31_ = NULL;
			gchar* _tmp32_ = NULL;
			gboolean _tmp33_ = FALSE;
			gboolean _tmp34_;
			gchar** _tmp35_;
			gint _tmp35__length1;
			const gchar* _tmp36_;
			_tmp16_ = parts;
			_tmp16__length1 = parts_length1;
			_tmp17_ = _tmp16_[1];
			if (_tmp17_ == NULL) {
				_tmp15_ = TRUE;
			} else {
				gchar** _tmp18_;
				gint _tmp18__length1;
				const gchar* _tmp19_;
				gchar* _tmp20_ = NULL;
				gchar* _tmp21_;
				_tmp18_ = parts;
				_tmp18__length1 = parts_length1;
				_tmp19_ = _tmp18_[1];
				_tmp20_ = string_strip (_tmp19_);
				_tmp21_ = _tmp20_;
				_tmp15_ = g_strcmp0 (_tmp21_, "") == 0;
				_g_free0 (_tmp21_);
			}
			_tmp22_ = _tmp15_;
			if (_tmp22_) {
				gchar** _tmp23_;
				gint _tmp23__length1;
				const gchar* _tmp24_;
				_tmp23_ = parts;
				_tmp23__length1 = parts_length1;
				_tmp24_ = _tmp23_[1];
				folks_inspect_utils_print_line ("Unrecognised signal identifier '%s'.", _tmp24_);
				_g_free0 (detail_string);
				_g_free0 (signal_name);
				_g_object_unref0 (class_instance);
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
				return;
			}
			_tmp25_ = parts;
			_tmp25__length1 = parts_length1;
			_tmp26_ = _tmp25_[1];
			_tmp27_ = string_strip (_tmp26_);
			_tmp28_ = _tmp27_;
			_tmp33_ = folks_inspect_commands_signals_parse_signal_id (self, _tmp28_, &_tmp29_, &_tmp30_, &_tmp31_, &_tmp32_);
			class_type = _tmp29_;
			_g_object_unref0 (class_instance);
			class_instance = _tmp30_;
			_g_free0 (signal_name);
			signal_name = _tmp31_;
			_g_free0 (detail_string);
			detail_string = _tmp32_;
			_tmp34_ = _tmp33_ == FALSE;
			_g_free0 (_tmp28_);
			if (_tmp34_) {
				_g_free0 (detail_string);
				_g_free0 (signal_name);
				_g_object_unref0 (class_instance);
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
				return;
			}
			_tmp35_ = parts;
			_tmp35__length1 = parts_length1;
			_tmp36_ = _tmp35_[0];
			if (g_strcmp0 (_tmp36_, "connect") == 0) {
				FolksInspectClient* _tmp37_;
				FolksInspectSignalManager* _tmp38_;
				FolksInspectSignalManager* _tmp39_;
				GType _tmp40_;
				GObject* _tmp41_;
				const gchar* _tmp42_;
				const gchar* _tmp43_;
				guint _tmp44_ = 0U;
				guint signal_count;
				guint _tmp45_;
				_tmp37_ = ((FolksInspectCommand*) self)->client;
				_tmp38_ = folks_inspect_client_get_signal_manager (_tmp37_);
				_tmp39_ = _tmp38_;
				_tmp40_ = class_type;
				_tmp41_ = class_instance;
				_tmp42_ = signal_name;
				_tmp43_ = detail_string;
				_tmp44_ = folks_inspect_signal_manager_connect_to_signal (_tmp39_, _tmp40_, _tmp41_, _tmp42_, _tmp43_);
				signal_count = _tmp44_;
				_tmp45_ = signal_count;
				folks_inspect_utils_print_line ("Connected to %u signals.", _tmp45_);
			} else {
				FolksInspectClient* _tmp46_;
				FolksInspectSignalManager* _tmp47_;
				FolksInspectSignalManager* _tmp48_;
				GType _tmp49_;
				GObject* _tmp50_;
				const gchar* _tmp51_;
				const gchar* _tmp52_;
				guint _tmp53_ = 0U;
				guint signal_count;
				guint _tmp54_;
				_tmp46_ = ((FolksInspectCommand*) self)->client;
				_tmp47_ = folks_inspect_client_get_signal_manager (_tmp46_);
				_tmp48_ = _tmp47_;
				_tmp49_ = class_type;
				_tmp50_ = class_instance;
				_tmp51_ = signal_name;
				_tmp52_ = detail_string;
				_tmp53_ = folks_inspect_signal_manager_disconnect_from_signal (_tmp48_, _tmp49_, _tmp50_, _tmp51_, _tmp52_);
				signal_count = _tmp53_;
				_tmp54_ = signal_count;
				folks_inspect_utils_print_line ("Disconnected from %u signals.", _tmp54_);
			}
		} else {
			gchar** _tmp55_;
			gint _tmp55__length1;
			const gchar* _tmp56_;
			gchar* _tmp57_ = NULL;
			gchar* _tmp58_;
			GType _tmp59_ = 0UL;
			GObject* _tmp60_ = NULL;
			gchar* _tmp61_ = NULL;
			gchar* _tmp62_ = NULL;
			gboolean _tmp63_ = FALSE;
			gboolean _tmp64_;
			const gchar* _tmp65_;
			_tmp55_ = parts;
			_tmp55__length1 = parts_length1;
			_tmp56_ = _tmp55_[0];
			_tmp57_ = string_strip (_tmp56_);
			_tmp58_ = _tmp57_;
			_tmp63_ = folks_inspect_commands_signals_parse_signal_id (self, _tmp58_, &_tmp59_, &_tmp60_, &_tmp61_, &_tmp62_);
			class_type = _tmp59_;
			_g_object_unref0 (class_instance);
			class_instance = _tmp60_;
			_g_free0 (signal_name);
			signal_name = _tmp61_;
			_g_free0 (detail_string);
			detail_string = _tmp62_;
			_tmp64_ = _tmp63_ == FALSE;
			_g_free0 (_tmp58_);
			if (_tmp64_) {
				_g_free0 (detail_string);
				_g_free0 (signal_name);
				_g_object_unref0 (class_instance);
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
				return;
			}
			_tmp65_ = signal_name;
			if (_tmp65_ == NULL) {
				FolksInspectClient* _tmp66_;
				FolksInspectSignalManager* _tmp67_;
				FolksInspectSignalManager* _tmp68_;
				GType _tmp69_;
				GObject* _tmp70_;
				_tmp66_ = ((FolksInspectCommand*) self)->client;
				_tmp67_ = folks_inspect_client_get_signal_manager (_tmp66_);
				_tmp68_ = _tmp67_;
				_tmp69_ = class_type;
				_tmp70_ = class_instance;
				folks_inspect_signal_manager_list_signals (_tmp68_, _tmp69_, _tmp70_);
			} else {
				GType _tmp71_;
				FolksInspectClient* _tmp74_;
				FolksInspectSignalManager* _tmp75_;
				FolksInspectSignalManager* _tmp76_;
				GType _tmp77_;
				const gchar* _tmp78_;
				const gchar* _tmp79_;
				_tmp71_ = class_type;
				if (_tmp71_ == G_TYPE_INVALID) {
					GObject* _tmp72_;
					GType _tmp73_ = 0UL;
					_tmp72_ = class_instance;
					_tmp73_ = G_TYPE_FROM_INSTANCE (_tmp72_);
					class_type = _tmp73_;
				}
				_tmp74_ = ((FolksInspectCommand*) self)->client;
				_tmp75_ = folks_inspect_client_get_signal_manager (_tmp74_);
				_tmp76_ = _tmp75_;
				_tmp77_ = class_type;
				_tmp78_ = signal_name;
				_tmp79_ = detail_string;
				folks_inspect_signal_manager_show_signal_details (_tmp76_, _tmp77_, _tmp78_, _tmp79_);
			}
		}
		_g_free0 (detail_string);
		_g_free0 (signal_name);
		_g_object_unref0 (class_instance);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	}
}


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


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


static gchar** folks_inspect_commands_signals_real_complete_subcommand (FolksInspectCommand* base, const gchar* subcommand, int* result_length1) {
	FolksInspectCommandsSignals * self;
	gchar** result = NULL;
	const gchar* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_ = NULL;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar** _tmp4_;
	gint _tmp4__length1;
	self = (FolksInspectCommandsSignals*) base;
	g_return_val_if_fail (subcommand != NULL, NULL);
	_tmp0_ = subcommand;
	_tmp2_ = _tmp1_ = rl_completion_matches (_tmp0_, _folks_inspect_utils_backend_name_completion_cb_rl_compentry_func_t);
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup10 (_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 gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_;
	gchar _tmp1_;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = index;
	_tmp1_ = ((gchar*) self)[_tmp0_];
	result = _tmp1_;
	return result;
}


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


static gboolean folks_inspect_commands_signals_parse_signal_id (FolksInspectCommandsSignals* self, const gchar* input, GType* class_type, GObject** class_instance, gchar** signal_name, gchar** detail_string) {
	GType _vala_class_type = 0UL;
	GObject* _vala_class_instance = NULL;
	gchar* _vala_signal_name = NULL;
	gchar* _vala_detail_string = NULL;
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	gboolean _tmp3_;
	const gchar* _tmp4_;
	gchar** _tmp5_;
	gchar** _tmp6_ = NULL;
	gchar** parts;
	gint parts_length1;
	gint _parts_size_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* class_name_or_instance;
	const gchar* _tmp10_ = NULL;
	gchar** _tmp11_;
	gint _tmp11__length1;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* signal_name_inner;
	const gchar* _tmp16_ = NULL;
	gchar** _tmp17_;
	gint _tmp17__length1;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* detail_string_inner;
	gboolean _tmp22_ = FALSE;
	const gchar* _tmp23_;
	gboolean _tmp25_;
	gboolean _tmp27_ = FALSE;
	gboolean _tmp28_ = FALSE;
	const gchar* _tmp29_;
	gint _tmp30_;
	gint _tmp31_;
	gboolean _tmp34_;
	gboolean _tmp37_;
	const gchar* _tmp57_;
	gchar* _tmp58_;
	const gchar* _tmp59_;
	gchar* _tmp60_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (input != NULL, FALSE);
	_tmp1_ = input;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_;
		_tmp2_ = input;
		_tmp0_ = g_strcmp0 (_tmp2_, "") != 0;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp3_ = _tmp0_;
	g_assert (_tmp3_);
	_vala_class_type = G_TYPE_INVALID;
	_g_object_unref0 (_vala_class_instance);
	_vala_class_instance = NULL;
	_g_free0 (_vala_signal_name);
	_vala_signal_name = NULL;
	_g_free0 (_vala_detail_string);
	_vala_detail_string = NULL;
	_tmp4_ = input;
	_tmp6_ = _tmp5_ = g_strsplit (_tmp4_, "::", 3);
	parts = _tmp6_;
	parts_length1 = _vala_array_length (_tmp5_);
	_parts_size_ = parts_length1;
	_tmp7_ = parts;
	_tmp7__length1 = parts_length1;
	_tmp8_ = _tmp7_[0];
	_tmp9_ = g_strdup (_tmp8_);
	class_name_or_instance = _tmp9_;
	_tmp11_ = parts;
	_tmp11__length1 = parts_length1;
	if (_tmp11__length1 > 1) {
		gchar** _tmp12_;
		gint _tmp12__length1;
		const gchar* _tmp13_;
		_tmp12_ = parts;
		_tmp12__length1 = parts_length1;
		_tmp13_ = _tmp12_[1];
		_tmp10_ = _tmp13_;
	} else {
		_tmp10_ = NULL;
	}
	_tmp14_ = _tmp10_;
	_tmp15_ = g_strdup (_tmp14_);
	signal_name_inner = _tmp15_;
	_tmp17_ = parts;
	_tmp17__length1 = parts_length1;
	if (_tmp17__length1 > 2) {
		gchar** _tmp18_;
		gint _tmp18__length1;
		const gchar* _tmp19_;
		_tmp18_ = parts;
		_tmp18__length1 = parts_length1;
		_tmp19_ = _tmp18_[2];
		_tmp16_ = _tmp19_;
	} else {
		_tmp16_ = NULL;
	}
	_tmp20_ = _tmp16_;
	_tmp21_ = g_strdup (_tmp20_);
	detail_string_inner = _tmp21_;
	_tmp23_ = signal_name_inner;
	if (g_strcmp0 (_tmp23_, "") == 0) {
		_tmp22_ = TRUE;
	} else {
		const gchar* _tmp24_;
		_tmp24_ = detail_string_inner;
		_tmp22_ = g_strcmp0 (_tmp24_, "") == 0;
	}
	_tmp25_ = _tmp22_;
	if (_tmp25_) {
		const gchar* _tmp26_;
		_tmp26_ = input;
		folks_inspect_utils_print_line ("Invalid signal identifier '%s'.", _tmp26_);
		result = FALSE;
		_g_free0 (detail_string_inner);
		_g_free0 (signal_name_inner);
		_g_free0 (class_name_or_instance);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		if (class_type) {
			*class_type = _vala_class_type;
		}
		if (class_instance) {
			*class_instance = _vala_class_instance;
		} else {
			_g_object_unref0 (_vala_class_instance);
		}
		if (signal_name) {
			*signal_name = _vala_signal_name;
		} else {
			_g_free0 (_vala_signal_name);
		}
		if (detail_string) {
			*detail_string = _vala_detail_string;
		} else {
			_g_free0 (_vala_detail_string);
		}
		return result;
	}
	_tmp29_ = class_name_or_instance;
	_tmp30_ = strlen (_tmp29_);
	_tmp31_ = _tmp30_;
	if (_tmp31_ > 2) {
		const gchar* _tmp32_;
		gchar _tmp33_ = '\0';
		_tmp32_ = class_name_or_instance;
		_tmp33_ = string_get (_tmp32_, (glong) 0);
		_tmp28_ = _tmp33_ == '0';
	} else {
		_tmp28_ = FALSE;
	}
	_tmp34_ = _tmp28_;
	if (_tmp34_) {
		const gchar* _tmp35_;
		gchar _tmp36_ = '\0';
		_tmp35_ = class_name_or_instance;
		_tmp36_ = string_get (_tmp35_, (glong) 1);
		_tmp27_ = _tmp36_ == 'x';
	} else {
		_tmp27_ = FALSE;
	}
	_tmp37_ = _tmp27_;
	if (_tmp37_) {
		const gchar* _tmp38_;
		gulong _tmp39_ = 0UL;
		gulong address;
		gulong _tmp40_;
		GObject* _tmp41_;
		GObject* _tmp42_;
		GType _tmp43_ = 0UL;
		gboolean _tmp44_ = FALSE;
		_tmp38_ = class_name_or_instance;
		_tmp39_ = strtoul (_tmp38_, NULL, 16);
		address = _tmp39_;
		_tmp40_ = address;
		_tmp41_ = _g_object_ref0 (G_OBJECT (_tmp40_));
		_g_object_unref0 (_vala_class_instance);
		_vala_class_instance = _tmp41_;
		_tmp42_ = _vala_class_instance;
		_tmp43_ = G_TYPE_FROM_INSTANCE (_tmp42_);
		_tmp44_ = G_TYPE_IS_OBJECT (_tmp43_);
		g_assert (_tmp44_);
	} else {
		const gchar* _tmp45_;
		GType _tmp46_ = 0UL;
		gboolean _tmp47_ = FALSE;
		GType _tmp48_;
		gboolean _tmp55_;
		_tmp45_ = class_name_or_instance;
		_tmp46_ = g_type_from_name (_tmp45_);
		_vala_class_type = _tmp46_;
		_tmp48_ = _vala_class_type;
		if (_tmp48_ == G_TYPE_INVALID) {
			_tmp47_ = TRUE;
		} else {
			gboolean _tmp49_ = FALSE;
			GType _tmp50_;
			gboolean _tmp51_ = FALSE;
			gboolean _tmp54_;
			_tmp50_ = _vala_class_type;
			_tmp51_ = G_TYPE_IS_INSTANTIATABLE (_tmp50_);
			if (_tmp51_ == FALSE) {
				GType _tmp52_;
				gboolean _tmp53_ = FALSE;
				_tmp52_ = _vala_class_type;
				_tmp53_ = G_TYPE_IS_INTERFACE (_tmp52_);
				_tmp49_ = _tmp53_ == FALSE;
			} else {
				_tmp49_ = FALSE;
			}
			_tmp54_ = _tmp49_;
			_tmp47_ = _tmp54_;
		}
		_tmp55_ = _tmp47_;
		if (_tmp55_) {
			const gchar* _tmp56_;
			_tmp56_ = class_name_or_instance;
			folks_inspect_utils_print_line ("Unrecognised class name '%s'.", _tmp56_);
			result = FALSE;
			_g_free0 (detail_string_inner);
			_g_free0 (signal_name_inner);
			_g_free0 (class_name_or_instance);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			if (class_type) {
				*class_type = _vala_class_type;
			}
			if (class_instance) {
				*class_instance = _vala_class_instance;
			} else {
				_g_object_unref0 (_vala_class_instance);
			}
			if (signal_name) {
				*signal_name = _vala_signal_name;
			} else {
				_g_free0 (_vala_signal_name);
			}
			if (detail_string) {
				*detail_string = _vala_detail_string;
			} else {
				_g_free0 (_vala_detail_string);
			}
			return result;
		}
	}
	_tmp57_ = signal_name_inner;
	_tmp58_ = g_strdup (_tmp57_);
	_g_free0 (_vala_signal_name);
	_vala_signal_name = _tmp58_;
	_tmp59_ = detail_string_inner;
	_tmp60_ = g_strdup (_tmp59_);
	_g_free0 (_vala_detail_string);
	_vala_detail_string = _tmp60_;
	result = TRUE;
	_g_free0 (detail_string_inner);
	_g_free0 (signal_name_inner);
	_g_free0 (class_name_or_instance);
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	if (class_type) {
		*class_type = _vala_class_type;
	}
	if (class_instance) {
		*class_instance = _vala_class_instance;
	} else {
		_g_object_unref0 (_vala_class_instance);
	}
	if (signal_name) {
		*signal_name = _vala_signal_name;
	} else {
		_g_free0 (_vala_signal_name);
	}
	if (detail_string) {
		*detail_string = _vala_detail_string;
	} else {
		_g_free0 (_vala_detail_string);
	}
	return result;
}


static const gchar* folks_inspect_commands_signals_real_get_name (FolksInspectCommand* base) {
	const gchar* result;
	FolksInspectCommandsSignals* self;
	self = (FolksInspectCommandsSignals*) base;
	result = "signals";
	return result;
}


static const gchar* folks_inspect_commands_signals_real_get_description (FolksInspectCommand* base) {
	const gchar* result;
	FolksInspectCommandsSignals* self;
	self = (FolksInspectCommandsSignals*) base;
	result = "Allow connection to and display of signals emitted by " "libfolks.";
	return result;
}


static const gchar* folks_inspect_commands_signals_real_get_help (FolksInspectCommand* base) {
	const gchar* result;
	FolksInspectCommandsSignals* self;
	self = (FolksInspectCommandsSignals*) base;
	result = "signals                                            " "List signals we're currently connected to.\n" "signals connect [class name]                       " "Connect to all the signals on all the instances of that " "class.\n" "signals connect [class name]::[signal name]        " "Connect to the given signal on all the instances of that " "class.\n" "signals connect [object pointer]                   " "Connect to all the signals on a particular class instance.\n" "signals connect [object pointer]::[signal name]    " "Connect to the given signal on a particular class instance.\n" "signals disconnect                                 " "(As for 'connect'.)\n" "signals [class name]                               " "List all the signals on all the instances of that class, " "highlighting the ones we're currently connected to.\n" "signals [object pointer]                           " "List all the signals on a particular class instance, " "highlighting the ones we're currently connected to.\n" "signals [class name]::[signal name]                " "Show the details of this signal.\n" "signals [object pointer]::[signal name]            " "Show the details of this signal.";
	return result;
}


static void folks_inspect_commands_signals_class_init (FolksInspectCommandsSignalsClass * klass) {
	folks_inspect_commands_signals_parent_class = g_type_class_peek_parent (klass);
	FOLKS_INSPECT_COMMAND_CLASS (klass)->run = folks_inspect_commands_signals_real_run;
	FOLKS_INSPECT_COMMAND_CLASS (klass)->complete_subcommand = folks_inspect_commands_signals_real_complete_subcommand;
	FOLKS_INSPECT_COMMAND_CLASS (klass)->get_name = folks_inspect_commands_signals_real_get_name;
	FOLKS_INSPECT_COMMAND_CLASS (klass)->get_description = folks_inspect_commands_signals_real_get_description;
	FOLKS_INSPECT_COMMAND_CLASS (klass)->get_help = folks_inspect_commands_signals_real_get_help;
}


static void folks_inspect_commands_signals_instance_init (FolksInspectCommandsSignals * self) {
}


GType folks_inspect_commands_signals_get_type (void) {
	static volatile gsize folks_inspect_commands_signals_type_id__volatile = 0;
	if (g_once_init_enter (&folks_inspect_commands_signals_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FolksInspectCommandsSignalsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_inspect_commands_signals_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksInspectCommandsSignals), 0, (GInstanceInitFunc) folks_inspect_commands_signals_instance_init, NULL };
		GType folks_inspect_commands_signals_type_id;
		folks_inspect_commands_signals_type_id = g_type_register_static (FOLKS_INSPECT_TYPE_COMMAND, "FolksInspectCommandsSignals", &g_define_type_info, 0);
		g_once_init_leave (&folks_inspect_commands_signals_type_id__volatile, folks_inspect_commands_signals_type_id);
	}
	return folks_inspect_commands_signals_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;
}



