/* launch-command-builder.c generated by valac 0.56.19, the Vala compiler
 * generated from launch-command-builder.vala, do not modify */

#include "protonplus_core.h"
#include <glib.h>
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>

#define PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILDER_COMMAND_PLACEHOLDER "%command%"
#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  {
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_0_PROPERTY,
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_IS_VALID_PROPERTY,
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_SEGMENTS_PROPERTY,
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_ERRORS_PROPERTY,
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_LAUNCH_LINE_PROPERTY,
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_games_launch_options_editor_launch_command_build_result_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILDER_0_PROPERTY,
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILDER_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_games_launch_options_editor_launch_command_builder_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILDER_NUM_PROPERTIES];

struct _ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResultPrivate {
	gboolean _is_valid;
	GeeList* _segments;
	GeeList* _errors;
	gchar* _launch_line;
};

static gint ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult_private_offset;
static gpointer proton_plus_widgets_games_launch_options_editor_launch_command_build_result_parent_class = NULL;
static gpointer proton_plus_widgets_games_launch_options_editor_launch_command_builder_parent_class = NULL;

static void proton_plus_widgets_games_launch_options_editor_launch_command_build_result_finalize (GObject * obj);
static GType proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_type_once (void);
static void _vala_proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_property (GObject * object,
                                                                                                     guint property_id,
                                                                                                     GValue * value,
                                                                                                     GParamSpec * pspec);
static void _vala_proton_plus_widgets_games_launch_options_editor_launch_command_build_result_set_property (GObject * object,
                                                                                                     guint property_id,
                                                                                                     const GValue * value,
                                                                                                     GParamSpec * pspec);
static GeeArrayList* proton_plus_widgets_games_launch_options_editor_launch_command_builder_validate (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                                                                                               ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandPlan* plan);
static GeeArrayList* proton_plus_widgets_games_launch_options_editor_launch_command_builder_get_ordered_wrappers (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                                                                                                           ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation** wrappers,
                                                                                                           gint wrappers_length1);
static void proton_plus_widgets_games_launch_options_editor_launch_command_builder_append_tokens (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                                                                                           GeeArrayList* segments,
                                                                                           gchar** tokens,
                                                                                           gint tokens_length1);
static gboolean proton_plus_widgets_games_launch_options_editor_launch_command_builder_requires_placeholder (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                                                                                                      ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandPlan* plan);
static gint __lambda159_ (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                   ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* first,
                   ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* second);
static gint ___lambda159__gcompare_data_func (gconstpointer a,
                                       gconstpointer b,
                                       gpointer self);
static void proton_plus_widgets_games_launch_options_editor_launch_command_builder_validate_token (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                                                                                            GeeArrayList* errors,
                                                                                            const gchar* token,
                                                                                            const gchar* description);
static GType proton_plus_widgets_games_launch_options_editor_launch_command_builder_get_type_once (void);
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
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_instance_private (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult_private_offset);
}

static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult*
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_construct (GType object_type,
                                                                                       gboolean is_valid,
                                                                                       GeeList* segments,
                                                                                       GeeList* errors)
{
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult * self = NULL;
	gchar* _tmp0_ = NULL;
	g_return_val_if_fail (segments != NULL, NULL);
	g_return_val_if_fail (errors != NULL, NULL);
	if (is_valid) {
		gint _tmp1_ = 0;
		gpointer* _tmp2_;
		gchar** _tmp3_;
		gint _tmp3__length1;
		gchar* _tmp4_;
		_tmp2_ = gee_collection_to_array ((GeeCollection*) segments, &_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp3__length1 = _tmp1_;
		_tmp4_ = _vala_g_strjoinv (" ", _tmp3_, (gint) _tmp1_);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp4_;
		_tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
	} else {
		gchar* _tmp5_;
		_tmp5_ = g_strdup ("");
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp5_;
	}
	self = (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult*) g_object_new (object_type, "is-valid", is_valid, "segments", segments, "errors", errors, "launch-line", _tmp0_, NULL);
	_g_free0 (_tmp0_);
	return self;
}

ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult*
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_new (gboolean is_valid,
                                                                                 GeeList* segments,
                                                                                 GeeList* errors)
{
	return proton_plus_widgets_games_launch_options_editor_launch_command_build_result_construct (PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_TYPE_LAUNCH_COMMAND_BUILD_RESULT, is_valid, segments, errors);
}

gboolean
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_is_valid (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_valid;
	return result;
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_set_is_valid (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* self,
                                                                                          gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_is_valid (self);
	if (old_value != value) {
		self->priv->_is_valid = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_IS_VALID_PROPERTY]);
	}
}

GeeList*
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_segments (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* self)
{
	GeeList* result;
	GeeList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_segments;
	result = _tmp0_;
	return result;
}

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

