/* timer-control-buttons.c generated by valac 0.56.19, the Vala compiler
 * generated from timer-control-buttons.vala, do not modify */

/*
 * Copyright (c) 2022-2025 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "ft_core.h"
#include <adwaita.h>
#include <glib-object.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>
#include "ft_ui.h"

#define FT_TIMER_CONTROL_BUTTONS_FADE_IN_DURATION ((guint) 500)
#define FT_TIMER_CONTROL_BUTTONS_FADE_OUT_DURATION ((guint) 500)
#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

typedef struct _FtTimerControlButtons FtTimerControlButtons;
typedef struct _FtTimerControlButtonsClass FtTimerControlButtonsClass;
typedef struct _FtTimerControlButtonsPrivate FtTimerControlButtonsPrivate;
enum  {
	FT_TIMER_CONTROL_BUTTONS_0_PROPERTY,
	FT_TIMER_CONTROL_BUTTONS_HAS_SUGGESTED_ACTION_PROPERTY,
	FT_TIMER_CONTROL_BUTTONS_CIRCULAR_PROPERTY,
	FT_TIMER_CONTROL_BUTTONS_NUM_PROPERTIES
};
static GParamSpec* ft_timer_control_buttons_properties[FT_TIMER_CONTROL_BUTTONS_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 _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 _FtTimerControlButtons {
	GtkBox parent_instance;
	FtTimerControlButtonsPrivate * priv;
};

struct _FtTimerControlButtonsClass {
	GtkBoxClass parent_class;
};

struct _FtTimerControlButtonsPrivate {
	GtkButton* left_button;
	GtkButton* center_button;
	GtkButton* right_button;
	GtkStack* left_image_stack;
	GtkStack* center_image_stack;
	GtkStack* right_image_stack;
	GtkImage* skip_image;
	FtSessionManager* session_manager;
	FtTimer* timer;
	gulong timer_state_changed_id;
	gulong session_manager_notify_current_session_id;
	GList* animations;
};

static gint FtTimerControlButtons_private_offset;
static gpointer ft_timer_control_buttons_parent_class = NULL;
static GtkBuildableIface * ft_timer_control_buttons_gtk_buildable_parent_iface = NULL;

VALA_EXTERN GtkStackPage* ft_get_stack_page_by_name (GtkStack* stack,
                                         const gchar* name);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void ft_timer_control_buttons_add_animation (FtTimerControlButtons* self,
                                             AdwTimedAnimation* animation);
static void ft_timer_control_buttons_remove_animation_link (FtTimerControlButtons* self,
                                                     GList* link);
static void ft_timer_control_buttons_remove_animation (FtTimerControlButtons* self,
                                                AdwTimedAnimation* animation);
static void ft_timer_control_buttons_stop_animations (FtTimerControlButtons* self);
static AdwTimedAnimation* ft_timer_control_buttons_get_animation (FtTimerControlButtons* self,
                                                           GtkWidget* widget);
static void ft_timer_control_buttons_fade_in (FtTimerControlButtons* self,
                                       GtkWidget* widget,
                                       gboolean animate);
static void ft_timer_control_buttons_fade_out (FtTimerControlButtons* self,
                                        GtkWidget* widget,
                                        gboolean animate);
static gchar* ft_timer_control_buttons_get_action_name (FtTimerControlButtons* self,
                                                 const gchar* page_name);
static void ft_timer_control_buttons_update_buttons (FtTimerControlButtons* self,
                                              gboolean animate);
static void ft_timer_control_buttons_update_images (FtTimerControlButtons* self);
static void ft_timer_control_buttons_on_timer_state_changed (FtTimerControlButtons* self,
                                                      const FtTimerState* current_state,
                                                      const FtTimerState* previous_state);
static void ft_timer_control_buttons_on_session_manager_notify_current_session (FtTimerControlButtons* self);
static void ft_timer_control_buttons_connect_signals (FtTimerControlButtons* self);
static void _ft_timer_control_buttons_on_timer_state_changed_ft_timer_state_changed (FtTimer* _sender,
                                                                              const FtTimerState* current_state,
                                                                              const FtTimerState* previous_state,
                                                                              gpointer self);
static void _ft_timer_control_buttons_on_session_manager_notify_current_session_g_object_notify (GObject* _sender,
                                                                                          GParamSpec* pspec,
                                                                                          gpointer self);
static void ft_timer_control_buttons_disconnect_signals (FtTimerControlButtons* self);
static void ft_timer_control_buttons_real_direction_changed (GtkWidget* base,
                                                      GtkTextDirection previous_direction);
static void ft_timer_control_buttons_real_map (GtkWidget* base);
static void ft_timer_control_buttons_real_unmap (GtkWidget* base);
static void ft_timer_control_buttons_real_dispose (GObject* base);
static GObject * ft_timer_control_buttons_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void ft_timer_control_buttons_finalize (GObject * obj);
static GType ft_timer_control_buttons_get_type_once (void);
static void _vala_ft_timer_control_buttons_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_ft_timer_control_buttons_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

inline GtkStackPage*
ft_get_stack_page_by_name (GtkStack* stack,
                           const gchar* name)
{
	GtkWidget* _tmp0_;
	GtkStackPage* _tmp1_;
	GtkStackPage* _tmp2_;
	GtkStackPage* result;
	g_return_val_if_fail (stack != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = gtk_stack_get_child_by_name (stack, name);
	_tmp1_ = gtk_stack_get_page (stack, _tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

static inline gpointer
ft_timer_control_buttons_get_instance_private (FtTimerControlButtons* self)
{
	return G_STRUCT_MEMBER_P (self, FtTimerControlButtons_private_offset);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static void
ft_timer_control_buttons_add_animation (FtTimerControlButtons* self,
                                        AdwTimedAnimation* animation)
{
	AdwTimedAnimation* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (animation != NULL);
	_tmp0_ = _g_object_ref0 (animation);
	self->priv->animations = g_list_append (self->priv->animations, _tmp0_);
}

static void
ft_timer_control_buttons_remove_animation_link (FtTimerControlButtons* self,
                                                GList* link)
{
	gconstpointer _tmp0_;
	g_return_if_fail (self != NULL);
	if (link == NULL) {
		return;
	}
	_tmp0_ = link->data;
	adw_animation_pause ((AdwAnimation*) ((AdwTimedAnimation*) _tmp0_));
	_g_object_unref0 (link->data);
	link->data = NULL;
	self->priv->animations = g_list_delete_link (self->priv->animations, link);
}

static void
ft_timer_control_buttons_remove_animation (FtTimerControlButtons* self,
                                           AdwTimedAnimation* animation)
{
	GList* link = NULL;
	GList* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (animation != NULL);
	_tmp0_ = self->priv->animations;
	_tmp1_ = g_list_find (_tmp0_, animation);
	link = _tmp1_;
	_tmp2_ = link;
	if (_tmp2_ != NULL) {
		GList* _tmp3_;
		_tmp3_ = link;
		ft_timer_control_buttons_remove_animation_link (self, _tmp3_);
	}
}

static void
ft_timer_control_buttons_stop_animations (FtTimerControlButtons* self)
{
	GList* link = NULL;
	g_return_if_fail (self != NULL);
	while (TRUE) {
		GList* _tmp0_;
		GList* _tmp1_;
		GList* _tmp2_;
		GList* _tmp3_;
		_tmp0_ = self->priv->animations;
		_tmp1_ = g_list_first (_tmp0_);
		link = _tmp1_;
		_tmp2_ = link;
		if (!(_tmp2_ != NULL)) {
			break;
		}
		_tmp3_ = link;
		ft_timer_control_buttons_remove_animation_link (self, _tmp3_);
	}
}

static AdwTimedAnimation*
ft_timer_control_buttons_get_animation (FtTimerControlButtons* self,
                                        GtkWidget* widget)
{
	GList* link = NULL;
	GList* _tmp0_;
	GList* _tmp1_;
	AdwTimedAnimation* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (widget != NULL, NULL);
	_tmp0_ = self->priv->animations;
	_tmp1_ = g_list_first (_tmp0_);
	link = _tmp1_;
	while (TRUE) {
		GList* _tmp2_;
		GList* _tmp3_;
		gconstpointer _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		GList* _tmp9_;
		GList* _tmp10_;
		_tmp2_ = link;
		if (!(_tmp2_ != NULL)) {
			break;
		}
		_tmp3_ = link;
		_tmp4_ = _tmp3_->data;
		_tmp5_ = adw_animation_get_widget ((AdwAnimation*) ((AdwTimedAnimation*) _tmp4_));
		_tmp6_ = _tmp5_;
		if (_tmp6_ == widget) {
			GList* _tmp7_;
			gconstpointer _tmp8_;
			_tmp7_ = link;
			_tmp8_ = _tmp7_->data;
			result = (AdwTimedAnimation*) _tmp8_;
			return result;
		}
		_tmp9_ = link;
		_tmp10_ = _tmp9_->next;
		link = _tmp10_;
	}
	result = NULL;
	return result;
}

static void
ft_timer_control_buttons_fade_in (FtTimerControlButtons* self,
                                  GtkWidget* widget,
                                  gboolean animate)
{
	AdwTimedAnimation* animation = NULL;
	AdwTimedAnimation* _tmp0_;
	AdwTimedAnimation* _tmp1_;
	AdwTimedAnimation* _tmp2_;
	gboolean _tmp4_ = FALSE;
	gdouble _tmp5_;
	gdouble _tmp6_;
	AdwPropertyAnimationTarget* animation_target = NULL;
	AdwPropertyAnimationTarget* _tmp7_;
	gdouble _tmp8_;
	gdouble _tmp9_;
	AdwPropertyAnimationTarget* _tmp10_;
	AdwAnimationTarget* _tmp11_;
	AdwTimedAnimation* _tmp12_;
	AdwTimedAnimation* _tmp13_;
	AdwTimedAnimation* _tmp14_;
	AdwTimedAnimation* _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = ft_timer_control_buttons_get_animation (self, widget);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	animation = _tmp1_;
	_tmp2_ = animation;
	if (_tmp2_ != NULL) {
		AdwTimedAnimation* _tmp3_;
		_tmp3_ = animation;
		ft_timer_control_buttons_remove_animation (self, _tmp3_);
	}
	gtk_widget_set_has_tooltip (widget, TRUE);
	if (!gtk_widget_get_mapped ((GtkWidget*) self)) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = !animate;
	}
	if (_tmp4_) {
		gtk_widget_set_opacity (widget, 1.0);
		_g_object_unref0 (animation);
		return;
	}
	_tmp5_ = gtk_widget_get_opacity (widget);
	_tmp6_ = _tmp5_;
	if (_tmp6_ == 1.0) {
		_g_object_unref0 (animation);
		return;
	}
	_tmp7_ = (AdwPropertyAnimationTarget*) adw_property_animation_target_new ((GObject*) widget, "opacity");
	animation_target = _tmp7_;
	_tmp8_ = gtk_widget_get_opacity (widget);
	_tmp9_ = _tmp8_;
	_tmp10_ = animation_target;
	_tmp11_ = _g_object_ref0 ((AdwAnimationTarget*) _tmp10_);
	_tmp12_ = (AdwTimedAnimation*) adw_timed_animation_new (widget, _tmp9_, 1.0, FT_TIMER_CONTROL_BUTTONS_FADE_IN_DURATION, _tmp11_);
	_g_object_unref0 (animation);
	animation = _tmp12_;
	_tmp13_ = animation;
	adw_timed_animation_set_easing (_tmp13_, ADW_EASE_OUT_QUAD);
	_tmp14_ = animation;
	adw_animation_play ((AdwAnimation*) _tmp14_);
	_tmp15_ = animation;
	ft_timer_control_buttons_add_animation (self, _tmp15_);
	_g_object_unref0 (animation_target);
	_g_object_unref0 (animation);
}

static void
ft_timer_control_buttons_fade_out (FtTimerControlButtons* self,
                                   GtkWidget* widget,
                                   gboolean animate)
{
	AdwTimedAnimation* animation = NULL;
	AdwTimedAnimation* _tmp0_;
	AdwTimedAnimation* _tmp1_;
	AdwTimedAnimation* _tmp2_;
	gboolean _tmp4_ = FALSE;
	gdouble _tmp5_;
	gdouble _tmp6_;
	AdwPropertyAnimationTarget* animation_target = NULL;
	AdwPropertyAnimationTarget* _tmp7_;
	gdouble _tmp8_;
	gdouble _tmp9_;
	AdwPropertyAnimationTarget* _tmp10_;
	AdwAnimationTarget* _tmp11_;
	AdwTimedAnimation* _tmp12_;
	AdwTimedAnimation* _tmp13_;
	AdwTimedAnimation* _tmp14_;
	AdwTimedAnimation* _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = ft_timer_control_buttons_get_animation (self, widget);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	animation = _tmp1_;
	_tmp2_ = animation;
	if (_tmp2_ != NULL) {
		AdwTimedAnimation* _tmp3_;
		_tmp3_ = animation;
		ft_timer_control_buttons_remove_animation (self, _tmp3_);
	}
	gtk_widget_set_has_tooltip (widget, FALSE);
	if (!gtk_widget_get_mapped ((GtkWidget*) self)) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = !animate;
	}
	if (_tmp4_) {
		gtk_widget_set_opacity (widget, 0.0);
		_g_object_unref0 (animation);
		return;
	}
	_tmp5_ = gtk_widget_get_opacity (widget);
	_tmp6_ = _tmp5_;
	if (_tmp6_ == 0.0) {
		_g_object_unref0 (animation);
		return;
	}
	_tmp7_ = (AdwPropertyAnimationTarget*) adw_property_animation_target_new ((GObject*) widget, "opacity");
	animation_target = _tmp7_;
	_tmp8_ = gtk_widget_get_opacity (widget);
	_tmp9_ = _tmp8_;
	_tmp10_ = animation_target;
	_tmp11_ = _g_object_ref0 ((AdwAnimationTarget*) _tmp10_);
	_tmp12_ = (AdwTimedAnimation*) adw_timed_animation_new (widget, _tmp9_, 0.0, FT_TIMER_CONTROL_BUTTONS_FADE_OUT_DURATION, _tmp11_);
	_g_object_unref0 (animation);
	animation = _tmp12_;
	_tmp13_ = animation;
	adw_timed_animation_set_easing (_tmp13_, ADW_EASE_IN_OUT_CUBIC);
	_tmp14_ = animation;
	adw_animation_play ((AdwAnimation*) _tmp14_);
	_tmp15_ = animation;
	ft_timer_control_buttons_add_animation (self, _tmp15_);
	_g_object_unref0 (animation_target);
	_g_object_unref0 (animation);
}

static gchar*
ft_timer_control_buttons_get_action_name (FtTimerControlButtons* self,
                                          const gchar* page_name)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	static GQuark _tmp1_label2 = 0;
	static GQuark _tmp1_label3 = 0;
	static GQuark _tmp1_label4 = 0;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (page_name != NULL, NULL);
	_tmp0_ = page_name;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("advance")))) {
		switch (0) {
			default:
			{
				gchar* _tmp3_;
				_tmp3_ = g_strdup ("session-manager.advance");
				result = _tmp3_;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("skip")))) {
		switch (0) {
			default:
			{
				gchar* _tmp4_;
				_tmp4_ = g_strdup ("session-manager.advance");
				result = _tmp4_;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("skip-break")))) {
		switch (0) {
			default:
			{
				gchar* _tmp5_;
				_tmp5_ = g_strdup ("session-manager.skip-break");
				result = _tmp5_;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label3) ? _tmp1_label3 : (_tmp1_label3 = g_quark_from_static_string ("reset")))) {
		switch (0) {
			default:
			{
				gchar* _tmp6_;
				_tmp6_ = g_strdup ("session-manager.reset");
				result = _tmp6_;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label4) ? _tmp1_label4 : (_tmp1_label4 = g_quark_from_static_string ("stop")))) {
		switch (0) {
			default:
			{
				gchar* _tmp7_;
				_tmp7_ = g_strdup ("timer.reset");
				result = _tmp7_;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				gchar* _tmp8_;
				_tmp8_ = g_strdup_printf ("timer.%s", page_name);
				result = _tmp8_;
				return result;
			}
		}
	}
}

static void
ft_timer_control_buttons_update_buttons (FtTimerControlButtons* self,
                                         gboolean animate)
{
	FtTimeBlock* current_time_block = NULL;
	FtSessionManager* _tmp0_;
	FtTimeBlock* _tmp1_;
	FtTimeBlock* _tmp2_;
	FtTimeBlock* _tmp3_;
	gboolean is_started = FALSE;
	FtTimer* _tmp4_;
	gboolean is_paused = FALSE;
	FtTimer* _tmp5_;
	gboolean is_finished = FALSE;
	FtTimer* _tmp6_;
	gboolean _tmp7_ = FALSE;
	FtTimeBlock* _tmp8_;
	gboolean is_break = FALSE;
	gboolean can_reset = FALSE;
	FtSessionManager* _tmp12_;
	GtkStackPage* left_page = NULL;
	GtkStackPage* center_page = NULL;
	GtkStackPage* right_page = NULL;
	GtkStackPage* _tmp48_;
	GtkStackPage* _tmp70_;
	GtkStackPage* _tmp90_;
	gboolean _tmp117_ = FALSE;
	GtkButton* _tmp118_;
	GtkButton* _tmp119_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->session_manager;
	_tmp1_ = ft_session_manager_get_current_time_block (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	current_time_block = _tmp3_;
	_tmp4_ = self->priv->timer;
	is_started = ft_timer_is_started (_tmp4_);
	_tmp5_ = self->priv->timer;
	is_paused = ft_timer_is_paused (_tmp5_);
	_tmp6_ = self->priv->timer;
	is_finished = ft_timer_is_finished (_tmp6_);
	_tmp8_ = current_time_block;
	if (_tmp8_ != NULL) {
		FtTimeBlock* _tmp9_;
		FtState _tmp10_;
		FtState _tmp11_;
		_tmp9_ = current_time_block;
		_tmp10_ = ft_time_block_get_state (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp7_ = ft_state_is_break (_tmp11_);
	} else {
		_tmp7_ = TRUE;
	}
	is_break = _tmp7_;
	_tmp12_ = self->priv->session_manager;
	can_reset = ft_session_manager_can_reset (_tmp12_);
	left_page = NULL;
	center_page = NULL;
	right_page = NULL;
	if (!is_started) {
		GtkStackPage* _tmp13_ = NULL;
		GtkStackPage* _tmp16_;
		GtkStack* _tmp17_;
		GtkStackPage* _tmp18_;
		GtkStackPage* _tmp19_;
		GtkStackPage* _tmp20_;
		if (can_reset) {
			GtkStack* _tmp14_;
			GtkStackPage* _tmp15_;
			_tmp14_ = self->priv->left_image_stack;
			_tmp15_ = ft_get_stack_page_by_name (_tmp14_, "reset");
			_g_object_unref0 (_tmp13_);
			_tmp13_ = _tmp15_;
		} else {
			_g_object_unref0 (_tmp13_);
			_tmp13_ = NULL;
		}
		_tmp16_ = _tmp13_;
		_tmp13_ = NULL;
		_g_object_unref0 (left_page);
		left_page = _tmp16_;
		_tmp17_ = self->priv->center_image_stack;
		_tmp18_ = ft_get_stack_page_by_name (_tmp17_, "start");
		_g_object_unref0 (center_page);
		center_page = _tmp18_;
		_tmp19_ = center_page;
		_vala_assert (_tmp19_ != NULL, "center_page != null");
		_tmp20_ = left_page;
		if (_tmp20_ != NULL) {
			GtkButton* _tmp21_;
			GtkButton* _tmp22_;
			_tmp21_ = self->priv->left_button;
			ft_timer_control_buttons_fade_in (self, (GtkWidget*) _tmp21_, animate);
			_tmp22_ = self->priv->right_button;
			ft_timer_control_buttons_fade_out (self, (GtkWidget*) _tmp22_, animate);
		} else {
			GtkButton* _tmp23_;
			GtkButton* _tmp24_;
			_tmp23_ = self->priv->left_button;
			ft_timer_control_buttons_fade_out (self, (GtkWidget*) _tmp23_, animate);
			_tmp24_ = self->priv->right_button;
			ft_timer_control_buttons_fade_out (self, (GtkWidget*) _tmp24_, animate);
		}
		_g_object_unref0 (_tmp13_);
	} else {
		GtkStackPage* _tmp43_;
		GtkStackPage* _tmp44_;
		GtkStackPage* _tmp45_;
		GtkButton* _tmp46_;
		GtkButton* _tmp47_;
		if (is_paused) {
			GtkStack* _tmp25_;
			GtkStackPage* _tmp26_;
			GtkStack* _tmp27_;
			GtkStackPage* _tmp28_;
			GtkStack* _tmp29_;
			GtkStackPage* _tmp30_;
			_tmp25_ = self->priv->left_image_stack;
			_tmp26_ = ft_get_stack_page_by_name (_tmp25_, "rewind");
			_g_object_unref0 (left_page);
			left_page = _tmp26_;
			_tmp27_ = self->priv->center_image_stack;
			_tmp28_ = ft_get_stack_page_by_name (_tmp27_, "resume");
			_g_object_unref0 (center_page);
			center_page = _tmp28_;
			_tmp29_ = self->priv->right_image_stack;
			_tmp30_ = ft_get_stack_page_by_name (_tmp29_, "stop");
			_g_object_unref0 (right_page);
			right_page = _tmp30_;
		} else {
			if (is_finished) {
				GtkStack* _tmp31_;
				GtkStackPage* _tmp32_;
				GtkStack* _tmp33_;
				GtkStackPage* _tmp34_;
				GtkStack* _tmp35_;
				GtkStackPage* _tmp36_;
				_tmp31_ = self->priv->left_image_stack;
				_tmp32_ = ft_get_stack_page_by_name (_tmp31_, "rewind");
				_g_object_unref0 (left_page);
				left_page = _tmp32_;
				_tmp33_ = self->priv->center_image_stack;
				_tmp34_ = ft_get_stack_page_by_name (_tmp33_, "advance");
				_g_object_unref0 (center_page);
				center_page = _tmp34_;
				_tmp35_ = self->priv->right_image_stack;
				_tmp36_ = ft_get_stack_page_by_name (_tmp35_, "stop");
				_g_object_unref0 (right_page);
				right_page = _tmp36_;
			} else {
				GtkStack* _tmp37_;
				GtkStackPage* _tmp38_;
				GtkStack* _tmp39_;
				GtkStackPage* _tmp40_;
				GtkStack* _tmp41_;
				GtkStackPage* _tmp42_;
				_tmp37_ = self->priv->left_image_stack;
				_tmp38_ = ft_get_stack_page_by_name (_tmp37_, "rewind");
				_g_object_unref0 (left_page);
				left_page = _tmp38_;
				_tmp39_ = self->priv->center_image_stack;
				_tmp40_ = ft_get_stack_page_by_name (_tmp39_, "pause");
				_g_object_unref0 (center_page);
				center_page = _tmp40_;
				_tmp41_ = self->priv->right_image_stack;
				_tmp42_ = ft_get_stack_page_by_name (_tmp41_, "skip");
				_g_object_unref0 (right_page);
				right_page = _tmp42_;
			}
		}
		_tmp43_ = left_page;
		_vala_assert (_tmp43_ != NULL, "left_page != null");
		_tmp44_ = center_page;
		_vala_assert (_tmp44_ != NULL, "center_page != null");
		_tmp45_ = right_page;
		_vala_assert (_tmp45_ != NULL, "right_page != null");
		_tmp46_ = self->priv->left_button;
		ft_timer_control_buttons_fade_in (self, (GtkWidget*) _tmp46_, animate);
		_tmp47_ = self->priv->right_button;
		ft_timer_control_buttons_fade_in (self, (GtkWidget*) _tmp47_, animate);
	}
	_tmp48_ = left_page;
	if (_tmp48_ != NULL) {
		GtkButton* _tmp49_;
		gdouble _tmp50_;
		gdouble _tmp51_;
		GtkButton* _tmp60_;
		GtkStackPage* _tmp61_;
		const gchar* _tmp62_;
		const gchar* _tmp63_;
		gchar* _tmp64_;
		gchar* _tmp65_;
		GtkButton* _tmp66_;
		GtkStackPage* _tmp67_;
		const gchar* _tmp68_;
		const gchar* _tmp69_;
		_tmp49_ = self->priv->left_button;
		_tmp50_ = gtk_widget_get_opacity ((GtkWidget*) _tmp49_);
		_tmp51_ = _tmp50_;
		if (_tmp51_ > 0.0) {
			GtkStack* _tmp52_;
			GtkStackPage* _tmp53_;
			GtkWidget* _tmp54_;
			GtkWidget* _tmp55_;
			_tmp52_ = self->priv->left_image_stack;
			_tmp53_ = left_page;
			_tmp54_ = gtk_stack_page_get_child (_tmp53_);
			_tmp55_ = _tmp54_;
			gtk_stack_set_visible_child (_tmp52_, _tmp55_);
		} else {
			GtkStack* _tmp56_;
			GtkStackPage* _tmp57_;
			const gchar* _tmp58_;
			const gchar* _tmp59_;
			_tmp56_ = self->priv->left_image_stack;
			_tmp57_ = left_page;
			_tmp58_ = gtk_stack_page_get_name (_tmp57_);
			_tmp59_ = _tmp58_;
			gtk_stack_set_visible_child_full (_tmp56_, _tmp59_, GTK_STACK_TRANSITION_TYPE_NONE);
		}
		_tmp60_ = self->priv->left_button;
		_tmp61_ = left_page;
		_tmp62_ = gtk_stack_page_get_name (_tmp61_);
		_tmp63_ = _tmp62_;
		_tmp64_ = ft_timer_control_buttons_get_action_name (self, _tmp63_);
		_tmp65_ = _tmp64_;
		gtk_actionable_set_action_name ((GtkActionable*) _tmp60_, _tmp65_);
		_g_free0 (_tmp65_);
		_tmp66_ = self->priv->left_button;
		_tmp67_ = left_page;
		_tmp68_ = gtk_stack_page_get_title (_tmp67_);
		_tmp69_ = _tmp68_;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp66_, _tmp69_);
	}
	_tmp70_ = center_page;
	if (_tmp70_ != NULL) {
		GtkStack* _tmp71_;
		GtkStackPage* _tmp72_;
		GtkWidget* _tmp73_;
		GtkWidget* _tmp74_;
		GtkButton* _tmp75_;
		GtkStackPage* _tmp76_;
		const gchar* _tmp77_;
		const gchar* _tmp78_;
		gchar* _tmp79_;
		gchar* _tmp80_;
		const gchar* _tmp81_ = NULL;
		GtkStackPage* _tmp82_;
		const gchar* _tmp83_;
		const gchar* _tmp84_;
		GtkButton* _tmp89_;
		_tmp71_ = self->priv->center_image_stack;
		_tmp72_ = center_page;
		_tmp73_ = gtk_stack_page_get_child (_tmp72_);
		_tmp74_ = _tmp73_;
		gtk_stack_set_visible_child (_tmp71_, _tmp74_);
		_tmp75_ = self->priv->center_button;
		_tmp76_ = center_page;
		_tmp77_ = gtk_stack_page_get_name (_tmp76_);
		_tmp78_ = _tmp77_;
		_tmp79_ = ft_timer_control_buttons_get_action_name (self, _tmp78_);
		_tmp80_ = _tmp79_;
		gtk_actionable_set_action_name ((GtkActionable*) _tmp75_, _tmp80_);
		_g_free0 (_tmp80_);
		_tmp82_ = center_page;
		_tmp83_ = gtk_stack_page_get_name (_tmp82_);
		_tmp84_ = _tmp83_;
		if (g_strcmp0 (_tmp84_, "advance") == 0) {
			const gchar* _tmp85_ = NULL;
			if (is_break) {
				_tmp85_ = _ ("Start Pomodoro");
			} else {
				_tmp85_ = _ ("Take a break");
			}
			_tmp81_ = _tmp85_;
		} else {
			GtkStackPage* _tmp86_;
			const gchar* _tmp87_;
			const gchar* _tmp88_;
			_tmp86_ = center_page;
			_tmp87_ = gtk_stack_page_get_title (_tmp86_);
			_tmp88_ = _tmp87_;
			_tmp81_ = _tmp88_;
		}
		_tmp89_ = self->priv->center_button;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp89_, _tmp81_);
	}
	_tmp90_ = right_page;
	if (_tmp90_ != NULL) {
		GtkButton* _tmp91_;
		gdouble _tmp92_;
		gdouble _tmp93_;
		GtkButton* _tmp102_;
		GtkStackPage* _tmp103_;
		const gchar* _tmp104_;
		const gchar* _tmp105_;
		gchar* _tmp106_;
		gchar* _tmp107_;
		const gchar* _tmp108_ = NULL;
		GtkStackPage* _tmp109_;
		const gchar* _tmp110_;
		const gchar* _tmp111_;
		GtkButton* _tmp116_;
		_tmp91_ = self->priv->right_button;
		_tmp92_ = gtk_widget_get_opacity ((GtkWidget*) _tmp91_);
		_tmp93_ = _tmp92_;
		if (_tmp93_ > 0.0) {
			GtkStack* _tmp94_;
			GtkStackPage* _tmp95_;
			GtkWidget* _tmp96_;
			GtkWidget* _tmp97_;
			_tmp94_ = self->priv->right_image_stack;
			_tmp95_ = right_page;
			_tmp96_ = gtk_stack_page_get_child (_tmp95_);
			_tmp97_ = _tmp96_;
			gtk_stack_set_visible_child (_tmp94_, _tmp97_);
		} else {
			GtkStack* _tmp98_;
			GtkStackPage* _tmp99_;
			const gchar* _tmp100_;
			const gchar* _tmp101_;
			_tmp98_ = self->priv->right_image_stack;
			_tmp99_ = right_page;
			_tmp100_ = gtk_stack_page_get_name (_tmp99_);
			_tmp101_ = _tmp100_;
			gtk_stack_set_visible_child_full (_tmp98_, _tmp101_, GTK_STACK_TRANSITION_TYPE_NONE);
		}
		_tmp102_ = self->priv->right_button;
		_tmp103_ = right_page;
		_tmp104_ = gtk_stack_page_get_name (_tmp103_);
		_tmp105_ = _tmp104_;
		_tmp106_ = ft_timer_control_buttons_get_action_name (self, _tmp105_);
		_tmp107_ = _tmp106_;
		gtk_actionable_set_action_name ((GtkActionable*) _tmp102_, _tmp107_);
		_g_free0 (_tmp107_);
		_tmp109_ = right_page;
		_tmp110_ = gtk_stack_page_get_name (_tmp109_);
		_tmp111_ = _tmp110_;
		if (g_strcmp0 (_tmp111_, "skip") == 0) {
			const gchar* _tmp112_ = NULL;
			if (is_break) {
				_tmp112_ = _ ("Start Pomodoro");
			} else {
				_tmp112_ = _ ("Take a break");
			}
			_tmp108_ = _tmp112_;
		} else {
			GtkStackPage* _tmp113_;
			const gchar* _tmp114_;
			const gchar* _tmp115_;
			_tmp113_ = right_page;
			_tmp114_ = gtk_stack_page_get_title (_tmp113_);
			_tmp115_ = _tmp114_;
			_tmp108_ = _tmp115_;
		}
		_tmp116_ = self->priv->right_button;
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp116_, _tmp108_);
	}
	if (is_started) {
		_tmp117_ = TRUE;
	} else {
		_tmp117_ = can_reset;
	}
	_tmp118_ = self->priv->left_button;
	gtk_widget_set_can_focus ((GtkWidget*) _tmp118_, _tmp117_);
	_tmp119_ = self->priv->right_button;
	gtk_widget_set_can_focus ((GtkWidget*) _tmp119_, is_started);
	_g_object_unref0 (right_page);
	_g_object_unref0 (center_page);
	_g_object_unref0 (left_page);
	_g_object_unref0 (current_time_block);
}

static void
ft_timer_control_buttons_update_images (FtTimerControlButtons* self)
{
	gboolean is_rtl = FALSE;
	const gchar* _tmp0_ = NULL;
	GtkImage* _tmp1_;
	g_return_if_fail (self != NULL);
	is_rtl = gtk_widget_get_direction ((GtkWidget*) self) == GTK_TEXT_DIR_RTL;
	if (is_rtl) {
		_tmp0_ = "timer-skip-symbolic-rtl";
	} else {
		_tmp0_ = "timer-skip-symbolic";
	}
	_tmp1_ = self->priv->skip_image;
	g_object_set (_tmp1_, "icon-name", _tmp0_, NULL);
}

static void
ft_timer_control_buttons_on_timer_state_changed (FtTimerControlButtons* self,
                                                 const FtTimerState* current_state,
                                                 const FtTimerState* previous_state)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (current_state != NULL);
	g_return_if_fail (previous_state != NULL);
	ft_timer_control_buttons_update_buttons (self, TRUE);
}

/**
         * Hide the reset button once the session has been reset, without animation.
         */
