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

/*
 * Copyright (c) 2013-2025 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Authors: Kamil Prusko <kamilprusko@gmail.com>
 */

#include "ft_ui.h"
#include "ft_core.h"
#include <gio/gio.h>
#include <libpeas.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <config.h>
#include <gtk/gtk.h>
#include <adwaita.h>
#include <gdk/gdk.h>
#include <glib/gi18n-lib.h>
#include <stdio.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

enum  {
	FT_APPLICATION_0_PROPERTY,
	FT_APPLICATION_READY_PROPERTY,
	FT_APPLICATION_NUM_PROPERTIES
};
static GParamSpec* ft_application_properties[FT_APPLICATION_NUM_PROPERTIES];
typedef struct _FtApplicationOption FtApplicationOption;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_variant_dict_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_dict_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define FT_TYPE_DEFAULT_SCREEN_SAVER_PROVIDER (ft_default_screen_saver_provider_get_type ())
#define FT_DEFAULT_SCREEN_SAVER_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FT_TYPE_DEFAULT_SCREEN_SAVER_PROVIDER, FtDefaultScreenSaverProvider))
#define FT_DEFAULT_SCREEN_SAVER_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FT_TYPE_DEFAULT_SCREEN_SAVER_PROVIDER, FtDefaultScreenSaverProviderClass))
#define FT_IS_DEFAULT_SCREEN_SAVER_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FT_TYPE_DEFAULT_SCREEN_SAVER_PROVIDER))
#define FT_IS_DEFAULT_SCREEN_SAVER_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FT_TYPE_DEFAULT_SCREEN_SAVER_PROVIDER))
#define FT_DEFAULT_SCREEN_SAVER_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FT_TYPE_DEFAULT_SCREEN_SAVER_PROVIDER, FtDefaultScreenSaverProviderClass))

typedef struct _FtDefaultScreenSaverProvider FtDefaultScreenSaverProvider;
typedef struct _FtDefaultScreenSaverProviderClass FtDefaultScreenSaverProviderClass;
typedef struct _Block33Data Block33Data;
#define _g_main_context_unref0(var) ((var == NULL) ? NULL : (var = (g_main_context_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
typedef struct _Block34Data Block34Data;
#define _g_option_group_unref0(var) ((var == NULL) ? NULL : (var = (g_option_group_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _FtApplicationPrivate {
	FtKeyboardManager* keyboard_manager;
	FtStatsManager* stats_manager;
	FtEventProducer* event_producer;
	FtEventBus* event_bus;
	FtJobQueue* job_queue;
	FtActionManager* action_manager;
	FtNotificationManager* notification_manager;
	FtScreenOverlayManager* screen_overlay_manager;
	FtBackgroundManager* background_manager;
	FtSoundManager* sound_manager;
	FtScreenSaver* screensaver;
	FtIndicator* indicator;
	FtLogger* logger;
	GSettings* settings;
	PeasExtensionSet* extensions;
	guint save_idle_id;
	FtApplicationDBusService* dbus_service;
	guint dbus_service_id;
	FtTimerDBusService* timer_dbus_service;
	guint timer_dbus_service_id;
	FtSessionDBusService* session_dbus_service;
	guint session_dbus_service_id;
	guint service_hold_id;
	GVariantDict* command_line_options;
	gboolean preferences_requested;
	gboolean _ready;
};

struct _FtApplicationOption {
	gchar* long_name;
	gchar short_name;
	gchar* description;
	GOptionArg arg_type;
	gchar* arg_description;
	gchar* group;
	gchar* action_name;
	GVariant* action_parameter;
	gboolean is_exclusive;
	gint order;
	gboolean bool_value;
	gint int_value;
};

struct _Block33Data {
	int _ref_count_;
	FtApplication* self;
	GMainContext* main_context;
	gboolean restored;
};

struct _Block34Data {
	int _ref_count_;
	FtApplication* self;
	gint remaining;
};

static gint FtApplication_private_offset;
static gpointer ft_application_parent_class = NULL;
static FtApplicationOption** ft_application_OPTIONS;
static gint ft_application_OPTIONS_length1;
static FtApplicationOption** ft_application_OPTIONS = NULL;
static gint ft_application_OPTIONS_length1 = 0;
static gint _ft_application_OPTIONS_size_ = 0;

static void ft_application_option_free (FtApplicationOption * self);
static GOptionEntry* ft_application_get_option_entries (const gchar* group,
                                                 gint* result_length1);
static void* ft_application_option_get_arg_data (FtApplicationOption* self);
static void _vala_array_add21 (GOptionEntry* * array,
                        gint* length,
                        gint* size,
                        const GOptionEntry* value);
static void _vala_array_add22 (GOptionEntry* * array,
                        gint* length,
                        gint* size,
                        const GOptionEntry* value);
static GSList* ft_application_get_options (void);
static gint __lambda94_ (FtApplicationOption* a,
                  FtApplicationOption* b);
static gint ___lambda94__gcompare_func (gconstpointer a,
                                 gconstpointer b);
static void ft_application_schedule_save (FtApplication* self);
static gboolean __lambda95_ (FtApplication* self);
static void __lambda96_ (FtApplication* self,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda96__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static gboolean ___lambda95__gsource_func (gpointer self);
static void ft_application_show_about_dialog (FtApplication* self);
static void ft_application_show_screen_overlay (FtApplication* self);
static void ft_application_activate_prefixed_action (FtApplication* self,
                                              const gchar* action_name,
                                              GVariant* parameter);
static void ft_application_activate_window (FtApplication* self,
                                     GSimpleAction* action,
                                     GVariant* parameter);
static void ft_application_activate_toggle_window (FtApplication* self,
                                            GSimpleAction* action,
                                            GVariant* parameter);
static void ft_application_activate_preferences (FtApplication* self,
                                          GSimpleAction* action,
                                          GVariant* parameter);
static void ft_application_activate_log (FtApplication* self,
                                  GSimpleAction* action,
                                  GVariant* parameter);
static void ft_application_activate_about (FtApplication* self,
                                    GSimpleAction* action,
                                    GVariant* parameter);
static void ft_application_activate_screen_overlay (FtApplication* self,
                                             GSimpleAction* action,
                                             GVariant* parameter);
static void ft_application_activate_visit_website (FtApplication* self,
                                            GSimpleAction* action,
                                            GVariant* parameter);
static void ft_application_activate_report_issue (FtApplication* self,
                                           GSimpleAction* action,
                                           GVariant* parameter);
static void ft_application_activate_quit (FtApplication* self,
                                   GSimpleAction* action,
                                   GVariant* parameter);
static void ft_application_activate_advance (FtApplication* self,
                                      GSimpleAction* action,
                                      GVariant* parameter);
static void ft_application_activate_advance_to_state (FtApplication* self,
                                               GSimpleAction* action,
                                               GVariant* parameter);
static void ft_application_activate_extend (FtApplication* self,
                                     GSimpleAction* action,
                                     GVariant* parameter);
static void ft_application_setup_resources (FtApplication* self);
static void ft_application_setup_database (FtApplication* self);
static void ft_application_setup_actions (FtApplication* self);
static void _ft_application_activate_window_g_simple_action_activate (GSimpleAction* _sender,
                                                               GVariant* parameter,
                                                               gpointer self);
static void _ft_application_activate_toggle_window_g_simple_action_activate (GSimpleAction* _sender,
                                                                      GVariant* parameter,
                                                                      gpointer self);
static void _ft_application_activate_preferences_g_simple_action_activate (GSimpleAction* _sender,
                                                                    GVariant* parameter,
                                                                    gpointer self);
static void _ft_application_activate_log_g_simple_action_activate (GSimpleAction* _sender,
                                                            GVariant* parameter,
                                                            gpointer self);
static void _ft_application_activate_screen_overlay_g_simple_action_activate (GSimpleAction* _sender,
                                                                       GVariant* parameter,
                                                                       gpointer self);
static void _ft_application_activate_visit_website_g_simple_action_activate (GSimpleAction* _sender,
                                                                      GVariant* parameter,
                                                                      gpointer self);
static void _ft_application_activate_report_issue_g_simple_action_activate (GSimpleAction* _sender,
                                                                     GVariant* parameter,
                                                                     gpointer self);
static void _ft_application_activate_about_g_simple_action_activate (GSimpleAction* _sender,
                                                              GVariant* parameter,
                                                              gpointer self);
static void _ft_application_activate_quit_g_simple_action_activate (GSimpleAction* _sender,
                                                             GVariant* parameter,
                                                             gpointer self);
static void _ft_application_activate_advance_g_simple_action_activate (GSimpleAction* _sender,
                                                                GVariant* parameter,
                                                                gpointer self);
static void _ft_application_activate_advance_to_state_g_simple_action_activate (GSimpleAction* _sender,
                                                                         GVariant* parameter,
                                                                         gpointer self);
static void _ft_application_activate_extend_g_simple_action_activate (GSimpleAction* _sender,
                                                               GVariant* parameter,
                                                               gpointer self);
static void ft_application_on_shortcut_activated (FtApplication* self,
                                           const gchar* shortcut_name);
static void _ft_application_on_shortcut_activated_ft_keyboard_manager_shortcut_activated (FtKeyboardManager* _sender,
                                                                                   const gchar* shortcut_name,
                                                                                   gpointer self);
static void ft_application_setup_providers (FtApplication* self);
VALA_EXTERN FtDefaultScreenSaverProvider* ft_default_screen_saver_provider_new (void);
VALA_EXTERN FtDefaultScreenSaverProvider* ft_default_screen_saver_provider_construct (GType object_type);
VALA_EXTERN GType ft_default_screen_saver_provider_get_type (void) G_GNUC_CONST ;
static void ft_application_setup_plugins (FtApplication* self);
static void _vala_GValue_array_free (GValue * array,
                              gssize array_length);
static void ft_application_update_color_scheme (FtApplication* self);
static void ft_application_real_startup (GApplication* base);
static Block33Data* block33_data_ref (Block33Data* _data33_);
static void block33_data_unref (void * _userdata_);
static void ft_application_on_settings_changed (FtApplication* self,
                                         GSettings* settings,
                                         const gchar* key);
static void _ft_application_on_settings_changed_g_settings_changed (GSettings* _sender,
                                                             const gchar* key,
                                                             gpointer self);
static void ft_application_on_event (FtApplication* self,
                              FtEvent* event);
static void _ft_application_on_event_ft_event_bus_event (FtEventBus* _sender,
                                                  FtEvent* event,
                                                  gpointer self);
static void __lambda97_ (Block33Data* _data33_,
                  GObject* obj,
                  GAsyncResult* res);
static void ft_application_on_enter_session (FtApplication* self,
                                      FtSession* session);
static void _ft_application_on_enter_session_ft_session_manager_enter_session (FtSessionManager* _sender,
                                                                        FtSession* session,
                                                                        gpointer self);
static void ft_application_on_leave_session (FtApplication* self,
                                      FtSession* session);
static void _ft_application_on_leave_session_ft_session_manager_leave_session (FtSessionManager* _sender,
                                                                        FtSession* session,
                                                                        gpointer self);
static void ft_application_on_advanced (FtApplication* self,
                                 FtSession* current_session,
                                 FtTimeBlock* current_time_block,
                                 FtSession* previous_session,
                                 FtTimeBlock* previous_time_block);
static void _ft_application_on_advanced_ft_session_manager_advanced (FtSessionManager* _sender,
                                                              FtSession* current_session,
                                                              FtTimeBlock* current_time_block,
                                                              FtSession* previous_session,
                                                              FtTimeBlock* previous_time_block,
                                                              gpointer self);
static void ___lambda97__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void ___lambda98_ (FtApplication* self,
                   GObject* obj,
                   GAsyncResult* res);
static void ____lambda98__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static GVariant* ft_application_option_get_action_parameter (FtApplicationOption* self,
                                                      GVariant* value);
static void ft_application_set_ready (FtApplication* self,
                               gboolean value);
static void ft_application_print_timer_status (FtApplication* self,
                                        GApplicationCommandLine* command_line);
static void ft_application_print_version (FtApplication* self);
static gint ft_application_real_handle_local_options (GApplication* base,
                                               GVariantDict* options);
static gboolean ft_application_option_is_set (FtApplicationOption* self);
static GVariant* ft_application_option_get_value (FtApplicationOption* self);
static gint ft_application_real_command_line (GApplication* base,
                                       GApplicationCommandLine* command_line);
static void ft_application_real_activate (GApplication* base);
static void ft_application_real_shutdown (GApplication* base);
static Block34Data* block34_data_ref (Block34Data* _data34_);
static void block34_data_unref (void * _userdata_);
static void ft_application_on_current_session_changed (FtApplication* self);
static void _ft_application_on_current_session_changed_ft_session_changed (FtSession* _sender,
                                                                    gpointer self);
static void __lambda99_ (Block34Data* _data34_,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda99__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void __lambda100_ (Block34Data* _data34_,
                   GObject* obj,
                   GAsyncResult* res);
static void ___lambda100__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static gboolean ft_application_real_dbus_register (GApplication* base,
                                            GDBusConnection* connection,
                                            const gchar* object_path,
                                            GError** error);
static void ft_application_real_dbus_unregister (GApplication* base,
                                          GDBusConnection* connection,
                                          const gchar* object_path);
static void ft_application_real_dispose (GObject* base);
static void ft_application_option_instance_init (FtApplicationOption * self);
static FtApplicationOption* ft_application_option_new (const gchar* long_name,
                                                gchar short_name,
                                                const gchar* description,
                                                GOptionArg arg_type,
                                                const gchar* arg_description,
                                                const gchar* action_name,
                                                GVariant* action_parameter,
                                                gboolean is_exclusive,
                                                gint order);
static GObject * ft_application_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties);
static void ft_application_finalize (GObject * obj);
static GType ft_application_get_type_once (void);
static void _vala_ft_application_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static void _vala_ft_application_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec);
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 gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GType
ft_exit_status_get_type_once (void)
{
	static const GEnumValue values[] = {{FT_EXIT_STATUS_UNDEFINED, "FT_EXIT_STATUS_UNDEFINED", "undefined"}, {FT_EXIT_STATUS_SUCCESS, "FT_EXIT_STATUS_SUCCESS", "success"}, {FT_EXIT_STATUS_FAILURE, "FT_EXIT_STATUS_FAILURE", "failure"}, {0, NULL, NULL}};
	GType ft_exit_status_type_id;
	ft_exit_status_type_id = g_enum_register_static ("FtExitStatus", values);
	return ft_exit_status_type_id;
}

GType
ft_exit_status_get_type (void)
{
	static volatile gsize ft_exit_status_type_id__once = 0;
	if (g_once_init_enter (&ft_exit_status_type_id__once)) {
		GType ft_exit_status_type_id;
		ft_exit_status_type_id = ft_exit_status_get_type_once ();
		g_once_init_leave (&ft_exit_status_type_id__once, ft_exit_status_type_id);
	}
	return ft_exit_status_type_id__once;
}

static inline gpointer
ft_application_get_instance_private (FtApplication* self)
{
	return G_STRUCT_MEMBER_P (self, FtApplication_private_offset);
}

