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

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

#include "ft_core.h"
#include <adwaita.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include "ft_ui.h"
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>

#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

#define _ft_expression_unref0(var) ((var == NULL) ? NULL : (var = (ft_expression_unref (var), NULL)))

#define FT_TYPE_EVENT_ROW (ft_event_row_get_type ())
#define FT_EVENT_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FT_TYPE_EVENT_ROW, FtEventRow))
#define FT_EVENT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FT_TYPE_EVENT_ROW, FtEventRowClass))
#define FT_IS_EVENT_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FT_TYPE_EVENT_ROW))
#define FT_IS_EVENT_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FT_TYPE_EVENT_ROW))
#define FT_EVENT_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FT_TYPE_EVENT_ROW, FtEventRowClass))

typedef struct _FtEventRow FtEventRow;
typedef struct _FtEventRowClass FtEventRowClass;
typedef struct _FtEventRowPrivate FtEventRowPrivate;
enum  {
	FT_EVENT_ROW_0_PROPERTY,
	FT_EVENT_ROW_EVENT_NAME_PROPERTY,
	FT_EVENT_ROW_NUM_PROPERTIES
};
static GParamSpec* ft_event_row_properties[FT_EVENT_ROW_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_ROW_REQUEST_REMOVE_SIGNAL,
	FT_EVENT_ROW_NUM_SIGNALS
};
static guint ft_event_row_signals[FT_EVENT_ROW_NUM_SIGNALS] = {0};
typedef struct _FtConditionGroupWidget FtConditionGroupWidget;
typedef struct _FtConditionGroupWidgetClass FtConditionGroupWidgetClass;
enum  {
	FT_ACTION_EDIT_WINDOW_0_PROPERTY,
	FT_ACTION_EDIT_WINDOW_ACTION_UUID_PROPERTY,
	FT_ACTION_EDIT_WINDOW_CREATING_PROPERTY,
	FT_ACTION_EDIT_WINDOW_TRIGGER_PROPERTY,
	FT_ACTION_EDIT_WINDOW_ENABLED_PROPERTY,
	FT_ACTION_EDIT_WINDOW_DISPLAY_NAME_PROPERTY,
	FT_ACTION_EDIT_WINDOW_COMMAND_LINE_PROPERTY,
	FT_ACTION_EDIT_WINDOW_ENTER_COMMAND_LINE_PROPERTY,
	FT_ACTION_EDIT_WINDOW_EXIT_COMMAND_LINE_PROPERTY,
	FT_ACTION_EDIT_WINDOW_WORKING_DIRECTORY_PROPERTY,
	FT_ACTION_EDIT_WINDOW_USE_SUBSHELL_PROPERTY,
	FT_ACTION_EDIT_WINDOW_PASS_INPUT_PROPERTY,
	FT_ACTION_EDIT_WINDOW_WAIT_FOR_COMPLETION_PROPERTY,
	FT_ACTION_EDIT_WINDOW_NUM_PROPERTIES
};
static GParamSpec* ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_NUM_PROPERTIES];
typedef struct _Block21Data Block21Data;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _Block22Data Block22Data;
#define _ft_event_spec_unref0(var) ((var == NULL) ? NULL : (var = (ft_event_spec_unref (var), NULL)))

struct _FtEventRow {
	AdwActionRow parent_instance;
	FtEventRowPrivate * priv;
};

struct _FtEventRowClass {
	AdwActionRowClass parent_class;
};

struct _FtEventRowPrivate {
	gchar* _event_name;
};

struct _FtActionEditWindowPrivate {
	gchar* _action_uuid;
	gboolean _creating;
	GtkButton* save_button;
	GtkSwitch* enabled_switch;
	AdwEntryRow* display_name_entryrow;
	GtkCheckButton* event_radio;
	GtkCheckButton* condition_radio;
	AdwPreferencesGroup* events_group;
	FtConditionGroupWidget* condition_group_widget;
	GtkMenuButton* add_event_button;
	GtkToggleButton* event_condition_button;
	AdwPreferencesGroup* event_condition_group;
	FtConditionGroupWidget* event_condition_group_widget;
	AdwEntryRow* working_directory_entryrow;
	AdwSwitchRow* use_subshell_switchrow;
	AdwSwitchRow* pass_input_switchrow;
	AdwSwitchRow* wait_for_completion_switchrow;
	FtCommandEntryRow* command_entryrow;
	FtCommandEntryRow* enter_command_entryrow;
	FtCommandEntryRow* exit_command_entryrow;
	AdwPreferencesGroup* buttons_group;
	FtActionManager* action_manager;
	FtEventProducer* event_producer;
	GtkListBox* events_listbox;
};

struct _Block21Data {
	int _ref_count_;
	FtActionEditWindow* self;
	GMenu* menu;
	GHashTable* sections;
};

struct _Block22Data {
	int _ref_count_;
	FtActionEditWindow* self;
	GtkFileDialog* file_dialog;
};

static gint FtEventRow_private_offset;
static gpointer ft_event_row_parent_class = NULL;
static gint FtActionEditWindow_private_offset;
static gpointer ft_action_edit_window_parent_class = NULL;

VALA_EXTERN FtExpression* ft_ensure_operation (FtExpression* expression);
VALA_EXTERN GType ft_event_row_get_type (void) G_GNUC_CONST ;
VALA_EXTERN FtEventRow* ft_event_row_new (const gchar* event_name,
                              const gchar* title,
                              const gchar* subtitle);
VALA_EXTERN FtEventRow* ft_event_row_construct (GType object_type,
                                    const gchar* event_name,
                                    const gchar* title,
                                    const gchar* subtitle);
VALA_EXTERN const gchar* ft_event_row_get_event_name (FtEventRow* self);
static void ft_event_row_set_event_name (FtEventRow* self,
                                  const gchar* value);
static GObject * ft_event_row_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties);
static void _ft_event_row___lambda69_ (FtEventRow* self);
static void __ft_event_row___lambda69__gtk_button_clicked (GtkButton* _sender,
                                                    gpointer self);
static void ft_event_row_finalize (GObject * obj);
static GType ft_event_row_get_type_once (void);
static void _vala_ft_event_row_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static void _vala_ft_event_row_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec);
static void ft_action_edit_window_update_event_condition_visible (FtActionEditWindow* self);
static void ft_action_edit_window_populate (FtActionEditWindow* self);
static AdwActionRow* ft_action_edit_window_create_event_row (FtActionEditWindow* self,
                                                      const gchar* event_name);
static void ft_action_edit_window_save_action (FtActionEditWindow* self);
static gchar** ft_action_edit_window_get_event_names (FtActionEditWindow* self,
                                               gint* result_length1);
static void ft_action_edit_window_delete_action (FtActionEditWindow* self);
static GMenu* ft_action_edit_window_create_add_event_menu (FtActionEditWindow* self);
static Block21Data* block21_data_ref (Block21Data* _data21_);
static void block21_data_unref (void * _userdata_);
static void _g_object_unref0_ (gpointer var);
static void __lambda75_ (Block21Data* _data21_,
                  FtEventCategory category);
static void ___lambda75__gfunc (gconstpointer data,
                         gpointer self);
static void ft_action_edit_window_open_working_directory_chooser (FtActionEditWindow* self);
static Block22Data* block22_data_ref (Block22Data* _data22_);
static void block22_data_unref (void * _userdata_);
static void __lambda76_ (Block22Data* _data22_,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda76__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void _ft_action_edit_window_on_cancel_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                         gpointer self);
static void _ft_action_edit_window_on_save_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                       gpointer self);
static void _ft_action_edit_window_on_delete_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                         gpointer self);
static void _ft_action_edit_window_on_trigger_radio_toggled_gtk_check_button_toggled (GtkCheckButton* _sender,
                                                                               gpointer self);
static void ft_action_edit_window_on_event_condition_button_toggled (FtActionEditWindow* self);
static void _ft_action_edit_window_on_event_condition_button_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                         gpointer self);
static void ft_action_edit_window_on_event_condition_request_remove (FtActionEditWindow* self);
static void _ft_action_edit_window_on_event_condition_request_remove_ft_expression_widget_request_remove (FtExpressionWidget* _sender,
                                                                                                   gpointer self);
static void ft_action_edit_window_on_working_directory_button_clicked (FtActionEditWindow* self);
static void _ft_action_edit_window_on_working_directory_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                    gpointer self);
static gboolean ft_action_edit_window_on_key_pressed (FtActionEditWindow* self,
                                               GtkEventControllerKey* event_controller,
                                               guint keyval,
                                               guint keycode,
                                               GdkModifierType state);
static gboolean _ft_action_edit_window_on_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                                     guint keyval,
                                                                                     guint keycode,
                                                                                     GdkModifierType state,
                                                                                     gpointer self);
static void _vala_array_add2 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _adw_preferences_group_remove_ft_event_row_request_remove (FtEventRow* _sender,
                                                                gpointer self);
static void ft_action_edit_window_on_add_event (FtActionEditWindow* self,
                                         const gchar* action_name,
                                         GVariant* parameter);
static gboolean ft_action_edit_window_real_close_request (GtkWindow* base);
static void ft_action_edit_window_real_dispose (GObject* base);
static GObject * ft_action_edit_window_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
VALA_EXTERN GtkWidget* ft_get_child_by_buildable_id (GtkWidget* widget,
                                         const gchar* buildable_id);
static void ft_action_edit_window_finalize (GObject * obj);
static GType ft_action_edit_window_get_type_once (void);
static void _vala_ft_action_edit_window_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_ft_action_edit_window_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 inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

FtExpression*
ft_ensure_operation (FtExpression* expression)
{
	FtExpression* _tmp0_ = NULL;
	FtExpression* _tmp3_;
	FtExpression* result;
	if (G_TYPE_CHECK_INSTANCE_TYPE (expression, FT_TYPE_OPERATION)) {
		FtExpression* _tmp1_;
		_tmp1_ = _ft_expression_ref0 (expression);
		_ft_expression_unref0 (_tmp0_);
		_tmp0_ = _tmp1_;
	} else {
		FtOperation* _tmp2_;
		_tmp2_ = ft_operation_new (FT_OPERATOR_AND, expression, NULL);
		_ft_expression_unref0 (_tmp0_);
		_tmp0_ = (FtExpression*) _tmp2_;
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	result = _tmp3_;
	_ft_expression_unref0 (_tmp0_);
	return result;
}

static inline gpointer
ft_event_row_get_instance_private (FtEventRow* self)
{
	return G_STRUCT_MEMBER_P (self, FtEventRow_private_offset);
}

FtEventRow*
ft_event_row_construct (GType object_type,
                        const gchar* event_name,
                        const gchar* title,
                        const gchar* subtitle)
{
	FtEventRow * self = NULL;
	g_return_val_if_fail (event_name != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	g_return_val_if_fail (subtitle != NULL, NULL);
	self = (FtEventRow*) g_object_new (object_type, "event-name", event_name, "title", title, "subtitle", subtitle, NULL);
	return self;
}

FtEventRow*
ft_event_row_new (const gchar* event_name,
                  const gchar* title,
                  const gchar* subtitle)
{
	return ft_event_row_construct (FT_TYPE_EVENT_ROW, event_name, title, subtitle);
}

const gchar*
ft_event_row_get_event_name (FtEventRow* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_event_name;
	result = _tmp0_;
	return result;
}

static void
ft_event_row_set_event_name (FtEventRow* self,
                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_event_row_get_event_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_event_name);
		self->priv->_event_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_event_row_properties[FT_EVENT_ROW_EVENT_NAME_PROPERTY]);
	}
}

