/* window.c generated by valac 0.20.1-dirty, the Vala compiler
 * generated from window.vala, do not modify */

/*
 * Copyright (C) 2013  Paolo Borelli <pborelli@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 <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <libgd/gd.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include "config.h"


#define CLOCKS_TYPE_WINDOW (clocks_window_get_type ())
#define CLOCKS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_WINDOW, ClocksWindow))
#define CLOCKS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_WINDOW, ClocksWindowClass))
#define CLOCKS_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_WINDOW))
#define CLOCKS_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_WINDOW))
#define CLOCKS_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_WINDOW, ClocksWindowClass))

typedef struct _ClocksWindow ClocksWindow;
typedef struct _ClocksWindowClass ClocksWindowClass;
typedef struct _ClocksWindowPrivate ClocksWindowPrivate;

#define CLOCKS_TYPE_HEADER_BAR (clocks_header_bar_get_type ())
#define CLOCKS_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_HEADER_BAR, ClocksHeaderBar))
#define CLOCKS_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_HEADER_BAR, ClocksHeaderBarClass))
#define CLOCKS_IS_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_HEADER_BAR))
#define CLOCKS_IS_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_HEADER_BAR))
#define CLOCKS_HEADER_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_HEADER_BAR, ClocksHeaderBarClass))

typedef struct _ClocksHeaderBar ClocksHeaderBar;
typedef struct _ClocksHeaderBarClass ClocksHeaderBarClass;

#define CLOCKS_WORLD_TYPE_MAIN_PANEL (clocks_world_main_panel_get_type ())
#define CLOCKS_WORLD_MAIN_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_WORLD_TYPE_MAIN_PANEL, ClocksWorldMainPanel))
#define CLOCKS_WORLD_MAIN_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_WORLD_TYPE_MAIN_PANEL, ClocksWorldMainPanelClass))
#define CLOCKS_WORLD_IS_MAIN_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_WORLD_TYPE_MAIN_PANEL))
#define CLOCKS_WORLD_IS_MAIN_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_WORLD_TYPE_MAIN_PANEL))
#define CLOCKS_WORLD_MAIN_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_WORLD_TYPE_MAIN_PANEL, ClocksWorldMainPanelClass))

typedef struct _ClocksWorldMainPanel ClocksWorldMainPanel;
typedef struct _ClocksWorldMainPanelClass ClocksWorldMainPanelClass;

#define CLOCKS_ALARM_TYPE_MAIN_PANEL (clocks_alarm_main_panel_get_type ())
#define CLOCKS_ALARM_MAIN_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_ALARM_TYPE_MAIN_PANEL, ClocksAlarmMainPanel))
#define CLOCKS_ALARM_MAIN_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_ALARM_TYPE_MAIN_PANEL, ClocksAlarmMainPanelClass))
#define CLOCKS_ALARM_IS_MAIN_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_ALARM_TYPE_MAIN_PANEL))
#define CLOCKS_ALARM_IS_MAIN_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_ALARM_TYPE_MAIN_PANEL))
#define CLOCKS_ALARM_MAIN_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_ALARM_TYPE_MAIN_PANEL, ClocksAlarmMainPanelClass))

typedef struct _ClocksAlarmMainPanel ClocksAlarmMainPanel;
typedef struct _ClocksAlarmMainPanelClass ClocksAlarmMainPanelClass;

#define CLOCKS_STOPWATCH_TYPE_MAIN_PANEL (clocks_stopwatch_main_panel_get_type ())
#define CLOCKS_STOPWATCH_MAIN_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_STOPWATCH_TYPE_MAIN_PANEL, ClocksStopwatchMainPanel))
#define CLOCKS_STOPWATCH_MAIN_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_STOPWATCH_TYPE_MAIN_PANEL, ClocksStopwatchMainPanelClass))
#define CLOCKS_STOPWATCH_IS_MAIN_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_STOPWATCH_TYPE_MAIN_PANEL))
#define CLOCKS_STOPWATCH_IS_MAIN_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_STOPWATCH_TYPE_MAIN_PANEL))
#define CLOCKS_STOPWATCH_MAIN_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_STOPWATCH_TYPE_MAIN_PANEL, ClocksStopwatchMainPanelClass))

typedef struct _ClocksStopwatchMainPanel ClocksStopwatchMainPanel;
typedef struct _ClocksStopwatchMainPanelClass ClocksStopwatchMainPanelClass;

#define CLOCKS_TIMER_TYPE_MAIN_PANEL (clocks_timer_main_panel_get_type ())
#define CLOCKS_TIMER_MAIN_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TIMER_TYPE_MAIN_PANEL, ClocksTimerMainPanel))
#define CLOCKS_TIMER_MAIN_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TIMER_TYPE_MAIN_PANEL, ClocksTimerMainPanelClass))
#define CLOCKS_TIMER_IS_MAIN_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TIMER_TYPE_MAIN_PANEL))
#define CLOCKS_TIMER_IS_MAIN_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TIMER_TYPE_MAIN_PANEL))
#define CLOCKS_TIMER_MAIN_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TIMER_TYPE_MAIN_PANEL, ClocksTimerMainPanelClass))

typedef struct _ClocksTimerMainPanel ClocksTimerMainPanel;
typedef struct _ClocksTimerMainPanelClass ClocksTimerMainPanelClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define CLOCKS_TYPE_APPLICATION (clocks_application_get_type ())
#define CLOCKS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_APPLICATION, ClocksApplication))
#define CLOCKS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_APPLICATION, ClocksApplicationClass))
#define CLOCKS_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_APPLICATION))
#define CLOCKS_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_APPLICATION))
#define CLOCKS_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_APPLICATION, ClocksApplicationClass))

typedef struct _ClocksApplication ClocksApplication;
typedef struct _ClocksApplicationClass ClocksApplicationClass;
typedef struct _Block1Data Block1Data;

#define CLOCKS_TYPE_CLOCK (clocks_clock_get_type ())
#define CLOCKS_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_CLOCK, ClocksClock))
#define CLOCKS_IS_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_CLOCK))
#define CLOCKS_CLOCK_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLOCKS_TYPE_CLOCK, ClocksClockIface))

typedef struct _ClocksClock ClocksClock;
typedef struct _ClocksClockIface ClocksClockIface;

struct _ClocksWindow {
	GtkApplicationWindow parent_instance;
	ClocksWindowPrivate * priv;
};

struct _ClocksWindowClass {
	GtkApplicationWindowClass parent_class;
};

struct _ClocksWindowPrivate {
	ClocksHeaderBar* header_bar;
	GdStack* stack;
	ClocksWorldMainPanel* world;
	ClocksAlarmMainPanel* alarm;
	ClocksStopwatchMainPanel* stopwatch;
	ClocksTimerMainPanel* timer;
};

struct _Block1Data {
	int _ref_count_;
	ClocksWindow * self;
	gulong stack_id;
	gulong header_bar_id;
};

struct _ClocksClockIface {
	GTypeInterface parent_iface;
	void (*activate_new) (ClocksClock* self);
	void (*activate_select_all) (ClocksClock* self);
	void (*activate_select_none) (ClocksClock* self);
	gboolean (*escape_pressed) (ClocksClock* self);
	void (*update_header_bar) (ClocksClock* self);
	const gchar* (*get_label) (ClocksClock* self);
	void (*set_label) (ClocksClock* self, const gchar* value);
	ClocksHeaderBar* (*get_header_bar) (ClocksClock* self);
	void (*set_header_bar) (ClocksClock* self, ClocksHeaderBar* value);
};


static gpointer clocks_window_parent_class = NULL;

GType clocks_window_get_type (void) G_GNUC_CONST;
GType clocks_header_bar_get_type (void) G_GNUC_CONST;
GType clocks_world_main_panel_get_type (void) G_GNUC_CONST;
GType clocks_alarm_main_panel_get_type (void) G_GNUC_CONST;
GType clocks_stopwatch_main_panel_get_type (void) G_GNUC_CONST;
GType clocks_timer_main_panel_get_type (void) G_GNUC_CONST;
#define CLOCKS_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CLOCKS_TYPE_WINDOW, ClocksWindowPrivate))
enum  {
	CLOCKS_WINDOW_DUMMY_PROPERTY
};
#define CLOCKS_WINDOW_DEFAULT_WIDTH 870
#define CLOCKS_WINDOW_DEFAULT_HEIGHT 680
static void clocks_window_on_new_activate (ClocksWindow* self);
static void _clocks_window_on_new_activate_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void clocks_window_on_about_activate (ClocksWindow* self);
static void _clocks_window_on_about_activate_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void clocks_window_on_select_all_activate (ClocksWindow* self);
static void _clocks_window_on_select_all_activate_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void clocks_window_on_select_none_activate (ClocksWindow* self);
static void _clocks_window_on_select_none_activate_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
GType clocks_application_get_type (void) G_GNUC_CONST;
ClocksWindow* clocks_window_new (ClocksApplication* app);
ClocksWindow* clocks_window_construct (GType object_type, ClocksApplication* app);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
GtkBuilder* clocks_utils_load_ui (const gchar* ui);
ClocksWorldMainPanel* clocks_world_main_panel_new (ClocksHeaderBar* header_bar);
ClocksWorldMainPanel* clocks_world_main_panel_construct (GType object_type, ClocksHeaderBar* header_bar);
ClocksAlarmMainPanel* clocks_alarm_main_panel_new (ClocksHeaderBar* header_bar);
ClocksAlarmMainPanel* clocks_alarm_main_panel_construct (GType object_type, ClocksHeaderBar* header_bar);
ClocksStopwatchMainPanel* clocks_stopwatch_main_panel_new (ClocksHeaderBar* header_bar);
ClocksStopwatchMainPanel* clocks_stopwatch_main_panel_construct (GType object_type, ClocksHeaderBar* header_bar);
ClocksTimerMainPanel* clocks_timer_main_panel_new (ClocksHeaderBar* header_bar);
ClocksTimerMainPanel* clocks_timer_main_panel_construct (GType object_type, ClocksHeaderBar* header_bar);
GType clocks_clock_get_type (void) G_GNUC_CONST;
const gchar* clocks_clock_get_label (ClocksClock* self);
void clocks_header_bar_set_stack (ClocksHeaderBar* self, GdStack* stack);
static void __lambda49_ (ClocksWindow* self);
static void clocks_window_update_header_bar (ClocksWindow* self);
static void ___lambda49__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void __lambda50_ (ClocksWindow* self);
static void ___lambda50__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void __lambda51_ (Block1Data* _data1_);
static void ___lambda51__gtk_widget_destroy (GtkWidget* _sender, gpointer self);
static void __lambda52_ (ClocksWindow* self, ClocksAlarmMainPanel* w);
static void ___lambda52__clocks_alarm_main_panel_ring (ClocksAlarmMainPanel* _sender, gpointer self);
static void __lambda53_ (ClocksWindow* self, ClocksTimerMainPanel* w);
static void ___lambda53__clocks_timer_main_panel_ring (ClocksTimerMainPanel* _sender, gpointer self);
void clocks_clock_activate_new (ClocksClock* self);
void clocks_clock_activate_select_all (ClocksClock* self);
void clocks_clock_activate_select_none (ClocksClock* self);
static gboolean clocks_window_real_key_press_event (GtkWidget* base, GdkEventKey* event);
gboolean clocks_clock_escape_pressed (ClocksClock* self);
void clocks_header_bar_clear (ClocksHeaderBar* self);
void clocks_clock_update_header_bar (ClocksClock* self);
static void clocks_window_finalize (GObject* obj);

static const GActionEntry CLOCKS_WINDOW_action_entries[4] = {{"new", _clocks_window_on_new_activate_gsimple_action_activate_callback}, {"about", _clocks_window_on_about_activate_gsimple_action_activate_callback}, {"select-all", _clocks_window_on_select_all_activate_gsimple_action_activate_callback}, {"select-none", _clocks_window_on_select_none_activate_gsimple_action_activate_callback}};

static void _clocks_window_on_new_activate_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	clocks_window_on_new_activate (self);
}


static void _clocks_window_on_about_activate_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	clocks_window_on_about_activate (self);
}


static void _clocks_window_on_select_all_activate_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	clocks_window_on_select_all_activate (self);
}


static void _clocks_window_on_select_none_activate_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	clocks_window_on_select_none_activate (self);
}


static Block1Data* block1_data_ref (Block1Data* _data1_) {
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}


static void block1_data_unref (void * _userdata_) {
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		ClocksWindow * self;
		self = _data1_->self;
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}


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


static void __lambda49_ (ClocksWindow* self) {
	clocks_window_update_header_bar (self);
}


static void ___lambda49__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	__lambda49_ (self);
}


static void __lambda50_ (ClocksWindow* self) {
	clocks_window_update_header_bar (self);
}


static void ___lambda50__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	__lambda50_ (self);
}


static void __lambda51_ (Block1Data* _data1_) {
	ClocksWindow * self;
	ClocksHeaderBar* _tmp0_;
	GdStack* _tmp1_;
	self = _data1_->self;
	_tmp0_ = self->priv->header_bar;
	g_signal_handler_disconnect ((GObject*) _tmp0_, _data1_->header_bar_id);
	_data1_->header_bar_id = (gulong) 0;
	_tmp1_ = self->priv->stack;
	g_signal_handler_disconnect ((GObject*) _tmp1_, _data1_->stack_id);
	_data1_->stack_id = (gulong) 0;
}


static void ___lambda51__gtk_widget_destroy (GtkWidget* _sender, gpointer self) {
	__lambda51_ (self);
}


static void __lambda52_ (ClocksWindow* self, ClocksAlarmMainPanel* w) {
	GdStack* _tmp0_;
	ClocksAlarmMainPanel* _tmp1_;
	g_return_if_fail (w != NULL);
	_tmp0_ = self->priv->stack;
	_tmp1_ = w;
	gd_stack_set_visible_child (_tmp0_, (GtkWidget*) _tmp1_);
}


static void ___lambda52__clocks_alarm_main_panel_ring (ClocksAlarmMainPanel* _sender, gpointer self) {
	__lambda52_ (self, _sender);
}


static void __lambda53_ (ClocksWindow* self, ClocksTimerMainPanel* w) {
	GdStack* _tmp0_;
	ClocksTimerMainPanel* _tmp1_;
	g_return_if_fail (w != NULL);
	_tmp0_ = self->priv->stack;
	_tmp1_ = w;
	gd_stack_set_visible_child (_tmp0_, (GtkWidget*) _tmp1_);
}


static void ___lambda53__clocks_timer_main_panel_ring (ClocksTimerMainPanel* _sender, gpointer self) {
	__lambda53_ (self, _sender);
}


ClocksWindow* clocks_window_construct (GType object_type, ClocksApplication* app) {
	ClocksWindow * self = NULL;
	Block1Data* _data1_;
	ClocksApplication* _tmp0_;
	const gchar* _tmp1_ = NULL;
	GtkBuilder* _tmp2_ = NULL;
	GtkBuilder* builder;
	GObject* _tmp3_ = NULL;
	GtkWidget* _tmp4_;
	GtkWidget* main_panel;
	GObject* _tmp5_ = NULL;
	ClocksHeaderBar* _tmp6_;
	GObject* _tmp7_ = NULL;
	GdStack* _tmp8_;
	ClocksHeaderBar* _tmp9_;
	ClocksWorldMainPanel* _tmp10_;
	ClocksHeaderBar* _tmp11_;
	ClocksAlarmMainPanel* _tmp12_;
	ClocksHeaderBar* _tmp13_;
	ClocksStopwatchMainPanel* _tmp14_;
	ClocksHeaderBar* _tmp15_;
	ClocksTimerMainPanel* _tmp16_;
	GdStack* _tmp17_;
	ClocksWorldMainPanel* _tmp18_;
	ClocksWorldMainPanel* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	ClocksWorldMainPanel* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	GdStack* _tmp25_;
	ClocksAlarmMainPanel* _tmp26_;
	ClocksAlarmMainPanel* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	ClocksAlarmMainPanel* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	GdStack* _tmp33_;
	ClocksStopwatchMainPanel* _tmp34_;
	ClocksStopwatchMainPanel* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	ClocksStopwatchMainPanel* _tmp38_;
	const gchar* _tmp39_;
	const gchar* _tmp40_;
	GdStack* _tmp41_;
	ClocksTimerMainPanel* _tmp42_;
	ClocksTimerMainPanel* _tmp43_;
	const gchar* _tmp44_;
	const gchar* _tmp45_;
	ClocksTimerMainPanel* _tmp46_;
	const gchar* _tmp47_;
	const gchar* _tmp48_;
	ClocksHeaderBar* _tmp49_;
	GdStack* _tmp50_;
	GdStack* _tmp51_;
	gulong _tmp52_ = 0UL;
	ClocksHeaderBar* _tmp53_;
	gulong _tmp54_ = 0UL;
	GdStack* _tmp55_;
	ClocksAlarmMainPanel* _tmp56_;
	ClocksTimerMainPanel* _tmp57_;
	GdStack* _tmp58_;
	ClocksWorldMainPanel* _tmp59_;
	g_return_val_if_fail (app != NULL, NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_tmp0_ = app;
	_tmp1_ = _ ("Clocks");
	self = (ClocksWindow*) g_object_new (object_type, "application", _tmp0_, "title", _tmp1_, NULL);
	_data1_->self = g_object_ref (self);
	gtk_window_set_hide_titlebar_when_maximized ((GtkWindow*) self, TRUE);
	g_action_map_add_action_entries ((GActionMap*) self, (const GActionEntry*) CLOCKS_WINDOW_action_entries, G_N_ELEMENTS (CLOCKS_WINDOW_action_entries), self);
	gtk_widget_set_size_request ((GtkWidget*) self, CLOCKS_WINDOW_DEFAULT_WIDTH, CLOCKS_WINDOW_DEFAULT_HEIGHT);
	_tmp2_ = clocks_utils_load_ui ("window.ui");
	builder = _tmp2_;
	_tmp3_ = gtk_builder_get_object (builder, "main_panel");
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, GTK_TYPE_WIDGET) ? ((GtkWidget*) _tmp3_) : NULL);
	main_panel = _tmp4_;
	_tmp5_ = gtk_builder_get_object (builder, "header_bar");
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, CLOCKS_TYPE_HEADER_BAR) ? ((ClocksHeaderBar*) _tmp5_) : NULL);
	_g_object_unref0 (self->priv->header_bar);
	self->priv->header_bar = _tmp6_;
	_tmp7_ = gtk_builder_get_object (builder, "stack");
	_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, gd_stack_get_type ()) ? ((GdStack*) _tmp7_) : NULL);
	_g_object_unref0 (self->priv->stack);
	self->priv->stack = _tmp8_;
	_tmp9_ = self->priv->header_bar;
	_tmp10_ = clocks_world_main_panel_new (_tmp9_);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->world);
	self->priv->world = _tmp10_;
	_tmp11_ = self->priv->header_bar;
	_tmp12_ = clocks_alarm_main_panel_new (_tmp11_);
	g_object_ref_sink (_tmp12_);
	_g_object_unref0 (self->priv->alarm);
	self->priv->alarm = _tmp12_;
	_tmp13_ = self->priv->header_bar;
	_tmp14_ = clocks_stopwatch_main_panel_new (_tmp13_);
	g_object_ref_sink (_tmp14_);
	_g_object_unref0 (self->priv->stopwatch);
	self->priv->stopwatch = _tmp14_;
	_tmp15_ = self->priv->header_bar;
	_tmp16_ = clocks_timer_main_panel_new (_tmp15_);
	g_object_ref_sink (_tmp16_);
	_g_object_unref0 (self->priv->timer);
	self->priv->timer = _tmp16_;
	_tmp17_ = self->priv->stack;
	_tmp18_ = self->priv->world;
	_tmp19_ = self->priv->world;
	_tmp20_ = clocks_clock_get_label ((ClocksClock*) _tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = self->priv->world;
	_tmp23_ = clocks_clock_get_label ((ClocksClock*) _tmp22_);
	_tmp24_ = _tmp23_;
	gd_stack_add_titled (_tmp17_, (GtkWidget*) _tmp18_, _tmp21_, _tmp24_);
	_tmp25_ = self->priv->stack;
	_tmp26_ = self->priv->alarm;
	_tmp27_ = self->priv->alarm;
	_tmp28_ = clocks_clock_get_label ((ClocksClock*) _tmp27_);
	_tmp29_ = _tmp28_;
	_tmp30_ = self->priv->alarm;
	_tmp31_ = clocks_clock_get_label ((ClocksClock*) _tmp30_);
	_tmp32_ = _tmp31_;
	gd_stack_add_titled (_tmp25_, (GtkWidget*) _tmp26_, _tmp29_, _tmp32_);
	_tmp33_ = self->priv->stack;
	_tmp34_ = self->priv->stopwatch;
	_tmp35_ = self->priv->stopwatch;
	_tmp36_ = clocks_clock_get_label ((ClocksClock*) _tmp35_);
	_tmp37_ = _tmp36_;
	_tmp38_ = self->priv->stopwatch;
	_tmp39_ = clocks_clock_get_label ((ClocksClock*) _tmp38_);
	_tmp40_ = _tmp39_;
	gd_stack_add_titled (_tmp33_, (GtkWidget*) _tmp34_, _tmp37_, _tmp40_);
	_tmp41_ = self->priv->stack;
	_tmp42_ = self->priv->timer;
	_tmp43_ = self->priv->timer;
	_tmp44_ = clocks_clock_get_label ((ClocksClock*) _tmp43_);
	_tmp45_ = _tmp44_;
	_tmp46_ = self->priv->timer;
	_tmp47_ = clocks_clock_get_label ((ClocksClock*) _tmp46_);
	_tmp48_ = _tmp47_;
	gd_stack_add_titled (_tmp41_, (GtkWidget*) _tmp42_, _tmp45_, _tmp48_);
	_tmp49_ = self->priv->header_bar;
	_tmp50_ = self->priv->stack;
	clocks_header_bar_set_stack (_tmp49_, _tmp50_);
	_tmp51_ = self->priv->stack;
	_tmp52_ = g_signal_connect_object ((GObject*) _tmp51_, "notify::visible-child", (GCallback) ___lambda49__g_object_notify, self, 0);
	_data1_->stack_id = _tmp52_;
	_tmp53_ = self->priv->header_bar;
	_tmp54_ = g_signal_connect_object ((GObject*) _tmp53_, "notify::mode", (GCallback) ___lambda50__g_object_notify, self, 0);
	_data1_->header_bar_id = _tmp54_;
	_tmp55_ = self->priv->stack;
	g_signal_connect_data ((GtkWidget*) _tmp55_, "destroy", (GCallback) ___lambda51__gtk_widget_destroy, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	_tmp56_ = self->priv->alarm;
	g_signal_connect_object (_tmp56_, "ring", (GCallback) ___lambda52__clocks_alarm_main_panel_ring, self, 0);
	_tmp57_ = self->priv->timer;
	g_signal_connect_object (_tmp57_, "ring", (GCallback) ___lambda53__clocks_timer_main_panel_ring, self, 0);
	_tmp58_ = self->priv->stack;
	_tmp59_ = self->priv->world;
	gd_stack_set_visible_child (_tmp58_, (GtkWidget*) _tmp59_);
	clocks_window_update_header_bar (self);
	gtk_container_add ((GtkContainer*) self, main_panel);
	gtk_widget_show_all ((GtkWidget*) self);
	_g_object_unref0 (main_panel);
	_g_object_unref0 (builder);
	block1_data_unref (_data1_);
	_data1_ = NULL;
	return self;
}


ClocksWindow* clocks_window_new (ClocksApplication* app) {
	return clocks_window_construct (CLOCKS_TYPE_WINDOW, app);
}


static void clocks_window_on_new_activate (ClocksWindow* self) {
	GdStack* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stack;
	_tmp1_ = gd_stack_get_visible_child (_tmp0_);
	_tmp2_ = _tmp1_;
	clocks_clock_activate_new (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, CLOCKS_TYPE_CLOCK, ClocksClock));
}


static void clocks_window_on_select_all_activate (ClocksWindow* self) {
	GdStack* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stack;
	_tmp1_ = gd_stack_get_visible_child (_tmp0_);
	_tmp2_ = _tmp1_;
	clocks_clock_activate_select_all (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, CLOCKS_TYPE_CLOCK, ClocksClock));
}


static void clocks_window_on_select_none_activate (ClocksWindow* self) {
	GdStack* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stack;
	_tmp1_ = gd_stack_get_visible_child (_tmp0_);
	_tmp2_ = _tmp1_;
	clocks_clock_activate_select_none (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, CLOCKS_TYPE_CLOCK, ClocksClock));
}


static gboolean clocks_window_real_key_press_event (GtkWidget* base, GdkEventKey* event) {
	ClocksWindow * self;
	gboolean result = FALSE;
	guint keyval = 0U;
	gboolean _tmp0_ = FALSE;
	guint _tmp1_ = 0U;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp4_;
	GdkEventKey _tmp9_;
	gboolean _tmp10_ = FALSE;
	self = (ClocksWindow*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp2_ = gdk_event_get_keyval ((GdkEvent*) (event), &_tmp1_);
	keyval = _tmp1_;
	if (_tmp2_) {
		guint _tmp3_;
		_tmp3_ = keyval;
		_tmp0_ = _tmp3_ == ((guint) GDK_KEY_Escape);
	} else {
		_tmp0_ = FALSE;
	}
	_tmp4_ = _tmp0_;
	if (_tmp4_) {
		GdStack* _tmp5_;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		gboolean _tmp8_ = FALSE;
		_tmp5_ = self->priv->stack;
		_tmp6_ = gd_stack_get_visible_child (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = clocks_clock_escape_pressed (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, CLOCKS_TYPE_CLOCK, ClocksClock));
		result = _tmp8_;
		return result;
	}
	_tmp9_ = *event;
	_tmp10_ = GTK_WIDGET_CLASS (clocks_window_parent_class)->key_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_APPLICATION_WINDOW, GtkApplicationWindow), &_tmp9_);
	result = _tmp10_;
	return result;
}


static void clocks_window_on_about_activate (ClocksWindow* self) {
	static const char copyright[] = "Copyright \xc2\xa9 2011 Collabora Ltd.\n" "Copyright \xc2\xa9 2012-2013 Collabora Ltd., Seif Lotfy, Emily Gonyer\n" "Eslam Mostafa, Paolo Borelli, Volker Sobek\n";
	static const gchar* authors[] = {"Alex Anthony", "Paolo Borelli", "Allan Day", "Piotr Drąg", "Emily Gonyer", "Maël Lavault", "Seif Lotfy", "William Jon McCann", "Eslam Mostafa", "Bastien Nocera", "Volker Sobek", "Jakub Steiner", NULL};
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = _ ("Gnome Clocks");
	_tmp1_ = _ ("Utilities to help you with the time.");
	_tmp2_ = _ ("translator-credits");
	gtk_show_about_dialog ((GtkWindow*) self, "program-name", _tmp0_, "logo-icon-name", "gnome-clocks", "version", VERSION, "comments", _tmp1_, "copyright", copyright, "authors", authors, "license-type", GTK_LICENSE_GPL_2_0, "wrap-license", FALSE, "translator-credits", _tmp2_, NULL, NULL);
}


static void clocks_window_update_header_bar (ClocksWindow* self) {
	ClocksHeaderBar* _tmp0_;
	GdStack* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	ClocksClock* _tmp4_;
	ClocksClock* clock;
	ClocksClock* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->header_bar;
	clocks_header_bar_clear (_tmp0_);
	_tmp1_ = self->priv->stack;
	_tmp2_ = gd_stack_get_visible_child (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, CLOCKS_TYPE_CLOCK, ClocksClock));
	clock = _tmp4_;
	_tmp5_ = clock;
	if (_tmp5_ != NULL) {
		ClocksClock* _tmp6_;
		ClocksClock* _tmp7_;
		_tmp6_ = clock;
		clocks_clock_update_header_bar (_tmp6_);
		_tmp7_ = clock;
		gtk_widget_grab_focus (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GTK_TYPE_WIDGET, GtkWidget));
	}
	_g_object_unref0 (clock);
}


static void clocks_window_class_init (ClocksWindowClass * klass) {
	clocks_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ClocksWindowPrivate));
	GTK_WIDGET_CLASS (klass)->key_press_event = clocks_window_real_key_press_event;
	G_OBJECT_CLASS (klass)->finalize = clocks_window_finalize;
}


static void clocks_window_instance_init (ClocksWindow * self) {
	self->priv = CLOCKS_WINDOW_GET_PRIVATE (self);
}


static void clocks_window_finalize (GObject* obj) {
	ClocksWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_TYPE_WINDOW, ClocksWindow);
	_g_object_unref0 (self->priv->header_bar);
	_g_object_unref0 (self->priv->stack);
	_g_object_unref0 (self->priv->world);
	_g_object_unref0 (self->priv->alarm);
	_g_object_unref0 (self->priv->stopwatch);
	_g_object_unref0 (self->priv->timer);
	G_OBJECT_CLASS (clocks_window_parent_class)->finalize (obj);
}


GType clocks_window_get_type (void) {
	static volatile gsize clocks_window_type_id__volatile = 0;
	if (g_once_init_enter (&clocks_window_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ClocksWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksWindow), 0, (GInstanceInitFunc) clocks_window_instance_init, NULL };
		GType clocks_window_type_id;
		clocks_window_type_id = g_type_register_static (GTK_TYPE_APPLICATION_WINDOW, "ClocksWindow", &g_define_type_info, 0);
		g_once_init_leave (&clocks_window_type_id__volatile, clocks_window_type_id);
	}
	return clocks_window_type_id__volatile;
}