static void
_vala_array_add21 (GOptionEntry* * array,
                   gint* length,
                   gint* size,
                   const GOptionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GOptionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add22 (GOptionEntry* * array,
                   gint* length,
                   gint* size,
                   const GOptionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GOptionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static GOptionEntry*
ft_application_get_option_entries (const gchar* group,
                                   gint* result_length1)
{
	GOptionEntry* _result_ = NULL;
	GOptionEntry* _tmp0_;
	gint _result__length1;
	gint __result__size_;
	FtApplicationOption** _tmp1_;
	gint _tmp1__length1;
	GOptionEntry _tmp15_ = {0};
	GOptionEntry* _tmp16_;
	gint _tmp16__length1;
	GOptionEntry* result;
	g_return_val_if_fail (group != NULL, NULL);
	_tmp0_ = g_new0 (GOptionEntry, 0);
	_result_ = _tmp0_;
	_result__length1 = 0;
	__result__size_ = _result__length1;
	_tmp1_ = ft_application_OPTIONS;
	_tmp1__length1 = ft_application_OPTIONS_length1;
	{
		FtApplicationOption** option_collection = NULL;
		gint option_collection_length1 = 0;
		gint _option_collection_size_ = 0;
		gint option_it = 0;
		option_collection = _tmp1_;
		option_collection_length1 = _tmp1__length1;
		for (option_it = 0; option_it < option_collection_length1; option_it = option_it + 1) {
			FtApplicationOption* option = NULL;
			option = option_collection[option_it];
			{
				FtApplicationOption* _tmp2_;
				const gchar* _tmp3_;
				_tmp2_ = option;
				_tmp3_ = _tmp2_->group;
				if (g_strcmp0 (_tmp3_, group) == 0) {
					FtApplicationOption* _tmp4_;
					const gchar* _tmp5_;
					FtApplicationOption* _tmp6_;
					FtApplicationOption* _tmp7_;
					const gchar* _tmp8_;
					FtApplicationOption* _tmp9_;
					FtApplicationOption* _tmp10_;
					void* _tmp11_;
					FtApplicationOption* _tmp12_;
					const gchar* _tmp13_;
					GOptionEntry _tmp14_ = {0};
					_tmp4_ = option;
					_tmp5_ = _tmp4_->long_name;
					_tmp6_ = option;
					_tmp7_ = option;
					_tmp8_ = _tmp7_->description;
					_tmp9_ = option;
					_tmp10_ = option;
					_tmp11_ = ft_application_option_get_arg_data (_tmp10_);
					_tmp12_ = option;
					_tmp13_ = _tmp12_->arg_description;
					memset (&_tmp14_, 0, sizeof (GOptionEntry));
					_tmp14_.long_name = _tmp5_;
					_tmp14_.short_name = _tmp6_->short_name;
					_tmp14_.description = _tmp8_;
					_tmp14_.flags = (gint) G_OPTION_FLAG_NONE;
					_tmp14_.arg = _tmp9_->arg_type;
					_tmp14_.arg_data = _tmp11_;
					_tmp14_.arg_description = _tmp13_;
					_vala_array_add21 (&_result_, &_result__length1, &__result__size_, &_tmp14_);
				}
			}
		}
	}
	memset (&_tmp15_, 0, sizeof (GOptionEntry));
	_vala_array_add22 (&_result_, &_result__length1, &__result__size_, &_tmp15_);
	_tmp16_ = _result_;
	_tmp16__length1 = _result__length1;
	if (result_length1) {
		*result_length1 = _tmp16__length1;
	}
	result = _tmp16_;
	return result;
}

static gint
__lambda94_ (FtApplicationOption* a,
             FtApplicationOption* b)
{
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	if (a->order != b->order) {
		gint _tmp0_ = 0;
		if (a->order < b->order) {
			_tmp0_ = -1;
		} else {
			_tmp0_ = 1;
		}
		result = _tmp0_;
		return result;
	}
	result = 0;
	return result;
}

static gint
___lambda94__gcompare_func (gconstpointer a,
                            gconstpointer b)
{
	gint result;
	result = __lambda94_ ((FtApplicationOption*) a, (FtApplicationOption*) b);
	return result;
}

static GSList*
ft_application_get_options (void)
{
	GSList* options = NULL;
	FtApplicationOption** _tmp0_;
	gint _tmp0__length1;
	GSList* result;
	options = NULL;
	_tmp0_ = ft_application_OPTIONS;
	_tmp0__length1 = ft_application_OPTIONS_length1;
	{
		FtApplicationOption** option_collection = NULL;
		gint option_collection_length1 = 0;
		gint _option_collection_size_ = 0;
		gint option_it = 0;
		option_collection = _tmp0_;
		option_collection_length1 = _tmp0__length1;
		for (option_it = 0; option_it < option_collection_length1; option_it = option_it + 1) {
			FtApplicationOption* option = NULL;
			option = option_collection[option_it];
			{
				FtApplicationOption* _tmp1_;
				_tmp1_ = option;
				options = g_slist_append (options, _tmp1_);
			}
		}
	}
	options = g_slist_sort (options, ___lambda94__gcompare_func);
	result = options;
	return result;
}

FtApplication*
ft_application_construct (GType object_type)
{
	FtApplication * self = NULL;
	self = (FtApplication*) g_object_new (object_type, "application-id", APPLICATION_ID, "flags", G_APPLICATION_HANDLES_COMMAND_LINE, "resource-base-path", "/io/github/focustimerhq/FocusTimer/", NULL);
	return self;
}

FtApplication*
ft_application_new (void)
{
	return ft_application_construct (FT_TYPE_APPLICATION);
}

FtApplication*
ft_application_get_default (void)
{
	GApplication* _tmp0_;
	FtApplication* result;
	_tmp0_ = g_application_get_default ();
	result = FT_IS_APPLICATION (_tmp0_) ? ((FtApplication*) _tmp0_) : NULL;
	return result;
}

GtkWindow*
ft_application_get_last_focused_window (FtApplication* self)
{
	GList* link = NULL;
	GList* _tmp0_;
	GtkWindow* _tmp1_ = NULL;
	GList* _tmp2_;
	GtkWindow* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_application_get_windows ((GtkApplication*) self);
	link = _tmp0_;
	_tmp2_ = link;
	if (_tmp2_ != NULL) {
		GList* _tmp3_;
		GList* _tmp4_;
		gconstpointer _tmp5_;
		_tmp3_ = link;
		_tmp4_ = g_list_first (_tmp3_);
		_tmp5_ = _tmp4_->data;
		_tmp1_ = (GtkWindow*) _tmp5_;
	} else {
		_tmp1_ = NULL;
	}
	result = _tmp1_;
	return result;
}

gconstpointer
ft_application_get_window (FtApplication* self,
                           GType t_type,
                           GBoxedCopyFunc t_dup_func,
                           GDestroyNotify t_destroy_func)
{
	GList* link = NULL;
	GList* _tmp0_;
	GType window_type = G_TYPE_NONE;
	gconstpointer result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_application_get_windows ((GtkApplication*) self);
	link = _tmp0_;
	window_type = t_type;
	while (TRUE) {
		GList* _tmp1_;
		GList* _tmp2_;
		gconstpointer _tmp3_;
		GList* _tmp6_;
		GList* _tmp7_;
		_tmp1_ = link;
		if (!(_tmp1_ != NULL)) {
			break;
		}
		_tmp2_ = link;
		_tmp3_ = _tmp2_->data;
		if (G_TYPE_FROM_INSTANCE ((GObject*) ((GtkWindow*) _tmp3_)) == window_type) {
			GList* _tmp4_;
			gconstpointer _tmp5_;
			_tmp4_ = link;
			_tmp5_ = _tmp4_->data;
			result = (GtkWindow*) _tmp5_;
			return result;
		}
		_tmp6_ = link;
		_tmp7_ = _tmp6_->next;
		link = _tmp7_;
	}
	result = NULL;
	return result;
}

static void
__lambda96_ (FtApplication* self,
             GObject* obj,
             GAsyncResult* res)
{
	FtSessionManager* _tmp0_;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->session_manager;
	ft_session_manager_save_finish (_tmp0_, res);
}

static void
___lambda96__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda96_ ((FtApplication*) self, source_object, res);
	g_object_unref (self);
}

static gboolean
__lambda95_ (FtApplication* self)
{
	FtSessionManager* _tmp0_;
	gboolean result;
	self->priv->save_idle_id = (guint) 0;
	_tmp0_ = self->session_manager;
	ft_session_manager_save (_tmp0_, ___lambda96__gasync_ready_callback, g_object_ref (self));
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda95__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda95_ ((FtApplication*) self);
	return result;
}

static void
ft_application_schedule_save (FtApplication* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->save_idle_id != ((guint) 0)) {
		return;
	}
	self->priv->save_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda95__gsource_func, g_object_ref (self), g_object_unref);
	g_source_set_name_by_id (self->priv->save_idle_id, "Ft.Application.schedule_save");
}

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

void
ft_application_show_window (FtApplication* self,
                            FtWindowView view)
{
	FtWindow* window = NULL;
	gconstpointer _tmp0_;
	FtWindow* _tmp1_;
	gboolean window_created = FALSE;
	FtWindow* _tmp2_;
	FtWindow* _tmp8_;
	gboolean _tmp9_ = FALSE;
	FtWindow* _tmp10_;
	gboolean _tmp11_;
	gboolean _tmp12_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ft_application_get_window (self, FT_TYPE_WINDOW, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
	_tmp1_ = _g_object_ref0 ((FtWindow*) _tmp0_);
	window = _tmp1_;
	window_created = FALSE;
	_tmp2_ = window;
	if (_tmp2_ == NULL) {
		FtWindow* _tmp3_;
		FtWindow* _tmp4_;
		_tmp3_ = ft_window_new ();
		g_object_ref_sink (_tmp3_);
		_g_object_unref0 (window);
		window = _tmp3_;
		window_created = TRUE;
		_tmp4_ = window;
		gtk_application_add_window ((GtkApplication*) self, (GtkWindow*) _tmp4_);
		if (ft_is_devel ()) {
			FtWindow* _tmp5_;
			_tmp5_ = window;
			gtk_widget_add_css_class ((GtkWidget*) _tmp5_, "devel");
		}
	}
	if (view != FT_WINDOW_VIEW_DEFAULT) {
		FtWindow* _tmp6_;
		FtWindow* _tmp7_;
		_tmp6_ = window;
		ft_window_set_size (_tmp6_, FT_WINDOW_SIZE_NORMAL);
		_tmp7_ = window;
		ft_window_set_view (_tmp7_, view);
	}
	_tmp8_ = window;
	gtk_window_present ((GtkWindow*) _tmp8_);
	_tmp10_ = window;
	g_object_get ((GtkWindow*) _tmp10_, "is-active", &_tmp11_, NULL);
	_tmp12_ = _tmp11_;
	if (!_tmp12_) {
		_tmp9_ = !window_created;
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		FtApplicationDBusService* _tmp13_;
		_tmp13_ = self->priv->dbus_service;
		ft_application_dbus_service_emit_request_focus (_tmp13_);
	}
	_g_object_unref0 (window);
}

void
ft_application_show_preferences (FtApplication* self,
                                 const gchar* panel_name)
{
	FtPreferencesWindow* preferences_window = NULL;
	gconstpointer _tmp0_;
	FtPreferencesWindow* _tmp1_;
	FtPreferencesWindow* _tmp2_;
	FtPreferencesWindow* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (panel_name != NULL);
	_tmp0_ = ft_application_get_window (self, FT_TYPE_PREFERENCES_WINDOW, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
	_tmp1_ = _g_object_ref0 ((FtPreferencesWindow*) _tmp0_);
	preferences_window = _tmp1_;
	_tmp2_ = preferences_window;
	if (_tmp2_ == NULL) {
		FtPreferencesWindow* _tmp3_;
		FtPreferencesWindow* _tmp4_;
		_tmp3_ = ft_preferences_window_new ();
		g_object_ref_sink (_tmp3_);
		_g_object_unref0 (preferences_window);
		preferences_window = _tmp3_;
		_tmp4_ = preferences_window;
		gtk_application_add_window ((GtkApplication*) self, (GtkWindow*) _tmp4_);
	}
	if (g_strcmp0 (panel_name, "") != 0) {
		FtPreferencesWindow* _tmp5_;
		_tmp5_ = preferences_window;
		ft_preferences_window_select_panel (_tmp5_, panel_name);
	}
	_tmp6_ = preferences_window;
	gtk_window_present ((GtkWindow*) _tmp6_);
	_g_object_unref0 (preferences_window);
}

static void
ft_application_show_about_dialog (FtApplication* self)
{
	FtWindow* window = NULL;
	gconstpointer _tmp0_;
	FtWindow* _tmp1_;
	AdwAboutDialog* about_dialog = NULL;
	gconstpointer _tmp2_;
	AdwAboutDialog* _tmp3_;
	AdwAboutDialog* _tmp4_;
	AdwAboutDialog* _tmp6_;
	FtWindow* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ft_application_get_window (self, FT_TYPE_WINDOW, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
	_tmp1_ = _g_object_ref0 ((FtWindow*) _tmp0_);
	window = _tmp1_;
	_tmp2_ = ft_application_get_window (self, adw_about_dialog_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
	_tmp3_ = _g_object_ref0 ((AdwAboutDialog*) _tmp2_);
	about_dialog = _tmp3_;
	_tmp4_ = about_dialog;
	if (_tmp4_ == NULL) {
		AdwAboutDialog* _tmp5_;
		_tmp5_ = ft_create_about_dialog ();
		_g_object_unref0 (about_dialog);
		about_dialog = _tmp5_;
	}
	_tmp6_ = about_dialog;
	_tmp7_ = window;
	adw_dialog_present ((AdwDialog*) _tmp6_, (GtkWidget*) _tmp7_);
	_g_object_unref0 (about_dialog);
	_g_object_unref0 (window);
}

static void
ft_application_show_screen_overlay (FtApplication* self)
{
	gboolean _tmp0_ = FALSE;
	FtSessionManager* _tmp1_;
	FtState _tmp2_;
	FtState _tmp3_;
	FtScreenOverlayManager* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->session_manager;
	_tmp2_ = ft_session_manager_get_current_state (_tmp1_);
	_tmp3_ = _tmp2_;
	if (!ft_state_is_break (_tmp3_)) {
		_tmp0_ = TRUE;
	} else {
		FtTimer* _tmp4_;
		_tmp4_ = self->timer;
		_tmp0_ = ft_timer_is_finished (_tmp4_);
	}
	if (_tmp0_) {
		FtSessionManager* _tmp5_;
		_tmp5_ = self->session_manager;
		ft_session_manager_advance_to_state (_tmp5_, FT_STATE_BREAK, FT_TIMESTAMP_UNDEFINED);
	} else {
		FtTimer* _tmp6_;
		_tmp6_ = self->timer;
		if (ft_timer_is_paused (_tmp6_)) {
			FtTimer* _tmp7_;
			_tmp7_ = self->timer;
			ft_timer_resume (_tmp7_, FT_TIMESTAMP_UNDEFINED);
		} else {
			FtTimer* _tmp8_;
			_tmp8_ = self->timer;
			if (!ft_timer_is_started (_tmp8_)) {
				FtTimer* _tmp9_;
				_tmp9_ = self->timer;
				ft_timer_start (_tmp9_, FT_TIMESTAMP_UNDEFINED);
			}
		}
	}
	_tmp10_ = self->priv->screen_overlay_manager;
	ft_screen_overlay_manager_open (_tmp10_);
}

static void
ft_application_activate_prefixed_action (FtApplication* self,
                                         const gchar* action_name,
                                         GVariant* parameter)
{
	GActionGroup* action_group = NULL;
	gchar** parts = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint parts_length1;
	gint _parts_size_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar** _tmp3_;
	gint _tmp3__length1;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	GQuark _tmp7_ = 0U;
	static GQuark _tmp6_label0 = 0;
	static GQuark _tmp6_label1 = 0;
	static GQuark _tmp6_label2 = 0;
	GActionGroup* _tmp11_;
	gchar** _tmp12_;
	gint _tmp12__length1;
	const gchar* _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action_name != NULL);
	_tmp1_ = _tmp0_ = g_strsplit (action_name, ".", 2);
	parts = _tmp1_;
	parts_length1 = _vala_array_length (_tmp0_);
	_parts_size_ = parts_length1;
	_tmp2_ = parts;
	_tmp2__length1 = parts_length1;
	if (_tmp2__length1 < 2) {
		g_action_group_activate_action ((GActionGroup*) self, action_name, parameter);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		_g_object_unref0 (action_group);
		return;
	}
	_tmp3_ = parts;
	_tmp3__length1 = parts_length1;
	_tmp4_ = _tmp3_[0];
	_tmp5_ = _tmp4_;
	_tmp7_ = (NULL == _tmp5_) ? 0 : g_quark_from_string (_tmp5_);
	if (_tmp7_ == ((0 != _tmp6_label0) ? _tmp6_label0 : (_tmp6_label0 = g_quark_from_static_string ("app")))) {
		switch (0) {
			default:
			{
				GActionGroup* _tmp8_;
				_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (self, g_action_group_get_type (), GActionGroup));
				_g_object_unref0 (action_group);
				action_group = _tmp8_;
				break;
			}
		}
	} else if (_tmp7_ == ((0 != _tmp6_label1) ? _tmp6_label1 : (_tmp6_label1 = g_quark_from_static_string ("timer")))) {
		switch (0) {
			default:
			{
				FtTimerActionGroup* _tmp9_;
				_tmp9_ = ft_timer_action_group_new ();
				_g_object_unref0 (action_group);
				action_group = (GActionGroup*) _tmp9_;
				break;
			}
		}
	} else if (_tmp7_ == ((0 != _tmp6_label2) ? _tmp6_label2 : (_tmp6_label2 = g_quark_from_static_string ("session-manager")))) {
		switch (0) {
			default:
			{
				FtSessionManagerActionGroup* _tmp10_;
				_tmp10_ = ft_session_manager_action_group_new ();
				_g_object_unref0 (action_group);
				action_group = (GActionGroup*) _tmp10_;
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				g_warning ("application.vala:449: Unhandled action '%s'", action_name);
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
				_g_object_unref0 (action_group);
				return;
			}
		}
	}
	_tmp11_ = action_group;
	_tmp12_ = parts;
	_tmp12__length1 = parts_length1;
	_tmp13_ = _tmp12_[1];
	g_action_group_activate_action (_tmp11_, _tmp13_, parameter);
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (action_group);
}

static void
ft_application_activate_window (FtApplication* self,
                                GSimpleAction* action,
                                GVariant* parameter)
{
	FtWindowView view = 0;
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = g_variant_get_string (parameter, NULL);
	view = ft_window_view_from_string (_tmp0_);
	ft_application_show_window (self, view);
}

static void
ft_application_activate_toggle_window (FtApplication* self,
                                       GSimpleAction* action,
                                       GVariant* parameter)
{
	FtWindow* window = NULL;
	gconstpointer _tmp0_;
	FtWindow* _tmp1_;
	gboolean _tmp2_ = FALSE;
	FtWindow* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = ft_application_get_window (self, FT_TYPE_WINDOW, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
	_tmp1_ = _g_object_ref0 ((FtWindow*) _tmp0_);
	window = _tmp1_;
	_tmp3_ = window;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		FtWindow* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = window;
		g_object_get ((GtkWindow*) _tmp4_, "is-active", &_tmp5_, NULL);
		_tmp6_ = _tmp5_;
		_tmp2_ = !_tmp6_;
	}
	if (_tmp2_) {
		ft_application_show_window (self, FT_WINDOW_VIEW_TIMER);
	} else {
		FtWindow* _tmp7_;
		_tmp7_ = window;
		ft_window_close_to_background (_tmp7_);
	}
	_g_object_unref0 (window);
}

static void
ft_application_activate_preferences (FtApplication* self,
                                     GSimpleAction* action,
                                     GVariant* parameter)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	ft_application_show_preferences (self, "");
}

static void
ft_application_activate_log (FtApplication* self,
                             GSimpleAction* action,
                             GVariant* parameter)
{
	FtLogWindow* log_window = NULL;
	gconstpointer _tmp0_;
	FtLogWindow* _tmp1_;
	FtLogWindow* _tmp2_;
	FtLogWindow* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = ft_application_get_window (self, FT_TYPE_LOG_WINDOW, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
	_tmp1_ = _g_object_ref0 ((FtLogWindow*) _tmp0_);
	log_window = _tmp1_;
	_tmp2_ = log_window;
	if (_tmp2_ == NULL) {
		FtLogWindow* _tmp3_;
		FtLogWindow* _tmp4_;
		_tmp3_ = ft_log_window_new ();
		g_object_ref_sink (_tmp3_);
		_g_object_unref0 (log_window);
		log_window = _tmp3_;
		_tmp4_ = log_window;
		gtk_application_add_window ((GtkApplication*) self, (GtkWindow*) _tmp4_);
	}
	if (parameter != NULL) {
		FtLogWindow* _tmp5_;
		_tmp5_ = log_window;
		ft_log_window_select (_tmp5_, (gulong) g_variant_get_uint64 (parameter));
	}
	_tmp6_ = log_window;
	gtk_window_present ((GtkWindow*) _tmp6_);
	_g_object_unref0 (log_window);
}

static void
ft_application_activate_about (FtApplication* self,
                               GSimpleAction* action,
                               GVariant* parameter)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	ft_application_show_about_dialog (self);
}

static void
ft_application_activate_screen_overlay (FtApplication* self,
                                        GSimpleAction* action,
                                        GVariant* parameter)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	ft_application_show_screen_overlay (self);
}

