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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * 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, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include "planify.h"
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <pango/pango.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 LAYOUTS_TYPE_HEADER_BAR (layouts_header_bar_get_type ())
#define LAYOUTS_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LAYOUTS_TYPE_HEADER_BAR, LayoutsHeaderBar))
#define LAYOUTS_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LAYOUTS_TYPE_HEADER_BAR, LayoutsHeaderBarClass))
#define LAYOUTS_IS_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LAYOUTS_TYPE_HEADER_BAR))
#define LAYOUTS_IS_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LAYOUTS_TYPE_HEADER_BAR))
#define LAYOUTS_HEADER_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LAYOUTS_TYPE_HEADER_BAR, LayoutsHeaderBarClass))

typedef struct _LayoutsHeaderBar LayoutsHeaderBar;
typedef struct _LayoutsHeaderBarClass LayoutsHeaderBarClass;
typedef struct _LayoutsHeaderBarPrivate LayoutsHeaderBarPrivate;
enum  {
	LAYOUTS_HEADER_BAR_0_PROPERTY,
	LAYOUTS_HEADER_BAR_TITLE_PROPERTY,
	LAYOUTS_HEADER_BAR_SUBTITLE_PROPERTY,
	LAYOUTS_HEADER_BAR_BACK_REVEALER_PROPERTY,
	LAYOUTS_HEADER_BAR_NUM_PROPERTIES
};
static GParamSpec* layouts_header_bar_properties[LAYOUTS_HEADER_BAR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	LAYOUTS_HEADER_BAR_BACK_ACTIVATED_SIGNAL,
	LAYOUTS_HEADER_BAR_NUM_SIGNALS
};
static guint layouts_header_bar_signals[LAYOUTS_HEADER_BAR_NUM_SIGNALS] = {0};

struct _LayoutsHeaderBar {
	AdwBin parent_instance;
	LayoutsHeaderBarPrivate * priv;
};

struct _LayoutsHeaderBarClass {
	AdwBinClass parent_class;
};

struct _LayoutsHeaderBarPrivate {
	AdwHeaderBar* headerbar;
	GtkLabel* title_label;
	GtkLabel* subtitle_label;
	GtkRevealer* subtitle_revealer;
	GtkRevealer* title_box_revealer;
	GtkRevealer* back_button_revealer;
	GtkButton* back_button;
	GtkButton* sidebar_button;
	gchar* _title;
	gchar* _subtitle;
	GeeHashMap* signal_map;
};

static gint LayoutsHeaderBar_private_offset;
static gpointer layouts_header_bar_parent_class = NULL;

VALA_EXTERN GType layouts_header_bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LayoutsHeaderBar, g_object_unref)
static void layouts_header_bar_update_sidebar_icon (LayoutsHeaderBar* self);
VALA_EXTERN void layouts_header_bar_pack_end (LayoutsHeaderBar* self,
                                  GtkWidget* widget);
VALA_EXTERN void layouts_header_bar_revealer_title_box (LayoutsHeaderBar* self,
                                            gboolean reveal);
VALA_EXTERN void layouts_header_bar_update_title_box_visibility (LayoutsHeaderBar* self,
                                                     gboolean visible);
VALA_EXTERN void layouts_header_bar_clean_up (LayoutsHeaderBar* self);
VALA_EXTERN LayoutsHeaderBar* layouts_header_bar_new (void);
VALA_EXTERN LayoutsHeaderBar* layouts_header_bar_construct (GType object_type);
VALA_EXTERN const gchar* layouts_header_bar_get_title (LayoutsHeaderBar* self);
VALA_EXTERN void layouts_header_bar_set_title (LayoutsHeaderBar* self,
                                   const gchar* value);
VALA_EXTERN const gchar* layouts_header_bar_get_subtitle (LayoutsHeaderBar* self);
VALA_EXTERN void layouts_header_bar_set_subtitle (LayoutsHeaderBar* self,
                                      const gchar* value);
VALA_EXTERN gboolean layouts_header_bar_get_back_revealer (LayoutsHeaderBar* self);
VALA_EXTERN void layouts_header_bar_set_back_revealer (LayoutsHeaderBar* self,
                                           gboolean value);
static GObject * layouts_header_bar_constructor (GType type,
                                          guint n_construct_properties,
                                          GObjectConstructParam * construct_properties);
