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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <adwaita.h>
#include <float.h>
#include <math.h>
#include <gsk/gsk.h>
#include <graphene-gobject.h>
#include <string.h>

#define TUBA_WIDGETS_FADE_BIN_COLLAPSED_HEIGHT 300
#define TUBA_WIDGETS_FADE_BIN_HEIGHT_THRESHOLD (TUBA_WIDGETS_FADE_BIN_COLLAPSED_HEIGHT + 100)
#define TUBA_WIDGETS_FADE_BIN_FADE_HEIGHT 125.f
#define TUBA_WIDGETS_FADE_BIN_ANIMATION_DURATION ((guint) 300)
#define TUBA_WIDGETS_FADE_BIN_LOTS 1000.f
#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 TUBA_WIDGETS_TYPE_FADE_BIN (tuba_widgets_fade_bin_get_type ())
#define TUBA_WIDGETS_FADE_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_FADE_BIN, TubaWidgetsFadeBin))
#define TUBA_WIDGETS_FADE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_FADE_BIN, TubaWidgetsFadeBinClass))
#define TUBA_WIDGETS_IS_FADE_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_FADE_BIN))
#define TUBA_WIDGETS_IS_FADE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_FADE_BIN))
#define TUBA_WIDGETS_FADE_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_FADE_BIN, TubaWidgetsFadeBinClass))

typedef struct _TubaWidgetsFadeBin TubaWidgetsFadeBin;
typedef struct _TubaWidgetsFadeBinClass TubaWidgetsFadeBinClass;
typedef struct _TubaWidgetsFadeBinPrivate TubaWidgetsFadeBinPrivate;
enum  {
	TUBA_WIDGETS_FADE_BIN_0_PROPERTY,
	TUBA_WIDGETS_FADE_BIN_CHILD_PROPERTY,
	TUBA_WIDGETS_FADE_BIN_REVEAL_PROPERTY,
	TUBA_WIDGETS_FADE_BIN_FADED_PROPERTY,
	TUBA_WIDGETS_FADE_BIN_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_fade_bin_properties[TUBA_WIDGETS_FADE_BIN_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _TubaWidgetsFadeBin {
	GtkWidget parent_instance;
	TubaWidgetsFadeBinPrivate * priv;
};

struct _TubaWidgetsFadeBinClass {
	GtkWidgetClass parent_class;
};

struct _TubaWidgetsFadeBinPrivate {
	GtkWidget* _child;
	gboolean _reveal;
	gboolean _should_fade;
	AdwTimedAnimation* animation;
};

static gint TubaWidgetsFadeBin_private_offset;
static gpointer tuba_widgets_fade_bin_parent_class = NULL;

VALA_EXTERN GType tuba_widgets_fade_bin_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsFadeBin, g_object_unref)
static void tuba_widgets_fade_bin_real_dispose (GObject* base);
VALA_EXTERN GtkWidget* tuba_widgets_fade_bin_get_child (TubaWidgetsFadeBin* self);
VALA_EXTERN void tuba_widgets_fade_bin_set_child (TubaWidgetsFadeBin* self,
                                      GtkWidget* value);
static GtkSizeRequestMode tuba_widgets_fade_bin_real_get_request_mode (GtkWidget* base);
VALA_EXTERN void tuba_widgets_fade_bin_reveal_animated (TubaWidgetsFadeBin* self);
VALA_EXTERN void tuba_widgets_fade_bin_hide_animated (TubaWidgetsFadeBin* self);
static void tuba_widgets_fade_bin_on_animation_end (TubaWidgetsFadeBin* self);
VALA_EXTERN gboolean tuba_widgets_fade_bin_get_reveal (TubaWidgetsFadeBin* self);
VALA_EXTERN void tuba_widgets_fade_bin_set_reveal (TubaWidgetsFadeBin* self,
                                       gboolean value);
static void tuba_widgets_fade_bin_animation_target_cb (TubaWidgetsFadeBin* self,
                                                gdouble value);
static inline gdouble tuba_widgets_fade_bin_lerp (TubaWidgetsFadeBin* self,
                                    gint a,
                                    gint b,
                                    gdouble p);
static inline gdouble tuba_widgets_fade_bin_inverse_lerp (TubaWidgetsFadeBin* self,
                                            gint a,
                                            gint r,
                                            gdouble p);
static void tuba_widgets_fade_bin_real_size_allocate (GtkWidget* base,
                                               gint width,
                                               gint height,
                                               gint baseline);
static void tuba_widgets_fade_bin_set_should_fade (TubaWidgetsFadeBin* self,
                                            gboolean value);
static void tuba_widgets_fade_bin_real_measure (GtkWidget* base,
                                         GtkOrientation orientation,
                                         gint for_size,
                                         gint* minimum,
                                         gint* natural,
                                         gint* minimum_baseline,
                                         gint* natural_baseline);
static void tuba_widgets_fade_bin_real_snapshot (GtkWidget* base,
                                          GtkSnapshot* snapshot);
VALA_EXTERN gboolean tuba_widgets_fade_bin_get_faded (TubaWidgetsFadeBin* self);
VALA_EXTERN TubaWidgetsFadeBin* tuba_widgets_fade_bin_new (void);
VALA_EXTERN TubaWidgetsFadeBin* tuba_widgets_fade_bin_construct (GType object_type);
static gboolean tuba_widgets_fade_bin_get_should_fade (TubaWidgetsFadeBin* self);
static GObject * tuba_widgets_fade_bin_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void _tuba_widgets_fade_bin_animation_target_cb_adw_animation_target_func (gdouble value,
                                                                           gpointer self);
static void _tuba_widgets_fade_bin_on_animation_end_adw_animation_done (AdwAnimation* _sender,
                                                                 gpointer self);
static void tuba_widgets_fade_bin_finalize (GObject * obj);
static GType tuba_widgets_fade_bin_get_type_once (void);
static void _vala_tuba_widgets_fade_bin_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_tuba_widgets_fade_bin_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);