static void
ft_timer_control_buttons_on_session_manager_notify_current_session (FtTimerControlButtons* self)
{
	gboolean _tmp0_ = FALSE;
	FtSessionManager* _tmp1_;
	FtSession* _tmp2_;
	FtSession* _tmp3_;
	gboolean animate = FALSE;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->session_manager;
	_tmp2_ = ft_session_manager_get_current_session (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != NULL) {
		FtSessionManager* _tmp4_;
		FtSession* _tmp5_;
		FtSession* _tmp6_;
		_tmp4_ = self->priv->session_manager;
		_tmp5_ = ft_session_manager_get_current_session (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = !ft_session_is_scheduled (_tmp6_);
	} else {
		_tmp0_ = FALSE;
	}
	animate = _tmp0_;
	ft_timer_control_buttons_update_buttons (self, animate);
}

static void
_ft_timer_control_buttons_on_timer_state_changed_ft_timer_state_changed (FtTimer* _sender,
                                                                         const FtTimerState* current_state,
                                                                         const FtTimerState* previous_state,
                                                                         gpointer self)
{
	ft_timer_control_buttons_on_timer_state_changed ((FtTimerControlButtons*) self, current_state, previous_state);
}

static void
_ft_timer_control_buttons_on_session_manager_notify_current_session_g_object_notify (GObject* _sender,
                                                                                     GParamSpec* pspec,
                                                                                     gpointer self)
{
	ft_timer_control_buttons_on_session_manager_notify_current_session ((FtTimerControlButtons*) self);
}

static void
ft_timer_control_buttons_connect_signals (FtTimerControlButtons* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->timer_state_changed_id == ((gulong) 0)) {
		FtTimer* _tmp0_;
		gulong _tmp1_;
		_tmp0_ = self->priv->timer;
		_tmp1_ = g_signal_connect_object (_tmp0_, "state-changed", (GCallback) _ft_timer_control_buttons_on_timer_state_changed_ft_timer_state_changed, self, G_CONNECT_AFTER);
		self->priv->timer_state_changed_id = _tmp1_;
	}
	if (self->priv->session_manager_notify_current_session_id == ((gulong) 0)) {
		FtSessionManager* _tmp2_;
		gulong _tmp3_;
		_tmp2_ = self->priv->session_manager;
		_tmp3_ = g_signal_connect_object ((GObject*) _tmp2_, "notify::current-session", (GCallback) _ft_timer_control_buttons_on_session_manager_notify_current_session_g_object_notify, self, 0);
		self->priv->session_manager_notify_current_session_id = _tmp3_;
	}
}

