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

/*
 * Copyright (c) 2013,2014,2016,2024 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include "ft_ui.h"
#include "ft_core.h"
#include <adwaita.h>
#include <libpeas.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 FT_TYPE_PREFERENCES_PANEL_INFO (ft_preferences_panel_info_get_type ())
#define FT_PREFERENCES_PANEL_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FT_TYPE_PREFERENCES_PANEL_INFO, FtPreferencesPanelInfo))
#define FT_PREFERENCES_PANEL_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FT_TYPE_PREFERENCES_PANEL_INFO, FtPreferencesPanelInfoClass))
#define FT_IS_PREFERENCES_PANEL_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FT_TYPE_PREFERENCES_PANEL_INFO))
#define FT_IS_PREFERENCES_PANEL_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FT_TYPE_PREFERENCES_PANEL_INFO))
#define FT_PREFERENCES_PANEL_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FT_TYPE_PREFERENCES_PANEL_INFO, FtPreferencesPanelInfoClass))

typedef struct _FtPreferencesPanelInfo FtPreferencesPanelInfo;
typedef struct _FtPreferencesPanelInfoClass FtPreferencesPanelInfoClass;
typedef struct _FtPreferencesPanelInfoPrivate FtPreferencesPanelInfoPrivate;
enum  {
	FT_PREFERENCES_PANEL_INFO_0_PROPERTY,
	FT_PREFERENCES_PANEL_INFO_NAME_PROPERTY,
	FT_PREFERENCES_PANEL_INFO_TITLE_PROPERTY,
	FT_PREFERENCES_PANEL_INFO_ICON_NAME_PROPERTY,
	FT_PREFERENCES_PANEL_INFO_CONTENT_CLASS_PROPERTY,
	FT_PREFERENCES_PANEL_INFO_VISIBLE_PROPERTY,
	FT_PREFERENCES_PANEL_INFO_NUM_PROPERTIES
};
static GParamSpec* ft_preferences_panel_info_properties[FT_PREFERENCES_PANEL_INFO_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	FT_PREFERENCES_PANEL_0_PROPERTY,
	FT_PREFERENCES_PANEL_NUM_PROPERTIES
};
static GParamSpec* ft_preferences_panel_properties[FT_PREFERENCES_PANEL_NUM_PROPERTIES];
enum  {
	FT_PREFERENCES_WINDOW_0_PROPERTY,
	FT_PREFERENCES_WINDOW_MODEL_PROPERTY,
	FT_PREFERENCES_WINDOW_VISIBLE_PANEL_PROPERTY,
	FT_PREFERENCES_WINDOW_NUM_PROPERTIES
};
static GParamSpec* ft_preferences_window_properties[FT_PREFERENCES_WINDOW_NUM_PROPERTIES];

struct _FtPreferencesPanelInfo {
	GObject parent_instance;
	FtPreferencesPanelInfoPrivate * priv;
};

struct _FtPreferencesPanelInfoClass {
	GObjectClass parent_class;
};

struct _FtPreferencesPanelInfoPrivate {
	gchar* _name;
	gchar* _title;
	gchar* _icon_name;
	GType _content_class;
	gboolean _visible;
};

struct _FtPreferencesWindowPrivate {
	AdwToastOverlay* toast_overlay;
	AdwNavigationSplitView* split_view;
	FtPreferencesSidebar* sidebar;
	GtkSingleSelection* _model;
	GSettings* settings;
	PeasExtensionSet* extensions;
};

static gint FtPreferencesPanelInfo_private_offset;
static gpointer ft_preferences_panel_info_parent_class = NULL;
static gpointer ft_preferences_panel_parent_class = NULL;
static gint FtPreferencesWindow_private_offset;
static gpointer ft_preferences_window_parent_class = NULL;
static GtkBuildableIface * ft_preferences_window_gtk_buildable_parent_iface = NULL;

VALA_EXTERN GType ft_preferences_panel_info_get_type (void) G_GNUC_CONST ;
VALA_EXTERN FtPreferencesPanelInfo* ft_preferences_panel_info_new (void);
VALA_EXTERN FtPreferencesPanelInfo* ft_preferences_panel_info_construct (GType object_type);
VALA_EXTERN const gchar* ft_preferences_panel_info_get_name (FtPreferencesPanelInfo* self);
VALA_EXTERN void ft_preferences_panel_info_set_name (FtPreferencesPanelInfo* self,
                                         const gchar* value);
VALA_EXTERN const gchar* ft_preferences_panel_info_get_title (FtPreferencesPanelInfo* self);
VALA_EXTERN void ft_preferences_panel_info_set_title (FtPreferencesPanelInfo* self,
                                          const gchar* value);
VALA_EXTERN const gchar* ft_preferences_panel_info_get_icon_name (FtPreferencesPanelInfo* self);
VALA_EXTERN void ft_preferences_panel_info_set_icon_name (FtPreferencesPanelInfo* self,
                                              const gchar* value);
VALA_EXTERN GType ft_preferences_panel_info_get_content_class (FtPreferencesPanelInfo* self);
VALA_EXTERN void ft_preferences_panel_info_set_content_class (FtPreferencesPanelInfo* self,
                                                  GType value);
VALA_EXTERN gboolean ft_preferences_panel_info_get_visible (FtPreferencesPanelInfo* self);
VALA_EXTERN void ft_preferences_panel_info_set_visible (FtPreferencesPanelInfo* self,
                                            gboolean value);
static void ft_preferences_panel_info_finalize (GObject * obj);
static GType ft_preferences_panel_info_get_type_once (void);
static void _vala_ft_preferences_panel_info_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec);
static void _vala_ft_preferences_panel_info_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec);
VALA_EXTERN GtkSingleSelection* ft_create_model (void);
static AdwPreferencesPage* ft_preferences_panel_real_get_preferences_page (FtPreferencesPanel* self);
static GType ft_preferences_panel_get_type_once (void);
static void ft_preferences_window_load_window_state (FtPreferencesWindow* self);
static void ft_preferences_window_save_window_state (FtPreferencesWindow* self);
static void ft_preferences_window_update_split_view_content (FtPreferencesWindow* self);
static void ft_preferences_window_setup_extension (FtPreferencesWindow* self,
                                            GObject* object);
static void ft_preferences_window_on_split_view_collapsed_notify (FtPreferencesWindow* self);
static void ft_preferences_window_on_selection_changed (FtPreferencesWindow* self,
                                                 guint position,
                                                 guint n_items);
static void ft_preferences_window_on_extension_added (FtPreferencesWindow* self,
                                               PeasExtensionSet* extension_set,
                                               PeasPluginInfo* plugin_info,
                                               GObject* object);
static void ft_preferences_window_real_unmap (GtkWidget* base);
static void ft_preferences_window_real_dispose (GObject* base);
static void _ft_preferences_window_on_selection_changed_gtk_selection_model_selection_changed (GtkSelectionModel* _sender,
                                                                                        guint position,
                                                                                        guint n_items,
                                                                                        gpointer self);
static GObject * ft_preferences_window_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void _ft_preferences_window_on_split_view_collapsed_notify_g_object_notify (GObject* _sender,
                                                                            GParamSpec* pspec,
                                                                            gpointer self);
static void _vala_GValue_array_free (GValue * array,
                              gssize array_length);
static void _ft_preferences_window_on_extension_added_peas_extension_set_extension_added (PeasExtensionSet* _sender,
                                                                                   PeasPluginInfo* info,
                                                                                   GObject* extension,
                                                                                   gpointer self);
static void _ft_preferences_window___lambda85_ (FtPreferencesWindow* self,
                                         GObject* object);
static void __ft_preferences_window___lambda85__ft_extension_set_foreach_func (GObject* object,
                                                                        gpointer self);
static void ft_preferences_window_finalize (GObject * obj);
static GType ft_preferences_window_get_type_once (void);
static void _vala_ft_preferences_window_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_ft_preferences_window_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 _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
ft_preferences_panel_info_get_instance_private (FtPreferencesPanelInfo* self)
{
	return G_STRUCT_MEMBER_P (self, FtPreferencesPanelInfo_private_offset);
}

FtPreferencesPanelInfo*
ft_preferences_panel_info_construct (GType object_type)
{
	FtPreferencesPanelInfo * self = NULL;
	self = (FtPreferencesPanelInfo*) g_object_new (object_type, NULL);
	return self;
}

FtPreferencesPanelInfo*
ft_preferences_panel_info_new (void)
{
	return ft_preferences_panel_info_construct (FT_TYPE_PREFERENCES_PANEL_INFO);
}

const gchar*
ft_preferences_panel_info_get_name (FtPreferencesPanelInfo* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name;
	result = _tmp0_;
	return result;
}

void
ft_preferences_panel_info_set_name (FtPreferencesPanelInfo* self,
                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_preferences_panel_info_get_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_name);
		self->priv->_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_preferences_panel_info_properties[FT_PREFERENCES_PANEL_INFO_NAME_PROPERTY]);
	}
}

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

void
ft_preferences_panel_info_set_title (FtPreferencesPanelInfo* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_preferences_panel_info_get_title (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_title);
		self->priv->_title = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_preferences_panel_info_properties[FT_PREFERENCES_PANEL_INFO_TITLE_PROPERTY]);
	}
}

const gchar*
ft_preferences_panel_info_get_icon_name (FtPreferencesPanelInfo* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_icon_name;
	result = _tmp0_;
	return result;
}

void
ft_preferences_panel_info_set_icon_name (FtPreferencesPanelInfo* self,
                                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_preferences_panel_info_get_icon_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_icon_name);
		self->priv->_icon_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_preferences_panel_info_properties[FT_PREFERENCES_PANEL_INFO_ICON_NAME_PROPERTY]);
	}
}

GType
ft_preferences_panel_info_get_content_class (FtPreferencesPanelInfo* self)
{
	GType result;
	g_return_val_if_fail (self != NULL, G_TYPE_INVALID);
	result = self->priv->_content_class;
	return result;
}

void
ft_preferences_panel_info_set_content_class (FtPreferencesPanelInfo* self,
                                             GType value)
{
	GType old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_preferences_panel_info_get_content_class (self);
	if (old_value != value) {
		self->priv->_content_class = value;
		g_object_notify_by_pspec ((GObject *) self, ft_preferences_panel_info_properties[FT_PREFERENCES_PANEL_INFO_CONTENT_CLASS_PROPERTY]);
	}
}

gboolean
ft_preferences_panel_info_get_visible (FtPreferencesPanelInfo* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_visible;
	return result;
}

void
ft_preferences_panel_info_set_visible (FtPreferencesPanelInfo* self,
                                       gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_preferences_panel_info_get_visible (self);
	if (old_value != value) {
		self->priv->_visible = value;
		g_object_notify_by_pspec ((GObject *) self, ft_preferences_panel_info_properties[FT_PREFERENCES_PANEL_INFO_VISIBLE_PROPERTY]);
	}
}

static void
ft_preferences_panel_info_class_init (FtPreferencesPanelInfoClass * klass,
                                      gpointer klass_data)
{
	ft_preferences_panel_info_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtPreferencesPanelInfo_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_preferences_panel_info_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_preferences_panel_info_set_property;
	G_OBJECT_CLASS (klass)->finalize = ft_preferences_panel_info_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_PREFERENCES_PANEL_INFO_NAME_PROPERTY, ft_preferences_panel_info_properties[FT_PREFERENCES_PANEL_INFO_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_PREFERENCES_PANEL_INFO_TITLE_PROPERTY, ft_preferences_panel_info_properties[FT_PREFERENCES_PANEL_INFO_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), FT_PREFERENCES_PANEL_INFO_ICON_NAME_PROPERTY, ft_preferences_panel_info_properties[FT_PREFERENCES_PANEL_INFO_ICON_NAME_PROPERTY] = g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_PREFERENCES_PANEL_INFO_CONTENT_CLASS_PROPERTY, ft_preferences_panel_info_properties[FT_PREFERENCES_PANEL_INFO_CONTENT_CLASS_PROPERTY] = g_param_spec_gtype ("content-class", "content-class", "content-class", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_PREFERENCES_PANEL_INFO_VISIBLE_PROPERTY, ft_preferences_panel_info_properties[FT_PREFERENCES_PANEL_INFO_VISIBLE_PROPERTY] = g_param_spec_boolean ("visible", "visible", "visible", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
ft_preferences_panel_info_instance_init (FtPreferencesPanelInfo * self,
                                         gpointer klass)
{
	self->priv = ft_preferences_panel_info_get_instance_private (self);
	self->priv->_visible = TRUE;
}

static void
ft_preferences_panel_info_finalize (GObject * obj)
{
	FtPreferencesPanelInfo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_PREFERENCES_PANEL_INFO, FtPreferencesPanelInfo);
	_g_free0 (self->priv->_name);
	_g_free0 (self->priv->_title);
	_g_free0 (self->priv->_icon_name);
	G_OBJECT_CLASS (ft_preferences_panel_info_parent_class)->finalize (obj);
}

static GType
ft_preferences_panel_info_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtPreferencesPanelInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_preferences_panel_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtPreferencesPanelInfo), 0, (GInstanceInitFunc) ft_preferences_panel_info_instance_init, NULL };
	GType ft_preferences_panel_info_type_id;
	ft_preferences_panel_info_type_id = g_type_register_static (G_TYPE_OBJECT, "FtPreferencesPanelInfo", &g_define_type_info, 0);
	FtPreferencesPanelInfo_private_offset = g_type_add_instance_private (ft_preferences_panel_info_type_id, sizeof (FtPreferencesPanelInfoPrivate));
	return ft_preferences_panel_info_type_id;
}

GType
ft_preferences_panel_info_get_type (void)
{
	static volatile gsize ft_preferences_panel_info_type_id__once = 0;
	if (g_once_init_enter (&ft_preferences_panel_info_type_id__once)) {
		GType ft_preferences_panel_info_type_id;
		ft_preferences_panel_info_type_id = ft_preferences_panel_info_get_type_once ();
		g_once_init_leave (&ft_preferences_panel_info_type_id__once, ft_preferences_panel_info_type_id);
	}
	return ft_preferences_panel_info_type_id__once;
}

static void
_vala_ft_preferences_panel_info_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec)
{
	FtPreferencesPanelInfo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_PREFERENCES_PANEL_INFO, FtPreferencesPanelInfo);
	switch (property_id) {
		case FT_PREFERENCES_PANEL_INFO_NAME_PROPERTY:
		g_value_set_string (value, ft_preferences_panel_info_get_name (self));
		break;
		case FT_PREFERENCES_PANEL_INFO_TITLE_PROPERTY:
		g_value_set_string (value, ft_preferences_panel_info_get_title (self));
		break;
		case FT_PREFERENCES_PANEL_INFO_ICON_NAME_PROPERTY:
		g_value_set_string (value, ft_preferences_panel_info_get_icon_name (self));
		break;
		case FT_PREFERENCES_PANEL_INFO_CONTENT_CLASS_PROPERTY:
		g_value_set_gtype (value, ft_preferences_panel_info_get_content_class (self));
		break;
		case FT_PREFERENCES_PANEL_INFO_VISIBLE_PROPERTY:
		g_value_set_boolean (value, ft_preferences_panel_info_get_visible (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_preferences_panel_info_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec)
{
	FtPreferencesPanelInfo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_PREFERENCES_PANEL_INFO, FtPreferencesPanelInfo);
	switch (property_id) {
		case FT_PREFERENCES_PANEL_INFO_NAME_PROPERTY:
		ft_preferences_panel_info_set_name (self, g_value_get_string (value));
		break;
		case FT_PREFERENCES_PANEL_INFO_TITLE_PROPERTY:
		ft_preferences_panel_info_set_title (self, g_value_get_string (value));
		break;
		case FT_PREFERENCES_PANEL_INFO_ICON_NAME_PROPERTY:
		ft_preferences_panel_info_set_icon_name (self, g_value_get_string (value));
		break;
		case FT_PREFERENCES_PANEL_INFO_CONTENT_CLASS_PROPERTY:
		ft_preferences_panel_info_set_content_class (self, g_value_get_gtype (value));
		break;
		case FT_PREFERENCES_PANEL_INFO_VISIBLE_PROPERTY:
		ft_preferences_panel_info_set_visible (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

GtkSingleSelection*
ft_create_model (void)
{
	FtPreferencesPanelInfo* panel_info = NULL;
	GListStore* model = NULL;
	GListStore* _tmp0_;
	FtPreferencesPanelInfo* _tmp1_;
	FtPreferencesPanelInfo* _tmp2_;
	FtPreferencesPanelInfo* _tmp3_;
	FtPreferencesPanelInfo* _tmp4_;
	FtPreferencesPanelInfo* _tmp5_;
	GListStore* _tmp6_;
	FtPreferencesPanelInfo* _tmp7_;
	FtPreferencesPanelInfo* _tmp8_;
	FtPreferencesPanelInfo* _tmp9_;
	FtPreferencesPanelInfo* _tmp10_;
	FtPreferencesPanelInfo* _tmp11_;
	FtPreferencesPanelInfo* _tmp12_;
	GListStore* _tmp13_;
	FtPreferencesPanelInfo* _tmp14_;
	FtPreferencesPanelInfo* _tmp15_;
	FtPreferencesPanelInfo* _tmp16_;
	FtPreferencesPanelInfo* _tmp17_;
	FtPreferencesPanelInfo* _tmp18_;
	FtPreferencesPanelInfo* _tmp19_;
	GListStore* _tmp20_;
	FtPreferencesPanelInfo* _tmp21_;
	FtPreferencesPanelInfo* _tmp22_;
	FtPreferencesPanelInfo* _tmp23_;
	FtPreferencesPanelInfo* _tmp24_;
	FtPreferencesPanelInfo* _tmp25_;
	FtPreferencesPanelInfo* _tmp26_;
	GListStore* _tmp27_;
	FtPreferencesPanelInfo* _tmp28_;
	FtPreferencesPanelInfo* _tmp29_;
	FtPreferencesPanelInfo* _tmp30_;
	FtPreferencesPanelInfo* _tmp31_;
	FtPreferencesPanelInfo* _tmp32_;
	FtPreferencesPanelInfo* _tmp33_;
	GListStore* _tmp34_;
	FtPreferencesPanelInfo* _tmp35_;
	FtKeyboardManager* keyboard_manager = NULL;
	FtKeyboardManager* _tmp36_;
	FtPreferencesPanelInfo* _tmp37_;
	FtPreferencesPanelInfo* _tmp38_;
	FtPreferencesPanelInfo* _tmp39_;
	FtPreferencesPanelInfo* _tmp40_;
	FtPreferencesPanelInfo* _tmp41_;
	FtPreferencesPanelInfo* _tmp42_;
	GListStore* _tmp43_;
	FtPreferencesPanelInfo* _tmp44_;
	FtPreferencesPanelInfo* _tmp45_;
	FtPreferencesPanelInfo* _tmp46_;
	FtPreferencesPanelInfo* _tmp47_;
	FtPreferencesPanelInfo* _tmp48_;
	FtPreferencesPanelInfo* _tmp49_;
	GListStore* _tmp50_;
	FtPreferencesPanelInfo* _tmp51_;
	GListStore* _tmp52_;
	GtkSingleSelection* _tmp53_;
	GtkSingleSelection* result;
	_tmp0_ = g_list_store_new (FT_TYPE_PREFERENCES_PANEL_INFO);
	model = _tmp0_;
	_tmp1_ = ft_preferences_panel_info_new ();
	_g_object_unref0 (panel_info);
	panel_info = _tmp1_;
	_tmp2_ = panel_info;
	ft_preferences_panel_info_set_name (_tmp2_, "timer");
	_tmp3_ = panel_info;
	ft_preferences_panel_info_set_title (_tmp3_, _ ("Timer"));
	_tmp4_ = panel_info;
	ft_preferences_panel_info_set_icon_name (_tmp4_, "timer-symbolic");
	_tmp5_ = panel_info;
	ft_preferences_panel_info_set_content_class (_tmp5_, FT_TYPE_PREFERENCES_PANEL_TIMER);
	_tmp6_ = model;
	_tmp7_ = panel_info;
	g_list_store_append (_tmp6_, (GObject*) _tmp7_);
	_tmp8_ = ft_preferences_panel_info_new ();
	_g_object_unref0 (panel_info);
	panel_info = _tmp8_;
	_tmp9_ = panel_info;
	ft_preferences_panel_info_set_name (_tmp9_, "notifications");
	_tmp10_ = panel_info;
	ft_preferences_panel_info_set_title (_tmp10_, _ ("Notifications"));
	_tmp11_ = panel_info;
	ft_preferences_panel_info_set_icon_name (_tmp11_, "preferences-notifications-symbolic");
	_tmp12_ = panel_info;
	ft_preferences_panel_info_set_content_class (_tmp12_, FT_TYPE_PREFERENCES_PANEL_NOTIFICATIONS);
	_tmp13_ = model;
	_tmp14_ = panel_info;
	g_list_store_append (_tmp13_, (GObject*) _tmp14_);
	_tmp15_ = ft_preferences_panel_info_new ();
	_g_object_unref0 (panel_info);
	panel_info = _tmp15_;
	_tmp16_ = panel_info;
	ft_preferences_panel_info_set_name (_tmp16_, "sounds");
	_tmp17_ = panel_info;
	ft_preferences_panel_info_set_title (_tmp17_, _ ("Sounds"));
	_tmp18_ = panel_info;
	ft_preferences_panel_info_set_icon_name (_tmp18_, "preferences-sounds-symbolic");
	_tmp19_ = panel_info;
	ft_preferences_panel_info_set_content_class (_tmp19_, FT_TYPE_PREFERENCES_PANEL_SOUNDS);
	_tmp20_ = model;
	_tmp21_ = panel_info;
	g_list_store_append (_tmp20_, (GObject*) _tmp21_);
	_tmp22_ = ft_preferences_panel_info_new ();
	_g_object_unref0 (panel_info);
	panel_info = _tmp22_;
	_tmp23_ = panel_info;
	ft_preferences_panel_info_set_name (_tmp23_, "appearance");
	_tmp24_ = panel_info;
	ft_preferences_panel_info_set_title (_tmp24_, _ ("Appearance"));
	_tmp25_ = panel_info;
	ft_preferences_panel_info_set_icon_name (_tmp25_, "preferences-appearance-symbolic");
	_tmp26_ = panel_info;
	ft_preferences_panel_info_set_content_class (_tmp26_, FT_TYPE_PREFERENCES_PANEL_APPEARANCE);
	_tmp27_ = model;
	_tmp28_ = panel_info;
	g_list_store_append (_tmp27_, (GObject*) _tmp28_);
	_tmp29_ = ft_preferences_panel_info_new ();
	_g_object_unref0 (panel_info);
	panel_info = _tmp29_;
	_tmp30_ = panel_info;
	ft_preferences_panel_info_set_name (_tmp30_, "keyboard-shortcuts");
	_tmp31_ = panel_info;
	ft_preferences_panel_info_set_title (_tmp31_, _ ("Keyboard Shortcuts"));
	_tmp32_ = panel_info;
	ft_preferences_panel_info_set_icon_name (_tmp32_, "preferences-keyboard-shortcuts-symbolic");
	_tmp33_ = panel_info;
	ft_preferences_panel_info_set_content_class (_tmp33_, FT_TYPE_PREFERENCES_PANEL_KEYBOARD_SHORTCUTS);
	_tmp34_ = model;
	_tmp35_ = panel_info;
	g_list_store_append (_tmp34_, (GObject*) _tmp35_);
	_tmp36_ = ft_keyboard_manager_new ();
	keyboard_manager = _tmp36_;
	_tmp37_ = panel_info;
	g_object_bind_property_with_closures ((GObject*) keyboard_manager, "global-shortcuts-supported", (GObject*) _tmp37_, "visible", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp38_ = ft_preferences_panel_info_new ();
	_g_object_unref0 (panel_info);
	panel_info = _tmp38_;
	_tmp39_ = panel_info;
	ft_preferences_panel_info_set_name (_tmp39_, "integrations");
	_tmp40_ = panel_info;
	ft_preferences_panel_info_set_title (_tmp40_, _ ("Integrations"));
	_tmp41_ = panel_info;
	ft_preferences_panel_info_set_icon_name (_tmp41_, "plugin-symbolic");
	_tmp42_ = panel_info;
	ft_preferences_panel_info_set_content_class (_tmp42_, FT_TYPE_PREFERENCES_PANEL_INTEGRATIONS);
	_tmp43_ = model;
	_tmp44_ = panel_info;
	g_list_store_append (_tmp43_, (GObject*) _tmp44_);
	_tmp45_ = ft_preferences_panel_info_new ();
	_g_object_unref0 (panel_info);
	panel_info = _tmp45_;
	_tmp46_ = panel_info;
	ft_preferences_panel_info_set_name (_tmp46_, "automation");
	_tmp47_ = panel_info;
	ft_preferences_panel_info_set_title (_tmp47_, _ ("Automation"));
	_tmp48_ = panel_info;
	ft_preferences_panel_info_set_icon_name (_tmp48_, "custom-action-symbolic");
	_tmp49_ = panel_info;
	ft_preferences_panel_info_set_content_class (_tmp49_, FT_TYPE_PREFERENCES_PANEL_AUTOMATION);
	_tmp50_ = model;
	_tmp51_ = panel_info;
	g_list_store_append (_tmp50_, (GObject*) _tmp51_);
	_tmp52_ = model;
	model = NULL;
	_tmp53_ = gtk_single_selection_new ((GListModel*) _tmp52_);
	result = _tmp53_;
	_g_object_unref0 (keyboard_manager);
	_g_object_unref0 (model);
	_g_object_unref0 (panel_info);
	return result;
}

static AdwPreferencesPage*
ft_preferences_panel_real_get_preferences_page (FtPreferencesPanel* self)
{
	g_critical ("Type `%s' does not implement abstract method `ft_preferences_panel_get_preferences_page'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

AdwPreferencesPage*
ft_preferences_panel_get_preferences_page (FtPreferencesPanel* self)
{
	FtPreferencesPanelClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = FT_PREFERENCES_PANEL_GET_CLASS (self);
	if (_klass_->get_preferences_page) {
		return _klass_->get_preferences_page (self);
	}
	return NULL;
}

FtPreferencesPanel*
ft_preferences_panel_construct (GType object_type)
{
	FtPreferencesPanel * self = NULL;
	self = (FtPreferencesPanel*) g_object_new (object_type, NULL);
	return self;
}

static void
ft_preferences_panel_class_init (FtPreferencesPanelClass * klass,
                                 gpointer klass_data)
{
	ft_preferences_panel_parent_class = g_type_class_peek_parent (klass);
	((FtPreferencesPanelClass *) klass)->get_preferences_page = (AdwPreferencesPage* (*) (FtPreferencesPanel*)) ft_preferences_panel_real_get_preferences_page;
}

static void
ft_preferences_panel_instance_init (FtPreferencesPanel * self,
                                    gpointer klass)
{
}

static GType
ft_preferences_panel_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtPreferencesPanelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_preferences_panel_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtPreferencesPanel), 0, (GInstanceInitFunc) ft_preferences_panel_instance_init, NULL };
	GType ft_preferences_panel_type_id;
	ft_preferences_panel_type_id = g_type_register_static (adw_navigation_page_get_type (), "FtPreferencesPanel", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	return ft_preferences_panel_type_id;
}

GType
ft_preferences_panel_get_type (void)
{
	static volatile gsize ft_preferences_panel_type_id__once = 0;
	if (g_once_init_enter (&ft_preferences_panel_type_id__once)) {
		GType ft_preferences_panel_type_id;
		ft_preferences_panel_type_id = ft_preferences_panel_get_type_once ();
		g_once_init_leave (&ft_preferences_panel_type_id__once, ft_preferences_panel_type_id);
	}
	return ft_preferences_panel_type_id__once;
}

static inline gpointer
ft_preferences_window_get_instance_private (FtPreferencesWindow* self)
{
	return G_STRUCT_MEMBER_P (self, FtPreferencesWindow_private_offset);
}

static void
ft_preferences_window_load_window_state (FtPreferencesWindow* self)
{
	gint current_width = 0;
	gint current_height = 0;
	gboolean maximized = FALSE;
	GSettings* _tmp0_;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	g_return_if_fail (self != NULL);
	current_width = -1;
	current_height = -1;
	maximized = FALSE;
	_tmp0_ = self->priv->settings;
	g_settings_get (_tmp0_, "preferences-window-state", "(iib)", &_tmp1_, &_tmp2_, &_tmp3_);
	current_width = _tmp1_;
	current_height = _tmp2_;
	maximized = _tmp3_;
	if (current_width != -1) {
		_tmp4_ = current_height != -1;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		gtk_window_set_default_size ((GtkWindow*) self, current_width, current_height);
	}
	if (maximized) {
		gtk_window_maximize ((GtkWindow*) self);
	}
}

static void
ft_preferences_window_save_window_state (FtPreferencesWindow* self)
{
	gint current_width = 0;
	gint current_height = 0;
	gboolean maximized = FALSE;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	GSettings* _tmp2_;
	g_return_if_fail (self != NULL);
	current_width = -1;
	current_height = -1;
	maximized = gtk_window_is_maximized ((GtkWindow*) self);
	gtk_window_get_default_size ((GtkWindow*) self, &_tmp0_, &_tmp1_);
	current_width = _tmp0_;
	current_height = _tmp1_;
	_tmp2_ = self->priv->settings;
	g_settings_set (_tmp2_, "preferences-window-state", "(iib)", current_width, current_height, maximized);
}

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

static void
ft_preferences_window_update_split_view_content (FtPreferencesWindow* self)
{
	FtPreferencesPanelInfo* panel_info = NULL;
	GtkSingleSelection* _tmp0_;
	GObject* _tmp1_;
	GObject* _tmp2_;
	FtPreferencesPanelInfo* _tmp3_;
	FtPreferencesPanelInfo* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_model;
	_tmp1_ = gtk_single_selection_get_selected_item (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, FT_TYPE_PREFERENCES_PANEL_INFO, FtPreferencesPanelInfo));
	panel_info = _tmp3_;
	_tmp4_ = panel_info;
	if (_tmp4_ != NULL) {
		FtPreferencesPanel* panel = NULL;
		FtPreferencesPanelInfo* _tmp5_;
		GType _tmp6_;
		GType _tmp7_;
		FtPreferencesPanelInfo* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		FtPreferencesPanelInfo* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		GObject* _tmp14_;
		GObject* _tmp15_;
		AdwNavigationSplitView* _tmp16_;
		FtPreferencesPanel* _tmp17_;
		AdwNavigationSplitView* _tmp18_;
		_tmp5_ = panel_info;
		_tmp6_ = ft_preferences_panel_info_get_content_class (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = panel_info;
		_tmp9_ = ft_preferences_panel_info_get_name (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = panel_info;
		_tmp12_ = ft_preferences_panel_info_get_title (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = g_object_new (_tmp7_, "tag", _tmp10_, "title", _tmp13_, NULL);
		_tmp15_ = G_IS_INITIALLY_UNOWNED (_tmp14_) ? g_object_ref_sink (_tmp14_) : _tmp14_;
		panel = G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, FT_TYPE_PREFERENCES_PANEL, FtPreferencesPanel);
		_tmp16_ = self->priv->split_view;
		_tmp17_ = panel;
		adw_navigation_split_view_set_content (_tmp16_, (AdwNavigationPage*) _tmp17_);
		_tmp18_ = self->priv->split_view;
		adw_navigation_split_view_set_show_content (_tmp18_, TRUE);
		g_object_notify ((GObject*) self, "visible-panel");
		_g_object_unref0 (panel);
	} else {
		AdwNavigationSplitView* _tmp19_;
		_tmp19_ = self->priv->split_view;
		adw_navigation_split_view_set_show_content (_tmp19_, FALSE);
	}
	_g_object_unref0 (panel_info);
}

static void
ft_preferences_window_setup_extension (FtPreferencesWindow* self,
                                       GObject* object)
{
	FtPreferencesWindowExtension* extension = NULL;
	FtPreferencesWindowExtension* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_PREFERENCES_WINDOW_EXTENSION, FtPreferencesWindowExtension));
	extension = _tmp0_;
	ft_preferences_window_extension_set_window (extension, self);
	_g_object_unref0 (extension);
}

static void
ft_preferences_window_on_split_view_collapsed_notify (FtPreferencesWindow* self)
{
	GtkSelectionMode _tmp0_ = 0;
	AdwNavigationSplitView* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	FtPreferencesSidebar* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->split_view;
	_tmp2_ = adw_navigation_split_view_get_collapsed (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		_tmp0_ = GTK_SELECTION_NONE;
	} else {
		_tmp0_ = GTK_SELECTION_SINGLE;
	}
	_tmp4_ = self->priv->sidebar;
	ft_preferences_sidebar_set_selection_mode (_tmp4_, _tmp0_);
}

static void
ft_preferences_window_on_selection_changed (FtPreferencesWindow* self,
                                            guint position,
                                            guint n_items)
{
	g_return_if_fail (self != NULL);
	ft_preferences_window_update_split_view_content (self);
}

static void
ft_preferences_window_on_extension_added (FtPreferencesWindow* self,
                                          PeasExtensionSet* extension_set,
                                          PeasPluginInfo* plugin_info,
                                          GObject* object)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (extension_set != NULL);
	g_return_if_fail (plugin_info != NULL);
	g_return_if_fail (object != NULL);
	ft_preferences_window_setup_extension (self, object);
}

gboolean
ft_preferences_window_select_panel (FtPreferencesWindow* self,
                                    const gchar* panel_name)
{
	guint n_items = 0U;
	GtkSingleSelection* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (panel_name != NULL, FALSE);
	_tmp0_ = self->priv->_model;
	n_items = g_list_model_get_n_items ((GListModel*) _tmp0_);
	{
		guint position = 0U;
		position = 0U;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				FtPreferencesPanelInfo* panel_info = NULL;
				GtkSingleSelection* _tmp3_;
				GObject* _tmp4_;
				FtPreferencesPanelInfo* _tmp5_;
				const gchar* _tmp6_;
				const gchar* _tmp7_;
				if (!_tmp1_) {
					guint _tmp2_;
					_tmp2_ = position;
					position = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(position < n_items)) {
					break;
				}
				_tmp3_ = self->priv->_model;
				_tmp4_ = g_list_model_get_item ((GListModel*) _tmp3_, position);
				panel_info = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, FT_TYPE_PREFERENCES_PANEL_INFO, FtPreferencesPanelInfo);
				_tmp5_ = panel_info;
				_tmp6_ = ft_preferences_panel_info_get_name (_tmp5_);
				_tmp7_ = _tmp6_;
				if (g_strcmp0 (_tmp7_, panel_name) == 0) {
					GtkSingleSelection* _tmp8_;
					_tmp8_ = self->priv->_model;
					gtk_selection_model_select_item ((GtkSelectionModel*) _tmp8_, position, TRUE);
					result = TRUE;
					_g_object_unref0 (panel_info);
					return result;
				}
				_g_object_unref0 (panel_info);
			}
		}
	}
	result = FALSE;
	return result;
}

void
ft_preferences_window_add_toast (FtPreferencesWindow* self,
                                 AdwToast* toast)
{
	AdwToastOverlay* _tmp0_;
	AdwToast* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (toast != NULL);
	_tmp0_ = self->priv->toast_overlay;
	_tmp1_ = _g_object_ref0 (toast);
	adw_toast_overlay_add_toast (_tmp0_, _tmp1_);
	_g_object_unref0 (toast);
}

static void
ft_preferences_window_real_unmap (GtkWidget* base)
{
	FtPreferencesWindow * self;
	self = (FtPreferencesWindow*) base;
	ft_preferences_window_save_window_state (self);
	GTK_WIDGET_CLASS (ft_preferences_window_parent_class)->unmap ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_application_window_get_type (), AdwApplicationWindow));
}

static void
_ft_preferences_window_on_selection_changed_gtk_selection_model_selection_changed (GtkSelectionModel* _sender,
                                                                                   guint position,
                                                                                   guint n_items,
                                                                                   gpointer self)
{
	ft_preferences_window_on_selection_changed ((FtPreferencesWindow*) self, position, n_items);
}

static void
ft_preferences_window_real_dispose (GObject* base)
{
	FtPreferencesWindow * self;
	GtkSingleSelection* _tmp0_;
	self = (FtPreferencesWindow*) base;
	_tmp0_ = self->priv->_model;
	if (_tmp0_ != NULL) {
		GtkSingleSelection* _tmp1_;
		guint _tmp2_;
		_tmp1_ = self->priv->_model;
		g_signal_parse_name ("selection-changed", gtk_selection_model_get_type (), &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched ((GtkSelectionModel*) _tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _ft_preferences_window_on_selection_changed_gtk_selection_model_selection_changed, self);
		_g_object_unref0 (self->priv->_model);
		self->priv->_model = NULL;
	}
	_g_object_unref0 (self->priv->extensions);
	self->priv->extensions = NULL;
	G_OBJECT_CLASS (ft_preferences_window_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, adw_application_window_get_type (), AdwApplicationWindow));
}

FtPreferencesWindow*
ft_preferences_window_construct (GType object_type)
{
	FtPreferencesWindow * self = NULL;
	self = (FtPreferencesWindow*) g_object_new (object_type, NULL);
	return self;
}

FtPreferencesWindow*
ft_preferences_window_new (void)
{
	return ft_preferences_window_construct (FT_TYPE_PREFERENCES_WINDOW);
}

GtkSingleSelection*
ft_preferences_window_get_model (FtPreferencesWindow* self)
{
	GtkSingleSelection* result;
	GtkSingleSelection* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_model;
	result = _tmp0_;
	return result;
}

static void
ft_preferences_window_set_model (FtPreferencesWindow* self,
                                 GtkSingleSelection* value)
{
	GtkSingleSelection* _tmp0_;
	GtkSingleSelection* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ft_create_model ();
	_g_object_unref0 (self->priv->_model);
	self->priv->_model = _tmp0_;
	_tmp1_ = self->priv->_model;
	g_signal_connect_object ((GtkSelectionModel*) _tmp1_, "selection-changed", (GCallback) _ft_preferences_window_on_selection_changed_gtk_selection_model_selection_changed, self, 0);
	g_object_notify_by_pspec ((GObject *) self, ft_preferences_window_properties[FT_PREFERENCES_WINDOW_MODEL_PROPERTY]);
}

FtPreferencesPanel*
ft_preferences_window_get_visible_panel (FtPreferencesWindow* self)
{
	FtPreferencesPanel* result;
	AdwNavigationSplitView* _tmp0_;
	AdwNavigationPage* _tmp1_;
	AdwNavigationPage* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->split_view;
	_tmp1_ = adw_navigation_split_view_get_content (_tmp0_);
	_tmp2_ = _tmp1_;
	result = FT_IS_PREFERENCES_PANEL (_tmp2_) ? ((FtPreferencesPanel*) _tmp2_) : NULL;
	return result;
}

static void
_ft_preferences_window_on_split_view_collapsed_notify_g_object_notify (GObject* _sender,
                                                                       GParamSpec* pspec,
                                                                       gpointer self)
{
	ft_preferences_window_on_split_view_collapsed_notify ((FtPreferencesWindow*) self);
}

static void
_vala_GValue_array_free (GValue * array,
                         gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			g_value_unset (&array[i]);
		}
	}
	g_free (array);
}

static void
_ft_preferences_window_on_extension_added_peas_extension_set_extension_added (PeasExtensionSet* _sender,
                                                                              PeasPluginInfo* info,
                                                                              GObject* extension,
                                                                              gpointer self)
{
	ft_preferences_window_on_extension_added ((FtPreferencesWindow*) self, _sender, info, extension);
}

static void
_ft_preferences_window___lambda85_ (FtPreferencesWindow* self,
                                    GObject* object)
{
	g_return_if_fail (object != NULL);
	ft_preferences_window_setup_extension (self, object);
}

static void
__ft_preferences_window___lambda85__ft_extension_set_foreach_func (GObject* object,
                                                                   gpointer self)
{
	_ft_preferences_window___lambda85_ ((FtPreferencesWindow*) self, object);
}

static GObject *
ft_preferences_window_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtPreferencesWindow * self;
	GSettings* _tmp0_;
	GSettings* _tmp1_;
	FtPreferencesSidebar* _tmp2_;
	GtkSingleSelection* _tmp3_;
	AdwNavigationSplitView* _tmp4_;
	PeasEngine* _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	GValue* _tmp8_;
	GValue* _tmp9_;
	gint _tmp9__length1;
	PeasExtensionSet* _tmp10_;
	PeasExtensionSet* _tmp11_;
	PeasExtensionSet* _tmp12_;
	parent_class = G_OBJECT_CLASS (ft_preferences_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_PREFERENCES_WINDOW, FtPreferencesWindow);
	_tmp0_ = ft_get_settings ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp1_;
	_tmp2_ = self->priv->sidebar;
	_tmp3_ = self->priv->_model;
	ft_preferences_sidebar_set_model (_tmp2_, _tmp3_);
	_tmp4_ = self->priv->split_view;
	g_signal_connect_object ((GObject*) _tmp4_, "notify::collapsed", (GCallback) _ft_preferences_window_on_split_view_collapsed_notify_g_object_notify, self, 0);
	ft_preferences_window_load_window_state (self);
	ft_preferences_window_update_split_view_content (self);
	_tmp5_ = peas_engine_get_default ();
	_tmp6_ = g_new0 (gchar*, 0 + 1);
	_tmp7_ = _tmp6_;
	_tmp7__length1 = 0;
	_tmp8_ = g_new0 (GValue, 0);
	_tmp9_ = _tmp8_;
	_tmp9__length1 = 0;
	_tmp10_ = peas_extension_set_new_with_properties (_tmp5_, FT_TYPE_PREFERENCES_WINDOW_EXTENSION, 0, _tmp7_, _tmp9_);
	_g_object_unref0 (self->priv->extensions);
	self->priv->extensions = _tmp10_;
	_tmp9_ = (_vala_GValue_array_free (_tmp9_, _tmp9__length1), NULL);
	_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL);
	_tmp11_ = self->priv->extensions;
	g_signal_connect_object (_tmp11_, "extension-added", (GCallback) _ft_preferences_window_on_extension_added_peas_extension_set_extension_added, self, 0);
	_tmp12_ = self->priv->extensions;
	ft_foreach_extension (_tmp12_, __ft_preferences_window___lambda85__ft_extension_set_foreach_func, self);
	return obj;
}

static void
ft_preferences_window_class_init (FtPreferencesWindowClass * klass,
                                  gpointer klass_data)
{
	ft_preferences_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtPreferencesWindow_private_offset);
	((GtkWidgetClass *) klass)->unmap = (void (*) (GtkWidget*)) ft_preferences_window_real_unmap;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) ft_preferences_window_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_preferences_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_preferences_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_preferences_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_preferences_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_PREFERENCES_WINDOW_MODEL_PROPERTY, ft_preferences_window_properties[FT_PREFERENCES_WINDOW_MODEL_PROPERTY] = g_param_spec_object ("model", "model", "model", gtk_single_selection_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_PREFERENCES_WINDOW_VISIBLE_PANEL_PROPERTY, ft_preferences_window_properties[FT_PREFERENCES_WINDOW_VISIBLE_PANEL_PROPERTY] = g_param_spec_object ("visible-panel", "visible-panel", "visible-panel", FT_TYPE_PREFERENCES_PANEL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/io/github/focustimerhq/FocusTimer/ui/preferences/preferences-window.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "toast_overlay", FALSE, FtPreferencesWindow_private_offset + G_STRUCT_OFFSET (FtPreferencesWindowPrivate, toast_overlay));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "split_view", FALSE, FtPreferencesWindow_private_offset + G_STRUCT_OFFSET (FtPreferencesWindowPrivate, split_view));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "sidebar", FALSE, FtPreferencesWindow_private_offset + G_STRUCT_OFFSET (FtPreferencesWindowPrivate, sidebar));
}

static void
ft_preferences_window_gtk_buildable_interface_init (GtkBuildableIface * iface,
                                                    gpointer iface_data)
{
	ft_preferences_window_gtk_buildable_parent_iface = g_type_interface_peek_parent (iface);
}

static void
ft_preferences_window_instance_init (FtPreferencesWindow * self,
                                     gpointer klass)
{
	self->priv = ft_preferences_window_get_instance_private (self);
	self->priv->_model = NULL;
	self->priv->settings = NULL;
	self->priv->extensions = NULL;
	g_type_ensure (FT_TYPE_PREFERENCES_SIDEBAR);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
ft_preferences_window_finalize (GObject * obj)
{
	FtPreferencesWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_PREFERENCES_WINDOW, FtPreferencesWindow);
	_g_object_unref0 (self->priv->_model);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->extensions);
	G_OBJECT_CLASS (ft_preferences_window_parent_class)->finalize (obj);
}

static GType
ft_preferences_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtPreferencesWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_preferences_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtPreferencesWindow), 0, (GInstanceInitFunc) ft_preferences_window_instance_init, NULL };
	static const GInterfaceInfo gtk_buildable_info = { (GInterfaceInitFunc) ft_preferences_window_gtk_buildable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType ft_preferences_window_type_id;
	ft_preferences_window_type_id = g_type_register_static (adw_application_window_get_type (), "FtPreferencesWindow", &g_define_type_info, 0);
	g_type_add_interface_static (ft_preferences_window_type_id, gtk_buildable_get_type (), &gtk_buildable_info);
	FtPreferencesWindow_private_offset = g_type_add_instance_private (ft_preferences_window_type_id, sizeof (FtPreferencesWindowPrivate));
	return ft_preferences_window_type_id;
}

GType
ft_preferences_window_get_type (void)
{
	static volatile gsize ft_preferences_window_type_id__once = 0;
	if (g_once_init_enter (&ft_preferences_window_type_id__once)) {
		GType ft_preferences_window_type_id;
		ft_preferences_window_type_id = ft_preferences_window_get_type_once ();
		g_once_init_leave (&ft_preferences_window_type_id__once, ft_preferences_window_type_id);
	}
	return ft_preferences_window_type_id__once;
}

static void
_vala_ft_preferences_window_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	FtPreferencesWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_PREFERENCES_WINDOW, FtPreferencesWindow);
	switch (property_id) {
		case FT_PREFERENCES_WINDOW_MODEL_PROPERTY:
		g_value_set_object (value, ft_preferences_window_get_model (self));
		break;
		case FT_PREFERENCES_WINDOW_VISIBLE_PANEL_PROPERTY:
		g_value_set_object (value, ft_preferences_window_get_visible_panel (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_preferences_window_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	FtPreferencesWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_PREFERENCES_WINDOW, FtPreferencesWindow);
	switch (property_id) {
		case FT_PREFERENCES_WINDOW_MODEL_PROPERTY:
		ft_preferences_window_set_model (self, g_value_get_object (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);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