static void _layouts_header_bar___lambda535_ (LayoutsHeaderBar* self);
static void __layouts_header_bar___lambda535__gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self);
static void _layouts_header_bar___lambda536_ (LayoutsHeaderBar* self);
static void __layouts_header_bar___lambda536__gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self);
static void _layouts_header_bar___lambda537_ (LayoutsHeaderBar* self);
static void __layouts_header_bar___lambda537__g_settings_changed (GSettings* _sender,
                                                           const gchar* key,
                                                           gpointer self);
static void layouts_header_bar_finalize (GObject * obj);
static GType layouts_header_bar_get_type_once (void);
static void _vala_layouts_header_bar_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec);
static void _vala_layouts_header_bar_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 inline gpointer
layouts_header_bar_get_instance_private (LayoutsHeaderBar* self)
{
	return G_STRUCT_MEMBER_P (self, LayoutsHeaderBar_private_offset);
}

static void
layouts_header_bar_update_sidebar_icon (LayoutsHeaderBar* self)
{
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_boolean (_tmp2_, "slim-mode");
	_g_object_unref0 (_tmp1_);
	if (_tmp3_) {
		GtkButton* _tmp4_;
		_tmp4_ = self->priv->sidebar_button;
		gtk_button_set_icon_name (_tmp4_, "dock-right-symbolic");
	} else {
		GtkButton* _tmp5_;
		_tmp5_ = self->priv->sidebar_button;
		gtk_button_set_icon_name (_tmp5_, "dock-left-symbolic");
	}
}

void
layouts_header_bar_pack_end (LayoutsHeaderBar* self,
                             GtkWidget* widget)
{
	AdwHeaderBar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->headerbar;
	adw_header_bar_pack_end (_tmp0_, widget);
}

void
layouts_header_bar_revealer_title_box (LayoutsHeaderBar* self,
                                       gboolean reveal)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->title_box_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, reveal);
}

void
layouts_header_bar_update_title_box_visibility (LayoutsHeaderBar* self,
                                                gboolean visible)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->title_box_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, visible);
}

void
layouts_header_bar_clean_up (LayoutsHeaderBar* self)
{
	GeeHashMap* _tmp15_;
	g_return_if_fail (self != NULL);
	{
		GeeIterator* _entry_it = NULL;
		GeeHashMap* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->signal_map;
		_tmp1_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_entry_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			GeeMapEntry* _tmp9_;
			gconstpointer _tmp10_;
			gconstpointer _tmp11_;
			GeeMapEntry* _tmp12_;
			gconstpointer _tmp13_;
			gconstpointer _tmp14_;
			_tmp6_ = _entry_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _entry_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			entry = (GeeMapEntry*) _tmp8_;
			_tmp9_ = entry;
			_tmp10_ = gee_map_entry_get_value (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = entry;
			_tmp13_ = gee_map_entry_get_key (_tmp12_);
			_tmp14_ = _tmp13_;
			g_signal_handler_disconnect ((GObject*) _tmp11_, (gulong) ((guintptr) _tmp14_));
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	_tmp15_ = self->priv->signal_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp15_);
}

LayoutsHeaderBar*
layouts_header_bar_construct (GType object_type)
{
	LayoutsHeaderBar * self = NULL;
	self = (LayoutsHeaderBar*) g_object_new (object_type, NULL);
	return self;
}

LayoutsHeaderBar*
layouts_header_bar_new (void)
{
	return layouts_header_bar_construct (LAYOUTS_TYPE_HEADER_BAR);
}

const gchar*
layouts_header_bar_get_title (LayoutsHeaderBar* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_title;
	result = _tmp0_;
	return result;
}

void
layouts_header_bar_set_title (LayoutsHeaderBar* self,
                              const gchar* value)
{
	gchar* _tmp0_;
	GtkLabel* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_title);
	self->priv->_title = _tmp0_;
	_tmp1_ = self->priv->title_label;
	_tmp2_ = self->priv->_title;
	gtk_label_set_label (_tmp1_, _tmp2_);
	g_object_notify_by_pspec ((GObject *) self, layouts_header_bar_properties[LAYOUTS_HEADER_BAR_TITLE_PROPERTY]);
}

const gchar*
layouts_header_bar_get_subtitle (LayoutsHeaderBar* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_title;
	result = _tmp0_;
	return result;
}

