/* mini-bar.c generated by valac 0.56.19, the Vala compiler
 * generated from mini-bar.vala, do not modify */

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <graphene-gobject.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <gst/gst.h>
#include <stdlib.h>
#include <pango/pango.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>

#define G4_ACTION_APP "app."
#define G4_ACTION_PREV "prev"
#define G4_ACTION_PLAY_PAUSE "play-pause"
#define G4_ACTION_NEXT "next"
#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 G4_TYPE_MINI_BAR (g4_mini_bar_get_type ())
#define G4_MINI_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_MINI_BAR, G4MiniBar))
#define G4_MINI_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_MINI_BAR, G4MiniBarClass))
#define G4_IS_MINI_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_MINI_BAR))
#define G4_IS_MINI_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_MINI_BAR))
#define G4_MINI_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_MINI_BAR, G4MiniBarClass))

typedef struct _G4MiniBar G4MiniBar;
typedef struct _G4MiniBarClass G4MiniBarClass;
typedef struct _G4MiniBarPrivate G4MiniBarPrivate;

#define G4_TYPE_STABLE_LABEL (g4_stable_label_get_type ())
#define G4_STABLE_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_STABLE_LABEL, G4StableLabel))
#define G4_STABLE_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_STABLE_LABEL, G4StableLabelClass))
#define G4_IS_STABLE_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_STABLE_LABEL))
#define G4_IS_STABLE_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_STABLE_LABEL))
#define G4_STABLE_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_STABLE_LABEL, G4StableLabelClass))

typedef struct _G4StableLabel G4StableLabel;
typedef struct _G4StableLabelClass G4StableLabelClass;

#define G4_TYPE_BASE_PAINTABLE (g4_base_paintable_get_type ())
#define G4_BASE_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_BASE_PAINTABLE, G4BasePaintable))
#define G4_BASE_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_BASE_PAINTABLE, G4BasePaintableClass))
#define G4_IS_BASE_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_BASE_PAINTABLE))
#define G4_IS_BASE_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_BASE_PAINTABLE))
#define G4_BASE_PAINTABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_BASE_PAINTABLE, G4BasePaintableClass))

typedef struct _G4BasePaintable G4BasePaintable;
typedef struct _G4BasePaintableClass G4BasePaintableClass;

#define G4_TYPE_CROSS_FADE_PAINTABLE (g4_cross_fade_paintable_get_type ())
#define G4_CROSS_FADE_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_CROSS_FADE_PAINTABLE, G4CrossFadePaintable))
#define G4_CROSS_FADE_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_CROSS_FADE_PAINTABLE, G4CrossFadePaintableClass))
#define G4_IS_CROSS_FADE_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_CROSS_FADE_PAINTABLE))
#define G4_IS_CROSS_FADE_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_CROSS_FADE_PAINTABLE))
#define G4_CROSS_FADE_PAINTABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_CROSS_FADE_PAINTABLE, G4CrossFadePaintableClass))