static const GskColorStop TUBA_WIDGETS_FADE_BIN_GRADIENT[2] = {{0.f, {(gfloat) 1, (gfloat) 1, (gfloat) 1, 1.f}}, {1.f, {(gfloat) 0, (gfloat) 0, (gfloat) 0, 0.f}}};

static inline gpointer
tuba_widgets_fade_bin_get_instance_private (TubaWidgetsFadeBin* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsFadeBin_private_offset);
}

static void
tuba_widgets_fade_bin_real_dispose (GObject* base)
{
	TubaWidgetsFadeBin * self;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	self = (TubaWidgetsFadeBin*) base;
	_tmp0_ = tuba_widgets_fade_bin_get_child (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != NULL) {
		GtkWidget* _tmp2_;
		GtkWidget* _tmp3_;
		_tmp2_ = tuba_widgets_fade_bin_get_child (self);
		_tmp3_ = _tmp2_;
		gtk_widget_unparent (_tmp3_);
		tuba_widgets_fade_bin_set_child (self, NULL);
	}
	G_OBJECT_CLASS (tuba_widgets_fade_bin_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
}

static GtkSizeRequestMode
tuba_widgets_fade_bin_real_get_request_mode (GtkWidget* base)
{
	TubaWidgetsFadeBin * self;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	GtkSizeRequestMode result;
	self = (TubaWidgetsFadeBin*) base;
	_tmp0_ = tuba_widgets_fade_bin_get_child (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != NULL) {
		GtkWidget* _tmp2_;
		GtkWidget* _tmp3_;
		_tmp2_ = tuba_widgets_fade_bin_get_child (self);
		_tmp3_ = _tmp2_;
		result = gtk_widget_get_request_mode (_tmp3_);
		return result;
	}
	result = GTK_SIZE_REQUEST_CONSTANT_SIZE;
	return result;
}

void
tuba_widgets_fade_bin_reveal_animated (TubaWidgetsFadeBin* self)
{
	AdwTimedAnimation* _tmp0_;
	AdwTimedAnimation* _tmp1_;
	AdwTimedAnimation* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->animation;
	adw_timed_animation_set_value_from (_tmp0_, 0.0);
	_tmp1_ = self->priv->animation;
	adw_timed_animation_set_value_to (_tmp1_, 1.0);
	_tmp2_ = self->priv->animation;
	adw_animation_play ((AdwAnimation*) _tmp2_);
}

void
tuba_widgets_fade_bin_hide_animated (TubaWidgetsFadeBin* self)
{
	AdwTimedAnimation* _tmp0_;
	AdwTimedAnimation* _tmp1_;
	AdwTimedAnimation* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->animation;
	adw_timed_animation_set_value_from (_tmp0_, 1.0);
	_tmp1_ = self->priv->animation;
	adw_timed_animation_set_value_to (_tmp1_, 0.0);
	_tmp2_ = self->priv->animation;
	adw_animation_play ((AdwAnimation*) _tmp2_);
}

static void
tuba_widgets_fade_bin_on_animation_end (TubaWidgetsFadeBin* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tuba_widgets_fade_bin_get_reveal (self);
	_tmp1_ = _tmp0_;
	tuba_widgets_fade_bin_set_reveal (self, !_tmp1_);
}

static void
tuba_widgets_fade_bin_animation_target_cb (TubaWidgetsFadeBin* self,
                                           gdouble value)
{
	g_return_if_fail (self != NULL);
	gtk_widget_queue_resize ((GtkWidget*) self);
}

static inline gdouble
tuba_widgets_fade_bin_lerp (TubaWidgetsFadeBin* self,
                            gint a,
                            gint b,
                            gdouble p)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = (a * (1.0 - p)) + (b * p);
	return result;
}

