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

/*
 * Copyright (C) 2013  Paolo Borelli <pborelli@gnome.org>
 * Copyright (C) 2020  Bilal Elmoussaoui <bilal.elmoussaoui@gnome.org>
 *
 * 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 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.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 CLOCKS_TIMER_TYPE_SETUP_DIALOG (clocks_timer_setup_dialog_get_type ())
#define CLOCKS_TIMER_SETUP_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TIMER_TYPE_SETUP_DIALOG, ClocksTimerSetupDialog))
#define CLOCKS_TIMER_SETUP_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TIMER_TYPE_SETUP_DIALOG, ClocksTimerSetupDialogClass))
#define CLOCKS_TIMER_IS_SETUP_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TIMER_TYPE_SETUP_DIALOG))
#define CLOCKS_TIMER_IS_SETUP_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TIMER_TYPE_SETUP_DIALOG))
#define CLOCKS_TIMER_SETUP_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TIMER_TYPE_SETUP_DIALOG, ClocksTimerSetupDialogClass))

typedef struct _ClocksTimerSetupDialog ClocksTimerSetupDialog;
typedef struct _ClocksTimerSetupDialogClass ClocksTimerSetupDialogClass;
typedef struct _ClocksTimerSetupDialogPrivate ClocksTimerSetupDialogPrivate;

#define CLOCKS_TIMER_TYPE_SETUP (clocks_timer_setup_get_type ())
#define CLOCKS_TIMER_SETUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TIMER_TYPE_SETUP, ClocksTimerSetup))
#define CLOCKS_TIMER_SETUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TIMER_TYPE_SETUP, ClocksTimerSetupClass))
#define CLOCKS_TIMER_IS_SETUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TIMER_TYPE_SETUP))
#define CLOCKS_TIMER_IS_SETUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TIMER_TYPE_SETUP))
#define CLOCKS_TIMER_SETUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TIMER_TYPE_SETUP, ClocksTimerSetupClass))

typedef struct _ClocksTimerSetup ClocksTimerSetup;
typedef struct _ClocksTimerSetupClass ClocksTimerSetupClass;
enum  {
	CLOCKS_TIMER_SETUP_DIALOG_0_PROPERTY,
	CLOCKS_TIMER_SETUP_DIALOG_NUM_PROPERTIES
};
static GParamSpec* clocks_timer_setup_dialog_properties[CLOCKS_TIMER_SETUP_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	CLOCKS_TIMER_SETUP_DIALOG_DONE_SIGNAL,
	CLOCKS_TIMER_SETUP_DIALOG_NUM_SIGNALS
};
static guint clocks_timer_setup_dialog_signals[CLOCKS_TIMER_SETUP_DIALOG_NUM_SIGNALS] = {0};

struct _ClocksTimerSetupDialog {
	AdwDialog parent_instance;
	ClocksTimerSetupDialogPrivate * priv;
	ClocksTimerSetup* timer_setup;
};

struct _ClocksTimerSetupDialogClass {
	AdwDialogClass parent_class;
};

struct _ClocksTimerSetupDialogPrivate {
	GtkBox* timer_box;
	GtkButton* start_button;
};

static gint ClocksTimerSetupDialog_private_offset;
static gpointer clocks_timer_setup_dialog_parent_class = NULL;

VALA_EXTERN GType clocks_timer_setup_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksTimerSetupDialog, g_object_unref)
VALA_EXTERN GType clocks_timer_setup_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksTimerSetup, g_object_unref)
VALA_EXTERN ClocksTimerSetupDialog* clocks_timer_setup_dialog_new (void);
VALA_EXTERN ClocksTimerSetupDialog* clocks_timer_setup_dialog_construct (GType object_type);
VALA_EXTERN ClocksTimerSetup* clocks_timer_setup_new (void);
VALA_EXTERN ClocksTimerSetup* clocks_timer_setup_construct (GType object_type);
static void __lambda39_ (ClocksTimerSetupDialog* self,
                  gint duration);
static void ___lambda39__clocks_timer_setup_duration_changed (ClocksTimerSetup* _sender,
                                                       gint seconds,
                                                       gpointer self);
static void __lambda40_ (ClocksTimerSetupDialog* self);
static void ___lambda40__clocks_timer_setup_start_timer (ClocksTimerSetup* _sender,
                                                  gpointer self);
static void clocks_timer_setup_dialog_create_clicked (ClocksTimerSetupDialog* self);
static void _clocks_timer_setup_dialog_create_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                   gpointer self);
static void clocks_timer_setup_dialog_finalize (GObject * obj);
static GType clocks_timer_setup_dialog_get_type_once (void);

static inline gpointer
clocks_timer_setup_dialog_get_instance_private (ClocksTimerSetupDialog* self)
{
	return G_STRUCT_MEMBER_P (self, ClocksTimerSetupDialog_private_offset);
}

static void
__lambda39_ (ClocksTimerSetupDialog* self,
             gint duration)
{
	GtkButton* _tmp0_;
	_tmp0_ = self->priv->start_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, duration != 0);
}

static void
___lambda39__clocks_timer_setup_duration_changed (ClocksTimerSetup* _sender,
                                                  gint seconds,
                                                  gpointer self)
{
	__lambda39_ ((ClocksTimerSetupDialog*) self, seconds);
}

static void
__lambda40_ (ClocksTimerSetupDialog* self)
{
	g_signal_emit (self, clocks_timer_setup_dialog_signals[CLOCKS_TIMER_SETUP_DIALOG_DONE_SIGNAL], 0);
}

static void
___lambda40__clocks_timer_setup_start_timer (ClocksTimerSetup* _sender,
                                             gpointer self)
{
	__lambda40_ ((ClocksTimerSetupDialog*) self);
}

ClocksTimerSetupDialog*
clocks_timer_setup_dialog_construct (GType object_type)
{
	ClocksTimerSetupDialog * self = NULL;
	ClocksTimerSetup* _tmp0_;
	GtkBox* _tmp1_;
	ClocksTimerSetup* _tmp2_;
	ClocksTimerSetup* _tmp3_;
	ClocksTimerSetup* _tmp4_;
	self = (ClocksTimerSetupDialog*) g_object_new (object_type, NULL);
	_tmp0_ = clocks_timer_setup_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->timer_setup);
	self->timer_setup = _tmp0_;
	_tmp1_ = self->priv->timer_box;
	_tmp2_ = self->timer_setup;
	gtk_box_prepend (_tmp1_, (GtkWidget*) _tmp2_);
	_tmp3_ = self->timer_setup;
	g_signal_connect_object (_tmp3_, "duration-changed", (GCallback) ___lambda39__clocks_timer_setup_duration_changed, self, 0);
	_tmp4_ = self->timer_setup;
	g_signal_connect_object (_tmp4_, "start-timer", (GCallback) ___lambda40__clocks_timer_setup_start_timer, self, 0);
	return self;
}

ClocksTimerSetupDialog*
clocks_timer_setup_dialog_new (void)
{
	return clocks_timer_setup_dialog_construct (CLOCKS_TIMER_TYPE_SETUP_DIALOG);
}

static void
clocks_timer_setup_dialog_create_clicked (ClocksTimerSetupDialog* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, clocks_timer_setup_dialog_signals[CLOCKS_TIMER_SETUP_DIALOG_DONE_SIGNAL], 0);
}

static void
_clocks_timer_setup_dialog_create_clicked_gtk_button_clicked (GtkButton* _sender,
                                                              gpointer self)
{
	clocks_timer_setup_dialog_create_clicked ((ClocksTimerSetupDialog*) self);
}

static void
clocks_timer_setup_dialog_class_init (ClocksTimerSetupDialogClass * klass,
                                      gpointer klass_data)
{
	clocks_timer_setup_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ClocksTimerSetupDialog_private_offset);
	G_OBJECT_CLASS (klass)->finalize = clocks_timer_setup_dialog_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/clocks/ui/timer-setup-dialog.ui");
	clocks_timer_setup_dialog_signals[CLOCKS_TIMER_SETUP_DIALOG_DONE_SIGNAL] = g_signal_new ("done", CLOCKS_TIMER_TYPE_SETUP_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "timer_box", FALSE, ClocksTimerSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksTimerSetupDialogPrivate, timer_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "start_button", FALSE, ClocksTimerSetupDialog_private_offset + G_STRUCT_OFFSET (ClocksTimerSetupDialogPrivate, start_button));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "create_clicked", G_CALLBACK(_clocks_timer_setup_dialog_create_clicked_gtk_button_clicked));
}

static void
clocks_timer_setup_dialog_instance_init (ClocksTimerSetupDialog * self,
                                         gpointer klass)
{
	self->priv = clocks_timer_setup_dialog_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
clocks_timer_setup_dialog_finalize (GObject * obj)
{
	ClocksTimerSetupDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_TIMER_TYPE_SETUP_DIALOG, ClocksTimerSetupDialog);
	_g_object_unref0 (self->timer_setup);
	G_OBJECT_CLASS (clocks_timer_setup_dialog_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
clocks_timer_setup_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksTimerSetupDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_timer_setup_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksTimerSetupDialog), 0, (GInstanceInitFunc) clocks_timer_setup_dialog_instance_init, NULL };
	GType clocks_timer_setup_dialog_type_id;
	clocks_timer_setup_dialog_type_id = g_type_register_static (adw_dialog_get_type (), "ClocksTimerSetupDialog", &g_define_type_info, 0);
	ClocksTimerSetupDialog_private_offset = g_type_add_instance_private (clocks_timer_setup_dialog_type_id, sizeof (ClocksTimerSetupDialogPrivate));
	return clocks_timer_setup_dialog_type_id;
}

GType
clocks_timer_setup_dialog_get_type (void)
{
	static gsize clocks_timer_setup_dialog_type_id__once = 0;
	if (g_once_init_enter (&clocks_timer_setup_dialog_type_id__once)) {
		GType clocks_timer_setup_dialog_type_id;
		clocks_timer_setup_dialog_type_id = clocks_timer_setup_dialog_get_type_once ();
		g_once_init_leave (&clocks_timer_setup_dialog_type_id__once, clocks_timer_setup_dialog_type_id);
	}
	return clocks_timer_setup_dialog_type_id__once;
}