static void
ft_timer_control_buttons_disconnect_signals (FtTimerControlButtons* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->timer_state_changed_id != ((gulong) 0)) {
		FtTimer* _tmp0_;
		_tmp0_ = self->priv->timer;
		g_signal_handler_disconnect ((GObject*) _tmp0_, self->priv->timer_state_changed_id);
		self->priv->timer_state_changed_id = (gulong) 0;
	}
	if (self->priv->session_manager_notify_current_session_id != ((gulong) 0)) {
		FtSessionManager* _tmp1_;
		_tmp1_ = self->priv->session_manager;
		g_signal_handler_disconnect ((GObject*) _tmp1_, self->priv->session_manager_notify_current_session_id);
		self->priv->session_manager_notify_current_session_id = (gulong) 0;
	}
}

static void
ft_timer_control_buttons_real_direction_changed (GtkWidget* base,
                                                 GtkTextDirection previous_direction)
{
	FtTimerControlButtons * self;
	self = (FtTimerControlButtons*) base;
	GTK_WIDGET_CLASS (ft_timer_control_buttons_parent_class)->direction_changed ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox), previous_direction);
	ft_timer_control_buttons_update_images (self);
}

static void
ft_timer_control_buttons_real_map (GtkWidget* base)
{
	FtTimerControlButtons * self;
	self = (FtTimerControlButtons*) base;
	ft_timer_control_buttons_update_buttons (self, FALSE);
	ft_timer_control_buttons_connect_signals (self);
	GTK_WIDGET_CLASS (ft_timer_control_buttons_parent_class)->map ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox));
}