static void
_ft_event_row___lambda69_ (FtEventRow* self)
{
	g_signal_emit (self, ft_event_row_signals[FT_EVENT_ROW_REQUEST_REMOVE_SIGNAL], 0);
}

static void
__ft_event_row___lambda69__gtk_button_clicked (GtkButton* _sender,
                                               gpointer self)
{
	_ft_event_row___lambda69_ ((FtEventRow*) self);
}

static GObject *
ft_event_row_constructor (GType type,
                          guint n_construct_properties,
                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtEventRow * self;
	GtkButton* remove_button = NULL;
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	GtkButton* _tmp5_;
	parent_class = G_OBJECT_CLASS (ft_event_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_EVENT_ROW, FtEventRow);
	_tmp0_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp0_);
	remove_button = _tmp0_;
	_tmp1_ = remove_button;
	gtk_button_set_icon_name (_tmp1_, "window-close-symbolic");
	_tmp2_ = remove_button;
	gtk_widget_set_valign ((GtkWidget*) _tmp2_, GTK_ALIGN_CENTER);
	_tmp3_ = remove_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp3_, "flat");
	_tmp4_ = remove_button;
	g_signal_connect_object (_tmp4_, "clicked", (GCallback) __ft_event_row___lambda69__gtk_button_clicked, self, 0);
	_tmp5_ = remove_button;
	adw_action_row_add_suffix ((AdwActionRow*) self, (GtkWidget*) _tmp5_);
	_g_object_unref0 (remove_button);
	return obj;
}

static void
ft_event_row_class_init (FtEventRowClass * klass,
                         gpointer klass_data)
{
	ft_event_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtEventRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_event_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_event_row_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_event_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_event_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_EVENT_ROW_EVENT_NAME_PROPERTY, ft_event_row_properties[FT_EVENT_ROW_EVENT_NAME_PROPERTY] = g_param_spec_string ("event-name", "event-name", "event-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	ft_event_row_signals[FT_EVENT_ROW_REQUEST_REMOVE_SIGNAL] = g_signal_new ("request-remove", FT_TYPE_EVENT_ROW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
ft_event_row_instance_init (FtEventRow * self,
                            gpointer klass)
{
	self->priv = ft_event_row_get_instance_private (self);
}

static void
ft_event_row_finalize (GObject * obj)
{
	FtEventRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_EVENT_ROW, FtEventRow);
	_g_free0 (self->priv->_event_name);
	G_OBJECT_CLASS (ft_event_row_parent_class)->finalize (obj);
}

static GType
ft_event_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtEventRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_event_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtEventRow), 0, (GInstanceInitFunc) ft_event_row_instance_init, NULL };
	GType ft_event_row_type_id;
	ft_event_row_type_id = g_type_register_static (adw_action_row_get_type (), "FtEventRow", &g_define_type_info, 0);
	FtEventRow_private_offset = g_type_add_instance_private (ft_event_row_type_id, sizeof (FtEventRowPrivate));
	return ft_event_row_type_id;
}

GType
ft_event_row_get_type (void)
{
	static volatile gsize ft_event_row_type_id__once = 0;
	if (g_once_init_enter (&ft_event_row_type_id__once)) {
		GType ft_event_row_type_id;
		ft_event_row_type_id = ft_event_row_get_type_once ();
		g_once_init_leave (&ft_event_row_type_id__once, ft_event_row_type_id);
	}
	return ft_event_row_type_id__once;
}

