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

#include "protonplus_core.h"
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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

enum  {
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_0_PROPERTY,
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_EXPLICIT_CLEAR_PROPERTY,
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_IS_DIRTY_PROPERTY,
	PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_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))

struct _ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditStatePrivate {
	GeeHashMap* baseline_selections;
	GeeArrayList* modified_option_ids;
	gboolean _explicit_clear;
};

static gint ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState_private_offset;
static gpointer proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_parent_class = NULL;

static void proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_set_explicit_clear (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState* self,
                                                                                                   gboolean value);
static gchar* proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_selection_fingerprint (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandSelection* selection);
static void proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_finalize (GObject * obj);
static GType proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_type_once (void);
static void _vala_proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_property (GObject * object,
                                                                                                   guint property_id,
                                                                                                   GValue * value,
                                                                                                   GParamSpec * pspec);
static void _vala_proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_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 inline gpointer
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_instance_private (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState_private_offset);
}

ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState*
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_construct (GType object_type)
{
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState * self = NULL;
	GeeHashMap* _tmp0_;
	GeeArrayList* _tmp1_;
	self = (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState*) g_object_new (object_type, NULL);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->baseline_selections);
	self->priv->baseline_selections = _tmp0_;
	_tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->modified_option_ids);
	self->priv->modified_option_ids = _tmp1_;
	return self;
}

ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState*
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_new (void)
{
	return proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_construct (PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_TYPE_LAUNCH_COMMAND_EDIT_STATE);
}

void
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_record_baseline (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState* self,
                                                                                           GeeCollection* sources)
{
	GeeHashMap* _tmp0_;
	GeeArrayList* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sources != NULL);
	_tmp0_ = self->priv->baseline_selections;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp0_);
	_tmp1_ = self->priv->modified_option_ids;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp1_);
	proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_set_explicit_clear (self, FALSE);
	{
		GeeIterator* _source_it = NULL;
		GeeIterator* _tmp2_;
		_tmp2_ = gee_iterable_iterator ((GeeIterable*) sources);
		_source_it = _tmp2_;
		while (TRUE) {
			GeeIterator* _tmp3_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorILaunchCommandSelectionSource* source = NULL;
			GeeIterator* _tmp4_;
			gpointer _tmp5_;
			GeeHashMap* _tmp6_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorILaunchCommandSelectionSource* _tmp7_;
			const gchar* _tmp8_;
			const gchar* _tmp9_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorILaunchCommandSelectionSource* _tmp10_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandSelection* _tmp11_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandSelection* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			_tmp3_ = _source_it;
			if (!gee_iterator_next (_tmp3_)) {
				break;
			}
			_tmp4_ = _source_it;
			_tmp5_ = gee_iterator_get (_tmp4_);
			source = (ProtonPlusWidgetsGamesLaunchOptionsEditorILaunchCommandSelectionSource*) _tmp5_;
			_tmp6_ = self->priv->baseline_selections;
			_tmp7_ = source;
			_tmp8_ = proton_plus_widgets_games_launch_options_editor_ilaunch_command_selection_source_get_option_id (_tmp7_);
			_tmp9_ = _tmp8_;
			_tmp10_ = source;
			_tmp11_ = proton_plus_widgets_games_launch_options_editor_ilaunch_command_selection_source_get_selection (_tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_selection_fingerprint (_tmp12_);
			_tmp14_ = _tmp13_;
			gee_abstract_map_set ((GeeAbstractMap*) _tmp6_, _tmp9_, _tmp14_);
			_g_free0 (_tmp14_);
			_g_object_unref0 (_tmp12_);
			_g_object_unref0 (source);
		}
		_g_object_unref0 (_source_it);
	}
}