static inline gdouble
tuba_widgets_fade_bin_inverse_lerp (TubaWidgetsFadeBin* self,
                                    gint a,
                                    gint r,
                                    gdouble p)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = (r - (a * (1.0 - p))) / p;
	return result;
}

static void
tuba_widgets_fade_bin_real_size_allocate (GtkWidget* base,
                                          gint width,
                                          gint height,
                                          gint baseline)
{
	TubaWidgetsFadeBin * self;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	gint child_min_height = 0;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	gint _tmp4_ = 0;
	gint child_height = 0;
	GtkWidget* _tmp5_;
	GtkWidget* _tmp6_;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_;
	gboolean _tmp9_;
	self = (TubaWidgetsFadeBin*) base;
	_tmp0_ = tuba_widgets_fade_bin_get_child (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		tuba_widgets_fade_bin_set_should_fade (self, FALSE);
		return;
	}
	_tmp2_ = tuba_widgets_fade_bin_get_child (self);
	_tmp3_ = _tmp2_;
	gtk_widget_measure (_tmp3_, GTK_ORIENTATION_VERTICAL, width, &_tmp4_, NULL, NULL, NULL);
	child_min_height = _tmp4_;
	child_height = MAX (height, child_min_height);
	_tmp5_ = tuba_widgets_fade_bin_get_child (self);
	_tmp6_ = _tmp5_;
	gtk_widget_allocate (_tmp6_, width, child_height, baseline, NULL);
	_tmp8_ = tuba_widgets_fade_bin_get_reveal (self);
	_tmp9_ = _tmp8_;
	if (!_tmp9_) {
		_tmp7_ = child_height > TUBA_WIDGETS_FADE_BIN_HEIGHT_THRESHOLD;
	} else {
		_tmp7_ = FALSE;
	}
	tuba_widgets_fade_bin_set_should_fade (self, _tmp7_);
}

