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

/*
 * Copyright © 2025 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 <gee.h>
#include <glib.h>
#include <stdlib.h>
#include <string.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 DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE (dialogs_preferences_pages_base_page_get_type ())
#define DIALOGS_PREFERENCES_PAGES_BASE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE, DialogsPreferencesPagesBasePage))
#define DIALOGS_PREFERENCES_PAGES_BASE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE, DialogsPreferencesPagesBasePageClass))
#define DIALOGS_PREFERENCES_PAGES_IS_BASE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE))
#define DIALOGS_PREFERENCES_PAGES_IS_BASE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE))
#define DIALOGS_PREFERENCES_PAGES_BASE_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE, DialogsPreferencesPagesBasePageClass))

typedef struct _DialogsPreferencesPagesBasePage DialogsPreferencesPagesBasePage;
typedef struct _DialogsPreferencesPagesBasePageClass DialogsPreferencesPagesBasePageClass;
typedef struct _DialogsPreferencesPagesBasePagePrivate DialogsPreferencesPagesBasePagePrivate;
enum  {
	DIALOGS_PREFERENCES_PAGES_BASE_PAGE_0_PROPERTY,
	DIALOGS_PREFERENCES_PAGES_BASE_PAGE_PREFERENCES_DIALOG_PROPERTY,
	DIALOGS_PREFERENCES_PAGES_BASE_PAGE_NUM_PROPERTIES
};
static GParamSpec* dialogs_preferences_pages_base_page_properties[DIALOGS_PREFERENCES_PAGES_BASE_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _DialogsPreferencesPagesBasePage {
	AdwNavigationPage parent_instance;
	DialogsPreferencesPagesBasePagePrivate * priv;
	GeeHashMap* signal_map;
};

struct _DialogsPreferencesPagesBasePageClass {
	AdwNavigationPageClass parent_class;
	void (*clean_up) (DialogsPreferencesPagesBasePage* self);
};

struct _DialogsPreferencesPagesBasePagePrivate {
	AdwPreferencesDialog* _preferences_dialog;
};

static gint DialogsPreferencesPagesBasePage_private_offset;
static gpointer dialogs_preferences_pages_base_page_parent_class = NULL;

VALA_EXTERN GType dialogs_preferences_pages_base_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsPreferencesPagesBasePage, g_object_unref)
VALA_EXTERN void dialogs_preferences_pages_base_page_clean_up (DialogsPreferencesPagesBasePage* self);
static void dialogs_preferences_pages_base_page_real_clean_up (DialogsPreferencesPagesBasePage* self);
VALA_EXTERN void dialogs_preferences_pages_base_page_popup_toast (DialogsPreferencesPagesBasePage* self,
                                                      const gchar* message);
VALA_EXTERN AdwPreferencesDialog* dialogs_preferences_pages_base_page_get_preferences_dialog (DialogsPreferencesPagesBasePage* self);
VALA_EXTERN DialogsPreferencesPagesBasePage* dialogs_preferences_pages_base_page_new (void);
VALA_EXTERN DialogsPreferencesPagesBasePage* dialogs_preferences_pages_base_page_construct (GType object_type);
static void dialogs_preferences_pages_base_page_set_preferences_dialog (DialogsPreferencesPagesBasePage* self,
                                                                 AdwPreferencesDialog* value);
static void dialogs_preferences_pages_base_page_finalize (GObject * obj);
static GType dialogs_preferences_pages_base_page_get_type_once (void);
static void _vala_dialogs_preferences_pages_base_page_get_property (GObject * object,
                                                             guint property_id,
                                                             GValue * value,
                                                             GParamSpec * pspec);
static void _vala_dialogs_preferences_pages_base_page_set_property (GObject * object,
                                                             guint property_id,
                                                             const GValue * value,
                                                             GParamSpec * pspec);

static inline gpointer
dialogs_preferences_pages_base_page_get_instance_private (DialogsPreferencesPagesBasePage* self)
{
	return G_STRUCT_MEMBER_P (self, DialogsPreferencesPagesBasePage_private_offset);
}

static void
dialogs_preferences_pages_base_page_real_clean_up (DialogsPreferencesPagesBasePage* self)
{
	GeeHashMap* _tmp15_;
	{
		GeeIterator* _entry_it = NULL;
		GeeHashMap* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->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->signal_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp15_);
}

void
dialogs_preferences_pages_base_page_clean_up (DialogsPreferencesPagesBasePage* self)
{
	DialogsPreferencesPagesBasePageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = DIALOGS_PREFERENCES_PAGES_BASE_PAGE_GET_CLASS (self);
	if (_klass_->clean_up) {
		_klass_->clean_up (self);
	}
}

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

void
dialogs_preferences_pages_base_page_popup_toast (DialogsPreferencesPagesBasePage* self,
                                                 const gchar* message)
{
	AdwToast* toast = NULL;
	AdwToast* _tmp0_;
	AdwToast* _tmp1_;
	AdwPreferencesDialog* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = adw_toast_new (message);
	toast = _tmp0_;
	_tmp1_ = toast;
	adw_toast_set_timeout (_tmp1_, (guint) 3);
	_tmp2_ = self->priv->_preferences_dialog;
	if (_tmp2_ != NULL) {
		AdwPreferencesDialog* _tmp3_;
		AdwToast* _tmp4_;
		AdwToast* _tmp5_;
		_tmp3_ = self->priv->_preferences_dialog;
		_tmp4_ = toast;
		_tmp5_ = _g_object_ref0 (_tmp4_);
		adw_preferences_dialog_add_toast (_tmp3_, _tmp5_);
	}
	_g_object_unref0 (toast);
}

DialogsPreferencesPagesBasePage*
dialogs_preferences_pages_base_page_construct (GType object_type)
{
	DialogsPreferencesPagesBasePage * self = NULL;
	self = (DialogsPreferencesPagesBasePage*) g_object_new (object_type, NULL);
	return self;
}

DialogsPreferencesPagesBasePage*
dialogs_preferences_pages_base_page_new (void)
{
	return dialogs_preferences_pages_base_page_construct (DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE);
}

AdwPreferencesDialog*
dialogs_preferences_pages_base_page_get_preferences_dialog (DialogsPreferencesPagesBasePage* self)
{
	AdwPreferencesDialog* result;
	AdwPreferencesDialog* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_preferences_dialog;
	result = _tmp0_;
	return result;
}

static void
dialogs_preferences_pages_base_page_set_preferences_dialog (DialogsPreferencesPagesBasePage* self,
                                                            AdwPreferencesDialog* value)
{
	AdwPreferencesDialog* old_value;
	g_return_if_fail (self != NULL);
	old_value = dialogs_preferences_pages_base_page_get_preferences_dialog (self);
	if (old_value != value) {
		AdwPreferencesDialog* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_preferences_dialog);
		self->priv->_preferences_dialog = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dialogs_preferences_pages_base_page_properties[DIALOGS_PREFERENCES_PAGES_BASE_PAGE_PREFERENCES_DIALOG_PROPERTY]);
	}
}

static void
dialogs_preferences_pages_base_page_class_init (DialogsPreferencesPagesBasePageClass * klass,
                                                gpointer klass_data)
{
	dialogs_preferences_pages_base_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DialogsPreferencesPagesBasePage_private_offset);
	((DialogsPreferencesPagesBasePageClass *) klass)->clean_up = (void (*) (DialogsPreferencesPagesBasePage*)) dialogs_preferences_pages_base_page_real_clean_up;
	G_OBJECT_CLASS (klass)->get_property = _vala_dialogs_preferences_pages_base_page_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dialogs_preferences_pages_base_page_set_property;
	G_OBJECT_CLASS (klass)->finalize = dialogs_preferences_pages_base_page_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DIALOGS_PREFERENCES_PAGES_BASE_PAGE_PREFERENCES_DIALOG_PROPERTY, dialogs_preferences_pages_base_page_properties[DIALOGS_PREFERENCES_PAGES_BASE_PAGE_PREFERENCES_DIALOG_PROPERTY] = g_param_spec_object ("preferences-dialog", "preferences-dialog", "preferences-dialog", adw_preferences_dialog_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
dialogs_preferences_pages_base_page_instance_init (DialogsPreferencesPagesBasePage * self,
                                                   gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = dialogs_preferences_pages_base_page_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->signal_map = _tmp0_;
}

static void
dialogs_preferences_pages_base_page_finalize (GObject * obj)
{
	DialogsPreferencesPagesBasePage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE, DialogsPreferencesPagesBasePage);
	_g_object_unref0 (self->priv->_preferences_dialog);
	_g_object_unref0 (self->signal_map);
	G_OBJECT_CLASS (dialogs_preferences_pages_base_page_parent_class)->finalize (obj);
}

static GType
dialogs_preferences_pages_base_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DialogsPreferencesPagesBasePageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dialogs_preferences_pages_base_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DialogsPreferencesPagesBasePage), 0, (GInstanceInitFunc) dialogs_preferences_pages_base_page_instance_init, NULL };
	GType dialogs_preferences_pages_base_page_type_id;
	dialogs_preferences_pages_base_page_type_id = g_type_register_static (adw_navigation_page_get_type (), "DialogsPreferencesPagesBasePage", &g_define_type_info, 0);
	DialogsPreferencesPagesBasePage_private_offset = g_type_add_instance_private (dialogs_preferences_pages_base_page_type_id, sizeof (DialogsPreferencesPagesBasePagePrivate));
	return dialogs_preferences_pages_base_page_type_id;
}

GType
dialogs_preferences_pages_base_page_get_type (void)
{
	static volatile gsize dialogs_preferences_pages_base_page_type_id__once = 0;
	if (g_once_init_enter (&dialogs_preferences_pages_base_page_type_id__once)) {
		GType dialogs_preferences_pages_base_page_type_id;
		dialogs_preferences_pages_base_page_type_id = dialogs_preferences_pages_base_page_get_type_once ();
		g_once_init_leave (&dialogs_preferences_pages_base_page_type_id__once, dialogs_preferences_pages_base_page_type_id);
	}
	return dialogs_preferences_pages_base_page_type_id__once;
}

static void
_vala_dialogs_preferences_pages_base_page_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec)
{
	DialogsPreferencesPagesBasePage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE, DialogsPreferencesPagesBasePage);
	switch (property_id) {
		case DIALOGS_PREFERENCES_PAGES_BASE_PAGE_PREFERENCES_DIALOG_PROPERTY:
		g_value_set_object (value, dialogs_preferences_pages_base_page_get_preferences_dialog (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dialogs_preferences_pages_base_page_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec)
{
	DialogsPreferencesPagesBasePage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DIALOGS_PREFERENCES_PAGES_TYPE_BASE_PAGE, DialogsPreferencesPagesBasePage);
	switch (property_id) {
		case DIALOGS_PREFERENCES_PAGES_BASE_PAGE_PREFERENCES_DIALOG_PROPERTY:
		dialogs_preferences_pages_base_page_set_preferences_dialog (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

