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

/* This file is part of GNOME Boxes. License: LGPLv2+*/
/* too bad we can't make it just a mixin*/

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


#define BOXES_TYPE_DISPLAY_PROPERTIES (boxes_display_properties_get_type ())
#define BOXES_DISPLAY_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DISPLAY_PROPERTIES, BoxesDisplayProperties))
#define BOXES_DISPLAY_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DISPLAY_PROPERTIES, BoxesDisplayPropertiesClass))
#define BOXES_IS_DISPLAY_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DISPLAY_PROPERTIES))
#define BOXES_IS_DISPLAY_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DISPLAY_PROPERTIES))
#define BOXES_DISPLAY_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DISPLAY_PROPERTIES, BoxesDisplayPropertiesClass))

typedef struct _BoxesDisplayProperties BoxesDisplayProperties;
typedef struct _BoxesDisplayPropertiesClass BoxesDisplayPropertiesClass;
typedef struct _BoxesDisplayPropertiesPrivate BoxesDisplayPropertiesPrivate;

#define BOXES_DISPLAY_PROPERTIES_TYPE_SAVED_PROPERTY (boxes_display_properties_saved_property_get_type ())
typedef struct _BoxesDisplayPropertiesSavedProperty BoxesDisplayPropertiesSavedProperty;

#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;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block1Data Block1Data;
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))

struct _BoxesDisplayProperties {
	GObject parent_instance;
	BoxesDisplayPropertiesPrivate * priv;
};

struct _BoxesDisplayPropertiesClass {
	GObjectClass parent_class;
};

struct _BoxesDisplayPropertiesSavedProperty {
	gchar* name;
	GValue default_value;
};

struct _BoxesDisplayPropertiesPrivate {
	gint64 started_time;
	gint64 _access_last_time;
	gint64 _access_first_time;
	gint64 _access_total_time;
	gint64 _access_ntimes;
	BoxesDisplayPropertiesSavedProperty* access_saved_properties;
	gint access_saved_properties_length1;
	gint _access_saved_properties_size_;
	BoxesDisplayConfig* _config;
	gchar* filter_data;
};

struct _Block1Data {
	int _ref_count_;
	BoxesDisplayProperties * self;
	GObject* display;
	BoxesDisplayPropertiesSavedProperty* saved_properties;
	gint saved_properties_length1;
};


static gpointer boxes_display_properties_parent_class = NULL;