void
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_update (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState* self,
                                                                                  GeeCollection* sources)
{
	GeeArrayList* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sources != NULL);
	_tmp0_ = self->priv->modified_option_ids;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp0_);
	{
		GeeIterator* _source_it = NULL;
		GeeIterator* _tmp1_;
		_tmp1_ = gee_iterable_iterator ((GeeIterable*) sources);
		_source_it = _tmp1_;
		while (TRUE) {
			GeeIterator* _tmp2_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorILaunchCommandSelectionSource* source = NULL;
			GeeIterator* _tmp3_;
			gpointer _tmp4_;
			gchar* _tmp5_ = NULL;
			GeeHashMap* _tmp6_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorILaunchCommandSelectionSource* _tmp7_;
			const gchar* _tmp8_;
			const gchar* _tmp9_;
			gchar* original = NULL;
			gchar* _tmp16_;
			gboolean _tmp17_ = FALSE;
			ProtonPlusWidgetsGamesLaunchOptionsEditorILaunchCommandSelectionSource* _tmp18_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandSelection* _tmp19_;
			ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandSelection* _tmp20_;
			gchar* _tmp21_;
			gchar* _tmp22_;
			const gchar* _tmp23_;
			gboolean _tmp24_;
			_tmp2_ = _source_it;
			if (!gee_iterator_next (_tmp2_)) {
				break;
			}
			_tmp3_ = _source_it;
			_tmp4_ = gee_iterator_get (_tmp3_);
			source = (ProtonPlusWidgetsGamesLaunchOptionsEditorILaunchCommandSelectionSource*) _tmp4_;
			_tmp6_ = self->priv->baseline_selections;
			_tmp7_ = source;
			_tmp8_ = proton_plus_widgets_games_launch_options_editor_ilaunch_command_selection_source_get_option_id (_tmp7_);
			_tmp9_ = _tmp8_;
			if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp6_, _tmp9_)) {
				GeeHashMap* _tmp10_;
				ProtonPlusWidgetsGamesLaunchOptionsEditorILaunchCommandSelectionSource* _tmp11_;
				const gchar* _tmp12_;
				const gchar* _tmp13_;
				gpointer _tmp14_;
				_tmp10_ = self->priv->baseline_selections;
				_tmp11_ = source;
				_tmp12_ = proton_plus_widgets_games_launch_options_editor_ilaunch_command_selection_source_get_option_id (_tmp11_);
				_tmp13_ = _tmp12_;
				_tmp14_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp10_, _tmp13_);
				_g_free0 (_tmp5_);
				_tmp5_ = (gchar*) _tmp14_;
			} else {
				gchar* _tmp15_;
				_tmp15_ = g_strdup ("");
				_g_free0 (_tmp5_);
				_tmp5_ = _tmp15_;
			}
			_tmp16_ = _tmp5_;
			_tmp5_ = NULL;
			original = _tmp16_;
			_tmp18_ = source;
			_tmp19_ = proton_plus_widgets_games_launch_options_editor_ilaunch_command_selection_source_get_selection (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_selection_fingerprint (_tmp20_);
			_tmp22_ = _tmp21_;
			_tmp23_ = original;
			_tmp24_ = g_strcmp0 (_tmp22_, _tmp23_) != 0;
			_g_free0 (_tmp22_);
			_g_object_unref0 (_tmp20_);
			if (_tmp24_) {
				GeeArrayList* _tmp25_;
				ProtonPlusWidgetsGamesLaunchOptionsEditorILaunchCommandSelectionSource* _tmp26_;
				const gchar* _tmp27_;
				const gchar* _tmp28_;
				_tmp25_ = self->priv->modified_option_ids;
				_tmp26_ = source;
				_tmp27_ = proton_plus_widgets_games_launch_options_editor_ilaunch_command_selection_source_get_option_id (_tmp26_);
				_tmp28_ = _tmp27_;
				_tmp17_ = !gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp25_, _tmp28_);
			} else {
				_tmp17_ = FALSE;
			}
			if (_tmp17_) {
				GeeArrayList* _tmp29_;
				ProtonPlusWidgetsGamesLaunchOptionsEditorILaunchCommandSelectionSource* _tmp30_;
				const gchar* _tmp31_;
				const gchar* _tmp32_;
				_tmp29_ = self->priv->modified_option_ids;
				_tmp30_ = source;
				_tmp31_ = proton_plus_widgets_games_launch_options_editor_ilaunch_command_selection_source_get_option_id (_tmp30_);
				_tmp32_ = _tmp31_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp29_, _tmp32_);
			}
			_g_free0 (original);
			_g_free0 (_tmp5_);
			_g_object_unref0 (source);
		}
		_g_object_unref0 (_source_it);
	}
}

void
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_mark_explicit_clear (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState* self,
                                                                                               GeeCollection* sources)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (sources != NULL);
	proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_update (self, sources);
	proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_set_explicit_clear (self, TRUE);
}

gchar**
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_modified_option_ids (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState* self,
                                                                                                   gint* result_length1)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_ = 0;
	gpointer* _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->modified_option_ids;
	_tmp2_ = gee_collection_to_array ((GeeCollection*) _tmp0_, &_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _tmp1_;
	if (result_length1) {
		*result_length1 = _tmp3__length1;
	}
	result = _tmp3_;
	return result;
}

gboolean
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_is_option_modified (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState* self,
                                                                                              const gchar* option_id)
{
	GeeArrayList* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (option_id != NULL, FALSE);
	_tmp0_ = self->priv->modified_option_ids;
	result = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp0_, option_id);
	return result;
}

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

