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

/*
 * Copyright (c) 2016,2024 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Authors: Kamil Prusko <kamilprusko@gmail.com>
 */

#include <glib.h>
#include "ft_core.h"
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <glib-object.h>

#define FT_COMMAND_TIMEOUT 10
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	FT_ACTION_0_PROPERTY,
	FT_ACTION_UUID_PROPERTY,
	FT_ACTION_SETTINGS_PROPERTY,
	FT_ACTION_ENABLED_PROPERTY,
	FT_ACTION_DISPLAY_NAME_PROPERTY,
	FT_ACTION_NUM_PROPERTIES
};
static GParamSpec* ft_action_properties[FT_ACTION_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	FT_EVENT_ACTION_0_PROPERTY,
	FT_EVENT_ACTION_EVENT_NAMES_PROPERTY,
	FT_EVENT_ACTION_CONDITION_PROPERTY,
	FT_EVENT_ACTION_COMMAND_PROPERTY,
	FT_EVENT_ACTION_WAIT_FOR_COMPLETION_PROPERTY,
	FT_EVENT_ACTION_NUM_PROPERTIES
};
static GParamSpec* ft_event_action_properties[FT_EVENT_ACTION_NUM_PROPERTIES];
#define _ft_expression_unref0(var) ((var == NULL) ? NULL : (var = (ft_expression_unref (var), NULL)))
typedef struct _FtExpressionParser FtExpressionParser;
#define _ft_expression_parser_free0(var) ((var == NULL) ? NULL : (var = (ft_expression_parser_free (var), NULL)))
enum  {
	FT_EVENT_ACTION_TRIGGERED_SIGNAL,
	FT_EVENT_ACTION_NUM_SIGNALS
};
static guint ft_event_action_signals[FT_EVENT_ACTION_NUM_SIGNALS] = {0};
enum  {
	FT_CONDITION_ACTION_0_PROPERTY,
	FT_CONDITION_ACTION_CONDITION_PROPERTY,
	FT_CONDITION_ACTION_ENTER_COMMAND_PROPERTY,
	FT_CONDITION_ACTION_EXIT_COMMAND_PROPERTY,
	FT_CONDITION_ACTION_NUM_PROPERTIES
};
static GParamSpec* ft_condition_action_properties[FT_CONDITION_ACTION_NUM_PROPERTIES];
enum  {
	FT_CONDITION_ACTION_ENTERED_CONDITION_SIGNAL,
	FT_CONDITION_ACTION_EXITED_CONDITION_SIGNAL,
	FT_CONDITION_ACTION_NUM_SIGNALS
};
static guint ft_condition_action_signals[FT_CONDITION_ACTION_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _FtActionPrivate {
	gchar* _display_name;
	gchar* _uuid;
	GSettings* _settings;
	gboolean _enabled;
};

struct _FtEventActionPrivate {
	gchar** _event_names;
	gint _event_names_length1;
	gint __event_names_size_;
	FtExpression* _condition;
	FtCommand* _command;
	gboolean _wait_for_completion;
	FtEventBus* bus;
	guint* watch_ids;
	gint watch_ids_length1;
	gint _watch_ids_size_;
	guint last_context_checksum;
};

struct _FtConditionActionPrivate {
	FtExpression* _condition;
	FtCommand* _enter_command;
	FtCommand* _exit_command;
	FtEventBus* bus;
	guint watch_id;
};

static gint FtAction_private_offset;
static gpointer ft_action_parent_class = NULL;
static gint FtEventAction_private_offset;
static gpointer ft_event_action_parent_class = NULL;
static gint FtConditionAction_private_offset;
static gpointer ft_condition_action_parent_class = NULL;

VALA_EXTERN void ft_action_set_uuid_internal (FtAction* self,
                                  const gchar* uuid);
static void ft_action_real_load (FtAction* self,
                          GSettings* settings);
static void ft_action_real_save (FtAction* self,
                          GSettings* settings);
static void ft_action_real_bind (FtAction* self);
static void ft_action_real_unbind (FtAction* self);
static void ft_action_finalize (GObject * obj);
static GType ft_action_get_type_once (void);
static void _vala_ft_action_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec);
static void _vala_ft_action_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec);
static void ft_event_action_real_load (FtAction* base,
                                GSettings* settings);
VALA_EXTERN void ft_expression_parser_free (FtExpressionParser * self);
VALA_EXTERN FtExpressionParser* ft_expression_parser_new (void);
VALA_EXTERN FtExpression* ft_expression_parser_parse (FtExpressionParser* self,
                                          const gchar* text,
                                          GError** error);
static void ft_event_action_real_save (FtAction* base,
                                GSettings* settings);
static void ft_event_action_on_event (FtEventAction* self,
                               FtEvent* event);
static void ft_event_action_real_bind (FtAction* base);
static void _ft_event_action_on_event_ft_event_callback (FtEvent* event,
                                                  gpointer self);
static void _vala_array_add1 (guint* * array,
                       gint* length,
                       gint* size,
                       guint value);
static void ft_event_action_real_unbind (FtAction* base);
static gchar** _vala_array_dup1 (gchar** self,
                          gssize length);
static void g_cclosure_user_marshal_VOID__FT_CONTEXT_OBJECT (GClosure * closure,
                                                      GValue * return_value,
                                                      guint n_param_values,
                                                      const GValue * param_values,
                                                      gpointer invocation_hint,
                                                      gpointer marshal_data);
static GObject * ft_event_action_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties);
static void ft_event_action_finalize (GObject * obj);
static GType ft_event_action_get_type_once (void);
static void _vala_ft_event_action_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static void _vala_ft_event_action_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);
static void ft_condition_action_real_load (FtAction* base,
                                    GSettings* settings);
static void ft_condition_action_real_save (FtAction* base,
                                    GSettings* settings);
static void ft_condition_action_on_enter_condition (FtConditionAction* self,
                                             FtContext* context);
static void ft_condition_action_on_exit_condition (FtConditionAction* self,
                                            FtContext* context);
static void ft_condition_action_real_bind (FtAction* base);
static void _ft_condition_action_on_enter_condition_ft_condition_callback (FtContext* context,
                                                                    gpointer self);
static void _ft_condition_action_on_exit_condition_ft_condition_callback (FtContext* context,
                                                                   gpointer self);
static void ft_condition_action_real_unbind (FtAction* base);
static GObject * ft_condition_action_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties);
static void ft_condition_action_finalize (GObject * obj);
static GType ft_condition_action_get_type_once (void);
static void _vala_ft_condition_action_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_ft_condition_action_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static GType
ft_action_trigger_get_type_once (void)
{
	static const GEnumValue values[] = {{FT_ACTION_TRIGGER_EVENT, "FT_ACTION_TRIGGER_EVENT", "event"}, {FT_ACTION_TRIGGER_CONDITION, "FT_ACTION_TRIGGER_CONDITION", "condition"}, {0, NULL, NULL}};
	GType ft_action_trigger_type_id;
	ft_action_trigger_type_id = g_enum_register_static ("FtActionTrigger", values);
	return ft_action_trigger_type_id;
}

GType
ft_action_trigger_get_type (void)
{
	static volatile gsize ft_action_trigger_type_id__once = 0;
	if (g_once_init_enter (&ft_action_trigger_type_id__once)) {
		GType ft_action_trigger_type_id;
		ft_action_trigger_type_id = ft_action_trigger_get_type_once ();
		g_once_init_leave (&ft_action_trigger_type_id__once, ft_action_trigger_type_id);
	}
	return ft_action_trigger_type_id__once;
}

static inline gpointer
ft_action_get_instance_private (FtAction* self)
{
	return G_STRUCT_MEMBER_P (self, FtAction_private_offset);
}

void
ft_action_set_uuid_internal (FtAction* self,
                             const gchar* uuid)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (uuid != NULL);
	_tmp0_ = g_strdup (uuid);
	_g_free0 (self->priv->_uuid);
	self->priv->_uuid = _tmp0_;
}

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