static void
_vala_ft_event_row_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	FtEventRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_EVENT_ROW, FtEventRow);
	switch (property_id) {
		case FT_EVENT_ROW_EVENT_NAME_PROPERTY:
		g_value_set_string (value, ft_event_row_get_event_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_event_row_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec)
{
	FtEventRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_EVENT_ROW, FtEventRow);
	switch (property_id) {
		case FT_EVENT_ROW_EVENT_NAME_PROPERTY:
		ft_event_row_set_event_name (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
ft_action_edit_window_get_instance_private (FtActionEditWindow* self)
{
	return G_STRUCT_MEMBER_P (self, FtActionEditWindow_private_offset);
}

FtActionEditWindow*
ft_action_edit_window_construct (GType object_type,
                                 const gchar* action_uuid)
{
	FtActionEditWindow * self = NULL;
	self = (FtActionEditWindow*) g_object_new (object_type, "action-uuid", action_uuid, "creating", action_uuid == NULL, NULL);
	return self;
}

FtActionEditWindow*
ft_action_edit_window_new (const gchar* action_uuid)
{
	return ft_action_edit_window_construct (FT_TYPE_ACTION_EDIT_WINDOW, action_uuid);
}

static void
ft_action_edit_window_update_event_condition_visible (FtActionEditWindow* self)
{
	gboolean _tmp0_ = FALSE;
	GtkCheckButton* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	AdwPreferencesGroup* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->event_radio;
	_tmp2_ = gtk_check_button_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		GtkToggleButton* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = self->priv->event_condition_button;
		_tmp5_ = gtk_toggle_button_get_active (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp7_ = self->priv->event_condition_group;
	gtk_widget_set_visible ((GtkWidget*) _tmp7_, _tmp0_);
}

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

static void
ft_action_edit_window_populate (FtActionEditWindow* self)
{
	FtAction* _tmp0_ = NULL;
	const gchar* _tmp1_;
	FtAction* action = NULL;
	FtAction* _tmp7_;
	FtAction* _tmp8_;
	FtAction* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	FtAction* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	FtAction* _tmp17_;
	FtAction* _tmp72_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_action_uuid;
	if (_tmp1_ != NULL) {
		FtActionManager* _tmp2_;
		FtActionListModel* _tmp3_;
		FtActionListModel* _tmp4_;
		const gchar* _tmp5_;
		FtAction* _tmp6_;
		_tmp2_ = self->priv->action_manager;
		_tmp3_ = ft_action_manager_get_model (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = self->priv->_action_uuid;
		_tmp6_ = ft_action_list_model_lookup (_tmp4_, _tmp5_);
		_g_object_unref0 (_tmp0_);
		_tmp0_ = _tmp6_;
	} else {
		_g_object_unref0 (_tmp0_);
		_tmp0_ = NULL;
	}
	_tmp7_ = _tmp0_;
	_tmp0_ = NULL;
	action = _tmp7_;
	_tmp8_ = action;
	if (_tmp8_ == NULL) {
		const gchar* _tmp9_;
		FtEventAction* _tmp10_;
		_tmp9_ = self->priv->_action_uuid;
		_tmp10_ = ft_event_action_new (_tmp9_);
		_g_object_unref0 (action);
		action = (FtAction*) _tmp10_;
	}
	_tmp11_ = action;
	_tmp12_ = ft_action_get_enabled (_tmp11_);
	_tmp13_ = _tmp12_;
	ft_action_edit_window_set_enabled (self, _tmp13_);
	_tmp14_ = action;
	_tmp15_ = ft_action_get_display_name (_tmp14_);
	_tmp16_ = _tmp15_;
	ft_action_edit_window_set_display_name (self, _tmp16_);
	_tmp17_ = action;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp17_, FT_TYPE_EVENT_ACTION)) {
		FtEventAction* event_action = NULL;
		FtAction* _tmp18_;
		FtEventAction* _tmp19_;
		FtExpression* condition = NULL;
		FtEventAction* _tmp20_;
		FtExpression* _tmp21_;
		FtExpression* _tmp22_;
		FtExpression* _tmp23_;
		FtCommand* command = NULL;
		FtEventAction* _tmp24_;
		FtCommand* _tmp25_;
		FtCommand* _tmp26_;
		FtCommand* _tmp27_;
		GtkWidget* row = NULL;
		AdwPreferencesGroup* _tmp28_;
		GtkWidget* _tmp29_;
		GtkWidget* _tmp30_;
		FtEventAction* _tmp40_;
		gchar** _tmp41_;
		gint _tmp41__length1;
		gint _tmp42_ = 0;
		gchar** _tmp43_;
		gint _tmp43__length1;
		FtConditionGroupWidget* _tmp50_;
		FtExpression* _tmp51_;
		FtExpression* _tmp52_;
		FtExpression* _tmp53_;
		GtkToggleButton* _tmp54_;
		FtExpression* _tmp55_;
		FtEventAction* _tmp56_;
		gboolean _tmp57_;
		gboolean _tmp58_;
		FtCommand* _tmp59_;
		_tmp18_ = action;
		_tmp19_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, FT_TYPE_EVENT_ACTION, FtEventAction));
		event_action = _tmp19_;
		_tmp20_ = event_action;
		_tmp21_ = ft_event_action_get_condition (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = _ft_expression_ref0 (_tmp22_);
		condition = _tmp23_;
		_tmp24_ = event_action;
		_tmp25_ = ft_event_action_get_command (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp27_ = _g_object_ref0 (_tmp26_);
		command = _tmp27_;
		_tmp28_ = self->priv->events_group;
		_tmp29_ = gtk_widget_get_first_child ((GtkWidget*) _tmp28_);
		_tmp30_ = _g_object_ref0 (_tmp29_);
		row = _tmp30_;
		while (TRUE) {
			GtkWidget* _tmp31_;
			GtkWidget* next_sibling = NULL;
			GtkWidget* _tmp32_;
			GtkWidget* _tmp33_;
			GtkWidget* _tmp34_;
			GtkWidget* _tmp35_;
			GtkWidget* _tmp38_;
			GtkWidget* _tmp39_;
			_tmp31_ = row;
			if (!(_tmp31_ != NULL)) {
				break;
			}
			_tmp32_ = row;
			_tmp33_ = gtk_widget_get_next_sibling (_tmp32_);
			_tmp34_ = _g_object_ref0 (_tmp33_);
			next_sibling = _tmp34_;
			_tmp35_ = row;
			if (FT_IS_EVENT_ROW (_tmp35_)) {
				AdwPreferencesGroup* _tmp36_;
				GtkWidget* _tmp37_;
				_tmp36_ = self->priv->events_group;
				_tmp37_ = row;
				adw_preferences_group_remove (_tmp36_, _tmp37_);
			}
			_tmp38_ = next_sibling;
			_tmp39_ = _g_object_ref0 (_tmp38_);
			_g_object_unref0 (row);
			row = _tmp39_;
			_g_object_unref0 (next_sibling);
		}
		_tmp40_ = event_action;
		_tmp41_ = ft_event_action_get_event_names (_tmp40_, &_tmp42_);
		_tmp41__length1 = _tmp42_;
		_tmp43_ = _tmp41_;
		_tmp43__length1 = _tmp41__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 = _tmp43_;
			event_name_collection_length1 = _tmp43__length1;
			for (event_name_it = 0; event_name_it < event_name_collection_length1; event_name_it = event_name_it + 1) {
				gchar* _tmp44_;
				gchar* event_name = NULL;
				_tmp44_ = g_strdup (event_name_collection[event_name_it]);
				event_name = _tmp44_;
				{
					const gchar* _tmp45_;
					AdwActionRow* _tmp46_;
					GtkWidget* _tmp47_;
					_tmp45_ = event_name;
					_tmp46_ = ft_action_edit_window_create_event_row (self, _tmp45_);
					_g_object_unref0 (row);
					row = (GtkWidget*) _tmp46_;
					_tmp47_ = row;
					if (_tmp47_ != NULL) {
						AdwPreferencesGroup* _tmp48_;
						GtkWidget* _tmp49_;
						_tmp48_ = self->priv->events_group;
						_tmp49_ = row;
						adw_preferences_group_add (_tmp48_, _tmp49_);
					}
					_g_free0 (event_name);
				}
			}
		}
		ft_action_edit_window_set_trigger (self, FT_ACTION_TRIGGER_EVENT);
		_tmp50_ = self->priv->event_condition_group_widget;
		_tmp51_ = condition;
		_tmp52_ = ft_ensure_operation (_tmp51_);
		_tmp53_ = _tmp52_;
		ft_expression_widget_set_expression ((FtExpressionWidget*) _tmp50_, _tmp53_);
		_ft_expression_unref0 (_tmp53_);
		_tmp54_ = self->priv->event_condition_button;
		_tmp55_ = condition;
		gtk_toggle_button_set_active (_tmp54_, _tmp55_ != NULL);
		_tmp56_ = event_action;
		_tmp57_ = ft_event_action_get_wait_for_completion (_tmp56_);
		_tmp58_ = _tmp57_;
		ft_action_edit_window_set_wait_for_completion (self, _tmp58_);
		_tmp59_ = command;
		if (_tmp59_ != NULL) {
			FtCommand* _tmp60_;
			const gchar* _tmp61_;
			const gchar* _tmp62_;
			FtCommand* _tmp63_;
			const gchar* _tmp64_;
			const gchar* _tmp65_;
			FtCommand* _tmp66_;
			gboolean _tmp67_;
			gboolean _tmp68_;
			FtCommand* _tmp69_;
			gboolean _tmp70_;
			gboolean _tmp71_;
			_tmp60_ = command;
			_tmp61_ = ft_command_get_line (_tmp60_);
			_tmp62_ = _tmp61_;
			ft_action_edit_window_set_command_line (self, _tmp62_);
			_tmp63_ = command;
			_tmp64_ = ft_command_get_working_directory (_tmp63_);
			_tmp65_ = _tmp64_;
			ft_action_edit_window_set_working_directory (self, _tmp65_);
			_tmp66_ = command;
			_tmp67_ = ft_command_get_use_subshell (_tmp66_);
			_tmp68_ = _tmp67_;
			ft_action_edit_window_set_use_subshell (self, _tmp68_);
			_tmp69_ = command;
			_tmp70_ = ft_command_get_pass_input (_tmp69_);
			_tmp71_ = _tmp70_;
			ft_action_edit_window_set_pass_input (self, _tmp71_);
		}
		_g_object_unref0 (row);
		_g_object_unref0 (command);
		_ft_expression_unref0 (condition);
		_g_object_unref0 (event_action);
	}
	_tmp72_ = action;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp72_, FT_TYPE_CONDITION_ACTION)) {
		FtConditionAction* condition_action = NULL;
		FtAction* _tmp73_;
		FtConditionAction* _tmp74_;
		FtExpression* condition = NULL;
		FtAction* _tmp75_;
		FtExpression* _tmp76_;
		FtExpression* _tmp77_;
		FtExpression* _tmp78_;
		FtCommand* enter_command = NULL;
		FtConditionAction* _tmp79_;
		FtCommand* _tmp80_;
		FtCommand* _tmp81_;
		FtCommand* _tmp82_;
		FtCommand* exit_command = NULL;
		FtConditionAction* _tmp83_;
		FtCommand* _tmp84_;
		FtCommand* _tmp85_;
		FtCommand* _tmp86_;
		FtCommand* _tmp87_ = NULL;
		FtCommand* _tmp88_;
		FtCommand* any_command = NULL;
		FtCommand* _tmp91_;
		FtConditionGroupWidget* _tmp92_;
		FtExpression* _tmp93_;
		FtExpression* _tmp94_;
		FtExpression* _tmp95_;
		FtCommand* _tmp96_;
		FtCommand* _tmp100_;
		FtCommand* _tmp104_;
		_tmp73_ = action;
		_tmp74_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp73_, FT_TYPE_CONDITION_ACTION, FtConditionAction));
		condition_action = _tmp74_;
		_tmp75_ = action;
		_tmp76_ = ft_condition_action_get_condition ((FtConditionAction*) _tmp75_);
		_tmp77_ = _tmp76_;
		_tmp78_ = _ft_expression_ref0 (_tmp77_);
		condition = _tmp78_;
		_tmp79_ = condition_action;
		_tmp80_ = ft_condition_action_get_enter_command (_tmp79_);
		_tmp81_ = _tmp80_;
		_tmp82_ = _g_object_ref0 (_tmp81_);
		enter_command = _tmp82_;
		_tmp83_ = condition_action;
		_tmp84_ = ft_condition_action_get_exit_command (_tmp83_);
		_tmp85_ = _tmp84_;
		_tmp86_ = _g_object_ref0 (_tmp85_);
		exit_command = _tmp86_;
		_tmp88_ = enter_command;
		if (_tmp88_ != NULL) {
			FtCommand* _tmp89_;
			_tmp89_ = enter_command;
			_tmp87_ = _tmp89_;
		} else {
			FtCommand* _tmp90_;
			_tmp90_ = exit_command;
			_tmp87_ = _tmp90_;
		}
		_tmp91_ = _g_object_ref0 (_tmp87_);
		any_command = _tmp91_;
		ft_action_edit_window_set_trigger (self, FT_ACTION_TRIGGER_CONDITION);
		_tmp92_ = self->priv->condition_group_widget;
		_tmp93_ = condition;
		_tmp94_ = ft_ensure_operation (_tmp93_);
		_tmp95_ = _tmp94_;
		ft_expression_widget_set_expression ((FtExpressionWidget*) _tmp92_, _tmp95_);
		_ft_expression_unref0 (_tmp95_);
		_tmp96_ = enter_command;
		if (_tmp96_ != NULL) {
			FtCommand* _tmp97_;
			const gchar* _tmp98_;
			const gchar* _tmp99_;
			_tmp97_ = enter_command;
			_tmp98_ = ft_command_get_line (_tmp97_);
			_tmp99_ = _tmp98_;
			ft_action_edit_window_set_enter_command_line (self, _tmp99_);
		}
		_tmp100_ = exit_command;
		if (_tmp100_ != NULL) {
			FtCommand* _tmp101_;
			const gchar* _tmp102_;
			const gchar* _tmp103_;
			_tmp101_ = exit_command;
			_tmp102_ = ft_command_get_line (_tmp101_);
			_tmp103_ = _tmp102_;
			ft_action_edit_window_set_exit_command_line (self, _tmp103_);
		}
		_tmp104_ = any_command;
		if (_tmp104_ != NULL) {
			FtCommand* _tmp105_;
			const gchar* _tmp106_;
			const gchar* _tmp107_;
			FtCommand* _tmp108_;
			gboolean _tmp109_;
			gboolean _tmp110_;
			FtCommand* _tmp111_;
			gboolean _tmp112_;
			gboolean _tmp113_;
			_tmp105_ = any_command;
			_tmp106_ = ft_command_get_working_directory (_tmp105_);
			_tmp107_ = _tmp106_;
			ft_action_edit_window_set_working_directory (self, _tmp107_);
			_tmp108_ = any_command;
			_tmp109_ = ft_command_get_use_subshell (_tmp108_);
			_tmp110_ = _tmp109_;
			ft_action_edit_window_set_use_subshell (self, _tmp110_);
			_tmp111_ = any_command;
			_tmp112_ = ft_command_get_pass_input (_tmp111_);
			_tmp113_ = _tmp112_;
			ft_action_edit_window_set_pass_input (self, _tmp113_);
		}
		_g_object_unref0 (any_command);
		_g_object_unref0 (exit_command);
		_g_object_unref0 (enter_command);
		_ft_expression_unref0 (condition);
		_g_object_unref0 (condition_action);
	}
	ft_action_edit_window_update_event_condition_visible (self);
	_g_object_unref0 (action);
	_g_object_unref0 (_tmp0_);
}