static void
ft_timer_control_buttons_real_unmap (GtkWidget* base)
{
	FtTimerControlButtons * self;
	self = (FtTimerControlButtons*) base;
	ft_timer_control_buttons_stop_animations (self);
	ft_timer_control_buttons_disconnect_signals (self);
	GTK_WIDGET_CLASS (ft_timer_control_buttons_parent_class)->unmap ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox));
}

static void
ft_timer_control_buttons_real_dispose (GObject* base)
{
	FtTimerControlButtons * self;
	self = (FtTimerControlButtons*) base;
	ft_timer_control_buttons_stop_animations (self);
	ft_timer_control_buttons_disconnect_signals (self);
	_g_object_unref0 (self->priv->session_manager);
	self->priv->session_manager = NULL;
	_g_object_unref0 (self->priv->timer);
	self->priv->timer = NULL;
	(self->priv->animations == NULL) ? NULL : (self->priv->animations = (_g_list_free__g_object_unref0_ (self->priv->animations), NULL));
	self->priv->animations = NULL;
	G_OBJECT_CLASS (ft_timer_control_buttons_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox));
}

FtTimerControlButtons*
ft_timer_control_buttons_construct (GType object_type)
{
	FtTimerControlButtons * self = NULL;
	self = (FtTimerControlButtons*) g_object_new (object_type, NULL);
	return self;
}