typedef struct _G4CrossFadePaintable G4CrossFadePaintable;
typedef struct _G4CrossFadePaintableClass G4CrossFadePaintableClass;
enum  {
	G4_MINI_BAR_0_PROPERTY,
	G4_MINI_BAR_COVER_PROPERTY,
	G4_MINI_BAR_TITLE_PROPERTY,
	G4_MINI_BAR_NUM_PROPERTIES
};
static GParamSpec* g4_mini_bar_properties[G4_MINI_BAR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define G4_TYPE_ROUND_PAINTABLE (g4_round_paintable_get_type ())
#define G4_ROUND_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_ROUND_PAINTABLE, G4RoundPaintable))
#define G4_ROUND_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_ROUND_PAINTABLE, G4RoundPaintableClass))
#define G4_IS_ROUND_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_ROUND_PAINTABLE))
#define G4_IS_ROUND_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_ROUND_PAINTABLE))
#define G4_ROUND_PAINTABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_ROUND_PAINTABLE, G4RoundPaintableClass))

typedef struct _G4RoundPaintable G4RoundPaintable;
typedef struct _G4RoundPaintableClass G4RoundPaintableClass;

#define G4_TYPE_APPLICATION (g4_application_get_type ())
#define G4_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_APPLICATION, G4Application))
#define G4_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_APPLICATION, G4ApplicationClass))
#define G4_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_APPLICATION))
#define G4_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_APPLICATION))
#define G4_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_APPLICATION, G4ApplicationClass))

typedef struct _G4Application G4Application;
typedef struct _G4ApplicationClass G4ApplicationClass;

#define G4_TYPE_GST_PLAYER (g4_gst_player_get_type ())
#define G4_GST_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_GST_PLAYER, G4GstPlayer))
#define G4_GST_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_GST_PLAYER, G4GstPlayerClass))
#define G4_IS_GST_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_GST_PLAYER))
#define G4_IS_GST_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_GST_PLAYER))
#define G4_GST_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_GST_PLAYER, G4GstPlayerClass))

typedef struct _G4GstPlayer G4GstPlayer;
typedef struct _G4GstPlayerClass G4GstPlayerClass;

struct _G4MiniBar {
	AdwActionRow parent_instance;
	G4MiniBarPrivate * priv;
};

struct _G4MiniBarClass {
	AdwActionRowClass parent_class;
};

struct _G4MiniBarPrivate {
	GtkImage* _cover;
	G4StableLabel* _title;
	GtkLabel* _time;
	GtkButton* _prev;
	GtkButton* _play;
	GtkButton* _next;
	gint _duration;
	gint _position;
	AdwAnimation* _fade_animation;
	G4CrossFadePaintable* _paintable;
};

static gint G4MiniBar_private_offset;
static gpointer g4_mini_bar_parent_class = NULL;

VALA_EXTERN GType g4_mini_bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4MiniBar, g_object_unref)
VALA_EXTERN GType g4_stable_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4StableLabel, g_object_unref)
VALA_EXTERN GType g4_base_paintable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4BasePaintable, g_object_unref)
VALA_EXTERN GType g4_cross_fade_paintable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4CrossFadePaintable, g_object_unref)
VALA_EXTERN G4StableLabel* g4_stable_label_new (void);
VALA_EXTERN G4StableLabel* g4_stable_label_construct (GType object_type);
VALA_EXTERN G4CrossFadePaintable* g4_cross_fade_paintable_new (GdkPaintable* paintable);
VALA_EXTERN G4CrossFadePaintable* g4_cross_fade_paintable_construct (GType object_type,
                                                         GdkPaintable* paintable);
VALA_EXTERN void g4_mini_bar_size_to_change (G4MiniBar* self,
                                 gint panel_width);
static void g4_mini_bar_real_snapshot (GtkWidget* base,
                                GtkSnapshot* snapshot);
VALA_EXTERN void g4_draw_outset_shadow (GtkSnapshot* snapshot,
                            graphene_rect_t* rect,
                            gfloat radius);
static void g4_mini_bar_on_duration_changed (G4MiniBar* self,
                                      GstClockTime duration);
VALA_EXTERN gdouble g4_gst_player_to_second (GstClockTime time);
static void g4_mini_bar_update_time_label (G4MiniBar* self);
static void g4_mini_bar_on_position_changed (G4MiniBar* self,
                                      GstClockTime position);
static void g4_mini_bar_on_state_changed (G4MiniBar* self,
                                   GstState state);
VALA_EXTERN gchar* g4_format_time (gint seconds);
VALA_EXTERN G4MiniBar* g4_mini_bar_new (void);
VALA_EXTERN G4MiniBar* g4_mini_bar_construct (GType object_type);
VALA_EXTERN GdkPaintable* g4_mini_bar_get_cover (G4MiniBar* self);
VALA_EXTERN GdkPaintable* g4_base_paintable_get_paintable (G4BasePaintable* self);
VALA_EXTERN void g4_mini_bar_set_cover (G4MiniBar* self,
                            GdkPaintable* value);
VALA_EXTERN void g4_base_paintable_set_paintable (G4BasePaintable* self,
                                      GdkPaintable* value);
static void _g4_mini_bar_cover___lambda66_ (G4MiniBar* self,
                                     gdouble value);
VALA_EXTERN void g4_cross_fade_paintable_set_fade (G4CrossFadePaintable* self,
                                       gdouble value);
static void __g4_mini_bar_cover___lambda66__adw_animation_target_func (gdouble value,
                                                                gpointer self);
VALA_EXTERN gdouble g4_cross_fade_paintable_get_fade (G4CrossFadePaintable* self);
static void _g4_mini_bar_cover___lambda67_ (G4MiniBar* self);
VALA_EXTERN void g4_cross_fade_paintable_set_previous (G4CrossFadePaintable* self,
                                           GdkPaintable* value);
static void __g4_mini_bar_cover___lambda67__adw_animation_done (AdwAnimation* _sender,
                                                         gpointer self);
VALA_EXTERN void g4_mini_bar_set_title (G4MiniBar* self,
                            const gchar* value);
VALA_EXTERN void g4_stable_label_set_label (G4StableLabel* self,
                                const gchar* value);
static GObject * g4_mini_bar_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties);
static void _adw_action_row_activate_gtk_gesture_click_released (GtkGestureClick* _sender,
                                                          gint n_press,
                                                          gdouble x,
                                                          gdouble y,
                                                          gpointer self);