static void
ft_action_edit_window_save_action (FtActionEditWindow* self)
{
	FtAction* action = NULL;
	FtActionManager* _tmp0_;
	FtActionListModel* _tmp1_;
	FtActionListModel* _tmp2_;
	const gchar* _tmp3_;
	FtActionTrigger _tmp4_;
	FtActionTrigger _tmp5_;
	FtAction* _tmp6_;
	FtAction* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	FtAction* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	FtAction* _tmp13_;
	FtAction* _tmp51_;
	FtActionManager* _tmp98_;
	FtActionListModel* _tmp99_;
	FtActionListModel* _tmp100_;
	FtAction* _tmp101_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->action_manager;
	_tmp1_ = ft_action_manager_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->_action_uuid;
	_tmp4_ = ft_action_edit_window_get_trigger (self);
	_tmp5_ = _tmp4_;
	_tmp6_ = ft_action_list_model_create_action (_tmp2_, _tmp3_, _tmp5_);
	action = _tmp6_;
	_tmp7_ = action;
	_tmp8_ = ft_action_edit_window_get_enabled (self);
	_tmp9_ = _tmp8_;
	ft_action_set_enabled (_tmp7_, _tmp9_);
	_tmp10_ = action;
	_tmp11_ = ft_action_edit_window_get_display_name (self);
	_tmp12_ = _tmp11_;
	ft_action_set_display_name (_tmp10_, _tmp12_);
	_tmp13_ = action;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp13_, FT_TYPE_EVENT_ACTION)) {
		FtEventAction* event_action = NULL;
		FtAction* _tmp14_;
		FtEventAction* _tmp15_;
		FtEventAction* _tmp16_;
		gint _tmp17_ = 0;
		gchar** _tmp18_;
		gchar** _tmp19_;
		gint _tmp19__length1;
		FtExpression* _tmp20_ = NULL;
		GtkToggleButton* _tmp21_;
		gboolean _tmp22_;
		gboolean _tmp23_;
		FtEventAction* _tmp27_;
		FtEventAction* _tmp28_;
		gboolean _tmp29_;
		gboolean _tmp30_;
		FtEventAction* _tmp31_;
		const gchar* _tmp32_;
		const gchar* _tmp33_;
		FtCommand* _tmp34_;
		FtCommand* _tmp35_;
		FtEventAction* _tmp36_;
		FtCommand* _tmp37_;
		FtCommand* _tmp38_;
		const gchar* _tmp39_;
		const gchar* _tmp40_;
		FtEventAction* _tmp41_;
		FtCommand* _tmp42_;
		FtCommand* _tmp43_;
		gboolean _tmp44_;
		gboolean _tmp45_;
		FtEventAction* _tmp46_;
		FtCommand* _tmp47_;
		FtCommand* _tmp48_;
		gboolean _tmp49_;
		gboolean _tmp50_;
		_tmp14_ = action;
		_tmp15_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, FT_TYPE_EVENT_ACTION, FtEventAction));
		event_action = _tmp15_;
		_tmp16_ = event_action;
		_tmp18_ = ft_action_edit_window_get_event_names (self, &_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp19__length1 = _tmp17_;
		ft_event_action_set_event_names (_tmp16_, _tmp19_, _tmp17_);
		_tmp19_ = (_vala_array_free (_tmp19_, _tmp19__length1, (GDestroyNotify) g_free), NULL);
		_tmp21_ = self->priv->event_condition_button;
		_tmp22_ = gtk_toggle_button_get_active (_tmp21_);
		_tmp23_ = _tmp22_;
		if (_tmp23_) {
			FtConditionGroupWidget* _tmp24_;
			FtExpression* _tmp25_;
			FtExpression* _tmp26_;
			_tmp24_ = self->priv->event_condition_group_widget;
			_tmp25_ = ft_expression_widget_get_expression ((FtExpressionWidget*) _tmp24_);
			_tmp26_ = _tmp25_;
			_tmp20_ = _tmp26_;
		} else {
			_tmp20_ = NULL;
		}
		_tmp27_ = event_action;
		ft_event_action_set_condition (_tmp27_, _tmp20_);
		_tmp28_ = event_action;
		_tmp29_ = ft_action_edit_window_get_wait_for_completion (self);
		_tmp30_ = _tmp29_;
		ft_event_action_set_wait_for_completion (_tmp28_, _tmp30_);
		_tmp31_ = event_action;
		_tmp32_ = ft_action_edit_window_get_command_line (self);
		_tmp33_ = _tmp32_;
		_tmp34_ = ft_command_new (_tmp33_);
		_tmp35_ = _tmp34_;
		ft_event_action_set_command (_tmp31_, _tmp35_);
		_g_object_unref0 (_tmp35_);
		_tmp36_ = event_action;
		_tmp37_ = ft_event_action_get_command (_tmp36_);
		_tmp38_ = _tmp37_;
		_tmp39_ = ft_action_edit_window_get_working_directory (self);
		_tmp40_ = _tmp39_;
		ft_command_set_working_directory (_tmp38_, _tmp40_);
		_tmp41_ = event_action;
		_tmp42_ = ft_event_action_get_command (_tmp41_);
		_tmp43_ = _tmp42_;
		_tmp44_ = ft_action_edit_window_get_use_subshell (self);
		_tmp45_ = _tmp44_;
		ft_command_set_use_subshell (_tmp43_, _tmp45_);
		_tmp46_ = event_action;
		_tmp47_ = ft_event_action_get_command (_tmp46_);
		_tmp48_ = _tmp47_;
		_tmp49_ = ft_action_edit_window_get_pass_input (self);
		_tmp50_ = _tmp49_;
		ft_command_set_pass_input (_tmp48_, _tmp50_);
		_g_object_unref0 (event_action);
	}
	_tmp51_ = action;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp51_, FT_TYPE_CONDITION_ACTION)) {
		FtConditionAction* condition_action = NULL;
		FtAction* _tmp52_;
		FtConditionAction* _tmp53_;
		FtConditionAction* _tmp54_;
		FtConditionGroupWidget* _tmp55_;
		FtExpression* _tmp56_;
		FtExpression* _tmp57_;
		FtConditionAction* _tmp58_;
		const gchar* _tmp59_;
		const gchar* _tmp60_;
		FtCommand* _tmp61_;
		FtCommand* _tmp62_;
		FtConditionAction* _tmp63_;
		FtCommand* _tmp64_;
		FtCommand* _tmp65_;
		const gchar* _tmp66_;
		const gchar* _tmp67_;
		FtConditionAction* _tmp68_;
		FtCommand* _tmp69_;
		FtCommand* _tmp70_;
		gboolean _tmp71_;
		gboolean _tmp72_;
		FtConditionAction* _tmp73_;
		FtCommand* _tmp74_;
		FtCommand* _tmp75_;
		gboolean _tmp76_;
		gboolean _tmp77_;
		FtConditionAction* _tmp78_;
		const gchar* _tmp79_;
		const gchar* _tmp80_;
		FtCommand* _tmp81_;
		FtCommand* _tmp82_;
		FtConditionAction* _tmp83_;
		FtCommand* _tmp84_;
		FtCommand* _tmp85_;
		const gchar* _tmp86_;
		const gchar* _tmp87_;
		FtConditionAction* _tmp88_;
		FtCommand* _tmp89_;
		FtCommand* _tmp90_;
		gboolean _tmp91_;
		gboolean _tmp92_;
		FtConditionAction* _tmp93_;
		FtCommand* _tmp94_;
		FtCommand* _tmp95_;
		gboolean _tmp96_;
		gboolean _tmp97_;
		_tmp52_ = action;
		_tmp53_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp52_, FT_TYPE_CONDITION_ACTION, FtConditionAction));
		condition_action = _tmp53_;
		_tmp54_ = condition_action;
		_tmp55_ = self->priv->condition_group_widget;
		_tmp56_ = ft_expression_widget_get_expression ((FtExpressionWidget*) _tmp55_);
		_tmp57_ = _tmp56_;
		ft_condition_action_set_condition (_tmp54_, _tmp57_);
		_tmp58_ = condition_action;
		_tmp59_ = ft_action_edit_window_get_enter_command_line (self);
		_tmp60_ = _tmp59_;
		_tmp61_ = ft_command_new (_tmp60_);
		_tmp62_ = _tmp61_;
		ft_condition_action_set_enter_command (_tmp58_, _tmp62_);
		_g_object_unref0 (_tmp62_);
		_tmp63_ = condition_action;
		_tmp64_ = ft_condition_action_get_enter_command (_tmp63_);
		_tmp65_ = _tmp64_;
		_tmp66_ = ft_action_edit_window_get_working_directory (self);
		_tmp67_ = _tmp66_;
		ft_command_set_working_directory (_tmp65_, _tmp67_);
		_tmp68_ = condition_action;
		_tmp69_ = ft_condition_action_get_enter_command (_tmp68_);
		_tmp70_ = _tmp69_;
		_tmp71_ = ft_action_edit_window_get_use_subshell (self);
		_tmp72_ = _tmp71_;
		ft_command_set_use_subshell (_tmp70_, _tmp72_);
		_tmp73_ = condition_action;
		_tmp74_ = ft_condition_action_get_enter_command (_tmp73_);
		_tmp75_ = _tmp74_;
		_tmp76_ = ft_action_edit_window_get_pass_input (self);
		_tmp77_ = _tmp76_;
		ft_command_set_pass_input (_tmp75_, _tmp77_);
		_tmp78_ = condition_action;
		_tmp79_ = ft_action_edit_window_get_exit_command_line (self);
		_tmp80_ = _tmp79_;
		_tmp81_ = ft_command_new (_tmp80_);
		_tmp82_ = _tmp81_;
		ft_condition_action_set_exit_command (_tmp78_, _tmp82_);
		_g_object_unref0 (_tmp82_);
		_tmp83_ = condition_action;
		_tmp84_ = ft_condition_action_get_exit_command (_tmp83_);
		_tmp85_ = _tmp84_;
		_tmp86_ = ft_action_edit_window_get_working_directory (self);
		_tmp87_ = _tmp86_;
		ft_command_set_working_directory (_tmp85_, _tmp87_);
		_tmp88_ = condition_action;
		_tmp89_ = ft_condition_action_get_exit_command (_tmp88_);
		_tmp90_ = _tmp89_;
		_tmp91_ = ft_action_edit_window_get_use_subshell (self);
		_tmp92_ = _tmp91_;
		ft_command_set_use_subshell (_tmp90_, _tmp92_);
		_tmp93_ = condition_action;
		_tmp94_ = ft_condition_action_get_exit_command (_tmp93_);
		_tmp95_ = _tmp94_;
		_tmp96_ = ft_action_edit_window_get_pass_input (self);
		_tmp97_ = _tmp96_;
		ft_command_set_pass_input (_tmp95_, _tmp97_);
		_g_object_unref0 (condition_action);
	}
	_tmp98_ = self->priv->action_manager;
	_tmp99_ = ft_action_manager_get_model (_tmp98_);
	_tmp100_ = _tmp99_;
	_tmp101_ = action;
	ft_action_list_model_save_action (_tmp100_, _tmp101_);
	_g_object_unref0 (action);
}

static void
ft_action_edit_window_delete_action (FtActionEditWindow* self)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_action_uuid;
	if (_tmp0_ != NULL) {
		FtActionManager* _tmp1_;
		FtActionListModel* _tmp2_;
		FtActionListModel* _tmp3_;
		const gchar* _tmp4_;
		_tmp1_ = self->priv->action_manager;
		_tmp2_ = ft_action_manager_get_model (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = self->priv->_action_uuid;
		ft_action_list_model_delete_action (_tmp3_, _tmp4_);
	}
}

static Block21Data*
block21_data_ref (Block21Data* _data21_)
{
	g_atomic_int_inc (&_data21_->_ref_count_);
	return _data21_;
}