GType boxes_display_properties_get_type (void) G_GNUC_CONST;
GType boxes_display_properties_saved_property_get_type (void) G_GNUC_CONST;
BoxesDisplayPropertiesSavedProperty* boxes_display_properties_saved_property_dup (const BoxesDisplayPropertiesSavedProperty* self);
void boxes_display_properties_saved_property_free (BoxesDisplayPropertiesSavedProperty* self);
void boxes_display_properties_saved_property_copy (const BoxesDisplayPropertiesSavedProperty* self, BoxesDisplayPropertiesSavedProperty* dest);
void boxes_display_properties_saved_property_destroy (BoxesDisplayPropertiesSavedProperty* self);
GType boxes_display_config_get_type (void) G_GNUC_CONST;
#define BOXES_DISPLAY_PROPERTIES_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BOXES_TYPE_DISPLAY_PROPERTIES, BoxesDisplayPropertiesPrivate))
enum  {
	BOXES_DISPLAY_PROPERTIES_DUMMY_PROPERTY,
	BOXES_DISPLAY_PROPERTIES_ACCESS_LAST_TIME,
	BOXES_DISPLAY_PROPERTIES_ACCESS_FIRST_TIME,
	BOXES_DISPLAY_PROPERTIES_ACCESS_TOTAL_TIME,
	BOXES_DISPLAY_PROPERTIES_ACCESS_NTIMES,
	BOXES_DISPLAY_PROPERTIES_CONFIG
};
void boxes_display_properties_access_finish (BoxesDisplayProperties* self);
static void _vala_BoxesDisplayPropertiesSavedProperty_array_free (BoxesDisplayPropertiesSavedProperty* array, gint array_length);
void boxes_display_properties_access_start (BoxesDisplayProperties* self);
void boxes_display_properties_set_access_last_time (BoxesDisplayProperties* self, gint64 value);
gint64 boxes_display_properties_get_access_ntimes (BoxesDisplayProperties* self);
void boxes_display_properties_set_access_ntimes (BoxesDisplayProperties* self, gint64 value);
gint64 boxes_display_properties_get_access_first_time (BoxesDisplayProperties* self);
gint64 boxes_display_properties_get_access_last_time (BoxesDisplayProperties* self);
void boxes_display_properties_set_access_first_time (BoxesDisplayProperties* self, gint64 value);
gint64 boxes_display_properties_get_access_total_time (BoxesDisplayProperties* self);
void boxes_display_properties_set_access_total_time (BoxesDisplayProperties* self, gint64 value);
BoxesDisplayProperties* boxes_display_properties_new_with_config (BoxesDisplayConfig* config);
BoxesDisplayProperties* boxes_display_properties_construct_with_config (GType object_type, BoxesDisplayConfig* config);
void boxes_display_properties_set_config (BoxesDisplayProperties* self, BoxesDisplayConfig* value);
static void boxes_display_properties_update_filter_data (BoxesDisplayProperties* self);
void boxes_display_properties_sync_config_with_display (BoxesDisplayProperties* self, GObject* display, BoxesDisplayPropertiesSavedProperty* saved_properties, int saved_properties_length1);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
BoxesDisplayConfig* boxes_display_properties_get_config (BoxesDisplayProperties* self);
void boxes_display_config_load_display_property (BoxesDisplayConfig* self, GObject* display, const gchar* property_name, GValue* default_value);
static void __lambda2_ (Block1Data* _data1_, GParamSpec* pspec);
void boxes_display_config_save_display_property (BoxesDisplayConfig* self, GObject* display, const gchar* property_name);
static void ___lambda2__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
gchar* boxes_display_config_get_last_seen_name (BoxesDisplayConfig* self);
gchar* boxes_canonicalize_for_search (const gchar* str);
gboolean boxes_display_properties_contains_strings (BoxesDisplayProperties* self, gchar** strings, int strings_length1);
BoxesDisplayProperties* boxes_display_properties_new (void);
BoxesDisplayProperties* boxes_display_properties_construct (GType object_type);
static GObject * boxes_display_properties_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _boxes_display_properties___lambda3_ (BoxesDisplayProperties* self);
static void __boxes_display_properties___lambda3__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void boxes_display_properties_finalize (GObject* obj);
static void _vala_boxes_display_properties_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_boxes_display_properties_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static void _vala_BoxesDisplayPropertiesSavedProperty_array_free (BoxesDisplayPropertiesSavedProperty* array, gint array_length) {
	if (array != NULL) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			boxes_display_properties_saved_property_destroy (&array[i]);
		}
	}
	g_free (array);
}


void boxes_display_properties_access_start (BoxesDisplayProperties* self) {
	gint64 _tmp0_;
	gint64 _tmp1_ = 0LL;
	gint64 _tmp2_ = 0LL;
	gint64 _tmp3_;
	gint64 _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->started_time;
	if (_tmp0_ != ((gint64) 0)) {
		return;
	}
	_tmp1_ = g_get_monotonic_time ();
	self->priv->started_time = _tmp1_;
	_tmp2_ = g_get_real_time ();
	boxes_display_properties_set_access_last_time (self, _tmp2_);
	_tmp3_ = self->priv->_access_ntimes;
	boxes_display_properties_set_access_ntimes (self, _tmp3_ + 1);
	_tmp4_ = self->priv->_access_first_time;
	if (_tmp4_ == ((gint64) 0)) {
		gint64 _tmp5_;
		_tmp5_ = self->priv->_access_last_time;
		boxes_display_properties_set_access_first_time (self, _tmp5_);
	}
}


