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

/*
 * SPDX-License-Identifier: LGPL-3.0-or-later
 * SPDX-FileCopyrightText: 2021 elementary, Inc. (https://elementary.io)
 */

#include <granite-7.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>
#include <string.h>
#include <cairo-gobject.h>
#include <stdlib.h>
#include <pango/pango.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>

#define MUSIC_APPLICATION_ACTION_PLAY_PAUSE "action-play-pause"
#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 MUSIC_TYPE_TRACK_ROW (music_track_row_get_type ())
#define MUSIC_TRACK_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MUSIC_TYPE_TRACK_ROW, MusicTrackRow))
#define MUSIC_TRACK_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MUSIC_TYPE_TRACK_ROW, MusicTrackRowClass))
#define MUSIC_IS_TRACK_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MUSIC_TYPE_TRACK_ROW))
#define MUSIC_IS_TRACK_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MUSIC_TYPE_TRACK_ROW))
#define MUSIC_TRACK_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MUSIC_TYPE_TRACK_ROW, MusicTrackRowClass))

typedef struct _MusicTrackRow MusicTrackRow;
typedef struct _MusicTrackRowClass MusicTrackRowClass;
typedef struct _MusicTrackRowPrivate MusicTrackRowPrivate;

#define MUSIC_TYPE_AUDIO_OBJECT (music_audio_object_get_type ())
#define MUSIC_AUDIO_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MUSIC_TYPE_AUDIO_OBJECT, MusicAudioObject))
#define MUSIC_AUDIO_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MUSIC_TYPE_AUDIO_OBJECT, MusicAudioObjectClass))
#define MUSIC_IS_AUDIO_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MUSIC_TYPE_AUDIO_OBJECT))
#define MUSIC_IS_AUDIO_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MUSIC_TYPE_AUDIO_OBJECT))
#define MUSIC_AUDIO_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MUSIC_TYPE_AUDIO_OBJECT, MusicAudioObjectClass))

typedef struct _MusicAudioObject MusicAudioObject;
typedef struct _MusicAudioObjectClass MusicAudioObjectClass;

#define MUSIC_TYPE_ALBUM_IMAGE (music_album_image_get_type ())
#define MUSIC_ALBUM_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MUSIC_TYPE_ALBUM_IMAGE, MusicAlbumImage))
#define MUSIC_ALBUM_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MUSIC_TYPE_ALBUM_IMAGE, MusicAlbumImageClass))
#define MUSIC_IS_ALBUM_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MUSIC_TYPE_ALBUM_IMAGE))
#define MUSIC_IS_ALBUM_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MUSIC_TYPE_ALBUM_IMAGE))
#define MUSIC_ALBUM_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MUSIC_TYPE_ALBUM_IMAGE, MusicAlbumImageClass))

typedef struct _MusicAlbumImage MusicAlbumImage;
typedef struct _MusicAlbumImageClass MusicAlbumImageClass;
enum  {
	MUSIC_TRACK_ROW_0_PROPERTY,
	MUSIC_TRACK_ROW_AUDIO_OBJECT_PROPERTY,
	MUSIC_TRACK_ROW_NUM_PROPERTIES
};
static GParamSpec* music_track_row_properties[MUSIC_TRACK_ROW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define MUSIC_TYPE_PLAYBACK_MANAGER (music_playback_manager_get_type ())
#define MUSIC_PLAYBACK_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MUSIC_TYPE_PLAYBACK_MANAGER, MusicPlaybackManager))
#define MUSIC_PLAYBACK_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MUSIC_TYPE_PLAYBACK_MANAGER, MusicPlaybackManagerClass))
#define MUSIC_IS_PLAYBACK_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MUSIC_TYPE_PLAYBACK_MANAGER))
#define MUSIC_IS_PLAYBACK_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MUSIC_TYPE_PLAYBACK_MANAGER))
#define MUSIC_PLAYBACK_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MUSIC_TYPE_PLAYBACK_MANAGER, MusicPlaybackManagerClass))

typedef struct _MusicPlaybackManager MusicPlaybackManager;
typedef struct _MusicPlaybackManagerClass MusicPlaybackManagerClass;
typedef struct _MusicAlbumImagePrivate MusicAlbumImagePrivate;
typedef struct _Block6Data Block6Data;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

struct _MusicTrackRow {
	GraniteBin parent_instance;
	MusicTrackRowPrivate * priv;
};

struct _MusicTrackRowClass {
	GraniteBinClass parent_class;
};

struct _MusicTrackRowPrivate {
	MusicAudioObject* _audio_object;
	GtkLabel* artist_label;
	GtkLabel* title_label;
	GtkSpinner* play_icon;
	MusicAlbumImage* album_image;
};

struct _MusicAlbumImage {
	GtkGrid parent_instance;
	MusicAlbumImagePrivate * priv;
	GtkImage* image;
};

struct _MusicAlbumImageClass {
	GtkGridClass parent_class;
};

struct _Block6Data {
	int _ref_count_;
	MusicTrackRow* self;
	GtkPopoverMenu* context_menu;
};

static gint MusicTrackRow_private_offset;
static gpointer music_track_row_parent_class = NULL;
static MusicPlaybackManager* music_track_row_playback_manager;
static MusicPlaybackManager* music_track_row_playback_manager = NULL;

VALA_EXTERN GType music_track_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MusicTrackRow, g_object_unref)
VALA_EXTERN GType music_audio_object_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MusicAudioObject, g_object_unref)
VALA_EXTERN GType music_album_image_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MusicAlbumImage, g_object_unref)
VALA_EXTERN GType music_playback_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MusicPlaybackManager, g_object_unref)
static void music_track_row_menu_popup_at_pointer (MusicTrackRow* self,
                                            GtkPopoverMenu* popover,
                                            gdouble x,
                                            gdouble y);