static gchar*
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_selection_fingerprint (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandSelection* selection)
{
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gint _tmp5_ = 0;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gint _tmp10_ = 0;
	gchar** _tmp11_;
	gchar** _tmp12_;
	gint _tmp12__length1;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* result;
	if (selection == NULL) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("");
		result = _tmp0_;
		return result;
	}
	_tmp1_ = proton_plus_widgets_games_launch_options_editor_launch_command_selection_get_option_id (selection);
	_tmp2_ = _tmp1_;
	_tmp3_ = proton_plus_widgets_games_launch_options_editor_launch_command_selection_get_wrapper_id (selection);
	_tmp4_ = _tmp3_;
	_tmp6_ = proton_plus_widgets_games_launch_options_editor_launch_command_selection_get_values (selection, &_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp7__length1 = _tmp5_;
	_tmp8_ = _vala_g_strjoinv ("\x1f", _tmp7_, (gint) _tmp5_);
	_tmp9_ = _tmp8_;
	_tmp11_ = proton_plus_widgets_games_launch_options_editor_launch_command_selection_get_additional_wrapper_arguments (selection, &_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp12__length1 = _tmp10_;
	_tmp13_ = _vala_g_strjoinv ("\x1f", _tmp12_, (gint) _tmp10_);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_strdup_printf ("%s\x1f%s\x1f%s\x1f%s", _tmp2_, _tmp4_, _tmp9_, _tmp14_);
	_tmp16_ = _tmp15_;
	_g_free0 (_tmp14_);
	_tmp12_ = (_vala_array_free (_tmp12_, _tmp12__length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_tmp9_);
	_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL);
	result = _tmp16_;
	return result;
}

gboolean
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_explicit_clear (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_explicit_clear;
	return result;
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_set_explicit_clear (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState* self,
                                                                                              gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_explicit_clear (self);
	if (old_value != value) {
		self->priv->_explicit_clear = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_EXPLICIT_CLEAR_PROPERTY]);
	}
}

gboolean
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_is_dirty (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState* self)
{
	gboolean result;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = self->priv->_explicit_clear;
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		_tmp2_ = self->priv->modified_option_ids;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ > 0;
	}
	result = _tmp0_;
	return result;
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_class_init (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditStateClass * klass,
                                                                                      gpointer klass_data)
{
	proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_EXPLICIT_CLEAR_PROPERTY, proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_EXPLICIT_CLEAR_PROPERTY] = g_param_spec_boolean ("explicit-clear", "explicit-clear", "explicit-clear", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_IS_DIRTY_PROPERTY, proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_properties[PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_IS_DIRTY_PROPERTY] = g_param_spec_boolean ("is-dirty", "is-dirty", "is-dirty", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_instance_init (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState * self,
                                                                                         gpointer klass)
{
	self->priv = proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_instance_private (self);
	self->priv->_explicit_clear = FALSE;
}

static void
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_finalize (GObject * obj)
{
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_TYPE_LAUNCH_COMMAND_EDIT_STATE, ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState);
	_g_object_unref0 (self->priv->baseline_selections);
	_g_object_unref0 (self->priv->modified_option_ids);
	G_OBJECT_CLASS (proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_parent_class)->finalize (obj);
}

static GType
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditStateClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState), 0, (GInstanceInitFunc) proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_instance_init, NULL };
	GType proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_type_id;
	proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState", &g_define_type_info, 0);
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState_private_offset = g_type_add_instance_private (proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_type_id, sizeof (ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditStatePrivate));
	return proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_type_id;
}

GType
proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_type (void)
{
	static volatile gsize proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_type_id__once)) {
		GType proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_type_id;
		proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_type_id = proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_type_id__once, proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_type_id);
	}
	return proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_type_id__once;
}

static void
_vala_proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_property (GObject * object,
                                                                                              guint property_id,
                                                                                              GValue * value,
                                                                                              GParamSpec * pspec)
{
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_TYPE_LAUNCH_COMMAND_EDIT_STATE, ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState);
	switch (property_id) {
		case PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_EXPLICIT_CLEAR_PROPERTY:
		g_value_set_boolean (value, proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_explicit_clear (self));
		break;
		case PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_IS_DIRTY_PROPERTY:
		g_value_set_boolean (value, proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_get_is_dirty (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_edit_state_set_property (GObject * object,
                                                                                              guint property_id,
                                                                                              const GValue * value,
                                                                                              GParamSpec * pspec)
{
	ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_TYPE_LAUNCH_COMMAND_EDIT_STATE, ProtonPlusWidgetsGamesLaunchOptionsEditorLaunchCommandEditState);
	switch (property_id) {
		case PROTON_PLUS_WIDGETS_GAMES_LAUNCH_OPTIONS_EDITOR_LAUNCH_COMMAND_EDIT_STATE_EXPLICIT_CLEAR_PROPERTY:
		proton_plus_widgets_games_launch_options_editor_launch_command_edit_state_set_explicit_clear (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;
}