static void
ft_application_activate_visit_website (FtApplication* self,
                                       GSimpleAction* action,
                                       GVariant* parameter)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	{
		gchar** spawn_args = NULL;
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar** _tmp2_;
		gint spawn_args_length1;
		gint _spawn_args_size_;
		gchar** spawn_env = NULL;
		gchar** _tmp3_;
		gchar** _tmp4_;
		gint spawn_env_length1;
		gint _spawn_env_size_;
		_tmp0_ = g_strdup ("xdg-open");
		_tmp1_ = g_strdup (PACKAGE_WEBSITE);
		_tmp2_ = g_new0 (gchar*, 2 + 1);
		_tmp2_[0] = _tmp0_;
		_tmp2_[1] = _tmp1_;
		spawn_args = _tmp2_;
		spawn_args_length1 = 2;
		_spawn_args_size_ = spawn_args_length1;
		_tmp4_ = _tmp3_ = g_get_environ ();
		spawn_env = _tmp4_;
		spawn_env_length1 = _vala_array_length (_tmp3_);
		_spawn_env_size_ = spawn_env_length1;
		g_spawn_async (NULL, spawn_args, spawn_env, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			spawn_env = (_vala_array_free (spawn_env, spawn_env_length1, (GDestroyNotify) g_free), NULL);
			spawn_args = (_vala_array_free (spawn_args, spawn_args_length1, (GDestroyNotify) g_free), NULL);
			if (_inner_error0_->domain == G_SPAWN_ERROR) {
				goto __catch0_g_spawn_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		spawn_env = (_vala_array_free (spawn_env, spawn_env_length1, (GDestroyNotify) g_free), NULL);
		spawn_args = (_vala_array_free (spawn_args, spawn_args_length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally0;
	__catch0_g_spawn_error:
	{
		GError* _error_ = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = _error_;
		_tmp6_ = _tmp5_->message;
		g_warning ("application.vala:527: Failed to spawn process: %s", _tmp6_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
ft_application_activate_report_issue (FtApplication* self,
                                      GSimpleAction* action,
                                      GVariant* parameter)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	{
		gchar** spawn_args = NULL;
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar** _tmp2_;
		gint spawn_args_length1;
		gint _spawn_args_size_;
		gchar** spawn_env = NULL;
		gchar** _tmp3_;
		gchar** _tmp4_;
		gint spawn_env_length1;
		gint _spawn_env_size_;
		_tmp0_ = g_strdup ("xdg-open");
		_tmp1_ = g_strdup (PACKAGE_ISSUE_URL);
		_tmp2_ = g_new0 (gchar*, 2 + 1);
		_tmp2_[0] = _tmp0_;
		_tmp2_[1] = _tmp1_;
		spawn_args = _tmp2_;
		spawn_args_length1 = 2;
		_spawn_args_size_ = spawn_args_length1;
		_tmp4_ = _tmp3_ = g_get_environ ();
		spawn_env = _tmp4_;
		spawn_env_length1 = _vala_array_length (_tmp3_);
		_spawn_env_size_ = spawn_env_length1;
		g_spawn_async (NULL, spawn_args, spawn_env, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			spawn_env = (_vala_array_free (spawn_env, spawn_env_length1, (GDestroyNotify) g_free), NULL);
			spawn_args = (_vala_array_free (spawn_args, spawn_args_length1, (GDestroyNotify) g_free), NULL);
			if (_inner_error0_->domain == G_SPAWN_ERROR) {
				goto __catch0_g_spawn_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		spawn_env = (_vala_array_free (spawn_env, spawn_env_length1, (GDestroyNotify) g_free), NULL);
		spawn_args = (_vala_array_free (spawn_args, spawn_args_length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally0;
	__catch0_g_spawn_error:
	{
		GError* _error_ = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = _error_;
		_tmp6_ = _tmp5_->message;
		g_warning ("application.vala:546: Failed to spawn process: %s", _tmp6_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
ft_application_activate_quit (FtApplication* self,
                              GSimpleAction* action,
                              GVariant* parameter)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	ft_context_set_event_source ("application.quit", FT_TIMESTAMP_UNDEFINED);
	g_application_quit ((GApplication*) self);
}

static void
ft_application_activate_advance (FtApplication* self,
                                 GSimpleAction* action,
                                 GVariant* parameter)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	ft_application_activate_prefixed_action (self, "session-manager.advance", parameter);
}

static void
ft_application_activate_advance_to_state (FtApplication* self,
                                          GSimpleAction* action,
                                          GVariant* parameter)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	ft_application_activate_prefixed_action (self, "session-manager.state", parameter);
}

static void
ft_application_activate_extend (FtApplication* self,
                                GSimpleAction* action,
                                GVariant* parameter)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	ft_application_activate_prefixed_action (self, "timer.extend-by", parameter);
}

static void
ft_application_setup_resources (FtApplication* self)
{
	GdkDisplay* display = NULL;
	GdkDisplay* _tmp0_;
	GdkDisplay* _tmp1_;
	GtkIconTheme* icon_theme = NULL;
	GtkIconTheme* _tmp2_;
	GtkIconTheme* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	display = _tmp1_;
	_tmp2_ = gtk_icon_theme_get_for_display (display);
	_tmp3_ = _g_object_ref0 (_tmp2_);
	icon_theme = _tmp3_;
	gtk_icon_theme_add_resource_path (icon_theme, "/io/github/focustimerhq/FocusTimer/icons");
	_g_object_unref0 (icon_theme);
	_g_object_unref0 (display);
}

static void
ft_application_setup_database (FtApplication* self)
{
	g_return_if_fail (self != NULL);
	ft_database_open ();
}

static void
_ft_application_activate_window_g_simple_action_activate (GSimpleAction* _sender,
                                                          GVariant* parameter,
                                                          gpointer self)
{
	ft_application_activate_window ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_activate_toggle_window_g_simple_action_activate (GSimpleAction* _sender,
                                                                 GVariant* parameter,
                                                                 gpointer self)
{
	ft_application_activate_toggle_window ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_activate_preferences_g_simple_action_activate (GSimpleAction* _sender,
                                                               GVariant* parameter,
                                                               gpointer self)
{
	ft_application_activate_preferences ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_activate_log_g_simple_action_activate (GSimpleAction* _sender,
                                                       GVariant* parameter,
                                                       gpointer self)
{
	ft_application_activate_log ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_activate_screen_overlay_g_simple_action_activate (GSimpleAction* _sender,
                                                                  GVariant* parameter,
                                                                  gpointer self)
{
	ft_application_activate_screen_overlay ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_activate_visit_website_g_simple_action_activate (GSimpleAction* _sender,
                                                                 GVariant* parameter,
                                                                 gpointer self)
{
	ft_application_activate_visit_website ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_activate_report_issue_g_simple_action_activate (GSimpleAction* _sender,
                                                                GVariant* parameter,
                                                                gpointer self)
{
	ft_application_activate_report_issue ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_activate_about_g_simple_action_activate (GSimpleAction* _sender,
                                                         GVariant* parameter,
                                                         gpointer self)
{
	ft_application_activate_about ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_activate_quit_g_simple_action_activate (GSimpleAction* _sender,
                                                        GVariant* parameter,
                                                        gpointer self)
{
	ft_application_activate_quit ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_activate_advance_g_simple_action_activate (GSimpleAction* _sender,
                                                           GVariant* parameter,
                                                           gpointer self)
{
	ft_application_activate_advance ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_activate_advance_to_state_g_simple_action_activate (GSimpleAction* _sender,
                                                                    GVariant* parameter,
                                                                    gpointer self)
{
	ft_application_activate_advance_to_state ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_activate_extend_g_simple_action_activate (GSimpleAction* _sender,
                                                          GVariant* parameter,
                                                          gpointer self)
{
	ft_application_activate_extend ((FtApplication*) self, _sender, parameter);
}

static void
_ft_application_on_shortcut_activated_ft_keyboard_manager_shortcut_activated (FtKeyboardManager* _sender,
                                                                              const gchar* shortcut_name,
                                                                              gpointer self)
{
	ft_application_on_shortcut_activated ((FtApplication*) self, shortcut_name);
}

static void
ft_application_setup_actions (FtApplication* self)
{
	GSimpleAction* action = NULL;
	const GVariantType* _tmp0_;
	GSimpleAction* _tmp1_;
	GSimpleAction* _tmp2_;
	GSimpleAction* _tmp3_;
	GSimpleAction* _tmp4_;
	GSimpleAction* _tmp5_;
	GSimpleAction* _tmp6_;
	GSimpleAction* _tmp7_;
	GSimpleAction* _tmp8_;
	GSimpleAction* _tmp9_;
	const GVariantType* _tmp10_;
	GSimpleAction* _tmp11_;
	GSimpleAction* _tmp12_;
	GSimpleAction* _tmp13_;
	GSimpleAction* _tmp14_;
	GSimpleAction* _tmp15_;
	GSimpleAction* _tmp16_;
	GSimpleAction* _tmp17_;
	GSimpleAction* _tmp18_;
	GSimpleAction* _tmp19_;
	GSimpleAction* _tmp20_;
	GSimpleAction* _tmp21_;
	GSimpleAction* _tmp22_;
	GSimpleAction* _tmp23_;
	GSimpleAction* _tmp24_;
	GSimpleAction* _tmp25_;
	GSimpleAction* _tmp26_;
	GSimpleAction* _tmp27_;
	GSimpleAction* _tmp28_;
	GSimpleAction* _tmp29_;
	GSimpleAction* _tmp30_;
	GSimpleAction* _tmp31_;
	const GVariantType* _tmp32_;
	GSimpleAction* _tmp33_;
	GSimpleAction* _tmp34_;
	GSimpleAction* _tmp35_;
	const GVariantType* _tmp36_;
	GSimpleAction* _tmp37_;
	GSimpleAction* _tmp38_;
	GSimpleAction* _tmp39_;
	gchar* _tmp40_;
	gchar** _tmp41_;
	gchar** _tmp42_;
	gint _tmp42__length1;
	gchar* _tmp43_;
	gchar** _tmp44_;
	gchar** _tmp45_;
	gint _tmp45__length1;
	gchar* _tmp46_;
	gchar** _tmp47_;
	gchar** _tmp48_;
	gint _tmp48__length1;
	gchar* _tmp49_;
	gchar** _tmp50_;
	gchar** _tmp51_;
	gint _tmp51__length1;
	gchar* _tmp52_;
	gchar** _tmp53_;
	gchar** _tmp54_;
	gint _tmp54__length1;
	FtKeyboardManager* _tmp55_;
	FtKeyboardManager* _tmp56_;
	FtKeyboardManager* _tmp57_;
	FtKeyboardManager* _tmp58_;
	FtKeyboardManager* _tmp59_;
	FtKeyboardManager* _tmp60_;
	FtKeyboardManager* _tmp61_;
	FtKeyboardManager* _tmp62_;
	FtKeyboardManager* _tmp63_;
	FtKeyboardManager* _tmp64_;
	FtKeyboardManager* _tmp65_;
	g_return_if_fail (self != NULL);
	_tmp0_ = G_VARIANT_TYPE_STRING;
	_tmp1_ = g_simple_action_new ("window", _tmp0_);
	_g_object_unref0 (action);
	action = _tmp1_;
	_tmp2_ = action;
	g_signal_connect_object (_tmp2_, "activate", (GCallback) _ft_application_activate_window_g_simple_action_activate, self, 0);
	_tmp3_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp3_);
	_tmp4_ = g_simple_action_new ("toggle-window", NULL);
	_g_object_unref0 (action);
	action = _tmp4_;
	_tmp5_ = action;
	g_signal_connect_object (_tmp5_, "activate", (GCallback) _ft_application_activate_toggle_window_g_simple_action_activate, self, 0);
	_tmp6_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp6_);
	_tmp7_ = g_simple_action_new ("preferences", NULL);
	_g_object_unref0 (action);
	action = _tmp7_;
	_tmp8_ = action;
	g_signal_connect_object (_tmp8_, "activate", (GCallback) _ft_application_activate_preferences_g_simple_action_activate, self, 0);
	_tmp9_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp9_);
	_tmp10_ = G_VARIANT_TYPE_UINT64;
	_tmp11_ = g_simple_action_new ("log", _tmp10_);
	_g_object_unref0 (action);
	action = _tmp11_;
	_tmp12_ = action;
	g_signal_connect_object (_tmp12_, "activate", (GCallback) _ft_application_activate_log_g_simple_action_activate, self, 0);
	_tmp13_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp13_);
	_tmp14_ = g_simple_action_new ("screen-overlay", NULL);
	_g_object_unref0 (action);
	action = _tmp14_;
	_tmp15_ = action;
	g_signal_connect_object (_tmp15_, "activate", (GCallback) _ft_application_activate_screen_overlay_g_simple_action_activate, self, 0);
	_tmp16_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp16_);
	_tmp17_ = g_simple_action_new ("visit-website", NULL);
	_g_object_unref0 (action);
	action = _tmp17_;
	_tmp18_ = action;
	g_signal_connect_object (_tmp18_, "activate", (GCallback) _ft_application_activate_visit_website_g_simple_action_activate, self, 0);
	_tmp19_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp19_);
	_tmp20_ = g_simple_action_new ("report-issue", NULL);
	_g_object_unref0 (action);
	action = _tmp20_;
	_tmp21_ = action;
	g_signal_connect_object (_tmp21_, "activate", (GCallback) _ft_application_activate_report_issue_g_simple_action_activate, self, 0);
	_tmp22_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp22_);
	_tmp23_ = g_simple_action_new ("about", NULL);
	_g_object_unref0 (action);
	action = _tmp23_;
	_tmp24_ = action;
	g_signal_connect_object (_tmp24_, "activate", (GCallback) _ft_application_activate_about_g_simple_action_activate, self, 0);
	_tmp25_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp25_);
	_tmp26_ = g_simple_action_new ("quit", NULL);
	_g_object_unref0 (action);
	action = _tmp26_;
	_tmp27_ = action;
	g_signal_connect_object (_tmp27_, "activate", (GCallback) _ft_application_activate_quit_g_simple_action_activate, self, 0);
	_tmp28_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp28_);
	_tmp29_ = g_simple_action_new ("advance", NULL);
	_g_object_unref0 (action);
	action = _tmp29_;
	_tmp30_ = action;
	g_signal_connect_object (_tmp30_, "activate", (GCallback) _ft_application_activate_advance_g_simple_action_activate, self, 0);
	_tmp31_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp31_);
	_tmp32_ = G_VARIANT_TYPE_STRING;
	_tmp33_ = g_simple_action_new ("advance-to-state", _tmp32_);
	_g_object_unref0 (action);
	action = _tmp33_;
	_tmp34_ = action;
	g_signal_connect_object (_tmp34_, "activate", (GCallback) _ft_application_activate_advance_to_state_g_simple_action_activate, self, 0);
	_tmp35_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp35_);
	_tmp36_ = G_VARIANT_TYPE_INT32;
	_tmp37_ = g_simple_action_new ("extend", _tmp36_);
	_g_object_unref0 (action);
	action = _tmp37_;
	_tmp38_ = action;
	g_signal_connect_object (_tmp38_, "activate", (GCallback) _ft_application_activate_extend_g_simple_action_activate, self, 0);
	_tmp39_ = action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp39_);
	_tmp40_ = g_strdup ("<Control>comma");
	_tmp41_ = g_new0 (gchar*, 1 + 1);
	_tmp41_[0] = _tmp40_;
	_tmp42_ = _tmp41_;
	_tmp42__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "app.preferences", _tmp42_);
	_tmp42_ = (_vala_array_free (_tmp42_, _tmp42__length1, (GDestroyNotify) g_free), NULL);
	_tmp43_ = g_strdup ("<Control>l");
	_tmp44_ = g_new0 (gchar*, 1 + 1);
	_tmp44_[0] = _tmp43_;
	_tmp45_ = _tmp44_;
	_tmp45__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "app.log", _tmp45_);
	_tmp45_ = (_vala_array_free (_tmp45_, _tmp45__length1, (GDestroyNotify) g_free), NULL);
	_tmp46_ = g_strdup ("<Control>q");
	_tmp47_ = g_new0 (gchar*, 1 + 1);
	_tmp47_[0] = _tmp46_;
	_tmp48_ = _tmp47_;
	_tmp48__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "app.quit", _tmp48_);
	_tmp48_ = (_vala_array_free (_tmp48_, _tmp48__length1, (GDestroyNotify) g_free), NULL);
	_tmp49_ = g_strdup ("<Control>w");
	_tmp50_ = g_new0 (gchar*, 1 + 1);
	_tmp50_[0] = _tmp49_;
	_tmp51_ = _tmp50_;
	_tmp51__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "window.close", _tmp51_);
	_tmp51_ = (_vala_array_free (_tmp51_, _tmp51__length1, (GDestroyNotify) g_free), NULL);
	_tmp52_ = g_strdup ("F9");
	_tmp53_ = g_new0 (gchar*, 1 + 1);
	_tmp53_[0] = _tmp52_;
	_tmp54_ = _tmp53_;
	_tmp54__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "win.toggle-compact-size", _tmp54_);
	_tmp54_ = (_vala_array_free (_tmp54_, _tmp54__length1, (GDestroyNotify) g_free), NULL);
	_tmp55_ = ft_keyboard_manager_new ();
	_g_object_unref0 (self->priv->keyboard_manager);
	self->priv->keyboard_manager = _tmp55_;
	_tmp56_ = self->priv->keyboard_manager;
	ft_keyboard_manager_add_shortcut (_tmp56_, "timer.start-stop", _ ("Start or Stop"), "<Control><Alt>p");
	_tmp57_ = self->priv->keyboard_manager;
	ft_keyboard_manager_add_shortcut (_tmp57_, "timer.start-pause-resume", _ ("Start, Pause or Resume"), "");
	_tmp58_ = self->priv->keyboard_manager;
	ft_keyboard_manager_add_shortcut (_tmp58_, "timer.start", _ ("Start"), "");
	_tmp59_ = self->priv->keyboard_manager;
	ft_keyboard_manager_add_shortcut (_tmp59_, "timer.reset", _ ("Stop"), "");
	_tmp60_ = self->priv->keyboard_manager;
	ft_keyboard_manager_add_shortcut (_tmp60_, "timer.pause", _ ("Pause"), "");
	_tmp61_ = self->priv->keyboard_manager;
	ft_keyboard_manager_add_shortcut (_tmp61_, "timer.resume", _ ("Resume"), "");
	_tmp62_ = self->priv->keyboard_manager;
	ft_keyboard_manager_add_shortcut (_tmp62_, "session-manager.advance", _ ("Skip"), "");
	_tmp63_ = self->priv->keyboard_manager;
	ft_keyboard_manager_add_shortcut (_tmp63_, "timer.rewind", _ ("Rewind"), "");
	_tmp64_ = self->priv->keyboard_manager;
	ft_keyboard_manager_add_shortcut (_tmp64_, "app.toggle-window", _ ("Bring to Focus"), "<Control><Alt><Shift>p");
	_tmp65_ = self->priv->keyboard_manager;
	g_signal_connect_object (_tmp65_, "shortcut-activated", (GCallback) _ft_application_on_shortcut_activated_ft_keyboard_manager_shortcut_activated, self, 0);
	_g_object_unref0 (action);
}

static void
ft_application_setup_providers (FtApplication* self)
{
	FtScreenOverlayManager* _tmp0_;
	FtDefaultScreenOverlayProvider* _tmp1_;
	FtDefaultScreenOverlayProvider* _tmp2_;
	FtScreenSaver* _tmp3_;
	FtDefaultScreenSaverProvider* _tmp4_;
	FtDefaultScreenSaverProvider* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->screen_overlay_manager;
	_tmp1_ = ft_default_screen_overlay_provider_new ();
	_tmp2_ = _tmp1_;
	ft_screen_overlay_manager_add_provider (_tmp0_, (FtScreenOverlayProvider*) _tmp2_, FT_PRIORITY_DEFAULT);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = self->priv->screensaver;
	_tmp4_ = ft_default_screen_saver_provider_new ();
	_tmp5_ = _tmp4_;
	ft_screen_saver_add_provider (_tmp3_, (FtScreenSaverProvider*) _tmp5_, FT_PRIORITY_DEFAULT);
	_g_object_unref0 (_tmp5_);
}

static void
_vala_GValue_array_free (GValue * array,
                         gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			g_value_unset (&array[i]);
		}
	}
	g_free (array);
}

static void
ft_application_setup_plugins (FtApplication* self)
{
	PeasEngine* engine = NULL;
	PeasEngine* _tmp0_;
	PeasEngine* _tmp1_;
	PeasEngine* _tmp2_;
	PeasEngine* _tmp3_;
	guint n_plugins = 0U;
	PeasEngine* _tmp4_;
	PeasEngine* _tmp11_;
	gchar** _tmp12_;
	gchar** _tmp13_;
	gint _tmp13__length1;
	GValue* _tmp14_;
	GValue* _tmp15_;
	gint _tmp15__length1;
	PeasExtensionSet* _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp0_ = peas_engine_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	engine = _tmp1_;
	_tmp2_ = engine;
	peas_engine_add_search_path (_tmp2_, "resource:///plugins", "resource:///plugins");
	_tmp3_ = engine;
	peas_engine_rescan_plugins (_tmp3_);
	_tmp4_ = engine;
	n_plugins = g_list_model_get_n_items ((GListModel*) _tmp4_);
	{
		guint i = 0U;
		i = 0U;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				PeasPluginInfo* plugin_info = NULL;
				PeasEngine* _tmp7_;
				GObject* _tmp8_;
				PeasEngine* _tmp9_;
				PeasPluginInfo* _tmp10_;
				if (!_tmp5_) {
					guint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				if (!(i < n_plugins)) {
					break;
				}
				_tmp7_ = engine;
				_tmp8_ = g_list_model_get_item ((GListModel*) _tmp7_, i);
				plugin_info = G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, peas_plugin_info_get_type (), PeasPluginInfo);
				_tmp9_ = engine;
				_tmp10_ = plugin_info;
				peas_engine_load_plugin (_tmp9_, _tmp10_);
				_g_object_unref0 (plugin_info);
			}
		}
	}
	_tmp11_ = engine;
	_tmp12_ = g_new0 (gchar*, 0 + 1);
	_tmp13_ = _tmp12_;
	_tmp13__length1 = 0;
	_tmp14_ = g_new0 (GValue, 0);
	_tmp15_ = _tmp14_;
	_tmp15__length1 = 0;
	_tmp16_ = peas_extension_set_new_with_properties (_tmp11_, FT_TYPE_APPLICATION_EXTENSION, 0, _tmp13_, _tmp15_);
	_g_object_unref0 (self->priv->extensions);
	self->priv->extensions = _tmp16_;
	_tmp15_ = (_vala_GValue_array_free (_tmp15_, _tmp15__length1), NULL);
	_tmp13_ = (_vala_array_free (_tmp13_, _tmp13__length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (engine);
}

static void
ft_application_update_color_scheme (FtApplication* self)
{
	AdwStyleManager* style_manager = NULL;
	AdwStyleManager* _tmp0_;
	AdwStyleManager* _tmp1_;
	GSettings* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = adw_style_manager_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	style_manager = _tmp1_;
	_tmp2_ = self->priv->settings;
	if (g_settings_get_boolean (_tmp2_, "dark-theme")) {
		AdwStyleManager* _tmp3_;
		_tmp3_ = style_manager;
		adw_style_manager_set_color_scheme (_tmp3_, ADW_COLOR_SCHEME_FORCE_DARK);
	} else {
		AdwStyleManager* _tmp4_;
		_tmp4_ = style_manager;
		adw_style_manager_set_color_scheme (_tmp4_, ADW_COLOR_SCHEME_DEFAULT);
	}
	_g_object_unref0 (style_manager);
}

/**
         * Emitted on the primary instance immediately after registration.
         */
static Block33Data*
block33_data_ref (Block33Data* _data33_)
{
	g_atomic_int_inc (&_data33_->_ref_count_);
	return _data33_;
}

static void
block33_data_unref (void * _userdata_)
{
	Block33Data* _data33_;
	_data33_ = (Block33Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data33_->_ref_count_)) {
		FtApplication* self;
		self = _data33_->self;
		_g_main_context_unref0 (_data33_->main_context);
		_g_object_unref0 (self);
		g_slice_free (Block33Data, _data33_);
	}
}

static gpointer
_g_main_context_ref0 (gpointer self)
{
	return self ? g_main_context_ref (self) : NULL;
}

static void
_ft_application_on_settings_changed_g_settings_changed (GSettings* _sender,
                                                        const gchar* key,
                                                        gpointer self)
{
	ft_application_on_settings_changed ((FtApplication*) self, _sender, key);
}

static void
_ft_application_on_event_ft_event_bus_event (FtEventBus* _sender,
                                             FtEvent* event,
                                             gpointer self)
{
	ft_application_on_event ((FtApplication*) self, event);
}

static void
_ft_application_on_enter_session_ft_session_manager_enter_session (FtSessionManager* _sender,
                                                                   FtSession* session,
                                                                   gpointer self)
{
	ft_application_on_enter_session ((FtApplication*) self, session);
}

static void
_ft_application_on_leave_session_ft_session_manager_leave_session (FtSessionManager* _sender,
                                                                   FtSession* session,
                                                                   gpointer self)
{
	ft_application_on_leave_session ((FtApplication*) self, session);
}

static void
_ft_application_on_advanced_ft_session_manager_advanced (FtSessionManager* _sender,
                                                         FtSession* current_session,
                                                         FtTimeBlock* current_time_block,
                                                         FtSession* previous_session,
                                                         FtTimeBlock* previous_time_block,
                                                         gpointer self)
{
	ft_application_on_advanced ((FtApplication*) self, current_session, current_time_block, previous_session, previous_time_block);
}

static void
__lambda97_ (Block33Data* _data33_,
             GObject* obj,
             GAsyncResult* res)
{
	FtApplication* self;
	FtSessionManager* _tmp0_;
	FtSessionManager* _tmp1_;
	FtSessionManager* _tmp2_;
	FtSessionManager* _tmp3_;
	FtSessionManager* _tmp4_;
	FtSessionManager* _tmp5_;
	FtSession* _tmp6_;
	FtSession* _tmp7_;
	GMainContext* _tmp8_;
	self = _data33_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->session_manager;
	ft_session_manager_restore_finish (_tmp0_, res);
	_tmp1_ = self->session_manager;
	ft_session_manager_ensure_session (_tmp1_, FT_TIMESTAMP_UNDEFINED);
	_tmp2_ = self->session_manager;
	g_signal_connect_object (_tmp2_, "enter-session", (GCallback) _ft_application_on_enter_session_ft_session_manager_enter_session, self, 0);
	_tmp3_ = self->session_manager;
	g_signal_connect_object (_tmp3_, "leave-session", (GCallback) _ft_application_on_leave_session_ft_session_manager_leave_session, self, 0);
	_tmp4_ = self->session_manager;
	g_signal_connect_object (_tmp4_, "advanced", (GCallback) _ft_application_on_advanced_ft_session_manager_advanced, self, 0);
	_tmp5_ = self->session_manager;
	_tmp6_ = ft_session_manager_get_current_session (_tmp5_);
	_tmp7_ = _tmp6_;
	ft_application_on_enter_session (self, _tmp7_);
	_data33_->restored = TRUE;
	_tmp8_ = _data33_->main_context;
	g_main_context_wakeup (_tmp8_);
}

static void
___lambda97__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda97_ (self, source_object, res);
	block33_data_unref (self);
}