VALA_EXTERN G4RoundPaintable* g4_round_paintable_new (GdkPaintable* paintable,
                                          gdouble ratio);
VALA_EXTERN G4RoundPaintable* g4_round_paintable_construct (GType object_type,
                                                GdkPaintable* paintable,
                                                gdouble ratio);
VALA_EXTERN GType g4_round_paintable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4RoundPaintable, g_object_unref)
static void _gtk_widget_queue_draw_g4_base_paintable_queue_draw (G4BasePaintable* _sender,
                                                          gpointer self);
VALA_EXTERN void g4_stable_label_set_marquee (G4StableLabel* self,
                                  gboolean value);
VALA_EXTERN GType g4_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4Application, g_object_unref)
VALA_EXTERN GType g4_gst_player_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4GstPlayer, g_object_unref)
VALA_EXTERN G4GstPlayer* g4_application_get_player (G4Application* self);
static void _g4_mini_bar_on_duration_changed_g4_gst_player_duration_changed (G4GstPlayer* _sender,
                                                                      GstClockTime duration,
                                                                      gpointer self);
static void _g4_mini_bar_on_position_changed_g4_gst_player_position_updated (G4GstPlayer* _sender,
                                                                      GstClockTime position,
                                                                      gpointer self);
static void _g4_mini_bar_on_state_changed_g4_gst_player_state_changed (G4GstPlayer* _sender,
                                                                GstState state,
                                                                gpointer self);
static void g4_mini_bar_finalize (GObject * obj);
static GType g4_mini_bar_get_type_once (void);
static void _vala_g4_mini_bar_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec);
static void _vala_g4_mini_bar_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
g4_mini_bar_get_instance_private (G4MiniBar* self)
{
	return G_STRUCT_MEMBER_P (self, G4MiniBar_private_offset);
}

void
g4_mini_bar_size_to_change (G4MiniBar* self,
                            gint panel_width)
{
	GtkButton* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_prev;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, panel_width >= 360);
}

static void
g4_mini_bar_real_snapshot (GtkWidget* base,
                           GtkSnapshot* snapshot)
{
	G4MiniBar * self;
	graphene_rect_t rect = {0};
	graphene_rect_t _tmp0_;
	self = (G4MiniBar*) base;
	g_return_if_fail (snapshot != NULL);
	memset (&rect, 0, sizeof (graphene_rect_t));
	graphene_rect_init (&rect, (gfloat) 0, (gfloat) 0, (gfloat) gtk_widget_get_width ((GtkWidget*) self), (gfloat) gtk_widget_get_height ((GtkWidget*) self));
	_tmp0_ = rect;
	g4_draw_outset_shadow (snapshot, &_tmp0_, (gfloat) 5);
	GTK_WIDGET_CLASS (g4_mini_bar_parent_class)->snapshot ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_action_row_get_type (), AdwActionRow), snapshot);
}

static void
g4_mini_bar_on_duration_changed (G4MiniBar* self,
                                 GstClockTime duration)
{
	gdouble value = 0.0;
	g_return_if_fail (self != NULL);
	value = g4_gst_player_to_second (duration);
	if (self->priv->_duration != ((gint) value)) {
		self->priv->_duration = (gint) value;
		g4_mini_bar_update_time_label (self);
	}
}

static void
g4_mini_bar_on_position_changed (G4MiniBar* self,
                                 GstClockTime position)
{
	gdouble value = 0.0;
	g_return_if_fail (self != NULL);
	value = g4_gst_player_to_second (position);
	if (self->priv->_position != ((gint) value)) {
		self->priv->_position = (gint) value;
		g4_mini_bar_update_time_label (self);
	}
}

static void
g4_mini_bar_on_state_changed (G4MiniBar* self,
                              GstState state)
{
	gboolean playing = FALSE;
	const gchar* _tmp0_ = NULL;
	GtkButton* _tmp1_;
	g_return_if_fail (self != NULL);
	playing = state == GST_STATE_PLAYING;
	if (playing) {
		_tmp0_ = "media-playback-pause-symbolic";
	} else {
		_tmp0_ = "media-playback-start-symbolic";
	}
	_tmp1_ = self->priv->_play;
	gtk_button_set_icon_name (_tmp1_, _tmp0_);
}