void
layouts_header_bar_set_subtitle (LayoutsHeaderBar* self,
                                 const gchar* value)
{
	gchar* _tmp0_;
	GtkLabel* _tmp1_;
	const gchar* _tmp2_;
	GtkRevealer* _tmp3_;
	const gchar* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_subtitle);
	self->priv->_subtitle = _tmp0_;
	_tmp1_ = self->priv->subtitle_label;
	_tmp2_ = self->priv->_subtitle;
	gtk_label_set_label (_tmp1_, _tmp2_);
	_tmp3_ = self->priv->subtitle_revealer;
	_tmp4_ = self->priv->_subtitle;
	_tmp5_ = strlen (_tmp4_);
	_tmp6_ = _tmp5_;
	gtk_revealer_set_reveal_child (_tmp3_, _tmp6_ > 0);
	g_object_notify_by_pspec ((GObject *) self, layouts_header_bar_properties[LAYOUTS_HEADER_BAR_SUBTITLE_PROPERTY]);
}

gboolean
layouts_header_bar_get_back_revealer (LayoutsHeaderBar* self)
{
	gboolean result;
	GtkRevealer* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->back_button_revealer;
	_tmp1_ = gtk_revealer_get_reveal_child (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
layouts_header_bar_set_back_revealer (LayoutsHeaderBar* self,
                                      gboolean value)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->back_button_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, layouts_header_bar_properties[LAYOUTS_HEADER_BAR_BACK_REVEALER_PROPERTY]);
}

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

static void
_layouts_header_bar___lambda535_ (LayoutsHeaderBar* self)
{
	gboolean slim_mode = FALSE;
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gboolean _tmp3_;
	ServicesSettings* _tmp4_;
	ServicesSettings* _tmp5_;
	GSettings* _tmp6_;
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_boolean (_tmp2_, "slim-mode");
	_g_object_unref0 (_tmp1_);
	slim_mode = _tmp3_;
	_tmp4_ = services_settings_get_default ();
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_->settings;
	g_settings_set_boolean (_tmp6_, "slim-mode", !slim_mode);
	_g_object_unref0 (_tmp5_);
}

static void
__layouts_header_bar___lambda535__gtk_button_clicked (GtkButton* _sender,
                                                      gpointer self)
{
	_layouts_header_bar___lambda535_ ((LayoutsHeaderBar*) self);
}

static void
_layouts_header_bar___lambda536_ (LayoutsHeaderBar* self)
{
	g_signal_emit (self, layouts_header_bar_signals[LAYOUTS_HEADER_BAR_BACK_ACTIVATED_SIGNAL], 0);
}

static void
__layouts_header_bar___lambda536__gtk_button_clicked (GtkButton* _sender,
                                                      gpointer self)
{
	_layouts_header_bar___lambda536_ ((LayoutsHeaderBar*) self);
}

static void
_layouts_header_bar___lambda537_ (LayoutsHeaderBar* self)
{
	layouts_header_bar_update_sidebar_icon (self);
}

static void
__layouts_header_bar___lambda537__g_settings_changed (GSettings* _sender,
                                                      const gchar* key,
                                                      gpointer self)
{
	_layouts_header_bar___lambda537_ ((LayoutsHeaderBar*) self);
}

