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

/*
Peek Copyright (c) 2017-2018 by Philipp Wolfer <ph.wolfer@gmail.com>

This file is part of Peek.

This software is licensed under the GNU General Public License
(version 3 or later). See the LICENSE file in this distribution.
*/

#include "../../application.h"
#include <glib.h>
#include <glib-object.h>
#include <string.h>

#define PEEK_DEFAULT_FRAMERATE 15
#define PEEK_DEFAULT_DOWNSAMPLE 1
#define PEEK_DEFAULT_GIFSKI_QUALITY 60
#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  {
	PEEK_RECORDING_RECORDING_CONFIG_0_PROPERTY,
	PEEK_RECORDING_RECORDING_CONFIG_OUTPUT_FORMAT_PROPERTY,
	PEEK_RECORDING_RECORDING_CONFIG_FRAMERATE_PROPERTY,
	PEEK_RECORDING_RECORDING_CONFIG_DOWNSAMPLE_PROPERTY,
	PEEK_RECORDING_RECORDING_CONFIG_CAPTURE_MOUSE_PROPERTY,
	PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_ENABLED_PROPERTY,
	PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_QUALITY_PROPERTY,
	PEEK_RECORDING_RECORDING_CONFIG_NUM_PROPERTIES
};
static GParamSpec* peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_NUM_PROPERTIES];

struct _PeekRecordingRecordingConfigPrivate {
	PeekOutputFormat _output_format;
	gint _framerate;
	gint _downsample;
	gboolean _capture_mouse;
	gboolean _gifski_enabled;
	gint _gifski_quality;
};

static gint PeekRecordingRecordingConfig_private_offset;
static gpointer peek_recording_recording_config_parent_class = NULL;

static void peek_recording_recording_config_finalize (GObject * obj);
static GType peek_recording_recording_config_get_type_once (void);
static void _vala_peek_recording_recording_config_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec);
static void _vala_peek_recording_recording_config_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
peek_recording_recording_config_get_instance_private (PeekRecordingRecordingConfig* self)
{
	return G_STRUCT_MEMBER_P (self, PeekRecordingRecordingConfig_private_offset);
}

PeekRecordingRecordingConfig*
peek_recording_recording_config_construct (GType object_type)
{
	PeekRecordingRecordingConfig * self = NULL;
	self = (PeekRecordingRecordingConfig*) g_object_new (object_type, NULL);
	return self;
}

PeekRecordingRecordingConfig*
peek_recording_recording_config_new (void)
{
	return peek_recording_recording_config_construct (PEEK_RECORDING_TYPE_RECORDING_CONFIG);
}

PeekOutputFormat
peek_recording_recording_config_get_output_format (PeekRecordingRecordingConfig* self)
{
	PeekOutputFormat result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_output_format;
	return result;
}

void
peek_recording_recording_config_set_output_format (PeekRecordingRecordingConfig* self,
                                                   PeekOutputFormat value)
{
	PeekOutputFormat old_value;
	g_return_if_fail (self != NULL);
	old_value = peek_recording_recording_config_get_output_format (self);
	if (old_value != value) {
		self->priv->_output_format = value;
		g_object_notify_by_pspec ((GObject *) self, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_OUTPUT_FORMAT_PROPERTY]);
	}
}

gint
peek_recording_recording_config_get_framerate (PeekRecordingRecordingConfig* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_framerate;
	return result;
}

void
peek_recording_recording_config_set_framerate (PeekRecordingRecordingConfig* self,
                                               gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = peek_recording_recording_config_get_framerate (self);
	if (old_value != value) {
		self->priv->_framerate = value;
		g_object_notify_by_pspec ((GObject *) self, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_FRAMERATE_PROPERTY]);
	}
}

gint
peek_recording_recording_config_get_downsample (PeekRecordingRecordingConfig* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_downsample;
	return result;
}

void
peek_recording_recording_config_set_downsample (PeekRecordingRecordingConfig* self,
                                                gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = peek_recording_recording_config_get_downsample (self);
	if (old_value != value) {
		self->priv->_downsample = value;
		g_object_notify_by_pspec ((GObject *) self, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_DOWNSAMPLE_PROPERTY]);
	}
}