static void music_track_row_update_playing (MusicTrackRow* self,
                                     gboolean playing);
static void music_track_row_update_title_label (MusicTrackRow* self);
VALA_EXTERN const gchar* music_audio_object_get_title (MusicAudioObject* self);
static void music_track_row_update_artist_label (MusicTrackRow* self);
VALA_EXTERN const gchar* music_audio_object_get_artist (MusicAudioObject* self);
static void music_track_row_update_cover_art (MusicTrackRow* self);
VALA_EXTERN GdkTexture* music_audio_object_get_texture (MusicAudioObject* self);
VALA_EXTERN MusicTrackRow* music_track_row_new (void);
VALA_EXTERN MusicTrackRow* music_track_row_construct (GType object_type);
VALA_EXTERN MusicAudioObject* music_track_row_get_audio_object (MusicTrackRow* self);
VALA_EXTERN void music_track_row_set_audio_object (MusicTrackRow* self,
                                       MusicAudioObject* value);
static void _music_track_row_update_artist_label_g_object_notify (GObject* _sender,
                                                           GParamSpec* pspec,
                                                           gpointer self);
static void _music_track_row_update_title_label_g_object_notify (GObject* _sender,
                                                          GParamSpec* pspec,
                                                          gpointer self);
static void _music_track_row_update_cover_art_g_object_notify (GObject* _sender,
                                                        GParamSpec* pspec,
                                                        gpointer self);
static GObject * music_track_row_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
VALA_EXTERN MusicAlbumImage* music_album_image_new (void);
VALA_EXTERN MusicAlbumImage* music_album_image_construct (GType object_type);
static void _music_track_row___lambda21_ (MusicTrackRow* self);
VALA_EXTERN MusicAudioObject* music_playback_manager_get_current_audio (MusicPlaybackManager* self);
static void __music_track_row___lambda21__g_object_notify (GObject* _sender,
                                                    GParamSpec* pspec,
                                                    gpointer self);
static void _music_track_row___lambda22_ (MusicTrackRow* self,
                                   const gchar* name,
                                   GVariant* new_state);
static void __music_track_row___lambda22__g_action_group_action_state_changed (GActionGroup* _sender,
                                                                        const gchar* action_name,
                                                                        GVariant* state,
                                                                        gpointer self);
static void _music_track_row___lambda23_ (MusicTrackRow* self);
static void __music_track_row___lambda23__g_object_notify (GObject* _sender,
                                                    GParamSpec* pspec,
                                                    gpointer self);
static void _music_track_row___lambda24_ (MusicTrackRow* self);
VALA_EXTERN void music_playback_manager_remove (MusicPlaybackManager* self,
                                    MusicAudioObject* song);
static void __music_track_row___lambda24__g_simple_action_activate (GSimpleAction* _sender,
                                                             GVariant* parameter,
                                                             gpointer self);
