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

/* main.vala
 *
 * Copyright 2020 Dylan McCall <dylan@dylanmccall.ca>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#define _GNU_SOURCE

#include "daemon.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <signal.h>
#include <gio/gio.h>

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

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

VALA_EXTERN BreakTimerDaemonApplication* break_timer_daemon_application;
BreakTimerDaemonApplication* break_timer_daemon_application = NULL;

static gint break_timer_daemon_main (gchar** args,
                              gint args_length1);
VALA_EXTERN void break_timer_daemon_sigint_cb (gint signal_number);
static void _break_timer_daemon_sigint_cb_sighandler_t (gint signal);

static void
_break_timer_daemon_sigint_cb_sighandler_t (gint signal)
{
	break_timer_daemon_sigint_cb (signal);
}

static gint
break_timer_daemon_main (gchar** args,
                         gint args_length1)
{
	BreakTimerDaemonApplication* _tmp0_;
	gint status = 0;
	BreakTimerDaemonApplication* _tmp1_;
	gint result;
	_tmp0_ = break_timer_daemon_application_new ();
	_g_object_unref0 (break_timer_daemon_application);
	break_timer_daemon_application = _tmp0_;
	signal ((gint) SIGINT, _break_timer_daemon_sigint_cb_sighandler_t);
	signal ((gint) SIGTERM, _break_timer_daemon_sigint_cb_sighandler_t);
	signal ((gint) SIGHUP, _break_timer_daemon_sigint_cb_sighandler_t);
	_tmp1_ = break_timer_daemon_application;
	status = g_application_run ((GApplication*) _tmp1_, (gint) args_length1, args);
	result = status;
	return result;
}

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

void
break_timer_daemon_sigint_cb (gint signal_number)
{
	BreakTimerDaemonApplication* _tmp0_;
	_tmp0_ = break_timer_daemon_application;
	g_application_quit ((GApplication*) _tmp0_);
}