static void
tuba_widgets_fade_bin_real_measure (GtkWidget* base,
                                    GtkOrientation orientation,
                                    gint for_size,
                                    gint* minimum,
                                    gint* natural,
                                    gint* minimum_baseline,
                                    gint* natural_baseline)
{
	TubaWidgetsFadeBin * self;
	gint _vala_minimum = 0;
	gint _vala_natural = 0;
	gint _vala_minimum_baseline = 0;
	gint _vala_natural_baseline = 0;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	gint child_for_size = 0;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_;
	gboolean _tmp6_;
	GtkWidget* _tmp13_;
	GtkWidget* _tmp14_;
	gint _tmp15_ = 0;
	gint _tmp16_ = 0;
	gint _tmp17_ = 0;
	gint _tmp18_ = 0;
	gboolean _tmp19_ = FALSE;
	self = (TubaWidgetsFadeBin*) base;
	_tmp0_ = tuba_widgets_fade_bin_get_child (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		_vala_natural_baseline = -1;
		_vala_minimum_baseline = _vala_natural_baseline;
		_vala_natural = 0;
		_vala_minimum = _vala_natural;
		if (minimum) {
			*minimum = _vala_minimum;
		}
		if (natural) {
			*natural = _vala_natural;
		}
		if (minimum_baseline) {
			*minimum_baseline = _vala_minimum_baseline;
		}
		if (natural_baseline) {
			*natural_baseline = _vala_natural_baseline;
		}
		return;
	}
	_tmp5_ = tuba_widgets_fade_bin_get_reveal (self);
	_tmp6_ = _tmp5_;
	if (_tmp6_) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = for_size < TUBA_WIDGETS_FADE_BIN_COLLAPSED_HEIGHT;
	}
	if (_tmp4_) {
		_tmp3_ = TRUE;
	} else {
		_tmp3_ = for_size == -1;
	}
	if (_tmp3_) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = orientation == GTK_ORIENTATION_VERTICAL;
	}
	if (_tmp2_) {
		child_for_size = for_size;
	} else {
		AdwTimedAnimation* _tmp7_;
		gdouble _tmp8_;
		gdouble _tmp9_;
		_tmp7_ = self->priv->animation;
		_tmp8_ = adw_animation_get_value ((AdwAnimation*) _tmp7_);
		_tmp9_ = _tmp8_;
		if (_tmp9_ == 0.0) {
			child_for_size = -1;
		} else {
			AdwTimedAnimation* _tmp10_;
			gdouble _tmp11_;
			gdouble _tmp12_;
			_tmp10_ = self->priv->animation;
			_tmp11_ = adw_animation_get_value ((AdwAnimation*) _tmp10_);
			_tmp12_ = _tmp11_;
			child_for_size = (gint) floor (tuba_widgets_fade_bin_inverse_lerp (self, TUBA_WIDGETS_FADE_BIN_COLLAPSED_HEIGHT, for_size, _tmp12_));
			_vala_assert (child_for_size >= for_size, "child_for_size >= for_size");
		}
	}
	_tmp13_ = tuba_widgets_fade_bin_get_child (self);
	_tmp14_ = _tmp13_;
	gtk_widget_measure (_tmp14_, orientation, child_for_size, &_tmp15_, &_tmp16_, &_tmp17_, &_tmp18_);
	_vala_minimum = _tmp15_;
	_vala_natural = _tmp16_;
	_vala_minimum_baseline = _tmp17_;
	_vala_natural_baseline = _tmp18_;
	if (orientation == GTK_ORIENTATION_VERTICAL) {
		gboolean _tmp20_;
		gboolean _tmp21_;
		_tmp20_ = tuba_widgets_fade_bin_get_reveal (self);
		_tmp21_ = _tmp20_;
		_tmp19_ = !_tmp21_;
	} else {
		_tmp19_ = FALSE;
	}
	if (_tmp19_) {
		_vala_natural_baseline = -1;
		_vala_minimum_baseline = _vala_natural_baseline;
		if (_vala_minimum > TUBA_WIDGETS_FADE_BIN_HEIGHT_THRESHOLD) {
			AdwTimedAnimation* _tmp22_;
			gdouble _tmp23_;
			gdouble _tmp24_;
			_tmp22_ = self->priv->animation;
			_tmp23_ = adw_animation_get_value ((AdwAnimation*) _tmp22_);
			_tmp24_ = _tmp23_;
			_vala_minimum = (gint) ceil (tuba_widgets_fade_bin_lerp (self, TUBA_WIDGETS_FADE_BIN_COLLAPSED_HEIGHT, _vala_minimum, _tmp24_));
		}
		if (_vala_natural > TUBA_WIDGETS_FADE_BIN_HEIGHT_THRESHOLD) {
			AdwTimedAnimation* _tmp25_;
			gdouble _tmp26_;
			gdouble _tmp27_;
			_tmp25_ = self->priv->animation;
			_tmp26_ = adw_animation_get_value ((AdwAnimation*) _tmp25_);
			_tmp27_ = _tmp26_;
			_vala_natural = (gint) ceil (tuba_widgets_fade_bin_lerp (self, TUBA_WIDGETS_FADE_BIN_COLLAPSED_HEIGHT, _vala_natural, _tmp27_));
		}
		_vala_natural = MAX (_vala_minimum, _vala_natural);
	}
	if (minimum) {
		*minimum = _vala_minimum;
	}
	if (natural) {
		*natural = _vala_natural;
	}
	if (minimum_baseline) {
		*minimum_baseline = _vala_minimum_baseline;
	}
	if (natural_baseline) {
		*natural_baseline = _vala_natural_baseline;
	}
}