void boxes_display_properties_access_finish (BoxesDisplayProperties* self) {
	gint64 _tmp0_;
	gint64 _tmp1_ = 0LL;
	gint64 _tmp2_;
	gint64 duration;
	gint64 _tmp3_;
	gint64 _tmp4_;
	gint64 _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->started_time;
	if (_tmp0_ == ((gint64) 0)) {
		return;
	}
	_tmp1_ = g_get_monotonic_time ();
	_tmp2_ = self->priv->started_time;
	duration = _tmp1_ - _tmp2_;
	_tmp3_ = duration;
	duration = _tmp3_ / 1000000;
	_tmp4_ = self->priv->_access_total_time;
	_tmp5_ = duration;
	boxes_display_properties_set_access_total_time (self, _tmp4_ + _tmp5_);
	self->priv->started_time = (gint64) 0;
}


BoxesDisplayProperties* boxes_display_properties_construct_with_config (GType object_type, BoxesDisplayConfig* config) {
	BoxesDisplayProperties * self = NULL;
	BoxesDisplayConfig* _tmp0_;
	g_return_val_if_fail (config != NULL, NULL);
	self = (BoxesDisplayProperties*) g_object_new (object_type, NULL);
	_tmp0_ = config;
	boxes_display_properties_set_config (self, _tmp0_);
	boxes_display_properties_update_filter_data (self);
	return self;
}


BoxesDisplayProperties* boxes_display_properties_new_with_config (BoxesDisplayConfig* config) {
	return boxes_display_properties_construct_with_config (BOXES_TYPE_DISPLAY_PROPERTIES, config);
}


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


static Block1Data* block1_data_ref (Block1Data* _data1_) {
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}


static void block1_data_unref (void * _userdata_) {
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		BoxesDisplayProperties * self;
		self = _data1_->self;
		_g_object_unref0 (_data1_->display);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}


static void __lambda2_ (Block1Data* _data1_, GParamSpec* pspec) {
	BoxesDisplayProperties * self;
	BoxesDisplayPropertiesSavedProperty* _tmp0_;
	gint _tmp0__length1;
	self = _data1_->self;
	g_return_if_fail (pspec != NULL);
	_tmp0_ = _data1_->saved_properties;
	_tmp0__length1 = _data1_->saved_properties_length1;
	{
		BoxesDisplayPropertiesSavedProperty* prop_collection = NULL;
		gint prop_collection_length1 = 0;
		gint _prop_collection_size_ = 0;
		gint prop_it = 0;
		prop_collection = _tmp0_;
		prop_collection_length1 = _tmp0__length1;
		for (prop_it = 0; prop_it < _tmp0__length1; prop_it = prop_it + 1) {
			BoxesDisplayPropertiesSavedProperty _tmp1_ = {0};
			BoxesDisplayPropertiesSavedProperty prop = {0};
			boxes_display_properties_saved_property_copy (&prop_collection[prop_it], &_tmp1_);
			prop = _tmp1_;
			{
				GParamSpec* _tmp2_;
				const gchar* _tmp3_;
				BoxesDisplayPropertiesSavedProperty _tmp4_;
				const gchar* _tmp5_;
				_tmp2_ = pspec;
				_tmp3_ = _tmp2_->name;
				_tmp4_ = prop;
				_tmp5_ = _tmp4_.name;
				if (g_strcmp0 (_tmp3_, _tmp5_) == 0) {
					BoxesDisplayConfig* _tmp6_;
					GObject* _tmp7_;
					GParamSpec* _tmp8_;
					const gchar* _tmp9_;
					_tmp6_ = self->priv->_config;
					_tmp7_ = _data1_->display;
					_tmp8_ = pspec;
					_tmp9_ = _tmp8_->name;
					boxes_display_config_save_display_property (_tmp6_, _tmp7_, _tmp9_);
					boxes_display_properties_saved_property_destroy (&prop);
					break;
				}
				boxes_display_properties_saved_property_destroy (&prop);
			}
		}
	}
}


static void ___lambda2__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	__lambda2_ (self, pspec);
}