static void
g4_mini_bar_update_time_label (G4MiniBar* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_duration > 0) {
		GtkLabel* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp0_ = self->priv->_time;
		_tmp1_ = g4_format_time (self->priv->_position);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_strconcat (_tmp2_, "/", NULL);
		_tmp4_ = _tmp3_;
		_tmp5_ = g4_format_time (self->priv->_duration);
		_tmp6_ = _tmp5_;
		_tmp7_ = g_strconcat (_tmp4_, _tmp6_, NULL);
		_tmp8_ = _tmp7_;
		gtk_label_set_label (_tmp0_, _tmp8_);
		_g_free0 (_tmp8_);
		_g_free0 (_tmp6_);
		_g_free0 (_tmp4_);
		_g_free0 (_tmp2_);
	} else {
		GtkLabel* _tmp9_;
		_tmp9_ = self->priv->_time;
		gtk_label_set_label (_tmp9_, "");
	}
}

G4MiniBar*
g4_mini_bar_construct (GType object_type)
{
	G4MiniBar * self = NULL;
	self = (G4MiniBar*) g_object_new (object_type, NULL);
	return self;
}

G4MiniBar*
g4_mini_bar_new (void)
{
	return g4_mini_bar_construct (G4_TYPE_MINI_BAR);
}

GdkPaintable*
g4_mini_bar_get_cover (G4MiniBar* self)
{
	GdkPaintable* result;
	G4CrossFadePaintable* _tmp0_;
	GdkPaintable* _tmp1_;
	GdkPaintable* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_paintable;
	_tmp1_ = g4_base_paintable_get_paintable ((G4BasePaintable*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static void
_g4_mini_bar_cover___lambda66_ (G4MiniBar* self,
                                gdouble value)
{
	G4CrossFadePaintable* _tmp0_;
	_tmp0_ = self->priv->_paintable;
	g4_cross_fade_paintable_set_fade (_tmp0_, value);
}

static void
__g4_mini_bar_cover___lambda66__adw_animation_target_func (gdouble value,
                                                           gpointer self)
{
	_g4_mini_bar_cover___lambda66_ ((G4MiniBar*) self, value);
}

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

static void
_g4_mini_bar_cover___lambda67_ (G4MiniBar* self)
{
	G4CrossFadePaintable* _tmp0_;
	_tmp0_ = self->priv->_paintable;
	g4_cross_fade_paintable_set_previous (_tmp0_, NULL);
	_g_object_unref0 (self->priv->_fade_animation);
	self->priv->_fade_animation = NULL;
}

static void
__g4_mini_bar_cover___lambda67__adw_animation_done (AdwAnimation* _sender,
                                                    gpointer self)
{
	_g4_mini_bar_cover___lambda67_ ((G4MiniBar*) self);
}

void
g4_mini_bar_set_cover (G4MiniBar* self,
                       GdkPaintable* value)
{
	G4CrossFadePaintable* _tmp0_;
	AdwCallbackAnimationTarget* target = NULL;
	AdwCallbackAnimationTarget* _tmp1_;
	AdwAnimation* _tmp2_ = NULL;
	AdwAnimation* _tmp3_;
	GtkImage* _tmp4_;
	G4CrossFadePaintable* _tmp5_;
	gdouble _tmp6_;
	gdouble _tmp7_;
	AdwCallbackAnimationTarget* _tmp8_;
	AdwAnimationTarget* _tmp9_;
	AdwTimedAnimation* _tmp10_;
	AdwAnimation* _tmp11_;
	AdwAnimation* _tmp12_ = NULL;
	AdwAnimation* _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_paintable;
	g4_base_paintable_set_paintable ((G4BasePaintable*) _tmp0_, value);
	_tmp1_ = (AdwCallbackAnimationTarget*) adw_callback_animation_target_new (__g4_mini_bar_cover___lambda66__adw_animation_target_func, g_object_ref (self), g_object_unref);
	target = _tmp1_;
	_tmp3_ = self->priv->_fade_animation;
	_tmp2_ = _tmp3_;
	if (_tmp2_ != NULL) {
		adw_animation_pause (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, adw_animation_get_type (), AdwAnimation));
	}
	_tmp4_ = self->priv->_cover;
	_tmp5_ = self->priv->_paintable;
	_tmp6_ = g4_cross_fade_paintable_get_fade (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = target;
	_tmp9_ = _g_object_ref0 ((AdwAnimationTarget*) _tmp8_);
	_tmp10_ = (AdwTimedAnimation*) adw_timed_animation_new ((GtkWidget*) _tmp4_, 1 - _tmp7_, (gdouble) 0, (guint) 800, _tmp9_);
	_g_object_unref0 (self->priv->_fade_animation);
	self->priv->_fade_animation = (AdwAnimation*) _tmp10_;
	_tmp11_ = self->priv->_fade_animation;
	g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, adw_animation_get_type (), AdwAnimation), "done", (GCallback) __g4_mini_bar_cover___lambda67__adw_animation_done, self, 0);
	_tmp13_ = self->priv->_fade_animation;
	_tmp12_ = _tmp13_;
	if (_tmp12_ != NULL) {
		adw_animation_play (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, adw_animation_get_type (), AdwAnimation));
	}
	_g_object_unref0 (target);
	g_object_notify_by_pspec ((GObject *) self, g4_mini_bar_properties[G4_MINI_BAR_COVER_PROPERTY]);
}