static void
tuba_widgets_fade_bin_real_snapshot (GtkWidget* base,
                                     GtkSnapshot* snapshot)
{
	TubaWidgetsFadeBin * self;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gint height = 0;
	gint width = 0;
	graphene_rect_t clip_rect = {0};
	graphene_point_t _tmp6_ = {0};
	graphene_size_t _tmp7_ = {0};
	graphene_rect_t _tmp8_ = {0};
	graphene_rect_t _tmp9_;
	graphene_rect_t _tmp10_;
	graphene_point_t _tmp11_ = {0};
	graphene_point_t _tmp12_ = {0};
	GtkWidget* _tmp13_;
	GtkWidget* _tmp14_;
	self = (TubaWidgetsFadeBin*) base;
	g_return_if_fail (snapshot != NULL);
	_tmp0_ = tuba_widgets_fade_bin_get_child (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		GTK_WIDGET_CLASS (tuba_widgets_fade_bin_parent_class)->snapshot (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), snapshot);
		return;
	}
	_tmp2_ = tuba_widgets_fade_bin_get_faded (self);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		GtkWidget* _tmp4_;
		GtkWidget* _tmp5_;
		_tmp4_ = tuba_widgets_fade_bin_get_child (self);
		_tmp5_ = _tmp4_;
		gtk_widget_snapshot_child ((GtkWidget*) self, _tmp5_, snapshot);
		return;
	}
	height = gtk_widget_get_height ((GtkWidget*) self);
	width = gtk_widget_get_width ((GtkWidget*) self);
	memset (&_tmp6_, 0, sizeof (graphene_point_t));
	_tmp6_.x = -TUBA_WIDGETS_FADE_BIN_LOTS;
	_tmp6_.y = -TUBA_WIDGETS_FADE_BIN_LOTS;
	memset (&_tmp7_, 0, sizeof (graphene_size_t));
	_tmp7_.width = width + (2 * TUBA_WIDGETS_FADE_BIN_LOTS);
	_tmp7_.height = height + TUBA_WIDGETS_FADE_BIN_LOTS;
	memset (&_tmp8_, 0, sizeof (graphene_rect_t));
	_tmp8_.origin = _tmp6_;
	_tmp8_.size = _tmp7_;
	clip_rect = _tmp8_;
	_tmp9_ = clip_rect;
	gtk_snapshot_push_clip (snapshot, &_tmp9_);
	gtk_snapshot_push_mask (snapshot, GSK_MASK_MODE_ALPHA);
	_tmp10_ = clip_rect;
	memset (&_tmp11_, 0, sizeof (graphene_point_t));
	_tmp11_.x = (gfloat) 0;
	_tmp11_.y = height - TUBA_WIDGETS_FADE_BIN_FADE_HEIGHT;
	memset (&_tmp12_, 0, sizeof (graphene_point_t));
	_tmp12_.x = (gfloat) 0;
	_tmp12_.y = (gfloat) height;
	gtk_snapshot_append_linear_gradient (snapshot, &_tmp10_, &_tmp11_, &_tmp12_, TUBA_WIDGETS_FADE_BIN_GRADIENT, (gsize) G_N_ELEMENTS (TUBA_WIDGETS_FADE_BIN_GRADIENT));
	gtk_snapshot_pop (snapshot);
	_tmp13_ = tuba_widgets_fade_bin_get_child (self);
	_tmp14_ = _tmp13_;
	gtk_widget_snapshot_child ((GtkWidget*) self, _tmp14_, snapshot);
	gtk_snapshot_pop (snapshot);
	gtk_snapshot_pop (snapshot);
}

TubaWidgetsFadeBin*
tuba_widgets_fade_bin_construct (GType object_type)
{
	TubaWidgetsFadeBin * self = NULL;
	self = (TubaWidgetsFadeBin*) g_object_new (object_type, NULL);
	return self;
}

TubaWidgetsFadeBin*
tuba_widgets_fade_bin_new (void)
{
	return tuba_widgets_fade_bin_construct (TUBA_WIDGETS_TYPE_FADE_BIN);
}

GtkWidget*
tuba_widgets_fade_bin_get_child (TubaWidgetsFadeBin* self)
{
	GtkWidget* result;
	GtkWidget* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_child;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_fade_bin_set_child (TubaWidgetsFadeBin* self,
                                 GtkWidget* value)
{
	GtkWidget* _tmp0_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_child;
	if (_tmp0_ != NULL) {
		GtkWidget* _tmp1_;
		_tmp1_ = self->priv->_child;
		gtk_widget_unparent (_tmp1_);
	}
	self->priv->_child = value;
	_tmp2_ = self->priv->_child;
	if (_tmp2_ != NULL) {
		GtkWidget* _tmp3_;
		_tmp3_ = self->priv->_child;
		gtk_widget_set_parent (_tmp3_, (GtkWidget*) self);
	}
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_fade_bin_properties[TUBA_WIDGETS_FADE_BIN_CHILD_PROPERTY]);
}