void boxes_display_properties_sync_config_with_display (BoxesDisplayProperties* self, GObject* display, BoxesDisplayPropertiesSavedProperty* saved_properties, int saved_properties_length1) {
	Block1Data* _data1_;
	GObject* _tmp0_;
	GObject* _tmp1_;
	BoxesDisplayPropertiesSavedProperty* _tmp2_;
	gint _tmp2__length1;
	BoxesDisplayConfig* _tmp3_;
	BoxesDisplayPropertiesSavedProperty* _tmp4_;
	gint _tmp4__length1;
	GObject* _tmp12_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (display != NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	_tmp0_ = display;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data1_->display);
	_data1_->display = _tmp1_;
	_tmp2_ = saved_properties;
	_tmp2__length1 = saved_properties_length1;
	_data1_->saved_properties = _tmp2_;
	_data1_->saved_properties_length1 = _tmp2__length1;
	_tmp3_ = self->priv->_config;
	if (_tmp3_ == NULL) {
		block1_data_unref (_data1_);
		_data1_ = NULL;
		return;
	}
	_tmp4_ = _data1_->saved_properties;
	_tmp4__length1 = _data1_->saved_properties_length1;
	{
		BoxesDisplayPropertiesSavedProperty* prop_collection = NULL;
		gint prop_collection_length1 = 0;
		gint _prop_collection_size_ = 0;
		gint prop_it = 0;
		prop_collection = _tmp4_;
		prop_collection_length1 = _tmp4__length1;
		for (prop_it = 0; prop_it < _tmp4__length1; prop_it = prop_it + 1) {
			BoxesDisplayPropertiesSavedProperty _tmp5_ = {0};
			BoxesDisplayPropertiesSavedProperty prop = {0};
			boxes_display_properties_saved_property_copy (&prop_collection[prop_it], &_tmp5_);
			prop = _tmp5_;
			{
				BoxesDisplayConfig* _tmp6_;
				GObject* _tmp7_;
				BoxesDisplayPropertiesSavedProperty _tmp8_;
				const gchar* _tmp9_;
				BoxesDisplayPropertiesSavedProperty _tmp10_;
				GValue _tmp11_;
				_tmp6_ = self->priv->_config;
				_tmp7_ = _data1_->display;
				_tmp8_ = prop;
				_tmp9_ = _tmp8_.name;
				_tmp10_ = prop;
				_tmp11_ = _tmp10_.default_value;
				boxes_display_config_load_display_property (_tmp6_, _tmp7_, _tmp9_, &_tmp11_);
				boxes_display_properties_saved_property_destroy (&prop);
			}
		}
	}
	_tmp12_ = _data1_->display;
	g_signal_connect_data (_tmp12_, "notify", (GCallback) ___lambda2__g_object_notify, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	block1_data_unref (_data1_);
	_data1_ = NULL;
}


static void boxes_display_properties_update_filter_data (BoxesDisplayProperties* self) {
	GString* _tmp0_;
	GString* builder;
	BoxesDisplayConfig* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gboolean _tmp5_;
	GString* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	_tmp1_ = self->priv->_config;
	_tmp2_ = boxes_display_config_get_last_seen_name (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ != NULL;
	_g_free0 (_tmp4_);
	if (_tmp5_) {
		GString* _tmp6_;
		BoxesDisplayConfig* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_ = NULL;
		gchar* _tmp12_;
		GString* _tmp13_;
		_tmp6_ = builder;
		_tmp7_ = self->priv->_config;
		_tmp8_ = boxes_display_config_get_last_seen_name (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = _tmp9_;
		_tmp11_ = boxes_canonicalize_for_search (_tmp10_);
		_tmp12_ = _tmp11_;
		g_string_append (_tmp6_, _tmp12_);
		_g_free0 (_tmp12_);
		_g_free0 (_tmp10_);
		_tmp13_ = builder;
		g_string_append_unichar (_tmp13_, (gunichar) ' ');
	}
	_tmp14_ = builder;
	_tmp15_ = _tmp14_->str;
	_tmp16_ = g_strdup (_tmp15_);
	_g_free0 (self->priv->filter_data);
	self->priv->filter_data = _tmp16_;
	_g_string_free0 (builder);
}


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


gboolean boxes_display_properties_contains_strings (BoxesDisplayProperties* self, gchar** strings, int strings_length1) {
	gboolean result = FALSE;
	gchar** _tmp0_;
	gint _tmp0__length1;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = strings;
	_tmp0__length1 = strings_length1;
	{
		gchar** i_collection = NULL;
		gint i_collection_length1 = 0;
		gint _i_collection_size_ = 0;
		gint i_it = 0;
		i_collection = _tmp0_;
		i_collection_length1 = _tmp0__length1;
		for (i_it = 0; i_it < _tmp0__length1; i_it = i_it + 1) {
			gchar* _tmp1_;
			gchar* i = NULL;
			_tmp1_ = g_strdup (i_collection[i_it]);
			i = _tmp1_;
			{
				const gchar* _tmp2_;
				const gchar* _tmp3_;
				gboolean _tmp4_ = FALSE;
				_tmp2_ = self->priv->filter_data;
				_tmp3_ = i;
				_tmp4_ = string_contains (_tmp2_, _tmp3_);
				if (!_tmp4_) {
					result = FALSE;
					_g_free0 (i);
					return result;
				}
				_g_free0 (i);
			}
		}
	}
	result = TRUE;
	return result;
}


BoxesDisplayProperties* boxes_display_properties_construct (GType object_type) {
	BoxesDisplayProperties * self = NULL;
	self = (BoxesDisplayProperties*) g_object_new (object_type, NULL);
	return self;
}


BoxesDisplayProperties* boxes_display_properties_new (void) {
	return boxes_display_properties_construct (BOXES_TYPE_DISPLAY_PROPERTIES);
}


gint64 boxes_display_properties_get_access_last_time (BoxesDisplayProperties* self) {
	gint64 result;
	gint64 _tmp0_;
	g_return_val_if_fail (self != NULL, 0LL);
	_tmp0_ = self->priv->_access_last_time;
	result = _tmp0_;
	return result;
}


void boxes_display_properties_set_access_last_time (BoxesDisplayProperties* self, gint64 value) {
	gint64 _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_access_last_time = _tmp0_;
	g_object_notify ((GObject *) self, "access-last-time");
}


gint64 boxes_display_properties_get_access_first_time (BoxesDisplayProperties* self) {
	gint64 result;
	gint64 _tmp0_;
	g_return_val_if_fail (self != NULL, 0LL);
	_tmp0_ = self->priv->_access_first_time;
	result = _tmp0_;
	return result;
}


void boxes_display_properties_set_access_first_time (BoxesDisplayProperties* self, gint64 value) {
	gint64 _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_access_first_time = _tmp0_;
	g_object_notify ((GObject *) self, "access-first-time");
}


gint64 boxes_display_properties_get_access_total_time (BoxesDisplayProperties* self) {
	gint64 result;
	gint64 _tmp0_;
	g_return_val_if_fail (self != NULL, 0LL);
	_tmp0_ = self->priv->_access_total_time;
	result = _tmp0_;
	return result;
}


void boxes_display_properties_set_access_total_time (BoxesDisplayProperties* self, gint64 value) {
	gint64 _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_access_total_time = _tmp0_;
	g_object_notify ((GObject *) self, "access-total-time");
}


gint64 boxes_display_properties_get_access_ntimes (BoxesDisplayProperties* self) {
	gint64 result;
	gint64 _tmp0_;
	g_return_val_if_fail (self != NULL, 0LL);
	_tmp0_ = self->priv->_access_ntimes;
	result = _tmp0_;
	return result;
}


void boxes_display_properties_set_access_ntimes (BoxesDisplayProperties* self, gint64 value) {
	gint64 _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_access_ntimes = _tmp0_;
	g_object_notify ((GObject *) self, "access-ntimes");
}


BoxesDisplayConfig* boxes_display_properties_get_config (BoxesDisplayProperties* self) {
	BoxesDisplayConfig* result;
	BoxesDisplayConfig* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_config;
	result = _tmp0_;
	return result;
}


void boxes_display_properties_set_config (BoxesDisplayProperties* self, BoxesDisplayConfig* value) {
	BoxesDisplayConfig* _tmp0_;
	BoxesDisplayConfig* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_config);
	self->priv->_config = _tmp1_;
	g_object_notify ((GObject *) self, "config");
}


static void _boxes_display_properties___lambda3_ (BoxesDisplayProperties* self) {
	BoxesDisplayPropertiesSavedProperty* _tmp0_;
	gint _tmp0__length1;
	_tmp0_ = self->priv->access_saved_properties;
	_tmp0__length1 = self->priv->access_saved_properties_length1;
	boxes_display_properties_sync_config_with_display (self, (GObject*) self, _tmp0_, _tmp0__length1);
}


static void __boxes_display_properties___lambda3__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_boxes_display_properties___lambda3_ (self);
}


static GObject * boxes_display_properties_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	BoxesDisplayProperties * self;
	gchar* _tmp0_;
	GValue _tmp1_ = {0};
	BoxesDisplayPropertiesSavedProperty _tmp2_ = {0};
	gchar* _tmp3_;
	GValue _tmp4_ = {0};
	BoxesDisplayPropertiesSavedProperty _tmp5_ = {0};
	gchar* _tmp6_;
	GValue _tmp7_ = {0};
	BoxesDisplayPropertiesSavedProperty _tmp8_ = {0};
	gchar* _tmp9_;
	GValue _tmp10_ = {0};
	BoxesDisplayPropertiesSavedProperty _tmp11_ = {0};
	BoxesDisplayPropertiesSavedProperty* _tmp12_ = NULL;
	parent_class = G_OBJECT_CLASS (boxes_display_properties_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_DISPLAY_PROPERTIES, BoxesDisplayProperties);
	_tmp0_ = g_strdup ("access-last-time");
	g_value_init (&_tmp1_, G_TYPE_INT64);
	g_value_set_int64 (&_tmp1_, (gint64) (-1));
	memset (&_tmp2_, 0, sizeof (BoxesDisplayPropertiesSavedProperty));
	_g_free0 (_tmp2_.name);
	_tmp2_.name = _tmp0_;
	G_IS_VALUE (&_tmp2_.default_value) ? (g_value_unset (&_tmp2_.default_value), NULL) : NULL;
	_tmp2_.default_value = _tmp1_;
	_tmp3_ = g_strdup ("access-first-time");
	g_value_init (&_tmp4_, G_TYPE_INT64);
	g_value_set_int64 (&_tmp4_, (gint64) (-1));
	memset (&_tmp5_, 0, sizeof (BoxesDisplayPropertiesSavedProperty));
	_g_free0 (_tmp5_.name);
	_tmp5_.name = _tmp3_;
	G_IS_VALUE (&_tmp5_.default_value) ? (g_value_unset (&_tmp5_.default_value), NULL) : NULL;
	_tmp5_.default_value = _tmp4_;
	_tmp6_ = g_strdup ("access-total-time");
	g_value_init (&_tmp7_, G_TYPE_INT64);
	g_value_set_int64 (&_tmp7_, (gint64) (-1));
	memset (&_tmp8_, 0, sizeof (BoxesDisplayPropertiesSavedProperty));
	_g_free0 (_tmp8_.name);
	_tmp8_.name = _tmp6_;
	G_IS_VALUE (&_tmp8_.default_value) ? (g_value_unset (&_tmp8_.default_value), NULL) : NULL;
	_tmp8_.default_value = _tmp7_;
	_tmp9_ = g_strdup ("access-ntimes");
	g_value_init (&_tmp10_, G_TYPE_UINT64);
	g_value_set_uint64 (&_tmp10_, (guint64) 0);
	memset (&_tmp11_, 0, sizeof (BoxesDisplayPropertiesSavedProperty));
	_g_free0 (_tmp11_.name);
	_tmp11_.name = _tmp9_;
	G_IS_VALUE (&_tmp11_.default_value) ? (g_value_unset (&_tmp11_.default_value), NULL) : NULL;
	_tmp11_.default_value = _tmp10_;
	_tmp12_ = g_new0 (BoxesDisplayPropertiesSavedProperty, 4);
	_tmp12_[0] = _tmp2_;
	_tmp12_[1] = _tmp5_;
	_tmp12_[2] = _tmp8_;
	_tmp12_[3] = _tmp11_;
	self->priv->access_saved_properties = (_vala_BoxesDisplayPropertiesSavedProperty_array_free (self->priv->access_saved_properties, self->priv->access_saved_properties_length1), NULL);
	self->priv->access_saved_properties = _tmp12_;
	self->priv->access_saved_properties_length1 = 4;
	self->priv->_access_saved_properties_size_ = self->priv->access_saved_properties_length1;
	g_signal_connect_object ((GObject*) self, "notify::config", (GCallback) __boxes_display_properties___lambda3__g_object_notify, self, 0);
	return obj;
}


