/* data-provider.c generated by valac 0.56.19, the Vala compiler
 * generated from data-provider.vala, do not modify */

/*
 * Zeitgeist
 *
 * Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by Michal Hruby <michal.mhr@gmail.com>
 *
 */

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "zeitgeist-datamodel.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 TYPE_DATA_PROVIDER (data_provider_get_type ())
#define DATA_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_PROVIDER, DataProvider))
#define DATA_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_PROVIDER, DataProviderClass))
#define IS_DATA_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_PROVIDER))
#define IS_DATA_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_PROVIDER))
#define DATA_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_PROVIDER, DataProviderClass))

typedef struct _DataProvider DataProvider;
typedef struct _DataProviderClass DataProviderClass;
typedef struct _DataProviderPrivate DataProviderPrivate;

#define TYPE_DATA_HUB (data_hub_get_type ())
#define DATA_HUB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_HUB, DataHub))
#define DATA_HUB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_HUB, DataHubClass))
#define IS_DATA_HUB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_HUB))
#define IS_DATA_HUB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_HUB))
#define DATA_HUB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_HUB, DataHubClass))

typedef struct _DataHub DataHub;
typedef struct _DataHubClass DataHubClass;
enum  {
	DATA_PROVIDER_0_PROPERTY,
	DATA_PROVIDER_UNIQUE_ID_PROPERTY,
	DATA_PROVIDER_NAME_PROPERTY,
	DATA_PROVIDER_DESCRIPTION_PROPERTY,
	DATA_PROVIDER_DATAHUB_PROPERTY,
	DATA_PROVIDER_ENABLED_PROPERTY,
	DATA_PROVIDER_REGISTER_PROPERTY,
	DATA_PROVIDER_LAST_TIMESTAMP_PROPERTY,
	DATA_PROVIDER_NUM_PROPERTIES
};
static GParamSpec* data_provider_properties[DATA_PROVIDER_NUM_PROPERTIES];
enum  {
	DATA_PROVIDER_ITEMS_AVAILABLE_SIGNAL,
	DATA_PROVIDER_NUM_SIGNALS
};
static guint data_provider_signals[DATA_PROVIDER_NUM_SIGNALS] = {0};

struct _DataProvider {
	GObject parent_instance;
	DataProviderPrivate * priv;
};

struct _DataProviderClass {
	GObjectClass parent_class;
	void (*start) (DataProvider* self);
	void (*stop) (DataProvider* self);
	const gchar* (*get_unique_id) (DataProvider* self);
	void (*set_unique_id) (DataProvider* self, const gchar* value);
	const gchar* (*get_name) (DataProvider* self);
	void (*set_name) (DataProvider* self, const gchar* value);
	const gchar* (*get_description) (DataProvider* self);
	void (*set_description) (DataProvider* self, const gchar* value);
	DataHub* (*get_datahub) (DataProvider* self);
	void (*set_datahub) (DataProvider* self, DataHub* value);
	gboolean (*get_enabled) (DataProvider* self);
	void (*set_enabled) (DataProvider* self, gboolean value);
	gboolean (*get_register) (DataProvider* self);
	void (*set_register) (DataProvider* self, gboolean value);
};

struct _DataProviderPrivate {
	gint64 _last_timestamp;
};

static gint DataProvider_private_offset;
static gpointer data_provider_parent_class = NULL;

VALA_EXTERN GType data_provider_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataProvider, g_object_unref)
VALA_EXTERN GType data_hub_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataHub, g_object_unref)
VALA_EXTERN void data_provider_start (DataProvider* self);
VALA_EXTERN void data_provider_stop (DataProvider* self);
static void data_provider_real_start (DataProvider* self);
static void data_provider_real_stop (DataProvider* self);
VALA_EXTERN DataProvider* data_provider_construct (GType object_type);
VALA_EXTERN const gchar* data_provider_get_unique_id (DataProvider* self);
VALA_EXTERN void data_provider_set_unique_id (DataProvider* self,
                                  const gchar* value);
VALA_EXTERN const gchar* data_provider_get_name (DataProvider* self);
VALA_EXTERN void data_provider_set_name (DataProvider* self,
                             const gchar* value);