static void
block21_data_unref (void * _userdata_)
{
	Block21Data* _data21_;
	_data21_ = (Block21Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data21_->_ref_count_)) {
		FtActionEditWindow* self;
		self = _data21_->self;
		_g_hash_table_unref0 (_data21_->sections);
		_g_object_unref0 (_data21_->menu);
		_g_object_unref0 (self);
		g_slice_free (Block21Data, _data21_);
	}
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static void
__lambda75_ (Block21Data* _data21_,
             FtEventCategory category)
{
	FtActionEditWindow* self;
	GMenu* section = NULL;
	GHashTable* _tmp0_;
	gconstpointer _tmp1_;
	GMenu* _tmp2_;
	GMenu* _tmp3_;
	self = _data21_->self;
	_tmp0_ = _data21_->sections;
	_tmp1_ = g_hash_table_lookup (_tmp0_, (gpointer) ((gintptr) category));
	_tmp2_ = _g_object_ref0 ((GMenu*) _tmp1_);
	section = _tmp2_;
	_tmp3_ = section;
	if (_tmp3_ != NULL) {
		GMenu* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		GMenu* _tmp7_;
		_tmp4_ = _data21_->menu;
		_tmp5_ = ft_event_category_get_label (category);
		_tmp6_ = _tmp5_;
		_tmp7_ = section;
		g_menu_append_section (_tmp4_, _tmp6_, (GMenuModel*) _tmp7_);
		_g_free0 (_tmp6_);
	}
	_g_object_unref0 (section);
}

static void
___lambda75__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda75_ (self, (FtEventCategory) ((gintptr) data));
}

static GMenu*
ft_action_edit_window_create_add_event_menu (FtActionEditWindow* self)
{
	Block21Data* _data21_;
	GMenu* _tmp0_;
	GHashFunc _tmp1_;
	GEqualFunc _tmp2_;
	GHashTable* _tmp3_;
	FtEventProducer* _tmp4_;
	gint _tmp5_ = 0;
	FtEventSpec** _tmp6_;
	GMenu* _tmp29_;
	GMenu* _tmp30_;
	GMenu* result;
	g_return_val_if_fail (self != NULL, NULL);
	_data21_ = g_slice_new0 (Block21Data);
	_data21_->_ref_count_ = 1;
	_data21_->self = g_object_ref (self);
	_tmp0_ = g_menu_new ();
	_data21_->menu = _tmp0_;
	_tmp1_ = g_direct_hash;
	_tmp2_ = g_direct_equal;
	_tmp3_ = g_hash_table_new_full (_tmp1_, _tmp2_, NULL, _g_object_unref0_);
	_data21_->sections = _tmp3_;
	_tmp4_ = self->priv->event_producer;
	_tmp6_ = ft_event_producer_list_events (_tmp4_, &_tmp5_);
	{
		FtEventSpec** event_spec_collection = NULL;
		gint event_spec_collection_length1 = 0;
		gint _event_spec_collection_size_ = 0;
		gint event_spec_it = 0;
		event_spec_collection = _tmp6_;
		event_spec_collection_length1 = _tmp5_;
		for (event_spec_it = 0; event_spec_it < event_spec_collection_length1; event_spec_it = event_spec_it + 1) {
			FtEventSpec* event_spec = NULL;
			event_spec = event_spec_collection[event_spec_it];
			{
				GMenu* section = NULL;
				GHashTable* _tmp7_;
				FtEventSpec* _tmp8_;
				gconstpointer _tmp9_;
				GMenu* _tmp10_;
				GMenu* _tmp11_;
				GMenuItem* section_item = NULL;
				FtEventSpec* _tmp19_;
				const gchar* _tmp20_;
				GMenuItem* _tmp21_;
				GMenuItem* _tmp22_;
				FtEventSpec* _tmp23_;
				const gchar* _tmp24_;
				GVariant* _tmp25_;
				GVariant* _tmp26_;
				GMenu* _tmp27_;
				GMenuItem* _tmp28_;
				_tmp7_ = _data21_->sections;
				_tmp8_ = event_spec;
				_tmp9_ = g_hash_table_lookup (_tmp7_, (gpointer) ((gintptr) _tmp8_->category));
				_tmp10_ = _g_object_ref0 ((GMenu*) _tmp9_);
				section = _tmp10_;
				_tmp11_ = section;
				if (_tmp11_ == NULL) {
					GMenu* new_section = NULL;
					GMenu* _tmp12_;
					GHashTable* _tmp13_;
					FtEventSpec* _tmp14_;
					GMenu* _tmp15_;
					GMenu* _tmp16_;
					GMenu* _tmp17_;
					GMenu* _tmp18_;
					_tmp12_ = g_menu_new ();
					new_section = _tmp12_;
					_tmp13_ = _data21_->sections;
					_tmp14_ = event_spec;
					_tmp15_ = new_section;
					_tmp16_ = _g_object_ref0 (_tmp15_);
					g_hash_table_insert (_tmp13_, (gpointer) ((gintptr) _tmp14_->category), _tmp16_);
					_tmp17_ = new_section;
					_tmp18_ = _g_object_ref0 (_tmp17_);
					_g_object_unref0 (section);
					section = _tmp18_;
					_g_object_unref0 (new_section);
				}
				_tmp19_ = event_spec;
				_tmp20_ = _tmp19_->display_name;
				_tmp21_ = g_menu_item_new (_tmp20_, NULL);
				section_item = _tmp21_;
				_tmp22_ = section_item;
				_tmp23_ = event_spec;
				_tmp24_ = _tmp23_->name;
				_tmp25_ = g_variant_new_string (_tmp24_);
				g_variant_ref_sink (_tmp25_);
				_tmp26_ = _tmp25_;
				g_menu_item_set_action_and_target_value (_tmp22_, "add-event", _tmp26_);
				_g_variant_unref0 (_tmp26_);
				_tmp27_ = section;
				_tmp28_ = section_item;
				g_menu_append_item (_tmp27_, _tmp28_);
				_g_object_unref0 (section_item);
				_g_object_unref0 (section);
			}
		}
		event_spec_collection = (g_free (event_spec_collection), NULL);
	}
	ft_event_category_foreach (___lambda75__gfunc, _data21_);
	_tmp29_ = _data21_->menu;
	_tmp30_ = _g_object_ref0 (_tmp29_);
	result = _tmp30_;
	block21_data_unref (_data21_);
	_data21_ = NULL;
	return result;
}

static Block22Data*
block22_data_ref (Block22Data* _data22_)
{
	g_atomic_int_inc (&_data22_->_ref_count_);
	return _data22_;
}

static void
block22_data_unref (void * _userdata_)
{
	Block22Data* _data22_;
	_data22_ = (Block22Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data22_->_ref_count_)) {
		FtActionEditWindow* self;
		self = _data22_->self;
		_g_object_unref0 (_data22_->file_dialog);
		_g_object_unref0 (self);
		g_slice_free (Block22Data, _data22_);
	}
}

static void
__lambda76_ (Block22Data* _data22_,
             GObject* obj,
             GAsyncResult* res)
{
	FtActionEditWindow* self;
	GFile* file = NULL;
	GFile* _tmp3_;
	GError* _inner_error0_ = NULL;
	self = _data22_->self;
	g_return_if_fail (res != NULL);
	file = NULL;
	{
		GFile* _tmp0_ = NULL;
		GFile* _tmp1_;
		GFile* _tmp2_;
		_tmp1_ = gtk_file_dialog_select_folder_finish (_data22_->file_dialog, res, &_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = _tmp0_;
		_tmp0_ = NULL;
		_g_object_unref0 (file);
		file = _tmp2_;
		_g_object_unref0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		_g_object_unref0 (file);
		return;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (file);
		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;
	}
	_tmp3_ = file;
	if (_tmp3_ != NULL) {
		GFile* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = file;
		_tmp5_ = g_file_get_path (_tmp4_);
		_tmp6_ = _tmp5_;
		ft_action_edit_window_set_working_directory (self, _tmp6_);
		_g_free0 (_tmp6_);
	}
	_g_object_unref0 (file);
}

static void
___lambda76__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda76_ (self, source_object, res);
	block22_data_unref (self);
}

static void
ft_action_edit_window_open_working_directory_chooser (FtActionEditWindow* self)
{
	Block22Data* _data22_;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* working_directory = NULL;
	gchar* _tmp6_;
	GtkFileFilter* directory_filter = NULL;
	GtkFileFilter* _tmp7_;
	GtkFileDialog* _tmp8_;
	GFile* _tmp9_;
	GFile* _tmp10_;
	g_return_if_fail (self != NULL);
	_data22_ = g_slice_new0 (Block22Data);
	_data22_->_ref_count_ = 1;
	_data22_->self = g_object_ref (self);
	_tmp1_ = ft_action_edit_window_get_working_directory (self);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, "") != 0) {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		_tmp3_ = ft_action_edit_window_get_working_directory (self);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	} else {
		const gchar* _tmp5_;
		_tmp5_ = g_get_home_dir ();
		_tmp0_ = _tmp5_;
	}
	_tmp6_ = g_strdup (_tmp0_);
	working_directory = _tmp6_;
	_tmp7_ = gtk_file_filter_new ();
	directory_filter = _tmp7_;
	gtk_file_filter_add_mime_type (directory_filter, "inode/directory");
	_tmp8_ = gtk_file_dialog_new ();
	_data22_->file_dialog = _tmp8_;
	gtk_file_dialog_set_title (_data22_->file_dialog, _ ("Select Working Directory"));
	gtk_file_dialog_set_modal (_data22_->file_dialog, TRUE);
	gtk_file_dialog_set_accept_label (_data22_->file_dialog, _ ("_Select"));
	gtk_file_dialog_set_default_filter (_data22_->file_dialog, directory_filter);
	_tmp9_ = g_file_new_for_path (working_directory);
	_tmp10_ = _tmp9_;
	gtk_file_dialog_set_initial_file (_data22_->file_dialog, _tmp10_);
	_g_object_unref0 (_tmp10_);
	gtk_file_dialog_select_folder (_data22_->file_dialog, (GtkWindow*) self, NULL, ___lambda76__gasync_ready_callback, block22_data_ref (_data22_));
	_g_object_unref0 (directory_filter);
	_g_free0 (working_directory);
	block22_data_unref (_data22_);
	_data22_ = NULL;
}

void
ft_action_edit_window_on_cancel_button_clicked (FtActionEditWindow* self)
{
	g_return_if_fail (self != NULL);
	gtk_window_close ((GtkWindow*) self);
}

static void
_ft_action_edit_window_on_cancel_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                    gpointer self)
{
	ft_action_edit_window_on_cancel_button_clicked ((FtActionEditWindow*) self);
}

