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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "planify.h"
#include <gio/gio.h>
#include <float.h>
#include <math.h>
#include <gee.h>
#include <glib/gi18n-lib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_SECTION (dialogs_productivity_report_productivity_section_get_type ())
#define DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_SECTION, DialogsProductivityReportProductivitySection))
#define DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_SECTION, DialogsProductivityReportProductivitySectionClass))
#define DIALOGS_PRODUCTIVITY_REPORT_IS_PRODUCTIVITY_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_SECTION))
#define DIALOGS_PRODUCTIVITY_REPORT_IS_PRODUCTIVITY_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_SECTION))
#define DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_SECTION, DialogsProductivityReportProductivitySectionClass))

typedef struct _DialogsProductivityReportProductivitySection DialogsProductivityReportProductivitySection;
typedef struct _DialogsProductivityReportProductivitySectionClass DialogsProductivityReportProductivitySectionClass;
typedef struct _DialogsProductivityReportProductivitySectionPrivate DialogsProductivityReportProductivitySectionPrivate;

#define DIALOGS_PRODUCTIVITY_REPORT_TYPE_STAT_CARD (dialogs_productivity_report_stat_card_get_type ())
#define DIALOGS_PRODUCTIVITY_REPORT_STAT_CARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_PRODUCTIVITY_REPORT_TYPE_STAT_CARD, DialogsProductivityReportStatCard))
#define DIALOGS_PRODUCTIVITY_REPORT_STAT_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_PRODUCTIVITY_REPORT_TYPE_STAT_CARD, DialogsProductivityReportStatCardClass))
#define DIALOGS_PRODUCTIVITY_REPORT_IS_STAT_CARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_PRODUCTIVITY_REPORT_TYPE_STAT_CARD))
#define DIALOGS_PRODUCTIVITY_REPORT_IS_STAT_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_PRODUCTIVITY_REPORT_TYPE_STAT_CARD))
#define DIALOGS_PRODUCTIVITY_REPORT_STAT_CARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_PRODUCTIVITY_REPORT_TYPE_STAT_CARD, DialogsProductivityReportStatCardClass))

typedef struct _DialogsProductivityReportStatCard DialogsProductivityReportStatCard;
typedef struct _DialogsProductivityReportStatCardClass DialogsProductivityReportStatCardClass;
enum  {
	DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_0_PROPERTY,
	DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_NUM_PROPERTIES
};
static GParamSpec* dialogs_productivity_report_productivity_section_properties[DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_SEE_MORE_CLICKED_SIGNAL,
	DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_SETUP_GOALS_CLICKED_SIGNAL,
	DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_NUM_SIGNALS
};
static guint dialogs_productivity_report_productivity_section_signals[DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_NUM_SIGNALS] = {0};

struct _DialogsProductivityReportProductivitySection {
	AdwBin parent_instance;
	DialogsProductivityReportProductivitySectionPrivate * priv;
};

struct _DialogsProductivityReportProductivitySectionClass {
	AdwBinClass parent_class;
};

struct _DialogsProductivityReportProductivitySectionPrivate {
	GtkStack* content_stack;
	GtkRevealer* see_more_revealer;
	DialogsProductivityReportStatCard* today_card;
	DialogsProductivityReportStatCard* week_card;
	DialogsProductivityReportStatCard* month_card;
	GtkLabel* goal_value_label;
	GtkLevelBar* goal_bar;
	GtkLabel* weekly_value_label;
	GtkLevelBar* weekly_bar;
	GtkLabel* motivation_label;
	GtkRevealer* motivation_revealer;
};

static gint DialogsProductivityReportProductivitySection_private_offset;
static gpointer dialogs_productivity_report_productivity_section_parent_class = NULL;

VALA_EXTERN GType dialogs_productivity_report_productivity_section_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsProductivityReportProductivitySection, g_object_unref)
VALA_EXTERN GType dialogs_productivity_report_stat_card_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsProductivityReportStatCard, g_object_unref)
VALA_EXTERN void dialogs_productivity_report_productivity_section_refresh (DialogsProductivityReportProductivitySection* self);
static void dialogs_productivity_report_productivity_section_update_view (DialogsProductivityReportProductivitySection* self);
static void dialogs_productivity_report_productivity_section_load_stats (DialogsProductivityReportProductivitySection* self);
static GDateTime* dialogs_productivity_report_productivity_section_get_week_start (DialogsProductivityReportProductivitySection* self,
                                                                            GDateTime* date,
                                                                            gint start_day);
VALA_EXTERN void dialogs_productivity_report_stat_card_animate_to (DialogsProductivityReportStatCard* self,
                                                       gint target,
                                                       guint duration);
static void __lambda908_ (DialogsProductivityReportProductivitySection* self,
                   gdouble val);
static void ___lambda908__adw_animation_target_func (gdouble value,
                                              gpointer self);
static void __lambda909_ (DialogsProductivityReportProductivitySection* self,
                   gdouble val);
static void ___lambda909__adw_animation_target_func (gdouble value,
                                              gpointer self);
static gchar* dialogs_productivity_report_productivity_section_get_motivation_message (DialogsProductivityReportProductivitySection* self,
                                                                                gint today,
                                                                                gint daily_goal,
                                                                                gint week,
                                                                                gint weekly_goal);
static gboolean __lambda910_ (DialogsProductivityReportProductivitySection* self);
static gboolean ___lambda910__gsource_func (gpointer self);
static GtkWidget* dialogs_productivity_report_productivity_section_build_setup_view (DialogsProductivityReportProductivitySection* self);
static void __lambda911_ (DialogsProductivityReportProductivitySection* self);
static void ___lambda911__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static GtkWidget* dialogs_productivity_report_productivity_section_build_stats_view (DialogsProductivityReportProductivitySection* self);
VALA_EXTERN DialogsProductivityReportStatCard* dialogs_productivity_report_stat_card_new (const gchar* stat_value,
                                                                              const gchar* stat_label);
VALA_EXTERN DialogsProductivityReportStatCard* dialogs_productivity_report_stat_card_construct (GType object_type,
                                                                                    const gchar* stat_value,
                                                                                    const gchar* stat_label);
static GtkWidget* dialogs_productivity_report_productivity_section_build_motivation_card (DialogsProductivityReportProductivitySection* self);
static void __lambda914_ (DialogsProductivityReportProductivitySection* self);
static void ___lambda914__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda912_ (DialogsProductivityReportProductivitySection* self);
static void ___lambda913_ (DialogsProductivityReportProductivitySection* self,
                    gdouble val);
static void ____lambda913__adw_animation_target_func (gdouble value,
                                               gpointer self);
static void ___lambda912__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
VALA_EXTERN DialogsProductivityReportProductivitySection* dialogs_productivity_report_productivity_section_new (void);
VALA_EXTERN DialogsProductivityReportProductivitySection* dialogs_productivity_report_productivity_section_construct (GType object_type);
static GObject * dialogs_productivity_report_productivity_section_constructor (GType type,
                                                                        guint n_construct_properties,
                                                                        GObjectConstructParam * construct_properties);
static void _dialogs_productivity_report_productivity_section___lambda915_ (DialogsProductivityReportProductivitySection* self);
static void __dialogs_productivity_report_productivity_section___lambda915__gtk_button_clicked (GtkButton* _sender,
                                                                                         gpointer self);