static void
ft_action_real_load (FtAction* self,
                     GSettings* settings)
{
	GSettings* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (settings != NULL);
	_tmp0_ = _g_object_ref0 (settings);
	_g_object_unref0 (self->priv->_settings);
	self->priv->_settings = _tmp0_;
	ft_action_set_enabled (self, g_settings_get_boolean (settings, "enabled"));
	_tmp1_ = g_settings_get_string (settings, "display-name");
	_tmp2_ = _tmp1_;
	ft_action_set_display_name (self, _tmp2_);
	_g_free0 (_tmp2_);
}

void
ft_action_load (FtAction* self,
                GSettings* settings)
{
	FtActionClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = FT_ACTION_GET_CLASS (self);
	if (_klass_->load) {
		_klass_->load (self, settings);
	}
}

static void
ft_action_real_save (FtAction* self,
                     GSettings* settings)
{
	GSettings* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (settings != NULL);
	_tmp0_ = _g_object_ref0 (settings);
	_g_object_unref0 (self->priv->_settings);
	self->priv->_settings = _tmp0_;
	_tmp1_ = ft_action_get_enabled (self);
	_tmp2_ = _tmp1_;
	g_settings_set_boolean (settings, "enabled", _tmp2_);
	_tmp3_ = self->priv->_display_name;
	g_settings_set_string (settings, "display-name", _tmp3_);
}

void
ft_action_save (FtAction* self,
                GSettings* settings)
{
	FtActionClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = FT_ACTION_GET_CLASS (self);
	if (_klass_->save) {
		_klass_->save (self, settings);
	}
}

static void
ft_action_real_bind (FtAction* self)
{
	g_assert_not_reached ();
}

void
ft_action_bind (FtAction* self)
{
	FtActionClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = FT_ACTION_GET_CLASS (self);
	if (_klass_->bind) {
		_klass_->bind (self);
	}
}

static void
ft_action_real_unbind (FtAction* self)
{
	g_assert_not_reached ();
}

void
ft_action_unbind (FtAction* self)
{
	FtActionClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = FT_ACTION_GET_CLASS (self);
	if (_klass_->unbind) {
		_klass_->unbind (self);
	}
}

FtAction*
ft_action_construct (GType object_type)
{
	FtAction * self = NULL;
	self = (FtAction*) g_object_new (object_type, NULL);
	return self;
}

const gchar*
ft_action_get_uuid (FtAction* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_uuid;
	result = _tmp0_;
	return result;
}

static void
ft_action_set_uuid (FtAction* self,
                    const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_uuid);
	self->priv->_uuid = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, ft_action_properties[FT_ACTION_UUID_PROPERTY]);
}

GSettings*
ft_action_get_settings (FtAction* self)
{
	GSettings* result;
	GSettings* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_settings;
	result = _tmp0_;
	return result;
}

gboolean
ft_action_get_enabled (FtAction* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_enabled;
	return result;
}

void
ft_action_set_enabled (FtAction* self,
                       gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_enabled != value) {
		self->priv->_enabled = value;
		g_object_notify ((GObject*) self, "enabled");
	}
}

const gchar*
ft_action_get_display_name (FtAction* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_display_name;
	result = _tmp0_;
	return result;
}

void
ft_action_set_display_name (FtAction* self,
                            const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_action_get_display_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_display_name);
		self->priv->_display_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_action_properties[FT_ACTION_DISPLAY_NAME_PROPERTY]);
	}
}