gboolean
tuba_widgets_fade_bin_get_reveal (TubaWidgetsFadeBin* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_reveal;
	return result;
}

void
tuba_widgets_fade_bin_set_reveal (TubaWidgetsFadeBin* self,
                                  gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_reveal != value) {
		self->priv->_reveal = value;
		gtk_widget_queue_resize ((GtkWidget*) self);
	}
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_fade_bin_properties[TUBA_WIDGETS_FADE_BIN_REVEAL_PROPERTY]);
}

static gboolean
tuba_widgets_fade_bin_get_should_fade (TubaWidgetsFadeBin* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_should_fade;
	return result;
}

static void
tuba_widgets_fade_bin_set_should_fade (TubaWidgetsFadeBin* self,
                                       gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_should_fade != value) {
		self->priv->_should_fade = value;
		g_object_notify ((GObject*) self, "faded");
	}
}

gboolean
tuba_widgets_fade_bin_get_faded (TubaWidgetsFadeBin* self)
{
	gboolean result;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = tuba_widgets_fade_bin_get_should_fade (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp3_ = tuba_widgets_fade_bin_get_reveal (self);
		_tmp4_ = _tmp3_;
		_tmp0_ = !_tmp4_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static void
_tuba_widgets_fade_bin_animation_target_cb_adw_animation_target_func (gdouble value,
                                                                      gpointer self)
{
	tuba_widgets_fade_bin_animation_target_cb ((TubaWidgetsFadeBin*) self, value);
}

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

static void
_tuba_widgets_fade_bin_on_animation_end_adw_animation_done (AdwAnimation* _sender,
                                                            gpointer self)
{
	tuba_widgets_fade_bin_on_animation_end ((TubaWidgetsFadeBin*) self);
}

static GObject *
tuba_widgets_fade_bin_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaWidgetsFadeBin * self;
	AdwCallbackAnimationTarget* target = NULL;
	AdwCallbackAnimationTarget* _tmp0_;
	AdwCallbackAnimationTarget* _tmp1_;
	AdwAnimationTarget* _tmp2_;
	AdwTimedAnimation* _tmp3_ = NULL;
	AdwTimedAnimation* _tmp4_;
	parent_class = G_OBJECT_CLASS (tuba_widgets_fade_bin_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_FADE_BIN, TubaWidgetsFadeBin);
	gtk_widget_set_overflow ((GtkWidget*) self, GTK_OVERFLOW_HIDDEN);
	_tmp0_ = (AdwCallbackAnimationTarget*) adw_callback_animation_target_new (_tuba_widgets_fade_bin_animation_target_cb_adw_animation_target_func, g_object_ref (self), g_object_unref);
	target = _tmp0_;
	_tmp1_ = target;
	_tmp2_ = _g_object_ref0 ((AdwAnimationTarget*) _tmp1_);
	_tmp3_ = (AdwTimedAnimation*) adw_timed_animation_new ((GtkWidget*) self, 0.0, 1.0, TUBA_WIDGETS_FADE_BIN_ANIMATION_DURATION, _tmp2_);
	adw_timed_animation_set_easing (_tmp3_, ADW_EASE_IN_OUT_QUART);
	_g_object_unref0 (self->priv->animation);
	self->priv->animation = _tmp3_;
	_tmp4_ = self->priv->animation;
	g_signal_connect_object ((AdwAnimation*) _tmp4_, "done", (GCallback) _tuba_widgets_fade_bin_on_animation_end_adw_animation_done, self, 0);
	_g_object_unref0 (target);
	return obj;
}

static void
tuba_widgets_fade_bin_class_init (TubaWidgetsFadeBinClass * klass,
                                  gpointer klass_data)
{
	tuba_widgets_fade_bin_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsFadeBin_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) tuba_widgets_fade_bin_real_dispose;
	((GtkWidgetClass *) klass)->get_request_mode = (GtkSizeRequestMode (*) (GtkWidget*)) tuba_widgets_fade_bin_real_get_request_mode;
	((GtkWidgetClass *) klass)->size_allocate = (void (*) (GtkWidget*, gint, gint, gint)) tuba_widgets_fade_bin_real_size_allocate;
	((GtkWidgetClass *) klass)->measure = (void (*) (GtkWidget*, GtkOrientation, gint, gint*, gint*, gint*, gint*)) tuba_widgets_fade_bin_real_measure;
	((GtkWidgetClass *) klass)->snapshot = (void (*) (GtkWidget*, GtkSnapshot*)) tuba_widgets_fade_bin_real_snapshot;
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_widgets_fade_bin_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_widgets_fade_bin_set_property;
	G_OBJECT_CLASS (klass)->constructor = tuba_widgets_fade_bin_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_fade_bin_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_FADE_BIN_CHILD_PROPERTY, tuba_widgets_fade_bin_properties[TUBA_WIDGETS_FADE_BIN_CHILD_PROPERTY] = g_param_spec_object ("child", "child", "child", gtk_widget_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_FADE_BIN_REVEAL_PROPERTY, tuba_widgets_fade_bin_properties[TUBA_WIDGETS_FADE_BIN_REVEAL_PROPERTY] = g_param_spec_boolean ("reveal", "reveal", "reveal", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_FADE_BIN_FADED_PROPERTY, tuba_widgets_fade_bin_properties[TUBA_WIDGETS_FADE_BIN_FADED_PROPERTY] = g_param_spec_boolean ("faded", "faded", "faded", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
tuba_widgets_fade_bin_instance_init (TubaWidgetsFadeBin * self,
                                     gpointer klass)
{
	self->priv = tuba_widgets_fade_bin_get_instance_private (self);
	self->priv->_child = NULL;
	self->priv->_reveal = FALSE;
	self->priv->_should_fade = FALSE;
}

static void
tuba_widgets_fade_bin_finalize (GObject * obj)
{
	TubaWidgetsFadeBin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_FADE_BIN, TubaWidgetsFadeBin);
	_g_object_unref0 (self->priv->animation);
	G_OBJECT_CLASS (tuba_widgets_fade_bin_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_fade_bin_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsFadeBinClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_fade_bin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsFadeBin), 0, (GInstanceInitFunc) tuba_widgets_fade_bin_instance_init, NULL };
	GType tuba_widgets_fade_bin_type_id;
	tuba_widgets_fade_bin_type_id = g_type_register_static (gtk_widget_get_type (), "TubaWidgetsFadeBin", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaWidgetsFadeBin_private_offset = g_type_add_instance_private (tuba_widgets_fade_bin_type_id, sizeof (TubaWidgetsFadeBinPrivate));
	return tuba_widgets_fade_bin_type_id;
}

GType
tuba_widgets_fade_bin_get_type (void)
{
	static GType tuba_widgets_fade_bin_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_widgets_fade_bin_type_id__once)) {
		GType tuba_widgets_fade_bin_type_id;
		tuba_widgets_fade_bin_type_id = tuba_widgets_fade_bin_get_type_once ();
		g_once_init_leave_pointer (&tuba_widgets_fade_bin_type_id__once, tuba_widgets_fade_bin_type_id);
	}
	return tuba_widgets_fade_bin_type_id__once;
}

static void
_vala_tuba_widgets_fade_bin_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	TubaWidgetsFadeBin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_FADE_BIN, TubaWidgetsFadeBin);
	switch (property_id) {
		case TUBA_WIDGETS_FADE_BIN_CHILD_PROPERTY:
		g_value_set_object (value, tuba_widgets_fade_bin_get_child (self));
		break;
		case TUBA_WIDGETS_FADE_BIN_REVEAL_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_fade_bin_get_reveal (self));
		break;
		case TUBA_WIDGETS_FADE_BIN_FADED_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_fade_bin_get_faded (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_widgets_fade_bin_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	TubaWidgetsFadeBin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_FADE_BIN, TubaWidgetsFadeBin);
	switch (property_id) {
		case TUBA_WIDGETS_FADE_BIN_CHILD_PROPERTY:
		tuba_widgets_fade_bin_set_child (self, g_value_get_object (value));
		break;
		case TUBA_WIDGETS_FADE_BIN_REVEAL_PROPERTY:
		tuba_widgets_fade_bin_set_reveal (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