static void _dialogs_productivity_report_productivity_section___lambda916_ (DialogsProductivityReportProductivitySection* self);
static gboolean ___lambda917_ (DialogsProductivityReportProductivitySection* self);
static gboolean ____lambda917__gsource_func (gpointer self);
static void __dialogs_productivity_report_productivity_section___lambda916__gtk_widget_map (GtkWidget* _sender,
                                                                                     gpointer self);
static void dialogs_productivity_report_productivity_section_finalize (GObject * obj);
static GType dialogs_productivity_report_productivity_section_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
dialogs_productivity_report_productivity_section_get_instance_private (DialogsProductivityReportProductivitySection* self)
{
	return G_STRUCT_MEMBER_P (self, DialogsProductivityReportProductivitySection_private_offset);
}

void
dialogs_productivity_report_productivity_section_refresh (DialogsProductivityReportProductivitySection* self)
{
	GtkStack* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	dialogs_productivity_report_productivity_section_update_view (self);
	_tmp0_ = self->priv->content_stack;
	_tmp1_ = gtk_stack_get_visible_child_name (_tmp0_);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, "stats") == 0) {
		dialogs_productivity_report_productivity_section_load_stats (self);
	}
}

static void
dialogs_productivity_report_productivity_section_update_view (DialogsProductivityReportProductivitySection* self)
{
	gint daily = 0;
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gint _tmp3_;
	gint weekly = 0;
	ServicesSettings* _tmp4_;
	ServicesSettings* _tmp5_;
	GSettings* _tmp6_;
	gint _tmp7_;
	gboolean _tmp8_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_int (_tmp2_, "daily-task-goal");
	_g_object_unref0 (_tmp1_);
	daily = _tmp3_;
	_tmp4_ = services_settings_get_default ();
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_->settings;
	_tmp7_ = g_settings_get_int (_tmp6_, "weekly-task-goal");
	_g_object_unref0 (_tmp5_);
	weekly = _tmp7_;
	if (daily <= 0) {
		_tmp8_ = weekly <= 0;
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		GtkStack* _tmp9_;
		GtkRevealer* _tmp10_;
		_tmp9_ = self->priv->content_stack;
		gtk_stack_set_visible_child_name (_tmp9_, "setup");
		_tmp10_ = self->priv->see_more_revealer;
		gtk_revealer_set_reveal_child (_tmp10_, FALSE);
	} else {
		GtkStack* _tmp11_;
		GtkRevealer* _tmp12_;
		_tmp11_ = self->priv->content_stack;
		gtk_stack_set_visible_child_name (_tmp11_, "stats");
		_tmp12_ = self->priv->see_more_revealer;
		gtk_revealer_set_reveal_child (_tmp12_, TRUE);
	}
}

static void
__lambda908_ (DialogsProductivityReportProductivitySection* self,
              gdouble val)
{
	GtkLevelBar* _tmp0_;
	_tmp0_ = self->priv->goal_bar;
	gtk_level_bar_set_value (_tmp0_, val);
}

static void
___lambda908__adw_animation_target_func (gdouble value,
                                         gpointer self)
{
	__lambda908_ ((DialogsProductivityReportProductivitySection*) self, value);
}

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

static void
__lambda909_ (DialogsProductivityReportProductivitySection* self,
              gdouble val)
{
	GtkLevelBar* _tmp0_;
	_tmp0_ = self->priv->weekly_bar;
	gtk_level_bar_set_value (_tmp0_, val);
}

static void
___lambda909__adw_animation_target_func (gdouble value,
                                         gpointer self)
{
	__lambda909_ ((DialogsProductivityReportProductivitySection*) self, value);
}

static gboolean
__lambda910_ (DialogsProductivityReportProductivitySection* self)
{
	GtkRevealer* _tmp0_;
	gboolean result;
	_tmp0_ = self->priv->motivation_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, TRUE);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda910__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda910_ ((DialogsProductivityReportProductivitySection*) self);
	return result;
}