static void
ft_action_class_init (FtActionClass * klass,
                      gpointer klass_data)
{
	ft_action_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtAction_private_offset);
	((FtActionClass *) klass)->load = (void (*) (FtAction*, GSettings*)) ft_action_real_load;
	((FtActionClass *) klass)->save = (void (*) (FtAction*, GSettings*)) ft_action_real_save;
	((FtActionClass *) klass)->bind = (void (*) (FtAction*)) ft_action_real_bind;
	((FtActionClass *) klass)->unbind = (void (*) (FtAction*)) ft_action_real_unbind;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_action_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_action_set_property;
	G_OBJECT_CLASS (klass)->finalize = ft_action_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_UUID_PROPERTY, ft_action_properties[FT_ACTION_UUID_PROPERTY] = g_param_spec_string ("uuid", "uuid", "uuid", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_SETTINGS_PROPERTY, ft_action_properties[FT_ACTION_SETTINGS_PROPERTY] = g_param_spec_object ("settings", "settings", "settings", g_settings_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_ENABLED_PROPERTY, ft_action_properties[FT_ACTION_ENABLED_PROPERTY] = g_param_spec_boolean ("enabled", "enabled", "enabled", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_DISPLAY_NAME_PROPERTY, ft_action_properties[FT_ACTION_DISPLAY_NAME_PROPERTY] = g_param_spec_string ("display-name", "display-name", "display-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
ft_action_instance_init (FtAction * self,
                         gpointer klass)
{
	gchar* _tmp0_;
	self->priv = ft_action_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_display_name = _tmp0_;
	self->priv->_uuid = NULL;
	self->priv->_settings = NULL;
	self->priv->_enabled = TRUE;
}

static void
ft_action_finalize (GObject * obj)
{
	FtAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_ACTION, FtAction);
	_g_free0 (self->priv->_display_name);
	_g_free0 (self->priv->_uuid);
	_g_object_unref0 (self->priv->_settings);
	G_OBJECT_CLASS (ft_action_parent_class)->finalize (obj);
}

static GType
ft_action_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtActionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_action_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtAction), 0, (GInstanceInitFunc) ft_action_instance_init, NULL };
	GType ft_action_type_id;
	ft_action_type_id = g_type_register_static (G_TYPE_OBJECT, "FtAction", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	FtAction_private_offset = g_type_add_instance_private (ft_action_type_id, sizeof (FtActionPrivate));
	return ft_action_type_id;
}

GType
ft_action_get_type (void)
{
	static volatile gsize ft_action_type_id__once = 0;
	if (g_once_init_enter (&ft_action_type_id__once)) {
		GType ft_action_type_id;
		ft_action_type_id = ft_action_get_type_once ();
		g_once_init_leave (&ft_action_type_id__once, ft_action_type_id);
	}
	return ft_action_type_id__once;
}

static void
_vala_ft_action_get_property (GObject * object,
                              guint property_id,
                              GValue * value,
                              GParamSpec * pspec)
{
	FtAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_ACTION, FtAction);
	switch (property_id) {
		case FT_ACTION_UUID_PROPERTY:
		g_value_set_string (value, ft_action_get_uuid (self));
		break;
		case FT_ACTION_SETTINGS_PROPERTY:
		g_value_set_object (value, ft_action_get_settings (self));
		break;
		case FT_ACTION_ENABLED_PROPERTY:
		g_value_set_boolean (value, ft_action_get_enabled (self));
		break;
		case FT_ACTION_DISPLAY_NAME_PROPERTY:
		g_value_set_string (value, ft_action_get_display_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_action_set_property (GObject * object,
                              guint property_id,
                              const GValue * value,
                              GParamSpec * pspec)
{
	FtAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_ACTION, FtAction);
	switch (property_id) {
		case FT_ACTION_UUID_PROPERTY:
		ft_action_set_uuid (self, g_value_get_string (value));
		break;
		case FT_ACTION_ENABLED_PROPERTY:
		ft_action_set_enabled (self, g_value_get_boolean (value));
		break;
		case FT_ACTION_DISPLAY_NAME_PROPERTY:
		ft_action_set_display_name (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
ft_event_action_get_instance_private (FtEventAction* self)
{
	return G_STRUCT_MEMBER_P (self, FtEventAction_private_offset);
}

FtEventAction*
ft_event_action_construct (GType object_type,
                           const gchar* uuid)
{
	FtEventAction * self = NULL;
	self = (FtEventAction*) g_object_new (object_type, "uuid", uuid, NULL);
	return self;
}

FtEventAction*
ft_event_action_new (const gchar* uuid)
{
	return ft_event_action_construct (FT_TYPE_EVENT_ACTION, uuid);
}

static void
ft_event_action_real_load (FtAction* base,
                           GSettings* settings)
{
	FtEventAction * self;
	gchar* condition_string = NULL;
	gchar* _tmp0_;
	FtExpression* condition = NULL;
	const gchar* _tmp1_;
	gchar** _tmp9_;
	gchar** _tmp10_;
	gchar** _tmp11_;
	gint _tmp11__length1;
	FtExpression* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	FtCommand* _tmp15_;
	FtCommand* _tmp16_;
	FtCommand* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	FtCommand* _tmp20_;
	FtCommand* _tmp21_;
	GError* _inner_error0_ = NULL;
	self = (FtEventAction*) base;
	g_return_if_fail (settings != NULL);
	FT_ACTION_CLASS (ft_event_action_parent_class)->load (G_TYPE_CHECK_INSTANCE_CAST (self, FT_TYPE_ACTION, FtAction), settings);
	_tmp0_ = g_settings_get_string (settings, "condition");
	condition_string = _tmp0_;
	condition = NULL;
	_tmp1_ = condition_string;
	if (g_strcmp0 (_tmp1_, "") != 0) {
		FtExpressionParser* parser = NULL;
		FtExpressionParser* _tmp2_;
		_tmp2_ = ft_expression_parser_new ();
		parser = _tmp2_;
		{
			FtExpression* _tmp3_ = NULL;
			FtExpressionParser* _tmp4_;
			const gchar* _tmp5_;
			FtExpression* _tmp6_;
			FtExpression* _tmp7_;
			_tmp4_ = parser;
			_tmp5_ = condition_string;
			_tmp6_ = ft_expression_parser_parse (_tmp4_, _tmp5_, &_inner_error0_);
			_tmp3_ = _tmp6_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->domain == FT_EXPRESSION_PARSER_ERROR) {
					goto __catch0_ft_expression_parser_error;
				}
				_ft_expression_parser_free0 (parser);
				_ft_expression_unref0 (condition);
				_g_free0 (condition_string);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
			_tmp7_ = _tmp3_;
			_tmp3_ = NULL;
			_ft_expression_unref0 (condition);
			condition = _tmp7_;
			_ft_expression_unref0 (_tmp3_);
		}
		goto __finally0;
		__catch0_ft_expression_parser_error:
		{
			const gchar* _tmp8_;
			g_clear_error (&_inner_error0_);
			_tmp8_ = condition_string;
			g_warning ("action.vala:139: Failed to parse action condition: `%s`", _tmp8_);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_ft_expression_parser_free0 (parser);
			_ft_expression_unref0 (condition);
			_g_free0 (condition_string);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		_ft_expression_parser_free0 (parser);
	}
	_tmp10_ = _tmp9_ = g_settings_get_strv (settings, "events");
	_tmp11_ = _tmp10_;
	_tmp11__length1 = _vala_array_length (_tmp9_);
	ft_event_action_set_event_names (self, _tmp11_, _vala_array_length (_tmp9_));
	_tmp11_ = (_vala_array_free (_tmp11_, _tmp11__length1, (GDestroyNotify) g_free), NULL);
	_tmp12_ = condition;
	ft_event_action_set_condition (self, _tmp12_);
	ft_event_action_set_wait_for_completion (self, g_settings_get_boolean (settings, "wait-for-completion"));
	_tmp13_ = g_settings_get_string (settings, "command");
	_tmp14_ = _tmp13_;
	_tmp15_ = ft_command_new (_tmp14_);
	_tmp16_ = _tmp15_;
	ft_event_action_set_command (self, _tmp16_);
	_g_object_unref0 (_tmp16_);
	_g_free0 (_tmp14_);
	_tmp17_ = self->priv->_command;
	_tmp18_ = g_settings_get_string (settings, "working-directory");
	_tmp19_ = _tmp18_;
	ft_command_set_working_directory (_tmp17_, _tmp19_);
	_g_free0 (_tmp19_);
	_tmp20_ = self->priv->_command;
	ft_command_set_use_subshell (_tmp20_, g_settings_get_boolean (settings, "use-subshell"));
	_tmp21_ = self->priv->_command;
	ft_command_set_pass_input (_tmp21_, g_settings_get_boolean (settings, "pass-input"));
	_ft_expression_unref0 (condition);
	_g_free0 (condition_string);
}

static gpointer
_ft_expression_ref0 (gpointer self)
{
	return self ? ft_expression_ref (self) : NULL;
}

static void
ft_event_action_real_save (FtAction* base,
                           GSettings* settings)
{
	FtEventAction * self;
	FtCommand* command = NULL;
	FtCommand* _tmp0_;
	FtCommand* _tmp1_;
	FtExpression* condition = NULL;
	FtExpression* _tmp2_;
	FtExpression* _tmp3_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gint _tmp5_ = 0;
	gchar** _tmp6_;
	gint _tmp6__length1;
	gboolean _tmp7_;
	FtExpression* _tmp8_;
	FtCommand* _tmp12_;
	self = (FtEventAction*) base;
	g_return_if_fail (settings != NULL);
	_tmp0_ = self->priv->_command;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	command = _tmp1_;
	_tmp2_ = self->priv->_condition;
	_tmp3_ = _ft_expression_ref0 (_tmp2_);
	condition = _tmp3_;
	FT_ACTION_CLASS (ft_event_action_parent_class)->save (G_TYPE_CHECK_INSTANCE_CAST (self, FT_TYPE_ACTION, FtAction), settings);
	g_settings_set_enum (settings, "trigger", (gint) FT_ACTION_TRIGGER_EVENT);
	_tmp4_ = ft_event_action_get_event_names (self, &_tmp5_);
	_tmp4__length1 = _tmp5_;
	_tmp6_ = _tmp4_;
	_tmp6__length1 = _tmp4__length1;
	g_settings_set_strv (settings, "events", _tmp6_);
	_tmp7_ = self->priv->_wait_for_completion;
	g_settings_set_boolean (settings, "wait-for-completion", _tmp7_);
	_tmp8_ = condition;
	if (_tmp8_ != NULL) {
		FtExpression* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp9_ = condition;
		_tmp10_ = ft_expression_to_string (_tmp9_);
		_tmp11_ = _tmp10_;
		g_settings_set_string (settings, "condition", _tmp11_);
		_g_free0 (_tmp11_);
	} else {
		g_settings_reset (settings, "condition");
	}
	_tmp12_ = command;
	if (_tmp12_ != NULL) {
		FtCommand* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		FtCommand* _tmp18_;
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		FtCommand* _tmp23_;
		gboolean _tmp24_;
		gboolean _tmp25_;
		FtCommand* _tmp26_;
		gboolean _tmp27_;
		gboolean _tmp28_;
		_tmp13_ = command;
		_tmp14_ = ft_command_get_line (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = ft_ensure_string (_tmp15_);
		_tmp17_ = _tmp16_;
		g_settings_set_string (settings, "command", _tmp17_);
		_g_free0 (_tmp17_);
		_tmp18_ = command;
		_tmp19_ = ft_command_get_working_directory (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp21_ = ft_ensure_string (_tmp20_);
		_tmp22_ = _tmp21_;
		g_settings_set_string (settings, "working-directory", _tmp22_);
		_g_free0 (_tmp22_);
		_tmp23_ = command;
		_tmp24_ = ft_command_get_use_subshell (_tmp23_);
		_tmp25_ = _tmp24_;
		g_settings_set_boolean (settings, "use-subshell", _tmp25_);
		_tmp26_ = command;
		_tmp27_ = ft_command_get_pass_input (_tmp26_);
		_tmp28_ = _tmp27_;
		g_settings_set_boolean (settings, "pass-input", _tmp28_);
	} else {
		g_settings_reset (settings, "command");
		g_settings_reset (settings, "working-directory");
		g_settings_reset (settings, "use-subshell");
		g_settings_reset (settings, "pass-input");
	}
	_ft_expression_unref0 (condition);
	_g_object_unref0 (command);
}

static void
ft_event_action_on_event (FtEventAction* self,
                          FtEvent* event)
{
	FtCommand* command = NULL;
	FtCommand* _tmp0_;
	FtCommand* _tmp1_;
	guint context_checksum = 0U;
	FtContext* _tmp2_;
	FtCommandExecution* execution = NULL;
	FtCommand* _tmp3_;
	FtContext* _tmp20_;
	FtCommandExecution* _tmp21_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (event != NULL);
	_tmp0_ = self->priv->_command;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	command = _tmp1_;
	_tmp2_ = event->context;
	context_checksum = ft_context_calculate_checksum (_tmp2_);
	execution = NULL;
	if (context_checksum == self->priv->last_context_checksum) {
		_g_object_unref0 (execution);
		_g_object_unref0 (command);
		return;
	}
	self->priv->last_context_checksum = context_checksum;
	_tmp3_ = command;
	if (_tmp3_ != NULL) {
		gboolean _tmp4_;
		_tmp4_ = self->priv->_wait_for_completion;
		if (_tmp4_) {
			FtCommand* _tmp5_;
			FtContext* _tmp6_;
			FtCommandExecution* _tmp7_;
			gboolean _tmp8_ = FALSE;
			FtCommandExecution* _tmp9_;
			_tmp5_ = command;
			_tmp6_ = event->context;
			_tmp7_ = ft_command_prepare (_tmp5_, _tmp6_);
			_g_object_unref0 (execution);
			execution = _tmp7_;
			_tmp9_ = execution;
			if (_tmp9_ != NULL) {
				FtCommandExecution* _tmp10_;
				gboolean _tmp11_;
				gboolean _tmp12_;
				_tmp10_ = execution;
				_tmp11_ = ft_job_get_completed ((FtJob*) _tmp10_);
				_tmp12_ = _tmp11_;
				_tmp8_ = !_tmp12_;
			} else {
				_tmp8_ = FALSE;
			}
			if (_tmp8_) {
				FtCommandExecution* _tmp13_;
				FtJobQueue* queue = NULL;
				FtJobQueue* _tmp14_;
				FtJobQueue* _tmp15_;
				FtCommandExecution* _tmp16_;
				_tmp13_ = execution;
				ft_command_execution_set_timeout (_tmp13_, FT_COMMAND_TIMEOUT);
				_tmp14_ = ft_job_queue_new ();
				queue = _tmp14_;
				_tmp15_ = queue;
				_tmp16_ = execution;
				ft_job_queue_push (_tmp15_, (FtJob*) _tmp16_);
				_g_object_unref0 (queue);
			}
		} else {
			FtCommand* _tmp17_;
			FtContext* _tmp18_;
			FtCommandExecution* _tmp19_;
			_tmp17_ = command;
			_tmp18_ = event->context;
			_tmp19_ = ft_command_execute (_tmp17_, _tmp18_);
			_g_object_unref0 (execution);
			execution = _tmp19_;
		}
	}
	_tmp20_ = event->context;
	_tmp21_ = execution;
	g_signal_emit (self, ft_event_action_signals[FT_EVENT_ACTION_TRIGGERED_SIGNAL], 0, _tmp20_, _tmp21_);
	_g_object_unref0 (execution);
	_g_object_unref0 (command);
}

static void
_ft_event_action_on_event_ft_event_callback (FtEvent* event,
                                             gpointer self)
{
	ft_event_action_on_event ((FtEventAction*) self, event);
}

static void
_vala_array_add1 (guint* * array,
                  gint* length,
                  gint* size,
                  guint value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (guint, *array, *size);
	}
	(*array)[(*length)++] = value;
}

static void
ft_event_action_real_bind (FtAction* base)
{
	FtEventAction * self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	self = (FtEventAction*) base;
	_tmp0_ = ft_action_get_enabled ((FtAction*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		FtExpression* condition = NULL;
		FtExpression* _tmp2_;
		FtExpression* _tmp3_;
		gchar** _tmp4_;
		gint _tmp4__length1;
		gint _tmp5_ = 0;
		gchar** _tmp6_;
		gint _tmp6__length1;
		guint* _tmp11_;
		gint _tmp11__length1;
		gchar** _tmp12_;
		gint _tmp12__length1;
		gint _tmp13_ = 0;
		gchar** _tmp14_;
		gint _tmp14__length1;
		_tmp2_ = self->priv->_condition;
		_tmp3_ = _ft_expression_ref0 (_tmp2_);
		condition = _tmp3_;
		_tmp4_ = ft_event_action_get_event_names (self, &_tmp5_);
		_tmp4__length1 = _tmp5_;
		_tmp6_ = _tmp4_;
		_tmp6__length1 = _tmp4__length1;
		{
			gchar** event_name_collection = NULL;
			gint event_name_collection_length1 = 0;
			gint _event_name_collection_size_ = 0;
			gint event_name_it = 0;
			event_name_collection = _tmp6_;
			event_name_collection_length1 = _tmp6__length1;
			for (event_name_it = 0; event_name_it < event_name_collection_length1; event_name_it = event_name_it + 1) {
				gchar* _tmp7_;
				gchar* event_name = NULL;
				_tmp7_ = g_strdup (event_name_collection[event_name_it]);
				event_name = _tmp7_;
				{
					guint watch_id = 0U;
					FtEventBus* _tmp8_;
					const gchar* _tmp9_;
					FtExpression* _tmp10_;
					_tmp8_ = self->priv->bus;
					_tmp9_ = event_name;
					_tmp10_ = condition;
					watch_id = ft_event_bus_add_event_watch (_tmp8_, _tmp9_, _tmp10_, _ft_event_action_on_event_ft_event_callback, g_object_ref (self), g_object_unref);
					_vala_array_add1 (&self->priv->watch_ids, &self->priv->watch_ids_length1, &self->priv->_watch_ids_size_, watch_id);
					_g_free0 (event_name);
				}
			}
		}
		_tmp11_ = self->priv->watch_ids;
		_tmp11__length1 = self->priv->watch_ids_length1;
		_tmp12_ = ft_event_action_get_event_names (self, &_tmp13_);
		_tmp12__length1 = _tmp13_;
		_tmp14_ = _tmp12_;
		_tmp14__length1 = _tmp12__length1;
		_vala_assert (_tmp11__length1 == _tmp14__length1, "this.watch_ids.length == this.event_names.length");
		_ft_expression_unref0 (condition);
	}
}

static void
ft_event_action_real_unbind (FtAction* base)
{
	FtEventAction * self;
	guint* _tmp0_;
	gint _tmp0__length1;
	guint* _tmp2_;
	self = (FtEventAction*) base;
	_tmp0_ = self->priv->watch_ids;
	_tmp0__length1 = self->priv->watch_ids_length1;
	{
		guint* watch_id_collection = NULL;
		gint watch_id_collection_length1 = 0;
		gint _watch_id_collection_size_ = 0;
		gint watch_id_it = 0;
		watch_id_collection = _tmp0_;
		watch_id_collection_length1 = _tmp0__length1;
		for (watch_id_it = 0; watch_id_it < watch_id_collection_length1; watch_id_it = watch_id_it + 1) {
			guint watch_id = 0U;
			watch_id = watch_id_collection[watch_id_it];
			{
				FtEventBus* _tmp1_;
				_tmp1_ = self->priv->bus;
				ft_event_bus_remove_event_watch (_tmp1_, watch_id);
			}
		}
	}
	_tmp2_ = g_new0 (guint, 0);
	self->priv->watch_ids = (g_free (self->priv->watch_ids), NULL);
	self->priv->watch_ids = _tmp2_;
	self->priv->watch_ids_length1 = 0;
	self->priv->_watch_ids_size_ = self->priv->watch_ids_length1;
}

gchar**
ft_event_action_get_event_names (FtEventAction* self,
                                 gint* result_length1)
{
	gchar** result;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_event_names;
	_tmp0__length1 = self->priv->_event_names_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

static gchar**
_vala_array_dup1 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize 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;
	}
	return NULL;
}

void
ft_event_action_set_event_names (FtEventAction* self,
                                 gchar** value,
                                 gint value_length1)
{
	gchar** old_value;
	gint old_value_length;
	g_return_if_fail (self != NULL);
	old_value = ft_event_action_get_event_names (self, &old_value_length);
	if (old_value != value) {
		gchar** _tmp0_;
		gint _tmp0__length1;
		_tmp0_ = (value != NULL) ? _vala_array_dup1 (value, value_length1) : value;
		_tmp0__length1 = value_length1;
		self->priv->_event_names = (_vala_array_free (self->priv->_event_names, self->priv->_event_names_length1, (GDestroyNotify) g_free), NULL);
		self->priv->_event_names = _tmp0_;
		self->priv->_event_names_length1 = _tmp0__length1;
		self->priv->__event_names_size_ = self->priv->_event_names_length1;
		g_object_notify_by_pspec ((GObject *) self, ft_event_action_properties[FT_EVENT_ACTION_EVENT_NAMES_PROPERTY]);
	}
}

FtExpression*
ft_event_action_get_condition (FtEventAction* self)
{
	FtExpression* result;
	FtExpression* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_condition;
	result = _tmp0_;
	return result;
}

void
ft_event_action_set_condition (FtEventAction* self,
                               FtExpression* value)
{
	FtExpression* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_event_action_get_condition (self);
	if (old_value != value) {
		FtExpression* _tmp0_;
		_tmp0_ = _ft_expression_ref0 (value);
		_ft_expression_unref0 (self->priv->_condition);
		self->priv->_condition = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_event_action_properties[FT_EVENT_ACTION_CONDITION_PROPERTY]);
	}
}

FtCommand*
ft_event_action_get_command (FtEventAction* self)
{
	FtCommand* result;
	FtCommand* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_command;
	result = _tmp0_;
	return result;
}

void
ft_event_action_set_command (FtEventAction* self,
                             FtCommand* value)
{
	FtCommand* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_event_action_get_command (self);
	if (old_value != value) {
		FtCommand* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_command);
		self->priv->_command = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_event_action_properties[FT_EVENT_ACTION_COMMAND_PROPERTY]);
	}
}

gboolean
ft_event_action_get_wait_for_completion (FtEventAction* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_wait_for_completion;
	return result;
}

void
ft_event_action_set_wait_for_completion (FtEventAction* self,
                                         gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_event_action_get_wait_for_completion (self);
	if (old_value != value) {
		self->priv->_wait_for_completion = value;
		g_object_notify_by_pspec ((GObject *) self, ft_event_action_properties[FT_EVENT_ACTION_WAIT_FOR_COMPLETION_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_VOID__FT_CONTEXT_OBJECT (GClosure * closure,
                                                 GValue * return_value,
                                                 guint n_param_values,
                                                 const GValue * param_values,
                                                 gpointer invocation_hint,
                                                 gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__FT_CONTEXT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__FT_CONTEXT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__FT_CONTEXT_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, ft_value_get_context (param_values + 1), g_value_get_object (param_values + 2), data2);
}

static GObject *
ft_event_action_constructor (GType type,
                             guint n_construct_properties,
                             GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtEventAction * self;
	FtEventBus* _tmp0_;
	guint* _tmp1_;
	parent_class = G_OBJECT_CLASS (ft_event_action_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_EVENT_ACTION, FtEventAction);
	_tmp0_ = ft_event_bus_new ();
	_g_object_unref0 (self->priv->bus);
	self->priv->bus = _tmp0_;
	_tmp1_ = g_new0 (guint, 0);
	self->priv->watch_ids = (g_free (self->priv->watch_ids), NULL);
	self->priv->watch_ids = _tmp1_;
	self->priv->watch_ids_length1 = 0;
	self->priv->_watch_ids_size_ = self->priv->watch_ids_length1;
	return obj;
}

static void
ft_event_action_class_init (FtEventActionClass * klass,
                            gpointer klass_data)
{
	ft_event_action_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtEventAction_private_offset);
	((FtActionClass *) klass)->load = (void (*) (FtAction*, GSettings*)) ft_event_action_real_load;
	((FtActionClass *) klass)->save = (void (*) (FtAction*, GSettings*)) ft_event_action_real_save;
	((FtActionClass *) klass)->bind = (void (*) (FtAction*)) ft_event_action_real_bind;
	((FtActionClass *) klass)->unbind = (void (*) (FtAction*)) ft_event_action_real_unbind;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_event_action_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_event_action_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_event_action_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_event_action_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_EVENT_ACTION_EVENT_NAMES_PROPERTY, ft_event_action_properties[FT_EVENT_ACTION_EVENT_NAMES_PROPERTY] = g_param_spec_boxed ("event-names", "event-names", "event-names", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_EVENT_ACTION_CONDITION_PROPERTY, ft_event_action_properties[FT_EVENT_ACTION_CONDITION_PROPERTY] = ft_param_spec_expression ("condition", "condition", "condition", FT_TYPE_EXPRESSION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_EVENT_ACTION_COMMAND_PROPERTY, ft_event_action_properties[FT_EVENT_ACTION_COMMAND_PROPERTY] = g_param_spec_object ("command", "command", "command", FT_TYPE_COMMAND, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_EVENT_ACTION_WAIT_FOR_COMPLETION_PROPERTY, ft_event_action_properties[FT_EVENT_ACTION_WAIT_FOR_COMPLETION_PROPERTY] = g_param_spec_boolean ("wait-for-completion", "wait-for-completion", "wait-for-completion", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	ft_event_action_signals[FT_EVENT_ACTION_TRIGGERED_SIGNAL] = g_signal_new ("triggered", FT_TYPE_EVENT_ACTION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__FT_CONTEXT_OBJECT, G_TYPE_NONE, 2, FT_TYPE_CONTEXT, FT_TYPE_COMMAND_EXECUTION);
}

static void
ft_event_action_instance_init (FtEventAction * self,
                               gpointer klass)
{
	self->priv = ft_event_action_get_instance_private (self);
	self->priv->_wait_for_completion = TRUE;
	self->priv->last_context_checksum = (guint) 0;
}

static void
ft_event_action_finalize (GObject * obj)
{
	FtEventAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_EVENT_ACTION, FtEventAction);
	self->priv->_event_names = (_vala_array_free (self->priv->_event_names, self->priv->_event_names_length1, (GDestroyNotify) g_free), NULL);
	_ft_expression_unref0 (self->priv->_condition);
	_g_object_unref0 (self->priv->_command);
	_g_object_unref0 (self->priv->bus);
	self->priv->watch_ids = (g_free (self->priv->watch_ids), NULL);
	G_OBJECT_CLASS (ft_event_action_parent_class)->finalize (obj);
}

static GType
ft_event_action_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtEventActionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_event_action_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtEventAction), 0, (GInstanceInitFunc) ft_event_action_instance_init, NULL };
	GType ft_event_action_type_id;
	ft_event_action_type_id = g_type_register_static (FT_TYPE_ACTION, "FtEventAction", &g_define_type_info, 0);
	FtEventAction_private_offset = g_type_add_instance_private (ft_event_action_type_id, sizeof (FtEventActionPrivate));
	return ft_event_action_type_id;
}

GType
ft_event_action_get_type (void)
{
	static volatile gsize ft_event_action_type_id__once = 0;
	if (g_once_init_enter (&ft_event_action_type_id__once)) {
		GType ft_event_action_type_id;
		ft_event_action_type_id = ft_event_action_get_type_once ();
		g_once_init_leave (&ft_event_action_type_id__once, ft_event_action_type_id);
	}
	return ft_event_action_type_id__once;
}

static void
_vala_ft_event_action_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	FtEventAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_EVENT_ACTION, FtEventAction);
	switch (property_id) {
		case FT_EVENT_ACTION_EVENT_NAMES_PROPERTY:
		{
			int length;
			g_value_set_boxed (value, ft_event_action_get_event_names (self, &length));
		}
		break;
		case FT_EVENT_ACTION_CONDITION_PROPERTY:
		ft_value_set_expression (value, ft_event_action_get_condition (self));
		break;
		case FT_EVENT_ACTION_COMMAND_PROPERTY:
		g_value_set_object (value, ft_event_action_get_command (self));
		break;
		case FT_EVENT_ACTION_WAIT_FOR_COMPLETION_PROPERTY:
		g_value_set_boolean (value, ft_event_action_get_wait_for_completion (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_event_action_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	FtEventAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_EVENT_ACTION, FtEventAction);
	switch (property_id) {
		case FT_EVENT_ACTION_EVENT_NAMES_PROPERTY:
		{
			gpointer boxed;
			boxed = g_value_get_boxed (value);
			ft_event_action_set_event_names (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
		}
		break;
		case FT_EVENT_ACTION_CONDITION_PROPERTY:
		ft_event_action_set_condition (self, ft_value_get_expression (value));
		break;
		case FT_EVENT_ACTION_COMMAND_PROPERTY:
		ft_event_action_set_command (self, g_value_get_object (value));
		break;
		case FT_EVENT_ACTION_WAIT_FOR_COMPLETION_PROPERTY:
		ft_event_action_set_wait_for_completion (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
ft_condition_action_get_instance_private (FtConditionAction* self)
{
	return G_STRUCT_MEMBER_P (self, FtConditionAction_private_offset);
}

FtConditionAction*
ft_condition_action_construct (GType object_type,
                               const gchar* uuid)
{
	FtConditionAction * self = NULL;
	self = (FtConditionAction*) g_object_new (object_type, "uuid", uuid, NULL);
	return self;
}

FtConditionAction*
ft_condition_action_new (const gchar* uuid)
{
	return ft_condition_action_construct (FT_TYPE_CONDITION_ACTION, uuid);
}

static void
ft_condition_action_real_load (FtAction* base,
                               GSettings* settings)
{
	FtConditionAction * self;
	gchar* condition_string = NULL;
	gchar* _tmp0_;
	FtExpression* condition = NULL;
	const gchar* _tmp1_;
	FtExpression* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	FtCommand* _tmp12_;
	FtCommand* _tmp13_;
	FtCommand* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	FtCommand* _tmp17_;
	FtCommand* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	FtCommand* _tmp21_;
	FtCommand* _tmp22_;
	FtCommand* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	FtCommand* _tmp26_;
	FtCommand* _tmp27_;
	GError* _inner_error0_ = NULL;
	self = (FtConditionAction*) base;
	g_return_if_fail (settings != NULL);
	FT_ACTION_CLASS (ft_condition_action_parent_class)->load (G_TYPE_CHECK_INSTANCE_CAST (self, FT_TYPE_ACTION, FtAction), settings);
	_tmp0_ = g_settings_get_string (settings, "condition");
	condition_string = _tmp0_;
	condition = NULL;
	_tmp1_ = condition_string;
	if (g_strcmp0 (_tmp1_, "") != 0) {
		FtExpressionParser* parser = NULL;
		FtExpressionParser* _tmp2_;
		_tmp2_ = ft_expression_parser_new ();
		parser = _tmp2_;
		{
			FtExpression* _tmp3_ = NULL;
			FtExpressionParser* _tmp4_;
			const gchar* _tmp5_;
			FtExpression* _tmp6_;
			FtExpression* _tmp7_;
			_tmp4_ = parser;
			_tmp5_ = condition_string;
			_tmp6_ = ft_expression_parser_parse (_tmp4_, _tmp5_, &_inner_error0_);
			_tmp3_ = _tmp6_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->domain == FT_EXPRESSION_PARSER_ERROR) {
					goto __catch0_ft_expression_parser_error;
				}
				_ft_expression_parser_free0 (parser);
				_ft_expression_unref0 (condition);
				_g_free0 (condition_string);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
			_tmp7_ = _tmp3_;
			_tmp3_ = NULL;
			_ft_expression_unref0 (condition);
			condition = _tmp7_;
			_ft_expression_unref0 (_tmp3_);
		}
		goto __finally0;
		__catch0_ft_expression_parser_error:
		{
			const gchar* _tmp8_;
			g_clear_error (&_inner_error0_);
			_tmp8_ = condition_string;
			g_warning ("action.vala:287: Failed to parse action condition: `%s`", _tmp8_);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_ft_expression_parser_free0 (parser);
			_ft_expression_unref0 (condition);
			_g_free0 (condition_string);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		_ft_expression_parser_free0 (parser);
	}
	_tmp9_ = condition;
	ft_condition_action_set_condition (self, _tmp9_);
	_tmp10_ = g_settings_get_string (settings, "command");
	_tmp11_ = _tmp10_;
	_tmp12_ = ft_command_new (_tmp11_);
	_tmp13_ = _tmp12_;
	ft_condition_action_set_enter_command (self, _tmp13_);
	_g_object_unref0 (_tmp13_);
	_g_free0 (_tmp11_);
	_tmp14_ = self->priv->_enter_command;
	_tmp15_ = g_settings_get_string (settings, "working-directory");
	_tmp16_ = _tmp15_;
	ft_command_set_working_directory (_tmp14_, _tmp16_);
	_g_free0 (_tmp16_);
	_tmp17_ = self->priv->_enter_command;
	ft_command_set_use_subshell (_tmp17_, g_settings_get_boolean (settings, "use-subshell"));
	_tmp18_ = self->priv->_enter_command;
	ft_command_set_pass_input (_tmp18_, g_settings_get_boolean (settings, "pass-input"));
	_tmp19_ = g_settings_get_string (settings, "exit-command");
	_tmp20_ = _tmp19_;
	_tmp21_ = ft_command_new (_tmp20_);
	_tmp22_ = _tmp21_;
	ft_condition_action_set_exit_command (self, _tmp22_);
	_g_object_unref0 (_tmp22_);
	_g_free0 (_tmp20_);
	_tmp23_ = self->priv->_exit_command;
	_tmp24_ = g_settings_get_string (settings, "working-directory");
	_tmp25_ = _tmp24_;
	ft_command_set_working_directory (_tmp23_, _tmp25_);
	_g_free0 (_tmp25_);
	_tmp26_ = self->priv->_exit_command;
	ft_command_set_use_subshell (_tmp26_, g_settings_get_boolean (settings, "use-subshell"));
	_tmp27_ = self->priv->_exit_command;
	ft_command_set_pass_input (_tmp27_, g_settings_get_boolean (settings, "pass-input"));
	_ft_expression_unref0 (condition);
	_g_free0 (condition_string);
}

static void
ft_condition_action_real_save (FtAction* base,
                               GSettings* settings)
{
	FtConditionAction * self;
	FtExpression* condition = NULL;
	FtExpression* _tmp0_;
	FtExpression* _tmp1_;
	FtCommand* enter_command = NULL;
	FtCommand* _tmp2_;
	FtCommand* _tmp3_;
	FtCommand* exit_command = NULL;
	FtCommand* _tmp4_;
	FtCommand* _tmp5_;
	FtCommand* _tmp6_ = NULL;
	FtCommand* _tmp7_;
	FtCommand* any_command = NULL;
	FtCommand* _tmp10_;
	FtExpression* _tmp11_;
	FtCommand* _tmp15_;
	FtCommand* _tmp21_;
	FtCommand* _tmp27_;
	self = (FtConditionAction*) base;
	g_return_if_fail (settings != NULL);
	_tmp0_ = self->priv->_condition;
	_tmp1_ = _ft_expression_ref0 (_tmp0_);
	condition = _tmp1_;
	_tmp2_ = self->priv->_enter_command;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	enter_command = _tmp3_;
	_tmp4_ = self->priv->_exit_command;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	exit_command = _tmp5_;
	_tmp7_ = enter_command;
	if (_tmp7_ != NULL) {
		FtCommand* _tmp8_;
		_tmp8_ = enter_command;
		_tmp6_ = _tmp8_;
	} else {
		FtCommand* _tmp9_;
		_tmp9_ = exit_command;
		_tmp6_ = _tmp9_;
	}
	_tmp10_ = _g_object_ref0 (_tmp6_);
	any_command = _tmp10_;
	FT_ACTION_CLASS (ft_condition_action_parent_class)->save (G_TYPE_CHECK_INSTANCE_CAST (self, FT_TYPE_ACTION, FtAction), settings);
	g_settings_set_enum (settings, "trigger", (gint) FT_ACTION_TRIGGER_CONDITION);
	_tmp11_ = condition;
	if (_tmp11_ != NULL) {
		FtExpression* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		_tmp12_ = condition;
		_tmp13_ = ft_expression_to_string (_tmp12_);
		_tmp14_ = _tmp13_;
		g_settings_set_string (settings, "condition", _tmp14_);
		_g_free0 (_tmp14_);
	} else {
		g_settings_reset (settings, "condition");
	}
	_tmp15_ = enter_command;
	if (_tmp15_ != NULL) {
		FtCommand* _tmp16_;
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		_tmp16_ = enter_command;
		_tmp17_ = ft_command_get_line (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = ft_ensure_string (_tmp18_);
		_tmp20_ = _tmp19_;
		g_settings_set_string (settings, "command", _tmp20_);
		_g_free0 (_tmp20_);
	} else {
		g_settings_reset (settings, "command");
	}
	_tmp21_ = exit_command;
	if (_tmp21_ != NULL) {
		FtCommand* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		_tmp22_ = exit_command;
		_tmp23_ = ft_command_get_line (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = ft_ensure_string (_tmp24_);
		_tmp26_ = _tmp25_;
		g_settings_set_string (settings, "exit-command", _tmp26_);
		_g_free0 (_tmp26_);
	} else {
		g_settings_reset (settings, "exit-command");
	}
	_tmp27_ = any_command;
	if (_tmp27_ != NULL) {
		FtCommand* _tmp28_;
		const gchar* _tmp29_;
		const gchar* _tmp30_;
		gchar* _tmp31_;
		gchar* _tmp32_;
		FtCommand* _tmp33_;
		gboolean _tmp34_;
		gboolean _tmp35_;
		FtCommand* _tmp36_;
		gboolean _tmp37_;
		gboolean _tmp38_;
		_tmp28_ = any_command;
		_tmp29_ = ft_command_get_working_directory (_tmp28_);
		_tmp30_ = _tmp29_;
		_tmp31_ = ft_ensure_string (_tmp30_);
		_tmp32_ = _tmp31_;
		g_settings_set_string (settings, "working-directory", _tmp32_);
		_g_free0 (_tmp32_);
		_tmp33_ = any_command;
		_tmp34_ = ft_command_get_use_subshell (_tmp33_);
		_tmp35_ = _tmp34_;
		g_settings_set_boolean (settings, "use-subshell", _tmp35_);
		_tmp36_ = any_command;
		_tmp37_ = ft_command_get_pass_input (_tmp36_);
		_tmp38_ = _tmp37_;
		g_settings_set_boolean (settings, "pass-input", _tmp38_);
	} else {
		g_settings_reset (settings, "working-directory");
		g_settings_reset (settings, "use-subshell");
		g_settings_reset (settings, "pass-input");
	}
	_g_object_unref0 (any_command);
	_g_object_unref0 (exit_command);
	_g_object_unref0 (enter_command);
	_ft_expression_unref0 (condition);
}

static void
ft_condition_action_on_enter_condition (FtConditionAction* self,
                                        FtContext* context)
{
	FtCommand* command = NULL;
	FtCommand* _tmp0_;
	FtCommand* _tmp1_;
	FtCommandExecution* execution = NULL;
	FtCommand* _tmp2_;
	FtCommandExecution* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	_tmp0_ = self->priv->_enter_command;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	command = _tmp1_;
	execution = NULL;
	_tmp2_ = command;
	if (_tmp2_ != NULL) {
		FtCommand* _tmp3_;
		FtCommandExecution* _tmp4_;
		gboolean _tmp5_ = FALSE;
		FtCommandExecution* _tmp6_;
		_tmp3_ = command;
		_tmp4_ = ft_command_prepare (_tmp3_, context);
		_g_object_unref0 (execution);
		execution = _tmp4_;
		_tmp6_ = execution;
		if (_tmp6_ != NULL) {
			FtCommandExecution* _tmp7_;
			gboolean _tmp8_;
			gboolean _tmp9_;
			_tmp7_ = execution;
			_tmp8_ = ft_job_get_completed ((FtJob*) _tmp7_);
			_tmp9_ = _tmp8_;
			_tmp5_ = !_tmp9_;
		} else {
			_tmp5_ = FALSE;
		}
		if (_tmp5_) {
			FtCommandExecution* _tmp10_;
			FtJobQueue* queue = NULL;
			FtJobQueue* _tmp11_;
			FtJobQueue* _tmp12_;
			FtCommandExecution* _tmp13_;
			_tmp10_ = execution;
			ft_command_execution_set_timeout (_tmp10_, FT_COMMAND_TIMEOUT);
			_tmp11_ = ft_job_queue_new ();
			queue = _tmp11_;
			_tmp12_ = queue;
			_tmp13_ = execution;
			ft_job_queue_push (_tmp12_, (FtJob*) _tmp13_);
			_g_object_unref0 (queue);
		}
	}
	_tmp14_ = execution;
	g_signal_emit (self, ft_condition_action_signals[FT_CONDITION_ACTION_ENTERED_CONDITION_SIGNAL], 0, context, _tmp14_);
	_g_object_unref0 (execution);
	_g_object_unref0 (command);
}

static void
ft_condition_action_on_exit_condition (FtConditionAction* self,
                                       FtContext* context)
{
	FtCommand* command = NULL;
	FtCommand* _tmp0_;
	FtCommand* _tmp1_;
	FtCommandExecution* execution = NULL;
	FtCommand* _tmp2_;
	FtCommandExecution* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	_tmp0_ = self->priv->_exit_command;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	command = _tmp1_;
	execution = NULL;
	_tmp2_ = command;
	if (_tmp2_ != NULL) {
		FtCommand* _tmp3_;
		FtCommandExecution* _tmp4_;
		gboolean _tmp5_ = FALSE;
		FtCommandExecution* _tmp6_;
		_tmp3_ = command;
		_tmp4_ = ft_command_prepare (_tmp3_, context);
		_g_object_unref0 (execution);
		execution = _tmp4_;
		_tmp6_ = execution;
		if (_tmp6_ != NULL) {
			FtCommandExecution* _tmp7_;
			gboolean _tmp8_;
			gboolean _tmp9_;
			_tmp7_ = execution;
			_tmp8_ = ft_job_get_completed ((FtJob*) _tmp7_);
			_tmp9_ = _tmp8_;
			_tmp5_ = !_tmp9_;
		} else {
			_tmp5_ = FALSE;
		}
		if (_tmp5_) {
			FtCommandExecution* _tmp10_;
			FtJobQueue* queue = NULL;
			FtJobQueue* _tmp11_;
			FtJobQueue* _tmp12_;
			FtCommandExecution* _tmp13_;
			_tmp10_ = execution;
			ft_command_execution_set_timeout (_tmp10_, FT_COMMAND_TIMEOUT);
			_tmp11_ = ft_job_queue_new ();
			queue = _tmp11_;
			_tmp12_ = queue;
			_tmp13_ = execution;
			ft_job_queue_push (_tmp12_, (FtJob*) _tmp13_);
			_g_object_unref0 (queue);
		}
	}
	_tmp14_ = execution;
	g_signal_emit (self, ft_condition_action_signals[FT_CONDITION_ACTION_EXITED_CONDITION_SIGNAL], 0, context, _tmp14_);
	_g_object_unref0 (execution);
	_g_object_unref0 (command);
}

static void
_ft_condition_action_on_enter_condition_ft_condition_callback (FtContext* context,
                                                               gpointer self)
{
	ft_condition_action_on_enter_condition ((FtConditionAction*) self, context);
}

static void
_ft_condition_action_on_exit_condition_ft_condition_callback (FtContext* context,
                                                              gpointer self)
{
	ft_condition_action_on_exit_condition ((FtConditionAction*) self, context);
}

static void
ft_condition_action_real_bind (FtAction* base)
{
	FtConditionAction * self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = (FtConditionAction*) base;
	_tmp2_ = ft_action_get_enabled ((FtAction*) self);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		FtExpression* _tmp4_;
		_tmp4_ = self->priv->_condition;
		_tmp1_ = _tmp4_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = self->priv->watch_id == ((guint) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		FtEventBus* _tmp5_;
		FtExpression* _tmp6_;
		_tmp5_ = self->priv->bus;
		_tmp6_ = self->priv->_condition;
		self->priv->watch_id = ft_event_bus_add_condition_watch (_tmp5_, _tmp6_, _ft_condition_action_on_enter_condition_ft_condition_callback, g_object_ref (self), g_object_unref, _ft_condition_action_on_exit_condition_ft_condition_callback, g_object_ref (self), g_object_unref);
	}
}

static void
ft_condition_action_real_unbind (FtAction* base)
{
	FtConditionAction * self;
	self = (FtConditionAction*) base;
	if (self->priv->watch_id != ((guint) 0)) {
		FtEventBus* _tmp0_;
		_tmp0_ = self->priv->bus;
		ft_event_bus_remove_condition_watch (_tmp0_, self->priv->watch_id);
		self->priv->watch_id = (guint) 0;
	}
}

FtExpression*
ft_condition_action_get_condition (FtConditionAction* self)
{
	FtExpression* result;
	FtExpression* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_condition;
	result = _tmp0_;
	return result;
}

void
ft_condition_action_set_condition (FtConditionAction* self,
                                   FtExpression* value)
{
	FtExpression* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_condition_action_get_condition (self);
	if (old_value != value) {
		FtExpression* _tmp0_;
		_tmp0_ = _ft_expression_ref0 (value);
		_ft_expression_unref0 (self->priv->_condition);
		self->priv->_condition = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_condition_action_properties[FT_CONDITION_ACTION_CONDITION_PROPERTY]);
	}
}

FtCommand*
ft_condition_action_get_enter_command (FtConditionAction* self)
{
	FtCommand* result;
	FtCommand* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_enter_command;
	result = _tmp0_;
	return result;
}

void
ft_condition_action_set_enter_command (FtConditionAction* self,
                                       FtCommand* value)
{
	FtCommand* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_condition_action_get_enter_command (self);
	if (old_value != value) {
		FtCommand* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_enter_command);
		self->priv->_enter_command = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_condition_action_properties[FT_CONDITION_ACTION_ENTER_COMMAND_PROPERTY]);
	}
}

FtCommand*
ft_condition_action_get_exit_command (FtConditionAction* self)
{
	FtCommand* result;
	FtCommand* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_exit_command;
	result = _tmp0_;
	return result;
}

void
ft_condition_action_set_exit_command (FtConditionAction* self,
                                      FtCommand* value)
{
	FtCommand* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_condition_action_get_exit_command (self);
	if (old_value != value) {
		FtCommand* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_exit_command);
		self->priv->_exit_command = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_condition_action_properties[FT_CONDITION_ACTION_EXIT_COMMAND_PROPERTY]);
	}
}

static GObject *
ft_condition_action_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtConditionAction * self;
	FtEventBus* _tmp0_;
	parent_class = G_OBJECT_CLASS (ft_condition_action_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_CONDITION_ACTION, FtConditionAction);
	_tmp0_ = ft_event_bus_new ();
	_g_object_unref0 (self->priv->bus);
	self->priv->bus = _tmp0_;
	return obj;
}

static void
ft_condition_action_class_init (FtConditionActionClass * klass,
                                gpointer klass_data)
{
	ft_condition_action_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtConditionAction_private_offset);
	((FtActionClass *) klass)->load = (void (*) (FtAction*, GSettings*)) ft_condition_action_real_load;
	((FtActionClass *) klass)->save = (void (*) (FtAction*, GSettings*)) ft_condition_action_real_save;
	((FtActionClass *) klass)->bind = (void (*) (FtAction*)) ft_condition_action_real_bind;
	((FtActionClass *) klass)->unbind = (void (*) (FtAction*)) ft_condition_action_real_unbind;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_condition_action_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_condition_action_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_condition_action_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_condition_action_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CONDITION_ACTION_CONDITION_PROPERTY, ft_condition_action_properties[FT_CONDITION_ACTION_CONDITION_PROPERTY] = ft_param_spec_expression ("condition", "condition", "condition", FT_TYPE_EXPRESSION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CONDITION_ACTION_ENTER_COMMAND_PROPERTY, ft_condition_action_properties[FT_CONDITION_ACTION_ENTER_COMMAND_PROPERTY] = g_param_spec_object ("enter-command", "enter-command", "enter-command", FT_TYPE_COMMAND, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_CONDITION_ACTION_EXIT_COMMAND_PROPERTY, ft_condition_action_properties[FT_CONDITION_ACTION_EXIT_COMMAND_PROPERTY] = g_param_spec_object ("exit-command", "exit-command", "exit-command", FT_TYPE_COMMAND, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	ft_condition_action_signals[FT_CONDITION_ACTION_ENTERED_CONDITION_SIGNAL] = g_signal_new ("entered-condition", FT_TYPE_CONDITION_ACTION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__FT_CONTEXT_OBJECT, G_TYPE_NONE, 2, FT_TYPE_CONTEXT, FT_TYPE_COMMAND_EXECUTION);
	ft_condition_action_signals[FT_CONDITION_ACTION_EXITED_CONDITION_SIGNAL] = g_signal_new ("exited-condition", FT_TYPE_CONDITION_ACTION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__FT_CONTEXT_OBJECT, G_TYPE_NONE, 2, FT_TYPE_CONTEXT, FT_TYPE_COMMAND_EXECUTION);
}

static void
ft_condition_action_instance_init (FtConditionAction * self,
                                   gpointer klass)
{
	self->priv = ft_condition_action_get_instance_private (self);
	self->priv->watch_id = (guint) 0;
}

static void
ft_condition_action_finalize (GObject * obj)
{
	FtConditionAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_CONDITION_ACTION, FtConditionAction);
	_ft_expression_unref0 (self->priv->_condition);
	_g_object_unref0 (self->priv->_enter_command);
	_g_object_unref0 (self->priv->_exit_command);
	_g_object_unref0 (self->priv->bus);
	G_OBJECT_CLASS (ft_condition_action_parent_class)->finalize (obj);
}

static GType
ft_condition_action_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtConditionActionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_condition_action_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtConditionAction), 0, (GInstanceInitFunc) ft_condition_action_instance_init, NULL };
	GType ft_condition_action_type_id;
	ft_condition_action_type_id = g_type_register_static (FT_TYPE_ACTION, "FtConditionAction", &g_define_type_info, 0);
	FtConditionAction_private_offset = g_type_add_instance_private (ft_condition_action_type_id, sizeof (FtConditionActionPrivate));
	return ft_condition_action_type_id;
}

GType
ft_condition_action_get_type (void)
{
	static volatile gsize ft_condition_action_type_id__once = 0;
	if (g_once_init_enter (&ft_condition_action_type_id__once)) {
		GType ft_condition_action_type_id;
		ft_condition_action_type_id = ft_condition_action_get_type_once ();
		g_once_init_leave (&ft_condition_action_type_id__once, ft_condition_action_type_id);
	}
	return ft_condition_action_type_id__once;
}

static void
_vala_ft_condition_action_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	FtConditionAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_CONDITION_ACTION, FtConditionAction);
	switch (property_id) {
		case FT_CONDITION_ACTION_CONDITION_PROPERTY:
		ft_value_set_expression (value, ft_condition_action_get_condition (self));
		break;
		case FT_CONDITION_ACTION_ENTER_COMMAND_PROPERTY:
		g_value_set_object (value, ft_condition_action_get_enter_command (self));
		break;
		case FT_CONDITION_ACTION_EXIT_COMMAND_PROPERTY:
		g_value_set_object (value, ft_condition_action_get_exit_command (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_condition_action_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	FtConditionAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_CONDITION_ACTION, FtConditionAction);
	switch (property_id) {
		case FT_CONDITION_ACTION_CONDITION_PROPERTY:
		ft_condition_action_set_condition (self, ft_value_get_expression (value));
		break;
		case FT_CONDITION_ACTION_ENTER_COMMAND_PROPERTY:
		ft_condition_action_set_enter_command (self, g_value_get_object (value));
		break;
		case FT_CONDITION_ACTION_EXIT_COMMAND_PROPERTY:
		ft_condition_action_set_exit_command (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

