/* DirectoryMonitoring.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from DirectoryMonitoring.vala, do not modify */

/* -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-*/
/*-
 * Copyright (c) 2016-2016 elementary LLC.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by: Artem Anufrij <artem.anufrij@live.de>
 *
 */

#include <glib-object.h>
#include <gio/gio.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define AUDIENCE_SERVICES_TYPE_DIRECTORY_MONITORING (audience_services_directory_monitoring_get_type ())
#define AUDIENCE_SERVICES_DIRECTORY_MONITORING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUDIENCE_SERVICES_TYPE_DIRECTORY_MONITORING, AudienceServicesDirectoryMonitoring))
#define AUDIENCE_SERVICES_DIRECTORY_MONITORING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AUDIENCE_SERVICES_TYPE_DIRECTORY_MONITORING, AudienceServicesDirectoryMonitoringClass))
#define AUDIENCE_SERVICES_IS_DIRECTORY_MONITORING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUDIENCE_SERVICES_TYPE_DIRECTORY_MONITORING))
#define AUDIENCE_SERVICES_IS_DIRECTORY_MONITORING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AUDIENCE_SERVICES_TYPE_DIRECTORY_MONITORING))
#define AUDIENCE_SERVICES_DIRECTORY_MONITORING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AUDIENCE_SERVICES_TYPE_DIRECTORY_MONITORING, AudienceServicesDirectoryMonitoringClass))

typedef struct _AudienceServicesDirectoryMonitoring AudienceServicesDirectoryMonitoring;
typedef struct _AudienceServicesDirectoryMonitoringClass AudienceServicesDirectoryMonitoringClass;
typedef struct _AudienceServicesDirectoryMonitoringPrivate AudienceServicesDirectoryMonitoringPrivate;
enum  {
	AUDIENCE_SERVICES_DIRECTORY_MONITORING_0_PROPERTY,
	AUDIENCE_SERVICES_DIRECTORY_MONITORING_MONITOR_PROPERTY,
	AUDIENCE_SERVICES_DIRECTORY_MONITORING_PATH_PROPERTY,
	AUDIENCE_SERVICES_DIRECTORY_MONITORING_NUM_PROPERTIES
};
static GParamSpec* audience_services_directory_monitoring_properties[AUDIENCE_SERVICES_DIRECTORY_MONITORING_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 _AudienceServicesDirectoryMonitoring {
	GObject parent_instance;
	AudienceServicesDirectoryMonitoringPrivate * priv;
};

struct _AudienceServicesDirectoryMonitoringClass {
	GObjectClass parent_class;
};

struct _AudienceServicesDirectoryMonitoringPrivate {
	GFileMonitor* _monitor;
	gchar* _path;
};

static gint AudienceServicesDirectoryMonitoring_private_offset;
static gpointer audience_services_directory_monitoring_parent_class = NULL;

VALA_EXTERN GType audience_services_directory_monitoring_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AudienceServicesDirectoryMonitoring, g_object_unref)
VALA_EXTERN AudienceServicesDirectoryMonitoring* audience_services_directory_monitoring_new (const gchar* path,
                                                                                 GFileMonitor* monitor);
VALA_EXTERN AudienceServicesDirectoryMonitoring* audience_services_directory_monitoring_construct (GType object_type,
                                                                                       const gchar* path,
                                                                                       GFileMonitor* monitor);
VALA_EXTERN GFileMonitor* audience_services_directory_monitoring_get_monitor (AudienceServicesDirectoryMonitoring* self);
VALA_EXTERN void audience_services_directory_monitoring_set_monitor (AudienceServicesDirectoryMonitoring* self,
                                                         GFileMonitor* value);
VALA_EXTERN const gchar* audience_services_directory_monitoring_get_path (AudienceServicesDirectoryMonitoring* self);
VALA_EXTERN void audience_services_directory_monitoring_set_path (AudienceServicesDirectoryMonitoring* self,
                                                      const gchar* value);
static void audience_services_directory_monitoring_finalize (GObject * obj);
static GType audience_services_directory_monitoring_get_type_once (void);
static void _vala_audience_services_directory_monitoring_get_property (GObject * object,
                                                                guint property_id,
                                                                GValue * value,
                                                                GParamSpec * pspec);
static void _vala_audience_services_directory_monitoring_set_property (GObject * object,
                                                                guint property_id,
                                                                const GValue * value,
                                                                GParamSpec * pspec);

static inline gpointer
audience_services_directory_monitoring_get_instance_private (AudienceServicesDirectoryMonitoring* self)
{
	return G_STRUCT_MEMBER_P (self, AudienceServicesDirectoryMonitoring_private_offset);
}

AudienceServicesDirectoryMonitoring*
audience_services_directory_monitoring_construct (GType object_type,
                                                  const gchar* path,
                                                  GFileMonitor* monitor)
{
	AudienceServicesDirectoryMonitoring * self = NULL;
	g_return_val_if_fail (path != NULL, NULL);
	g_return_val_if_fail (monitor != NULL, NULL);
	self = (AudienceServicesDirectoryMonitoring*) g_object_new (object_type, "path", path, "monitor", monitor, NULL);
	return self;
}

AudienceServicesDirectoryMonitoring*
audience_services_directory_monitoring_new (const gchar* path,
                                            GFileMonitor* monitor)
{
	return audience_services_directory_monitoring_construct (AUDIENCE_SERVICES_TYPE_DIRECTORY_MONITORING, path, monitor);
}