static void
dialogs_productivity_report_productivity_section_load_stats (DialogsProductivityReportProductivitySection* self)
{
	GDateTime* now = NULL;
	GDateTime* _tmp0_;
	GDateTime* today = NULL;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	gint start_of_week_day = 0;
	ServicesSettings* _tmp3_;
	ServicesSettings* _tmp4_;
	GSettings* _tmp5_;
	gint _tmp6_;
	GDateTime* week_start = NULL;
	GDateTime* _tmp7_;
	GDateTime* _tmp8_;
	GDateTime* month_start = NULL;
	GDateTime* _tmp9_;
	GDateTime* _tmp10_;
	GDateTime* _tmp11_;
	gint completed_today = 0;
	gint completed_week = 0;
	gint completed_month = 0;
	DialogsProductivityReportStatCard* _tmp53_;
	DialogsProductivityReportStatCard* _tmp54_;
	DialogsProductivityReportStatCard* _tmp55_;
	gint daily_goal = 0;
	ServicesSettings* _tmp56_;
	ServicesSettings* _tmp57_;
	GSettings* _tmp58_;
	gint _tmp59_;
	gint weekly_goal = 0;
	ServicesSettings* _tmp60_;
	ServicesSettings* _tmp61_;
	GSettings* _tmp62_;
	gint _tmp63_;
	gdouble _tmp64_ = 0.0;
	gdouble daily_progress = 0.0;
	gdouble _tmp65_ = 0.0;
	gdouble weekly_progress = 0.0;
	GtkLabel* _tmp66_;
	gchar* _tmp67_;
	gchar* _tmp68_;
	GtkLabel* _tmp69_;
	gchar* _tmp70_;
	gchar* _tmp71_;
	AdwCallbackAnimationTarget* daily_target = NULL;
	AdwCallbackAnimationTarget* _tmp72_;
	AdwTimedAnimation* daily_animation = NULL;
	GtkLevelBar* _tmp73_;
	AdwAnimationTarget* _tmp74_;
	AdwTimedAnimation* _tmp75_ = NULL;
	AdwCallbackAnimationTarget* weekly_target = NULL;
	AdwCallbackAnimationTarget* _tmp76_;
	AdwTimedAnimation* weekly_animation = NULL;
	GtkLevelBar* _tmp77_;
	AdwAnimationTarget* _tmp78_;
	AdwTimedAnimation* _tmp79_ = NULL;
	GtkLabel* _tmp80_;
	gchar* _tmp81_;
	gchar* _tmp82_;
	GtkRevealer* _tmp83_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_date_time_new_now_local ();
	now = _tmp0_;
	_tmp1_ = now;
	_tmp2_ = utils_datetime_get_date_only (_tmp1_);
	today = _tmp2_;
	_tmp3_ = services_settings_get_default ();
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_->settings;
	_tmp6_ = g_settings_get_enum (_tmp5_, "start-week");
	_g_object_unref0 (_tmp4_);
	start_of_week_day = _tmp6_;
	_tmp7_ = today;
	_tmp8_ = dialogs_productivity_report_productivity_section_get_week_start (self, _tmp7_, start_of_week_day);
	week_start = _tmp8_;
	_tmp9_ = now;
	_tmp10_ = now;
	_tmp11_ = g_date_time_new_local (g_date_time_get_year (_tmp9_), g_date_time_get_month (_tmp10_), 1, 0, 0, (gdouble) 0);
	month_start = _tmp11_;
	completed_today = 0;
	completed_week = 0;
	completed_month = 0;
	{
		GeeArrayList* _item_list = NULL;
		ServicesStore* _tmp12_;
		GeeArrayList* _tmp13_;
		GeeArrayList* _tmp14_;
		gint _item_size = 0;
		GeeArrayList* _tmp15_;
		gint _tmp16_;
		gint _tmp17_;
		gint _item_index = 0;
		_tmp12_ = services_store_instance ();
		_tmp13_ = services_store_get_items (_tmp12_);
		_tmp14_ = _tmp13_;
		_item_list = _tmp14_;
		_tmp15_ = _item_list;
		_tmp16_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp15_);
		_tmp17_ = _tmp16_;
		_item_size = _tmp17_;
		_item_index = -1;
		while (TRUE) {
			gint _tmp18_;
			gint _tmp19_;
			ObjectsItem* item = NULL;
			GeeArrayList* _tmp20_;
			gpointer _tmp21_;
			gboolean _tmp22_ = FALSE;
			gboolean _tmp23_ = FALSE;
			ObjectsItem* _tmp24_;
			gboolean _tmp25_;
			gboolean _tmp26_;
			GDateTime* completed_date = NULL;
			ObjectsItem* _tmp31_;
			const gchar* _tmp32_;
			const gchar* _tmp33_;
			GDateTime* _tmp34_;
			GDateTime* _tmp35_;
			GDateTime* completed_date_only = NULL;
			GDateTime* _tmp36_;
			GDateTime* _tmp37_;
			GDateTime* _tmp38_;
			GDateTime* _tmp39_;
			gboolean _tmp41_ = FALSE;
			GDateTime* _tmp42_;
			GDateTime* _tmp43_;
			gboolean _tmp47_ = FALSE;
			GDateTime* _tmp48_;
			GDateTime* _tmp49_;
			_item_index = _item_index + 1;
			_tmp18_ = _item_index;
			_tmp19_ = _item_size;
			if (!(_tmp18_ < _tmp19_)) {
				break;
			}
			_tmp20_ = _item_list;
			_tmp21_ = gee_abstract_list_get ((GeeAbstractList*) _tmp20_, _item_index);
			item = (ObjectsItem*) _tmp21_;
			_tmp24_ = item;
			_tmp25_ = objects_item_get_checked (_tmp24_);
			_tmp26_ = _tmp25_;
			if (!_tmp26_) {
				_tmp23_ = TRUE;
			} else {
				ObjectsItem* _tmp27_;
				const gchar* _tmp28_;
				const gchar* _tmp29_;
				_tmp27_ = item;
				_tmp28_ = objects_item_get_completed_at (_tmp27_);
				_tmp29_ = _tmp28_;
				_tmp23_ = g_strcmp0 (_tmp29_, "") == 0;
			}
			if (_tmp23_) {
				_tmp22_ = TRUE;
			} else {
				ObjectsItem* _tmp30_;
				_tmp30_ = item;
				_tmp22_ = objects_item_was_archived (_tmp30_);
			}
			if (_tmp22_) {
				_g_object_unref0 (item);
				continue;
			}
			_tmp31_ = item;
			_tmp32_ = objects_item_get_completed_at (_tmp31_);
			_tmp33_ = _tmp32_;
			_tmp34_ = utils_datetime_get_date_from_string (_tmp33_);
			completed_date = _tmp34_;
			_tmp35_ = completed_date;
			if (_tmp35_ == NULL) {
				_g_date_time_unref0 (completed_date);
				_g_object_unref0 (item);
				continue;
			}
			_tmp36_ = completed_date;
			_tmp37_ = utils_datetime_get_date_only (_tmp36_);
			completed_date_only = _tmp37_;
			_tmp38_ = completed_date_only;
			_tmp39_ = today;
			if (g_date_time_compare (_tmp38_, _tmp39_) == 0) {
				gint _tmp40_;
				_tmp40_ = completed_today;
				completed_today = _tmp40_ + 1;
			}
			_tmp42_ = completed_date_only;
			_tmp43_ = week_start;
			if (g_date_time_compare (_tmp42_, _tmp43_) >= 0) {
				GDateTime* _tmp44_;
				GDateTime* _tmp45_;
				_tmp44_ = completed_date_only;
				_tmp45_ = today;
				_tmp41_ = g_date_time_compare (_tmp44_, _tmp45_) <= 0;
			} else {
				_tmp41_ = FALSE;
			}
			if (_tmp41_) {
				gint _tmp46_;
				_tmp46_ = completed_week;
				completed_week = _tmp46_ + 1;
			}
			_tmp48_ = completed_date_only;
			_tmp49_ = month_start;
			if (g_date_time_compare (_tmp48_, _tmp49_) >= 0) {
				GDateTime* _tmp50_;
				GDateTime* _tmp51_;
				_tmp50_ = completed_date_only;
				_tmp51_ = today;
				_tmp47_ = g_date_time_compare (_tmp50_, _tmp51_) <= 0;
			} else {
				_tmp47_ = FALSE;
			}
			if (_tmp47_) {
				gint _tmp52_;
				_tmp52_ = completed_month;
				completed_month = _tmp52_ + 1;
			}
			_g_date_time_unref0 (completed_date_only);
			_g_date_time_unref0 (completed_date);
			_g_object_unref0 (item);
		}
	}
	_tmp53_ = self->priv->today_card;
	dialogs_productivity_report_stat_card_animate_to (_tmp53_, completed_today, (guint) 600);
	_tmp54_ = self->priv->week_card;
	dialogs_productivity_report_stat_card_animate_to (_tmp54_, completed_week, (guint) 600);
	_tmp55_ = self->priv->month_card;
	dialogs_productivity_report_stat_card_animate_to (_tmp55_, completed_month, (guint) 600);
	_tmp56_ = services_settings_get_default ();
	_tmp57_ = _tmp56_;
	_tmp58_ = _tmp57_->settings;
	_tmp59_ = g_settings_get_int (_tmp58_, "daily-task-goal");
	_g_object_unref0 (_tmp57_);
	daily_goal = _tmp59_;
	_tmp60_ = services_settings_get_default ();
	_tmp61_ = _tmp60_;
	_tmp62_ = _tmp61_->settings;
	_tmp63_ = g_settings_get_int (_tmp62_, "weekly-task-goal");
	_g_object_unref0 (_tmp61_);
	weekly_goal = _tmp63_;
	if (daily_goal > 0) {
		_tmp64_ = MIN (1.0, ((gdouble) completed_today) / daily_goal);
	} else {
		_tmp64_ = 0.0;
	}
	daily_progress = _tmp64_;
	if (weekly_goal > 0) {
		_tmp65_ = MIN (1.0, ((gdouble) completed_week) / weekly_goal);
	} else {
		_tmp65_ = 0.0;
	}
	weekly_progress = _tmp65_;
	_tmp66_ = self->priv->goal_value_label;
	_tmp67_ = g_strdup_printf ("%d / %d", completed_today, daily_goal);
	_tmp68_ = _tmp67_;
	gtk_label_set_label (_tmp66_, _tmp68_);
	_g_free0 (_tmp68_);
	_tmp69_ = self->priv->weekly_value_label;
	_tmp70_ = g_strdup_printf ("%d / %d", completed_week, weekly_goal);
	_tmp71_ = _tmp70_;
	gtk_label_set_label (_tmp69_, _tmp71_);
	_g_free0 (_tmp71_);
	_tmp72_ = (AdwCallbackAnimationTarget*) adw_callback_animation_target_new (___lambda908__adw_animation_target_func, g_object_ref (self), g_object_unref);
	daily_target = _tmp72_;
	_tmp73_ = self->priv->goal_bar;
	_tmp74_ = _g_object_ref0 ((AdwAnimationTarget*) daily_target);
	_tmp75_ = (AdwTimedAnimation*) adw_timed_animation_new ((GtkWidget*) _tmp73_, (gdouble) 0, daily_progress, (guint) 800, _tmp74_);
	adw_timed_animation_set_easing (_tmp75_, ADW_EASE_OUT_CUBIC);
	daily_animation = _tmp75_;
	adw_animation_play ((AdwAnimation*) daily_animation);
	_tmp76_ = (AdwCallbackAnimationTarget*) adw_callback_animation_target_new (___lambda909__adw_animation_target_func, g_object_ref (self), g_object_unref);
	weekly_target = _tmp76_;
	_tmp77_ = self->priv->weekly_bar;
	_tmp78_ = _g_object_ref0 ((AdwAnimationTarget*) weekly_target);
	_tmp79_ = (AdwTimedAnimation*) adw_timed_animation_new ((GtkWidget*) _tmp77_, (gdouble) 0, weekly_progress, (guint) 800, _tmp78_);
	adw_timed_animation_set_easing (_tmp79_, ADW_EASE_OUT_CUBIC);
	weekly_animation = _tmp79_;
	adw_animation_play ((AdwAnimation*) weekly_animation);
	_tmp80_ = self->priv->motivation_label;
	_tmp81_ = dialogs_productivity_report_productivity_section_get_motivation_message (self, completed_today, daily_goal, completed_week, weekly_goal);
	_tmp82_ = _tmp81_;
	gtk_label_set_label (_tmp80_, _tmp82_);
	_g_free0 (_tmp82_);
	_tmp83_ = self->priv->motivation_revealer;
	gtk_revealer_set_reveal_child (_tmp83_, FALSE);
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 900, ___lambda910__gsource_func, g_object_ref (self), g_object_unref);
	_g_object_unref0 (weekly_animation);
	_g_object_unref0 (weekly_target);
	_g_object_unref0 (daily_animation);
	_g_object_unref0 (daily_target);
	_g_date_time_unref0 (month_start);
	_g_date_time_unref0 (week_start);
	_g_date_time_unref0 (today);
	_g_date_time_unref0 (now);
}