gboolean
peek_recording_recording_config_get_capture_mouse (PeekRecordingRecordingConfig* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_capture_mouse;
	return result;
}

void
peek_recording_recording_config_set_capture_mouse (PeekRecordingRecordingConfig* self,
                                                   gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = peek_recording_recording_config_get_capture_mouse (self);
	if (old_value != value) {
		self->priv->_capture_mouse = value;
		g_object_notify_by_pspec ((GObject *) self, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_CAPTURE_MOUSE_PROPERTY]);
	}
}

gboolean
peek_recording_recording_config_get_gifski_enabled (PeekRecordingRecordingConfig* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_gifski_enabled;
	return result;
}

void
peek_recording_recording_config_set_gifski_enabled (PeekRecordingRecordingConfig* self,
                                                    gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = peek_recording_recording_config_get_gifski_enabled (self);
	if (old_value != value) {
		self->priv->_gifski_enabled = value;
		g_object_notify_by_pspec ((GObject *) self, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_ENABLED_PROPERTY]);
	}
}

gint
peek_recording_recording_config_get_gifski_quality (PeekRecordingRecordingConfig* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_gifski_quality;
	return result;
}

void
peek_recording_recording_config_set_gifski_quality (PeekRecordingRecordingConfig* self,
                                                    gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = peek_recording_recording_config_get_gifski_quality (self);
	if (old_value != value) {
		self->priv->_gifski_quality = value;
		g_object_notify_by_pspec ((GObject *) self, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_QUALITY_PROPERTY]);
	}
}

static void
peek_recording_recording_config_class_init (PeekRecordingRecordingConfigClass * klass,
                                            gpointer klass_data)
{
	peek_recording_recording_config_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PeekRecordingRecordingConfig_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_peek_recording_recording_config_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_peek_recording_recording_config_set_property;
	G_OBJECT_CLASS (klass)->finalize = peek_recording_recording_config_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PEEK_RECORDING_RECORDING_CONFIG_OUTPUT_FORMAT_PROPERTY, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_OUTPUT_FORMAT_PROPERTY] = g_param_spec_enum ("output-format", "output-format", "output-format", PEEK_TYPE_OUTPUT_FORMAT, PEEK_OUTPUT_FORMAT_GIF, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PEEK_RECORDING_RECORDING_CONFIG_FRAMERATE_PROPERTY, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_FRAMERATE_PROPERTY] = g_param_spec_int ("framerate", "framerate", "framerate", G_MININT, G_MAXINT, PEEK_DEFAULT_FRAMERATE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PEEK_RECORDING_RECORDING_CONFIG_DOWNSAMPLE_PROPERTY, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_DOWNSAMPLE_PROPERTY] = g_param_spec_int ("downsample", "downsample", "downsample", G_MININT, G_MAXINT, PEEK_DEFAULT_DOWNSAMPLE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PEEK_RECORDING_RECORDING_CONFIG_CAPTURE_MOUSE_PROPERTY, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_CAPTURE_MOUSE_PROPERTY] = g_param_spec_boolean ("capture-mouse", "capture-mouse", "capture-mouse", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_ENABLED_PROPERTY, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_ENABLED_PROPERTY] = g_param_spec_boolean ("gifski-enabled", "gifski-enabled", "gifski-enabled", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_QUALITY_PROPERTY, peek_recording_recording_config_properties[PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_QUALITY_PROPERTY] = g_param_spec_int ("gifski-quality", "gifski-quality", "gifski-quality", G_MININT, G_MAXINT, PEEK_DEFAULT_GIFSKI_QUALITY, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
peek_recording_recording_config_instance_init (PeekRecordingRecordingConfig * self,
                                               gpointer klass)
{
	self->priv = peek_recording_recording_config_get_instance_private (self);
	self->priv->_output_format = PEEK_OUTPUT_FORMAT_GIF;
	self->priv->_framerate = PEEK_DEFAULT_FRAMERATE;
	self->priv->_downsample = PEEK_DEFAULT_DOWNSAMPLE;
	self->priv->_capture_mouse = TRUE;
	self->priv->_gifski_enabled = FALSE;
	self->priv->_gifski_quality = PEEK_DEFAULT_GIFSKI_QUALITY;
}

static void
peek_recording_recording_config_finalize (GObject * obj)
{
	PeekRecordingRecordingConfig * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PEEK_RECORDING_TYPE_RECORDING_CONFIG, PeekRecordingRecordingConfig);
	G_OBJECT_CLASS (peek_recording_recording_config_parent_class)->finalize (obj);
}

static GType
peek_recording_recording_config_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PeekRecordingRecordingConfigClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) peek_recording_recording_config_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PeekRecordingRecordingConfig), 0, (GInstanceInitFunc) peek_recording_recording_config_instance_init, NULL };
	GType peek_recording_recording_config_type_id;
	peek_recording_recording_config_type_id = g_type_register_static (G_TYPE_OBJECT, "PeekRecordingRecordingConfig", &g_define_type_info, 0);
	PeekRecordingRecordingConfig_private_offset = g_type_add_instance_private (peek_recording_recording_config_type_id, sizeof (PeekRecordingRecordingConfigPrivate));
	return peek_recording_recording_config_type_id;
}