FtTimerControlButtons*
ft_timer_control_buttons_new (void)
{
	return ft_timer_control_buttons_construct (FT_TYPE_TIMER_CONTROL_BUTTONS);
}

gboolean
ft_timer_control_buttons_get_has_suggested_action (FtTimerControlButtons* self)
{
	gboolean result;
	GtkButton* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->center_button;
	result = gtk_widget_has_css_class ((GtkWidget*) _tmp0_, "suggested-action");
	return result;
}

void
ft_timer_control_buttons_set_has_suggested_action (FtTimerControlButtons* self,
                                                   gboolean value)
{
	g_return_if_fail (self != NULL);
	if (value) {
		GtkButton* _tmp0_;
		_tmp0_ = self->priv->center_button;
		gtk_widget_add_css_class ((GtkWidget*) _tmp0_, "suggested-action");
	} else {
		GtkButton* _tmp1_;
		_tmp1_ = self->priv->center_button;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp1_, "suggested-action");
	}
	g_object_notify_by_pspec ((GObject *) self, ft_timer_control_buttons_properties[FT_TIMER_CONTROL_BUTTONS_HAS_SUGGESTED_ACTION_PROPERTY]);
}

gboolean
ft_timer_control_buttons_get_circular (FtTimerControlButtons* self)
{
	gboolean result;
	GtkButton* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->center_button;
	result = gtk_widget_has_css_class ((GtkWidget*) _tmp0_, "circular");
	return result;
}