void boxes_display_properties_saved_property_copy (const BoxesDisplayPropertiesSavedProperty* self, BoxesDisplayPropertiesSavedProperty* dest) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	GValue _tmp2_;
	GValue _tmp3_ = {0};
	_tmp0_ = (*self).name;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).name);
	(*dest).name = _tmp1_;
	_tmp2_ = (*self).default_value;
	if (G_IS_VALUE (&_tmp2_)) {
		g_value_init (&_tmp3_, G_VALUE_TYPE (&_tmp2_));
		g_value_copy (&_tmp2_, &_tmp3_);
	} else {
		_tmp3_ = _tmp2_;
	}
	G_IS_VALUE (&(*dest).default_value) ? (g_value_unset (&(*dest).default_value), NULL) : NULL;
	(*dest).default_value = _tmp3_;
}


void boxes_display_properties_saved_property_destroy (BoxesDisplayPropertiesSavedProperty* self) {
	_g_free0 ((*self).name);
	G_IS_VALUE (&(*self).default_value) ? (g_value_unset (&(*self).default_value), NULL) : NULL;
}


BoxesDisplayPropertiesSavedProperty* boxes_display_properties_saved_property_dup (const BoxesDisplayPropertiesSavedProperty* self) {
	BoxesDisplayPropertiesSavedProperty* dup;
	dup = g_new0 (BoxesDisplayPropertiesSavedProperty, 1);
	boxes_display_properties_saved_property_copy (self, dup);
	return dup;
}


