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

/*
* Copyright 2019 elementary, Inc. (https://elementary.io)
*
* 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, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <pango/pango.h>
#include <granite-7.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_WIDGETS_TYPE_PLAYLIST_ITEM (audience_widgets_playlist_item_get_type ())
#define AUDIENCE_WIDGETS_PLAYLIST_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AUDIENCE_WIDGETS_TYPE_PLAYLIST_ITEM, AudienceWidgetsPlaylistItem))
#define AUDIENCE_WIDGETS_PLAYLIST_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AUDIENCE_WIDGETS_TYPE_PLAYLIST_ITEM, AudienceWidgetsPlaylistItemClass))
#define AUDIENCE_WIDGETS_IS_PLAYLIST_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AUDIENCE_WIDGETS_TYPE_PLAYLIST_ITEM))
#define AUDIENCE_WIDGETS_IS_PLAYLIST_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AUDIENCE_WIDGETS_TYPE_PLAYLIST_ITEM))
#define AUDIENCE_WIDGETS_PLAYLIST_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AUDIENCE_WIDGETS_TYPE_PLAYLIST_ITEM, AudienceWidgetsPlaylistItemClass))

typedef struct _AudienceWidgetsPlaylistItem AudienceWidgetsPlaylistItem;
typedef struct _AudienceWidgetsPlaylistItemClass AudienceWidgetsPlaylistItemClass;
typedef struct _AudienceWidgetsPlaylistItemPrivate AudienceWidgetsPlaylistItemPrivate;
enum  {
	AUDIENCE_WIDGETS_PLAYLIST_ITEM_0_PROPERTY,
	AUDIENCE_WIDGETS_PLAYLIST_ITEM_IS_PLAYING_PROPERTY,
	AUDIENCE_WIDGETS_PLAYLIST_ITEM_TITLE_PROPERTY,
	AUDIENCE_WIDGETS_PLAYLIST_ITEM_FILENAME_PROPERTY,
	AUDIENCE_WIDGETS_PLAYLIST_ITEM_NUM_PROPERTIES
};
static GParamSpec* audience_widgets_playlist_item_properties[AUDIENCE_WIDGETS_PLAYLIST_ITEM_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _AudienceWidgetsPlaylistItem {
	GtkListBoxRow parent_instance;
	AudienceWidgetsPlaylistItemPrivate * priv;
};

struct _AudienceWidgetsPlaylistItemClass {
	GtkListBoxRowClass parent_class;
};

struct _AudienceWidgetsPlaylistItemPrivate {
	gboolean _is_playing;
	gchar* _title;
	gchar* _filename;
};

static gint AudienceWidgetsPlaylistItem_private_offset;
static gpointer audience_widgets_playlist_item_parent_class = NULL;

VALA_EXTERN GType audience_widgets_playlist_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AudienceWidgetsPlaylistItem, g_object_unref)
VALA_EXTERN AudienceWidgetsPlaylistItem* audience_widgets_playlist_item_new (const gchar* title,
                                                                 const gchar* filename);
VALA_EXTERN AudienceWidgetsPlaylistItem* audience_widgets_playlist_item_construct (GType object_type,
                                                                       const gchar* title,
                                                                       const gchar* filename);
VALA_EXTERN gboolean audience_widgets_playlist_item_get_is_playing (AudienceWidgetsPlaylistItem* self);
VALA_EXTERN void audience_widgets_playlist_item_set_is_playing (AudienceWidgetsPlaylistItem* self,
                                                    gboolean value);
VALA_EXTERN const gchar* audience_widgets_playlist_item_get_title (AudienceWidgetsPlaylistItem* self);
static void audience_widgets_playlist_item_set_title (AudienceWidgetsPlaylistItem* self,
                                               const gchar* value);
VALA_EXTERN const gchar* audience_widgets_playlist_item_get_filename (AudienceWidgetsPlaylistItem* self);
static void audience_widgets_playlist_item_set_filename (AudienceWidgetsPlaylistItem* self,
                                                  const gchar* value);
static GObject * audience_widgets_playlist_item_constructor (GType type,
                                                      guint n_construct_properties,
                                                      GObjectConstructParam * construct_properties);
static void audience_widgets_playlist_item_finalize (GObject * obj);
static GType audience_widgets_playlist_item_get_type_once (void);
static void _vala_audience_widgets_playlist_item_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec);
static void _vala_audience_widgets_playlist_item_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec);

static inline gpointer
audience_widgets_playlist_item_get_instance_private (AudienceWidgetsPlaylistItem* self)
{
	return G_STRUCT_MEMBER_P (self, AudienceWidgetsPlaylistItem_private_offset);
}

AudienceWidgetsPlaylistItem*
audience_widgets_playlist_item_construct (GType object_type,
                                          const gchar* title,
                                          const gchar* filename)
{
	AudienceWidgetsPlaylistItem * self = NULL;
	g_return_val_if_fail (title != NULL, NULL);
	g_return_val_if_fail (filename != NULL, NULL);
	self = (AudienceWidgetsPlaylistItem*) g_object_new (object_type, "title", title, "filename", filename, NULL);
	return self;
}

AudienceWidgetsPlaylistItem*
audience_widgets_playlist_item_new (const gchar* title,
                                    const gchar* filename)
{
	return audience_widgets_playlist_item_construct (AUDIENCE_WIDGETS_TYPE_PLAYLIST_ITEM, title, filename);
}

gboolean
audience_widgets_playlist_item_get_is_playing (AudienceWidgetsPlaylistItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_playing;
	return result;
}

void
audience_widgets_playlist_item_set_is_playing (AudienceWidgetsPlaylistItem* self,
                                               gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = audience_widgets_playlist_item_get_is_playing (self);
	if (old_value != value) {
		self->priv->_is_playing = value;
		g_object_notify_by_pspec ((GObject *) self, audience_widgets_playlist_item_properties[AUDIENCE_WIDGETS_PLAYLIST_ITEM_IS_PLAYING_PROPERTY]);
	}
}

const gchar*
audience_widgets_playlist_item_get_title (AudienceWidgetsPlaylistItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_title;
	result = _tmp0_;
	return result;
}

static void
audience_widgets_playlist_item_set_title (AudienceWidgetsPlaylistItem* self,
                                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = audience_widgets_playlist_item_get_title (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_title);
		self->priv->_title = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, audience_widgets_playlist_item_properties[AUDIENCE_WIDGETS_PLAYLIST_ITEM_TITLE_PROPERTY]);
	}
}

const gchar*
audience_widgets_playlist_item_get_filename (AudienceWidgetsPlaylistItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_filename;
	result = _tmp0_;
	return result;
}

static void
audience_widgets_playlist_item_set_filename (AudienceWidgetsPlaylistItem* self,
                                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = audience_widgets_playlist_item_get_filename (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_filename);
		self->priv->_filename = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, audience_widgets_playlist_item_properties[AUDIENCE_WIDGETS_PLAYLIST_ITEM_FILENAME_PROPERTY]);
	}
}

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

static GObject *
audience_widgets_playlist_item_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	AudienceWidgetsPlaylistItem * self;
	GtkImage* play_icon = NULL;
	GtkImage* _tmp0_;
	GtkRevealer* play_revealer = NULL;
	GtkImage* _tmp1_;
	GtkWidget* _tmp2_;
	GtkRevealer* _tmp3_ = NULL;
	GtkLabel* track_name_label = NULL;
	const gchar* _tmp4_;
	GtkLabel* _tmp5_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp6_;
	GtkBox* _tmp7_;
	GtkBox* _tmp8_;
	GtkRevealer* _tmp9_;
	GtkBox* _tmp10_;
	GtkLabel* _tmp11_;
	const gchar* _tmp12_;
	GtkBox* _tmp13_;
	GtkRevealer* _tmp14_;
	parent_class = G_OBJECT_CLASS (audience_widgets_playlist_item_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, AUDIENCE_WIDGETS_TYPE_PLAYLIST_ITEM, AudienceWidgetsPlaylistItem);
	_tmp0_ = (GtkImage*) gtk_image_new_from_icon_name ("media-playback-start-symbolic");
	g_object_ref_sink (_tmp0_);
	play_icon = _tmp0_;
	_tmp1_ = play_icon;
	_tmp2_ = _g_object_ref0 ((GtkWidget*) _tmp1_);
	_tmp3_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_child (_tmp3_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	gtk_revealer_set_transition_type (_tmp3_, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
	g_object_ref_sink (_tmp3_);
	play_revealer = _tmp3_;
	_tmp4_ = self->priv->_title;
	_tmp5_ = (GtkLabel*) gtk_label_new (_tmp4_);
	gtk_label_set_ellipsize (_tmp5_, PANGO_ELLIPSIZE_MIDDLE);
	g_object_ref_sink (_tmp5_);
	track_name_label = _tmp5_;
	_tmp6_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp6_);
	box = _tmp6_;
	_tmp7_ = box;
	gtk_widget_add_css_class ((GtkWidget*) _tmp7_, GRANITE_STYLE_CLASS_MENUITEM);
	_tmp8_ = box;
	_tmp9_ = play_revealer;
	gtk_box_append (_tmp8_, (GtkWidget*) _tmp9_);
	_tmp10_ = box;
	_tmp11_ = track_name_label;
	gtk_box_append (_tmp10_, (GtkWidget*) _tmp11_);
	_tmp12_ = self->priv->_title;
	gtk_widget_set_tooltip_text ((GtkWidget*) self, _tmp12_);
	_tmp13_ = box;
	gtk_list_box_row_set_child ((GtkListBoxRow*) self, (GtkWidget*) _tmp13_);
	_tmp14_ = play_revealer;
	g_object_bind_property_with_closures ((GObject*) self, "is-playing", (GObject*) _tmp14_, "reveal-child", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_g_object_unref0 (box);
	_g_object_unref0 (track_name_label);
	_g_object_unref0 (play_revealer);
	_g_object_unref0 (play_icon);
	return obj;
}

static void
audience_widgets_playlist_item_class_init (AudienceWidgetsPlaylistItemClass * klass,
                                           gpointer klass_data)
{
	audience_widgets_playlist_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &AudienceWidgetsPlaylistItem_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_audience_widgets_playlist_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_audience_widgets_playlist_item_set_property;
	G_OBJECT_CLASS (klass)->constructor = audience_widgets_playlist_item_constructor;
	G_OBJECT_CLASS (klass)->finalize = audience_widgets_playlist_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), AUDIENCE_WIDGETS_PLAYLIST_ITEM_IS_PLAYING_PROPERTY, audience_widgets_playlist_item_properties[AUDIENCE_WIDGETS_PLAYLIST_ITEM_IS_PLAYING_PROPERTY] = g_param_spec_boolean ("is-playing", "is-playing", "is-playing", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), AUDIENCE_WIDGETS_PLAYLIST_ITEM_TITLE_PROPERTY, audience_widgets_playlist_item_properties[AUDIENCE_WIDGETS_PLAYLIST_ITEM_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), AUDIENCE_WIDGETS_PLAYLIST_ITEM_FILENAME_PROPERTY, audience_widgets_playlist_item_properties[AUDIENCE_WIDGETS_PLAYLIST_ITEM_FILENAME_PROPERTY] = g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
audience_widgets_playlist_item_instance_init (AudienceWidgetsPlaylistItem * self,
                                              gpointer klass)
{
	self->priv = audience_widgets_playlist_item_get_instance_private (self);
}

static void
audience_widgets_playlist_item_finalize (GObject * obj)
{
	AudienceWidgetsPlaylistItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, AUDIENCE_WIDGETS_TYPE_PLAYLIST_ITEM, AudienceWidgetsPlaylistItem);
	_g_free0 (self->priv->_title);
	_g_free0 (self->priv->_filename);
	G_OBJECT_CLASS (audience_widgets_playlist_item_parent_class)->finalize (obj);
}

static GType
audience_widgets_playlist_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (AudienceWidgetsPlaylistItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) audience_widgets_playlist_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AudienceWidgetsPlaylistItem), 0, (GInstanceInitFunc) audience_widgets_playlist_item_instance_init, NULL };
	GType audience_widgets_playlist_item_type_id;
	audience_widgets_playlist_item_type_id = g_type_register_static (gtk_list_box_row_get_type (), "AudienceWidgetsPlaylistItem", &g_define_type_info, 0);
	AudienceWidgetsPlaylistItem_private_offset = g_type_add_instance_private (audience_widgets_playlist_item_type_id, sizeof (AudienceWidgetsPlaylistItemPrivate));
	return audience_widgets_playlist_item_type_id;
}

GType
audience_widgets_playlist_item_get_type (void)
{
	static volatile gsize audience_widgets_playlist_item_type_id__once = 0;
	if (g_once_init_enter (&audience_widgets_playlist_item_type_id__once)) {
		GType audience_widgets_playlist_item_type_id;
		audience_widgets_playlist_item_type_id = audience_widgets_playlist_item_get_type_once ();
		g_once_init_leave (&audience_widgets_playlist_item_type_id__once, audience_widgets_playlist_item_type_id);
	}
	return audience_widgets_playlist_item_type_id__once;
}

static void
_vala_audience_widgets_playlist_item_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec)
{
	AudienceWidgetsPlaylistItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, AUDIENCE_WIDGETS_TYPE_PLAYLIST_ITEM, AudienceWidgetsPlaylistItem);
	switch (property_id) {
		case AUDIENCE_WIDGETS_PLAYLIST_ITEM_IS_PLAYING_PROPERTY:
		g_value_set_boolean (value, audience_widgets_playlist_item_get_is_playing (self));
		break;
		case AUDIENCE_WIDGETS_PLAYLIST_ITEM_TITLE_PROPERTY:
		g_value_set_string (value, audience_widgets_playlist_item_get_title (self));
		break;
		case AUDIENCE_WIDGETS_PLAYLIST_ITEM_FILENAME_PROPERTY:
		g_value_set_string (value, audience_widgets_playlist_item_get_filename (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_audience_widgets_playlist_item_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec)
{
	AudienceWidgetsPlaylistItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, AUDIENCE_WIDGETS_TYPE_PLAYLIST_ITEM, AudienceWidgetsPlaylistItem);
	switch (property_id) {
		case AUDIENCE_WIDGETS_PLAYLIST_ITEM_IS_PLAYING_PROPERTY:
		audience_widgets_playlist_item_set_is_playing (self, g_value_get_boolean (value));
		break;
		case AUDIENCE_WIDGETS_PLAYLIST_ITEM_TITLE_PROPERTY:
		audience_widgets_playlist_item_set_title (self, g_value_get_string (value));
		break;
		case AUDIENCE_WIDGETS_PLAYLIST_ITEM_FILENAME_PROPERTY:
		audience_widgets_playlist_item_set_filename (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