void
g4_mini_bar_set_title (G4MiniBar* self,
                       const gchar* value)
{
	G4StableLabel* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_title;
	g4_stable_label_set_label (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, g4_mini_bar_properties[G4_MINI_BAR_TITLE_PROPERTY]);
}

static void
_adw_action_row_activate_gtk_gesture_click_released (GtkGestureClick* _sender,
                                                     gint n_press,
                                                     gdouble x,
                                                     gdouble y,
                                                     gpointer self)
{
	adw_action_row_activate ((AdwActionRow*) self);
}

static void
_gtk_widget_queue_draw_g4_base_paintable_queue_draw (G4BasePaintable* _sender,
                                                     gpointer self)
{
	gtk_widget_queue_draw ((GtkWidget*) self);
}

static void
_g4_mini_bar_on_duration_changed_g4_gst_player_duration_changed (G4GstPlayer* _sender,
                                                                 GstClockTime duration,
                                                                 gpointer self)
{
	g4_mini_bar_on_duration_changed ((G4MiniBar*) self, duration);
}

static void
_g4_mini_bar_on_position_changed_g4_gst_player_position_updated (G4GstPlayer* _sender,
                                                                 GstClockTime position,
                                                                 gpointer self)
{
	g4_mini_bar_on_position_changed ((G4MiniBar*) self, position);
}

static void
_g4_mini_bar_on_state_changed_g4_gst_player_state_changed (G4GstPlayer* _sender,
                                                           GstState state,
                                                           gpointer self)
{
	g4_mini_bar_on_state_changed ((G4MiniBar*) self, state);
}

