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

/* SPDX-License-Identifier: GPL-3.0-or-later*/

#include "graphs.h"
#include <gtk/gtk.h>
#include <adwaita.h>
#include <glib-object.h>
#include <glib.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  {
	GRAPHS_MAIN_SIDEBAR_PAGE_0_PROPERTY,
	GRAPHS_MAIN_SIDEBAR_PAGE_ITEM_LIST_PROPERTY,
	GRAPHS_MAIN_SIDEBAR_PAGE_HEIGHT_LIMITED_PROPERTY,
	GRAPHS_MAIN_SIDEBAR_PAGE_MODE_PROPERTY,
	GRAPHS_MAIN_SIDEBAR_PAGE_OPERATIONS_PROPERTY,
	GRAPHS_MAIN_SIDEBAR_PAGE_NUM_PROPERTIES
};
static GParamSpec* graphs_main_sidebar_page_properties[GRAPHS_MAIN_SIDEBAR_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GraphsMainSidebarPagePrivate {
	GtkScrolledWindow* _scrollwindow_itemlist;
	GtkToggleButton* _pan_button;
	GtkToggleButton* _zoom_button;
	GtkToggleButton* _select_button;
	AdwBin* _operations_bin;
	GtkStack* _itemlist_stack;
	GtkListBox* _item_list;
};

static gint GraphsMainSidebarPage_private_offset;
static gpointer graphs_main_sidebar_page_parent_class = NULL;

static GtkStack* graphs_main_sidebar_page_get_itemlist_stack (GraphsMainSidebarPage* self);
static GtkScrolledWindow* graphs_main_sidebar_page_get_scrollwindow_itemlist (GraphsMainSidebarPage* self);
static GtkToggleButton* graphs_main_sidebar_page_get_pan_button (GraphsMainSidebarPage* self);
static GtkToggleButton* graphs_main_sidebar_page_get_zoom_button (GraphsMainSidebarPage* self);
static GtkToggleButton* graphs_main_sidebar_page_get_select_button (GraphsMainSidebarPage* self);
static AdwBin* graphs_main_sidebar_page_get_operations_bin (GraphsMainSidebarPage* self);
static void graphs_main_sidebar_page_finalize (GObject * obj);
static GType graphs_main_sidebar_page_get_type_once (void);
static void _vala_graphs_main_sidebar_page_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_graphs_main_sidebar_page_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
graphs_main_sidebar_page_get_instance_private (GraphsMainSidebarPage* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsMainSidebarPage_private_offset);
}

GraphsMainSidebarPage*
graphs_main_sidebar_page_construct (GType object_type)
{
	GraphsMainSidebarPage * self = NULL;
	self = (GraphsMainSidebarPage*) g_object_new (object_type, NULL);
	return self;
}

GraphsMainSidebarPage*
graphs_main_sidebar_page_new (void)
{
	return graphs_main_sidebar_page_construct (GRAPHS_TYPE_MAIN_SIDEBAR_PAGE);
}