static gchar*
dialogs_productivity_report_productivity_section_get_motivation_message (DialogsProductivityReportProductivitySection* self,
                                                                         gint today,
                                                                         gint daily_goal,
                                                                         gint week,
                                                                         gint weekly_goal)
{
	gdouble _tmp0_ = 0.0;
	gdouble daily_ratio = 0.0;
	gdouble _tmp1_ = 0.0;
	gdouble weekly_ratio = 0.0;
	gboolean _tmp2_ = FALSE;
	gchar* _tmp11_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (daily_goal > 0) {
		_tmp0_ = ((gdouble) today) / daily_goal;
	} else {
		_tmp0_ = (gdouble) 0;
	}
	daily_ratio = _tmp0_;
	if (weekly_goal > 0) {
		_tmp1_ = ((gdouble) week) / weekly_goal;
	} else {
		_tmp1_ = (gdouble) 0;
	}
	weekly_ratio = _tmp1_;
	if (daily_ratio >= 1.0) {
		_tmp2_ = weekly_ratio >= 1.0;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		gchar* _tmp3_;
		_tmp3_ = g_strconcat ("🏆 ", _ ("All goals achieved! You're unstoppable"), NULL);
		result = _tmp3_;
		return result;
	}
	if (daily_ratio >= 1.0) {
		gchar* _tmp4_;
		_tmp4_ = g_strconcat ("🔥 ", _ ("Daily goal crushed! Keep the momentum going"), NULL);
		result = _tmp4_;
		return result;
	}
	if (weekly_ratio >= 1.0) {
		gchar* _tmp5_;
		_tmp5_ = g_strconcat ("🎉 ", _ ("Weekly goal achieved! Enjoy the rest of your week"), NULL);
		result = _tmp5_;
		return result;
	}
	if (today == 0) {
		gchar* _tmp6_;
		_tmp6_ = g_strconcat ("🚀 ", _ ("Start your day, your first task awaits"), NULL);
		result = _tmp6_;
		return result;
	}
	if (daily_ratio >= 0.75) {
		gchar* _tmp7_;
		_tmp7_ = g_strconcat ("💪 ", _ ("Almost there! Just a few more tasks today"), NULL);
		result = _tmp7_;
		return result;
	}
	if (weekly_ratio >= 0.75) {
		gchar* _tmp8_;
		_tmp8_ = g_strconcat ("📈 ", _ ("Great pace this week, you're almost at your goal"), NULL);
		result = _tmp8_;
		return result;
	}
	if (daily_ratio >= 0.5) {
		gchar* _tmp9_;
		_tmp9_ = g_strconcat ("👍 ", _ ("Halfway through your daily goal, nice progress"), NULL);
		result = _tmp9_;
		return result;
	}
	if (weekly_ratio >= 0.5) {
		gchar* _tmp10_;
		_tmp10_ = g_strconcat ("✨ ", _ ("Solid week so far, keep it up"), NULL);
		result = _tmp10_;
		return result;
	}
	_tmp11_ = g_strconcat ("📝 ", _ ("Every task completed is a step forward"), NULL);
	result = _tmp11_;
	return result;
}

static GDateTime*
dialogs_productivity_report_productivity_section_get_week_start (DialogsProductivityReportProductivitySection* self,
                                                                 GDateTime* date,
                                                                 gint start_day)
{
	gint current_dow = 0;
	gint _tmp0_ = 0;
	gint target_dow = 0;
	gint diff = 0;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	GDateTime* _tmp4_;
	GDateTime* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (date != NULL, NULL);
	current_dow = g_date_time_get_day_of_week (date);
	if (start_day == 0) {
		_tmp0_ = 7;
	} else {
		_tmp0_ = start_day;
	}
	target_dow = _tmp0_;
	diff = current_dow - target_dow;
	if (diff < 0) {
		diff += 7;
	}
	_tmp1_ = g_date_time_add_days (date, -diff);
	_tmp2_ = _tmp1_;
	_tmp3_ = utils_datetime_get_date_only (_tmp2_);
	_tmp4_ = _tmp3_;
	_g_date_time_unref0 (_tmp2_);
	result = _tmp4_;
	return result;
}

static void
__lambda911_ (DialogsProductivityReportProductivitySection* self)
{
	g_signal_emit (self, dialogs_productivity_report_productivity_section_signals[DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_SETUP_GOALS_CLICKED_SIGNAL], 0);
}

static void
___lambda911__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda911_ ((DialogsProductivityReportProductivitySection*) self);
}