void
ft_timer_control_buttons_set_circular (FtTimerControlButtons* self,
                                       gboolean value)
{
	g_return_if_fail (self != NULL);
	if (value) {
		GtkButton* _tmp0_;
		GtkButton* _tmp1_;
		GtkButton* _tmp2_;
		_tmp0_ = self->priv->left_button;
		gtk_widget_add_css_class ((GtkWidget*) _tmp0_, "circular");
		_tmp1_ = self->priv->center_button;
		gtk_widget_add_css_class ((GtkWidget*) _tmp1_, "circular");
		_tmp2_ = self->priv->right_button;
		gtk_widget_add_css_class ((GtkWidget*) _tmp2_, "circular");
	} else {
		GtkButton* _tmp3_;
		GtkButton* _tmp4_;
		GtkButton* _tmp5_;
		_tmp3_ = self->priv->left_button;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp3_, "circular");
		_tmp4_ = self->priv->center_button;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp4_, "circular");
		_tmp5_ = self->priv->right_button;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp5_, "circular");
	}
	g_object_notify_by_pspec ((GObject *) self, ft_timer_control_buttons_properties[FT_TIMER_CONTROL_BUTTONS_CIRCULAR_PROPERTY]);
}

static GObject *
ft_timer_control_buttons_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtTimerControlButtons * self;
	FtSessionManager* _tmp0_;
	FtSessionManager* _tmp1_;
	FtTimer* _tmp2_;
	FtTimer* _tmp3_;
	parent_class = G_OBJECT_CLASS (ft_timer_control_buttons_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_TIMER_CONTROL_BUTTONS, FtTimerControlButtons);
	_tmp0_ = ft_session_manager_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->session_manager);
	self->priv->session_manager = _tmp1_;
	_tmp2_ = ft_timer_get_default ();
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->priv->timer);
	self->priv->timer = _tmp3_;
	ft_timer_control_buttons_update_images (self);
	return obj;
}