static void _music_track_row___lambda25_ (Block6Data* _data6_,
                                   gint n_press,
                                   gdouble x,
                                   gdouble y);
static void __music_track_row___lambda25__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                                              gint n_press,
                                                              gdouble x,
                                                              gdouble y,
                                                              gpointer self);
static void _music_track_row___lambda26_ (Block6Data* _data6_,
                                   gdouble x,
                                   gdouble y);
static void __music_track_row___lambda26__gtk_gesture_long_press_pressed (GtkGestureLongPress* _sender,
                                                                   gdouble x,
                                                                   gdouble y,
                                                                   gpointer self);
VALA_EXTERN MusicPlaybackManager* music_playback_manager_get_default (void);
static void music_track_row_finalize (GObject * obj);
static GType music_track_row_get_type_once (void);
static void _vala_music_track_row_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static void _vala_music_track_row_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);

static inline gpointer
music_track_row_get_instance_private (MusicTrackRow* self)
{
	return G_STRUCT_MEMBER_P (self, MusicTrackRow_private_offset);
}

static void
music_track_row_menu_popup_at_pointer (MusicTrackRow* self,
                                       GtkPopoverMenu* popover,
                                       gdouble x,
                                       gdouble y)
{
	GdkRectangle rect = {0};
	GdkRectangle _tmp0_ = {0};
	GdkRectangle _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (popover != NULL);
	memset (&_tmp0_, 0, sizeof (GdkRectangle));
	_tmp0_.x = (gint) x;
	_tmp0_.y = (gint) y;
	rect = _tmp0_;
	_tmp1_ = rect;
	g_object_set ((GtkPopover*) popover, "pointing-to", &_tmp1_, NULL);
	gtk_popover_popup ((GtkPopover*) popover);
}

static void
music_track_row_update_playing (MusicTrackRow* self,
                                gboolean playing)
{
	g_return_if_fail (self != NULL);
	if (playing) {
		GtkSpinner* _tmp0_;
		_tmp0_ = self->priv->play_icon;
		gtk_widget_add_css_class ((GtkWidget*) _tmp0_, "playing");
	} else {
		GtkSpinner* _tmp1_;
		_tmp1_ = self->priv->play_icon;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp1_, "playing");
	}
}