static GtkWidget*
dialogs_productivity_report_productivity_section_build_setup_view (DialogsProductivityReportProductivitySection* self)
{
	GtkLabel* description_label = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_;
	GtkLabel* _tmp2_ = NULL;
	GtkButton* setup_button = NULL;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_;
	GtkButton* _tmp6_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp7_ = NULL;
	GtkWidget* _tmp8_;
	AdwBin* _tmp9_ = NULL;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("title-2");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = (GtkLabel*) gtk_label_new (_ ("Set your daily and weekly goals to start tracking your productivity"));
	gtk_label_set_wrap (_tmp2_, TRUE);
	gtk_label_set_justify (_tmp2_, GTK_JUSTIFY_CENTER);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp2_, _tmp1_);
	_tmp1_ = (_vala_array_free (_tmp1_, 1, (GDestroyNotify) g_free), NULL);
	gtk_label_set_max_width_chars (_tmp2_, 40);
	g_object_ref_sink (_tmp2_);
	description_label = _tmp2_;
	_tmp3_ = g_strdup ("suggested-action");
	_tmp4_ = g_strdup ("pill");
	_tmp5_ = g_new0 (gchar*, 2 + 1);
	_tmp5_[0] = _tmp3_;
	_tmp5_[1] = _tmp4_;
	_tmp6_ = (GtkButton*) gtk_button_new_with_label (_ ("Set Up Goals"));
	gtk_widget_set_halign ((GtkWidget*) _tmp6_, GTK_ALIGN_CENTER);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp6_, _tmp5_);
	_tmp5_ = (_vala_array_free (_tmp5_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp6_);
	setup_button = _tmp6_;
	g_signal_connect_object (setup_button, "clicked", (GCallback) ___lambda911__gtk_button_clicked, self, 0);
	_tmp7_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 24);
	gtk_widget_set_halign ((GtkWidget*) _tmp7_, GTK_ALIGN_CENTER);
	gtk_widget_set_valign ((GtkWidget*) _tmp7_, GTK_ALIGN_CENTER);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp7_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp7_, 24);
	g_object_ref_sink (_tmp7_);
	box = _tmp7_;
	gtk_box_append (box, (GtkWidget*) description_label);
	gtk_box_append (box, (GtkWidget*) setup_button);
	_tmp8_ = _g_object_ref0 ((GtkWidget*) box);
	_tmp9_ = (AdwBin*) adw_bin_new ();
	adw_bin_set_child (_tmp9_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	result = (GtkWidget*) _tmp9_;
	_g_object_unref0 (box);
	_g_object_unref0 (setup_button);
	_g_object_unref0 (description_label);
	return result;
}

static void
__lambda914_ (DialogsProductivityReportProductivitySection* self)
{
	g_signal_emit (self, dialogs_productivity_report_productivity_section_signals[DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_SETUP_GOALS_CLICKED_SIGNAL], 0);
}

static void
___lambda914__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda914_ ((DialogsProductivityReportProductivitySection*) self);
}