static GObject *
g4_mini_bar_constructor (GType type,
                         guint n_construct_properties,
                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	G4MiniBar * self;
	GtkGestureClick* controller = NULL;
	GtkGestureClick* _tmp0_;
	GtkGestureClick* _tmp1_;
	GtkGestureClick* _tmp2_;
	GtkEventController* _tmp3_;
	GtkBox* vbox = NULL;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkBox* _tmp6_;
	GtkBox* _tmp7_;
	GtkBox* _tmp8_;
	G4StableLabel* _tmp9_;
	GtkBox* _tmp10_;
	GtkLabel* _tmp11_;
	GtkBox* _tmp12_;
	GtkImage* _tmp13_;
	GtkImage* _tmp14_;
	GtkImage* _tmp15_;
	GtkImage* _tmp16_;
	GtkImage* _tmp17_;
	GtkImage* _tmp18_;
	G4CrossFadePaintable* _tmp19_;
	G4RoundPaintable* _tmp20_;
	G4RoundPaintable* _tmp21_;
	G4CrossFadePaintable* _tmp22_;
	GtkImage* _tmp23_;
	G4StableLabel* _tmp24_;
	G4StableLabel* _tmp25_;
	G4StableLabel* _tmp26_;
	GtkLabel* _tmp27_;
	GtkLabel* _tmp28_;
	GtkLabel* _tmp29_;
	gint font_size = 0;
	GtkLabel* _tmp30_;
	PangoContext* _tmp31_;
	PangoFontDescription* _tmp32_;
	GtkBox* hbox = NULL;
	GtkBox* _tmp34_;
	GtkBox* _tmp35_;
	GtkBox* _tmp36_;
	GtkButton* _tmp37_;
	GtkButton* _tmp38_;
	GtkButton* _tmp39_;
	GtkButton* _tmp40_;
	GtkButton* _tmp41_;
	GtkButton* _tmp42_;
	GtkBox* _tmp43_;
	GtkButton* _tmp44_;
	GtkButton* _tmp45_;
	GtkButton* _tmp46_;
	GtkButton* _tmp47_;
	GtkButton* _tmp48_;
	GtkButton* _tmp49_;
	GtkButton* _tmp50_;
	GtkBox* _tmp51_;
	GtkButton* _tmp52_;
	GtkButton* _tmp53_;
	GtkButton* _tmp54_;
	GtkButton* _tmp55_;
	GtkButton* _tmp56_;
	GtkButton* _tmp57_;
	GtkButton* _tmp58_;
	GtkBox* _tmp59_;
	GtkButton* _tmp60_;
	G4Application* app = NULL;
	GApplication* _tmp61_;
	G4Application* _tmp62_;
	G4GstPlayer* player = NULL;
	G4Application* _tmp63_;
	G4GstPlayer* _tmp64_;
	G4GstPlayer* _tmp65_;
	G4GstPlayer* _tmp66_;
	G4GstPlayer* _tmp67_;
	G4GstPlayer* _tmp68_;
	G4GstPlayer* _tmp69_;
	parent_class = G_OBJECT_CLASS (g4_mini_bar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_MINI_BAR, G4MiniBar);
	gtk_widget_set_halign ((GtkWidget*) self, GTK_ALIGN_FILL);
	gtk_widget_set_hexpand ((GtkWidget*) self, TRUE);
	g_object_set ((GtkWidget*) self, "height-request", 60, NULL);
	_tmp0_ = (GtkGestureClick*) gtk_gesture_click_new ();
	controller = _tmp0_;
	_tmp1_ = controller;
	g_signal_connect_object (_tmp1_, "released", (GCallback) _adw_action_row_activate_gtk_gesture_click_released, (AdwActionRow*) self, 0);
	_tmp2_ = controller;
	_tmp3_ = _g_object_ref0 ((GtkEventController*) _tmp2_);
	gtk_widget_add_controller ((GtkWidget*) self, _tmp3_);
	adw_action_row_set_activatable_widget ((AdwActionRow*) self, (GtkWidget*) self);
	_tmp4_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
	g_object_ref_sink (_tmp4_);
	vbox = _tmp4_;
	_tmp5_ = vbox;
	gtk_widget_set_halign ((GtkWidget*) _tmp5_, GTK_ALIGN_START);
	_tmp6_ = vbox;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp6_, TRUE);
	_tmp7_ = vbox;
	gtk_widget_set_valign ((GtkWidget*) _tmp7_, GTK_ALIGN_CENTER);
	_tmp8_ = vbox;
	_tmp9_ = self->priv->_title;
	gtk_box_append (_tmp8_, (GtkWidget*) _tmp9_);
	_tmp10_ = vbox;
	_tmp11_ = self->priv->_time;
	gtk_box_append (_tmp10_, (GtkWidget*) _tmp11_);
	_tmp12_ = vbox;
	adw_action_row_add_prefix ((AdwActionRow*) self, (GtkWidget*) _tmp12_);
	_tmp13_ = self->priv->_cover;
	adw_action_row_add_prefix ((AdwActionRow*) self, (GtkWidget*) _tmp13_);
	_tmp14_ = self->priv->_cover;
	gtk_widget_set_valign ((GtkWidget*) _tmp14_, GTK_ALIGN_CENTER);
	_tmp15_ = self->priv->_cover;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp15_, 2);
	_tmp16_ = self->priv->_cover;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp16_, 6);
	_tmp17_ = self->priv->_cover;
	gtk_image_set_pixel_size (_tmp17_, 40);
	_tmp18_ = self->priv->_cover;
	_tmp19_ = self->priv->_paintable;
	_tmp20_ = g4_round_paintable_new ((GdkPaintable*) _tmp19_, 0.1);
	_tmp21_ = _tmp20_;
	g_object_set (_tmp18_, "paintable", (GdkPaintable*) _tmp21_, NULL);
	_g_object_unref0 (_tmp21_);
	_tmp22_ = self->priv->_paintable;
	_tmp23_ = self->priv->_cover;
	g_signal_connect_object ((G4BasePaintable*) _tmp22_, "queue-draw", (GCallback) _gtk_widget_queue_draw_g4_base_paintable_queue_draw, (GtkWidget*) _tmp23_, 0);
	_tmp24_ = self->priv->_title;
	gtk_widget_set_halign ((GtkWidget*) _tmp24_, GTK_ALIGN_START);
	_tmp25_ = self->priv->_title;
	g4_stable_label_set_marquee (_tmp25_, TRUE);
	_tmp26_ = self->priv->_title;
	gtk_widget_add_css_class ((GtkWidget*) _tmp26_, "title-leading");
	_tmp27_ = self->priv->_time;
	gtk_widget_set_halign ((GtkWidget*) _tmp27_, GTK_ALIGN_START);
	_tmp28_ = self->priv->_time;
	gtk_widget_add_css_class ((GtkWidget*) _tmp28_, "dim-label");
	_tmp29_ = self->priv->_time;
	gtk_widget_add_css_class ((GtkWidget*) _tmp29_, "numeric");
	_tmp30_ = self->priv->_time;
	_tmp31_ = gtk_widget_get_pango_context ((GtkWidget*) _tmp30_);
	_tmp32_ = pango_context_get_font_description (_tmp31_);
	font_size = pango_font_description_get_size (_tmp32_) / PANGO_SCALE;
	if (font_size >= 13) {
		GtkLabel* _tmp33_;
		_tmp33_ = self->priv->_time;
		gtk_widget_add_css_class ((GtkWidget*) _tmp33_, "title-secondly");
	}
	_tmp34_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
	g_object_ref_sink (_tmp34_);
	hbox = _tmp34_;
	_tmp35_ = hbox;
	gtk_widget_set_valign ((GtkWidget*) _tmp35_, GTK_ALIGN_CENTER);
	_tmp36_ = hbox;
	adw_action_row_add_suffix ((AdwActionRow*) self, (GtkWidget*) _tmp36_);
	_tmp37_ = self->priv->_prev;
	gtk_widget_set_valign ((GtkWidget*) _tmp37_, GTK_ALIGN_CENTER);
	_tmp38_ = self->priv->_prev;
	gtk_actionable_set_action_name ((GtkActionable*) _tmp38_, G4_ACTION_APP G4_ACTION_PREV);
	_tmp39_ = self->priv->_prev;
	gtk_button_set_icon_name (_tmp39_, "media-skip-backward-symbolic");
	_tmp40_ = self->priv->_prev;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp40_, _ ("Play Previous"));
	_tmp41_ = self->priv->_prev;
	gtk_widget_add_css_class ((GtkWidget*) _tmp41_, "circular");
	_tmp42_ = self->priv->_prev;
	gtk_widget_add_css_class ((GtkWidget*) _tmp42_, "flat");
	_tmp43_ = hbox;
	_tmp44_ = self->priv->_prev;
	gtk_box_append (_tmp43_, (GtkWidget*) _tmp44_);
	_tmp45_ = self->priv->_play;
	gtk_widget_set_valign ((GtkWidget*) _tmp45_, GTK_ALIGN_CENTER);
	_tmp46_ = self->priv->_play;
	gtk_actionable_set_action_name ((GtkActionable*) _tmp46_, G4_ACTION_APP G4_ACTION_PLAY_PAUSE);
	_tmp47_ = self->priv->_play;
	gtk_button_set_icon_name (_tmp47_, "media-playback-start-symbolic");
	_tmp48_ = self->priv->_play;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp48_, _ ("Play/Pause"));
	_tmp49_ = self->priv->_play;
	gtk_widget_add_css_class ((GtkWidget*) _tmp49_, "circular");
	_tmp50_ = self->priv->_play;
	gtk_widget_add_css_class ((GtkWidget*) _tmp50_, "flat");
	_tmp51_ = hbox;
	_tmp52_ = self->priv->_play;
	gtk_box_append (_tmp51_, (GtkWidget*) _tmp52_);
	_tmp53_ = self->priv->_next;
	gtk_widget_set_valign ((GtkWidget*) _tmp53_, GTK_ALIGN_CENTER);
	_tmp54_ = self->priv->_next;
	gtk_actionable_set_action_name ((GtkActionable*) _tmp54_, G4_ACTION_APP G4_ACTION_NEXT);
	_tmp55_ = self->priv->_next;
	gtk_button_set_icon_name (_tmp55_, "media-skip-forward-symbolic");
	_tmp56_ = self->priv->_next;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp56_, _ ("Play Next"));
	_tmp57_ = self->priv->_next;
	gtk_widget_add_css_class ((GtkWidget*) _tmp57_, "circular");
	_tmp58_ = self->priv->_next;
	gtk_widget_add_css_class ((GtkWidget*) _tmp58_, "flat");
	_tmp59_ = hbox;
	_tmp60_ = self->priv->_next;
	gtk_box_append (_tmp59_, (GtkWidget*) _tmp60_);
	_tmp61_ = g_application_get_default ();
	_tmp62_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp61_, G4_TYPE_APPLICATION, G4Application));
	app = _tmp62_;
	_tmp63_ = app;
	_tmp64_ = g4_application_get_player (_tmp63_);
	_tmp65_ = _tmp64_;
	_tmp66_ = _g_object_ref0 (_tmp65_);
	player = _tmp66_;
	_tmp67_ = player;
	g_signal_connect_object (_tmp67_, "duration-changed", (GCallback) _g4_mini_bar_on_duration_changed_g4_gst_player_duration_changed, self, 0);
	_tmp68_ = player;
	g_signal_connect_object (_tmp68_, "position-updated", (GCallback) _g4_mini_bar_on_position_changed_g4_gst_player_position_updated, self, 0);
	_tmp69_ = player;
	g_signal_connect_object (_tmp69_, "state-changed", (GCallback) _g4_mini_bar_on_state_changed_g4_gst_player_state_changed, self, 0);
	_g_object_unref0 (player);
	_g_object_unref0 (app);
	_g_object_unref0 (hbox);
	_g_object_unref0 (vbox);
	_g_object_unref0 (controller);
	return obj;
}

