/* rygel-tracker-genre.c generated by valac 0.15.1.36-84b2b, the Vala compiler
 * generated from rygel-tracker-genre.vala, do not modify */

/*
 * Copyright (C) 2009,2010 Nokia Corporation.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.com>
 *
 * This file is part of Rygel.
 *
 * Rygel 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 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel 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, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#include <glib.h>
#include <glib-object.h>
#include <rygel.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>


#define RYGEL_TRACKER_TYPE_METADATA_VALUES (rygel_tracker_metadata_values_get_type ())
#define RYGEL_TRACKER_METADATA_VALUES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_METADATA_VALUES, RygelTrackerMetadataValues))
#define RYGEL_TRACKER_METADATA_VALUES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_METADATA_VALUES, RygelTrackerMetadataValuesClass))
#define RYGEL_TRACKER_IS_METADATA_VALUES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_METADATA_VALUES))
#define RYGEL_TRACKER_IS_METADATA_VALUES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_METADATA_VALUES))
#define RYGEL_TRACKER_METADATA_VALUES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_METADATA_VALUES, RygelTrackerMetadataValuesClass))

typedef struct _RygelTrackerMetadataValues RygelTrackerMetadataValues;
typedef struct _RygelTrackerMetadataValuesClass RygelTrackerMetadataValuesClass;
typedef struct _RygelTrackerMetadataValuesPrivate RygelTrackerMetadataValuesPrivate;

#define RYGEL_TRACKER_TYPE_GENRE (rygel_tracker_genre_get_type ())
#define RYGEL_TRACKER_GENRE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_GENRE, RygelTrackerGenre))
#define RYGEL_TRACKER_GENRE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_GENRE, RygelTrackerGenreClass))
#define RYGEL_TRACKER_IS_GENRE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_GENRE))
#define RYGEL_TRACKER_IS_GENRE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_GENRE))
#define RYGEL_TRACKER_GENRE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_GENRE, RygelTrackerGenreClass))

typedef struct _RygelTrackerGenre RygelTrackerGenre;
typedef struct _RygelTrackerGenreClass RygelTrackerGenreClass;
typedef struct _RygelTrackerGenrePrivate RygelTrackerGenrePrivate;

#define RYGEL_TRACKER_TYPE_CATEGORY_CONTAINER (rygel_tracker_category_container_get_type ())
#define RYGEL_TRACKER_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_CATEGORY_CONTAINER, RygelTrackerCategoryContainer))
#define RYGEL_TRACKER_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_CATEGORY_CONTAINER, RygelTrackerCategoryContainerClass))
#define RYGEL_TRACKER_IS_CATEGORY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_CATEGORY_CONTAINER))
#define RYGEL_TRACKER_IS_CATEGORY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_CATEGORY_CONTAINER))
#define RYGEL_TRACKER_CATEGORY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_CATEGORY_CONTAINER, RygelTrackerCategoryContainerClass))

typedef struct _RygelTrackerCategoryContainer RygelTrackerCategoryContainer;
typedef struct _RygelTrackerCategoryContainerClass RygelTrackerCategoryContainerClass;

#define RYGEL_TRACKER_TYPE_MUSIC (rygel_tracker_music_get_type ())
#define RYGEL_TRACKER_MUSIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_MUSIC, RygelTrackerMusic))
#define RYGEL_TRACKER_MUSIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_MUSIC, RygelTrackerMusicClass))
#define RYGEL_TRACKER_IS_MUSIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_MUSIC))
#define RYGEL_TRACKER_IS_MUSIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_MUSIC))
#define RYGEL_TRACKER_MUSIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_MUSIC, RygelTrackerMusicClass))

typedef struct _RygelTrackerMusic RygelTrackerMusic;
typedef struct _RygelTrackerMusicClass RygelTrackerMusicClass;
typedef struct _RygelTrackerCategoryContainerPrivate RygelTrackerCategoryContainerPrivate;

#define RYGEL_TRACKER_TYPE_ITEM_FACTORY (rygel_tracker_item_factory_get_type ())
#define RYGEL_TRACKER_ITEM_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_ITEM_FACTORY, RygelTrackerItemFactory))
#define RYGEL_TRACKER_ITEM_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_ITEM_FACTORY, RygelTrackerItemFactoryClass))
#define RYGEL_TRACKER_IS_ITEM_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_ITEM_FACTORY))
#define RYGEL_TRACKER_IS_ITEM_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_ITEM_FACTORY))
#define RYGEL_TRACKER_ITEM_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_ITEM_FACTORY, RygelTrackerItemFactoryClass))

typedef struct _RygelTrackerItemFactory RygelTrackerItemFactory;
typedef struct _RygelTrackerItemFactoryClass RygelTrackerItemFactoryClass;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _RygelTrackerMetadataValues {
	RygelSimpleContainer parent_instance;
	RygelTrackerMetadataValuesPrivate * priv;
	gchar** key_chain;
	gint key_chain_length1;
};

struct _RygelTrackerMetadataValuesClass {
	RygelSimpleContainerClass parent_class;
	gchar* (*create_id_for_title) (RygelTrackerMetadataValues* self, const gchar* title);
	gchar* (*create_title_for_value) (RygelTrackerMetadataValues* self, const gchar* value);
	gchar* (*create_filter) (RygelTrackerMetadataValues* self, const gchar* variable, const gchar* value);
};

struct _RygelTrackerGenre {
	RygelTrackerMetadataValues parent_instance;
	RygelTrackerGenrePrivate * priv;
};

struct _RygelTrackerGenreClass {
	RygelTrackerMetadataValuesClass parent_class;
};

struct _RygelTrackerCategoryContainer {
	RygelSimpleContainer parent_instance;
	RygelTrackerCategoryContainerPrivate * priv;
	RygelTrackerItemFactory* item_factory;
};

struct _RygelTrackerCategoryContainerClass {
	RygelSimpleContainerClass parent_class;
};


static gpointer rygel_tracker_genre_parent_class = NULL;

GType rygel_tracker_metadata_values_get_type (void) G_GNUC_CONST;
GType rygel_tracker_genre_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_TRACKER_GENRE_DUMMY_PROPERTY
};
GType rygel_tracker_category_container_get_type (void) G_GNUC_CONST;
GType rygel_tracker_music_get_type (void) G_GNUC_CONST;
RygelTrackerGenre* rygel_tracker_genre_new (RygelTrackerMusic* parent);
RygelTrackerGenre* rygel_tracker_genre_construct (GType object_type, RygelTrackerMusic* parent);
gpointer rygel_tracker_item_factory_ref (gpointer instance);
void rygel_tracker_item_factory_unref (gpointer instance);
GParamSpec* rygel_tracker_param_spec_item_factory (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void rygel_tracker_value_set_item_factory (GValue* value, gpointer v_object);
void rygel_tracker_value_take_item_factory (GValue* value, gpointer v_object);
gpointer rygel_tracker_value_get_item_factory (const GValue* value);
GType rygel_tracker_item_factory_get_type (void) G_GNUC_CONST;
RygelTrackerMetadataValues* rygel_tracker_metadata_values_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, RygelTrackerItemFactory* item_factory, gchar** key_chain, int key_chain_length1, const gchar* child_class);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


RygelTrackerGenre* rygel_tracker_genre_construct (GType object_type, RygelTrackerMusic* parent) {
	RygelTrackerGenre * self = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_ = NULL;
	gchar** key_chain;
	gint key_chain_length1;
	gint _key_chain_size_;
	RygelTrackerMusic* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	RygelTrackerMusic* _tmp6_;
	const gchar* _tmp7_ = NULL;
	RygelTrackerMusic* _tmp8_;
	RygelTrackerItemFactory* _tmp9_;
	g_return_val_if_fail (parent != NULL, NULL);
	_tmp0_ = g_strdup ("nfo:genre");
	_tmp1_ = g_new0 (gchar*, 2 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp1_[1] = NULL;
	key_chain = _tmp1_;
	key_chain_length1 = 2;
	_key_chain_size_ = key_chain_length1;
	_tmp2_ = parent;
	_tmp3_ = ((RygelMediaObject*) _tmp2_)->id;
	_tmp4_ = g_strconcat (_tmp3_, "Genre", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = parent;
	_tmp7_ = _ ("Genre");
	_tmp8_ = parent;
	_tmp9_ = ((RygelTrackerCategoryContainer*) _tmp8_)->item_factory;
	self = (RygelTrackerGenre*) rygel_tracker_metadata_values_construct (object_type, _tmp5_, (RygelMediaContainer*) _tmp6_, _tmp7_, _tmp9_, key_chain, key_chain_length1, RYGEL_MEDIA_CONTAINER_MUSIC_GENRE);
	_g_free0 (_tmp5_);
	key_chain = (_vala_array_free (key_chain, key_chain_length1, (GDestroyNotify) g_free), NULL);
	return self;
}


RygelTrackerGenre* rygel_tracker_genre_new (RygelTrackerMusic* parent) {
	return rygel_tracker_genre_construct (RYGEL_TRACKER_TYPE_GENRE, parent);
}


static void rygel_tracker_genre_class_init (RygelTrackerGenreClass * klass) {
	rygel_tracker_genre_parent_class = g_type_class_peek_parent (klass);
}


static void rygel_tracker_genre_instance_init (RygelTrackerGenre * self) {
}


/**
 * Container listing music genres as containers.
 */
GType rygel_tracker_genre_get_type (void) {
	static volatile gsize rygel_tracker_genre_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_tracker_genre_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelTrackerGenreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_tracker_genre_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelTrackerGenre), 0, (GInstanceInitFunc) rygel_tracker_genre_instance_init, NULL };
		GType rygel_tracker_genre_type_id;
		rygel_tracker_genre_type_id = g_type_register_static (RYGEL_TRACKER_TYPE_METADATA_VALUES, "RygelTrackerGenre", &g_define_type_info, 0);
		g_once_init_leave (&rygel_tracker_genre_type_id__volatile, rygel_tracker_genre_type_id);
	}
	return rygel_tracker_genre_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