static void
ft_timer_control_buttons_class_init (FtTimerControlButtonsClass * klass,
                                     gpointer klass_data)
{
	ft_timer_control_buttons_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtTimerControlButtons_private_offset);
	((GtkWidgetClass *) klass)->direction_changed = (void (*) (GtkWidget*, GtkTextDirection)) ft_timer_control_buttons_real_direction_changed;
	((GtkWidgetClass *) klass)->map = (void (*) (GtkWidget*)) ft_timer_control_buttons_real_map;
	((GtkWidgetClass *) klass)->unmap = (void (*) (GtkWidget*)) ft_timer_control_buttons_real_unmap;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) ft_timer_control_buttons_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_timer_control_buttons_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_timer_control_buttons_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_timer_control_buttons_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_timer_control_buttons_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_TIMER_CONTROL_BUTTONS_HAS_SUGGESTED_ACTION_PROPERTY, ft_timer_control_buttons_properties[FT_TIMER_CONTROL_BUTTONS_HAS_SUGGESTED_ACTION_PROPERTY] = g_param_spec_boolean ("has-suggested-action", "has-suggested-action", "has-suggested-action", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_TIMER_CONTROL_BUTTONS_CIRCULAR_PROPERTY, ft_timer_control_buttons_properties[FT_TIMER_CONTROL_BUTTONS_CIRCULAR_PROPERTY] = g_param_spec_boolean ("circular", "circular", "circular", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/io/github/focustimerhq/FocusTimer/ui/main/timer/widgets/timer-control-buttons.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "left_button", FALSE, FtTimerControlButtons_private_offset + G_STRUCT_OFFSET (FtTimerControlButtonsPrivate, left_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "center_button", FALSE, FtTimerControlButtons_private_offset + G_STRUCT_OFFSET (FtTimerControlButtonsPrivate, center_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "right_button", FALSE, FtTimerControlButtons_private_offset + G_STRUCT_OFFSET (FtTimerControlButtonsPrivate, right_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "left_image_stack", FALSE, FtTimerControlButtons_private_offset + G_STRUCT_OFFSET (FtTimerControlButtonsPrivate, left_image_stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "center_image_stack", FALSE, FtTimerControlButtons_private_offset + G_STRUCT_OFFSET (FtTimerControlButtonsPrivate, center_image_stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "right_image_stack", FALSE, FtTimerControlButtons_private_offset + G_STRUCT_OFFSET (FtTimerControlButtonsPrivate, right_image_stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "skip_image", FALSE, FtTimerControlButtons_private_offset + G_STRUCT_OFFSET (FtTimerControlButtonsPrivate, skip_image));
	gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "timercontrolbuttons");
}

static void
ft_timer_control_buttons_gtk_buildable_interface_init (GtkBuildableIface * iface,
                                                       gpointer iface_data)
{
	ft_timer_control_buttons_gtk_buildable_parent_iface = g_type_interface_peek_parent (iface);
}

static void
ft_timer_control_buttons_instance_init (FtTimerControlButtons * self,
                                        gpointer klass)
{
	self->priv = ft_timer_control_buttons_get_instance_private (self);
	self->priv->timer_state_changed_id = (gulong) 0;
	self->priv->session_manager_notify_current_session_id = (gulong) 0;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
ft_timer_control_buttons_finalize (GObject * obj)
{
	FtTimerControlButtons * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_TIMER_CONTROL_BUTTONS, FtTimerControlButtons);
	_g_object_unref0 (self->priv->session_manager);
	_g_object_unref0 (self->priv->timer);
	(self->priv->animations == NULL) ? NULL : (self->priv->animations = (_g_list_free__g_object_unref0_ (self->priv->animations), NULL));
	G_OBJECT_CLASS (ft_timer_control_buttons_parent_class)->finalize (obj);
}

static GType
ft_timer_control_buttons_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtTimerControlButtonsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_timer_control_buttons_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtTimerControlButtons), 0, (GInstanceInitFunc) ft_timer_control_buttons_instance_init, NULL };
	static const GInterfaceInfo gtk_buildable_info = { (GInterfaceInitFunc) ft_timer_control_buttons_gtk_buildable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType ft_timer_control_buttons_type_id;
	ft_timer_control_buttons_type_id = g_type_register_static (gtk_box_get_type (), "FtTimerControlButtons", &g_define_type_info, 0);
	g_type_add_interface_static (ft_timer_control_buttons_type_id, gtk_buildable_get_type (), &gtk_buildable_info);
	FtTimerControlButtons_private_offset = g_type_add_instance_private (ft_timer_control_buttons_type_id, sizeof (FtTimerControlButtonsPrivate));
	return ft_timer_control_buttons_type_id;
}

GType
ft_timer_control_buttons_get_type (void)
{
	static volatile gsize ft_timer_control_buttons_type_id__once = 0;
	if (g_once_init_enter (&ft_timer_control_buttons_type_id__once)) {
		GType ft_timer_control_buttons_type_id;
		ft_timer_control_buttons_type_id = ft_timer_control_buttons_get_type_once ();
		g_once_init_leave (&ft_timer_control_buttons_type_id__once, ft_timer_control_buttons_type_id);
	}
	return ft_timer_control_buttons_type_id__once;
}

static void
_vala_ft_timer_control_buttons_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	FtTimerControlButtons * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_TIMER_CONTROL_BUTTONS, FtTimerControlButtons);
	switch (property_id) {
		case FT_TIMER_CONTROL_BUTTONS_HAS_SUGGESTED_ACTION_PROPERTY:
		g_value_set_boolean (value, ft_timer_control_buttons_get_has_suggested_action (self));
		break;
		case FT_TIMER_CONTROL_BUTTONS_CIRCULAR_PROPERTY:
		g_value_set_boolean (value, ft_timer_control_buttons_get_circular (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_timer_control_buttons_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	FtTimerControlButtons * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_TIMER_CONTROL_BUTTONS, FtTimerControlButtons);
	switch (property_id) {
		case FT_TIMER_CONTROL_BUTTONS_HAS_SUGGESTED_ACTION_PROPERTY:
		ft_timer_control_buttons_set_has_suggested_action (self, g_value_get_boolean (value));
		break;
		case FT_TIMER_CONTROL_BUTTONS_CIRCULAR_PROPERTY:
		ft_timer_control_buttons_set_circular (self, g_value_get_boolean (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;
}