static GtkWidget*
dialogs_productivity_report_productivity_section_build_stats_view (DialogsProductivityReportProductivitySection* self)
{
	DialogsProductivityReportStatCard* _tmp0_;
	DialogsProductivityReportStatCard* _tmp1_;
	DialogsProductivityReportStatCard* _tmp2_;
	GtkGrid* cards_grid = NULL;
	GtkGrid* _tmp3_ = NULL;
	DialogsProductivityReportStatCard* _tmp4_;
	DialogsProductivityReportStatCard* _tmp5_;
	DialogsProductivityReportStatCard* _tmp6_;
	GtkLabel* goal_label = NULL;
	gchar* _tmp7_;
	gchar** _tmp8_;
	GtkLabel* _tmp9_ = NULL;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar** _tmp12_;
	GtkLabel* _tmp13_ = NULL;
	GtkBox* goal_header = NULL;
	GtkBox* _tmp14_;
	GtkLabel* _tmp15_;
	GtkLevelBar* _tmp16_ = NULL;
	GtkBox* goal_box = NULL;
	GtkBox* _tmp17_ = NULL;
	GtkLevelBar* _tmp18_;
	GtkLabel* weekly_label = NULL;
	gchar* _tmp19_;
	gchar** _tmp20_;
	GtkLabel* _tmp21_ = NULL;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar** _tmp24_;
	GtkLabel* _tmp25_ = NULL;
	GtkBox* weekly_header = NULL;
	GtkBox* _tmp26_;
	GtkLabel* _tmp27_;
	GtkLevelBar* _tmp28_ = NULL;
	GtkBox* weekly_box = NULL;
	GtkBox* _tmp29_ = NULL;
	GtkLevelBar* _tmp30_;
	GtkBox* goals_content = NULL;
	GtkBox* _tmp31_ = NULL;
	AdwBin* goals_card = NULL;
	gchar* _tmp32_;
	gchar** _tmp33_;
	GtkWidget* _tmp34_;
	AdwBin* _tmp35_ = NULL;
	GtkBox* stats_box = NULL;
	GtkBox* _tmp36_ = NULL;
	GtkWidget* _tmp37_;
	GtkWidget* _tmp38_;
	GtkButton* edit_goals_button = NULL;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	gchar** _tmp42_;
	GtkButton* _tmp43_ = NULL;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = dialogs_productivity_report_stat_card_new ("0", _ ("Today"));
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->today_card);
	self->priv->today_card = _tmp0_;
	_tmp1_ = dialogs_productivity_report_stat_card_new ("0", _ ("This Week"));
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->week_card);
	self->priv->week_card = _tmp1_;
	_tmp2_ = dialogs_productivity_report_stat_card_new ("0", _ ("This Month"));
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->month_card);
	self->priv->month_card = _tmp2_;
	_tmp3_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp3_, 12);
	gtk_grid_set_column_homogeneous (_tmp3_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp3_, TRUE);
	g_object_ref_sink (_tmp3_);
	cards_grid = _tmp3_;
	_tmp4_ = self->priv->today_card;
	gtk_grid_attach (cards_grid, (GtkWidget*) _tmp4_, 0, 0, 1, 1);
	_tmp5_ = self->priv->week_card;
	gtk_grid_attach (cards_grid, (GtkWidget*) _tmp5_, 1, 0, 1, 1);
	_tmp6_ = self->priv->month_card;
	gtk_grid_attach (cards_grid, (GtkWidget*) _tmp6_, 2, 0, 1, 1);
	_tmp7_ = g_strdup ("caption");
	_tmp8_ = g_new0 (gchar*, 1 + 1);
	_tmp8_[0] = _tmp7_;
	_tmp9_ = (GtkLabel*) gtk_label_new (_ ("Daily Goal"));
	gtk_widget_set_halign ((GtkWidget*) _tmp9_, GTK_ALIGN_START);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp9_, _tmp8_);
	_tmp8_ = (_vala_array_free (_tmp8_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp9_);
	goal_label = _tmp9_;
	_tmp10_ = g_strdup ("caption");
	_tmp11_ = g_strdup ("dimmed");
	_tmp12_ = g_new0 (gchar*, 2 + 1);
	_tmp12_[0] = _tmp10_;
	_tmp12_[1] = _tmp11_;
	_tmp13_ = (GtkLabel*) gtk_label_new ("0 / 0");
	gtk_widget_set_halign ((GtkWidget*) _tmp13_, GTK_ALIGN_END);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp13_, TRUE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp13_, _tmp12_);
	_tmp12_ = (_vala_array_free (_tmp12_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->goal_value_label);
	self->priv->goal_value_label = _tmp13_;
	_tmp14_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp14_);
	goal_header = _tmp14_;
	gtk_box_append (goal_header, (GtkWidget*) goal_label);
	_tmp15_ = self->priv->goal_value_label;
	gtk_box_append (goal_header, (GtkWidget*) _tmp15_);
	_tmp16_ = (GtkLevelBar*) gtk_level_bar_new ();
	gtk_level_bar_set_min_value (_tmp16_, 0.0);
	gtk_level_bar_set_max_value (_tmp16_, 1.0);
	gtk_level_bar_set_value (_tmp16_, 0.0);
	g_object_ref_sink (_tmp16_);
	_g_object_unref0 (self->priv->goal_bar);
	self->priv->goal_bar = _tmp16_;
	_tmp17_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp17_, 4);
	g_object_ref_sink (_tmp17_);
	goal_box = _tmp17_;
	gtk_box_append (goal_box, (GtkWidget*) goal_header);
	_tmp18_ = self->priv->goal_bar;
	gtk_box_append (goal_box, (GtkWidget*) _tmp18_);
	_tmp19_ = g_strdup ("caption");
	_tmp20_ = g_new0 (gchar*, 1 + 1);
	_tmp20_[0] = _tmp19_;
	_tmp21_ = (GtkLabel*) gtk_label_new (_ ("Weekly Goal"));
	gtk_widget_set_halign ((GtkWidget*) _tmp21_, GTK_ALIGN_START);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp21_, _tmp20_);
	_tmp20_ = (_vala_array_free (_tmp20_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp21_);
	weekly_label = _tmp21_;
	_tmp22_ = g_strdup ("caption");
	_tmp23_ = g_strdup ("dimmed");
	_tmp24_ = g_new0 (gchar*, 2 + 1);
	_tmp24_[0] = _tmp22_;
	_tmp24_[1] = _tmp23_;
	_tmp25_ = (GtkLabel*) gtk_label_new ("0 / 0");
	gtk_widget_set_halign ((GtkWidget*) _tmp25_, GTK_ALIGN_END);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp25_, TRUE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp25_, _tmp24_);
	_tmp24_ = (_vala_array_free (_tmp24_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp25_);
	_g_object_unref0 (self->priv->weekly_value_label);
	self->priv->weekly_value_label = _tmp25_;
	_tmp26_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp26_);
	weekly_header = _tmp26_;
	gtk_box_append (weekly_header, (GtkWidget*) weekly_label);
	_tmp27_ = self->priv->weekly_value_label;
	gtk_box_append (weekly_header, (GtkWidget*) _tmp27_);
	_tmp28_ = (GtkLevelBar*) gtk_level_bar_new ();
	gtk_level_bar_set_min_value (_tmp28_, 0.0);
	gtk_level_bar_set_max_value (_tmp28_, 1.0);
	gtk_level_bar_set_value (_tmp28_, 0.0);
	g_object_ref_sink (_tmp28_);
	_g_object_unref0 (self->priv->weekly_bar);
	self->priv->weekly_bar = _tmp28_;
	_tmp29_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp29_, 4);
	g_object_ref_sink (_tmp29_);
	weekly_box = _tmp29_;
	gtk_box_append (weekly_box, (GtkWidget*) weekly_header);
	_tmp30_ = self->priv->weekly_bar;
	gtk_box_append (weekly_box, (GtkWidget*) _tmp30_);
	_tmp31_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp31_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp31_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp31_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp31_, 12);
	g_object_ref_sink (_tmp31_);
	goals_content = _tmp31_;
	gtk_box_append (goals_content, (GtkWidget*) goal_box);
	gtk_box_append (goals_content, (GtkWidget*) weekly_box);
	_tmp32_ = g_strdup ("card");
	_tmp33_ = g_new0 (gchar*, 1 + 1);
	_tmp33_[0] = _tmp32_;
	_tmp34_ = _g_object_ref0 ((GtkWidget*) goals_content);
	_tmp35_ = (AdwBin*) adw_bin_new ();
	gtk_widget_set_css_classes ((GtkWidget*) _tmp35_, _tmp33_);
	_tmp33_ = (_vala_array_free (_tmp33_, 1, (GDestroyNotify) g_free), NULL);
	adw_bin_set_child (_tmp35_, _tmp34_);
	_g_object_unref0 (_tmp34_);
	g_object_ref_sink (_tmp35_);
	goals_card = _tmp35_;
	_tmp36_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp36_, 1);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp36_, 1);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp36_, 1);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp36_, 1);
	g_object_ref_sink (_tmp36_);
	stats_box = _tmp36_;
	gtk_box_append (stats_box, (GtkWidget*) cards_grid);
	gtk_box_append (stats_box, (GtkWidget*) goals_card);
	_tmp37_ = dialogs_productivity_report_productivity_section_build_motivation_card (self);
	_tmp38_ = _tmp37_;
	gtk_box_append (stats_box, _tmp38_);
	_g_object_unref0 (_tmp38_);
	_tmp39_ = g_strdup ("flat");
	_tmp40_ = g_strdup ("caption");
	_tmp41_ = g_strdup ("accent");
	_tmp42_ = g_new0 (gchar*, 3 + 1);
	_tmp42_[0] = _tmp39_;
	_tmp42_[1] = _tmp40_;
	_tmp42_[2] = _tmp41_;
	_tmp43_ = (GtkButton*) gtk_button_new_with_label (_ ("Edit Goals"));
	gtk_widget_set_halign ((GtkWidget*) _tmp43_, GTK_ALIGN_CENTER);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp43_, _tmp42_);
	_tmp42_ = (_vala_array_free (_tmp42_, 3, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp43_);
	edit_goals_button = _tmp43_;
	g_signal_connect_object (edit_goals_button, "clicked", (GCallback) ___lambda914__gtk_button_clicked, self, 0);
	gtk_box_append (stats_box, (GtkWidget*) edit_goals_button);
	result = (GtkWidget*) stats_box;
	_g_object_unref0 (edit_goals_button);
	_g_object_unref0 (goals_card);
	_g_object_unref0 (goals_content);
	_g_object_unref0 (weekly_box);
	_g_object_unref0 (weekly_header);
	_g_object_unref0 (weekly_label);
	_g_object_unref0 (goal_box);
	_g_object_unref0 (goal_header);
	_g_object_unref0 (goal_label);
	_g_object_unref0 (cards_grid);
	return result;
}

static void
___lambda913_ (DialogsProductivityReportProductivitySection* self,
               gdouble val)
{
	GtkLabel* _tmp0_;
	_tmp0_ = self->priv->motivation_label;
	gtk_widget_set_opacity ((GtkWidget*) _tmp0_, val);
}

static void
____lambda913__adw_animation_target_func (gdouble value,
                                          gpointer self)
{
	___lambda913_ ((DialogsProductivityReportProductivitySection*) self, value);
}

static void
__lambda912_ (DialogsProductivityReportProductivitySection* self)
{
	GtkRevealer* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	_tmp0_ = self->priv->motivation_revealer;
	_tmp1_ = gtk_revealer_get_reveal_child (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		AdwCallbackAnimationTarget* fade_target = NULL;
		AdwCallbackAnimationTarget* _tmp3_;
		AdwTimedAnimation* fade_animation = NULL;
		GtkLabel* _tmp4_;
		AdwCallbackAnimationTarget* _tmp5_;
		AdwAnimationTarget* _tmp6_;
		AdwTimedAnimation* _tmp7_ = NULL;
		AdwTimedAnimation* _tmp8_;
		_tmp3_ = (AdwCallbackAnimationTarget*) adw_callback_animation_target_new (____lambda913__adw_animation_target_func, g_object_ref (self), g_object_unref);
		fade_target = _tmp3_;
		_tmp4_ = self->priv->motivation_label;
		_tmp5_ = fade_target;
		_tmp6_ = _g_object_ref0 ((AdwAnimationTarget*) _tmp5_);
		_tmp7_ = (AdwTimedAnimation*) adw_timed_animation_new ((GtkWidget*) _tmp4_, (gdouble) 0, (gdouble) 1, (guint) 500, _tmp6_);
		adw_timed_animation_set_easing (_tmp7_, ADW_EASE_IN_QUAD);
		fade_animation = _tmp7_;
		_tmp8_ = fade_animation;
		adw_animation_play ((AdwAnimation*) _tmp8_);
		_g_object_unref0 (fade_animation);
		_g_object_unref0 (fade_target);
	}
}