static GObject *
layouts_header_bar_constructor (GType type,
                                guint n_construct_properties,
                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	LayoutsHeaderBar * self;
	gchar* _tmp0_;
	gchar** _tmp1_;
	Util* _tmp2_;
	Util* _tmp3_;
	gchar* _tmp4_;
	GtkButton* _tmp5_ = NULL;
	gchar* _tmp6_;
	gchar** _tmp7_;
	gchar* _tmp8_;
	GtkButton* _tmp9_ = NULL;
	GtkButton* _tmp10_;
	GtkWidget* _tmp11_;
	GtkRevealer* _tmp12_ = NULL;
	gchar* _tmp13_;
	gchar** _tmp14_;
	GtkLabel* _tmp15_ = NULL;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar** _tmp18_;
	GtkLabel* _tmp19_ = NULL;
	GtkLabel* _tmp20_;
	GtkWidget* _tmp21_;
	GtkRevealer* _tmp22_ = NULL;
	GtkBox* title_box = NULL;
	GtkBox* _tmp23_ = NULL;
	GtkBox* _tmp24_;
	GtkLabel* _tmp25_;
	GtkBox* _tmp26_;
	GtkRevealer* _tmp27_;
	GtkBox* _tmp28_;
	GtkWidget* _tmp29_;
	GtkRevealer* _tmp30_ = NULL;
	GtkRevealer* _tmp31_;
	GtkWidget* _tmp32_;
	AdwHeaderBar* _tmp33_ = NULL;
	AdwHeaderBar* _tmp34_;
	GtkButton* _tmp35_;
	AdwHeaderBar* _tmp36_;
	GtkRevealer* _tmp37_;
	AdwHeaderBar* _tmp38_;
	GeeHashMap* _tmp39_;
	GtkButton* _tmp40_;
	gulong _tmp41_;
	GtkButton* _tmp42_;
	GeeHashMap* _tmp43_;
	GtkButton* _tmp44_;
	gulong _tmp45_;
	GtkButton* _tmp46_;
	GeeHashMap* _tmp47_;
	ServicesSettings* _tmp48_;
	ServicesSettings* _tmp49_;
	GSettings* _tmp50_;
	gulong _tmp51_;
	ServicesSettings* _tmp52_;
	ServicesSettings* _tmp53_;
	parent_class = G_OBJECT_CLASS (layouts_header_bar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LAYOUTS_TYPE_HEADER_BAR, LayoutsHeaderBar);
	_tmp0_ = g_strdup ("flat");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp2_ = util_get_default ();
	_tmp3_ = _tmp2_;
	_tmp4_ = util_markup_accel_tooltip (_tmp3_, _ ("Open/Close Sidebar"), "M");
	_tmp5_ = (GtkButton*) gtk_button_new ();
	gtk_widget_set_valign ((GtkWidget*) _tmp5_, GTK_ALIGN_CENTER);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp5_, _tmp1_);
	_tmp1_ = (_vala_array_free (_tmp1_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_tooltip_markup ((GtkWidget*) _tmp5_, _tmp4_);
	_g_free0 (_tmp4_);
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->sidebar_button);
	self->priv->sidebar_button = _tmp5_;
	_g_object_unref0 (_tmp3_);
	layouts_header_bar_update_sidebar_icon (self);
	_tmp6_ = g_strdup ("flat");
	_tmp7_ = g_new0 (gchar*, 1 + 1);
	_tmp7_[0] = _tmp6_;
	_tmp8_ = g_strdup (_ ("Back"));
	_tmp9_ = (GtkButton*) gtk_button_new_from_icon_name ("go-previous-symbolic");
	gtk_widget_set_valign ((GtkWidget*) _tmp9_, GTK_ALIGN_CENTER);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp9_, _tmp7_);
	_tmp7_ = (_vala_array_free (_tmp7_, 1, (GDestroyNotify) g_free), NULL);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp9_, _tmp8_);
	_g_free0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->back_button);
	self->priv->back_button = _tmp9_;
	_tmp10_ = self->priv->back_button;
	_tmp11_ = _g_object_ref0 ((GtkWidget*) _tmp10_);
	_tmp12_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp12_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT);
	gtk_revealer_set_child (_tmp12_, _tmp11_);
	_g_object_unref0 (_tmp11_);
	gtk_revealer_set_reveal_child (_tmp12_, FALSE);
	g_object_ref_sink (_tmp12_);
	_g_object_unref0 (self->priv->back_button_revealer);
	self->priv->back_button_revealer = _tmp12_;
	_tmp13_ = g_strdup ("font-bold");
	_tmp14_ = g_new0 (gchar*, 1 + 1);
	_tmp14_[0] = _tmp13_;
	_tmp15_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp15_, _tmp14_);
	_tmp14_ = (_vala_array_free (_tmp14_, 1, (GDestroyNotify) g_free), NULL);
	gtk_label_set_ellipsize (_tmp15_, PANGO_ELLIPSIZE_END);
	g_object_ref_sink (_tmp15_);
	_g_object_unref0 (self->priv->title_label);
	self->priv->title_label = _tmp15_;
	_tmp16_ = g_strdup ("caption");
	_tmp17_ = g_strdup ("dimmed");
	_tmp18_ = g_new0 (gchar*, 2 + 1);
	_tmp18_[0] = _tmp16_;
	_tmp18_[1] = _tmp17_;
	_tmp19_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp19_, _tmp18_);
	_tmp18_ = (_vala_array_free (_tmp18_, 2, (GDestroyNotify) g_free), NULL);
	gtk_label_set_ellipsize (_tmp19_, PANGO_ELLIPSIZE_END);
	g_object_ref_sink (_tmp19_);
	_g_object_unref0 (self->priv->subtitle_label);
	self->priv->subtitle_label = _tmp19_;
	_tmp20_ = self->priv->subtitle_label;
	_tmp21_ = _g_object_ref0 ((GtkWidget*) _tmp20_);
	_tmp22_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp22_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	gtk_revealer_set_child (_tmp22_, _tmp21_);
	_g_object_unref0 (_tmp21_);
	g_object_ref_sink (_tmp22_);
	_g_object_unref0 (self->priv->subtitle_revealer);
	self->priv->subtitle_revealer = _tmp22_;
	_tmp23_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_widget_set_valign ((GtkWidget*) _tmp23_, GTK_ALIGN_CENTER);
	gtk_widget_set_halign ((GtkWidget*) _tmp23_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp23_);
	title_box = _tmp23_;
	_tmp24_ = title_box;
	_tmp25_ = self->priv->title_label;
	gtk_box_append (_tmp24_, (GtkWidget*) _tmp25_);
	_tmp26_ = title_box;
	_tmp27_ = self->priv->subtitle_revealer;
	gtk_box_append (_tmp26_, (GtkWidget*) _tmp27_);
	_tmp28_ = title_box;
	_tmp29_ = _g_object_ref0 ((GtkWidget*) _tmp28_);
	_tmp30_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp30_, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
	gtk_revealer_set_child (_tmp30_, _tmp29_);
	_g_object_unref0 (_tmp29_);
	g_object_ref_sink (_tmp30_);
	_g_object_unref0 (self->priv->title_box_revealer);
	self->priv->title_box_revealer = _tmp30_;
	_tmp31_ = self->priv->title_box_revealer;
	_tmp32_ = _g_object_ref0 ((GtkWidget*) _tmp31_);
	_tmp33_ = (AdwHeaderBar*) adw_header_bar_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp33_, TRUE);
	adw_header_bar_set_title_widget (_tmp33_, _tmp32_);
	_g_object_unref0 (_tmp32_);
	g_object_ref_sink (_tmp33_);
	_g_object_unref0 (self->priv->headerbar);
	self->priv->headerbar = _tmp33_;
	_tmp34_ = self->priv->headerbar;
	_tmp35_ = self->priv->sidebar_button;
	adw_header_bar_pack_start (_tmp34_, (GtkWidget*) _tmp35_);
	_tmp36_ = self->priv->headerbar;
	_tmp37_ = self->priv->back_button_revealer;
	adw_header_bar_pack_start (_tmp36_, (GtkWidget*) _tmp37_);
	_tmp38_ = self->priv->headerbar;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp38_);
	_tmp39_ = self->priv->signal_map;
	_tmp40_ = self->priv->sidebar_button;
	_tmp41_ = g_signal_connect_object (_tmp40_, "clicked", (GCallback) __layouts_header_bar___lambda535__gtk_button_clicked, self, 0);
	_tmp42_ = self->priv->sidebar_button;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp39_, (gpointer) ((guintptr) _tmp41_), (GObject*) _tmp42_);
	_tmp43_ = self->priv->signal_map;
	_tmp44_ = self->priv->back_button;
	_tmp45_ = g_signal_connect_object (_tmp44_, "clicked", (GCallback) __layouts_header_bar___lambda536__gtk_button_clicked, self, 0);
	_tmp46_ = self->priv->back_button;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp43_, (gpointer) ((guintptr) _tmp45_), (GObject*) _tmp46_);
	_tmp47_ = self->priv->signal_map;
	_tmp48_ = services_settings_get_default ();
	_tmp49_ = _tmp48_;
	_tmp50_ = _tmp49_->settings;
	_tmp51_ = g_signal_connect_object (_tmp50_, "changed::slim-mode", (GCallback) __layouts_header_bar___lambda537__g_settings_changed, self, 0);
	_tmp52_ = services_settings_get_default ();
	_tmp53_ = _tmp52_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp47_, (gpointer) ((guintptr) _tmp51_), (GObject*) _tmp53_);
	_g_object_unref0 (_tmp53_);
	_g_object_unref0 (_tmp49_);
	_g_object_unref0 (title_box);
	return obj;
}