VALA_EXTERN const gchar* data_provider_get_description (DataProvider* self);
VALA_EXTERN void data_provider_set_description (DataProvider* self,
                                    const gchar* value);
VALA_EXTERN DataHub* data_provider_get_datahub (DataProvider* self);
VALA_EXTERN void data_provider_set_datahub (DataProvider* self,
                                DataHub* value);
VALA_EXTERN gboolean data_provider_get_enabled (DataProvider* self);
VALA_EXTERN void data_provider_set_enabled (DataProvider* self,
                                gboolean value);
VALA_EXTERN gboolean data_provider_get_register (DataProvider* self);
VALA_EXTERN void data_provider_set_register (DataProvider* self,
                                 gboolean value);
VALA_EXTERN gint64 data_provider_get_last_timestamp (DataProvider* self);
VALA_EXTERN void data_provider_set_last_timestamp (DataProvider* self,
                                       gint64 value);
static void data_provider_finalize (GObject * obj);
static GType data_provider_get_type_once (void);
static void _vala_data_provider_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _vala_data_provider_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec);

static inline gpointer
data_provider_get_instance_private (DataProvider* self)
{
	return G_STRUCT_MEMBER_P (self, DataProvider_private_offset);
}

static void
data_provider_real_start (DataProvider* self)
{
}

void
data_provider_start (DataProvider* self)
{
	DataProviderClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->start) {
		_klass_->start (self);
	}
}

static void
data_provider_real_stop (DataProvider* self)
{
}

void
data_provider_stop (DataProvider* self)
{
	DataProviderClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->stop) {
		_klass_->stop (self);
	}
}

DataProvider*
data_provider_construct (GType object_type)
{
	DataProvider * self = NULL;
	self = (DataProvider*) g_object_new (object_type, NULL);
	return self;
}

const gchar*
data_provider_get_unique_id (DataProvider* self)
{
	DataProviderClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->get_unique_id) {
		return _klass_->get_unique_id (self);
	}
	return NULL;
}

void
data_provider_set_unique_id (DataProvider* self,
                             const gchar* value)
{
	DataProviderClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->set_unique_id) {
		_klass_->set_unique_id (self, value);
	}
}

const gchar*
data_provider_get_name (DataProvider* self)
{
	DataProviderClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->get_name) {
		return _klass_->get_name (self);
	}
	return NULL;
}

void
data_provider_set_name (DataProvider* self,
                        const gchar* value)
{
	DataProviderClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->set_name) {
		_klass_->set_name (self, value);
	}
}

const gchar*
data_provider_get_description (DataProvider* self)
{
	DataProviderClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->get_description) {
		return _klass_->get_description (self);
	}
	return NULL;
}

void
data_provider_set_description (DataProvider* self,
                               const gchar* value)
{
	DataProviderClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->set_description) {
		_klass_->set_description (self, value);
	}
}

DataHub*
data_provider_get_datahub (DataProvider* self)
{
	DataProviderClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->get_datahub) {
		return _klass_->get_datahub (self);
	}
	return NULL;
}

void
data_provider_set_datahub (DataProvider* self,
                           DataHub* value)
{
	DataProviderClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->set_datahub) {
		_klass_->set_datahub (self, value);
	}
}

gboolean
data_provider_get_enabled (DataProvider* self)
{
	DataProviderClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->get_enabled) {
		return _klass_->get_enabled (self);
	}
	return FALSE;
}

void
data_provider_set_enabled (DataProvider* self,
                           gboolean value)
{
	DataProviderClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->set_enabled) {
		_klass_->set_enabled (self, value);
	}
}

gboolean
data_provider_get_register (DataProvider* self)
{
	DataProviderClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->get_register) {
		return _klass_->get_register (self);
	}
	return FALSE;
}

void
data_provider_set_register (DataProvider* self,
                            gboolean value)
{
	DataProviderClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = DATA_PROVIDER_GET_CLASS (self);
	if (_klass_->set_register) {
		_klass_->set_register (self, value);
	}
}

gint64
data_provider_get_last_timestamp (DataProvider* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	result = self->priv->_last_timestamp;
	return result;
}