void
ft_action_edit_window_on_save_button_clicked (FtActionEditWindow* self)
{
	g_return_if_fail (self != NULL);
	ft_action_edit_window_save_action (self);
	gtk_window_close ((GtkWindow*) self);
}

static void
_ft_action_edit_window_on_save_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                  gpointer self)
{
	ft_action_edit_window_on_save_button_clicked ((FtActionEditWindow*) self);
}

void
ft_action_edit_window_on_delete_button_clicked (FtActionEditWindow* self)
{
	g_return_if_fail (self != NULL);
	ft_action_edit_window_delete_action (self);
	gtk_window_close ((GtkWindow*) self);
}

static void
_ft_action_edit_window_on_delete_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                    gpointer self)
{
	ft_action_edit_window_on_delete_button_clicked ((FtActionEditWindow*) self);
}

void
ft_action_edit_window_on_trigger_radio_toggled (FtActionEditWindow* self,
                                                GtkCheckButton* radio)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (radio != NULL);
	ft_action_edit_window_update_event_condition_visible (self);
}

static void
_ft_action_edit_window_on_trigger_radio_toggled_gtk_check_button_toggled (GtkCheckButton* _sender,
                                                                          gpointer self)
{
	ft_action_edit_window_on_trigger_radio_toggled ((FtActionEditWindow*) self, _sender);
}

static void
ft_action_edit_window_on_event_condition_button_toggled (FtActionEditWindow* self)
{
	g_return_if_fail (self != NULL);
	ft_action_edit_window_update_event_condition_visible (self);
}

static void
_ft_action_edit_window_on_event_condition_button_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                    gpointer self)
{
	ft_action_edit_window_on_event_condition_button_toggled ((FtActionEditWindow*) self);
}

static void
ft_action_edit_window_on_event_condition_request_remove (FtActionEditWindow* self)
{
	GtkToggleButton* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->event_condition_button;
	gtk_toggle_button_set_active (_tmp0_, FALSE);
	ft_action_edit_window_update_event_condition_visible (self);
}

static void
_ft_action_edit_window_on_event_condition_request_remove_ft_expression_widget_request_remove (FtExpressionWidget* _sender,
                                                                                              gpointer self)
{
	ft_action_edit_window_on_event_condition_request_remove ((FtActionEditWindow*) self);
}

static void
ft_action_edit_window_on_working_directory_button_clicked (FtActionEditWindow* self)
{
	g_return_if_fail (self != NULL);
	ft_action_edit_window_open_working_directory_chooser (self);
}

static void
_ft_action_edit_window_on_working_directory_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                               gpointer self)
{
	ft_action_edit_window_on_working_directory_button_clicked ((FtActionEditWindow*) self);
}

static gboolean
ft_action_edit_window_on_key_pressed (FtActionEditWindow* self,
                                      GtkEventControllerKey* event_controller,
                                      guint keyval,
                                      guint keycode,
                                      GdkModifierType state)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event_controller != NULL, FALSE);
	switch (keyval) {
		case GDK_KEY_Escape:
		{
			gtk_window_close ((GtkWindow*) self);
			result = TRUE;
			return result;
		}
		default:
		break;
	}
	result = FALSE;
	return result;
}

static gboolean
_ft_action_edit_window_on_key_pressed_gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                            guint keyval,
                                                                            guint keycode,
                                                                            GdkModifierType state,
                                                                            gpointer self)
{
	gboolean result;
	result = ft_action_edit_window_on_key_pressed ((FtActionEditWindow*) self, _sender, keyval, keycode, state);
	return result;
}

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

static gchar**
ft_action_edit_window_get_event_names (FtActionEditWindow* self,
                                       gint* result_length1)
{
	GtkListBox* listbox = NULL;
	GtkListBox* _tmp0_;
	GtkWidget* child = NULL;
	GtkListBox* _tmp1_;
	GtkWidget* _tmp2_;
	gchar** event_names = NULL;
	gchar** _tmp3_;
	gint event_names_length1;
	gint _event_names_size_;
	gchar** _tmp14_;
	gint _tmp14__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->events_listbox;
	listbox = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_list_box_get_type (), GtkListBox);
	_tmp1_ = listbox;
	_tmp2_ = gtk_widget_get_first_child ((GtkWidget*) _tmp1_);
	child = _tmp2_;
	_tmp3_ = g_new0 (gchar*, 0 + 1);
	event_names = _tmp3_;
	event_names_length1 = 0;
	_event_names_size_ = event_names_length1;
	while (TRUE) {
		GtkWidget* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp12_;
		GtkWidget* _tmp13_;
		_tmp4_ = child;
		if (!(_tmp4_ != NULL)) {
			break;
		}
		_tmp5_ = child;
		if (FT_IS_EVENT_ROW (_tmp5_)) {
			FtEventRow* row = NULL;
			GtkWidget* _tmp6_;
			FtEventRow* _tmp7_;
			FtEventRow* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			gchar* _tmp11_;
			_tmp6_ = child;
			_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, FT_TYPE_EVENT_ROW, FtEventRow));
			row = _tmp7_;
			_tmp8_ = row;
			_tmp9_ = ft_event_row_get_event_name (_tmp8_);
			_tmp10_ = _tmp9_;
			_tmp11_ = g_strdup (_tmp10_);
			_vala_array_add2 (&event_names, &event_names_length1, &_event_names_size_, _tmp11_);
			_g_object_unref0 (row);
		}
		_tmp12_ = child;
		_tmp13_ = gtk_widget_get_next_sibling (_tmp12_);
		child = _tmp13_;
	}
	_tmp14_ = event_names;
	_tmp14__length1 = event_names_length1;
	if (result_length1) {
		*result_length1 = _tmp14__length1;
	}
	result = _tmp14_;
	return result;
}

static gpointer
_ft_event_spec_ref0 (gpointer self)
{
	return self ? ft_event_spec_ref (self) : NULL;
}

static void
_adw_preferences_group_remove_ft_event_row_request_remove (FtEventRow* _sender,
                                                           gpointer self)
{
	adw_preferences_group_remove ((AdwPreferencesGroup*) self, _sender);
}

static AdwActionRow*
ft_action_edit_window_create_event_row (FtActionEditWindow* self,
                                        const gchar* event_name)
{
	FtEventSpec* event_spec = NULL;
	FtEventProducer* _tmp0_;
	FtEventSpec* _tmp1_;
	FtEventSpec* _tmp2_;
	FtEventSpec* _tmp3_;
	FtEventRow* row = NULL;
	FtEventSpec* _tmp4_;
	const gchar* _tmp5_;
	FtEventSpec* _tmp6_;
	const gchar* _tmp7_;
	FtEventRow* _tmp8_;
	FtEventRow* _tmp9_;
	AdwPreferencesGroup* _tmp10_;
	AdwActionRow* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (event_name != NULL, NULL);
	_tmp0_ = self->priv->event_producer;
	_tmp1_ = ft_event_producer_find_event (_tmp0_, event_name);
	_tmp2_ = _ft_event_spec_ref0 (_tmp1_);
	event_spec = _tmp2_;
	_tmp3_ = event_spec;
	if (_tmp3_ == NULL) {
		g_warning ("action-edit-window.vala:550: Could not find event '%s'.", event_name);
		result = NULL;
		_ft_event_spec_unref0 (event_spec);
		return result;
	}
	_tmp4_ = event_spec;
	_tmp5_ = _tmp4_->display_name;
	_tmp6_ = event_spec;
	_tmp7_ = _tmp6_->description;
	_tmp8_ = ft_event_row_new (event_name, _tmp5_, _tmp7_);
	g_object_ref_sink (_tmp8_);
	row = _tmp8_;
	_tmp9_ = row;
	_tmp10_ = self->priv->events_group;
	g_signal_connect_object (_tmp9_, "request-remove", (GCallback) _adw_preferences_group_remove_ft_event_row_request_remove, _tmp10_, 0);
	result = (AdwActionRow*) row;
	_ft_event_spec_unref0 (event_spec);
	return result;
}

static void
ft_action_edit_window_on_add_event (FtActionEditWindow* self,
                                    const gchar* action_name,
                                    GVariant* parameter)
{
	AdwActionRow* row = NULL;
	const gchar* _tmp0_;
	AdwActionRow* _tmp1_;
	AdwActionRow* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action_name != NULL);
	if (parameter == NULL) {
		return;
	}
	_tmp0_ = g_variant_get_string (parameter, NULL);
	_tmp1_ = ft_action_edit_window_create_event_row (self, _tmp0_);
	row = _tmp1_;
	_tmp2_ = row;
	if (_tmp2_ != NULL) {
		AdwPreferencesGroup* _tmp3_;
		AdwActionRow* _tmp4_;
		_tmp3_ = self->priv->events_group;
		_tmp4_ = row;
		adw_preferences_group_add (_tmp3_, (GtkWidget*) _tmp4_);
	}
	_g_object_unref0 (row);
}

static gboolean
ft_action_edit_window_real_close_request (GtkWindow* base)
{
	FtActionEditWindow * self;
	gboolean cancelled = FALSE;
	gboolean _tmp0_ = FALSE;
	gboolean result;
	self = (FtActionEditWindow*) base;
	cancelled = GTK_WINDOW_CLASS (ft_action_edit_window_parent_class)->close_request ((GtkWindow*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_window_get_type (), AdwWindow));
	if (!cancelled) {
		gboolean _tmp1_;
		_tmp1_ = self->priv->_creating;
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ft_action_edit_window_delete_action (self);
	}
	result = cancelled;
	return result;
}

static void
ft_action_edit_window_real_dispose (GObject* base)
{
	FtActionEditWindow * self;
	self = (FtActionEditWindow*) base;
	_g_object_unref0 (self->priv->action_manager);
	self->priv->action_manager = NULL;
	_g_object_unref0 (self->priv->event_producer);
	self->priv->event_producer = NULL;
	G_OBJECT_CLASS (ft_action_edit_window_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_window_get_type (), AdwWindow));
}

const gchar*
ft_action_edit_window_get_action_uuid (FtActionEditWindow* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_action_uuid;
	result = _tmp0_;
	return result;
}

static void
ft_action_edit_window_set_action_uuid (FtActionEditWindow* self,
                                       const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_action_edit_window_get_action_uuid (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_action_uuid);
		self->priv->_action_uuid = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_ACTION_UUID_PROPERTY]);
	}
}

gboolean
ft_action_edit_window_get_creating (FtActionEditWindow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_creating;
	return result;
}

static void
ft_action_edit_window_set_creating (FtActionEditWindow* self,
                                    gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_action_edit_window_get_creating (self);
	if (old_value != value) {
		self->priv->_creating = value;
		g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_CREATING_PROPERTY]);
	}
}