static void
layouts_header_bar_class_init (LayoutsHeaderBarClass * klass,
                               gpointer klass_data)
{
	layouts_header_bar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &LayoutsHeaderBar_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_layouts_header_bar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_layouts_header_bar_set_property;
	G_OBJECT_CLASS (klass)->constructor = layouts_header_bar_constructor;
	G_OBJECT_CLASS (klass)->finalize = layouts_header_bar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), LAYOUTS_HEADER_BAR_TITLE_PROPERTY, layouts_header_bar_properties[LAYOUTS_HEADER_BAR_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), LAYOUTS_HEADER_BAR_SUBTITLE_PROPERTY, layouts_header_bar_properties[LAYOUTS_HEADER_BAR_SUBTITLE_PROPERTY] = g_param_spec_string ("subtitle", "subtitle", "subtitle", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), LAYOUTS_HEADER_BAR_BACK_REVEALER_PROPERTY, layouts_header_bar_properties[LAYOUTS_HEADER_BAR_BACK_REVEALER_PROPERTY] = g_param_spec_boolean ("back-revealer", "back-revealer", "back-revealer", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	layouts_header_bar_signals[LAYOUTS_HEADER_BAR_BACK_ACTIVATED_SIGNAL] = g_signal_new ("back-activated", LAYOUTS_TYPE_HEADER_BAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
layouts_header_bar_instance_init (LayoutsHeaderBar * self,
                                  gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = layouts_header_bar_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_ULONG, NULL, NULL, G_TYPE_OBJECT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->signal_map = _tmp0_;
}

static void
layouts_header_bar_finalize (GObject * obj)
{
	LayoutsHeaderBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LAYOUTS_TYPE_HEADER_BAR, LayoutsHeaderBar);
	g_debug ("HeaderBar.vala:72: Destroying - Layouts.HeaderBar\n");
	_g_object_unref0 (self->priv->headerbar);
	_g_object_unref0 (self->priv->title_label);
	_g_object_unref0 (self->priv->subtitle_label);
	_g_object_unref0 (self->priv->subtitle_revealer);
	_g_object_unref0 (self->priv->title_box_revealer);
	_g_object_unref0 (self->priv->back_button_revealer);
	_g_object_unref0 (self->priv->back_button);
	_g_object_unref0 (self->priv->sidebar_button);
	_g_free0 (self->priv->_title);
	_g_free0 (self->priv->_subtitle);
	_g_object_unref0 (self->priv->signal_map);
	G_OBJECT_CLASS (layouts_header_bar_parent_class)->finalize (obj);
}

static GType
layouts_header_bar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LayoutsHeaderBarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) layouts_header_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LayoutsHeaderBar), 0, (GInstanceInitFunc) layouts_header_bar_instance_init, NULL };
	GType layouts_header_bar_type_id;
	layouts_header_bar_type_id = g_type_register_static (adw_bin_get_type (), "LayoutsHeaderBar", &g_define_type_info, 0);
	LayoutsHeaderBar_private_offset = g_type_add_instance_private (layouts_header_bar_type_id, sizeof (LayoutsHeaderBarPrivate));
	return layouts_header_bar_type_id;
}