GType
peek_recording_recording_config_get_type (void)
{
	static volatile gsize peek_recording_recording_config_type_id__once = 0;
	if (g_once_init_enter (&peek_recording_recording_config_type_id__once)) {
		GType peek_recording_recording_config_type_id;
		peek_recording_recording_config_type_id = peek_recording_recording_config_get_type_once ();
		g_once_init_leave (&peek_recording_recording_config_type_id__once, peek_recording_recording_config_type_id);
	}
	return peek_recording_recording_config_type_id__once;
}

static void
_vala_peek_recording_recording_config_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec)
{
	PeekRecordingRecordingConfig * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PEEK_RECORDING_TYPE_RECORDING_CONFIG, PeekRecordingRecordingConfig);
	switch (property_id) {
		case PEEK_RECORDING_RECORDING_CONFIG_OUTPUT_FORMAT_PROPERTY:
		g_value_set_enum (value, peek_recording_recording_config_get_output_format (self));
		break;
		case PEEK_RECORDING_RECORDING_CONFIG_FRAMERATE_PROPERTY:
		g_value_set_int (value, peek_recording_recording_config_get_framerate (self));
		break;
		case PEEK_RECORDING_RECORDING_CONFIG_DOWNSAMPLE_PROPERTY:
		g_value_set_int (value, peek_recording_recording_config_get_downsample (self));
		break;
		case PEEK_RECORDING_RECORDING_CONFIG_CAPTURE_MOUSE_PROPERTY:
		g_value_set_boolean (value, peek_recording_recording_config_get_capture_mouse (self));
		break;
		case PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_ENABLED_PROPERTY:
		g_value_set_boolean (value, peek_recording_recording_config_get_gifski_enabled (self));
		break;
		case PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_QUALITY_PROPERTY:
		g_value_set_int (value, peek_recording_recording_config_get_gifski_quality (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_peek_recording_recording_config_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec)
{
	PeekRecordingRecordingConfig * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PEEK_RECORDING_TYPE_RECORDING_CONFIG, PeekRecordingRecordingConfig);
	switch (property_id) {
		case PEEK_RECORDING_RECORDING_CONFIG_OUTPUT_FORMAT_PROPERTY:
		peek_recording_recording_config_set_output_format (self, g_value_get_enum (value));
		break;
		case PEEK_RECORDING_RECORDING_CONFIG_FRAMERATE_PROPERTY:
		peek_recording_recording_config_set_framerate (self, g_value_get_int (value));
		break;
		case PEEK_RECORDING_RECORDING_CONFIG_DOWNSAMPLE_PROPERTY:
		peek_recording_recording_config_set_downsample (self, g_value_get_int (value));
		break;
		case PEEK_RECORDING_RECORDING_CONFIG_CAPTURE_MOUSE_PROPERTY:
		peek_recording_recording_config_set_capture_mouse (self, g_value_get_boolean (value));
		break;
		case PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_ENABLED_PROPERTY:
		peek_recording_recording_config_set_gifski_enabled (self, g_value_get_boolean (value));
		break;
		case PEEK_RECORDING_RECORDING_CONFIG_GIFSKI_QUALITY_PROPERTY:
		peek_recording_recording_config_set_gifski_quality (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

