/* display-config.c generated by valac 0.17.7, the Vala compiler
 * generated from display-config.vala, do not modify */

/* This file is part of GNOME Boxes. License: LGPLv2+*/

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>


#define BOXES_TYPE_ICONFIG (boxes_iconfig_get_type ())
#define BOXES_ICONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_ICONFIG, BoxesIConfig))
#define BOXES_IS_ICONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_ICONFIG))
#define BOXES_ICONFIG_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BOXES_TYPE_ICONFIG, BoxesIConfigIface))

typedef struct _BoxesIConfig BoxesIConfig;
typedef struct _BoxesIConfigIface BoxesIConfigIface;

#define BOXES_TYPE_DISPLAY_CONFIG (boxes_display_config_get_type ())
#define BOXES_DISPLAY_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DISPLAY_CONFIG, BoxesDisplayConfig))
#define BOXES_DISPLAY_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DISPLAY_CONFIG, BoxesDisplayConfigClass))
#define BOXES_IS_DISPLAY_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DISPLAY_CONFIG))
#define BOXES_IS_DISPLAY_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DISPLAY_CONFIG))
#define BOXES_DISPLAY_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DISPLAY_CONFIG, BoxesDisplayConfigClass))

typedef struct _BoxesDisplayConfig BoxesDisplayConfig;
typedef struct _BoxesDisplayConfigClass BoxesDisplayConfigClass;
typedef struct _BoxesDisplayConfigPrivate BoxesDisplayConfigPrivate;

#define BOXES_TYPE_COLLECTION_SOURCE (boxes_collection_source_get_type ())
#define BOXES_COLLECTION_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_COLLECTION_SOURCE, BoxesCollectionSource))
#define BOXES_COLLECTION_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_COLLECTION_SOURCE, BoxesCollectionSourceClass))
#define BOXES_IS_COLLECTION_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_COLLECTION_SOURCE))
#define BOXES_IS_COLLECTION_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_COLLECTION_SOURCE))
#define BOXES_COLLECTION_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_COLLECTION_SOURCE, BoxesCollectionSourceClass))

typedef struct _BoxesCollectionSource BoxesCollectionSource;
typedef struct _BoxesCollectionSourceClass BoxesCollectionSourceClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_param_spec_unref0(var) ((var == NULL) ? NULL : (var = (g_param_spec_unref (var), NULL)))

struct _BoxesIConfigIface {
	GTypeInterface parent_iface;
	GKeyFile* (*get_keyfile) (BoxesIConfig* self);
	const gchar* (*get_filename) (BoxesIConfig* self);
	void (*set_filename) (BoxesIConfig* self, const gchar* value);
	gboolean (*get_has_file) (BoxesIConfig* self);
	void (*set_has_file) (BoxesIConfig* self, gboolean value);
};

struct _BoxesDisplayConfig {
	GObject parent_instance;
	BoxesDisplayConfigPrivate * priv;
};

struct _BoxesDisplayConfigClass {
	GObjectClass parent_class;
};

struct _BoxesDisplayConfigPrivate {
	BoxesCollectionSource* source;
	gchar* group;
};


static gpointer boxes_display_config_parent_class = NULL;
static BoxesIConfigIface* boxes_display_config_boxes_iconfig_parent_iface = NULL;

