/* rygel-tracker-albums.c generated by valac 0.15.1.36-84b2b, the Vala compiler
 * generated from rygel-tracker-albums.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_ALBUMS (rygel_tracker_albums_get_type ())
#define RYGEL_TRACKER_ALBUMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_ALBUMS, RygelTrackerAlbums))
#define RYGEL_TRACKER_ALBUMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_ALBUMS, RygelTrackerAlbumsClass))
#define RYGEL_TRACKER_IS_ALBUMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_ALBUMS))
#define RYGEL_TRACKER_IS_ALBUMS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_ALBUMS))
#define RYGEL_TRACKER_ALBUMS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_ALBUMS, RygelTrackerAlbumsClass))

typedef struct _RygelTrackerAlbums RygelTrackerAlbums;
typedef struct _RygelTrackerAlbumsClass RygelTrackerAlbumsClass;
typedef struct _RygelTrackerAlbumsPrivate RygelTrackerAlbumsPrivate;

#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 _RygelTrackerAlbums {
	RygelTrackerMetadataValues parent_instance;
	RygelTrackerAlbumsPrivate * priv;
};

struct _RygelTrackerAlbumsClass {
	RygelTrackerMetadataValuesClass parent_class;
};

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

struct _RygelTrackerCategoryContainerClass {
	RygelSimpleContainerClass parent_class;
};


static gpointer rygel_tracker_albums_parent_class = NULL;

GType rygel_tracker_metadata_values_get_type (void) G_GNUC_CONST;
GType rygel_tracker_albums_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_TRACKER_ALBUMS_DUMMY_PROPERTY
};
GType rygel_tracker_category_container_get_type (void) G_GNUC_CONST;
GType rygel_tracker_music_get_type (void) G_GNUC_CONST;
RygelTrackerAlbums* rygel_tracker_albums_new (RygelTrackerMusic* parent);
RygelTrackerAlbums* rygel_tracker_albums_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);


RygelTrackerAlbums* rygel_tracker_albums_construct (GType object_type, RygelTrackerMusic* parent) {
	RygelTrackerAlbums * self = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_ = NULL;
	gchar** key_chain;
	gint key_chain_length1;
	gint _key_chain_size_;
	RygelTrackerMusic* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	RygelTrackerMusic* _tmp7_;
	const gchar* _tmp8_ = NULL;
	RygelTrackerMusic* _tmp9_;
	RygelTrackerItemFactory* _tmp10_;
	g_return_val_if_fail (parent != NULL, NULL);
	_tmp0_ = g_strdup ("nmm:musicAlbum");
	_tmp1_ = g_strdup ("nmm:albumTitle");
	_tmp2_ = g_new0 (gchar*, 3 + 1);
	_tmp2_[0] = _tmp0_;
	_tmp2_[1] = _tmp1_;
	_tmp2_[2] = NULL;
	key_chain = _tmp2_;
	key_chain_length1 = 3;
	_key_chain_size_ = key_chain_length1;
	_tmp3_ = parent;
	_tmp4_ = ((RygelMediaObject*) _tmp3_)->id;
	_tmp5_ = g_strconcat (_tmp4_, "Albums", NULL);
	_tmp6_ = _tmp5_;
	_tmp7_ = parent;
	_tmp8_ = _ ("Albums");
	_tmp9_ = parent;
	_tmp10_ = ((RygelTrackerCategoryContainer*) _tmp9_)->item_factory;
	self = (RygelTrackerAlbums*) rygel_tracker_metadata_values_construct (object_type, _tmp6_, (RygelMediaContainer*) _tmp7_, _tmp8_, _tmp10_, key_chain, key_chain_length1, RYGEL_MEDIA_CONTAINER_MUSIC_ALBUM);
	_g_free0 (_tmp6_);
	key_chain = (_vala_array_free (key_chain, key_chain_length1, (GDestroyNotify) g_free), NULL);
	return self;
}


RygelTrackerAlbums* rygel_tracker_albums_new (RygelTrackerMusic* parent) {
	return rygel_tracker_albums_construct (RYGEL_TRACKER_TYPE_ALBUMS, parent);
}


static void rygel_tracker_albums_class_init (RygelTrackerAlbumsClass * klass) {
	rygel_tracker_albums_parent_class = g_type_class_peek_parent (klass);
}


static void rygel_tracker_albums_instance_init (RygelTrackerAlbums * self) {
}


/**
 * Container listing Music albums as containers.
 */
GType rygel_tracker_albums_get_type (void) {
	static volatile gsize rygel_tracker_albums_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_tracker_albums_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelTrackerAlbumsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_tracker_albums_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelTrackerAlbums), 0, (GInstanceInitFunc) rygel_tracker_albums_instance_init, NULL };
		GType rygel_tracker_albums_type_id;
		rygel_tracker_albums_type_id = g_type_register_static (RYGEL_TRACKER_TYPE_METADATA_VALUES, "RygelTrackerAlbums", &g_define_type_info, 0);
		g_once_init_leave (&rygel_tracker_albums_type_id__volatile, rygel_tracker_albums_type_id);
	}
	return rygel_tracker_albums_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);
}