static void
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_set_segments (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* self,
                                                                                          GeeList* value)
{
	GeeList* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_segments (self);
	if (old_value != value) {
		GeeList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_segments);
		self->priv->_segments = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_SEGMENTS_PROPERTY]);
	}
}

GeeList*
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_errors (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* self)
{
	GeeList* result;
	GeeList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_errors;
	result = _tmp0_;
	return result;
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_set_errors (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* self,
                                                                                        GeeList* value)
{
	GeeList* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_errors (self);
	if (old_value != value) {
		GeeList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_errors);
		self->priv->_errors = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_ERRORS_PROPERTY]);
	}
}

const gchar*
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_launch_line (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_launch_line;
	result = _tmp0_;
	return result;
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_set_launch_line (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* self,
                                                                                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_launch_line (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_launch_line);
		self->priv->_launch_line = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_LAUNCH_LINE_PROPERTY]);
	}
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_class_init (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResultClass * klass,
                                                                                        gpointer klass_data)
{
	proton_plus_widgets_games_launch_options_editor_launch_command_build_result_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_widgets_games_launch_options_editor_launch_command_build_result_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_widgets_games_launch_options_editor_launch_command_build_result_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_IS_VALID_PROPERTY, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_IS_VALID_PROPERTY] = g_param_spec_boolean ("is-valid", "is-valid", "is-valid", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_SEGMENTS_PROPERTY, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_SEGMENTS_PROPERTY] = g_param_spec_object ("segments", "segments", "segments", GEE_TYPE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_ERRORS_PROPERTY, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_ERRORS_PROPERTY] = g_param_spec_object ("errors", "errors", "errors", GEE_TYPE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_LAUNCH_LINE_PROPERTY, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_LAUNCH_LINE_PROPERTY] = g_param_spec_string ("launch-line", "launch-line", "launch-line", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_instance_init (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult * self,
                                                                                           gpointer klass)
{
	self->priv = proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_instance_private (self);
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_finalize (GObject * obj)
{
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_TYPE_LAUNCH_COMMAND_BUILD_RESULT, ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult);
	_g_object_unref0 (self->priv->_segments);
	_g_object_unref0 (self->priv->_errors);
	_g_free0 (self->priv->_launch_line);
	G_OBJECT_CLASS (proton_plus_widgets_games_launch_options_editor_launch_command_build_result_parent_class)->finalize (obj);
}

static GType
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResultClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_games_launch_options_editor_launch_command_build_result_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult), 0, (GInstanceInitFunc) proton_plus_widgets_games_launch_options_editor_launch_command_build_result_instance_init, NULL };
	GType proton_plus_widgets_games_launch_options_editor_launch_command_build_result_type_id;
	proton_plus_widgets_games_launch_options_editor_launch_command_build_result_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult", &g_define_type_info, 0);
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult_private_offset = g_type_add_instance_private (proton_plus_widgets_games_launch_options_editor_launch_command_build_result_type_id, sizeof (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResultPrivate));
	return proton_plus_widgets_games_launch_options_editor_launch_command_build_result_type_id;
}

GType
proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_type (void)
{
	static volatile gsize proton_plus_widgets_games_launch_options_editor_launch_command_build_result_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_games_launch_options_editor_launch_command_build_result_type_id__once)) {
		GType proton_plus_widgets_games_launch_options_editor_launch_command_build_result_type_id;
		proton_plus_widgets_games_launch_options_editor_launch_command_build_result_type_id = proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_games_launch_options_editor_launch_command_build_result_type_id__once, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_type_id);
	}
	return proton_plus_widgets_games_launch_options_editor_launch_command_build_result_type_id__once;
}