GType
layouts_header_bar_get_type (void)
{
	static volatile gsize layouts_header_bar_type_id__once = 0;
	if (g_once_init_enter (&layouts_header_bar_type_id__once)) {
		GType layouts_header_bar_type_id;
		layouts_header_bar_type_id = layouts_header_bar_get_type_once ();
		g_once_init_leave (&layouts_header_bar_type_id__once, layouts_header_bar_type_id);
	}
	return layouts_header_bar_type_id__once;
}

static void
_vala_layouts_header_bar_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec)
{
	LayoutsHeaderBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LAYOUTS_TYPE_HEADER_BAR, LayoutsHeaderBar);
	switch (property_id) {
		case LAYOUTS_HEADER_BAR_TITLE_PROPERTY:
		g_value_set_string (value, layouts_header_bar_get_title (self));
		break;
		case LAYOUTS_HEADER_BAR_SUBTITLE_PROPERTY:
		g_value_set_string (value, layouts_header_bar_get_subtitle (self));
		break;
		case LAYOUTS_HEADER_BAR_BACK_REVEALER_PROPERTY:
		g_value_set_boolean (value, layouts_header_bar_get_back_revealer (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_layouts_header_bar_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec)
{
	LayoutsHeaderBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LAYOUTS_TYPE_HEADER_BAR, LayoutsHeaderBar);
	switch (property_id) {
		case LAYOUTS_HEADER_BAR_TITLE_PROPERTY:
		layouts_header_bar_set_title (self, g_value_get_string (value));
		break;
		case LAYOUTS_HEADER_BAR_SUBTITLE_PROPERTY:
		layouts_header_bar_set_subtitle (self, g_value_get_string (value));
		break;
		case LAYOUTS_HEADER_BAR_BACK_REVEALER_PROPERTY:
		layouts_header_bar_set_back_revealer (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);
}