FtActionTrigger
ft_action_edit_window_get_trigger (FtActionEditWindow* self)
{
	FtActionTrigger result;
	FtActionTrigger _tmp0_ = 0;
	GtkCheckButton* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp1_ = self->priv->event_radio;
	_tmp2_ = gtk_check_button_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		_tmp0_ = FT_ACTION_TRIGGER_EVENT;
	} else {
		_tmp0_ = FT_ACTION_TRIGGER_CONDITION;
	}
	result = _tmp0_;
	return result;
}

void
ft_action_edit_window_set_trigger (FtActionEditWindow* self,
                                   FtActionTrigger value)
{
	GtkCheckButton* _tmp0_;
	GtkCheckButton* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->event_radio;
	gtk_check_button_set_active (_tmp0_, value == FT_ACTION_TRIGGER_EVENT);
	_tmp1_ = self->priv->condition_radio;
	gtk_check_button_set_active (_tmp1_, value == FT_ACTION_TRIGGER_CONDITION);
	g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_TRIGGER_PROPERTY]);
}

gboolean
ft_action_edit_window_get_enabled (FtActionEditWindow* self)
{
	gboolean result;
	GtkSwitch* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->enabled_switch;
	_tmp1_ = gtk_switch_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
ft_action_edit_window_set_enabled (FtActionEditWindow* self,
                                   gboolean value)
{
	GtkSwitch* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->enabled_switch;
	gtk_switch_set_active (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_ENABLED_PROPERTY]);
}

const gchar*
ft_action_edit_window_get_display_name (FtActionEditWindow* self)
{
	const gchar* result;
	AdwEntryRow* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->display_name_entryrow;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
ft_action_edit_window_set_display_name (FtActionEditWindow* self,
                                        const gchar* value)
{
	AdwEntryRow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->display_name_entryrow;
	gtk_editable_set_text ((GtkEditable*) _tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_DISPLAY_NAME_PROPERTY]);
}

const gchar*
ft_action_edit_window_get_command_line (FtActionEditWindow* self)
{
	const gchar* result;
	FtCommandEntryRow* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->command_entryrow;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
ft_action_edit_window_set_command_line (FtActionEditWindow* self,
                                        const gchar* value)
{
	FtCommandEntryRow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->command_entryrow;
	gtk_editable_set_text ((GtkEditable*) _tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_COMMAND_LINE_PROPERTY]);
}

const gchar*
ft_action_edit_window_get_enter_command_line (FtActionEditWindow* self)
{
	const gchar* result;
	FtCommandEntryRow* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->enter_command_entryrow;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
ft_action_edit_window_set_enter_command_line (FtActionEditWindow* self,
                                              const gchar* value)
{
	FtCommandEntryRow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->enter_command_entryrow;
	gtk_editable_set_text ((GtkEditable*) _tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_ENTER_COMMAND_LINE_PROPERTY]);
}

const gchar*
ft_action_edit_window_get_exit_command_line (FtActionEditWindow* self)
{
	const gchar* result;
	FtCommandEntryRow* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->exit_command_entryrow;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
ft_action_edit_window_set_exit_command_line (FtActionEditWindow* self,
                                             const gchar* value)
{
	FtCommandEntryRow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->exit_command_entryrow;
	gtk_editable_set_text ((GtkEditable*) _tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_EXIT_COMMAND_LINE_PROPERTY]);
}

const gchar*
ft_action_edit_window_get_working_directory (FtActionEditWindow* self)
{
	const gchar* result;
	AdwEntryRow* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->working_directory_entryrow;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
ft_action_edit_window_set_working_directory (FtActionEditWindow* self,
                                             const gchar* value)
{
	AdwEntryRow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->working_directory_entryrow;
	gtk_editable_set_text ((GtkEditable*) _tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_WORKING_DIRECTORY_PROPERTY]);
}

gboolean
ft_action_edit_window_get_use_subshell (FtActionEditWindow* self)
{
	gboolean result;
	AdwSwitchRow* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->use_subshell_switchrow;
	_tmp1_ = adw_switch_row_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
ft_action_edit_window_set_use_subshell (FtActionEditWindow* self,
                                        gboolean value)
{
	AdwSwitchRow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->use_subshell_switchrow;
	adw_switch_row_set_active (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_USE_SUBSHELL_PROPERTY]);
}

gboolean
ft_action_edit_window_get_pass_input (FtActionEditWindow* self)
{
	gboolean result;
	AdwSwitchRow* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->pass_input_switchrow;
	_tmp1_ = adw_switch_row_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
ft_action_edit_window_set_pass_input (FtActionEditWindow* self,
                                      gboolean value)
{
	AdwSwitchRow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->pass_input_switchrow;
	adw_switch_row_set_active (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_PASS_INPUT_PROPERTY]);
}

gboolean
ft_action_edit_window_get_wait_for_completion (FtActionEditWindow* self)
{
	gboolean result;
	AdwSwitchRow* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->wait_for_completion_switchrow;
	_tmp1_ = adw_switch_row_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
ft_action_edit_window_set_wait_for_completion (FtActionEditWindow* self,
                                               gboolean value)
{
	AdwSwitchRow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->wait_for_completion_switchrow;
	adw_switch_row_set_active (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_WAIT_FOR_COMPLETION_PROPERTY]);
}

static GObject *
ft_action_edit_window_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtActionEditWindow * self;
	GtkText* text_widget = NULL;
	AdwEntryRow* _tmp0_;
	GtkWidget* _tmp1_;
	GtkText* _tmp2_;
	GtkListBox* events_listbox = NULL;
	AdwPreferencesGroup* _tmp3_;
	GtkWidget* _tmp4_;
	GtkListBox* _tmp5_;
	GtkText* _tmp6_;
	GtkListBox* _tmp8_;
	FtActionManager* _tmp14_;
	FtEventProducer* _tmp15_;
	GtkMenuButton* _tmp16_;
	GMenu* _tmp17_;
	GMenu* _tmp18_;
	GtkListBox* _tmp19_;
	gboolean _tmp20_;
	parent_class = G_OBJECT_CLASS (ft_action_edit_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_ACTION_EDIT_WINDOW, FtActionEditWindow);
	_tmp0_ = self->priv->display_name_entryrow;
	_tmp1_ = ft_get_child_by_buildable_id ((GtkWidget*) _tmp0_, "text");
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, gtk_text_get_type ()) ? ((GtkText*) _tmp1_) : NULL);
	text_widget = _tmp2_;
	_tmp3_ = self->priv->events_group;
	_tmp4_ = ft_get_child_by_buildable_id ((GtkWidget*) _tmp3_, "listbox");
	_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, gtk_list_box_get_type ()) ? ((GtkListBox*) _tmp4_) : NULL);
	events_listbox = _tmp5_;
	_tmp6_ = text_widget;
	if (_tmp6_ != NULL) {
		GtkText* _tmp7_;
		_tmp7_ = text_widget;
		gtk_text_set_max_length (_tmp7_, 50);
	} else {
		g_warning ("action-edit-window.vala:225: Could not find text widget.");
	}
	_tmp8_ = events_listbox;
	if (_tmp8_ != NULL) {
		GtkLabel* placeholder_label = NULL;
		GtkLabel* _tmp9_;
		GtkLabel* _tmp10_;
		GtkLabel* _tmp11_;
		GtkListBox* _tmp12_;
		GtkLabel* _tmp13_;
		_tmp9_ = (GtkLabel*) gtk_label_new (_ ("No events specified yet."));
		g_object_ref_sink (_tmp9_);
		placeholder_label = _tmp9_;
		_tmp10_ = placeholder_label;
		g_object_set ((GtkWidget*) _tmp10_, "height-request", 50, NULL);
		_tmp11_ = placeholder_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp11_, "dim-label");
		_tmp12_ = events_listbox;
		_tmp13_ = placeholder_label;
		gtk_list_box_set_placeholder (_tmp12_, (GtkWidget*) _tmp13_);
		_g_object_unref0 (placeholder_label);
	} else {
		g_warning ("action-edit-window.vala:237: Could not find events listbox.");
	}
	_tmp14_ = ft_action_manager_new ();
	_g_object_unref0 (self->priv->action_manager);
	self->priv->action_manager = _tmp14_;
	_tmp15_ = ft_event_producer_new ();
	_g_object_unref0 (self->priv->event_producer);
	self->priv->event_producer = _tmp15_;
	_tmp16_ = self->priv->add_event_button;
	_tmp17_ = ft_action_edit_window_create_add_event_menu (self);
	_tmp18_ = _tmp17_;
	gtk_menu_button_set_menu_model (_tmp16_, (GMenuModel*) _tmp18_);
	_g_object_unref0 (_tmp18_);
	_tmp19_ = events_listbox;
	self->priv->events_listbox = _tmp19_;
	_tmp20_ = self->priv->_creating;
	if (_tmp20_) {
		GtkButton* _tmp21_;
		AdwPreferencesGroup* _tmp22_;
		gtk_window_set_title ((GtkWindow*) self, _ ("Add Custom Action"));
		_tmp21_ = self->priv->save_button;
		gtk_button_set_label (_tmp21_, _ ("_Add"));
		_tmp22_ = self->priv->buttons_group;
		gtk_widget_set_visible ((GtkWidget*) _tmp22_, FALSE);
	}
	ft_action_edit_window_populate (self);
	_g_object_unref0 (events_listbox);
	_g_object_unref0 (text_widget);
	return obj;
}