static void
_vala_proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_property (GObject * object,
                                                                                                guint property_id,
                                                                                                GValue * value,
                                                                                                GParamSpec * pspec)
{
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_TYPE_LAUNCH_COMMAND_BUILD_RESULT, ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult);
	switch (property_id) {
		case PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_IS_VALID_PROPERTY:
		g_value_set_boolean (value, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_is_valid (self));
		break;
		case PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_SEGMENTS_PROPERTY:
		g_value_set_object (value, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_segments (self));
		break;
		case PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_ERRORS_PROPERTY:
		g_value_set_object (value, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_errors (self));
		break;
		case PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_LAUNCH_LINE_PROPERTY:
		g_value_set_string (value, proton_plus_widgets_games_launch_options_editor_launch_command_build_result_get_launch_line (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_widgets_games_launch_options_editor_launch_command_build_result_set_property (GObject * object,
                                                                                                guint property_id,
                                                                                                const GValue * value,
                                                                                                GParamSpec * pspec)
{
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_TYPE_LAUNCH_COMMAND_BUILD_RESULT, ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult);
	switch (property_id) {
		case PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_IS_VALID_PROPERTY:
		proton_plus_widgets_games_launch_options_editor_launch_command_build_result_set_is_valid (self, g_value_get_boolean (value));
		break;
		case PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_SEGMENTS_PROPERTY:
		proton_plus_widgets_games_launch_options_editor_launch_command_build_result_set_segments (self, g_value_get_object (value));
		break;
		case PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_ERRORS_PROPERTY:
		proton_plus_widgets_games_launch_options_editor_launch_command_build_result_set_errors (self, g_value_get_object (value));
		break;
		case PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILD_RESULT_LAUNCH_LINE_PROPERTY:
		proton_plus_widgets_games_launch_options_editor_launch_command_build_result_set_launch_line (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult*
proton_plus_widgets_games_launch_options_editor_launch_command_builder_build (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                                                                              ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandPlan* plan)
{
	GeeArrayList* errors = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* segments = NULL;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment** _tmp8_;
	gint _tmp8__length1;
	GeeArrayList* wrappers = NULL;
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation** _tmp14_;
	gint _tmp14__length1;
	GeeArrayList* _tmp15_;
	GeeArrayList* _tmp42_;
	gchar** _tmp43_;
	gint _tmp43__length1;
	gint _tmp44_ = 0;
	gchar** _tmp45_;
	gint _tmp45__length1;
	GeeArrayList* _tmp46_;
	GeeArrayList* _tmp47_;
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* _tmp48_;
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (plan != NULL, NULL);
	_tmp0_ = proton_plus_widgets_games_launch_options_editor_launch_command_builder_validate (self, plan);
	errors = _tmp0_;
	_tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	segments = _tmp1_;
	_tmp2_ = errors;
	_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ > 0) {
		GeeArrayList* _tmp5_;
		GeeArrayList* _tmp6_;
		ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuildResult* _tmp7_;
		_tmp5_ = segments;
		_tmp6_ = errors;
		_tmp7_ = proton_plus_widgets_games_launch_options_editor_launch_command_build_result_new (FALSE, (GeeList*) _tmp5_, (GeeList*) _tmp6_);
		result = _tmp7_;
		_g_object_unref0 (segments);
		_g_object_unref0 (errors);
		return result;
	}
	_tmp8_ = plan->environment_assignments;
	_tmp8__length1 = plan->environment_assignments_length1;
	{
		ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment** environment_collection = NULL;
		gint environment_collection_length1 = 0;
		gint _environment_collection_size_ = 0;
		gint environment_it = 0;
		environment_collection = _tmp8_;
		environment_collection_length1 = _tmp8__length1;
		for (environment_it = 0; environment_it < environment_collection_length1; environment_it = environment_it + 1) {
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment* _tmp9_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment* environment = NULL;
			_tmp9_ = _g_object_ref0 (environment_collection[environment_it]);
			environment = _tmp9_;
			{
				GeeArrayList* _tmp10_;
				ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment* _tmp11_;
				const gchar* _tmp12_;
				const gchar* _tmp13_;
				_tmp10_ = segments;
				_tmp11_ = environment;
				_tmp12_ = proton_plus_widgets_games_launch_options_editor_launch_environment_assignment_get_raw_assignment (_tmp11_);
				_tmp13_ = _tmp12_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, _tmp13_);
				_g_object_unref0 (environment);
			}
		}
	}
	_tmp14_ = plan->wrappers;
	_tmp14__length1 = plan->wrappers_length1;
	_tmp15_ = proton_plus_widgets_games_launch_options_editor_launch_command_builder_get_ordered_wrappers (self, _tmp14_, (gint) _tmp14__length1);
	wrappers = _tmp15_;
	{
		GeeArrayList* _wrapper_list = NULL;
		GeeArrayList* _tmp16_;
		gint _wrapper_size = 0;
		GeeArrayList* _tmp17_;
		gint _tmp18_;
		gint _tmp19_;
		gint _wrapper_index = 0;
		_tmp16_ = wrappers;
		_wrapper_list = _tmp16_;
		_tmp17_ = _wrapper_list;
		_tmp18_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp17_);
		_tmp19_ = _tmp18_;
		_wrapper_size = _tmp19_;
		_wrapper_index = -1;
		while (TRUE) {
			gint _tmp20_;
			gint _tmp21_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* wrapper = NULL;
			GeeArrayList* _tmp22_;
			gpointer _tmp23_;
			GeeArrayList* _tmp24_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp25_;
			gchar** _tmp26_;
			gint _tmp26__length1;
			gint _tmp27_ = 0;
			gchar** _tmp28_;
			gint _tmp28__length1;
			GeeArrayList* _tmp29_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp30_;
			gchar** _tmp31_;
			gint _tmp31__length1;
			gint _tmp32_ = 0;
			gchar** _tmp33_;
			gint _tmp33__length1;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp34_;
			const gchar* _tmp35_;
			const gchar* _tmp36_;
			_wrapper_index = _wrapper_index + 1;
			_tmp20_ = _wrapper_index;
			_tmp21_ = _wrapper_size;
			if (!(_tmp20_ < _tmp21_)) {
				break;
			}
			_tmp22_ = _wrapper_list;
			_tmp23_ = gee_abstract_list_get ((GeeAbstractList*) _tmp22_, _wrapper_index);
			wrapper = (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation*) _tmp23_;
			_tmp24_ = segments;
			_tmp25_ = wrapper;
			_tmp26_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_executable_tokens (_tmp25_, &_tmp27_);
			_tmp26__length1 = _tmp27_;
			_tmp28_ = _tmp26_;
			_tmp28__length1 = _tmp26__length1;
			proton_plus_widgets_games_launch_options_editor_launch_command_builder_append_tokens (self, _tmp24_, _tmp28_, (gint) _tmp28__length1);
			_tmp29_ = segments;
			_tmp30_ = wrapper;
			_tmp31_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_argument_tokens (_tmp30_, &_tmp32_);
			_tmp31__length1 = _tmp32_;
			_tmp33_ = _tmp31_;
			_tmp33__length1 = _tmp31__length1;
			proton_plus_widgets_games_launch_options_editor_launch_command_builder_append_tokens (self, _tmp29_, _tmp33_, (gint) _tmp33__length1);
			_tmp34_ = wrapper;
			_tmp35_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_delimiter (_tmp34_);
			_tmp36_ = _tmp35_;
			if (_tmp36_ != NULL) {
				GeeArrayList* _tmp37_;
				ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp38_;
				const gchar* _tmp39_;
				const gchar* _tmp40_;
				_tmp37_ = segments;
				_tmp38_ = wrapper;
				_tmp39_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_delimiter (_tmp38_);
				_tmp40_ = _tmp39_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp37_, _tmp40_);
			}
			_g_object_unref0 (wrapper);
		}
	}
	if (proton_plus_widgets_games_launch_options_editor_launch_command_builder_requires_placeholder (self, plan)) {
		GeeArrayList* _tmp41_;
		_tmp41_ = segments;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp41_, PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILDER_COMMAND_PLACEHOLDER);
	}
	_tmp42_ = segments;
	_tmp43_ = proton_plus_widgets_games_launch_options_editor_launch_command_plan_get_game_arguments (plan, &_tmp44_);
	_tmp43__length1 = _tmp44_;
	_tmp45_ = _tmp43_;
	_tmp45__length1 = _tmp43__length1;
	proton_plus_widgets_games_launch_options_editor_launch_command_builder_append_tokens (self, _tmp42_, _tmp45_, (gint) _tmp45__length1);
	_tmp46_ = segments;
	_tmp47_ = errors;
	_tmp48_ = proton_plus_widgets_games_launch_options_editor_launch_command_build_result_new (TRUE, (GeeList*) _tmp46_, (GeeList*) _tmp47_);
	result = _tmp48_;
	_g_object_unref0 (wrappers);
	_g_object_unref0 (segments);
	_g_object_unref0 (errors);
	return result;
}