GType boxes_iconfig_get_type (void) G_GNUC_CONST;
GType boxes_display_config_get_type (void) G_GNUC_CONST;
GType boxes_collection_source_get_type (void) G_GNUC_CONST;
#define BOXES_DISPLAY_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BOXES_TYPE_DISPLAY_CONFIG, BoxesDisplayConfigPrivate))
enum  {
	BOXES_DISPLAY_CONFIG_DUMMY_PROPERTY,
	BOXES_DISPLAY_CONFIG_LAST_SEEN_NAME,
	BOXES_DISPLAY_CONFIG_UUID,
	BOXES_DISPLAY_CONFIG_CATEGORIES
};
BoxesDisplayConfig* boxes_display_config_new_with_group (BoxesCollectionSource* source, const gchar* group);
BoxesDisplayConfig* boxes_display_config_construct_with_group (GType object_type, BoxesCollectionSource* source, const gchar* group);
void boxes_display_config_delete (BoxesDisplayConfig* self);
GKeyFile* boxes_iconfig_get_keyfile (BoxesIConfig* self);
void boxes_iconfig_save (BoxesIConfig* self);
static void boxes_display_config_remove_category (BoxesDisplayConfig* self, const gchar* category);
gchar** boxes_display_config_get_categories (BoxesDisplayConfig* self, int* result_length1);
static void _vala_array_add2 (gchar*** array, int* length, int* size, gchar* value);
void boxes_display_config_set_categories (BoxesDisplayConfig* self, gchar** value, int value_length1);
static void boxes_display_config_add_category (BoxesDisplayConfig* self, const gchar* category);
static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle);
static void _vala_array_add3 (gchar*** array, int* length, int* size, gchar* value);
void boxes_display_config_set_category (BoxesDisplayConfig* self, const gchar* category, gboolean enabled);
void boxes_display_config_save_display_property (BoxesDisplayConfig* self, GObject* display, const gchar* property_name);
void boxes_display_config_load_display_property (BoxesDisplayConfig* self, GObject* display, const gchar* property_name, GValue* default_value);
BoxesDisplayConfig* boxes_display_config_new (void);
BoxesDisplayConfig* boxes_display_config_construct (GType object_type);
gboolean boxes_iconfig_get_has_file (BoxesIConfig* self);
void boxes_iconfig_set_has_file (BoxesIConfig* self, gboolean value);
const gchar* boxes_iconfig_get_filename (BoxesIConfig* self);
gchar* boxes_display_config_get_last_seen_name (BoxesDisplayConfig* self);
gchar* boxes_iconfig_get_string (BoxesIConfig* self, const gchar* group, const gchar* key);
void boxes_display_config_set_last_seen_name (BoxesDisplayConfig* self, const gchar* value);
gchar* boxes_display_config_get_uuid (BoxesDisplayConfig* self);
void boxes_display_config_set_uuid (BoxesDisplayConfig* self, const gchar* value);
gchar** boxes_iconfig_get_string_list (BoxesIConfig* self, const gchar* group, const gchar* key, int* result_length1);
static void boxes_display_config_finalize (GObject* obj);
static void _vala_boxes_display_config_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_boxes_display_config_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


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


BoxesDisplayConfig* boxes_display_config_construct_with_group (GType object_type, BoxesCollectionSource* source, const gchar* group) {
	BoxesDisplayConfig * self = NULL;
	BoxesCollectionSource* _tmp0_;
	BoxesCollectionSource* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	g_return_val_if_fail (source != NULL, NULL);
	g_return_val_if_fail (group != NULL, NULL);
	self = (BoxesDisplayConfig*) g_object_new (object_type, NULL);
	_tmp0_ = source;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->source);
	self->priv->source = _tmp1_;
	_tmp2_ = group;
	_tmp3_ = g_str_has_prefix (_tmp2_, "display");
	g_warn_if_fail (_tmp3_);
	_tmp4_ = group;
	_tmp5_ = g_strdup (_tmp4_);
	_g_free0 (self->priv->group);
	self->priv->group = _tmp5_;
	return self;
}


BoxesDisplayConfig* boxes_display_config_new_with_group (BoxesCollectionSource* source, const gchar* group) {
	return boxes_display_config_construct_with_group (BOXES_TYPE_DISPLAY_CONFIG, source, group);
}


void boxes_display_config_delete (BoxesDisplayConfig* self) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	{
		GKeyFile* _tmp0_;
		GKeyFile* _tmp1_;
		const gchar* _tmp2_;
		_tmp0_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = self->priv->group;
		g_key_file_remove_group (_tmp1_, _tmp2_, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch3_g_error;
		}
	}
	goto __finally3;
	__catch3_g_error:
	{
		GError* _error_ = NULL;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		_g_error_free0 (_error_);
	}
	__finally3:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	boxes_iconfig_save ((BoxesIConfig*) self);
}