static void
___lambda912__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda912_ ((DialogsProductivityReportProductivitySection*) self);
}

static GtkWidget*
dialogs_productivity_report_productivity_section_build_motivation_card (DialogsProductivityReportProductivitySection* self)
{
	gchar* _tmp0_;
	gchar** _tmp1_;
	GtkLabel* _tmp2_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp3_ = NULL;
	GtkLabel* _tmp4_;
	AdwBin* card = NULL;
	gchar* _tmp5_;
	gchar** _tmp6_;
	GtkWidget* _tmp7_;
	AdwBin* _tmp8_ = NULL;
	GtkWidget* _tmp9_;
	GtkRevealer* _tmp10_ = NULL;
	GtkRevealer* _tmp11_;
	GtkRevealer* _tmp12_;
	GtkWidget* _tmp13_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("caption");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_label_set_wrap (_tmp2_, TRUE);
	gtk_widget_set_halign ((GtkWidget*) _tmp2_, GTK_ALIGN_CENTER);
	gtk_label_set_justify (_tmp2_, GTK_JUSTIFY_CENTER);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp2_, _tmp1_);
	_tmp1_ = (_vala_array_free (_tmp1_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_opacity ((GtkWidget*) _tmp2_, (gdouble) 0);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->motivation_label);
	self->priv->motivation_label = _tmp2_;
	_tmp3_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp3_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp3_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp3_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp3_, 12);
	g_object_ref_sink (_tmp3_);
	box = _tmp3_;
	_tmp4_ = self->priv->motivation_label;
	gtk_box_append (box, (GtkWidget*) _tmp4_);
	_tmp5_ = g_strdup ("card");
	_tmp6_ = g_new0 (gchar*, 1 + 1);
	_tmp6_[0] = _tmp5_;
	_tmp7_ = _g_object_ref0 ((GtkWidget*) box);
	_tmp8_ = (AdwBin*) adw_bin_new ();
	gtk_widget_set_css_classes ((GtkWidget*) _tmp8_, _tmp6_);
	_tmp6_ = (_vala_array_free (_tmp6_, 1, (GDestroyNotify) g_free), NULL);
	adw_bin_set_child (_tmp8_, _tmp7_);
	_g_object_unref0 (_tmp7_);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp8_, 2);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp8_, 2);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp8_, 2);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp8_, 2);
	g_object_ref_sink (_tmp8_);
	card = _tmp8_;
	_tmp9_ = _g_object_ref0 ((GtkWidget*) card);
	_tmp10_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_child (_tmp10_, _tmp9_);
	_g_object_unref0 (_tmp9_);
	gtk_revealer_set_transition_type (_tmp10_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	gtk_revealer_set_transition_duration (_tmp10_, (guint) 400);
	gtk_revealer_set_reveal_child (_tmp10_, FALSE);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->motivation_revealer);
	self->priv->motivation_revealer = _tmp10_;
	_tmp11_ = self->priv->motivation_revealer;
	g_signal_connect_object ((GObject*) _tmp11_, "notify::reveal-child", (GCallback) ___lambda912__g_object_notify, self, 0);
	_tmp12_ = self->priv->motivation_revealer;
	_tmp13_ = _g_object_ref0 ((GtkWidget*) _tmp12_);
	result = _tmp13_;
	_g_object_unref0 (card);
	_g_object_unref0 (box);
	return result;
}

DialogsProductivityReportProductivitySection*
dialogs_productivity_report_productivity_section_construct (GType object_type)
{
	DialogsProductivityReportProductivitySection * self = NULL;
	self = (DialogsProductivityReportProductivitySection*) g_object_new (object_type, NULL);
	return self;
}

DialogsProductivityReportProductivitySection*
dialogs_productivity_report_productivity_section_new (void)
{
	return dialogs_productivity_report_productivity_section_construct (DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_SECTION);
}

static void
_dialogs_productivity_report_productivity_section___lambda915_ (DialogsProductivityReportProductivitySection* self)
{
	g_signal_emit (self, dialogs_productivity_report_productivity_section_signals[DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_SEE_MORE_CLICKED_SIGNAL], 0);
}

static void
__dialogs_productivity_report_productivity_section___lambda915__gtk_button_clicked (GtkButton* _sender,
                                                                                    gpointer self)
{
	_dialogs_productivity_report_productivity_section___lambda915_ ((DialogsProductivityReportProductivitySection*) self);
}

static gboolean
___lambda917_ (DialogsProductivityReportProductivitySection* self)
{
	gboolean result;
	dialogs_productivity_report_productivity_section_load_stats (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
____lambda917__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda917_ ((DialogsProductivityReportProductivitySection*) self);
	return result;
}

static void
_dialogs_productivity_report_productivity_section___lambda916_ (DialogsProductivityReportProductivitySection* self)
{
	GtkStack* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	_tmp0_ = self->priv->content_stack;
	_tmp1_ = gtk_stack_get_visible_child_name (_tmp0_);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, "stats") == 0) {
		g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, ____lambda917__gsource_func, g_object_ref (self), g_object_unref);
	}
}

static void
__dialogs_productivity_report_productivity_section___lambda916__gtk_widget_map (GtkWidget* _sender,
                                                                                gpointer self)
{
	_dialogs_productivity_report_productivity_section___lambda916_ ((DialogsProductivityReportProductivitySection*) self);
}