void boxes_display_properties_saved_property_free (BoxesDisplayPropertiesSavedProperty* self) {
	boxes_display_properties_saved_property_destroy (self);
	g_free (self);
}


GType boxes_display_properties_saved_property_get_type (void) {
	static volatile gsize boxes_display_properties_saved_property_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_display_properties_saved_property_type_id__volatile)) {
		GType boxes_display_properties_saved_property_type_id;
		boxes_display_properties_saved_property_type_id = g_boxed_type_register_static ("BoxesDisplayPropertiesSavedProperty", (GBoxedCopyFunc) boxes_display_properties_saved_property_dup, (GBoxedFreeFunc) boxes_display_properties_saved_property_free);
		g_once_init_leave (&boxes_display_properties_saved_property_type_id__volatile, boxes_display_properties_saved_property_type_id);
	}
	return boxes_display_properties_saved_property_type_id__volatile;
}


static void boxes_display_properties_class_init (BoxesDisplayPropertiesClass * klass) {
	boxes_display_properties_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (BoxesDisplayPropertiesPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_display_properties_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_display_properties_set_property;
	G_OBJECT_CLASS (klass)->constructor = boxes_display_properties_constructor;
	G_OBJECT_CLASS (klass)->finalize = boxes_display_properties_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_DISPLAY_PROPERTIES_ACCESS_LAST_TIME, g_param_spec_int64 ("access-last-time", "access-last-time", "access-last-time", G_MININT64, G_MAXINT64, 0, 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_PROPERTIES_ACCESS_FIRST_TIME, g_param_spec_int64 ("access-first-time", "access-first-time", "access-first-time", G_MININT64, G_MAXINT64, 0, 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_PROPERTIES_ACCESS_TOTAL_TIME, g_param_spec_int64 ("access-total-time", "access-total-time", "access-total-time", G_MININT64, G_MAXINT64, 0, 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_PROPERTIES_ACCESS_NTIMES, g_param_spec_int64 ("access-ntimes", "access-ntimes", "access-ntimes", G_MININT64, G_MAXINT64, 0, 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_PROPERTIES_CONFIG, g_param_spec_object ("config", "config", "config", BOXES_TYPE_DISPLAY_CONFIG, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void boxes_display_properties_instance_init (BoxesDisplayProperties * self) {
	self->priv = BOXES_DISPLAY_PROPERTIES_GET_PRIVATE (self);
}


static void boxes_display_properties_finalize (GObject* obj) {
	BoxesDisplayProperties * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_DISPLAY_PROPERTIES, BoxesDisplayProperties);
	boxes_display_properties_access_finish (self);
	self->priv->access_saved_properties = (_vala_BoxesDisplayPropertiesSavedProperty_array_free (self->priv->access_saved_properties, self->priv->access_saved_properties_length1), NULL);
	_g_object_unref0 (self->priv->_config);
	_g_free0 (self->priv->filter_data);
	G_OBJECT_CLASS (boxes_display_properties_parent_class)->finalize (obj);
}


GType boxes_display_properties_get_type (void) {
	static volatile gsize boxes_display_properties_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_display_properties_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesDisplayPropertiesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_display_properties_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesDisplayProperties), 0, (GInstanceInitFunc) boxes_display_properties_instance_init, NULL };
		GType boxes_display_properties_type_id;
		boxes_display_properties_type_id = g_type_register_static (G_TYPE_OBJECT, "BoxesDisplayProperties", &g_define_type_info, 0);
		g_once_init_leave (&boxes_display_properties_type_id__volatile, boxes_display_properties_type_id);
	}
	return boxes_display_properties_type_id__volatile;
}


static void _vala_boxes_display_properties_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	BoxesDisplayProperties * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_DISPLAY_PROPERTIES, BoxesDisplayProperties);
	switch (property_id) {
		case BOXES_DISPLAY_PROPERTIES_ACCESS_LAST_TIME:
		g_value_set_int64 (value, boxes_display_properties_get_access_last_time (self));
		break;
		case BOXES_DISPLAY_PROPERTIES_ACCESS_FIRST_TIME:
		g_value_set_int64 (value, boxes_display_properties_get_access_first_time (self));
		break;
		case BOXES_DISPLAY_PROPERTIES_ACCESS_TOTAL_TIME:
		g_value_set_int64 (value, boxes_display_properties_get_access_total_time (self));
		break;
		case BOXES_DISPLAY_PROPERTIES_ACCESS_NTIMES:
		g_value_set_int64 (value, boxes_display_properties_get_access_ntimes (self));
		break;
		case BOXES_DISPLAY_PROPERTIES_CONFIG:
		g_value_set_object (value, boxes_display_properties_get_config (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_boxes_display_properties_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	BoxesDisplayProperties * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_DISPLAY_PROPERTIES, BoxesDisplayProperties);
	switch (property_id) {
		case BOXES_DISPLAY_PROPERTIES_ACCESS_LAST_TIME:
		boxes_display_properties_set_access_last_time (self, g_value_get_int64 (value));
		break;
		case BOXES_DISPLAY_PROPERTIES_ACCESS_FIRST_TIME:
		boxes_display_properties_set_access_first_time (self, g_value_get_int64 (value));
		break;
		case BOXES_DISPLAY_PROPERTIES_ACCESS_TOTAL_TIME:
		boxes_display_properties_set_access_total_time (self, g_value_get_int64 (value));
		break;
		case BOXES_DISPLAY_PROPERTIES_ACCESS_NTIMES:
		boxes_display_properties_set_access_ntimes (self, g_value_get_int64 (value));
		break;
		case BOXES_DISPLAY_PROPERTIES_CONFIG:
		boxes_display_properties_set_config (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