static gboolean
proton_plus_widgets_games_launch_options_editor_launch_command_builder_requires_placeholder (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                                                                                             ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandPlan* plan)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment** _tmp2_;
	gint _tmp2__length1;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (plan != NULL, FALSE);
	_tmp2_ = plan->environment_assignments;
	_tmp2__length1 = plan->environment_assignments_length1;
	if (_tmp2__length1 > 0) {
		_tmp1_ = TRUE;
	} else {
		ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation** _tmp3_;
		gint _tmp3__length1;
		_tmp3_ = plan->wrappers;
		_tmp3__length1 = plan->wrappers_length1;
		_tmp1_ = _tmp3__length1 > 0;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp4_;
		gboolean _tmp5_;
		_tmp4_ = proton_plus_widgets_games_launch_options_editor_launch_command_plan_get_retain_placeholder_for_arguments_only (plan);
		_tmp5_ = _tmp4_;
		_tmp0_ = _tmp5_;
	}
	result = _tmp0_;
	return result;
}

static gint
__lambda159_ (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
              ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* first,
              ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* second)
{
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	GCompareFunc _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gint result;
	g_return_val_if_fail (first != NULL, -1);
	g_return_val_if_fail (second != NULL, -1);
	_tmp0_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_nesting_priority (first);
	_tmp1_ = _tmp0_;
	_tmp2_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_nesting_priority (second);
	_tmp3_ = _tmp2_;
	if (_tmp1_ != _tmp3_) {
		gint _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		_tmp4_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_nesting_priority (first);
		_tmp5_ = _tmp4_;
		_tmp6_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_nesting_priority (second);
		_tmp7_ = _tmp6_;
		result = _tmp5_ - _tmp7_;
		return result;
	}
	_tmp8_ = ((GCompareFunc) g_strcmp0);
	_tmp9_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_id (first);
	_tmp10_ = _tmp9_;
	_tmp11_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_id (second);
	_tmp12_ = _tmp11_;
	result = _tmp8_ (_tmp10_, _tmp12_);
	return result;
}