static void
___lambda98_ (FtApplication* self,
              GObject* obj,
              GAsyncResult* res)
{
	FtBackgroundManager* _tmp0_;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->priv->background_manager;
	self->priv->service_hold_id = ft_background_manager_hold_finish (_tmp0_, res);
}

static void
____lambda98__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda98_ ((FtApplication*) self, source_object, res);
	g_object_unref (self);
}

static void
ft_application_real_startup (GApplication* base)
{
	FtApplication * self;
	Block33Data* _data33_;
	GDBusConnection* dbus_connection = NULL;
	GDBusConnection* _tmp0_;
	GDBusConnection* _tmp1_;
	gchar* dbus_object_path = NULL;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	GMainContext* _tmp4_;
	GMainContext* _tmp5_;
	GSettings* _tmp6_;
	GSettings* _tmp7_;
	FtSessionManager* _tmp8_;
	FtSessionManager* _tmp9_;
	FtSessionManager* _tmp10_;
	FtTimer* _tmp11_;
	FtTimer* _tmp12_;
	FtTimer* _tmp13_;
	FtStatsManager* _tmp14_;
	FtNotificationManager* _tmp15_;
	FtScreenOverlayManager* _tmp16_;
	FtBackgroundManager* _tmp17_;
	FtEventProducer* _tmp18_;
	FtEventProducer* _tmp19_;
	FtEventBus* _tmp20_;
	FtEventBus* _tmp21_;
	FtEventBus* _tmp22_;
	FtJobQueue* _tmp23_;
	FtLogger* _tmp24_;
	FtIndicator* _tmp25_;
	FtScreenSaver* _tmp26_;
	FtActionManager* _tmp27_;
	FtSoundManager* _tmp28_ = NULL;
	GSettings* _tmp29_;
	FtSoundManager* _tmp31_;
	GSettings* _tmp32_;
	FtEventBus* _tmp33_;
	FtSessionManager* _tmp34_;
	GApplicationFlags _tmp35_;
	GApplicationFlags _tmp36_;
	FtTimerDBusService* _tmp39_;
	FtSessionDBusService* _tmp52_;
	GVariantDict* _tmp64_;
	GError* _inner_error0_ = NULL;
	self = (FtApplication*) base;
	_data33_ = g_slice_new0 (Block33Data);
	_data33_->_ref_count_ = 1;
	_data33_->self = g_object_ref (self);
	_tmp0_ = g_application_get_dbus_connection ((GApplication*) self);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	dbus_connection = _tmp1_;
	_tmp2_ = g_application_get_dbus_object_path ((GApplication*) self);
	_tmp3_ = g_strdup (_tmp2_);
	dbus_object_path = _tmp3_;
	_tmp4_ = g_main_context_default ();
	_tmp5_ = _g_main_context_ref0 (_tmp4_);
	_data33_->main_context = _tmp5_;
	_data33_->restored = FALSE;
	g_application_hold ((GApplication*) self);
	g_application_mark_busy ((GApplication*) self);
	G_APPLICATION_CLASS (ft_application_parent_class)->startup ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_application_get_type (), AdwApplication));
	_tmp6_ = ft_get_settings ();
	_tmp7_ = _g_object_ref0 (_tmp6_);
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp7_;
	_tmp8_ = ft_session_manager_get_default ();
	_tmp9_ = _g_object_ref0 (_tmp8_);
	_g_object_unref0 (self->session_manager);
	self->session_manager = _tmp9_;
	_tmp10_ = self->session_manager;
	_tmp11_ = ft_session_manager_get_timer (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = _g_object_ref0 (_tmp12_);
	_g_object_unref0 (self->timer);
	self->timer = _tmp13_;
	_tmp14_ = ft_stats_manager_new ();
	_g_object_unref0 (self->priv->stats_manager);
	self->priv->stats_manager = _tmp14_;
	_tmp15_ = ft_notification_manager_new ();
	_g_object_unref0 (self->priv->notification_manager);
	self->priv->notification_manager = _tmp15_;
	_tmp16_ = ft_screen_overlay_manager_new ();
	_g_object_unref0 (self->priv->screen_overlay_manager);
	self->priv->screen_overlay_manager = _tmp16_;
	_tmp17_ = ft_background_manager_new ();
	_g_object_unref0 (self->priv->background_manager);
	self->priv->background_manager = _tmp17_;
	_tmp18_ = ft_event_producer_new ();
	_g_object_unref0 (self->priv->event_producer);
	self->priv->event_producer = _tmp18_;
	_tmp19_ = self->priv->event_producer;
	_tmp20_ = ft_event_producer_get_bus (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = _g_object_ref0 (_tmp21_);
	_g_object_unref0 (self->priv->event_bus);
	self->priv->event_bus = _tmp22_;
	_tmp23_ = ft_job_queue_new ();
	_g_object_unref0 (self->priv->job_queue);
	self->priv->job_queue = _tmp23_;
	_tmp24_ = ft_logger_new ();
	_g_object_unref0 (self->priv->logger);
	self->priv->logger = _tmp24_;
	_tmp25_ = ft_indicator_new ();
	_g_object_unref0 (self->priv->indicator);
	self->priv->indicator = _tmp25_;
	_tmp26_ = ft_screen_saver_new ();
	_g_object_unref0 (self->priv->screensaver);
	self->priv->screensaver = _tmp26_;
	_tmp27_ = ft_action_manager_new ();
	_g_object_unref0 (self->priv->action_manager);
	self->priv->action_manager = _tmp27_;
	_tmp29_ = self->priv->settings;
	if (g_settings_get_boolean (_tmp29_, "sounds")) {
		FtSoundManager* _tmp30_;
		_tmp30_ = ft_sound_manager_new ();
		_g_object_unref0 (_tmp28_);
		_tmp28_ = _tmp30_;
	} else {
		_g_object_unref0 (_tmp28_);
		_tmp28_ = NULL;
	}
	_tmp31_ = _tmp28_;
	_tmp28_ = NULL;
	_g_object_unref0 (self->priv->sound_manager);
	self->priv->sound_manager = _tmp31_;
	ft_application_setup_resources (self);
	ft_application_setup_database (self);
	ft_application_setup_plugins (self);
	ft_application_setup_providers (self);
	ft_application_setup_actions (self);
	ft_application_update_color_scheme (self);
	_tmp32_ = self->priv->settings;
	g_signal_connect_object (_tmp32_, "changed", (GCallback) _ft_application_on_settings_changed_g_settings_changed, self, 0);
	_tmp33_ = self->priv->event_bus;
	g_signal_connect_object (_tmp33_, "event", (GCallback) _ft_application_on_event_ft_event_bus_event, self, 0);
	_tmp34_ = self->session_manager;
	ft_session_manager_restore (_tmp34_, FT_TIMESTAMP_UNDEFINED, ___lambda97__gasync_ready_callback, block33_data_ref (_data33_));
	_tmp35_ = g_application_get_flags ((GApplication*) self);
	_tmp36_ = _tmp35_;
	if ((_tmp36_ & G_APPLICATION_IS_SERVICE) == G_APPLICATION_IS_SERVICE) {
		FtBackgroundManager* _tmp37_;
		_tmp37_ = self->priv->background_manager;
		ft_background_manager_hold (_tmp37_, "", ____lambda98__gasync_ready_callback, g_object_ref (self));
	}
	while (TRUE) {
		GMainContext* _tmp38_;
		if (!(!_data33_->restored)) {
			break;
		}
		_tmp38_ = _data33_->main_context;
		g_main_context_iteration (_tmp38_, TRUE);
	}
	_tmp39_ = self->priv->timer_dbus_service;
	if (_tmp39_ == NULL) {
		{
			GDBusConnection* _tmp40_;
			const gchar* _tmp41_;
			FtTimer* _tmp42_;
			FtSessionManager* _tmp43_;
			FtTimerDBusService* _tmp44_;
			guint _tmp45_ = 0U;
			GDBusConnection* _tmp46_;
			const gchar* _tmp47_;
			FtTimerDBusService* _tmp48_;
			guint _tmp49_;
			_tmp40_ = dbus_connection;
			_tmp41_ = dbus_object_path;
			_tmp42_ = self->timer;
			_tmp43_ = self->session_manager;
			_tmp44_ = ft_timer_dbus_service_new (_tmp40_, _tmp41_, _tmp42_, _tmp43_);
			_g_object_unref0 (self->priv->timer_dbus_service);
			self->priv->timer_dbus_service = _tmp44_;
			_tmp46_ = dbus_connection;
			_tmp47_ = dbus_object_path;
			_tmp48_ = self->priv->timer_dbus_service;
			_tmp49_ = ft_timer_dbus_service_register_object (_tmp48_, _tmp46_, _tmp47_, &_inner_error0_);
			_tmp45_ = _tmp49_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->domain == G_IO_ERROR) {
					goto __catch0_g_io_error;
				}
				_g_object_unref0 (_tmp28_);
				_g_free0 (dbus_object_path);
				_g_object_unref0 (dbus_connection);
				block33_data_unref (_data33_);
				_data33_ = NULL;
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
			self->priv->timer_dbus_service_id = _tmp45_;
		}
		goto __finally0;
		__catch0_g_io_error:
		{
			GError* _error_ = NULL;
			GError* _tmp50_;
			const gchar* _tmp51_;
			_error_ = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp50_ = _error_;
			_tmp51_ = _tmp50_->message;
			g_warning ("application.vala:798: Error while initializing timer dbus service: %s", _tmp51_);
			_g_object_unref0 (self->priv->timer_dbus_service);
			self->priv->timer_dbus_service = NULL;
			_g_error_free0 (_error_);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (_tmp28_);
			_g_free0 (dbus_object_path);
			_g_object_unref0 (dbus_connection);
			block33_data_unref (_data33_);
			_data33_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp52_ = self->priv->session_dbus_service;
	if (_tmp52_ == NULL) {
		{
			GDBusConnection* _tmp53_;
			const gchar* _tmp54_;
			FtSessionManager* _tmp55_;
			FtSessionDBusService* _tmp56_;
			guint _tmp57_ = 0U;
			GDBusConnection* _tmp58_;
			const gchar* _tmp59_;
			FtSessionDBusService* _tmp60_;
			guint _tmp61_;
			_tmp53_ = dbus_connection;
			_tmp54_ = dbus_object_path;
			_tmp55_ = self->session_manager;
			_tmp56_ = ft_session_dbus_service_new (_tmp53_, _tmp54_, _tmp55_);
			_g_object_unref0 (self->priv->session_dbus_service);
			self->priv->session_dbus_service = _tmp56_;
			_tmp58_ = dbus_connection;
			_tmp59_ = dbus_object_path;
			_tmp60_ = self->priv->session_dbus_service;
			_tmp61_ = ft_session_dbus_service_register_object (_tmp60_, _tmp58_, _tmp59_, &_inner_error0_);
			_tmp57_ = _tmp61_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->domain == G_IO_ERROR) {
					goto __catch1_g_io_error;
				}
				_g_object_unref0 (_tmp28_);
				_g_free0 (dbus_object_path);
				_g_object_unref0 (dbus_connection);
				block33_data_unref (_data33_);
				_data33_ = NULL;
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
			self->priv->session_dbus_service_id = _tmp57_;
		}
		goto __finally1;
		__catch1_g_io_error:
		{
			GError* _error_ = NULL;
			GError* _tmp62_;
			const gchar* _tmp63_;
			_error_ = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp62_ = _error_;
			_tmp63_ = _tmp62_->message;
			g_warning ("application.vala:816: Error while initializing session dbus service: %" \
"s", _tmp63_);
			_g_object_unref0 (self->priv->session_dbus_service);
			self->priv->session_dbus_service = NULL;
			_g_error_free0 (_error_);
		}
		__finally1:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (_tmp28_);
			_g_free0 (dbus_object_path);
			_g_object_unref0 (dbus_connection);
			block33_data_unref (_data33_);
			_data33_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp64_ = self->priv->command_line_options;
	if (_tmp64_ != NULL) {
		GSList* _tmp65_;
		_tmp65_ = ft_application_get_options ();
		{
			GSList* option_collection = NULL;
			GSList* option_it = NULL;
			option_collection = _tmp65_;
			for (option_it = option_collection; option_it != NULL; option_it = option_it->next) {
				FtApplicationOption* option = NULL;
				option = (FtApplicationOption*) option_it->data;
				{
					GVariantDict* _tmp66_ = NULL;
					GVariantDict* _tmp67_;
					GVariant* _tmp68_ = NULL;
					GVariant* value = NULL;
					GVariant* _tmp72_;
					gboolean _tmp73_ = FALSE;
					gboolean _tmp74_ = FALSE;
					GVariant* _tmp75_;
					_tmp67_ = self->priv->command_line_options;
					_tmp66_ = _tmp67_;
					_tmp68_ = NULL;
					if (_tmp66_ != NULL) {
						FtApplicationOption* _tmp69_;
						const gchar* _tmp70_;
						GVariant* _tmp71_;
						_tmp69_ = option;
						_tmp70_ = _tmp69_->long_name;
						_tmp71_ = g_variant_dict_lookup_value (_tmp66_, _tmp70_, NULL);
						_g_variant_unref0 (_tmp68_);
						_tmp68_ = _tmp71_;
					}
					_tmp72_ = _tmp68_;
					_tmp68_ = NULL;
					value = _tmp72_;
					_tmp75_ = value;
					if (_tmp75_ != NULL) {
						FtApplicationOption* _tmp76_;
						const gchar* _tmp77_;
						_tmp76_ = option;
						_tmp77_ = _tmp76_->action_name;
						_tmp74_ = _tmp77_ != NULL;
					} else {
						_tmp74_ = FALSE;
					}
					if (_tmp74_) {
						FtApplicationOption* _tmp78_;
						const gchar* _tmp79_;
						_tmp78_ = option;
						_tmp79_ = _tmp78_->group;
						_tmp73_ = g_strcmp0 (_tmp79_, "timer") == 0;
					} else {
						_tmp73_ = FALSE;
					}
					if (_tmp73_) {
						FtApplicationOption* _tmp80_;
						const gchar* _tmp81_;
						FtApplicationOption* _tmp82_;
						GVariant* _tmp83_;
						GVariant* _tmp84_;
						GVariant* _tmp85_;
						_tmp80_ = option;
						_tmp81_ = _tmp80_->action_name;
						_tmp82_ = option;
						_tmp83_ = value;
						_tmp84_ = ft_application_option_get_action_parameter (_tmp82_, _tmp83_);
						_tmp85_ = _tmp84_;
						ft_application_activate_prefixed_action (self, _tmp81_, _tmp85_);
						_g_variant_unref0 (_tmp85_);
					}
					_g_variant_unref0 (value);
					_g_variant_unref0 (_tmp68_);
				}
			}
			(option_collection == NULL) ? NULL : (option_collection = (g_slist_free (option_collection), NULL));
		}
		_g_variant_dict_unref0 (self->priv->command_line_options);
		self->priv->command_line_options = NULL;
	}
	ft_application_set_ready (self, TRUE);
	g_application_unmark_busy ((GApplication*) self);
	g_application_release ((GApplication*) self);
	_g_object_unref0 (_tmp28_);
	_g_free0 (dbus_object_path);
	_g_object_unref0 (dbus_connection);
	block33_data_unref (_data33_);
	_data33_ = NULL;
}

static void
ft_application_print_timer_status (FtApplication* self,
                                   GApplicationCommandLine* command_line)
{
	gint64 timestamp = 0LL;
	FtTimer* _tmp0_;
	gint64 last_state_changed_time = 0LL;
	FtTimer* _tmp1_;
	GString* message = NULL;
	GString* _tmp2_;
	gchar* glyph = NULL;
	gchar* _tmp3_;
	FtTimer* _tmp4_;
	GString* _tmp10_;
	const gchar* _tmp11_;
	FtSessionManager* _tmp12_;
	FtState _tmp13_;
	FtState _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	FtSessionManager* _tmp17_;
	FtState _tmp18_;
	FtState _tmp19_;
	GString* _tmp26_;
	const gchar* _tmp27_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (command_line != NULL);
	_tmp0_ = self->timer;
	timestamp = ft_timer_get_current_time (_tmp0_, FT_TIMESTAMP_UNDEFINED);
	_tmp1_ = self->timer;
	last_state_changed_time = ft_timer_get_last_state_changed_time (_tmp1_);
	if ((timestamp - last_state_changed_time) < FT_INTERVAL_SECOND) {
		timestamp = last_state_changed_time;
	}
	_tmp2_ = g_string_new ("");
	message = _tmp2_;
	_tmp3_ = g_strdup (" ");
	glyph = _tmp3_;
	_tmp4_ = self->timer;
	if (ft_timer_is_running (_tmp4_)) {
		gchar* _tmp5_;
		_tmp5_ = g_strdup ("▶");
		_g_free0 (glyph);
		glyph = _tmp5_;
	} else {
		FtTimer* _tmp6_;
		_tmp6_ = self->timer;
		if (ft_timer_is_paused (_tmp6_)) {
			gchar* _tmp7_;
			_tmp7_ = g_strdup ("⏸");
			_g_free0 (glyph);
			glyph = _tmp7_;
		} else {
			FtTimer* _tmp8_;
			_tmp8_ = self->timer;
			if (!ft_timer_is_started (_tmp8_)) {
				gchar* _tmp9_;
				_tmp9_ = g_strdup ("⏹");
				_g_free0 (glyph);
				glyph = _tmp9_;
			}
		}
	}
	_tmp10_ = message;
	_tmp11_ = glyph;
	_tmp12_ = self->session_manager;
	_tmp13_ = ft_session_manager_get_current_state (_tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = ft_state_get_label (_tmp14_);
	_tmp16_ = _tmp15_;
	g_string_append_printf (_tmp10_, " %s %s\n", _tmp11_, _tmp16_);
	_g_free0 (_tmp16_);
	_tmp17_ = self->session_manager;
	_tmp18_ = ft_session_manager_get_current_state (_tmp17_);
	_tmp19_ = _tmp18_;
	if (_tmp19_ != FT_STATE_STOPPED) {
		guint seconds_uint = 0U;
		FtTimer* _tmp20_;
		GString* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		_tmp20_ = self->timer;
		seconds_uint = (guint) ft_timestamp_to_seconds_uint (ft_timer_calculate_remaining (_tmp20_, timestamp));
		_tmp21_ = message;
		_tmp22_ = ft_format_time (seconds_uint);
		_tmp23_ = _tmp22_;
		_tmp24_ = g_strdup_printf (_ ("%s remaining"), _tmp23_);
		_tmp25_ = _tmp24_;
		g_string_append_printf (_tmp21_, "   %s\n", _tmp25_);
		_g_free0 (_tmp25_);
		_g_free0 (_tmp23_);
	}
	_tmp26_ = message;
	_tmp27_ = _tmp26_->str;
	G_TYPE_INSTANCE_GET_CLASS (command_line, g_application_command_line_get_type (), GApplicationCommandLineClass)->print_literal (command_line, _tmp27_);
	_g_free0 (glyph);
	_g_string_free0 (message);
}

static void
ft_application_print_version (FtApplication* self)
{
	FILE* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = stdout;
	_tmp1_ = g_get_application_name ();
	fprintf (_tmp0_, "%s %s\n", _tmp1_, PACKAGE_VERSION);
}

/**
         * GLib only fills `options` for entries with empty `arg_data`, and empty `arg_data` aren't
         * supported for option groups. Therefore, we fill `options` manually before it's passed
         * to the primary instance.
         */
static gpointer
_g_variant_dict_ref0 (gpointer self)
{
	return self ? g_variant_dict_ref (self) : NULL;
}

static gint
ft_application_real_handle_local_options (GApplication* base,
                                          GVariantDict* options)
{
	FtApplication * self;
	guint options_count = 0U;
	guint exclusive_options_count = 0U;
	gboolean version_requested = FALSE;
	FtApplicationOption** _tmp0_;
	gint _tmp0__length1;
	GApplicationFlags _tmp13_;
	GApplicationFlags _tmp14_;
	gint result;
	self = (FtApplication*) base;
	g_return_val_if_fail (options != NULL, -1);
	options_count = 0U;
	exclusive_options_count = 0U;
	version_requested = FALSE;
	_tmp0_ = ft_application_OPTIONS;
	_tmp0__length1 = ft_application_OPTIONS_length1;
	{
		FtApplicationOption** option_collection = NULL;
		gint option_collection_length1 = 0;
		gint _option_collection_size_ = 0;
		gint option_it = 0;
		option_collection = _tmp0_;
		option_collection_length1 = _tmp0__length1;
		for (option_it = 0; option_it < option_collection_length1; option_it = option_it + 1) {
			FtApplicationOption* option = NULL;
			option = option_collection[option_it];
			{
				FtApplicationOption* _tmp1_;
				_tmp1_ = option;
				if (ft_application_option_is_set (_tmp1_)) {
					FtApplicationOption* _tmp2_;
					FtApplicationOption* _tmp4_;
					const gchar* _tmp5_;
					FtApplicationOption* _tmp6_;
					const gchar* _tmp7_;
					FtApplicationOption* _tmp8_;
					GVariant* _tmp9_;
					GVariant* _tmp10_;
					guint _tmp11_;
					_tmp2_ = option;
					if (_tmp2_->is_exclusive) {
						guint _tmp3_;
						_tmp3_ = exclusive_options_count;
						exclusive_options_count = _tmp3_ + 1;
					}
					_tmp4_ = option;
					_tmp5_ = _tmp4_->long_name;
					if (g_strcmp0 (_tmp5_, "version") == 0) {
						version_requested = TRUE;
						continue;
					}
					_tmp6_ = option;
					_tmp7_ = _tmp6_->long_name;
					_tmp8_ = option;
					_tmp9_ = ft_application_option_get_value (_tmp8_);
					_tmp10_ = _tmp9_;
					g_variant_dict_insert_value (options, _tmp7_, _tmp10_);
					_g_variant_unref0 (_tmp10_);
					_tmp11_ = options_count;
					options_count = _tmp11_ + 1;
				}
			}
		}
	}
	if (exclusive_options_count > 1U) {
		FILE* _tmp12_;
		_tmp12_ = stderr;
		fprintf (_tmp12_, "%s\n", _ ("Invalid use. Pass one flag for controlling the timer at a time."));
		result = (gint) FT_EXIT_STATUS_FAILURE;
		return result;
	}
	if (version_requested) {
		ft_application_print_version (self);
		result = (gint) FT_EXIT_STATUS_SUCCESS;
		return result;
	}
	_tmp13_ = g_application_get_flags ((GApplication*) self);
	_tmp14_ = _tmp13_;
	if ((_tmp14_ & G_APPLICATION_IS_SERVICE) == G_APPLICATION_IS_SERVICE) {
		GVariantDict* _tmp15_ = NULL;
		GVariantDict* _tmp16_;
		if (options_count > ((guint) 0)) {
			_tmp15_ = options;
		} else {
			_tmp15_ = NULL;
		}
		_tmp16_ = _g_variant_dict_ref0 (_tmp15_);
		_g_variant_dict_unref0 (self->priv->command_line_options);
		self->priv->command_line_options = _tmp16_;
	}
	result = (gint) FT_EXIT_STATUS_UNDEFINED;
	return result;
}

/**
         * Run command-line options on the primary instance, or handle local options when starting
         * the app.
         */
static gint
ft_application_real_command_line (GApplication* base,
                                  GApplicationCommandLine* command_line)
{
	FtApplication * self;
	GVariantDict* options = NULL;
	GVariantDict* _tmp0_;
	GVariantDict* _tmp1_;
	FtExitStatus exit_status = 0;
	GSList* _tmp2_;
	GVariantDict* _tmp20_;
	gint result;
	self = (FtApplication*) base;
	g_return_val_if_fail (command_line != NULL, -1);
	_tmp0_ = g_application_command_line_get_options_dict (command_line);
	_tmp1_ = _g_variant_dict_ref0 (_tmp0_);
	options = _tmp1_;
	exit_status = FT_EXIT_STATUS_UNDEFINED;
	_tmp2_ = ft_application_get_options ();
	{
		GSList* option_collection = NULL;
		GSList* option_it = NULL;
		option_collection = _tmp2_;
		for (option_it = option_collection; option_it != NULL; option_it = option_it->next) {
			FtApplicationOption* option = NULL;
			option = (FtApplicationOption*) option_it->data;
			{
				GVariant* value = NULL;
				GVariantDict* _tmp3_;
				FtApplicationOption* _tmp4_;
				const gchar* _tmp5_;
				GVariant* _tmp6_;
				GVariant* _tmp7_;
				FtApplicationOption* _tmp8_;
				const gchar* _tmp9_;
				_tmp3_ = options;
				_tmp4_ = option;
				_tmp5_ = _tmp4_->long_name;
				_tmp6_ = g_variant_dict_lookup_value (_tmp3_, _tmp5_, NULL);
				value = _tmp6_;
				_tmp7_ = value;
				if (_tmp7_ == NULL) {
					_g_variant_unref0 (value);
					continue;
				}
				_tmp8_ = option;
				_tmp9_ = _tmp8_->action_name;
				if (_tmp9_ != NULL) {
					FtApplicationOption* _tmp10_;
					const gchar* _tmp11_;
					FtApplicationOption* _tmp12_;
					GVariant* _tmp13_;
					GVariant* _tmp14_;
					GVariant* _tmp15_;
					gboolean _tmp16_;
					gboolean _tmp17_;
					_tmp10_ = option;
					_tmp11_ = _tmp10_->action_name;
					_tmp12_ = option;
					_tmp13_ = value;
					_tmp14_ = ft_application_option_get_action_parameter (_tmp12_, _tmp13_);
					_tmp15_ = _tmp14_;
					ft_application_activate_prefixed_action (self, _tmp11_, _tmp15_);
					_g_variant_unref0 (_tmp15_);
					_tmp16_ = g_application_command_line_get_is_remote (command_line);
					_tmp17_ = _tmp16_;
					if (_tmp17_) {
						exit_status = FT_EXIT_STATUS_SUCCESS;
					}
				} else {
					FtApplicationOption* _tmp18_;
					const gchar* _tmp19_;
					_tmp18_ = option;
					_tmp19_ = _tmp18_->long_name;
					if (g_strcmp0 (_tmp19_, "status") == 0) {
						ft_application_print_timer_status (self, command_line);
						exit_status = FT_EXIT_STATUS_SUCCESS;
					}
				}
				_g_variant_unref0 (value);
			}
		}
		(option_collection == NULL) ? NULL : (option_collection = (g_slist_free (option_collection), NULL));
	}
	if (exit_status != FT_EXIT_STATUS_UNDEFINED) {
		g_application_command_line_set_exit_status (command_line, (gint) exit_status);
	}
	g_application_command_line_done (command_line);
	if (exit_status != FT_EXIT_STATUS_UNDEFINED) {
		result = (gint) exit_status;
		_g_variant_dict_unref0 (options);
		return result;
	}
	_tmp20_ = options;
	self->priv->preferences_requested = g_variant_dict_contains (_tmp20_, "preferences");
	g_application_activate ((GApplication*) self);
	self->priv->preferences_requested = FALSE;
	result = (gint) FT_EXIT_STATUS_SUCCESS;
	_g_variant_dict_unref0 (options);
	return result;
}

static void
ft_application_real_activate (GApplication* base)
{
	FtApplication * self;
	self = (FtApplication*) base;
	if (self->priv->preferences_requested) {
		ft_application_show_preferences (self, "");
	} else {
		ft_application_show_window (self, FT_WINDOW_VIEW_DEFAULT);
	}
}

static Block34Data*
block34_data_ref (Block34Data* _data34_)
{
	g_atomic_int_inc (&_data34_->_ref_count_);
	return _data34_;
}

static void
block34_data_unref (void * _userdata_)
{
	Block34Data* _data34_;
	_data34_ = (Block34Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data34_->_ref_count_)) {
		FtApplication* self;
		self = _data34_->self;
		_g_object_unref0 (self);
		g_slice_free (Block34Data, _data34_);
	}
}

static void
_ft_application_on_current_session_changed_ft_session_changed (FtSession* _sender,
                                                               gpointer self)
{
	ft_application_on_current_session_changed ((FtApplication*) self);
}

static void
__lambda99_ (Block34Data* _data34_,
             GObject* obj,
             GAsyncResult* res)
{
	FtApplication* self;
	FtJobQueue* _tmp0_;
	gint _tmp1_;
	self = _data34_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->priv->job_queue;
	ft_job_queue_wait_finish (_tmp0_, res);
	_tmp1_ = _data34_->remaining;
	_data34_->remaining = _tmp1_ - 1;
}

static void
___lambda99__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda99_ (self, source_object, res);
	block34_data_unref (self);
}

static void
__lambda100_ (Block34Data* _data34_,
              GObject* obj,
              GAsyncResult* res)
{
	FtApplication* self;
	FtSessionManager* _tmp0_;
	gint _tmp1_;
	self = _data34_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->session_manager;
	ft_session_manager_save_finish (_tmp0_, res);
	_tmp1_ = _data34_->remaining;
	_data34_->remaining = _tmp1_ - 1;
}

static void
___lambda100__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	__lambda100_ (self, source_object, res);
	block34_data_unref (self);
}