static void
g4_mini_bar_class_init (G4MiniBarClass * klass,
                        gpointer klass_data)
{
	g4_mini_bar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4MiniBar_private_offset);
	((GtkWidgetClass *) klass)->snapshot = (void (*) (GtkWidget*, GtkSnapshot*)) g4_mini_bar_real_snapshot;
	G_OBJECT_CLASS (klass)->get_property = _vala_g4_mini_bar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_g4_mini_bar_set_property;
	G_OBJECT_CLASS (klass)->constructor = g4_mini_bar_constructor;
	G_OBJECT_CLASS (klass)->finalize = g4_mini_bar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MINI_BAR_COVER_PROPERTY, g4_mini_bar_properties[G4_MINI_BAR_COVER_PROPERTY] = g_param_spec_object ("cover", "cover", "cover", gdk_paintable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MINI_BAR_TITLE_PROPERTY, g4_mini_bar_properties[G4_MINI_BAR_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
}

static void
g4_mini_bar_instance_init (G4MiniBar * self,
                           gpointer klass)
{
	GtkImage* _tmp0_;
	G4StableLabel* _tmp1_;
	GtkLabel* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	GtkButton* _tmp5_;
	G4CrossFadePaintable* _tmp6_;
	self->priv = g4_mini_bar_get_instance_private (self);
	_tmp0_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp0_);
	self->priv->_cover = _tmp0_;
	_tmp1_ = g4_stable_label_new ();
	g_object_ref_sink (_tmp1_);
	self->priv->_title = _tmp1_;
	_tmp2_ = (GtkLabel*) gtk_label_new ("0:00");
	g_object_ref_sink (_tmp2_);
	self->priv->_time = _tmp2_;
	_tmp3_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp3_);
	self->priv->_prev = _tmp3_;
	_tmp4_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp4_);
	self->priv->_play = _tmp4_;
	_tmp5_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp5_);
	self->priv->_next = _tmp5_;
	self->priv->_duration = 0;
	self->priv->_position = 0;
	self->priv->_fade_animation = NULL;
	_tmp6_ = g4_cross_fade_paintable_new (NULL);
	self->priv->_paintable = _tmp6_;
}