GFileMonitor*
audience_services_directory_monitoring_get_monitor (AudienceServicesDirectoryMonitoring* self)
{
	GFileMonitor* result;
	GFileMonitor* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_monitor;
	result = _tmp0_;
	return result;
}

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

void
audience_services_directory_monitoring_set_monitor (AudienceServicesDirectoryMonitoring* self,
                                                    GFileMonitor* value)
{
	GFileMonitor* old_value;
	g_return_if_fail (self != NULL);
	old_value = audience_services_directory_monitoring_get_monitor (self);
	if (old_value != value) {
		GFileMonitor* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_monitor);
		self->priv->_monitor = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, audience_services_directory_monitoring_properties[AUDIENCE_SERVICES_DIRECTORY_MONITORING_MONITOR_PROPERTY]);
	}
}

const gchar*
audience_services_directory_monitoring_get_path (AudienceServicesDirectoryMonitoring* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_path;
	result = _tmp0_;
	return result;
}

void
audience_services_directory_monitoring_set_path (AudienceServicesDirectoryMonitoring* self,
                                                 const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = audience_services_directory_monitoring_get_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_path);
		self->priv->_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, audience_services_directory_monitoring_properties[AUDIENCE_SERVICES_DIRECTORY_MONITORING_PATH_PROPERTY]);
	}
}

static void
audience_services_directory_monitoring_class_init (AudienceServicesDirectoryMonitoringClass * klass,
                                                   gpointer klass_data)
{
	audience_services_directory_monitoring_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &AudienceServicesDirectoryMonitoring_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_audience_services_directory_monitoring_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_audience_services_directory_monitoring_set_property;
	G_OBJECT_CLASS (klass)->finalize = audience_services_directory_monitoring_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), AUDIENCE_SERVICES_DIRECTORY_MONITORING_MONITOR_PROPERTY, audience_services_directory_monitoring_properties[AUDIENCE_SERVICES_DIRECTORY_MONITORING_MONITOR_PROPERTY] = g_param_spec_object ("monitor", "monitor", "monitor", g_file_monitor_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), AUDIENCE_SERVICES_DIRECTORY_MONITORING_PATH_PROPERTY, audience_services_directory_monitoring_properties[AUDIENCE_SERVICES_DIRECTORY_MONITORING_PATH_PROPERTY] = g_param_spec_string ("path", "path", "path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
audience_services_directory_monitoring_instance_init (AudienceServicesDirectoryMonitoring * self,
                                                      gpointer klass)
{
	self->priv = audience_services_directory_monitoring_get_instance_private (self);
}

static void
audience_services_directory_monitoring_finalize (GObject * obj)
{
	AudienceServicesDirectoryMonitoring * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, AUDIENCE_SERVICES_TYPE_DIRECTORY_MONITORING, AudienceServicesDirectoryMonitoring);
	_g_object_unref0 (self->priv->_monitor);
	_g_free0 (self->priv->_path);
	G_OBJECT_CLASS (audience_services_directory_monitoring_parent_class)->finalize (obj);
}

static GType
audience_services_directory_monitoring_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (AudienceServicesDirectoryMonitoringClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) audience_services_directory_monitoring_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AudienceServicesDirectoryMonitoring), 0, (GInstanceInitFunc) audience_services_directory_monitoring_instance_init, NULL };
	GType audience_services_directory_monitoring_type_id;
	audience_services_directory_monitoring_type_id = g_type_register_static (G_TYPE_OBJECT, "AudienceServicesDirectoryMonitoring", &g_define_type_info, 0);
	AudienceServicesDirectoryMonitoring_private_offset = g_type_add_instance_private (audience_services_directory_monitoring_type_id, sizeof (AudienceServicesDirectoryMonitoringPrivate));
	return audience_services_directory_monitoring_type_id;
}

GType
audience_services_directory_monitoring_get_type (void)
{
	static volatile gsize audience_services_directory_monitoring_type_id__once = 0;
	if (g_once_init_enter (&audience_services_directory_monitoring_type_id__once)) {
		GType audience_services_directory_monitoring_type_id;
		audience_services_directory_monitoring_type_id = audience_services_directory_monitoring_get_type_once ();
		g_once_init_leave (&audience_services_directory_monitoring_type_id__once, audience_services_directory_monitoring_type_id);
	}
	return audience_services_directory_monitoring_type_id__once;
}

static void
_vala_audience_services_directory_monitoring_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec)
{
	AudienceServicesDirectoryMonitoring * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, AUDIENCE_SERVICES_TYPE_DIRECTORY_MONITORING, AudienceServicesDirectoryMonitoring);
	switch (property_id) {
		case AUDIENCE_SERVICES_DIRECTORY_MONITORING_MONITOR_PROPERTY:
		g_value_set_object (value, audience_services_directory_monitoring_get_monitor (self));
		break;
		case AUDIENCE_SERVICES_DIRECTORY_MONITORING_PATH_PROPERTY:
		g_value_set_string (value, audience_services_directory_monitoring_get_path (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_audience_services_directory_monitoring_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec)
{
	AudienceServicesDirectoryMonitoring * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, AUDIENCE_SERVICES_TYPE_DIRECTORY_MONITORING, AudienceServicesDirectoryMonitoring);
	switch (property_id) {
		case AUDIENCE_SERVICES_DIRECTORY_MONITORING_MONITOR_PROPERTY:
		audience_services_directory_monitoring_set_monitor (self, g_value_get_object (value));
		break;
		case AUDIENCE_SERVICES_DIRECTORY_MONITORING_PATH_PROPERTY:
		audience_services_directory_monitoring_set_path (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