static void
ft_application_real_shutdown (GApplication* base)
{
	FtApplication * self;
	Block34Data* _data34_;
	GSettings* _tmp1_;
	guint _tmp2_;
	FtEventBus* _tmp3_;
	guint _tmp4_;
	FtKeyboardManager* _tmp5_;
	guint _tmp6_;
	FtEventProducer* _tmp7_;
	FtEventBus* _tmp8_;
	FtActionManager* _tmp9_ = NULL;
	FtActionManager* _tmp10_;
	FtNotificationManager* _tmp11_;
	FtBackgroundManager* _tmp12_;
	FtSessionManager* _tmp13_;
	guint _tmp14_;
	FtSessionManager* _tmp15_;
	guint _tmp16_;
	FtSessionManager* _tmp17_;
	guint _tmp18_;
	FtSessionManager* _tmp19_;
	FtSession* _tmp20_;
	FtSession* _tmp21_;
	FtTimer* _tmp26_;
	GMainContext* main_context = NULL;
	GMainContext* _tmp27_;
	GMainContext* _tmp28_;
	FtJobQueue* _tmp29_;
	FtSessionManager* _tmp30_;
	self = (FtApplication*) base;
	_data34_ = g_slice_new0 (Block34Data);
	_data34_->_ref_count_ = 1;
	_data34_->self = g_object_ref (self);
	if (self->priv->service_hold_id != 0U) {
		FtBackgroundManager* _tmp0_;
		_tmp0_ = self->priv->background_manager;
		ft_background_manager_release (_tmp0_, self->priv->service_hold_id);
		self->priv->service_hold_id = 0U;
	}
	if (self->priv->save_idle_id != ((guint) 0)) {
		g_source_remove (self->priv->save_idle_id);
		self->priv->save_idle_id = (guint) 0;
	}
	_tmp1_ = self->priv->settings;
	g_signal_parse_name ("changed", g_settings_get_type (), &_tmp2_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _ft_application_on_settings_changed_g_settings_changed, self);
	_tmp3_ = self->priv->event_bus;
	g_signal_parse_name ("event", FT_TYPE_EVENT_BUS, &_tmp4_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _ft_application_on_event_ft_event_bus_event, self);
	_tmp5_ = self->priv->keyboard_manager;
	g_signal_parse_name ("shortcut-activated", FT_TYPE_KEYBOARD_MANAGER, &_tmp6_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp5_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, 0, NULL, (GCallback) _ft_application_on_shortcut_activated_ft_keyboard_manager_shortcut_activated, self);
	G_APPLICATION_CLASS (ft_application_parent_class)->shutdown ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_application_get_type (), AdwApplication));
	_tmp7_ = self->priv->event_producer;
	ft_event_producer_destroy (_tmp7_);
	_tmp8_ = self->priv->event_bus;
	ft_event_bus_destroy (_tmp8_);
	_tmp10_ = self->priv->action_manager;
	_tmp9_ = _tmp10_;
	if (_tmp9_ != NULL) {
		ft_action_manager_destroy (_tmp9_);
	}
	_tmp11_ = self->priv->notification_manager;
	ft_notification_manager_destroy (_tmp11_);
	_tmp12_ = self->priv->background_manager;
	ft_background_manager_destroy (_tmp12_);
	_tmp13_ = self->session_manager;
	g_signal_parse_name ("enter-session", FT_TYPE_SESSION_MANAGER, &_tmp14_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp13_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp14_, 0, NULL, (GCallback) _ft_application_on_enter_session_ft_session_manager_enter_session, self);
	_tmp15_ = self->session_manager;
	g_signal_parse_name ("leave-session", FT_TYPE_SESSION_MANAGER, &_tmp16_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp15_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp16_, 0, NULL, (GCallback) _ft_application_on_leave_session_ft_session_manager_leave_session, self);
	_tmp17_ = self->session_manager;
	g_signal_parse_name ("advanced", FT_TYPE_SESSION_MANAGER, &_tmp18_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp17_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp18_, 0, NULL, (GCallback) _ft_application_on_advanced_ft_session_manager_advanced, self);
	_tmp19_ = self->session_manager;
	_tmp20_ = ft_session_manager_get_current_session (_tmp19_);
	_tmp21_ = _tmp20_;
	if (_tmp21_ != NULL) {
		FtSessionManager* _tmp22_;
		FtSession* _tmp23_;
		FtSession* _tmp24_;
		guint _tmp25_;
		_tmp22_ = self->session_manager;
		_tmp23_ = ft_session_manager_get_current_session (_tmp22_);
		_tmp24_ = _tmp23_;
		g_signal_parse_name ("changed", FT_TYPE_SESSION, &_tmp25_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp24_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp25_, 0, NULL, (GCallback) _ft_application_on_current_session_changed_ft_session_changed, self);
	}
	_tmp26_ = self->timer;
	ft_timer_pause (_tmp26_, FT_TIMESTAMP_UNDEFINED);
	_tmp27_ = g_main_context_default ();
	_tmp28_ = _g_main_context_ref0 (_tmp27_);
	main_context = _tmp28_;
	_data34_->remaining = 2;
	_tmp29_ = self->priv->job_queue;
	ft_job_queue_wait (_tmp29_, ___lambda99__gasync_ready_callback, block34_data_ref (_data34_));
	_tmp30_ = self->session_manager;
	ft_session_manager_save (_tmp30_, ___lambda100__gasync_ready_callback, block34_data_ref (_data34_));
	while (TRUE) {
		gboolean _tmp31_ = FALSE;
		if (_data34_->remaining > 0) {
			GMainContext* _tmp32_;
			_tmp32_ = main_context;
			_tmp31_ = g_main_context_iteration (_tmp32_, TRUE);
		} else {
			_tmp31_ = FALSE;
		}
		if (!_tmp31_) {
			break;
		}
	}
	ft_database_close ();
	ft_session_manager_set_default (NULL);
	ft_timer_set_default (NULL);
	_g_object_unref0 (self->priv->event_producer);
	self->priv->event_producer = NULL;
	_g_object_unref0 (self->priv->event_bus);
	self->priv->event_bus = NULL;
	_g_object_unref0 (self->priv->extensions);
	self->priv->extensions = NULL;
	_g_object_unref0 (self->priv->job_queue);
	self->priv->job_queue = NULL;
	_g_object_unref0 (self->priv->action_manager);
	self->priv->action_manager = NULL;
	_g_object_unref0 (self->priv->logger);
	self->priv->logger = NULL;
	_g_object_unref0 (self->priv->indicator);
	self->priv->indicator = NULL;
	_g_object_unref0 (self->priv->screensaver);
	self->priv->screensaver = NULL;
	_g_object_unref0 (self->priv->background_manager);
	self->priv->background_manager = NULL;
	_g_object_unref0 (self->priv->sound_manager);
	self->priv->sound_manager = NULL;
	_g_object_unref0 (self->priv->notification_manager);
	self->priv->notification_manager = NULL;
	_g_object_unref0 (self->priv->screen_overlay_manager);
	self->priv->screen_overlay_manager = NULL;
	_g_object_unref0 (self->priv->keyboard_manager);
	self->priv->keyboard_manager = NULL;
	_g_object_unref0 (self->priv->stats_manager);
	self->priv->stats_manager = NULL;
	_g_object_unref0 (self->session_manager);
	self->session_manager = NULL;
	_g_object_unref0 (self->timer);
	self->timer = NULL;
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = NULL;
	_g_main_context_unref0 (main_context);
	block34_data_unref (_data34_);
	_data34_ = NULL;
}