static gint
___lambda159__gcompare_data_func (gconstpointer a,
                                  gconstpointer b,
                                  gpointer self)
{
	gint result;
	result = __lambda159_ ((ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder*) self, (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation*) a, (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation*) b);
	return result;
}

static GeeArrayList*
proton_plus_widgets_games_launch_options_editor_launch_command_builder_get_ordered_wrappers (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                                                                                             ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation** wrappers,
                                                                                             gint wrappers_length1)
{
	GeeArrayList* ordered = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp4_;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_TYPE_LAUNCH_WRAPPER_INVOCATION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	ordered = _tmp0_;
	{
		ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation** wrapper_collection = NULL;
		gint wrapper_collection_length1 = 0;
		gint _wrapper_collection_size_ = 0;
		gint wrapper_it = 0;
		wrapper_collection = wrappers;
		wrapper_collection_length1 = wrappers_length1;
		for (wrapper_it = 0; wrapper_it < wrapper_collection_length1; wrapper_it = wrapper_it + 1) {
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp1_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* wrapper = NULL;
			_tmp1_ = _g_object_ref0 (wrapper_collection[wrapper_it]);
			wrapper = _tmp1_;
			{
				GeeArrayList* _tmp2_;
				ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp3_;
				_tmp2_ = ordered;
				_tmp3_ = wrapper;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp2_, _tmp3_);
				_g_object_unref0 (wrapper);
			}
		}
	}
	_tmp4_ = ordered;
	gee_list_sort ((GeeList*) _tmp4_, ___lambda159__gcompare_data_func, g_object_ref (self), g_object_unref);
	result = ordered;
	return result;
}

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

