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

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

#define _GNU_SOURCE

#include <glib.h>
#include <signal.h>
#include "ft_ui.h"
#include <gio/gio.h>
#include "focus-timer.h"
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <glib/gi18n-lib.h>
#include <config.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

#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

VALA_EXTERN void on_posix_signal (gint signal);
static void _on_posix_signal_sighandler_t (gint signal);

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

void
on_posix_signal (gint signal)
{
	switch (signal) {
		case SIGINT:
		case SIGTERM:
		{
			FtApplication* application = NULL;
			FtApplication* _tmp0_;
			FtApplication* _tmp1_;
			FtApplication* _tmp2_;
			_tmp0_ = ft_application_get_default ();
			_tmp1_ = _g_object_ref0 (_tmp0_);
			application = _tmp1_;
			_tmp2_ = application;
			if (_tmp2_ != NULL) {
				FtApplication* _tmp3_;
				_tmp3_ = application;
				g_application_quit ((GApplication*) _tmp3_);
			}
			_g_object_unref0 (application);
			break;
		}
		default:
		{
			break;
		}
	}
}

static void
_on_posix_signal_sighandler_t (gint signal)
{
	on_posix_signal (signal);
}

static gint
_vala_main (gchar** args,
            gint args_length1)
{
	FtApplication* application = NULL;
	FtApplication* _tmp0_;
	gint result;
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	g_set_application_name (_ ("Focus Timer"));
	g_set_prgname (APPLICATION_ID);
	signal ((gint) SIGINT, _on_posix_signal_sighandler_t);
	signal ((gint) SIGTERM, _on_posix_signal_sighandler_t);
	_tmp0_ = ft_application_new ();
	application = _tmp0_;
	result = g_application_run ((GApplication*) application, (gint) args_length1, args);
	_g_object_unref0 (application);
	return result;
}

int
main (int argc,
      char ** argv)
{
	return _vala_main (argv, argc);
}