/**
         * Register main D-Bus service for the app.
         */
static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

static gboolean
ft_application_real_dbus_register (GApplication* base,
                                   GDBusConnection* connection,
                                   const gchar* object_path,
                                   GError** error)
{
	FtApplication * self;
	GError* _inner_error0_ = NULL;
	gboolean result;
	self = (FtApplication*) base;
	g_return_val_if_fail (connection != NULL, FALSE);
	g_return_val_if_fail (object_path != NULL, FALSE);
	{
		FtApplicationDBusService* _tmp0_;
		G_APPLICATION_CLASS (ft_application_parent_class)->dbus_register ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_application_get_type (), AdwApplication), connection, object_path, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_IO_ERROR) {
				goto __catch0_g_io_error;
			}
			goto __finally0;
		}
		_tmp0_ = self->priv->dbus_service;
		if (_tmp0_ == NULL) {
			GSettings* _tmp1_;
			FtApplicationDBusService* _tmp2_;
			guint _tmp3_ = 0U;
			FtApplicationDBusService* _tmp4_;
			guint _tmp5_;
			_tmp1_ = ft_get_settings ();
			_tmp2_ = ft_application_dbus_service_new (connection, object_path, self, _tmp1_);
			_g_object_unref0 (self->priv->dbus_service);
			self->priv->dbus_service = _tmp2_;
			_tmp4_ = self->priv->dbus_service;
			_tmp5_ = ft_application_dbus_service_register_object (_tmp4_, connection, object_path, &_inner_error0_);
			_tmp3_ = _tmp5_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				gboolean _tmp6_ = FALSE;
				if (_inner_error0_->domain == G_IO_ERROR) {
					goto __catch0_g_io_error;
				}
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return _tmp6_;
			}
			self->priv->dbus_service_id = _tmp3_;
		}
	}
	goto __finally0;
	__catch0_g_io_error:
	{
		GError* _error_ = NULL;
		GError* _tmp7_;
		const gchar* _tmp8_;
		GError* _tmp9_;
		GError* _tmp10_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp7_ = _error_;
		_tmp8_ = _tmp7_->message;
		g_warning ("application.vala:1104: Error while initializing dbus service: %s", _tmp8_);
		_g_object_unref0 (self->priv->dbus_service);
		self->priv->dbus_service = NULL;
		_tmp9_ = _error_;
		_tmp10_ = _g_error_copy0 (_tmp9_);
		_inner_error0_ = _tmp10_;
		_g_error_free0 (_error_);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp11_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		return _tmp11_;
	}
	result = TRUE;
	return result;
}