static GeeArrayList*
proton_plus_widgets_games_launch_options_editor_launch_command_builder_validate (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                                                                                 ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandPlan* plan)
{
	GeeArrayList* errors = NULL;
	GeeArrayList* _tmp0_;
	GeeHashSet* environment_keys = NULL;
	GeeHashSet* _tmp1_;
	GeeHashSet* priorities = NULL;
	GeeHashSet* _tmp2_;
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment** _tmp3_;
	gint _tmp3__length1;
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation** _tmp30_;
	gint _tmp30__length1;
	gchar** _tmp84_;
	gint _tmp84__length1;
	gint _tmp85_ = 0;
	gchar** _tmp86_;
	gint _tmp86__length1;
	GeeArrayList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (plan != NULL, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	errors = _tmp0_;
	_tmp1_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	environment_keys = _tmp1_;
	_tmp2_ = gee_hash_set_new (G_TYPE_INT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	priorities = _tmp2_;
	_tmp3_ = plan->environment_assignments;
	_tmp3__length1 = plan->environment_assignments_length1;
	{
		ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment** environment_collection = NULL;
		gint environment_collection_length1 = 0;
		gint _environment_collection_size_ = 0;
		gint environment_it = 0;
		environment_collection = _tmp3_;
		environment_collection_length1 = _tmp3__length1;
		for (environment_it = 0; environment_it < environment_collection_length1; environment_it = environment_it + 1) {
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment* _tmp4_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment* environment = NULL;
			_tmp4_ = _g_object_ref0 (environment_collection[environment_it]);
			environment = _tmp4_;
			{
				ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment* _tmp5_;
				const gchar* _tmp6_;
				const gchar* _tmp7_;
				gchar* _tmp8_;
				gchar* _tmp9_;
				gboolean _tmp10_;
				GeeArrayList* _tmp26_;
				ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment* _tmp27_;
				const gchar* _tmp28_;
				const gchar* _tmp29_;
				_tmp5_ = environment;
				_tmp6_ = proton_plus_widgets_games_launch_options_editor_launch_environment_assignment_get_key (_tmp5_);
				_tmp7_ = _tmp6_;
				_tmp8_ = string_strip (_tmp7_);
				_tmp9_ = _tmp8_;
				_tmp10_ = g_strcmp0 (_tmp9_, "") == 0;
				_g_free0 (_tmp9_);
				if (_tmp10_) {
					GeeArrayList* _tmp11_;
					_tmp11_ = errors;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, "Environment assignments require a key.");
				} else {
					GeeHashSet* _tmp12_;
					ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					_tmp12_ = environment_keys;
					_tmp13_ = environment;
					_tmp14_ = proton_plus_widgets_games_launch_options_editor_launch_environment_assignment_get_key (_tmp13_);
					_tmp15_ = _tmp14_;
					if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp12_, _tmp15_)) {
						GeeArrayList* _tmp16_;
						ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment* _tmp17_;
						const gchar* _tmp18_;
						const gchar* _tmp19_;
						gchar* _tmp20_;
						gchar* _tmp21_;
						_tmp16_ = errors;
						_tmp17_ = environment;
						_tmp18_ = proton_plus_widgets_games_launch_options_editor_launch_environment_assignment_get_key (_tmp17_);
						_tmp19_ = _tmp18_;
						_tmp20_ = g_strdup_printf ("Duplicate environment key: %s", _tmp19_);
						_tmp21_ = _tmp20_;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp21_);
						_g_free0 (_tmp21_);
					} else {
						GeeHashSet* _tmp22_;
						ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchEnvironmentAssignment* _tmp23_;
						const gchar* _tmp24_;
						const gchar* _tmp25_;
						_tmp22_ = environment_keys;
						_tmp23_ = environment;
						_tmp24_ = proton_plus_widgets_games_launch_options_editor_launch_environment_assignment_get_key (_tmp23_);
						_tmp25_ = _tmp24_;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, _tmp25_);
					}
				}
				_tmp26_ = errors;
				_tmp27_ = environment;
				_tmp28_ = proton_plus_widgets_games_launch_options_editor_launch_environment_assignment_get_raw_assignment (_tmp27_);
				_tmp29_ = _tmp28_;
				proton_plus_widgets_games_launch_options_editor_launch_command_builder_validate_token (self, _tmp26_, _tmp29_, "environment assignment");
				_g_object_unref0 (environment);
			}
		}
	}
	_tmp30_ = plan->wrappers;
	_tmp30__length1 = plan->wrappers_length1;
	{
		ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation** wrapper_collection = NULL;
		gint wrapper_collection_length1 = 0;
		gint _wrapper_collection_size_ = 0;
		gint wrapper_it = 0;
		wrapper_collection = _tmp30_;
		wrapper_collection_length1 = _tmp30__length1;
		for (wrapper_it = 0; wrapper_it < wrapper_collection_length1; wrapper_it = wrapper_it + 1) {
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp31_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* wrapper = NULL;
			_tmp31_ = _g_object_ref0 (wrapper_collection[wrapper_it]);
			wrapper = _tmp31_;
			{
				ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp32_;
				const gchar* _tmp33_;
				const gchar* _tmp34_;
				gchar* _tmp35_;
				gchar* _tmp36_;
				gboolean _tmp37_;
				ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp39_;
				gchar** _tmp40_;
				gint _tmp40__length1;
				gint _tmp41_ = 0;
				gchar** _tmp42_;
				gint _tmp42__length1;
				GeeHashSet* _tmp49_;
				ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp50_;
				gint _tmp51_;
				gint _tmp52_;
				ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp63_;
				gchar** _tmp64_;
				gint _tmp64__length1;
				gint _tmp65_ = 0;
				gchar** _tmp66_;
				gint _tmp66__length1;
				ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp70_;
				gchar** _tmp71_;
				gint _tmp71__length1;
				gint _tmp72_ = 0;
				gchar** _tmp73_;
				gint _tmp73__length1;
				ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp77_;
				const gchar* _tmp78_;
				const gchar* _tmp79_;
				_tmp32_ = wrapper;
				_tmp33_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_id (_tmp32_);
				_tmp34_ = _tmp33_;
				_tmp35_ = string_strip (_tmp34_);
				_tmp36_ = _tmp35_;
				_tmp37_ = g_strcmp0 (_tmp36_, "") == 0;
				_g_free0 (_tmp36_);
				if (_tmp37_) {
					GeeArrayList* _tmp38_;
					_tmp38_ = errors;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp38_, "Wrapper definitions require an ID.");
				}
				_tmp39_ = wrapper;
				_tmp40_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_executable_tokens (_tmp39_, &_tmp41_);
				_tmp40__length1 = _tmp41_;
				_tmp42_ = _tmp40_;
				_tmp42__length1 = _tmp40__length1;
				if (_tmp42__length1 == 0) {
					GeeArrayList* _tmp43_;
					ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp44_;
					const gchar* _tmp45_;
					const gchar* _tmp46_;
					gchar* _tmp47_;
					gchar* _tmp48_;
					_tmp43_ = errors;
					_tmp44_ = wrapper;
					_tmp45_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_id (_tmp44_);
					_tmp46_ = _tmp45_;
					_tmp47_ = g_strdup_printf ("Wrapper '%s' requires an executable token.", _tmp46_);
					_tmp48_ = _tmp47_;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp43_, _tmp48_);
					_g_free0 (_tmp48_);
				}
				_tmp49_ = priorities;
				_tmp50_ = wrapper;
				_tmp51_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_nesting_priority (_tmp50_);
				_tmp52_ = _tmp51_;
				if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp49_, (gpointer) ((gintptr) _tmp52_))) {
					GeeArrayList* _tmp53_;
					ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp54_;
					gint _tmp55_;
					gint _tmp56_;
					gchar* _tmp57_;
					gchar* _tmp58_;
					_tmp53_ = errors;
					_tmp54_ = wrapper;
					_tmp55_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_nesting_priority (_tmp54_);
					_tmp56_ = _tmp55_;
					_tmp57_ = g_strdup_printf ("Wrapper nesting priority %d is ambiguous.", _tmp56_);
					_tmp58_ = _tmp57_;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp53_, _tmp58_);
					_g_free0 (_tmp58_);
				} else {
					GeeHashSet* _tmp59_;
					ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp60_;
					gint _tmp61_;
					gint _tmp62_;
					_tmp59_ = priorities;
					_tmp60_ = wrapper;
					_tmp61_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_nesting_priority (_tmp60_);
					_tmp62_ = _tmp61_;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp59_, (gpointer) ((gintptr) _tmp62_));
				}
				_tmp63_ = wrapper;
				_tmp64_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_executable_tokens (_tmp63_, &_tmp65_);
				_tmp64__length1 = _tmp65_;
				_tmp66_ = _tmp64_;
				_tmp66__length1 = _tmp64__length1;
				{
					gchar** token_collection = NULL;
					gint token_collection_length1 = 0;
					gint _token_collection_size_ = 0;
					gint token_it = 0;
					token_collection = _tmp66_;
					token_collection_length1 = _tmp66__length1;
					for (token_it = 0; token_it < token_collection_length1; token_it = token_it + 1) {
						gchar* _tmp67_;
						gchar* token = NULL;
						_tmp67_ = g_strdup (token_collection[token_it]);
						token = _tmp67_;
						{
							GeeArrayList* _tmp68_;
							const gchar* _tmp69_;
							_tmp68_ = errors;
							_tmp69_ = token;
							proton_plus_widgets_games_launch_options_editor_launch_command_builder_validate_token (self, _tmp68_, _tmp69_, "wrapper executable token");
							_g_free0 (token);
						}
					}
				}
				_tmp70_ = wrapper;
				_tmp71_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_argument_tokens (_tmp70_, &_tmp72_);
				_tmp71__length1 = _tmp72_;
				_tmp73_ = _tmp71_;
				_tmp73__length1 = _tmp71__length1;
				{
					gchar** token_collection = NULL;
					gint token_collection_length1 = 0;
					gint _token_collection_size_ = 0;
					gint token_it = 0;
					token_collection = _tmp73_;
					token_collection_length1 = _tmp73__length1;
					for (token_it = 0; token_it < token_collection_length1; token_it = token_it + 1) {
						gchar* _tmp74_;
						gchar* token = NULL;
						_tmp74_ = g_strdup (token_collection[token_it]);
						token = _tmp74_;
						{
							GeeArrayList* _tmp75_;
							const gchar* _tmp76_;
							_tmp75_ = errors;
							_tmp76_ = token;
							proton_plus_widgets_games_launch_options_editor_launch_command_builder_validate_token (self, _tmp75_, _tmp76_, "wrapper argument");
							_g_free0 (token);
						}
					}
				}
				_tmp77_ = wrapper;
				_tmp78_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_delimiter (_tmp77_);
				_tmp79_ = _tmp78_;
				if (_tmp79_ != NULL) {
					GeeArrayList* _tmp80_;
					ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchWrapperInvocation* _tmp81_;
					const gchar* _tmp82_;
					const gchar* _tmp83_;
					_tmp80_ = errors;
					_tmp81_ = wrapper;
					_tmp82_ = proton_plus_widgets_games_launch_options_editor_launch_wrapper_invocation_get_delimiter (_tmp81_);
					_tmp83_ = _tmp82_;
					proton_plus_widgets_games_launch_options_editor_launch_command_builder_validate_token (self, _tmp80_, _tmp83_, "wrapper delimiter");
				}
				_g_object_unref0 (wrapper);
			}
		}
	}
	_tmp84_ = proton_plus_widgets_games_launch_options_editor_launch_command_plan_get_game_arguments (plan, &_tmp85_);
	_tmp84__length1 = _tmp85_;
	_tmp86_ = _tmp84_;
	_tmp86__length1 = _tmp84__length1;
	{
		gchar** argument_collection = NULL;
		gint argument_collection_length1 = 0;
		gint _argument_collection_size_ = 0;
		gint argument_it = 0;
		argument_collection = _tmp86_;
		argument_collection_length1 = _tmp86__length1;
		for (argument_it = 0; argument_it < argument_collection_length1; argument_it = argument_it + 1) {
			gchar* _tmp87_;
			gchar* argument = NULL;
			_tmp87_ = g_strdup (argument_collection[argument_it]);
			argument = _tmp87_;
			{
				GeeArrayList* _tmp88_;
				const gchar* _tmp89_;
				_tmp88_ = errors;
				_tmp89_ = argument;
				proton_plus_widgets_games_launch_options_editor_launch_command_builder_validate_token (self, _tmp88_, _tmp89_, "game argument");
				_g_free0 (argument);
			}
		}
	}
	result = errors;
	_g_object_unref0 (priorities);
	_g_object_unref0 (environment_keys);
	return result;
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_builder_validate_token (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                                                                                       GeeArrayList* errors,
                                                                                       const gchar* token,
                                                                                       const gchar* description)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (errors != NULL);
	g_return_if_fail (token != NULL);
	g_return_if_fail (description != NULL);
	_tmp0_ = string_strip (token);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strcmp0 (_tmp1_, "") == 0;
	_g_free0 (_tmp1_);
	if (_tmp2_) {
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp3_ = g_strdup_printf ("%s must not be empty.", description);
		_tmp4_ = _tmp3_;
		gee_abstract_collection_add ((GeeAbstractCollection*) errors, _tmp4_);
		_g_free0 (_tmp4_);
	}
	if (string_contains (token, PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILDER_COMMAND_PLACEHOLDER)) {
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp5_ = g_strdup_printf ("%s must not contain %s.", description, PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_BUILDER_COMMAND_PLACEHOLDER);
		_tmp6_ = _tmp5_;
		gee_abstract_collection_add ((GeeAbstractCollection*) errors, _tmp6_);
		_g_free0 (_tmp6_);
	}
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_builder_append_tokens (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder* self,
                                                                                      GeeArrayList* segments,
                                                                                      gchar** tokens,
                                                                                      gint tokens_length1)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (segments != NULL);
	{
		gchar** token_collection = NULL;
		gint token_collection_length1 = 0;
		gint _token_collection_size_ = 0;
		gint token_it = 0;
		token_collection = tokens;
		token_collection_length1 = tokens_length1;
		for (token_it = 0; token_it < token_collection_length1; token_it = token_it + 1) {
			gchar* _tmp0_;
			gchar* token = NULL;
			_tmp0_ = g_strdup (token_collection[token_it]);
			token = _tmp0_;
			{
				const gchar* _tmp1_;
				_tmp1_ = token;
				gee_abstract_collection_add ((GeeAbstractCollection*) segments, _tmp1_);
				_g_free0 (token);
			}
		}
	}
}

ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder*
proton_plus_widgets_games_launch_options_editor_launch_command_builder_construct (GType object_type)
{
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder * self = NULL;
	self = (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder*) g_object_new (object_type, NULL);
	return self;
}

ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder*
proton_plus_widgets_games_launch_options_editor_launch_command_builder_new (void)
{
	return proton_plus_widgets_games_launch_options_editor_launch_command_builder_construct (PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_TYPE_LAUNCH_COMMAND_BUILDER);
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_builder_class_init (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilderClass * klass,
                                                                                   gpointer klass_data)
{
	proton_plus_widgets_games_launch_options_editor_launch_command_builder_parent_class = g_type_class_peek_parent (klass);
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_builder_instance_init (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder * self,
                                                                                      gpointer klass)
{
}

static GType
proton_plus_widgets_games_launch_options_editor_launch_command_builder_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_games_launch_options_editor_launch_command_builder_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder), 0, (GInstanceInitFunc) proton_plus_widgets_games_launch_options_editor_launch_command_builder_instance_init, NULL };
	GType proton_plus_widgets_games_launch_options_editor_launch_command_builder_type_id;
	proton_plus_widgets_games_launch_options_editor_launch_command_builder_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandBuilder", &g_define_type_info, 0);
	return proton_plus_widgets_games_launch_options_editor_launch_command_builder_type_id;
}

GType
proton_plus_widgets_games_launch_options_editor_launch_command_builder_get_type (void)
{
	static volatile gsize proton_plus_widgets_games_launch_options_editor_launch_command_builder_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_games_launch_options_editor_launch_command_builder_type_id__once)) {
		GType proton_plus_widgets_games_launch_options_editor_launch_command_builder_type_id;
		proton_plus_widgets_games_launch_options_editor_launch_command_builder_type_id = proton_plus_widgets_games_launch_options_editor_launch_command_builder_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_games_launch_options_editor_launch_command_builder_type_id__once, proton_plus_widgets_games_launch_options_editor_launch_command_builder_type_id);
	}
	return proton_plus_widgets_games_launch_options_editor_launch_command_builder_type_id__once;
}

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

