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

/* SPDX-FileCopyrightText: 2012-2025 Sébastien Wilmet
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Author: Sébastien Wilmet
 */

#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include "config.h"
#include <amtk/amtk.h>
#include <gio/gio.h>
#include <gobject/gvaluecollector.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 TYPE_MAIN_WINDOW_EDIT (main_window_edit_get_type ())
#define MAIN_WINDOW_EDIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW_EDIT, MainWindowEdit))
#define MAIN_WINDOW_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW_EDIT, MainWindowEditClass))
#define IS_MAIN_WINDOW_EDIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW_EDIT))
#define IS_MAIN_WINDOW_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW_EDIT))
#define MAIN_WINDOW_EDIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW_EDIT, MainWindowEditClass))

typedef struct _MainWindowEdit MainWindowEdit;
typedef struct _MainWindowEditClass MainWindowEditClass;
typedef struct _MainWindowEditPrivate MainWindowEditPrivate;

#define TYPE_MAIN_WINDOW (main_window_get_type ())
#define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
#define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
#define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
#define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
#define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ParamSpecMainWindowEdit ParamSpecMainWindowEdit;

struct _MainWindowEdit {
	GTypeInstance parent_instance;
	volatile int ref_count;
	MainWindowEditPrivate * priv;
};

struct _MainWindowEditClass {
	GTypeClass parent_class;
	void (*finalize) (MainWindowEdit *self);
};

struct _MainWindowEditPrivate {
	MainWindow* _main_window;
	GtkActionGroup* _action_group;
};

struct _ParamSpecMainWindowEdit {
	GParamSpec parent_instance;
};

static gint MainWindowEdit_private_offset;
static gpointer main_window_edit_parent_class = NULL;

VALA_EXTERN gpointer main_window_edit_ref (gpointer instance);
VALA_EXTERN void main_window_edit_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_main_window_edit (const gchar* name,
                                         const gchar* nick,
                                         const gchar* blurb,
                                         GType object_type,
                                         GParamFlags flags);
VALA_EXTERN void value_set_main_window_edit (GValue* value,
                                 gpointer v_object);
VALA_EXTERN void value_take_main_window_edit (GValue* value,
                                  gpointer v_object);
VALA_EXTERN gpointer value_get_main_window_edit (const GValue* value);
VALA_EXTERN GType main_window_edit_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindowEdit, main_window_edit_unref)
VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
VALA_EXTERN MainWindowEdit* main_window_edit_new (MainWindow* main_window,
                                      GtkUIManager* ui_manager);
VALA_EXTERN MainWindowEdit* main_window_edit_construct (GType object_type,
                                            MainWindow* main_window,
                                            GtkUIManager* ui_manager);
static void main_window_edit_finalize (MainWindowEdit * obj);
static GType main_window_edit_get_type_once (void);

static const GtkActionEntry MAIN_WINDOW_EDIT__action_entries[1] = {{"Edit", NULL, N_ ("_Edit")}};

static inline gpointer
main_window_edit_get_instance_private (MainWindowEdit* self)
{
	return G_STRUCT_MEMBER_P (self, MainWindowEdit_private_offset);
}

MainWindowEdit*
main_window_edit_construct (GType object_type,
                            MainWindow* main_window,
                            GtkUIManager* ui_manager)
{
	MainWindowEdit* self = NULL;
	GtkActionGroup* _tmp0_;
	GtkActionGroup* _tmp1_;
	GtkActionGroup* _tmp2_;
	GtkActionGroup* _tmp3_;
	GtkActionGroup* _tmp4_;
	GtkActionGroup* _tmp5_;
	GtkActionGroup* _tmp6_;
	GtkActionGroup* _tmp7_;
	GtkActionGroup* _tmp8_;
	g_return_val_if_fail (main_window != NULL, NULL);
	g_return_val_if_fail (ui_manager != NULL, NULL);
	self = (MainWindowEdit*) g_type_create_instance (object_type);
	self->priv->_main_window = main_window;
	_tmp0_ = gtk_action_group_new ("EditMenuActionGroup");
	_g_object_unref0 (self->priv->_action_group);
	self->priv->_action_group = _tmp0_;
	_tmp1_ = self->priv->_action_group;
	gtk_action_group_set_translation_domain (_tmp1_, GETTEXT_PACKAGE);
	_tmp2_ = self->priv->_action_group;
	gtk_action_group_add_actions (_tmp2_, MAIN_WINDOW_EDIT__action_entries, (guint) G_N_ELEMENTS (MAIN_WINDOW_EDIT__action_entries), self);
	_tmp3_ = self->priv->_action_group;
	amtk_utils_create_gtk_action ((GActionMap*) main_window, "win.tepl-undo", _tmp3_, "EditUndo");
	_tmp4_ = self->priv->_action_group;
	amtk_utils_create_gtk_action ((GActionMap*) main_window, "win.tepl-redo", _tmp4_, "EditRedo");
	_tmp5_ = self->priv->_action_group;
	amtk_utils_create_gtk_action ((GActionMap*) main_window, "win.tepl-cut", _tmp5_, "EditCut");
	_tmp6_ = self->priv->_action_group;
	amtk_utils_create_gtk_action ((GActionMap*) main_window, "win.tepl-copy", _tmp6_, "EditCopy");
	_tmp7_ = self->priv->_action_group;
	amtk_utils_create_gtk_action ((GActionMap*) main_window, "win.tepl-paste", _tmp7_, "EditPaste");
	_tmp8_ = self->priv->_action_group;
	gtk_ui_manager_insert_action_group (ui_manager, _tmp8_, 0);
	return self;
}