static void
g4_mini_bar_finalize (GObject * obj)
{
	G4MiniBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_MINI_BAR, G4MiniBar);
	_g_object_unref0 (self->priv->_cover);
	_g_object_unref0 (self->priv->_title);
	_g_object_unref0 (self->priv->_time);
	_g_object_unref0 (self->priv->_prev);
	_g_object_unref0 (self->priv->_play);
	_g_object_unref0 (self->priv->_next);
	_g_object_unref0 (self->priv->_fade_animation);
	_g_object_unref0 (self->priv->_paintable);
	G_OBJECT_CLASS (g4_mini_bar_parent_class)->finalize (obj);
}

static GType
g4_mini_bar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4MiniBarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_mini_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4MiniBar), 0, (GInstanceInitFunc) g4_mini_bar_instance_init, NULL };
	GType g4_mini_bar_type_id;
	g4_mini_bar_type_id = g_type_register_static (adw_action_row_get_type (), "G4MiniBar", &g_define_type_info, 0);
	G4MiniBar_private_offset = g_type_add_instance_private (g4_mini_bar_type_id, sizeof (G4MiniBarPrivate));
	return g4_mini_bar_type_id;
}

GType
g4_mini_bar_get_type (void)
{
	static volatile gsize g4_mini_bar_type_id__once = 0;
	if (g_once_init_enter (&g4_mini_bar_type_id__once)) {
		GType g4_mini_bar_type_id;
		g4_mini_bar_type_id = g4_mini_bar_get_type_once ();
		g_once_init_leave (&g4_mini_bar_type_id__once, g4_mini_bar_type_id);
	}
	return g4_mini_bar_type_id__once;
}

static void
_vala_g4_mini_bar_get_property (GObject * object,
                                guint property_id,
                                GValue * value,
                                GParamSpec * pspec)
{
	G4MiniBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_MINI_BAR, G4MiniBar);
	switch (property_id) {
		case G4_MINI_BAR_COVER_PROPERTY:
		g_value_set_object (value, g4_mini_bar_get_cover (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_g4_mini_bar_set_property (GObject * object,
                                guint property_id,
                                const GValue * value,
                                GParamSpec * pspec)
{
	G4MiniBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_MINI_BAR, G4MiniBar);
	switch (property_id) {
		case G4_MINI_BAR_COVER_PROPERTY:
		g4_mini_bar_set_cover (self, g_value_get_object (value));
		break;
		case G4_MINI_BAR_TITLE_PROPERTY:
		g4_mini_bar_set_title (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