static void
ft_application_real_dbus_unregister (GApplication* base,
                                     GDBusConnection* connection,
                                     const gchar* object_path)
{
	FtApplication * self;
	FtTimerDBusService* _tmp0_;
	FtSessionDBusService* _tmp1_;
	FtApplicationDBusService* _tmp2_;
	self = (FtApplication*) base;
	g_return_if_fail (connection != NULL);
	g_return_if_fail (object_path != NULL);
	_tmp0_ = self->priv->timer_dbus_service;
	if (_tmp0_ != NULL) {
		g_dbus_connection_unregister_object (connection, self->priv->timer_dbus_service_id);
		_g_object_unref0 (self->priv->timer_dbus_service);
		self->priv->timer_dbus_service = NULL;
		self->priv->timer_dbus_service_id = 0U;
	}
	_tmp1_ = self->priv->session_dbus_service;
	if (_tmp1_ != NULL) {
		g_dbus_connection_unregister_object (connection, self->priv->session_dbus_service_id);
		_g_object_unref0 (self->priv->session_dbus_service);
		self->priv->session_dbus_service = NULL;
		self->priv->session_dbus_service_id = 0U;
	}
	_tmp2_ = self->priv->dbus_service;
	if (_tmp2_ != NULL) {
		g_dbus_connection_unregister_object (connection, self->priv->dbus_service_id);
		_g_object_unref0 (self->priv->dbus_service);
		self->priv->dbus_service = NULL;
		self->priv->dbus_service_id = 0U;
	}
	G_APPLICATION_CLASS (ft_application_parent_class)->dbus_unregister ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_application_get_type (), AdwApplication), connection, object_path);
}

void
ft_application_send_notification (FtApplication* self,
                                  const gchar* id,
                                  FtNotification* notification)
{
	FtNotificationManager* _tmp0_ = NULL;
	FtNotificationManager* _tmp1_;
	FtNotificationBackendInterface* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	g_return_if_fail (notification != NULL);
	_tmp1_ = self->priv->notification_manager;
	_tmp0_ = _tmp1_;
	_tmp2_ = NULL;
	if (_tmp0_ != NULL) {
		FtNotificationBackendInterface* _tmp3_;
		FtNotificationBackendInterface* _tmp4_;
		_tmp3_ = ft_notification_manager_get_backend (_tmp0_);
		_tmp4_ = _tmp3_;
		_tmp2_ = _tmp4_;
	}
	ft_notification_backend_interface_send_notification (_tmp2_, id, notification);
}

void
ft_application_withdraw_notification (FtApplication* self,
                                      const gchar* id)
{
	FtNotificationManager* _tmp0_ = NULL;
	FtNotificationManager* _tmp1_;
	FtNotificationBackendInterface* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	_tmp1_ = self->priv->notification_manager;
	_tmp0_ = _tmp1_;
	_tmp2_ = NULL;
	if (_tmp0_ != NULL) {
		FtNotificationBackendInterface* _tmp3_;
		FtNotificationBackendInterface* _tmp4_;
		_tmp3_ = ft_notification_manager_get_backend (_tmp0_);
		_tmp4_ = _tmp3_;
		_tmp2_ = _tmp4_;
	}
	ft_notification_backend_interface_withdraw_notification (_tmp2_, id);
}

static void
ft_application_on_settings_changed (FtApplication* self,
                                    GSettings* settings,
                                    const gchar* key)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (settings != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = key;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("dark-theme")))) {
		switch (0) {
			default:
			{
				ft_application_update_color_scheme (self);
				break;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("sounds")))) {
		switch (0) {
			default:
			{
				FtSoundManager* _tmp3_ = NULL;
				FtSoundManager* _tmp5_;
				if (g_settings_get_boolean (settings, key)) {
					FtSoundManager* _tmp4_;
					_tmp4_ = ft_sound_manager_new ();
					_g_object_unref0 (_tmp3_);
					_tmp3_ = _tmp4_;
				} else {
					_g_object_unref0 (_tmp3_);
					_tmp3_ = NULL;
				}
				_tmp5_ = _tmp3_;
				_tmp3_ = NULL;
				_g_object_unref0 (self->priv->sound_manager);
				self->priv->sound_manager = _tmp5_;
				_g_object_unref0 (_tmp3_);
				break;
			}
		}
	}
}

static void
ft_application_on_current_session_changed (FtApplication* self)
{
	g_return_if_fail (self != NULL);
	ft_application_schedule_save (self);
}

static void
ft_application_on_enter_session (FtApplication* self,
                                 FtSession* session)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (session != NULL);
	g_signal_connect_object (session, "changed", (GCallback) _ft_application_on_current_session_changed_ft_session_changed, self, 0);
}

static void
ft_application_on_leave_session (FtApplication* self,
                                 FtSession* session)
{
	guint _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (session != NULL);
	g_signal_parse_name ("changed", FT_TYPE_SESSION, &_tmp0_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (session, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _ft_application_on_current_session_changed_ft_session_changed, self);
	ft_database_schedule_backup ();
}

static void
ft_application_on_advanced (FtApplication* self,
                            FtSession* current_session,
                            FtTimeBlock* current_time_block,
                            FtSession* previous_session,
                            FtTimeBlock* previous_time_block)
{
	g_return_if_fail (self != NULL);
	ft_application_schedule_save (self);
}

static void
ft_application_on_event (FtApplication* self,
                         FtEvent* event)
{
	FtLogger* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (event != NULL);
	_tmp0_ = self->priv->logger;
	ft_logger_log_event (_tmp0_, event);
}

static void
ft_application_on_shortcut_activated (FtApplication* self,
                                      const gchar* shortcut_name)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (shortcut_name != NULL);
	ft_application_activate_prefixed_action (self, shortcut_name, NULL);
}

static void
ft_application_real_dispose (GObject* base)
{
	FtApplication * self;
	self = (FtApplication*) base;
	_vala_assert (self->priv->save_idle_id == ((guint) 0), "this.save_idle_id == 0");
	G_OBJECT_CLASS (ft_application_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_application_get_type (), AdwApplication));
}

gboolean
ft_application_get_ready (FtApplication* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_ready;
	return result;
}

static void
ft_application_set_ready (FtApplication* self,
                          gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_ready != value) {
		self->priv->_ready = value;
		g_object_notify ((GObject*) self, "ready");
	}
}

static gpointer
_g_variant_ref0 (gpointer self)
{
	return self ? g_variant_ref (self) : NULL;
}

static FtApplicationOption*
ft_application_option_new (const gchar* long_name,
                           gchar short_name,
                           const gchar* description,
                           GOptionArg arg_type,
                           const gchar* arg_description,
                           const gchar* action_name,
                           GVariant* action_parameter,
                           gboolean is_exclusive,
                           gint order)
{
	FtApplicationOption* self;
	gchar** parts = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint parts_length1;
	gint _parts_size_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GVariant* _tmp14_;
	g_return_val_if_fail (long_name != NULL, NULL);
	g_return_val_if_fail (description != NULL, NULL);
	self = g_slice_new0 (FtApplicationOption);
	ft_application_option_instance_init (self);
	_tmp1_ = _tmp0_ = g_strsplit (long_name, ".", 2);
	parts = _tmp1_;
	parts_length1 = _vala_array_length (_tmp0_);
	_parts_size_ = parts_length1;
	_tmp2_ = parts;
	_tmp2__length1 = parts_length1;
	if (_tmp2__length1 > 1) {
		gchar** _tmp3_;
		gint _tmp3__length1;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar** _tmp6_;
		gint _tmp6__length1;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp3_ = parts;
		_tmp3__length1 = parts_length1;
		_tmp4_ = _tmp3_[0];
		_tmp5_ = g_strdup (_tmp4_);
		_g_free0 (self->group);
		self->group = _tmp5_;
		_tmp6_ = parts;
		_tmp6__length1 = parts_length1;
		_tmp7_ = _tmp6_[1];
		_tmp8_ = g_strdup (_tmp7_);
		_g_free0 (self->long_name);
		self->long_name = _tmp8_;
	} else {
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp9_ = g_strdup ("main");
		_g_free0 (self->group);
		self->group = _tmp9_;
		_tmp10_ = g_strdup (long_name);
		_g_free0 (self->long_name);
		self->long_name = _tmp10_;
	}
	self->short_name = short_name;
	_tmp11_ = g_strdup (description);
	_g_free0 (self->description);
	self->description = _tmp11_;
	_tmp12_ = g_strdup (arg_description);
	_g_free0 (self->arg_description);
	self->arg_description = _tmp12_;
	self->arg_type = arg_type;
	_tmp13_ = g_strdup (action_name);
	_g_free0 (self->action_name);
	self->action_name = _tmp13_;
	_tmp14_ = _g_variant_ref0 (action_parameter);
	_g_variant_unref0 (self->action_parameter);
	self->action_parameter = _tmp14_;
	self->is_exclusive = is_exclusive;
	self->order = order;
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	return self;
}