static void
ft_action_edit_window_class_init (FtActionEditWindowClass * klass,
                                  gpointer klass_data)
{
	ft_action_edit_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtActionEditWindow_private_offset);
	((GtkWindowClass *) klass)->close_request = (gboolean (*) (GtkWindow*)) ft_action_edit_window_real_close_request;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) ft_action_edit_window_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_action_edit_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_action_edit_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_action_edit_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_action_edit_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_EDIT_WINDOW_ACTION_UUID_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_ACTION_UUID_PROPERTY] = g_param_spec_string ("action-uuid", "action-uuid", "action-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_EDIT_WINDOW_CREATING_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_CREATING_PROPERTY] = g_param_spec_boolean ("creating", "creating", "creating", FALSE, 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_EDIT_WINDOW_TRIGGER_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_TRIGGER_PROPERTY] = g_param_spec_enum ("trigger", "trigger", "trigger", FT_TYPE_ACTION_TRIGGER, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_EDIT_WINDOW_ENABLED_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_ENABLED_PROPERTY] = g_param_spec_boolean ("enabled", "enabled", "enabled", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_EDIT_WINDOW_DISPLAY_NAME_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_DISPLAY_NAME_PROPERTY] = g_param_spec_string ("display-name", "display-name", "display-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_EDIT_WINDOW_COMMAND_LINE_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_COMMAND_LINE_PROPERTY] = g_param_spec_string ("command-line", "command-line", "command-line", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_EDIT_WINDOW_ENTER_COMMAND_LINE_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_ENTER_COMMAND_LINE_PROPERTY] = g_param_spec_string ("enter-command-line", "enter-command-line", "enter-command-line", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_EDIT_WINDOW_EXIT_COMMAND_LINE_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_EXIT_COMMAND_LINE_PROPERTY] = g_param_spec_string ("exit-command-line", "exit-command-line", "exit-command-line", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_EDIT_WINDOW_WORKING_DIRECTORY_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_WORKING_DIRECTORY_PROPERTY] = g_param_spec_string ("working-directory", "working-directory", "working-directory", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_EDIT_WINDOW_USE_SUBSHELL_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_USE_SUBSHELL_PROPERTY] = g_param_spec_boolean ("use-subshell", "use-subshell", "use-subshell", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_EDIT_WINDOW_PASS_INPUT_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_PASS_INPUT_PROPERTY] = g_param_spec_boolean ("pass-input", "pass-input", "pass-input", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_ACTION_EDIT_WINDOW_WAIT_FOR_COMPLETION_PROPERTY, ft_action_edit_window_properties[FT_ACTION_EDIT_WINDOW_WAIT_FOR_COMPLETION_PROPERTY] = g_param_spec_boolean ("wait-for-completion", "wait-for-completion", "wait-for-completion", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/io/github/focustimerhq/FocusTimer/ui/preferences/automation/action/action-edit-window.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "save_button", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, save_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "enabled_switch", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, enabled_switch));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "display_name_entryrow", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, display_name_entryrow));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "event_radio", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, event_radio));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "condition_radio", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, condition_radio));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "events_group", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, events_group));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "condition_group_widget", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, condition_group_widget));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "add_event_button", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, add_event_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "event_condition_button", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, event_condition_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "event_condition_group", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, event_condition_group));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "event_condition_group_widget", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, event_condition_group_widget));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "working_directory_entryrow", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, working_directory_entryrow));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "use_subshell_switchrow", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, use_subshell_switchrow));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "pass_input_switchrow", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, pass_input_switchrow));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "wait_for_completion_switchrow", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, wait_for_completion_switchrow));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "command_entryrow", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, command_entryrow));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "enter_command_entryrow", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, enter_command_entryrow));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "exit_command_entryrow", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, exit_command_entryrow));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "buttons_group", FALSE, FtActionEditWindow_private_offset + G_STRUCT_OFFSET (FtActionEditWindowPrivate, buttons_group));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_cancel_button_clicked", G_CALLBACK(_ft_action_edit_window_on_cancel_button_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_save_button_clicked", G_CALLBACK(_ft_action_edit_window_on_save_button_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_delete_button_clicked", G_CALLBACK(_ft_action_edit_window_on_delete_button_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_trigger_radio_toggled", G_CALLBACK(_ft_action_edit_window_on_trigger_radio_toggled_gtk_check_button_toggled));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_event_condition_button_toggled", G_CALLBACK(_ft_action_edit_window_on_event_condition_button_toggled_gtk_toggle_button_toggled));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_event_condition_request_remove", G_CALLBACK(_ft_action_edit_window_on_event_condition_request_remove_ft_expression_widget_request_remove));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_working_directory_button_clicked", G_CALLBACK(_ft_action_edit_window_on_working_directory_button_clicked_gtk_button_clicked));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_key_pressed", G_CALLBACK(_ft_action_edit_window_on_key_pressed_gtk_event_controller_key_key_pressed));
	gtk_widget_class_install_action (GTK_WIDGET_CLASS (klass), "add-event", "s", (GtkWidgetActionActivateFunc) ft_action_edit_window_on_add_event);
}

static void
ft_action_edit_window_instance_init (FtActionEditWindow * self,
                                     gpointer klass)
{
	self->priv = ft_action_edit_window_get_instance_private (self);
	self->priv->action_manager = NULL;
	self->priv->event_producer = NULL;
	self->priv->events_listbox = NULL;
	g_type_ensure (FT_TYPE_CONDITION_GROUP_WIDGET);
	g_type_ensure (FT_TYPE_CONDITION_GROUP_WIDGET);
	g_type_ensure (FT_TYPE_COMMAND_ENTRY_ROW);
	g_type_ensure (FT_TYPE_COMMAND_ENTRY_ROW);
	g_type_ensure (FT_TYPE_COMMAND_ENTRY_ROW);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
ft_action_edit_window_finalize (GObject * obj)
{
	FtActionEditWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_ACTION_EDIT_WINDOW, FtActionEditWindow);
	_g_free0 (self->priv->_action_uuid);
	_g_object_unref0 (self->priv->action_manager);
	_g_object_unref0 (self->priv->event_producer);
	G_OBJECT_CLASS (ft_action_edit_window_parent_class)->finalize (obj);
}

static GType
ft_action_edit_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtActionEditWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_action_edit_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtActionEditWindow), 0, (GInstanceInitFunc) ft_action_edit_window_instance_init, NULL };
	GType ft_action_edit_window_type_id;
	ft_action_edit_window_type_id = g_type_register_static (adw_window_get_type (), "FtActionEditWindow", &g_define_type_info, 0);
	FtActionEditWindow_private_offset = g_type_add_instance_private (ft_action_edit_window_type_id, sizeof (FtActionEditWindowPrivate));
	return ft_action_edit_window_type_id;
}

GType
ft_action_edit_window_get_type (void)
{
	static volatile gsize ft_action_edit_window_type_id__once = 0;
	if (g_once_init_enter (&ft_action_edit_window_type_id__once)) {
		GType ft_action_edit_window_type_id;
		ft_action_edit_window_type_id = ft_action_edit_window_get_type_once ();
		g_once_init_leave (&ft_action_edit_window_type_id__once, ft_action_edit_window_type_id);
	}
	return ft_action_edit_window_type_id__once;
}

static void
_vala_ft_action_edit_window_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	FtActionEditWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_ACTION_EDIT_WINDOW, FtActionEditWindow);
	switch (property_id) {
		case FT_ACTION_EDIT_WINDOW_ACTION_UUID_PROPERTY:
		g_value_set_string (value, ft_action_edit_window_get_action_uuid (self));
		break;
		case FT_ACTION_EDIT_WINDOW_CREATING_PROPERTY:
		g_value_set_boolean (value, ft_action_edit_window_get_creating (self));
		break;
		case FT_ACTION_EDIT_WINDOW_TRIGGER_PROPERTY:
		g_value_set_enum (value, ft_action_edit_window_get_trigger (self));
		break;
		case FT_ACTION_EDIT_WINDOW_ENABLED_PROPERTY:
		g_value_set_boolean (value, ft_action_edit_window_get_enabled (self));
		break;
		case FT_ACTION_EDIT_WINDOW_DISPLAY_NAME_PROPERTY:
		g_value_set_string (value, ft_action_edit_window_get_display_name (self));
		break;
		case FT_ACTION_EDIT_WINDOW_COMMAND_LINE_PROPERTY:
		g_value_set_string (value, ft_action_edit_window_get_command_line (self));
		break;
		case FT_ACTION_EDIT_WINDOW_ENTER_COMMAND_LINE_PROPERTY:
		g_value_set_string (value, ft_action_edit_window_get_enter_command_line (self));
		break;
		case FT_ACTION_EDIT_WINDOW_EXIT_COMMAND_LINE_PROPERTY:
		g_value_set_string (value, ft_action_edit_window_get_exit_command_line (self));
		break;
		case FT_ACTION_EDIT_WINDOW_WORKING_DIRECTORY_PROPERTY:
		g_value_set_string (value, ft_action_edit_window_get_working_directory (self));
		break;
		case FT_ACTION_EDIT_WINDOW_USE_SUBSHELL_PROPERTY:
		g_value_set_boolean (value, ft_action_edit_window_get_use_subshell (self));
		break;
		case FT_ACTION_EDIT_WINDOW_PASS_INPUT_PROPERTY:
		g_value_set_boolean (value, ft_action_edit_window_get_pass_input (self));
		break;
		case FT_ACTION_EDIT_WINDOW_WAIT_FOR_COMPLETION_PROPERTY:
		g_value_set_boolean (value, ft_action_edit_window_get_wait_for_completion (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_action_edit_window_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	FtActionEditWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_ACTION_EDIT_WINDOW, FtActionEditWindow);
	switch (property_id) {
		case FT_ACTION_EDIT_WINDOW_ACTION_UUID_PROPERTY:
		ft_action_edit_window_set_action_uuid (self, g_value_get_string (value));
		break;
		case FT_ACTION_EDIT_WINDOW_CREATING_PROPERTY:
		ft_action_edit_window_set_creating (self, g_value_get_boolean (value));
		break;
		case FT_ACTION_EDIT_WINDOW_TRIGGER_PROPERTY:
		ft_action_edit_window_set_trigger (self, g_value_get_enum (value));
		break;
		case FT_ACTION_EDIT_WINDOW_ENABLED_PROPERTY:
		ft_action_edit_window_set_enabled (self, g_value_get_boolean (value));
		break;
		case FT_ACTION_EDIT_WINDOW_DISPLAY_NAME_PROPERTY:
		ft_action_edit_window_set_display_name (self, g_value_get_string (value));
		break;
		case FT_ACTION_EDIT_WINDOW_COMMAND_LINE_PROPERTY:
		ft_action_edit_window_set_command_line (self, g_value_get_string (value));
		break;
		case FT_ACTION_EDIT_WINDOW_ENTER_COMMAND_LINE_PROPERTY:
		ft_action_edit_window_set_enter_command_line (self, g_value_get_string (value));
		break;
		case FT_ACTION_EDIT_WINDOW_EXIT_COMMAND_LINE_PROPERTY:
		ft_action_edit_window_set_exit_command_line (self, g_value_get_string (value));
		break;
		case FT_ACTION_EDIT_WINDOW_WORKING_DIRECTORY_PROPERTY:
		ft_action_edit_window_set_working_directory (self, g_value_get_string (value));
		break;
		case FT_ACTION_EDIT_WINDOW_USE_SUBSHELL_PROPERTY:
		ft_action_edit_window_set_use_subshell (self, g_value_get_boolean (value));
		break;
		case FT_ACTION_EDIT_WINDOW_PASS_INPUT_PROPERTY:
		ft_action_edit_window_set_pass_input (self, g_value_get_boolean (value));
		break;
		case FT_ACTION_EDIT_WINDOW_WAIT_FOR_COMPLETION_PROPERTY:
		ft_action_edit_window_set_wait_for_completion (self, g_value_get_boolean (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 inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

