/* media.c generated by valac 0.35.5, the Vala compiler
 * generated from media.vala, do not modify */

/* This file is part of GNOME Games. License: GPLv3*/

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


#define GAMES_TYPE_MEDIA (games_media_get_type ())
#define GAMES_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_MEDIA, GamesMedia))
#define GAMES_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_MEDIA, GamesMediaClass))
#define GAMES_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_MEDIA))
#define GAMES_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_MEDIA))
#define GAMES_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_MEDIA, GamesMediaClass))

typedef struct _GamesMedia GamesMedia;
typedef struct _GamesMediaClass GamesMediaClass;
typedef struct _GamesMediaPrivate GamesMediaPrivate;

#define GAMES_TYPE_TITLE (games_title_get_type ())
#define GAMES_TITLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_TITLE, GamesTitle))
#define GAMES_IS_TITLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_TITLE))
#define GAMES_TITLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_TITLE, GamesTitleIface))

typedef struct _GamesTitle GamesTitle;
typedef struct _GamesTitleIface GamesTitleIface;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GamesMedia {
	GObject parent_instance;
	GamesMediaPrivate * priv;
};

struct _GamesMediaClass {
	GObjectClass parent_class;
};

struct _GamesTitleIface {
	GTypeInterface parent_iface;
	gchar* (*get_title) (GamesTitle* self, GError** error);
};

struct _GamesMediaPrivate {
	GamesTitle* _title;
	gchar* _uri;
};


static gpointer games_media_parent_class = NULL;

GType games_media_get_type (void) G_GNUC_CONST;
GType games_title_get_type (void) G_GNUC_CONST;
#define GAMES_MEDIA_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_MEDIA, GamesMediaPrivate))
enum  {
	GAMES_MEDIA_DUMMY_PROPERTY,
	GAMES_MEDIA_TITLE,
	GAMES_MEDIA_URI
};
GamesMedia* games_media_new (const gchar* uri, GamesTitle* title);
GamesMedia* games_media_construct (GType object_type, const gchar* uri, GamesTitle* title);
GamesTitle* games_media_get_title (GamesMedia* self);
static void games_media_set_title (GamesMedia* self, GamesTitle* value);
const gchar* games_media_get_uri (GamesMedia* self);
static void games_media_set_uri (GamesMedia* self, const gchar* value);
static void games_media_finalize (GObject * obj);
static void _vala_games_media_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_games_media_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GamesMedia* games_media_construct (GType object_type, const gchar* uri, GamesTitle* title) {
	GamesMedia * self = NULL;
	GamesTitle* _tmp0_;
	const gchar* _tmp1_;
	g_return_val_if_fail (uri != NULL, NULL);
	_tmp0_ = title;
	_tmp1_ = uri;
	self = (GamesMedia*) g_object_new (object_type, "title", _tmp0_, "uri", _tmp1_, NULL);
	return self;
}


GamesMedia* games_media_new (const gchar* uri, GamesTitle* title) {
	return games_media_construct (GAMES_TYPE_MEDIA, uri, title);
}


GamesTitle* games_media_get_title (GamesMedia* self) {
	GamesTitle* result;
	GamesTitle* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_title;
	result = _tmp0_;
	return result;
}


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


static void games_media_set_title (GamesMedia* self, GamesTitle* value) {
	g_return_if_fail (self != NULL);
	if (games_media_get_title (self) != value) {
		GamesTitle* _tmp0_;
		GamesTitle* _tmp1_;
		_tmp0_ = value;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_g_object_unref0 (self->priv->_title);
		self->priv->_title = _tmp1_;
		g_object_notify ((GObject *) self, "title");
	}
}


const gchar* games_media_get_uri (GamesMedia* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_uri;
	result = _tmp0_;
	return result;
}


static void games_media_set_uri (GamesMedia* self, const gchar* value) {
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (value, games_media_get_uri (self)) != 0) {
		const gchar* _tmp0_;
		gchar* _tmp1_;
		_tmp0_ = value;
		_tmp1_ = g_strdup (_tmp0_);
		_g_free0 (self->priv->_uri);
		self->priv->_uri = _tmp1_;
		g_object_notify ((GObject *) self, "uri");
	}
}


static void games_media_class_init (GamesMediaClass * klass) {
	games_media_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesMediaPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_games_media_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_media_set_property;
	G_OBJECT_CLASS (klass)->finalize = games_media_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_MEDIA_TITLE, g_param_spec_object ("title", "title", "title", GAMES_TYPE_TITLE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_MEDIA_URI, g_param_spec_string ("uri", "uri", "uri", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}


static void games_media_instance_init (GamesMedia * self) {
	self->priv = GAMES_MEDIA_GET_PRIVATE (self);
}


static void games_media_finalize (GObject * obj) {
	GamesMedia * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_MEDIA, GamesMedia);
	_g_object_unref0 (self->priv->_title);
	_g_free0 (self->priv->_uri);
	G_OBJECT_CLASS (games_media_parent_class)->finalize (obj);
}


GType games_media_get_type (void) {
	static volatile gsize games_media_type_id__volatile = 0;
	if (g_once_init_enter (&games_media_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesMediaClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_media_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesMedia), 0, (GInstanceInitFunc) games_media_instance_init, NULL };
		GType games_media_type_id;
		games_media_type_id = g_type_register_static (G_TYPE_OBJECT, "GamesMedia", &g_define_type_info, 0);
		g_once_init_leave (&games_media_type_id__volatile, games_media_type_id);
	}
	return games_media_type_id__volatile;
}


static void _vala_games_media_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GamesMedia * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_MEDIA, GamesMedia);
	switch (property_id) {
		case GAMES_MEDIA_TITLE:
		g_value_set_object (value, games_media_get_title (self));
		break;
		case GAMES_MEDIA_URI:
		g_value_set_string (value, games_media_get_uri (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_games_media_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GamesMedia * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_MEDIA, GamesMedia);
	switch (property_id) {
		case GAMES_MEDIA_TITLE:
		games_media_set_title (self, g_value_get_object (value));
		break;
		case GAMES_MEDIA_URI:
		games_media_set_uri (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