void
graphs_main_sidebar_page_set_show_empty_data_page (GraphsMainSidebarPage* self,
                                                   gboolean val)
{
	gint _tmp0_ = 0;
	GtkStack* _tmp1_;
	GtkSelectionModel* _tmp2_;
	GtkSelectionModel* _tmp3_;
	g_return_if_fail (self != NULL);
	if (val) {
		_tmp0_ = 0;
	} else {
		_tmp0_ = 1;
	}
	_tmp1_ = self->priv->_itemlist_stack;
	_tmp2_ = gtk_stack_get_pages (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_selection_model_select_item (_tmp3_, (guint) _tmp0_, TRUE);
	_g_object_unref0 (_tmp3_);
}

static GtkScrolledWindow*
graphs_main_sidebar_page_get_scrollwindow_itemlist (GraphsMainSidebarPage* self)
{
	GtkScrolledWindow* result;
	GtkScrolledWindow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_scrollwindow_itemlist;
	result = _tmp0_;
	return result;
}

static GtkToggleButton*
graphs_main_sidebar_page_get_pan_button (GraphsMainSidebarPage* self)
{
	GtkToggleButton* result;
	GtkToggleButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_pan_button;
	result = _tmp0_;
	return result;
}

static GtkToggleButton*
graphs_main_sidebar_page_get_zoom_button (GraphsMainSidebarPage* self)
{
	GtkToggleButton* result;
	GtkToggleButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_zoom_button;
	result = _tmp0_;
	return result;
}

static GtkToggleButton*
graphs_main_sidebar_page_get_select_button (GraphsMainSidebarPage* self)
{
	GtkToggleButton* result;
	GtkToggleButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_select_button;
	result = _tmp0_;
	return result;
}

static AdwBin*
graphs_main_sidebar_page_get_operations_bin (GraphsMainSidebarPage* self)
{
	AdwBin* result;
	AdwBin* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_operations_bin;
	result = _tmp0_;
	return result;
}

static GtkStack*
graphs_main_sidebar_page_get_itemlist_stack (GraphsMainSidebarPage* self)
{
	GtkStack* result;
	GtkStack* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_itemlist_stack;
	result = _tmp0_;
	return result;
}

GtkListBox*
graphs_main_sidebar_page_get_item_list (GraphsMainSidebarPage* self)
{
	GtkListBox* result;
	GtkListBox* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_item_list;
	result = _tmp0_;
	return result;
}

gboolean
graphs_main_sidebar_page_get_height_limited (GraphsMainSidebarPage* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = FALSE;
	return result;
}

void
graphs_main_sidebar_page_set_height_limited (GraphsMainSidebarPage* self,
                                             gboolean value)
{
	GtkPolicyType _tmp0_ = 0;
	GtkScrolledWindow* _tmp1_;
	g_return_if_fail (self != NULL);
	if (value) {
		_tmp0_ = GTK_POLICY_NEVER;
	} else {
		_tmp0_ = GTK_POLICY_AUTOMATIC;
	}
	_tmp1_ = self->priv->_scrollwindow_itemlist;
	gtk_scrolled_window_set_policy (_tmp1_, GTK_POLICY_AUTOMATIC, _tmp0_);
	g_object_notify_by_pspec ((GObject *) self, graphs_main_sidebar_page_properties[GRAPHS_MAIN_SIDEBAR_PAGE_HEIGHT_LIMITED_PROPERTY]);
}

GraphsMode
graphs_main_sidebar_page_get_mode (GraphsMainSidebarPage* self)
{
	GraphsMode result;
	GtkToggleButton* _tmp0_;
	GtkToggleButton* _tmp1_;
	GtkToggleButton* _tmp2_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_pan_button;
	if (gtk_toggle_button_get_active (_tmp0_)) {
		result = GRAPHS_MODE_PAN;
		return result;
	}
	_tmp1_ = self->priv->_zoom_button;
	if (gtk_toggle_button_get_active (_tmp1_)) {
		result = GRAPHS_MODE_ZOOM;
		return result;
	}
	_tmp2_ = self->priv->_select_button;
	if (gtk_toggle_button_get_active (_tmp2_)) {
		result = GRAPHS_MODE_SELECT;
		return result;
	}
	result = -1;
	return result;
}

void
graphs_main_sidebar_page_set_mode (GraphsMainSidebarPage* self,
                                   GraphsMode value)
{
	GtkToggleButton* _tmp0_;
	GtkToggleButton* _tmp1_;
	GtkToggleButton* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_pan_button;
	gtk_toggle_button_set_active (_tmp0_, value == GRAPHS_MODE_PAN);
	_tmp1_ = self->priv->_zoom_button;
	gtk_toggle_button_set_active (_tmp1_, value == GRAPHS_MODE_ZOOM);
	_tmp2_ = self->priv->_select_button;
	gtk_toggle_button_set_active (_tmp2_, value == GRAPHS_MODE_SELECT);
	g_object_notify_by_pspec ((GObject *) self, graphs_main_sidebar_page_properties[GRAPHS_MAIN_SIDEBAR_PAGE_MODE_PROPERTY]);
}

GraphsOperations*
graphs_main_sidebar_page_get_operations (GraphsMainSidebarPage* self)
{
	GraphsOperations* result;
	AdwBin* _tmp0_;
	GtkWidget* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_operations_bin;
	_tmp1_ = adw_bin_get_child (_tmp0_);
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GRAPHS_TYPE_OPERATIONS, GraphsOperations);
	return result;
}

void
graphs_main_sidebar_page_set_operations (GraphsMainSidebarPage* self,
                                         GraphsOperations* value)
{
	AdwBin* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_operations_bin;
	adw_bin_set_child (_tmp0_, (GtkWidget*) value);
	g_object_notify_by_pspec ((GObject *) self, graphs_main_sidebar_page_properties[GRAPHS_MAIN_SIDEBAR_PAGE_OPERATIONS_PROPERTY]);
}

