/* ProjectPickerPopover.c generated by valac 0.56.19, the Vala compiler
 * generated from ProjectPickerPopover.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 "planify.h"
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.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

enum  {
	WIDGETS_PROJECT_PICKER_PROJECT_PICKER_POPOVER_0_PROPERTY,
	WIDGETS_PROJECT_PICKER_PROJECT_PICKER_POPOVER_NUM_PROPERTIES
};
static GParamSpec* widgets_project_picker_project_picker_popover_properties[WIDGETS_PROJECT_PICKER_PROJECT_PICKER_POPOVER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	WIDGETS_PROJECT_PICKER_PROJECT_PICKER_POPOVER_SELECTED_SIGNAL,
	WIDGETS_PROJECT_PICKER_PROJECT_PICKER_POPOVER_NUM_SIGNALS
};
static guint widgets_project_picker_project_picker_popover_signals[WIDGETS_PROJECT_PICKER_PROJECT_PICKER_POPOVER_NUM_SIGNALS] = {0};

struct _WidgetsProjectPickerProjectPickerPopoverPrivate {
	WidgetsProjectPickerCore* project_picker_core;
};

static gint WidgetsProjectPickerProjectPickerPopover_private_offset;
static gpointer widgets_project_picker_project_picker_popover_parent_class = NULL;

static GObject * widgets_project_picker_project_picker_popover_constructor (GType type,
                                                                     guint n_construct_properties,
                                                                     GObjectConstructParam * construct_properties);
static void _widgets_project_picker_project_picker_popover___lambda118_ (WidgetsProjectPickerProjectPickerPopover* self,
                                                                  ObjectsProject* project);
static void __widgets_project_picker_project_picker_popover___lambda118__widgets_project_picker_core_selected (WidgetsProjectPickerCore* _sender,
                                                                                                        ObjectsProject* project,
                                                                                                        gpointer self);
static void _widgets_project_picker_project_picker_popover___lambda119_ (WidgetsProjectPickerProjectPickerPopover* self);
static void __widgets_project_picker_project_picker_popover___lambda119__widgets_project_picker_core_close (WidgetsProjectPickerCore* _sender,
                                                                                                     gpointer self);
static void _widgets_project_picker_project_picker_popover___lambda120_ (WidgetsProjectPickerProjectPickerPopover* self);
static void __widgets_project_picker_project_picker_popover___lambda120__gtk_widget_destroy (GtkWidget* _sender,
                                                                                      gpointer self);
static void widgets_project_picker_project_picker_popover_finalize (GObject * obj);
static GType widgets_project_picker_project_picker_popover_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
widgets_project_picker_project_picker_popover_get_instance_private (WidgetsProjectPickerProjectPickerPopover* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsProjectPickerProjectPickerPopover_private_offset);
}

WidgetsProjectPickerProjectPickerPopover*
widgets_project_picker_project_picker_popover_construct (GType object_type)
{
	WidgetsProjectPickerProjectPickerPopover * self = NULL;
	self = (WidgetsProjectPickerProjectPickerPopover*) g_object_new (object_type, "height-request", 300, "width-request", 275, "has-arrow", FALSE, "position", GTK_POS_BOTTOM, NULL);
	return self;
}

WidgetsProjectPickerProjectPickerPopover*
widgets_project_picker_project_picker_popover_new (void)
{
	return widgets_project_picker_project_picker_popover_construct (WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_POPOVER);
}

void
widgets_project_picker_project_picker_popover_set_selected_project (WidgetsProjectPickerProjectPickerPopover* self,
                                                                    ObjectsProject* project)
{
	WidgetsProjectPickerCore* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_tmp0_ = self->priv->project_picker_core;
	widgets_project_picker_core_set_selected_project (_tmp0_, project);
}

void
widgets_project_picker_project_picker_popover_clean_up (WidgetsProjectPickerProjectPickerPopover* self)
{
	WidgetsProjectPickerCore* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->project_picker_core;
	if (_tmp0_ != NULL) {
		WidgetsProjectPickerCore* _tmp1_;
		_tmp1_ = self->priv->project_picker_core;
		widgets_project_picker_core_clean_up (_tmp1_);
	}
}

static void
_widgets_project_picker_project_picker_popover___lambda118_ (WidgetsProjectPickerProjectPickerPopover* self,
                                                             ObjectsProject* project)
{
	g_return_if_fail (project != NULL);
	g_signal_emit (self, widgets_project_picker_project_picker_popover_signals[WIDGETS_PROJECT_PICKER_PROJECT_PICKER_POPOVER_SELECTED_SIGNAL], 0, project);
}

static void
__widgets_project_picker_project_picker_popover___lambda118__widgets_project_picker_core_selected (WidgetsProjectPickerCore* _sender,
                                                                                                   ObjectsProject* project,
                                                                                                   gpointer self)
{
	_widgets_project_picker_project_picker_popover___lambda118_ ((WidgetsProjectPickerProjectPickerPopover*) self, project);
}

static void
_widgets_project_picker_project_picker_popover___lambda119_ (WidgetsProjectPickerProjectPickerPopover* self)
{
	gtk_popover_popdown ((GtkPopover*) self);
}

static void
__widgets_project_picker_project_picker_popover___lambda119__widgets_project_picker_core_close (WidgetsProjectPickerCore* _sender,
                                                                                                gpointer self)
{
	_widgets_project_picker_project_picker_popover___lambda119_ ((WidgetsProjectPickerProjectPickerPopover*) self);
}

static void
_widgets_project_picker_project_picker_popover___lambda120_ (WidgetsProjectPickerProjectPickerPopover* self)
{
	WidgetsProjectPickerCore* _tmp0_;
	_tmp0_ = self->priv->project_picker_core;
	widgets_project_picker_core_clean_up (_tmp0_);
}

static void
__widgets_project_picker_project_picker_popover___lambda120__gtk_widget_destroy (GtkWidget* _sender,
                                                                                 gpointer self)
{
	_widgets_project_picker_project_picker_popover___lambda120_ ((WidgetsProjectPickerProjectPickerPopover*) self);
}

static GObject *
widgets_project_picker_project_picker_popover_constructor (GType type,
                                                           guint n_construct_properties,
                                                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsProjectPickerProjectPickerPopover * self;
	WidgetsProjectPickerCore* _tmp0_;
	WidgetsProjectPickerCore* _tmp1_;
	WidgetsProjectPickerCore* _tmp2_;
	WidgetsProjectPickerCore* _tmp3_;
	parent_class = G_OBJECT_CLASS (widgets_project_picker_project_picker_popover_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_POPOVER, WidgetsProjectPickerProjectPickerPopover);
	_tmp0_ = widgets_project_picker_core_new (NULL);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->project_picker_core);
	self->priv->project_picker_core = _tmp0_;
	_tmp1_ = self->priv->project_picker_core;
	gtk_popover_set_child ((GtkPopover*) self, (GtkWidget*) _tmp1_);
	gtk_widget_add_css_class ((GtkWidget*) self, "popover-contents");
	_tmp2_ = self->priv->project_picker_core;
	g_signal_connect_object (_tmp2_, "selected", (GCallback) __widgets_project_picker_project_picker_popover___lambda118__widgets_project_picker_core_selected, self, 0);
	_tmp3_ = self->priv->project_picker_core;
	g_signal_connect_object (_tmp3_, "close", (GCallback) __widgets_project_picker_project_picker_popover___lambda119__widgets_project_picker_core_close, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "destroy", (GCallback) __widgets_project_picker_project_picker_popover___lambda120__gtk_widget_destroy, self, 0);
	return obj;
}

static void
widgets_project_picker_project_picker_popover_class_init (WidgetsProjectPickerProjectPickerPopoverClass * klass,
                                                          gpointer klass_data)
{
	widgets_project_picker_project_picker_popover_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsProjectPickerProjectPickerPopover_private_offset);
	G_OBJECT_CLASS (klass)->constructor = widgets_project_picker_project_picker_popover_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_project_picker_project_picker_popover_finalize;
	widgets_project_picker_project_picker_popover_signals[WIDGETS_PROJECT_PICKER_PROJECT_PICKER_POPOVER_SELECTED_SIGNAL] = g_signal_new ("selected", WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_POPOVER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, OBJECTS_TYPE_PROJECT);
}

static void
widgets_project_picker_project_picker_popover_instance_init (WidgetsProjectPickerProjectPickerPopover * self,
                                                             gpointer klass)
{
	self->priv = widgets_project_picker_project_picker_popover_get_instance_private (self);
}

static void
widgets_project_picker_project_picker_popover_finalize (GObject * obj)
{
	WidgetsProjectPickerProjectPickerPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_PROJECT_PICKER_TYPE_PROJECT_PICKER_POPOVER, WidgetsProjectPickerProjectPickerPopover);
	g_debug ("ProjectPickerPopover.vala:37: Destroying - Widgets.ProjectPicker.Proje" \
"ctPickerPopover\n");
	_g_object_unref0 (self->priv->project_picker_core);
	G_OBJECT_CLASS (widgets_project_picker_project_picker_popover_parent_class)->finalize (obj);
}

static GType
widgets_project_picker_project_picker_popover_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsProjectPickerProjectPickerPopoverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_project_picker_project_picker_popover_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsProjectPickerProjectPickerPopover), 0, (GInstanceInitFunc) widgets_project_picker_project_picker_popover_instance_init, NULL };
	GType widgets_project_picker_project_picker_popover_type_id;
	widgets_project_picker_project_picker_popover_type_id = g_type_register_static (gtk_popover_get_type (), "WidgetsProjectPickerProjectPickerPopover", &g_define_type_info, 0);
	WidgetsProjectPickerProjectPickerPopover_private_offset = g_type_add_instance_private (widgets_project_picker_project_picker_popover_type_id, sizeof (WidgetsProjectPickerProjectPickerPopoverPrivate));
	return widgets_project_picker_project_picker_popover_type_id;
}

GType
widgets_project_picker_project_picker_popover_get_type (void)
{
	static volatile gsize widgets_project_picker_project_picker_popover_type_id__once = 0;
	if (g_once_init_enter (&widgets_project_picker_project_picker_popover_type_id__once)) {
		GType widgets_project_picker_project_picker_popover_type_id;
		widgets_project_picker_project_picker_popover_type_id = widgets_project_picker_project_picker_popover_get_type_once ();
		g_once_init_leave (&widgets_project_picker_project_picker_popover_type_id__once, widgets_project_picker_project_picker_popover_type_id);
	}
	return widgets_project_picker_project_picker_popover_type_id__once;
}

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;
}