void
data_provider_set_last_timestamp (DataProvider* self,
                                  gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = data_provider_get_last_timestamp (self);
	if (old_value != value) {
		self->priv->_last_timestamp = value;
		g_object_notify_by_pspec ((GObject *) self, data_provider_properties[DATA_PROVIDER_LAST_TIMESTAMP_PROPERTY]);
	}
}

static void
data_provider_class_init (DataProviderClass * klass,
                          gpointer klass_data)
{
	data_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DataProvider_private_offset);
	((DataProviderClass *) klass)->start = (void (*) (DataProvider*)) data_provider_real_start;
	((DataProviderClass *) klass)->stop = (void (*) (DataProvider*)) data_provider_real_stop;
	G_OBJECT_CLASS (klass)->get_property = _vala_data_provider_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_data_provider_set_property;
	G_OBJECT_CLASS (klass)->finalize = data_provider_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DATA_PROVIDER_UNIQUE_ID_PROPERTY, data_provider_properties[DATA_PROVIDER_UNIQUE_ID_PROPERTY] = g_param_spec_string ("unique-id", "unique-id", "unique-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DATA_PROVIDER_NAME_PROPERTY, data_provider_properties[DATA_PROVIDER_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DATA_PROVIDER_DESCRIPTION_PROPERTY, data_provider_properties[DATA_PROVIDER_DESCRIPTION_PROPERTY] = g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DATA_PROVIDER_DATAHUB_PROPERTY, data_provider_properties[DATA_PROVIDER_DATAHUB_PROPERTY] = g_param_spec_object ("datahub", "datahub", "datahub", TYPE_DATA_HUB, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DATA_PROVIDER_ENABLED_PROPERTY, data_provider_properties[DATA_PROVIDER_ENABLED_PROPERTY] = g_param_spec_boolean ("enabled", "enabled", "enabled", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DATA_PROVIDER_REGISTER_PROPERTY, data_provider_properties[DATA_PROVIDER_REGISTER_PROPERTY] = g_param_spec_boolean ("register", "register", "register", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DATA_PROVIDER_LAST_TIMESTAMP_PROPERTY, data_provider_properties[DATA_PROVIDER_LAST_TIMESTAMP_PROPERTY] = g_param_spec_int64 ("last-timestamp", "last-timestamp", "last-timestamp", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	data_provider_signals[DATA_PROVIDER_ITEMS_AVAILABLE_SIGNAL] = g_signal_new ("items-available", TYPE_DATA_PROVIDER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, G_TYPE_PTR_ARRAY);
}

static void
data_provider_instance_init (DataProvider * self,
                             gpointer klass)
{
	self->priv = data_provider_get_instance_private (self);
}

static void
data_provider_finalize (GObject * obj)
{
	DataProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_DATA_PROVIDER, DataProvider);
	G_OBJECT_CLASS (data_provider_parent_class)->finalize (obj);
}

static GType
data_provider_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DataProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) data_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DataProvider), 0, (GInstanceInitFunc) data_provider_instance_init, NULL };
	GType data_provider_type_id;
	data_provider_type_id = g_type_register_static (G_TYPE_OBJECT, "DataProvider", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	DataProvider_private_offset = g_type_add_instance_private (data_provider_type_id, sizeof (DataProviderPrivate));
	return data_provider_type_id;
}

GType
data_provider_get_type (void)
{
	static volatile gsize data_provider_type_id__once = 0;
	if (g_once_init_enter (&data_provider_type_id__once)) {
		GType data_provider_type_id;
		data_provider_type_id = data_provider_get_type_once ();
		g_once_init_leave (&data_provider_type_id__once, data_provider_type_id);
	}
	return data_provider_type_id__once;
}

static void
_vala_data_provider_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	DataProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_DATA_PROVIDER, DataProvider);
	switch (property_id) {
		case DATA_PROVIDER_LAST_TIMESTAMP_PROPERTY:
		g_value_set_int64 (value, data_provider_get_last_timestamp (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_data_provider_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	DataProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_DATA_PROVIDER, DataProvider);
	switch (property_id) {
		case DATA_PROVIDER_LAST_TIMESTAMP_PROPERTY:
		data_provider_set_last_timestamp (self, g_value_get_int64 (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