static void
graphs_main_sidebar_page_class_init (GraphsMainSidebarPageClass * klass,
                                     gpointer klass_data)
{
	graphs_main_sidebar_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsMainSidebarPage_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_main_sidebar_page_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_graphs_main_sidebar_page_set_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_main_sidebar_page_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_MAIN_SIDEBAR_PAGE_ITEM_LIST_PROPERTY, graphs_main_sidebar_page_properties[GRAPHS_MAIN_SIDEBAR_PAGE_ITEM_LIST_PROPERTY] = g_param_spec_object ("item-list", "item-list", "item-list", gtk_list_box_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_MAIN_SIDEBAR_PAGE_HEIGHT_LIMITED_PROPERTY, graphs_main_sidebar_page_properties[GRAPHS_MAIN_SIDEBAR_PAGE_HEIGHT_LIMITED_PROPERTY] = g_param_spec_boolean ("height-limited", "height-limited", "height-limited", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_MAIN_SIDEBAR_PAGE_MODE_PROPERTY, graphs_main_sidebar_page_properties[GRAPHS_MAIN_SIDEBAR_PAGE_MODE_PROPERTY] = g_param_spec_enum ("mode", "mode", "mode", GRAPHS_TYPE_MODE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_MAIN_SIDEBAR_PAGE_OPERATIONS_PROPERTY, graphs_main_sidebar_page_properties[GRAPHS_MAIN_SIDEBAR_PAGE_OPERATIONS_PROPERTY] = g_param_spec_object ("operations", "operations", "operations", GRAPHS_TYPE_OPERATIONS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/se/sjoerd/Graphs/ui/sidebar/main.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "scrollwindow_itemlist", FALSE, GraphsMainSidebarPage_private_offset + G_STRUCT_OFFSET (GraphsMainSidebarPagePrivate, _scrollwindow_itemlist));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "pan_button", FALSE, GraphsMainSidebarPage_private_offset + G_STRUCT_OFFSET (GraphsMainSidebarPagePrivate, _pan_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "zoom_button", FALSE, GraphsMainSidebarPage_private_offset + G_STRUCT_OFFSET (GraphsMainSidebarPagePrivate, _zoom_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "select_button", FALSE, GraphsMainSidebarPage_private_offset + G_STRUCT_OFFSET (GraphsMainSidebarPagePrivate, _select_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "operations_bin", FALSE, GraphsMainSidebarPage_private_offset + G_STRUCT_OFFSET (GraphsMainSidebarPagePrivate, _operations_bin));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "itemlist_stack", FALSE, GraphsMainSidebarPage_private_offset + G_STRUCT_OFFSET (GraphsMainSidebarPagePrivate, _itemlist_stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "item_list", FALSE, GraphsMainSidebarPage_private_offset + G_STRUCT_OFFSET (GraphsMainSidebarPagePrivate, _item_list));
}

static void
graphs_main_sidebar_page_instance_init (GraphsMainSidebarPage * self,
                                        gpointer klass)
{
	self->priv = graphs_main_sidebar_page_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_main_sidebar_page_finalize (GObject * obj)
{
	GraphsMainSidebarPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_MAIN_SIDEBAR_PAGE, GraphsMainSidebarPage);
	G_OBJECT_CLASS (graphs_main_sidebar_page_parent_class)->finalize (obj);
}

static GType
graphs_main_sidebar_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsMainSidebarPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_main_sidebar_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsMainSidebarPage), 0, (GInstanceInitFunc) graphs_main_sidebar_page_instance_init, NULL };
	GType graphs_main_sidebar_page_type_id;
	graphs_main_sidebar_page_type_id = g_type_register_static (adw_navigation_page_get_type (), "GraphsMainSidebarPage", &g_define_type_info, 0);
	GraphsMainSidebarPage_private_offset = g_type_add_instance_private (graphs_main_sidebar_page_type_id, sizeof (GraphsMainSidebarPagePrivate));
	return graphs_main_sidebar_page_type_id;
}

GType
graphs_main_sidebar_page_get_type (void)
{
	static volatile gsize graphs_main_sidebar_page_type_id__once = 0;
	if (g_once_init_enter (&graphs_main_sidebar_page_type_id__once)) {
		GType graphs_main_sidebar_page_type_id;
		graphs_main_sidebar_page_type_id = graphs_main_sidebar_page_get_type_once ();
		g_once_init_leave (&graphs_main_sidebar_page_type_id__once, graphs_main_sidebar_page_type_id);
	}
	return graphs_main_sidebar_page_type_id__once;
}

static void
_vala_graphs_main_sidebar_page_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	GraphsMainSidebarPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_MAIN_SIDEBAR_PAGE, GraphsMainSidebarPage);
	switch (property_id) {
		case GRAPHS_MAIN_SIDEBAR_PAGE_ITEM_LIST_PROPERTY:
		g_value_set_object (value, graphs_main_sidebar_page_get_item_list (self));
		break;
		case GRAPHS_MAIN_SIDEBAR_PAGE_HEIGHT_LIMITED_PROPERTY:
		g_value_set_boolean (value, graphs_main_sidebar_page_get_height_limited (self));
		break;
		case GRAPHS_MAIN_SIDEBAR_PAGE_MODE_PROPERTY:
		g_value_set_enum (value, graphs_main_sidebar_page_get_mode (self));
		break;
		case GRAPHS_MAIN_SIDEBAR_PAGE_OPERATIONS_PROPERTY:
		g_value_set_object (value, graphs_main_sidebar_page_get_operations (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_graphs_main_sidebar_page_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	GraphsMainSidebarPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_MAIN_SIDEBAR_PAGE, GraphsMainSidebarPage);
	switch (property_id) {
		case GRAPHS_MAIN_SIDEBAR_PAGE_HEIGHT_LIMITED_PROPERTY:
		graphs_main_sidebar_page_set_height_limited (self, g_value_get_boolean (value));
		break;
		case GRAPHS_MAIN_SIDEBAR_PAGE_MODE_PROPERTY:
		graphs_main_sidebar_page_set_mode (self, g_value_get_enum (value));
		break;
		case GRAPHS_MAIN_SIDEBAR_PAGE_OPERATIONS_PROPERTY:
		graphs_main_sidebar_page_set_operations (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