static GObject *
dialogs_productivity_report_productivity_section_constructor (GType type,
                                                              guint n_construct_properties,
                                                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DialogsProductivityReportProductivitySection * self;
	GtkLabel* title_label = NULL;
	gchar* _tmp0_;
	gchar** _tmp1_;
	GtkLabel* _tmp2_ = NULL;
	GtkButton* see_more_button = NULL;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_;
	GtkButton* _tmp6_ = NULL;
	GtkButton* _tmp7_;
	GtkButton* _tmp8_;
	GtkWidget* _tmp9_;
	GtkRevealer* _tmp10_ = NULL;
	GtkBox* header_box = NULL;
	GtkBox* _tmp11_ = NULL;
	GtkBox* _tmp12_;
	GtkLabel* _tmp13_;
	GtkBox* _tmp14_;
	GtkRevealer* _tmp15_;
	GtkStack* _tmp16_ = NULL;
	GtkStack* _tmp17_;
	GtkWidget* _tmp18_;
	GtkWidget* _tmp19_;
	GtkStack* _tmp20_;
	GtkWidget* _tmp21_;
	GtkWidget* _tmp22_;
	GtkBox* section_box = NULL;
	GtkBox* _tmp23_;
	GtkBox* _tmp24_;
	GtkBox* _tmp25_;
	GtkBox* _tmp26_;
	GtkStack* _tmp27_;
	GtkBox* _tmp28_;
	parent_class = G_OBJECT_CLASS (dialogs_productivity_report_productivity_section_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_SECTION, DialogsProductivityReportProductivitySection);
	_tmp0_ = g_strdup ("font-bold");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = (GtkLabel*) gtk_label_new (_ ("Productivity"));
	gtk_widget_set_halign ((GtkWidget*) _tmp2_, GTK_ALIGN_START);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp2_, _tmp1_);
	_tmp1_ = (_vala_array_free (_tmp1_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp2_);
	title_label = _tmp2_;
	_tmp3_ = g_strdup ("flat");
	_tmp4_ = g_strdup ("caption");
	_tmp5_ = g_new0 (gchar*, 2 + 1);
	_tmp5_[0] = _tmp3_;
	_tmp5_[1] = _tmp4_;
	_tmp6_ = (GtkButton*) gtk_button_new_with_label (_ ("See More"));
	gtk_widget_set_halign ((GtkWidget*) _tmp6_, GTK_ALIGN_END);
	gtk_widget_set_valign ((GtkWidget*) _tmp6_, GTK_ALIGN_CENTER);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp6_, TRUE);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp6_, _tmp5_);
	_tmp5_ = (_vala_array_free (_tmp5_, 2, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp6_);
	see_more_button = _tmp6_;
	_tmp7_ = see_more_button;
	g_signal_connect_object (_tmp7_, "clicked", (GCallback) __dialogs_productivity_report_productivity_section___lambda915__gtk_button_clicked, self, 0);
	_tmp8_ = see_more_button;
	_tmp9_ = _g_object_ref0 ((GtkWidget*) _tmp8_);
	_tmp10_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_child (_tmp10_, _tmp9_);
	_g_object_unref0 (_tmp9_);
	gtk_revealer_set_transition_type (_tmp10_, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
	gtk_revealer_set_reveal_child (_tmp10_, FALSE);
	gtk_widget_set_visible ((GtkWidget*) _tmp10_, FALSE);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->see_more_revealer);
	self->priv->see_more_revealer = _tmp10_;
	_tmp11_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp11_, TRUE);
	g_object_ref_sink (_tmp11_);
	header_box = _tmp11_;
	_tmp12_ = header_box;
	_tmp13_ = title_label;
	gtk_box_append (_tmp12_, (GtkWidget*) _tmp13_);
	_tmp14_ = header_box;
	_tmp15_ = self->priv->see_more_revealer;
	gtk_box_append (_tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = (GtkStack*) gtk_stack_new ();
	gtk_stack_set_transition_type (_tmp16_, GTK_STACK_TRANSITION_TYPE_CROSSFADE);
	g_object_ref_sink (_tmp16_);
	_g_object_unref0 (self->priv->content_stack);
	self->priv->content_stack = _tmp16_;
	_tmp17_ = self->priv->content_stack;
	_tmp18_ = dialogs_productivity_report_productivity_section_build_setup_view (self);
	_tmp19_ = _tmp18_;
	gtk_stack_add_named (_tmp17_, _tmp19_, "setup");
	_g_object_unref0 (_tmp19_);
	_tmp20_ = self->priv->content_stack;
	_tmp21_ = dialogs_productivity_report_productivity_section_build_stats_view (self);
	_tmp22_ = _tmp21_;
	gtk_stack_add_named (_tmp20_, _tmp22_, "stats");
	_g_object_unref0 (_tmp22_);
	_tmp23_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
	g_object_ref_sink (_tmp23_);
	section_box = _tmp23_;
	_tmp24_ = section_box;
	_tmp25_ = header_box;
	gtk_box_append (_tmp24_, (GtkWidget*) _tmp25_);
	_tmp26_ = section_box;
	_tmp27_ = self->priv->content_stack;
	gtk_box_append (_tmp26_, (GtkWidget*) _tmp27_);
	_tmp28_ = section_box;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp28_);
	dialogs_productivity_report_productivity_section_update_view (self);
	g_signal_connect_object ((GtkWidget*) self, "map", (GCallback) __dialogs_productivity_report_productivity_section___lambda916__gtk_widget_map, self, 0);
	_g_object_unref0 (section_box);
	_g_object_unref0 (header_box);
	_g_object_unref0 (see_more_button);
	_g_object_unref0 (title_label);
	return obj;
}

static void
dialogs_productivity_report_productivity_section_class_init (DialogsProductivityReportProductivitySectionClass * klass,
                                                             gpointer klass_data)
{
	dialogs_productivity_report_productivity_section_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DialogsProductivityReportProductivitySection_private_offset);
	G_OBJECT_CLASS (klass)->constructor = dialogs_productivity_report_productivity_section_constructor;
	G_OBJECT_CLASS (klass)->finalize = dialogs_productivity_report_productivity_section_finalize;
	dialogs_productivity_report_productivity_section_signals[DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_SEE_MORE_CLICKED_SIGNAL] = g_signal_new ("see-more-clicked", DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_SECTION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	dialogs_productivity_report_productivity_section_signals[DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_SECTION_SETUP_GOALS_CLICKED_SIGNAL] = g_signal_new ("setup-goals-clicked", DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_SECTION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
dialogs_productivity_report_productivity_section_instance_init (DialogsProductivityReportProductivitySection * self,
                                                                gpointer klass)
{
	self->priv = dialogs_productivity_report_productivity_section_get_instance_private (self);
}

static void
dialogs_productivity_report_productivity_section_finalize (GObject * obj)
{
	DialogsProductivityReportProductivitySection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_SECTION, DialogsProductivityReportProductivitySection);
	_g_object_unref0 (self->priv->content_stack);
	_g_object_unref0 (self->priv->see_more_revealer);
	_g_object_unref0 (self->priv->today_card);
	_g_object_unref0 (self->priv->week_card);
	_g_object_unref0 (self->priv->month_card);
	_g_object_unref0 (self->priv->goal_value_label);
	_g_object_unref0 (self->priv->goal_bar);
	_g_object_unref0 (self->priv->weekly_value_label);
	_g_object_unref0 (self->priv->weekly_bar);
	_g_object_unref0 (self->priv->motivation_label);
	_g_object_unref0 (self->priv->motivation_revealer);
	G_OBJECT_CLASS (dialogs_productivity_report_productivity_section_parent_class)->finalize (obj);
}

static GType
dialogs_productivity_report_productivity_section_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DialogsProductivityReportProductivitySectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dialogs_productivity_report_productivity_section_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DialogsProductivityReportProductivitySection), 0, (GInstanceInitFunc) dialogs_productivity_report_productivity_section_instance_init, NULL };
	GType dialogs_productivity_report_productivity_section_type_id;
	dialogs_productivity_report_productivity_section_type_id = g_type_register_static (adw_bin_get_type (), "DialogsProductivityReportProductivitySection", &g_define_type_info, 0);
	DialogsProductivityReportProductivitySection_private_offset = g_type_add_instance_private (dialogs_productivity_report_productivity_section_type_id, sizeof (DialogsProductivityReportProductivitySectionPrivate));
	return dialogs_productivity_report_productivity_section_type_id;
}

GType
dialogs_productivity_report_productivity_section_get_type (void)
{
	static volatile gsize dialogs_productivity_report_productivity_section_type_id__once = 0;
	if (g_once_init_enter (&dialogs_productivity_report_productivity_section_type_id__once)) {
		GType dialogs_productivity_report_productivity_section_type_id;
		dialogs_productivity_report_productivity_section_type_id = dialogs_productivity_report_productivity_section_get_type_once ();
		g_once_init_leave (&dialogs_productivity_report_productivity_section_type_id__once, dialogs_productivity_report_productivity_section_type_id);
	}
	return dialogs_productivity_report_productivity_section_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