static void
music_track_row_update_title_label (MusicTrackRow* self)
{
	GtkLabel* _tmp0_;
	MusicAudioObject* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->title_label;
	_tmp1_ = self->priv->_audio_object;
	_tmp2_ = music_audio_object_get_title (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_label_set_label (_tmp0_, _tmp3_);
}

static void
music_track_row_update_artist_label (MusicTrackRow* self)
{
	GtkLabel* _tmp0_;
	MusicAudioObject* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->artist_label;
	_tmp1_ = self->priv->_audio_object;
	_tmp2_ = music_audio_object_get_artist (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_label_set_label (_tmp0_, _tmp3_);
}

static void
music_track_row_update_cover_art (MusicTrackRow* self)
{
	MusicAlbumImage* _tmp0_;
	GtkImage* _tmp1_;
	MusicAudioObject* _tmp2_;
	GdkTexture* _tmp3_;
	GdkTexture* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->album_image;
	_tmp1_ = _tmp0_->image;
	_tmp2_ = self->priv->_audio_object;
	_tmp3_ = music_audio_object_get_texture (_tmp2_);
	_tmp4_ = _tmp3_;
	g_object_set (_tmp1_, "paintable", (GdkPaintable*) _tmp4_, NULL);
}

MusicTrackRow*
music_track_row_construct (GType object_type)
{
	MusicTrackRow * self = NULL;
	self = (MusicTrackRow*) granite_bin_construct (object_type);
	return self;
}

MusicTrackRow*
music_track_row_new (void)
{
	return music_track_row_construct (MUSIC_TYPE_TRACK_ROW);
}

MusicAudioObject*
music_track_row_get_audio_object (MusicTrackRow* self)
{
	MusicAudioObject* result;
	MusicAudioObject* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_audio_object;
	result = _tmp0_;
	return result;
}

static void
_music_track_row_update_artist_label_g_object_notify (GObject* _sender,
                                                      GParamSpec* pspec,
                                                      gpointer self)
{
	music_track_row_update_artist_label ((MusicTrackRow*) self);
}

static void
_music_track_row_update_title_label_g_object_notify (GObject* _sender,
                                                     GParamSpec* pspec,
                                                     gpointer self)
{
	music_track_row_update_title_label ((MusicTrackRow*) self);
}

static void
_music_track_row_update_cover_art_g_object_notify (GObject* _sender,
                                                   GParamSpec* pspec,
                                                   gpointer self)
{
	music_track_row_update_cover_art ((MusicTrackRow*) self);
}

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

void
music_track_row_set_audio_object (MusicTrackRow* self,
                                  MusicAudioObject* value)
{
	MusicAudioObject* _tmp0_;
	MusicAudioObject* _tmp10_;
	MusicAudioObject* _tmp11_;
	MusicAudioObject* _tmp12_;
	MusicAudioObject* _tmp13_;
	MusicAudioObject* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_audio_object;
	if (_tmp0_ != NULL) {
		MusicAudioObject* _tmp1_;
		guint _tmp2_;
		GQuark _tmp3_;
		MusicAudioObject* _tmp4_;
		guint _tmp5_;
		GQuark _tmp6_;
		MusicAudioObject* _tmp7_;
		guint _tmp8_;
		GQuark _tmp9_;
		_tmp1_ = self->priv->_audio_object;
		g_signal_parse_name ("notify::artist", G_TYPE_OBJECT, &_tmp2_, &_tmp3_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, _tmp3_, NULL, (GCallback) _music_track_row_update_artist_label_g_object_notify, self);
		_tmp4_ = self->priv->_audio_object;
		g_signal_parse_name ("notify::title", G_TYPE_OBJECT, &_tmp5_, &_tmp6_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, _tmp6_, NULL, (GCallback) _music_track_row_update_title_label_g_object_notify, self);
		_tmp7_ = self->priv->_audio_object;
		g_signal_parse_name ("notify::texture", G_TYPE_OBJECT, &_tmp8_, &_tmp9_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp7_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp8_, _tmp9_, NULL, (GCallback) _music_track_row_update_cover_art_g_object_notify, self);
	}
	_tmp10_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_audio_object);
	self->priv->_audio_object = _tmp10_;
	_tmp11_ = self->priv->_audio_object;
	if (_tmp11_ == NULL) {
		return;
	}
	music_track_row_update_artist_label (self);
	music_track_row_update_title_label (self);
	music_track_row_update_cover_art (self);
	_tmp12_ = self->priv->_audio_object;
	g_signal_connect_object ((GObject*) _tmp12_, "notify::artist", (GCallback) _music_track_row_update_artist_label_g_object_notify, self, 0);
	_tmp13_ = self->priv->_audio_object;
	g_signal_connect_object ((GObject*) _tmp13_, "notify::title", (GCallback) _music_track_row_update_title_label_g_object_notify, self, 0);
	_tmp14_ = self->priv->_audio_object;
	g_signal_connect_object ((GObject*) _tmp14_, "notify::texture", (GCallback) _music_track_row_update_cover_art_g_object_notify, self, 0);
	g_object_notify_by_pspec ((GObject *) self, music_track_row_properties[MUSIC_TRACK_ROW_AUDIO_OBJECT_PROPERTY]);
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		MusicTrackRow* self;
		self = _data6_->self;
		_g_object_unref0 (_data6_->context_menu);
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static void
_music_track_row___lambda21_ (MusicTrackRow* self)
{
	GtkSpinner* _tmp0_;
	MusicPlaybackManager* _tmp1_;
	MusicAudioObject* _tmp2_;
	MusicAudioObject* _tmp3_;
	MusicAudioObject* _tmp4_;
	MusicAudioObject* _tmp5_;
	_tmp0_ = self->priv->play_icon;
	_tmp1_ = music_track_row_playback_manager;
	_tmp2_ = music_playback_manager_get_current_audio (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = music_track_row_get_audio_object (self);
	_tmp5_ = _tmp4_;
	gtk_spinner_set_spinning (_tmp0_, _tmp3_ == _tmp5_);
}

static void
__music_track_row___lambda21__g_object_notify (GObject* _sender,
                                               GParamSpec* pspec,
                                               gpointer self)
{
	_music_track_row___lambda21_ ((MusicTrackRow*) self);
}

static void
_music_track_row___lambda22_ (MusicTrackRow* self,
                              const gchar* name,
                              GVariant* new_state)
{
	g_return_if_fail (name != NULL);
	g_return_if_fail (new_state != NULL);
	if (g_strcmp0 (name, MUSIC_APPLICATION_ACTION_PLAY_PAUSE) == 0) {
		music_track_row_update_playing (self, g_variant_get_boolean (new_state));
	}
}

static void
__music_track_row___lambda22__g_action_group_action_state_changed (GActionGroup* _sender,
                                                                   const gchar* action_name,
                                                                   GVariant* state,
                                                                   gpointer self)
{
	_music_track_row___lambda22_ ((MusicTrackRow*) self, action_name, state);
}

static void
_music_track_row___lambda23_ (MusicTrackRow* self)
{
	GtkSpinner* _tmp0_;
	MusicPlaybackManager* _tmp1_;
	MusicAudioObject* _tmp2_;
	MusicAudioObject* _tmp3_;
	MusicAudioObject* _tmp4_;
	MusicAudioObject* _tmp5_;
	_tmp0_ = self->priv->play_icon;
	_tmp1_ = music_track_row_playback_manager;
	_tmp2_ = music_playback_manager_get_current_audio (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = music_track_row_get_audio_object (self);
	_tmp5_ = _tmp4_;
	gtk_spinner_set_spinning (_tmp0_, _tmp3_ == _tmp5_);
}

static void
__music_track_row___lambda23__g_object_notify (GObject* _sender,
                                               GParamSpec* pspec,
                                               gpointer self)
{
	_music_track_row___lambda23_ ((MusicTrackRow*) self);
}

static void
_music_track_row___lambda24_ (MusicTrackRow* self)
{
	MusicPlaybackManager* _tmp0_;
	MusicAudioObject* _tmp1_;
	MusicAudioObject* _tmp2_;
	_tmp0_ = music_track_row_playback_manager;
	_tmp1_ = music_track_row_get_audio_object (self);
	_tmp2_ = _tmp1_;
	music_playback_manager_remove (_tmp0_, _tmp2_);
}

static void
__music_track_row___lambda24__g_simple_action_activate (GSimpleAction* _sender,
                                                        GVariant* parameter,
                                                        gpointer self)
{
	_music_track_row___lambda24_ ((MusicTrackRow*) self);
}

static void
_music_track_row___lambda25_ (Block6Data* _data6_,
                              gint n_press,
                              gdouble x,
                              gdouble y)
{
	MusicTrackRow* self;
	GtkPopoverMenu* _tmp0_;
	self = _data6_->self;
	_tmp0_ = _data6_->context_menu;
	music_track_row_menu_popup_at_pointer (self, _tmp0_, x, y);
}

static void
__music_track_row___lambda25__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                                         gint n_press,
                                                         gdouble x,
                                                         gdouble y,
                                                         gpointer self)
{
	_music_track_row___lambda25_ (self, n_press, x, y);
}

static void
_music_track_row___lambda26_ (Block6Data* _data6_,
                              gdouble x,
                              gdouble y)
{
	MusicTrackRow* self;
	GtkPopoverMenu* _tmp0_;
	self = _data6_->self;
	_tmp0_ = _data6_->context_menu;
	music_track_row_menu_popup_at_pointer (self, _tmp0_, x, y);
}

static void
__music_track_row___lambda26__gtk_gesture_long_press_pressed (GtkGestureLongPress* _sender,
                                                              gdouble x,
                                                              gdouble y,
                                                              gpointer self)
{
	_music_track_row___lambda26_ (self, x, y);
}

static GObject *
music_track_row_constructor (GType type,
                             guint n_construct_properties,
                             GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	MusicTrackRow * self;
	Block6Data* _data6_;
	GtkSpinner* _tmp0_;
	GtkSpinner* _tmp1_;
	MusicAlbumImage* _tmp2_;
	MusicAlbumImage* _tmp3_;
	GtkImage* _tmp4_;
	MusicAlbumImage* _tmp5_;
	GtkImage* _tmp6_;
	GtkAspectFrame* aspect_frame = NULL;
	MusicAlbumImage* _tmp7_;
	GtkWidget* _tmp8_;
	GtkAspectFrame* _tmp9_ = NULL;
	GtkLabel* _tmp10_ = NULL;
	GtkLabel* _tmp11_ = NULL;
	GtkLabel* _tmp12_;
	GtkLabel* _tmp13_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp14_ = NULL;
	GtkGrid* _tmp15_;
	GtkAspectFrame* _tmp16_;
	GtkGrid* _tmp17_;
	GtkLabel* _tmp18_;
	GtkGrid* _tmp19_;
	GtkLabel* _tmp20_;
	GtkGrid* _tmp21_;
	GtkSpinner* _tmp22_;
	GtkGrid* _tmp23_;
	MusicPlaybackManager* _tmp24_;
	GSimpleAction* play_pause_action = NULL;
	GApplication* _tmp25_;
	GAction* _tmp26_;
	GSimpleAction* _tmp27_;
	GSimpleAction* _tmp28_;
	GVariant* _tmp29_;
	GVariant* _tmp30_;
	GApplication* _tmp31_;
	GSimpleAction* action_remove = NULL;
	GSimpleAction* _tmp32_;
	GSimpleAction* _tmp33_;
	GSimpleActionGroup* row_action_group = NULL;
	GSimpleActionGroup* _tmp34_;
	GSimpleActionGroup* _tmp35_;
	GSimpleAction* _tmp36_;
	GSimpleActionGroup* _tmp37_;
	GMenu* menu = NULL;
	GMenu* _tmp38_;
	GMenu* _tmp39_;
	GMenu* _tmp40_;
	GtkPopoverMenu* _tmp41_ = NULL;
	GtkPopoverMenu* _tmp42_;
	GtkGestureClick* right_click = NULL;
	GtkGestureClick* _tmp43_ = NULL;
	GtkGestureClick* _tmp44_;
	GtkGestureLongPress* long_press = NULL;
	GtkGestureLongPress* _tmp45_;
	GtkGestureLongPress* _tmp46_;
	GtkGestureClick* _tmp47_;
	GtkEventController* _tmp48_;
	GtkGestureLongPress* _tmp49_;
	GtkEventController* _tmp50_;
	parent_class = G_OBJECT_CLASS (music_track_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MUSIC_TYPE_TRACK_ROW, MusicTrackRow);
	_data6_ = g_slice_new0 (Block6Data);
	_data6_->_ref_count_ = 1;
	_data6_->self = g_object_ref (self);
	_tmp0_ = (GtkSpinner*) gtk_spinner_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->play_icon);
	self->priv->play_icon = _tmp0_;
	_tmp1_ = self->priv->play_icon;
	gtk_widget_add_css_class ((GtkWidget*) _tmp1_, "play-indicator");
	_tmp2_ = music_album_image_new ();
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->album_image);
	self->priv->album_image = _tmp2_;
	_tmp3_ = self->priv->album_image;
	_tmp4_ = _tmp3_->image;
	g_object_set ((GtkWidget*) _tmp4_, "height-request", 32, NULL);
	_tmp5_ = self->priv->album_image;
	_tmp6_ = _tmp5_->image;
	g_object_set ((GtkWidget*) _tmp6_, "width-request", 32, NULL);
	_tmp7_ = self->priv->album_image;
	_tmp8_ = _g_object_ref0 ((GtkWidget*) _tmp7_);
	_tmp9_ = (GtkAspectFrame*) gtk_aspect_frame_new (0.5f, 0.5f, (gfloat) 1, FALSE);
	gtk_aspect_frame_set_child (_tmp9_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	aspect_frame = _tmp9_;
	_tmp10_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_label_set_ellipsize (_tmp10_, PANGO_ELLIPSIZE_MIDDLE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp10_, TRUE);
	gtk_label_set_xalign (_tmp10_, (gfloat) 0);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->title_label);
	self->priv->title_label = _tmp10_;
	_tmp11_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_label_set_ellipsize (_tmp11_, PANGO_ELLIPSIZE_MIDDLE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp11_, TRUE);
	gtk_label_set_xalign (_tmp11_, (gfloat) 0);
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->artist_label);
	self->priv->artist_label = _tmp11_;
	_tmp12_ = self->priv->artist_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp12_, GRANITE_STYLE_CLASS_DIM_LABEL);
	_tmp13_ = self->priv->artist_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp13_, GRANITE_STYLE_CLASS_SMALL_LABEL);
	_tmp14_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp14_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp14_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp14_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp14_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp14_, 6);
	g_object_ref_sink (_tmp14_);
	grid = _tmp14_;
	_tmp15_ = grid;
	_tmp16_ = aspect_frame;
	gtk_grid_attach (_tmp15_, (GtkWidget*) _tmp16_, 0, 0, 1, 2);
	_tmp17_ = grid;
	_tmp18_ = self->priv->title_label;
	gtk_grid_attach (_tmp17_, (GtkWidget*) _tmp18_, 1, 0, 1, 1);
	_tmp19_ = grid;
	_tmp20_ = self->priv->artist_label;
	gtk_grid_attach (_tmp19_, (GtkWidget*) _tmp20_, 1, 1, 1, 1);
	_tmp21_ = grid;
	_tmp22_ = self->priv->play_icon;
	gtk_grid_attach (_tmp21_, (GtkWidget*) _tmp22_, 2, 0, 1, 2);
	_tmp23_ = grid;
	granite_bin_set_child ((GraniteBin*) self, (GtkWidget*) _tmp23_);
	_tmp24_ = music_track_row_playback_manager;
	g_signal_connect_object ((GObject*) _tmp24_, "notify::current-audio", (GCallback) __music_track_row___lambda21__g_object_notify, self, 0);
	_tmp25_ = g_application_get_default ();
	_tmp26_ = g_action_map_lookup_action ((GActionMap*) _tmp25_, MUSIC_APPLICATION_ACTION_PLAY_PAUSE);
	_tmp27_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, g_simple_action_get_type (), GSimpleAction));
	play_pause_action = _tmp27_;
	_tmp28_ = play_pause_action;
	_tmp29_ = g_action_get_state ((GAction*) _tmp28_);
	_tmp30_ = _tmp29_;
	music_track_row_update_playing (self, g_variant_get_boolean (_tmp30_));
	_g_variant_unref0 (_tmp30_);
	_tmp31_ = g_application_get_default ();
	g_signal_connect_object ((GActionGroup*) _tmp31_, "action-state-changed", (GCallback) __music_track_row___lambda22__g_action_group_action_state_changed, self, 0);
	g_signal_connect_object ((GObject*) self, "notify::audio-object", (GCallback) __music_track_row___lambda23__g_object_notify, self, 0);
	_tmp32_ = g_simple_action_new ("remove", NULL);
	action_remove = _tmp32_;
	_tmp33_ = action_remove;
	g_signal_connect_object (_tmp33_, "activate", (GCallback) __music_track_row___lambda24__g_simple_action_activate, self, 0);
	_tmp34_ = g_simple_action_group_new ();
	row_action_group = _tmp34_;
	_tmp35_ = row_action_group;
	_tmp36_ = action_remove;
	g_action_map_add_action ((GActionMap*) _tmp35_, (GAction*) _tmp36_);
	_tmp37_ = row_action_group;
	gtk_widget_insert_action_group ((GtkWidget*) self, "trackrow", (GActionGroup*) _tmp37_);
	gtk_widget_class_add_binding_action (G_TYPE_INSTANCE_GET_CLASS (self, gtk_widget_get_type (), GtkWidgetClass), GDK_KEY_Delete, GDK_NO_MODIFIER_MASK, "trackrow.remove", NULL, NULL);
	_tmp38_ = g_menu_new ();
	menu = _tmp38_;
	_tmp39_ = menu;
	g_menu_append (_tmp39_, _ ("Remove"), "trackrow.remove");
	_tmp40_ = menu;
	_tmp41_ = (GtkPopoverMenu*) gtk_popover_menu_new_from_model ((GMenuModel*) _tmp40_);
	gtk_widget_set_halign ((GtkWidget*) _tmp41_, GTK_ALIGN_START);
	gtk_popover_set_has_arrow ((GtkPopover*) _tmp41_, FALSE);
	gtk_popover_set_position ((GtkPopover*) _tmp41_, GTK_POS_BOTTOM);
	g_object_ref_sink (_tmp41_);
	_data6_->context_menu = _tmp41_;
	_tmp42_ = _data6_->context_menu;
	gtk_widget_set_parent ((GtkWidget*) _tmp42_, (GtkWidget*) self);
	_tmp43_ = (GtkGestureClick*) gtk_gesture_click_new ();
	gtk_gesture_single_set_button ((GtkGestureSingle*) _tmp43_, (guint) GDK_BUTTON_SECONDARY);
	right_click = _tmp43_;
	_tmp44_ = right_click;
	g_signal_connect_data (_tmp44_, "pressed", (GCallback) __music_track_row___lambda25__gtk_gesture_click_pressed, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp45_ = (GtkGestureLongPress*) gtk_gesture_long_press_new ();
	long_press = _tmp45_;
	_tmp46_ = long_press;
	g_signal_connect_data (_tmp46_, "pressed", (GCallback) __music_track_row___lambda26__gtk_gesture_long_press_pressed, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp47_ = right_click;
	_tmp48_ = _g_object_ref0 ((GtkEventController*) _tmp47_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp48_);
	_tmp49_ = long_press;
	_tmp50_ = _g_object_ref0 ((GtkEventController*) _tmp49_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp50_);
	_g_object_unref0 (long_press);
	_g_object_unref0 (right_click);
	_g_object_unref0 (menu);
	_g_object_unref0 (row_action_group);
	_g_object_unref0 (action_remove);
	_g_object_unref0 (play_pause_action);
	_g_object_unref0 (grid);
	_g_object_unref0 (aspect_frame);
	block6_data_unref (_data6_);
	_data6_ = NULL;
	return obj;
}

static void
music_track_row_class_init (MusicTrackRowClass * klass,
                            gpointer klass_data)
{
	MusicPlaybackManager* _tmp0_;
	MusicPlaybackManager* _tmp1_;
	music_track_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MusicTrackRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_music_track_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_music_track_row_set_property;
	G_OBJECT_CLASS (klass)->constructor = music_track_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = music_track_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), MUSIC_TRACK_ROW_AUDIO_OBJECT_PROPERTY, music_track_row_properties[MUSIC_TRACK_ROW_AUDIO_OBJECT_PROPERTY] = g_param_spec_object ("audio-object", "audio-object", "audio-object", MUSIC_TYPE_AUDIO_OBJECT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	_tmp0_ = music_playback_manager_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (music_track_row_playback_manager);
	music_track_row_playback_manager = _tmp1_;
}

static void
music_track_row_instance_init (MusicTrackRow * self,
                               gpointer klass)
{
	self->priv = music_track_row_get_instance_private (self);
	self->priv->_audio_object = NULL;
}

static void
music_track_row_finalize (GObject * obj)
{
	MusicTrackRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MUSIC_TYPE_TRACK_ROW, MusicTrackRow);
	_g_object_unref0 (self->priv->_audio_object);
	_g_object_unref0 (self->priv->artist_label);
	_g_object_unref0 (self->priv->title_label);
	_g_object_unref0 (self->priv->play_icon);
	_g_object_unref0 (self->priv->album_image);
	G_OBJECT_CLASS (music_track_row_parent_class)->finalize (obj);
}