static void*
ft_application_option_get_arg_data (FtApplicationOption* self)
{
	void* result;
	g_return_val_if_fail (self != NULL, NULL);
	switch (self->arg_type) {
		case G_OPTION_ARG_NONE:
		{
			result = (void*) (&self->bool_value);
			return result;
		}
		case G_OPTION_ARG_INT:
		{
			result = (void*) (&self->int_value);
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

static gboolean
ft_application_option_is_set (FtApplicationOption* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	switch (self->arg_type) {
		case G_OPTION_ARG_NONE:
		{
			result = self->bool_value;
			return result;
		}
		case G_OPTION_ARG_INT:
		{
			result = self->int_value > 0;
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

static GVariant*
ft_application_option_get_value (FtApplicationOption* self)
{
	GVariant* result;
	g_return_val_if_fail (self != NULL, NULL);
	switch (self->arg_type) {
		case G_OPTION_ARG_NONE:
		{
			GVariant* _tmp0_;
			_tmp0_ = g_variant_new_boolean (TRUE);
			g_variant_ref_sink (_tmp0_);
			result = _tmp0_;
			return result;
		}
		case G_OPTION_ARG_INT:
		{
			GVariant* _tmp1_;
			_tmp1_ = g_variant_new_int32 ((gint32) self->int_value);
			g_variant_ref_sink (_tmp1_);
			result = _tmp1_;
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

static GVariant*
ft_application_option_get_action_parameter (FtApplicationOption* self,
                                            GVariant* value)
{
	GVariant* _tmp0_ = NULL;
	GVariant* _tmp2_;
	GVariant* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (self->arg_type != G_OPTION_ARG_NONE) {
		_tmp0_ = value;
	} else {
		GVariant* _tmp1_;
		_tmp1_ = self->action_parameter;
		_tmp0_ = _tmp1_;
	}
	_tmp2_ = _g_variant_ref0 (_tmp0_);
	result = _tmp2_;
	return result;
}

static void
ft_application_option_instance_init (FtApplicationOption * self)
{
}

static void
ft_application_option_free (FtApplicationOption * self)
{
	_g_free0 (self->long_name);
	_g_free0 (self->description);
	_g_free0 (self->arg_description);
	_g_free0 (self->group);
	_g_free0 (self->action_name);
	_g_variant_unref0 (self->action_parameter);
	g_slice_free (FtApplicationOption, self);
}

static gpointer
_g_option_group_ref0 (gpointer self)
{
	return self ? g_option_group_ref (self) : NULL;
}

static GObject *
ft_application_constructor (GType type,
                            guint n_construct_properties,
                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtApplication * self;
	GOptionGroup* timer_options = NULL;
	GOptionGroup* _tmp0_;
	GOptionGroup* _tmp1_;
	gint _tmp2_ = 0;
	GOptionEntry* _tmp3_;
	GOptionEntry* _tmp4_;
	gint _tmp4__length1;
	GOptionGroup* _tmp5_;
	GOptionGroup* _tmp6_;
	GOptionGroup* _tmp7_;
	gint _tmp8_ = 0;
	GOptionEntry* _tmp9_;
	GOptionEntry* _tmp10_;
	gint _tmp10__length1;
	gchar* _tmp11_;
	gchar* _tmp12_;
	parent_class = G_OBJECT_CLASS (ft_application_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_APPLICATION, FtApplication);
	_tmp0_ = g_option_group_new ("timer", _ ("Timer Options:"), _ ("Show options for controlling the timer"), NULL, NULL);
	timer_options = _tmp0_;
	_tmp1_ = timer_options;
	_tmp3_ = ft_application_get_option_entries ("timer", &_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp4__length1 = _tmp2_;
	g_option_group_add_entries (_tmp1_, _tmp4_);
	_tmp4_ = (g_free (_tmp4_), NULL);
	_tmp5_ = timer_options;
	g_option_group_set_translation_domain (_tmp5_, GETTEXT_PACKAGE);
	_tmp6_ = timer_options;
	_tmp7_ = _g_option_group_ref0 (_tmp6_);
	g_application_add_option_group ((GApplication*) self, _tmp7_);
	_tmp9_ = ft_application_get_option_entries ("main", &_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp10__length1 = _tmp8_;
	g_application_add_main_option_entries ((GApplication*) self, _tmp10_);
	_tmp10_ = (g_free (_tmp10_), NULL);
	_tmp11_ = g_strdup_printf (_ ("Bugs may be reported at: %s"), PACKAGE_ISSUE_URL);
	_tmp12_ = _tmp11_;
	g_application_set_option_context_description ((GApplication*) self, _tmp12_);
	_g_free0 (_tmp12_);
	_g_option_group_unref0 (timer_options);
	return obj;
}

static void
ft_application_class_init (FtApplicationClass * klass,
                           gpointer klass_data)
{
	FtApplicationOption* _tmp0_;
	FtApplicationOption* _tmp1_;
	GVariant* _tmp2_;
	GVariant* _tmp3_;
	FtApplicationOption* _tmp4_;
	GVariant* _tmp5_;
	GVariant* _tmp6_;
	FtApplicationOption* _tmp7_;
	GVariant* _tmp8_;
	GVariant* _tmp9_;
	FtApplicationOption* _tmp10_;
	GVariant* _tmp11_;
	GVariant* _tmp12_;
	FtApplicationOption* _tmp13_;
	FtApplicationOption* _tmp14_;
	FtApplicationOption* _tmp15_;
	FtApplicationOption* _tmp16_;
	FtApplicationOption* _tmp17_;
	FtApplicationOption* _tmp18_;
	FtApplicationOption* _tmp19_;
	FtApplicationOption* _tmp20_;
	FtApplicationOption* _tmp21_;
	FtApplicationOption* _tmp22_;
	FtApplicationOption* _tmp23_;
	FtApplicationOption* _tmp24_;
	FtApplicationOption* _tmp25_;
	FtApplicationOption** _tmp26_;
	ft_application_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtApplication_private_offset);
	((GApplicationClass *) klass)->startup = (void (*) (GApplication*)) ft_application_real_startup;
	((GApplicationClass *) klass)->handle_local_options = (gint (*) (GApplication*, GVariantDict*)) ft_application_real_handle_local_options;
	((GApplicationClass *) klass)->command_line = (gint (*) (GApplication*, GApplicationCommandLine*)) ft_application_real_command_line;
	((GApplicationClass *) klass)->activate = (void (*) (GApplication*)) ft_application_real_activate;
	((GApplicationClass *) klass)->shutdown = (void (*) (GApplication*)) ft_application_real_shutdown;
	((GApplicationClass *) klass)->dbus_register = (gboolean (*) (GApplication*, GDBusConnection*, const gchar*, GError**)) ft_application_real_dbus_register;
	((GApplicationClass *) klass)->dbus_unregister = (void (*) (GApplication*, GDBusConnection*, const gchar*)) ft_application_real_dbus_unregister;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) ft_application_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_application_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_application_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_application_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_application_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_APPLICATION_READY_PROPERTY, ft_application_properties[FT_APPLICATION_READY_PROPERTY] = g_param_spec_boolean ("ready", "ready", "ready", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
	_tmp0_ = ft_application_option_new ("timer.start-stop", '\0', N_ ("Start or Stop"), G_OPTION_ARG_NONE, NULL, "timer.start-stop", NULL, TRUE, 0);
	_tmp1_ = ft_application_option_new ("timer.start-pause-resume", '\0', N_ ("Start, Pause or Resume"), G_OPTION_ARG_NONE, NULL, "timer.start-pause-resume", NULL, TRUE, 0);
	_tmp2_ = g_variant_new_string ("pomodoro");
	g_variant_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	_tmp4_ = ft_application_option_new ("timer.start-pomodoro", '\0', N_ ("Start Pomodoro"), G_OPTION_ARG_NONE, NULL, "session-manager.state", _tmp3_, TRUE, 0);
	_tmp5_ = g_variant_new_string ("break");
	g_variant_ref_sink (_tmp5_);
	_tmp6_ = _tmp5_;
	_tmp7_ = ft_application_option_new ("timer.start-break", '\0', N_ ("Start break"), G_OPTION_ARG_NONE, NULL, "session-manager.state", _tmp6_, TRUE, 0);
	_tmp8_ = g_variant_new_string ("short-break");
	g_variant_ref_sink (_tmp8_);
	_tmp9_ = _tmp8_;
	_tmp10_ = ft_application_option_new ("timer.start-short-break", '\0', N_ ("Start short break"), G_OPTION_ARG_NONE, NULL, "session-manager.state", _tmp9_, TRUE, 0);
	_tmp11_ = g_variant_new_string ("long-break");
	g_variant_ref_sink (_tmp11_);
	_tmp12_ = _tmp11_;
	_tmp13_ = ft_application_option_new ("timer.start-long-break", '\0', N_ ("Start long break"), G_OPTION_ARG_NONE, NULL, "session-manager.state", _tmp12_, TRUE, 0);
	_tmp14_ = ft_application_option_new ("timer.start", '\0', N_ ("Start"), G_OPTION_ARG_NONE, NULL, "timer.start", NULL, TRUE, 0);
	_tmp15_ = ft_application_option_new ("timer.stop", '\0', N_ ("Stop"), G_OPTION_ARG_NONE, NULL, "timer.reset", NULL, TRUE, 0);
	_tmp16_ = ft_application_option_new ("timer.pause", '\0', N_ ("Pause"), G_OPTION_ARG_NONE, NULL, "timer.pause", NULL, TRUE, 0);
	_tmp17_ = ft_application_option_new ("timer.resume", '\0', N_ ("Resume"), G_OPTION_ARG_NONE, NULL, "timer.resume", NULL, TRUE, 0);
	_tmp18_ = ft_application_option_new ("timer.skip", '\0', N_ ("Skip"), G_OPTION_ARG_NONE, NULL, "session-manager.advance", NULL, TRUE, 0);
	_tmp19_ = ft_application_option_new ("timer.rewind", '\0', N_ ("Rewind"), G_OPTION_ARG_INT, N_ ("SECONDS"), "timer.rewind-by", NULL, TRUE, 0);
	_tmp20_ = ft_application_option_new ("timer.extend", '\0', N_ ("Extend current pomodoro or break"), G_OPTION_ARG_INT, N_ ("SECONDS"), "timer.extend-by", NULL, TRUE, 0);
	_tmp21_ = ft_application_option_new ("timer.reset", '\0', N_ ("Reset"), G_OPTION_ARG_NONE, NULL, "session-manager.reset", NULL, FALSE, -1);
	_tmp22_ = ft_application_option_new ("timer.status", 's', N_ ("Print timer status"), G_OPTION_ARG_NONE, NULL, NULL, NULL, FALSE, 1);
	_tmp23_ = ft_application_option_new ("preferences", '\0', N_ ("Show preferences"), G_OPTION_ARG_NONE, NULL, NULL, NULL, FALSE, 1);
	_tmp24_ = ft_application_option_new ("quit", 'q', N_ ("Quit application"), G_OPTION_ARG_NONE, NULL, "app.quit", NULL, TRUE, 0);
	_tmp25_ = ft_application_option_new ("version", 'v', N_ ("Print version information and exit"), G_OPTION_ARG_NONE, NULL, NULL, NULL, TRUE, 0);
	_tmp26_ = g_new0 (FtApplicationOption*, 18 + 1);
	_tmp26_[0] = _tmp0_;
	_tmp26_[1] = _tmp1_;
	_tmp26_[2] = _tmp4_;
	_tmp26_[3] = _tmp7_;
	_tmp26_[4] = _tmp10_;
	_tmp26_[5] = _tmp13_;
	_tmp26_[6] = _tmp14_;
	_tmp26_[7] = _tmp15_;
	_tmp26_[8] = _tmp16_;
	_tmp26_[9] = _tmp17_;
	_tmp26_[10] = _tmp18_;
	_tmp26_[11] = _tmp19_;
	_tmp26_[12] = _tmp20_;
	_tmp26_[13] = _tmp21_;
	_tmp26_[14] = _tmp22_;
	_tmp26_[15] = _tmp23_;
	_tmp26_[16] = _tmp24_;
	_tmp26_[17] = _tmp25_;
	ft_application_OPTIONS = (_vala_array_free (ft_application_OPTIONS, ft_application_OPTIONS_length1, (GDestroyNotify) ft_application_option_free), NULL);
	ft_application_OPTIONS = _tmp26_;
	ft_application_OPTIONS_length1 = 18;
	_ft_application_OPTIONS_size_ = ft_application_OPTIONS_length1;
	_g_variant_unref0 (_tmp12_);
	_g_variant_unref0 (_tmp9_);
	_g_variant_unref0 (_tmp6_);
	_g_variant_unref0 (_tmp3_);
}

static void
ft_application_instance_init (FtApplication * self,
                              gpointer klass)
{
	self->priv = ft_application_get_instance_private (self);
	self->priv->save_idle_id = (guint) 0;
	self->priv->service_hold_id = 0U;
	self->priv->command_line_options = NULL;
	self->priv->preferences_requested = FALSE;
	self->priv->_ready = FALSE;
}

static void
ft_application_finalize (GObject * obj)
{
	FtApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_APPLICATION, FtApplication);
	_g_object_unref0 (self->timer);
	_g_object_unref0 (self->session_manager);
	_g_object_unref0 (self->priv->keyboard_manager);
	_g_object_unref0 (self->priv->stats_manager);
	_g_object_unref0 (self->priv->event_producer);
	_g_object_unref0 (self->priv->event_bus);
	_g_object_unref0 (self->priv->job_queue);
	_g_object_unref0 (self->priv->action_manager);
	_g_object_unref0 (self->priv->notification_manager);
	_g_object_unref0 (self->priv->screen_overlay_manager);
	_g_object_unref0 (self->priv->background_manager);
	_g_object_unref0 (self->priv->sound_manager);
	_g_object_unref0 (self->priv->screensaver);
	_g_object_unref0 (self->priv->indicator);
	_g_object_unref0 (self->priv->logger);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->extensions);
	_g_object_unref0 (self->priv->dbus_service);
	_g_object_unref0 (self->priv->timer_dbus_service);
	_g_object_unref0 (self->priv->session_dbus_service);
	_g_variant_dict_unref0 (self->priv->command_line_options);
	G_OBJECT_CLASS (ft_application_parent_class)->finalize (obj);
}

static GType
ft_application_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtApplicationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_application_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtApplication), 0, (GInstanceInitFunc) ft_application_instance_init, NULL };
	GType ft_application_type_id;
	ft_application_type_id = g_type_register_static (adw_application_get_type (), "FtApplication", &g_define_type_info, 0);
	FtApplication_private_offset = g_type_add_instance_private (ft_application_type_id, sizeof (FtApplicationPrivate));
	return ft_application_type_id;
}

GType
ft_application_get_type (void)
{
	static volatile gsize ft_application_type_id__once = 0;
	if (g_once_init_enter (&ft_application_type_id__once)) {
		GType ft_application_type_id;
		ft_application_type_id = ft_application_get_type_once ();
		g_once_init_leave (&ft_application_type_id__once, ft_application_type_id);
	}
	return ft_application_type_id__once;
}

static void
_vala_ft_application_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	FtApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_APPLICATION, FtApplication);
	switch (property_id) {
		case FT_APPLICATION_READY_PROPERTY:
		g_value_set_boolean (value, ft_application_get_ready (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_application_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec)
{
	FtApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_APPLICATION, FtApplication);
	switch (property_id) {
		case FT_APPLICATION_READY_PROPERTY:
		ft_application_set_ready (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

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;
}