static void _vala_array_add2 (gchar*** array, int* length, int* 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 void boxes_display_config_remove_category (BoxesDisplayConfig* self, const gchar* category) {
	gchar** _tmp0_ = NULL;
	gchar** categories;
	gint categories_length1;
	gint _categories_size_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar** _tmp9_;
	gint _tmp9__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (category != NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	categories = _tmp0_;
	categories_length1 = 0;
	_categories_size_ = categories_length1;
	_tmp1_ = boxes_display_config_get_categories (self, &_tmp1__length1);
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	{
		gchar** it_collection = NULL;
		gint it_collection_length1 = 0;
		gint _it_collection_size_ = 0;
		gint it_it = 0;
		it_collection = _tmp2_;
		it_collection_length1 = _tmp2__length1;
		for (it_it = 0; it_it < _tmp2__length1; it_it = it_it + 1) {
			gchar* _tmp3_;
			gchar* it = NULL;
			_tmp3_ = g_strdup (it_collection[it_it]);
			it = _tmp3_;
			{
				const gchar* _tmp4_;
				const gchar* _tmp5_;
				_tmp4_ = it;
				_tmp5_ = category;
				if (g_strcmp0 (_tmp4_, _tmp5_) != 0) {
					gchar** _tmp6_;
					gint _tmp6__length1;
					const gchar* _tmp7_;
					gchar* _tmp8_;
					_tmp6_ = categories;
					_tmp6__length1 = categories_length1;
					_tmp7_ = it;
					_tmp8_ = g_strdup (_tmp7_);
					_vala_array_add2 (&categories, &categories_length1, &_categories_size_, _tmp8_);
				}
				_g_free0 (it);
			}
		}
		it_collection = (_vala_array_free (it_collection, it_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp9_ = categories;
	_tmp9__length1 = categories_length1;
	boxes_display_config_set_categories (self, _tmp9_, _tmp9__length1);
	categories = (_vala_array_free (categories, categories_length1, (GDestroyNotify) g_free), NULL);
}


static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle) {
	int i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}


static void _vala_array_add3 (gchar*** array, int* length, int* 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 void boxes_display_config_add_category (BoxesDisplayConfig* self, const gchar* category) {
	const gchar* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gboolean _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gchar** _tmp6_;
	gint _tmp6__length1;
	gchar** categories;
	gint categories_length1;
	gint _categories_size_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar** _tmp10_;
	gint _tmp10__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (category != NULL);
	_tmp0_ = category;
	_tmp1_ = boxes_display_config_get_categories (self, &_tmp1__length1);
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _tmp2__length1;
	_tmp4_ = _vala_string_array_contains (_tmp3_, _tmp2__length1, _tmp0_);
	_tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
	if (_tmp4_) {
		return;
	}
	_tmp5_ = boxes_display_config_get_categories (self, &_tmp5__length1);
	_tmp6_ = _tmp5_;
	_tmp6__length1 = _tmp5__length1;
	categories = _tmp6_;
	categories_length1 = _tmp6__length1;
	_categories_size_ = categories_length1;
	_tmp7_ = categories;
	_tmp7__length1 = categories_length1;
	_tmp8_ = category;
	_tmp9_ = g_strdup (_tmp8_);
	_vala_array_add3 (&categories, &categories_length1, &_categories_size_, _tmp9_);
	_tmp10_ = categories;
	_tmp10__length1 = categories_length1;
	boxes_display_config_set_categories (self, _tmp10_, _tmp10__length1);
	categories = (_vala_array_free (categories, categories_length1, (GDestroyNotify) g_free), NULL);
}


void boxes_display_config_set_category (BoxesDisplayConfig* self, const gchar* category, gboolean enabled) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (category != NULL);
	_tmp0_ = enabled;
	if (_tmp0_) {
		const gchar* _tmp1_;
		_tmp1_ = category;
		boxes_display_config_add_category (self, _tmp1_);
	} else {
		const gchar* _tmp2_;
		_tmp2_ = category;
		boxes_display_config_remove_category (self, _tmp2_);
	}
	boxes_iconfig_save ((BoxesIConfig*) self);
}


void boxes_display_config_save_display_property (BoxesDisplayConfig* self, GObject* display, const gchar* property_name) {
	GObject* _tmp0_;
	GObjectClass* _tmp1_ = NULL;
	const gchar* _tmp2_;
	GParamSpec* _tmp3_ = NULL;
	GType _tmp4_;
	GValue _tmp5_ = {0};
	GValue value;
	GObject* _tmp6_;
	const gchar* _tmp7_;
	GType _tmp8_ = 0UL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (display != NULL);
	g_return_if_fail (property_name != NULL);
	_tmp0_ = display;
	_tmp1_ = G_OBJECT_GET_CLASS (_tmp0_);
	_tmp2_ = property_name;
	_tmp3_ = g_object_class_find_property (_tmp1_, _tmp2_);
	_tmp4_ = _tmp3_->value_type;
	g_value_init (&_tmp5_, _tmp4_);
	value = _tmp5_;
	_tmp6_ = display;
	_tmp7_ = property_name;
	g_object_get_property (_tmp6_, _tmp7_, &value);
	_tmp8_ = G_VALUE_TYPE (&value);
	if (_tmp8_ == G_TYPE_STRING) {
		GKeyFile* _tmp9_;
		GKeyFile* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_ = NULL;
		_tmp9_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
		_tmp10_ = _tmp9_;
		_tmp11_ = self->priv->group;
		_tmp12_ = property_name;
		_tmp13_ = g_value_get_string (&value);
		g_key_file_set_string (_tmp10_, _tmp11_, _tmp12_, _tmp13_);
	} else {
		GType _tmp14_ = 0UL;
		_tmp14_ = G_VALUE_TYPE (&value);
		if (_tmp14_ == G_TYPE_UINT64) {
			GKeyFile* _tmp15_;
			GKeyFile* _tmp16_;
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			guint64 _tmp19_ = 0ULL;
			_tmp15_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
			_tmp16_ = _tmp15_;
			_tmp17_ = self->priv->group;
			_tmp18_ = property_name;
			_tmp19_ = g_value_get_uint64 (&value);
			g_key_file_set_uint64 (_tmp16_, _tmp17_, _tmp18_, _tmp19_);
		} else {
			GType _tmp20_ = 0UL;
			_tmp20_ = G_VALUE_TYPE (&value);
			if (_tmp20_ == G_TYPE_INT64) {
				GKeyFile* _tmp21_;
				GKeyFile* _tmp22_;
				const gchar* _tmp23_;
				const gchar* _tmp24_;
				gint64 _tmp25_ = 0LL;
				_tmp21_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
				_tmp22_ = _tmp21_;
				_tmp23_ = self->priv->group;
				_tmp24_ = property_name;
				_tmp25_ = g_value_get_int64 (&value);
				g_key_file_set_int64 (_tmp22_, _tmp23_, _tmp24_, _tmp25_);
			} else {
				GType _tmp26_ = 0UL;
				_tmp26_ = G_VALUE_TYPE (&value);
				if (_tmp26_ == G_TYPE_BOOLEAN) {
					GKeyFile* _tmp27_;
					GKeyFile* _tmp28_;
					const gchar* _tmp29_;
					const gchar* _tmp30_;
					gboolean _tmp31_ = FALSE;
					_tmp27_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
					_tmp28_ = _tmp27_;
					_tmp29_ = self->priv->group;
					_tmp30_ = property_name;
					_tmp31_ = g_value_get_boolean (&value);
					g_key_file_set_boolean (_tmp28_, _tmp29_, _tmp30_, _tmp31_);
				} else {
					const gchar* _tmp32_;
					gchar* _tmp33_ = NULL;
					gchar* _tmp34_;
					gchar* _tmp35_ = NULL;
					gchar* _tmp36_;
					_tmp32_ = property_name;
					_tmp33_ = g_strdup_value_contents (&value);
					_tmp34_ = _tmp33_;
					_tmp35_ = g_strdup_printf ("unhandled property %s type, value: %s", _tmp32_, _tmp34_);
					_tmp36_ = _tmp35_;
					g_warning ("display-config.vala:94: %s", _tmp36_);
					_g_free0 (_tmp36_);
					_g_free0 (_tmp34_);
				}
			}
		}
	}
	boxes_iconfig_save ((BoxesIConfig*) self);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
}


static gpointer _g_param_spec_ref0 (gpointer self) {
	return self ? g_param_spec_ref (self) : NULL;
}


void boxes_display_config_load_display_property (BoxesDisplayConfig* self, GObject* display, const gchar* property_name, GValue* default_value) {
	GObject* _tmp0_;
	GObjectClass* _tmp1_ = NULL;
	const gchar* _tmp2_;
	GParamSpec* _tmp3_ = NULL;
	GParamSpec* _tmp4_;
	GParamSpec* property;
	GParamSpec* _tmp5_;
	GParamSpec* _tmp7_;
	GType _tmp8_;
	GValue _tmp9_ = {0};
	GValue value;
	GObject* _tmp44_;
	const gchar* _tmp45_;
	GValue _tmp46_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (display != NULL);
	g_return_if_fail (property_name != NULL);
	g_return_if_fail (default_value != NULL);
	_tmp0_ = display;
	_tmp1_ = G_OBJECT_GET_CLASS (_tmp0_);
	_tmp2_ = property_name;
	_tmp3_ = g_object_class_find_property (_tmp1_, _tmp2_);
	_tmp4_ = _g_param_spec_ref0 (_tmp3_);
	property = _tmp4_;
	_tmp5_ = property;
	if (_tmp5_ == NULL) {
		const gchar* _tmp6_;
		_tmp6_ = property_name;
		g_debug ("display-config.vala:103: You forgot the property '%s' needs to have pu" \
"blic getter!", _tmp6_);
	}
	_tmp7_ = property;
	_tmp8_ = _tmp7_->value_type;
	g_value_init (&_tmp9_, _tmp8_);
	value = _tmp9_;
	{
		GType _tmp10_ = 0UL;
		GType _tmp18_ = 0UL;
		GType _tmp26_ = 0UL;
		GType _tmp34_ = 0UL;
		_tmp10_ = G_VALUE_TYPE (&value);
		if (_tmp10_ == G_TYPE_STRING) {
			GKeyFile* _tmp11_;
			GKeyFile* _tmp12_;
			const gchar* _tmp13_;
			const gchar* _tmp14_;
			gchar* _tmp15_ = NULL;
			gchar* _tmp16_;
			GValue _tmp17_ = {0};
			_tmp11_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
			_tmp12_ = _tmp11_;
			_tmp13_ = self->priv->group;
			_tmp14_ = property_name;
			_tmp15_ = g_key_file_get_string (_tmp12_, _tmp13_, _tmp14_, &_inner_error_);
			_tmp16_ = _tmp15_;
			if (_inner_error_ != NULL) {
				goto __catch4_g_error;
			}
			g_value_init (&_tmp17_, G_TYPE_STRING);
			g_value_take_string (&_tmp17_, _tmp16_);
			G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
			value = _tmp17_;
		}
		_tmp18_ = G_VALUE_TYPE (&value);
		if (_tmp18_ == G_TYPE_UINT64) {
			GKeyFile* _tmp19_;
			GKeyFile* _tmp20_;
			const gchar* _tmp21_;
			const gchar* _tmp22_;
			guint64 _tmp23_ = 0ULL;
			guint64 _tmp24_;
			GValue _tmp25_ = {0};
			_tmp19_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
			_tmp20_ = _tmp19_;
			_tmp21_ = self->priv->group;
			_tmp22_ = property_name;
			_tmp23_ = g_key_file_get_uint64 (_tmp20_, _tmp21_, _tmp22_, &_inner_error_);
			_tmp24_ = _tmp23_;
			if (_inner_error_ != NULL) {
				goto __catch4_g_error;
			}
			g_value_init (&_tmp25_, G_TYPE_UINT64);
			g_value_set_uint64 (&_tmp25_, _tmp24_);
			G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
			value = _tmp25_;
		}
		_tmp26_ = G_VALUE_TYPE (&value);
		if (_tmp26_ == G_TYPE_INT64) {
			GKeyFile* _tmp27_;
			GKeyFile* _tmp28_;
			const gchar* _tmp29_;
			const gchar* _tmp30_;
			gint64 _tmp31_ = 0LL;
			gint64 _tmp32_;
			GValue _tmp33_ = {0};
			_tmp27_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
			_tmp28_ = _tmp27_;
			_tmp29_ = self->priv->group;
			_tmp30_ = property_name;
			_tmp31_ = g_key_file_get_int64 (_tmp28_, _tmp29_, _tmp30_, &_inner_error_);
			_tmp32_ = _tmp31_;
			if (_inner_error_ != NULL) {
				goto __catch4_g_error;
			}
			g_value_init (&_tmp33_, G_TYPE_INT64);
			g_value_set_int64 (&_tmp33_, _tmp32_);
			G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
			value = _tmp33_;
		}
		_tmp34_ = G_VALUE_TYPE (&value);
		if (_tmp34_ == G_TYPE_BOOLEAN) {
			GKeyFile* _tmp35_;
			GKeyFile* _tmp36_;
			const gchar* _tmp37_;
			const gchar* _tmp38_;
			gboolean _tmp39_ = FALSE;
			gboolean _tmp40_;
			GValue _tmp41_ = {0};
			_tmp35_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
			_tmp36_ = _tmp35_;
			_tmp37_ = self->priv->group;
			_tmp38_ = property_name;
			_tmp39_ = g_key_file_get_boolean (_tmp36_, _tmp37_, _tmp38_, &_inner_error_);
			_tmp40_ = _tmp39_;
			if (_inner_error_ != NULL) {
				goto __catch4_g_error;
			}
			g_value_init (&_tmp41_, G_TYPE_BOOLEAN);
			g_value_set_boolean (&_tmp41_, _tmp40_);
			G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
			value = _tmp41_;
		}
	}
	goto __finally4;
	__catch4_g_error:
	{
		GError* err = NULL;
		GValue _tmp42_;
		GValue _tmp43_ = {0};
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp42_ = *default_value;
		if (G_IS_VALUE (&_tmp42_)) {
			g_value_init (&_tmp43_, G_VALUE_TYPE (&_tmp42_));
			g_value_copy (&_tmp42_, &_tmp43_);
		} else {
			_tmp43_ = _tmp42_;
		}
		G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
		value = _tmp43_;
		_g_error_free0 (err);
	}
	__finally4:
	if (_inner_error_ != NULL) {
		G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
		_g_param_spec_unref0 (property);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp44_ = display;
	_tmp45_ = property_name;
	_tmp46_ = value;
	g_object_set_property (_tmp44_, _tmp45_, &_tmp46_);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	_g_param_spec_unref0 (property);
}


BoxesDisplayConfig* boxes_display_config_construct (GType object_type) {
	BoxesDisplayConfig * self = NULL;
	self = (BoxesDisplayConfig*) g_object_new (object_type, NULL);
	return self;
}


BoxesDisplayConfig* boxes_display_config_new (void) {
	return boxes_display_config_construct (BOXES_TYPE_DISPLAY_CONFIG);
}


static gboolean boxes_display_config_real_get_has_file (BoxesIConfig* base) {
	gboolean result;
	BoxesDisplayConfig* self;
	BoxesCollectionSource* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = (BoxesDisplayConfig*) base;
	_tmp0_ = self->priv->source;
	_tmp1_ = boxes_iconfig_get_has_file ((BoxesIConfig*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}


static void boxes_display_config_real_set_has_file (BoxesIConfig* base, gboolean value) {
	BoxesDisplayConfig* self;
	BoxesCollectionSource* _tmp0_;
	gboolean _tmp1_;
	self = (BoxesDisplayConfig*) base;
	_tmp0_ = self->priv->source;
	_tmp1_ = value;
	boxes_iconfig_set_has_file ((BoxesIConfig*) _tmp0_, _tmp1_);
}


static const gchar* boxes_display_config_real_get_filename (BoxesIConfig* base) {
	const gchar* result;
	BoxesDisplayConfig* self;
	BoxesCollectionSource* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	self = (BoxesDisplayConfig*) base;
	_tmp0_ = self->priv->source;
	_tmp1_ = boxes_iconfig_get_filename ((BoxesIConfig*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}


static void boxes_display_config_real_set_filename (BoxesIConfig* base, const gchar* value) {
	BoxesDisplayConfig* self;
	self = (BoxesDisplayConfig*) base;
	g_warning ("display-config.vala:12: not allowed to change filename");
}


static GKeyFile* boxes_display_config_real_get_keyfile (BoxesIConfig* base) {
	GKeyFile* result;
	BoxesDisplayConfig* self;
	BoxesCollectionSource* _tmp0_;
	GKeyFile* _tmp1_;
	GKeyFile* _tmp2_;
	self = (BoxesDisplayConfig*) base;
	_tmp0_ = self->priv->source;
	_tmp1_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}


gchar* boxes_display_config_get_last_seen_name (BoxesDisplayConfig* self) {
	gchar* result;
	const gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->group;
	_tmp1_ = boxes_iconfig_get_string ((BoxesIConfig*) self, _tmp0_, "last-seen-name");
	result = _tmp1_;
	return result;
}


void boxes_display_config_set_last_seen_name (BoxesDisplayConfig* self, const gchar* value) {
	GKeyFile* _tmp0_;
	GKeyFile* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->group;
	_tmp3_ = value;
	g_key_file_set_string (_tmp1_, _tmp2_, "last-seen-name", _tmp3_);
	g_object_notify ((GObject *) self, "last-seen-name");
}


gchar* boxes_display_config_get_uuid (BoxesDisplayConfig* self) {
	gchar* result;
	const gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->group;
	_tmp1_ = boxes_iconfig_get_string ((BoxesIConfig*) self, _tmp0_, "uuid");
	result = _tmp1_;
	return result;
}


void boxes_display_config_set_uuid (BoxesDisplayConfig* self, const gchar* value) {
	GKeyFile* _tmp0_;
	GKeyFile* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->group;
	_tmp3_ = value;
	g_key_file_set_string (_tmp1_, _tmp2_, "uuid", _tmp3_);
	g_object_notify ((GObject *) self, "uuid");
}


gchar** boxes_display_config_get_categories (BoxesDisplayConfig* self, int* result_length1) {
	gchar** result;
	const gchar* _tmp0_;
	gint _tmp1_ = 0;
	gchar** _tmp2_ = NULL;
	gchar** _tmp3_;
	gint _tmp3__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->group;
	_tmp2_ = boxes_iconfig_get_string_list ((BoxesIConfig*) self, _tmp0_, "categories", &_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _tmp1_;
	if (result_length1) {
		*result_length1 = _tmp3__length1;
	}
	result = _tmp3_;
	return result;
}


void boxes_display_config_set_categories (BoxesDisplayConfig* self, gchar** value, int value_length1) {
	GKeyFile* _tmp0_;
	GKeyFile* _tmp1_;
	const gchar* _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = boxes_iconfig_get_keyfile ((BoxesIConfig*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->group;
	_tmp3_ = value;
	_tmp3__length1 = value_length1;
	g_key_file_set_string_list (_tmp1_, _tmp2_, "categories", (const gchar* const*) _tmp3_, _tmp3__length1);
	g_object_notify ((GObject *) self, "categories");
}


static void boxes_display_config_class_init (BoxesDisplayConfigClass * klass) {
	boxes_display_config_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (BoxesDisplayConfigPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_display_config_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_display_config_set_property;
	G_OBJECT_CLASS (klass)->finalize = boxes_display_config_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_DISPLAY_CONFIG_LAST_SEEN_NAME, g_param_spec_string ("last-seen-name", "last-seen-name", "last-seen-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_DISPLAY_CONFIG_UUID, g_param_spec_string ("uuid", "uuid", "uuid", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_DISPLAY_CONFIG_CATEGORIES, g_param_spec_boxed ("categories", "categories", "categories", G_TYPE_STRV, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void boxes_display_config_boxes_iconfig_interface_init (BoxesIConfigIface * iface) {
	boxes_display_config_boxes_iconfig_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_has_file = boxes_display_config_real_get_has_file;
	iface->set_has_file = boxes_display_config_real_set_has_file;
	iface->get_filename = boxes_display_config_real_get_filename;
	iface->set_filename = boxes_display_config_real_set_filename;
	iface->get_keyfile = boxes_display_config_real_get_keyfile;
}


static void boxes_display_config_instance_init (BoxesDisplayConfig * self) {
	self->priv = BOXES_DISPLAY_CONFIG_GET_PRIVATE (self);
}


static void boxes_display_config_finalize (GObject* obj) {
	BoxesDisplayConfig * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_DISPLAY_CONFIG, BoxesDisplayConfig);
	_g_object_unref0 (self->priv->source);
	_g_free0 (self->priv->group);
	G_OBJECT_CLASS (boxes_display_config_parent_class)->finalize (obj);
}


GType boxes_display_config_get_type (void) {
	static volatile gsize boxes_display_config_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_display_config_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesDisplayConfigClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_display_config_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesDisplayConfig), 0, (GInstanceInitFunc) boxes_display_config_instance_init, NULL };
		static const GInterfaceInfo boxes_iconfig_info = { (GInterfaceInitFunc) boxes_display_config_boxes_iconfig_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType boxes_display_config_type_id;
		boxes_display_config_type_id = g_type_register_static (G_TYPE_OBJECT, "BoxesDisplayConfig", &g_define_type_info, 0);
		g_type_add_interface_static (boxes_display_config_type_id, BOXES_TYPE_ICONFIG, &boxes_iconfig_info);
		g_once_init_leave (&boxes_display_config_type_id__volatile, boxes_display_config_type_id);
	}
	return boxes_display_config_type_id__volatile;
}


static void _vala_boxes_display_config_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	BoxesDisplayConfig * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_DISPLAY_CONFIG, BoxesDisplayConfig);
	switch (property_id) {
		case BOXES_DISPLAY_CONFIG_LAST_SEEN_NAME:
		g_value_take_string (value, boxes_display_config_get_last_seen_name (self));
		break;
		case BOXES_DISPLAY_CONFIG_UUID:
		g_value_take_string (value, boxes_display_config_get_uuid (self));
		break;
		case BOXES_DISPLAY_CONFIG_CATEGORIES:
		{
			int length;
			g_value_take_boxed (value, boxes_display_config_get_categories (self, &length));
		}
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_boxes_display_config_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	BoxesDisplayConfig * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_DISPLAY_CONFIG, BoxesDisplayConfig);
	switch (property_id) {
		case BOXES_DISPLAY_CONFIG_LAST_SEEN_NAME:
		boxes_display_config_set_last_seen_name (self, g_value_get_string (value));
		break;
		case BOXES_DISPLAY_CONFIG_UUID:
		boxes_display_config_set_uuid (self, g_value_get_string (value));
		break;
		case BOXES_DISPLAY_CONFIG_CATEGORIES:
		{
			gpointer boxed;
			boxed = g_value_get_boxed (value);
			boxes_display_config_set_categories (self, boxed, g_strv_length (boxed));
		}
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