static GType
music_track_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MusicTrackRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) music_track_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MusicTrackRow), 0, (GInstanceInitFunc) music_track_row_instance_init, NULL };
	GType music_track_row_type_id;
	music_track_row_type_id = g_type_register_static (GRANITE_TYPE_BIN, "MusicTrackRow", &g_define_type_info, 0);
	MusicTrackRow_private_offset = g_type_add_instance_private (music_track_row_type_id, sizeof (MusicTrackRowPrivate));
	return music_track_row_type_id;
}

GType
music_track_row_get_type (void)
{
	static volatile gsize music_track_row_type_id__once = 0;
	if (g_once_init_enter (&music_track_row_type_id__once)) {
		GType music_track_row_type_id;
		music_track_row_type_id = music_track_row_get_type_once ();
		g_once_init_leave (&music_track_row_type_id__once, music_track_row_type_id);
	}
	return music_track_row_type_id__once;
}

static void
_vala_music_track_row_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	MusicTrackRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MUSIC_TYPE_TRACK_ROW, MusicTrackRow);
	switch (property_id) {
		case MUSIC_TRACK_ROW_AUDIO_OBJECT_PROPERTY:
		g_value_set_object (value, music_track_row_get_audio_object (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_music_track_row_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	MusicTrackRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MUSIC_TYPE_TRACK_ROW, MusicTrackRow);
	switch (property_id) {
		case MUSIC_TRACK_ROW_AUDIO_OBJECT_PROPERTY:
		music_track_row_set_audio_object (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