MainWindowEdit*
main_window_edit_new (MainWindow* main_window,
                      GtkUIManager* ui_manager)
{
	return main_window_edit_construct (TYPE_MAIN_WINDOW_EDIT, main_window, ui_manager);
}

static void
value_main_window_edit_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
value_main_window_edit_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		main_window_edit_unref (value->data[0].v_pointer);
	}
}

static void
value_main_window_edit_copy_value (const GValue* src_value,
                                   GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = main_window_edit_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
value_main_window_edit_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
value_main_window_edit_collect_value (GValue* value,
                                      guint n_collect_values,
                                      GTypeCValue* collect_values,
                                      guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		MainWindowEdit * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = main_window_edit_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_main_window_edit_lcopy_value (const GValue* value,
                                    guint n_collect_values,
                                    GTypeCValue* collect_values,
                                    guint collect_flags)
{
	MainWindowEdit ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = main_window_edit_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_main_window_edit (const gchar* name,
                             const gchar* nick,
                             const gchar* blurb,
                             GType object_type,
                             GParamFlags flags)
{
	ParamSpecMainWindowEdit* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_MAIN_WINDOW_EDIT), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
value_get_main_window_edit (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_EDIT), NULL);
	return value->data[0].v_pointer;
}

void
value_set_main_window_edit (GValue* value,
                            gpointer v_object)
{
	MainWindowEdit * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_EDIT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN_WINDOW_EDIT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		main_window_edit_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		main_window_edit_unref (old);
	}
}

void
value_take_main_window_edit (GValue* value,
                             gpointer v_object)
{
	MainWindowEdit * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_EDIT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN_WINDOW_EDIT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		main_window_edit_unref (old);
	}
}

static void
main_window_edit_class_init (MainWindowEditClass * klass,
                             gpointer klass_data)
{
	main_window_edit_parent_class = g_type_class_peek_parent (klass);
	((MainWindowEditClass *) klass)->finalize = main_window_edit_finalize;
	g_type_class_adjust_private_offset (klass, &MainWindowEdit_private_offset);
}

static void
main_window_edit_instance_init (MainWindowEdit * self,
                                gpointer klass)
{
	self->priv = main_window_edit_get_instance_private (self);
	self->ref_count = 1;
}

static void
main_window_edit_finalize (MainWindowEdit * obj)
{
	MainWindowEdit * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW_EDIT, MainWindowEdit);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->_action_group);
}

 G_GNUC_NO_INLINE static GType
main_window_edit_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_main_window_edit_init, value_main_window_edit_free_value, value_main_window_edit_copy_value, value_main_window_edit_peek_pointer, "p", value_main_window_edit_collect_value, "p", value_main_window_edit_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (MainWindowEditClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) main_window_edit_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MainWindowEdit), 0, (GInstanceInitFunc) main_window_edit_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType main_window_edit_type_id;
	main_window_edit_type_id = g_type_register_fundamental (g_type_fundamental_next (), "MainWindowEdit", &g_define_type_info, &g_define_type_fundamental_info, G_TYPE_FLAG_NONE);
	MainWindowEdit_private_offset = g_type_add_instance_private (main_window_edit_type_id, sizeof (MainWindowEditPrivate));
	return main_window_edit_type_id;
}

GType
main_window_edit_get_type (void)
{
	static GType main_window_edit_type_id__once = 0;
	if (g_once_init_enter_pointer (&main_window_edit_type_id__once)) {
		GType main_window_edit_type_id;
		main_window_edit_type_id = main_window_edit_get_type_once ();
		g_once_init_leave_pointer (&main_window_edit_type_id__once, main_window_edit_type_id);
	}
	return main_window_edit_type_id__once;
}

gpointer
main_window_edit_ref (gpointer instance)
{
	MainWindowEdit * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
main_window_edit_unref (gpointer instance)
{
	MainWindowEdit * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		MAIN_WINDOW_EDIT_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

