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

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

#include "graphs.h"
#include <gtk/gtk.h>
#include <adwaita.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gee.h>
#include <glib-object.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.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_WINDOW_0_PROPERTY,
	GRAPHS_WINDOW_OVERLAY_SPLIT_VIEW_PROPERTY,
	GRAPHS_WINDOW_CONTENT_VIEW_PROPERTY,
	GRAPHS_WINDOW_DATA_PROPERTY,
	GRAPHS_WINDOW_CSS_PROVIDER_PROPERTY,
	GRAPHS_WINDOW_KEY_CONTROLLER_PROPERTY,
	GRAPHS_WINDOW_MODE_PROPERTY,
	GRAPHS_WINDOW_CANVAS_PROPERTY,
	GRAPHS_WINDOW_IS_MAIN_VIEW_PROPERTY,
	GRAPHS_WINDOW_NUM_PROPERTIES
};
static GParamSpec* graphs_window_properties[GRAPHS_WINDOW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block25Data Block25Data;
typedef struct _Block26Data Block26Data;
typedef struct _Block27Data Block27Data;

struct _GraphsWindowPrivate {
	GtkButton* _view_back_button;
	GtkButton* _view_forward_button;
	GtkButton* _optimize_limits_button;
	AdwOverlaySplitView* _overlay_split_view;
	AdwToastOverlay* _toast_overlay;
	AdwWindowTitle* _content_title;
	GtkOverlay* _drag_overlay;
	GtkRevealer* _drag_revealer;
	AdwToolbarView* _content_view;
	AdwNavigationView* _sidebar_navigation_view;
	GraphsMainSidebarPage* _main_page;
	GraphsEditItemPage* _edit_page;
	GraphsData* _data;
	GtkCssProvider* _css_provider;
	GtkEventControllerKey* _key_controller;
	gboolean _force_close;
	guint _inhibit_cookie;
	GraphsFigureSettingsPage* figure_settings_page;
};

struct _Block25Data {
	int _ref_count_;
	GraphsWindow* self;
	GraphsItemBox* row;
	gdouble drag_x;
	gdouble drag_y;
	GraphsItem* item;
	guint index;
};

struct _Block26Data {
	int _ref_count_;
	GraphsWindow* self;
	GFile* file;
};

struct _Block27Data {
	int _ref_count_;
	GraphsWindow* self;
	GtkDropTarget* file_drop_target;
};

static gint GraphsWindow_private_offset;
static gpointer graphs_window_parent_class = NULL;

static void graphs_window_update_history_actions (GraphsWindow* self);
static void graphs_window_update_close_project_action (GraphsWindow* self);
static void graphs_window_on_unsaved_change (GraphsWindow* self);
VALA_EXTERN gchar* graphs_tools_get_friendly_path (GFile* file);
static AdwWindowTitle* graphs_window_get_content_title (GraphsWindow* self);
static void graphs_window_on_items_changed (GraphsWindow* self);
static GraphsMainSidebarPage* graphs_window_get_main_page (GraphsWindow* self);
static void graphs_window_append_item_row (GraphsWindow* self,
                                    GraphsItem* item,
                                    guint index,
                                    gboolean is_data_item);
static Block25Data* block25_data_ref (Block25Data* _data25_);
static void block25_data_unref (void * _userdata_);
static GdkContentProvider* __lambda26_ (Block25Data* _data25_,
                                 gdouble x,
                                 gdouble y);
static GdkContentProvider* ___lambda26__gtk_drag_source_prepare (GtkDragSource* _sender,
                                                          gdouble x,
                                                          gdouble y,
                                                          gpointer self);
static void __lambda27_ (Block25Data* _data25_,
                  GdkDrag* drag);
static void ___lambda27__gtk_drag_source_drag_begin (GtkDragSource* _sender,
                                              GdkDrag* drag,
                                              gpointer self);
static void __lambda28_ (Block25Data* _data25_);
static void ___lambda28__gtk_drop_controller_motion_enter (GtkDropControllerMotion* _sender,
                                                    gdouble x,
                                                    gdouble y,
                                                    gpointer self);
static void __lambda29_ (GraphsWindow* self);
static void ___lambda29__gtk_drop_controller_motion_leave (GtkDropControllerMotion* _sender,
                                                    gpointer self);
static void __lambda30_ (Block25Data* _data25_);
static void ___lambda30__adw_action_row_activated (AdwActionRow* _sender,
                                            gpointer self);
static AdwNavigationView* graphs_window_get_sidebar_navigation_view (GraphsWindow* self);
static GraphsEditItemPage* graphs_window_get_edit_page (GraphsWindow* self);
static AdwToastOverlay* graphs_window_get_toast_overlay (GraphsWindow* self);
static Block26Data* block26_data_ref (Block26Data* _data26_);
static void block26_data_unref (void * _userdata_);
static void __lambda31_ (Block26Data* _data26_);
static void ___lambda31__g_simple_action_activate (GSimpleAction* _sender,
                                            GVariant* parameter,
                                            gpointer self);
static gboolean graphs_window_real_close_request (GtkWindow* base);
static void ___lambda32_ (GraphsWindow* self,
                   AdwAlertDialog* d,
                   const gchar* response);
static void ____lambda33_ (GraphsWindow* self,
                    GObject* o,
                    GAsyncResult* _result_);
static void _____lambda33__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void ____lambda32__adw_alert_dialog_response (AdwAlertDialog* _sender,
                                              const gchar* response,
                                              gpointer self);
static GtkButton* graphs_window_get_view_back_button (GraphsWindow* self);
static GtkButton* graphs_window_get_view_forward_button (GraphsWindow* self);
static GtkButton* graphs_window_get_optimize_limits_button (GraphsWindow* self);
static GtkOverlay* graphs_window_get_drag_overlay (GraphsWindow* self);
static GtkRevealer* graphs_window_get_drag_revealer (GraphsWindow* self);
static void graphs_window_set_css_provider (GraphsWindow* self,
                                     GtkCssProvider* value);
static void graphs_window_set_key_controller (GraphsWindow* self,
                                       GtkEventControllerKey* value);
static GObject * graphs_window_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties);
static Block27Data* block27_data_ref (Block27Data* _data27_);
static void block27_data_unref (void * _userdata_);
static gboolean _graphs_window___lambda34_ (GraphsWindow* self,
                                     GtkDropTarget* drop,
                                     GValue* val,
                                     gdouble x,
                                     gdouble y);
static gboolean __graphs_window___lambda34__gtk_drop_target_drop (GtkDropTarget* _sender,
                                                           GValue* value,
                                                           gdouble x,
                                                           gdouble y,
                                                           gpointer self);
static void _graphs_window___lambda35_ (Block27Data* _data27_);
static void __graphs_window___lambda35__g_object_notify (GObject* _sender,
                                                  GParamSpec* pspec,
                                                  gpointer self);
static gboolean _graphs_window___lambda36_ (GraphsWindow* self,
                                     GtkDropTarget* drop,
                                     GValue* val,
                                     gdouble x,
                                     gdouble y);
static gboolean __graphs_window___lambda36__gtk_drop_target_drop (GtkDropTarget* _sender,
                                                           GValue* value,
                                                           gdouble x,
                                                           gdouble y,
                                                           gpointer self);
static void _graphs_window___lambda40_ (GraphsWindow* self);
static void __graphs_window___lambda40__adw_navigation_view_pushed (AdwNavigationView* _sender,
                                                             gpointer self);
static void _graphs_window___lambda41_ (GraphsWindow* self,
                                 AdwNavigationView* view,
                                 AdwNavigationPage* page);
static void __graphs_window___lambda41__adw_navigation_view_popped (AdwNavigationView* _sender,
                                                             AdwNavigationPage* page,
                                                             gpointer self);
static void _graphs_window_update_history_actions_g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self);
static void _graphs_window_on_items_changed_g_list_model_items_changed (GListModel* _sender,
                                                                 guint position,
                                                                 guint removed,
                                                                 guint added,
                                                                 gpointer self);
static void _graphs_window_on_selection_changed_gtk_selection_model_selection_changed (GtkSelectionModel* _sender,
                                                                                guint position,
                                                                                guint n_items,
                                                                                gpointer self);
static void _graphs_window_on_unsaved_change_g_object_notify (GObject* _sender,
                                                       GParamSpec* pspec,
                                                       gpointer self);
static void graphs_window_finalize (GObject * obj);
static GType graphs_window_get_type_once (void);
static void _vala_graphs_window_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _vala_graphs_window_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_window_get_instance_private (GraphsWindow* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsWindow_private_offset);
}

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

static void
graphs_window_update_history_actions (GraphsWindow* self)
{
	gboolean enable = FALSE;
	gboolean _tmp0_;
	gboolean _tmp1_;
	GSimpleAction* undo_action = NULL;
	GAction* _tmp2_;
	GSimpleAction* _tmp3_;
	GSimpleAction* redo_action = NULL;
	GAction* _tmp4_;
	GSimpleAction* _tmp5_;
	gboolean _tmp6_ = FALSE;
	GSimpleAction* _tmp10_;
	gboolean _tmp11_ = FALSE;
	GSimpleAction* _tmp15_;
	g_return_if_fail (self != NULL);
	_tmp0_ = graphs_window_get_is_main_view (self);
	_tmp1_ = _tmp0_;
	enable = _tmp1_;
	_tmp2_ = g_action_map_lookup_action ((GActionMap*) self, "undo");
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, g_simple_action_get_type (), GSimpleAction));
	undo_action = _tmp3_;
	_tmp4_ = g_action_map_lookup_action ((GActionMap*) self, "redo");
	_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, g_simple_action_get_type (), GSimpleAction));
	redo_action = _tmp5_;
	if (enable) {
		GraphsData* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp7_ = self->priv->_data;
		_tmp8_ = graphs_data_get_can_undo (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp6_ = _tmp9_;
	} else {
		_tmp6_ = FALSE;
	}
	_tmp10_ = undo_action;
	g_simple_action_set_enabled (_tmp10_, _tmp6_);
	if (enable) {
		GraphsData* _tmp12_;
		gboolean _tmp13_;
		gboolean _tmp14_;
		_tmp12_ = self->priv->_data;
		_tmp13_ = graphs_data_get_can_redo (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp11_ = _tmp14_;
	} else {
		_tmp11_ = FALSE;
	}
	_tmp15_ = redo_action;
	g_simple_action_set_enabled (_tmp15_, _tmp11_);
	_g_object_unref0 (redo_action);
	_g_object_unref0 (undo_action);
}

static void
graphs_window_update_close_project_action (GraphsWindow* self)
{
	GSimpleAction* close_action = NULL;
	GAction* _tmp0_;
	GSimpleAction* _tmp1_;
	gboolean _tmp2_ = FALSE;
	GraphsData* _tmp3_;
	GFile* _tmp4_;
	GFile* _tmp5_;
	GSimpleAction* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_action_map_lookup_action ((GActionMap*) self, "close-project");
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, g_simple_action_get_type (), GSimpleAction));
	close_action = _tmp1_;
	_tmp3_ = self->priv->_data;
	_tmp4_ = graphs_data_get_file (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != NULL) {
		gboolean _tmp6_;
		gboolean _tmp7_;
		_tmp6_ = graphs_window_get_is_main_view (self);
		_tmp7_ = _tmp6_;
		_tmp2_ = _tmp7_;
	} else {
		_tmp2_ = FALSE;
	}
	_tmp8_ = close_action;
	g_simple_action_set_enabled (_tmp8_, _tmp2_);
	_g_object_unref0 (close_action);
}

/**
         * Inhibit session end when there is unsaved data present.
         * Disable save actions if there is no unsaved data.
         * Update window title.
         */
static void
graphs_window_on_unsaved_change (GraphsWindow* self)
{
	gchar* title = NULL;
	gchar* path = NULL;
	GraphsData* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	AdwWindowTitle* _tmp16_;
	const gchar* _tmp17_;
	GSimpleAction* save_action = NULL;
	GAction* _tmp18_;
	GSimpleAction* _tmp19_;
	GSimpleAction* save_as_action = NULL;
	GAction* _tmp20_;
	GSimpleAction* _tmp21_;
	GraphsData* _tmp22_;
	gboolean _tmp23_;
	gboolean _tmp24_;
	g_return_if_fail (self != NULL);
	graphs_window_update_close_project_action (self);
	_tmp0_ = self->priv->_data;
	_tmp1_ = graphs_data_get_file (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp3_ = g_strdup (_ ("Untitled Project"));
		_g_free0 (title);
		title = _tmp3_;
		_tmp4_ = g_strdup (_ ("Draft"));
		_g_free0 (path);
		path = _tmp4_;
	} else {
		GraphsData* _tmp5_;
		GFile* _tmp6_;
		GFile* _tmp7_;
		gchar* _tmp8_;
		GraphsData* _tmp9_;
		GFile* _tmp10_;
		GFile* _tmp11_;
		gchar* _tmp12_;
		_tmp5_ = self->priv->_data;
		_tmp6_ = graphs_data_get_file (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = graphs_tools_get_filename (_tmp7_);
		_g_free0 (title);
		title = _tmp8_;
		_tmp9_ = self->priv->_data;
		_tmp10_ = graphs_data_get_file (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = graphs_tools_get_friendly_path (_tmp11_);
		_g_free0 (path);
		path = _tmp12_;
	}
	_tmp13_ = title;
	_tmp14_ = g_strdup_printf (_ ("Graphs — %s"), _tmp13_);
	_tmp15_ = _tmp14_;
	gtk_window_set_title ((GtkWindow*) self, _tmp15_);
	_g_free0 (_tmp15_);
	_tmp16_ = self->priv->_content_title;
	_tmp17_ = path;
	adw_window_title_set_subtitle (_tmp16_, _tmp17_);
	_tmp18_ = g_action_map_lookup_action ((GActionMap*) self, "save-project");
	_tmp19_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, g_simple_action_get_type (), GSimpleAction));
	save_action = _tmp19_;
	_tmp20_ = g_action_map_lookup_action ((GActionMap*) self, "save-project-as");
	_tmp21_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, g_simple_action_get_type (), GSimpleAction));
	save_as_action = _tmp21_;
	_tmp22_ = self->priv->_data;
	_tmp23_ = graphs_data_get_unsaved (_tmp22_);
	_tmp24_ = _tmp23_;
	if (_tmp24_) {
		GSimpleAction* _tmp28_;
		GSimpleAction* _tmp29_;
		AdwWindowTitle* _tmp30_;
		const gchar* _tmp31_;
		gchar* _tmp32_;
		gchar* _tmp33_;
		if (self->priv->_inhibit_cookie == ((guint) 0)) {
			GtkApplication* _tmp25_;
			GtkApplication* _tmp26_;
			const gchar* _tmp27_;
			_tmp25_ = gtk_window_get_application ((GtkWindow*) self);
			_tmp26_ = _tmp25_;
			_tmp27_ = title;
			self->priv->_inhibit_cookie = gtk_application_inhibit (_tmp26_, (GtkWindow*) self, GTK_APPLICATION_INHIBIT_LOGOUT, _tmp27_);
		}
		_tmp28_ = save_action;
		g_simple_action_set_enabled (_tmp28_, TRUE);
		_tmp29_ = save_as_action;
		g_simple_action_set_enabled (_tmp29_, TRUE);
		_tmp30_ = self->priv->_content_title;
		_tmp31_ = title;
		_tmp32_ = g_strconcat ("• ", _tmp31_, NULL);
		_tmp33_ = _tmp32_;
		adw_window_title_set_title (_tmp30_, _tmp33_);
		_g_free0 (_tmp33_);
	} else {
		GSimpleAction* _tmp36_;
		GSimpleAction* _tmp37_;
		GraphsData* _tmp38_;
		GFile* _tmp39_;
		GFile* _tmp40_;
		AdwWindowTitle* _tmp41_;
		const gchar* _tmp42_;
		if (self->priv->_inhibit_cookie > ((guint) 0)) {
			GtkApplication* _tmp34_;
			GtkApplication* _tmp35_;
			_tmp34_ = gtk_window_get_application ((GtkWindow*) self);
			_tmp35_ = _tmp34_;
			gtk_application_uninhibit (_tmp35_, self->priv->_inhibit_cookie);
			self->priv->_inhibit_cookie = (guint) 0;
		}
		_tmp36_ = save_action;
		g_simple_action_set_enabled (_tmp36_, FALSE);
		_tmp37_ = save_as_action;
		_tmp38_ = self->priv->_data;
		_tmp39_ = graphs_data_get_file (_tmp38_);
		_tmp40_ = _tmp39_;
		g_simple_action_set_enabled (_tmp37_, _tmp40_ != NULL);
		_tmp41_ = self->priv->_content_title;
		_tmp42_ = title;
		adw_window_title_set_title (_tmp41_, _tmp42_);
	}
	_g_object_unref0 (save_as_action);
	_g_object_unref0 (save_action);
	_g_free0 (path);
	_g_free0 (title);
}

static void
graphs_window_on_items_changed (GraphsWindow* self)
{
	GraphsMainSidebarPage* _tmp0_;
	GtkListBox* _tmp1_;
	GtkListBox* _tmp2_;
	GSimpleAction* export_data_action = NULL;
	GAction* _tmp3_;
	GSimpleAction* _tmp4_;
	GSimpleAction* optimize_limits_action = NULL;
	GAction* _tmp5_;
	GSimpleAction* _tmp6_;
	GraphsData* _tmp7_;
	GraphsMainSidebarPage* _tmp27_;
	gboolean items_selected = FALSE;
	gboolean data_items_selected = FALSE;
	guint index = 0U;
	GraphsMainSidebarPage* _tmp45_;
	GraphsOperations* _tmp46_;
	GraphsOperations* _tmp47_;
	GtkButton* _tmp48_;
	GtkButton* _tmp49_;
	GraphsMainSidebarPage* _tmp50_;
	GraphsOperations* _tmp51_;
	GraphsOperations* _tmp52_;
	AdwSplitButton* _tmp53_;
	AdwSplitButton* _tmp54_;
	gboolean _tmp55_ = FALSE;
	GraphsMainSidebarPage* _tmp58_;
	GraphsOperations* _tmp59_;
	GraphsOperations* _tmp60_;
	GraphsMainSidebarPage* _tmp61_;
	GraphsOperations* _tmp62_;
	GraphsOperations* _tmp63_;
	GSimpleAction* _tmp64_;
	GSimpleAction* _tmp65_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_main_page;
	_tmp1_ = graphs_main_sidebar_page_get_item_list (_tmp0_);
	_tmp2_ = _tmp1_;
	gtk_list_box_remove_all (_tmp2_);
	_tmp3_ = g_action_map_lookup_action ((GActionMap*) self, "export-data");
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, g_simple_action_get_type (), GSimpleAction));
	export_data_action = _tmp4_;
	_tmp5_ = g_action_map_lookup_action ((GActionMap*) self, "optimize-limits");
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, g_simple_action_get_type (), GSimpleAction));
	optimize_limits_action = _tmp6_;
	_tmp7_ = self->priv->_data;
	if (graphs_data_is_empty (_tmp7_)) {
		GraphsMainSidebarPage* _tmp8_;
		GraphsMainSidebarPage* _tmp9_;
		GraphsOperations* _tmp10_;
		GraphsOperations* _tmp11_;
		GtkButton* _tmp12_;
		GtkButton* _tmp13_;
		GraphsMainSidebarPage* _tmp14_;
		GraphsOperations* _tmp15_;
		GraphsOperations* _tmp16_;
		AdwSplitButton* _tmp17_;
		AdwSplitButton* _tmp18_;
		GraphsMainSidebarPage* _tmp19_;
		GraphsOperations* _tmp20_;
		GraphsOperations* _tmp21_;
		GraphsMainSidebarPage* _tmp22_;
		GraphsOperations* _tmp23_;
		GraphsOperations* _tmp24_;
		GSimpleAction* _tmp25_;
		GSimpleAction* _tmp26_;
		_tmp8_ = self->priv->_main_page;
		graphs_main_sidebar_page_set_show_empty_data_page (_tmp8_, TRUE);
		_tmp9_ = self->priv->_main_page;
		_tmp10_ = graphs_main_sidebar_page_get_operations (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = graphs_operations_get_shift_button (_tmp11_);
		_tmp13_ = _tmp12_;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp13_, FALSE);
		_tmp14_ = self->priv->_main_page;
		_tmp15_ = graphs_main_sidebar_page_get_operations (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = graphs_operations_get_smoothen_button (_tmp16_);
		_tmp18_ = _tmp17_;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp18_, FALSE);
		_tmp19_ = self->priv->_main_page;
		_tmp20_ = graphs_main_sidebar_page_get_operations (_tmp19_);
		_tmp21_ = _tmp20_;
		graphs_operations_set_cut_sensitivity (_tmp21_, FALSE);
		_tmp22_ = self->priv->_main_page;
		_tmp23_ = graphs_main_sidebar_page_get_operations (_tmp22_);
		_tmp24_ = _tmp23_;
		graphs_operations_set_entry_sensitivity (_tmp24_, FALSE);
		_tmp25_ = export_data_action;
		g_simple_action_set_enabled (_tmp25_, FALSE);
		_tmp26_ = optimize_limits_action;
		g_simple_action_set_enabled (_tmp26_, FALSE);
		_g_object_unref0 (optimize_limits_action);
		_g_object_unref0 (export_data_action);
		return;
	}
	_tmp27_ = self->priv->_main_page;
	graphs_main_sidebar_page_set_show_empty_data_page (_tmp27_, FALSE);
	items_selected = FALSE;
	data_items_selected = FALSE;
	index = (guint) 0;
	{
		GeeIterator* _item_it = NULL;
		GraphsData* _tmp28_;
		GeeIterator* _tmp29_;
		_tmp28_ = self->priv->_data;
		_tmp29_ = gee_iterable_iterator ((GeeIterable*) _tmp28_);
		_item_it = _tmp29_;
		while (TRUE) {
			GeeIterator* _tmp30_;
			GraphsItem* item = NULL;
			GeeIterator* _tmp31_;
			gpointer _tmp32_;
			gboolean data_item = FALSE;
			GraphsItem* _tmp33_;
			GraphsItem* _tmp34_;
			gboolean _tmp35_ = FALSE;
			gboolean _tmp39_ = FALSE;
			guint _tmp44_;
			_tmp30_ = _item_it;
			if (!gee_iterator_next (_tmp30_)) {
				break;
			}
			_tmp31_ = _item_it;
			_tmp32_ = gee_iterator_get (_tmp31_);
			item = (GraphsItem*) _tmp32_;
			_tmp33_ = item;
			data_item = GRAPHS_IS_DATA_ITEM (_tmp33_);
			_tmp34_ = item;
			graphs_window_append_item_row (self, _tmp34_, index, data_item);
			if (items_selected) {
				_tmp35_ = TRUE;
			} else {
				GraphsItem* _tmp36_;
				gboolean _tmp37_;
				gboolean _tmp38_;
				_tmp36_ = item;
				_tmp37_ = graphs_item_get_selected (_tmp36_);
				_tmp38_ = _tmp37_;
				_tmp35_ = _tmp38_;
			}
			items_selected = _tmp35_;
			if (data_items_selected) {
				_tmp39_ = TRUE;
			} else {
				gboolean _tmp40_ = FALSE;
				GraphsItem* _tmp41_;
				gboolean _tmp42_;
				gboolean _tmp43_;
				_tmp41_ = item;
				_tmp42_ = graphs_item_get_selected (_tmp41_);
				_tmp43_ = _tmp42_;
				if (_tmp43_) {
					_tmp40_ = data_item;
				} else {
					_tmp40_ = FALSE;
				}
				_tmp39_ = _tmp40_;
			}
			data_items_selected = _tmp39_;
			_tmp44_ = index;
			index = _tmp44_ + 1;
			_g_object_unref0 (item);
		}
		_g_object_unref0 (_item_it);
	}
	_tmp45_ = self->priv->_main_page;
	_tmp46_ = graphs_main_sidebar_page_get_operations (_tmp45_);
	_tmp47_ = _tmp46_;
	_tmp48_ = graphs_operations_get_shift_button (_tmp47_);
	_tmp49_ = _tmp48_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp49_, items_selected);
	_tmp50_ = self->priv->_main_page;
	_tmp51_ = graphs_main_sidebar_page_get_operations (_tmp50_);
	_tmp52_ = _tmp51_;
	_tmp53_ = graphs_operations_get_smoothen_button (_tmp52_);
	_tmp54_ = _tmp53_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp54_, data_items_selected);
	if (data_items_selected) {
		GraphsMode _tmp56_;
		GraphsMode _tmp57_;
		_tmp56_ = graphs_window_get_mode (self);
		_tmp57_ = _tmp56_;
		_tmp55_ = _tmp57_ == GRAPHS_MODE_SELECT;
	} else {
		_tmp55_ = FALSE;
	}
	_tmp58_ = self->priv->_main_page;
	_tmp59_ = graphs_main_sidebar_page_get_operations (_tmp58_);
	_tmp60_ = _tmp59_;
	graphs_operations_set_cut_sensitivity (_tmp60_, _tmp55_);
	_tmp61_ = self->priv->_main_page;
	_tmp62_ = graphs_main_sidebar_page_get_operations (_tmp61_);
	_tmp63_ = _tmp62_;
	graphs_operations_set_entry_sensitivity (_tmp63_, items_selected);
	_tmp64_ = export_data_action;
	g_simple_action_set_enabled (_tmp64_, items_selected);
	_tmp65_ = optimize_limits_action;
	g_simple_action_set_enabled (_tmp65_, TRUE);
	_g_object_unref0 (optimize_limits_action);
	_g_object_unref0 (export_data_action);
}

void
graphs_window_on_selection_changed (GraphsWindow* self)
{
	GSimpleAction* export_data_action = NULL;
	GAction* _tmp0_;
	GSimpleAction* _tmp1_;
	GraphsData* _tmp2_;
	gboolean items_selected = FALSE;
	gboolean data_items_selected = FALSE;
	GraphsMainSidebarPage* _tmp36_;
	GraphsOperations* _tmp37_;
	GraphsOperations* _tmp38_;
	GtkButton* _tmp39_;
	GtkButton* _tmp40_;
	GraphsMainSidebarPage* _tmp41_;
	GraphsOperations* _tmp42_;
	GraphsOperations* _tmp43_;
	AdwSplitButton* _tmp44_;
	AdwSplitButton* _tmp45_;
	gboolean _tmp46_ = FALSE;
	GraphsMainSidebarPage* _tmp49_;
	GraphsOperations* _tmp50_;
	GraphsOperations* _tmp51_;
	GraphsMainSidebarPage* _tmp52_;
	GraphsOperations* _tmp53_;
	GraphsOperations* _tmp54_;
	GSimpleAction* _tmp55_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_action_map_lookup_action ((GActionMap*) self, "export-data");
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, g_simple_action_get_type (), GSimpleAction));
	export_data_action = _tmp1_;
	_tmp2_ = self->priv->_data;
	if (graphs_data_is_empty (_tmp2_)) {
		GraphsMainSidebarPage* _tmp3_;
		GraphsOperations* _tmp4_;
		GraphsOperations* _tmp5_;
		GtkButton* _tmp6_;
		GtkButton* _tmp7_;
		GraphsMainSidebarPage* _tmp8_;
		GraphsOperations* _tmp9_;
		GraphsOperations* _tmp10_;
		AdwSplitButton* _tmp11_;
		AdwSplitButton* _tmp12_;
		GraphsMainSidebarPage* _tmp13_;
		GraphsOperations* _tmp14_;
		GraphsOperations* _tmp15_;
		GraphsMainSidebarPage* _tmp16_;
		GraphsOperations* _tmp17_;
		GraphsOperations* _tmp18_;
		GSimpleAction* _tmp19_;
		_tmp3_ = self->priv->_main_page;
		_tmp4_ = graphs_main_sidebar_page_get_operations (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = graphs_operations_get_shift_button (_tmp5_);
		_tmp7_ = _tmp6_;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp7_, FALSE);
		_tmp8_ = self->priv->_main_page;
		_tmp9_ = graphs_main_sidebar_page_get_operations (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = graphs_operations_get_smoothen_button (_tmp10_);
		_tmp12_ = _tmp11_;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp12_, FALSE);
		_tmp13_ = self->priv->_main_page;
		_tmp14_ = graphs_main_sidebar_page_get_operations (_tmp13_);
		_tmp15_ = _tmp14_;
		graphs_operations_set_cut_sensitivity (_tmp15_, FALSE);
		_tmp16_ = self->priv->_main_page;
		_tmp17_ = graphs_main_sidebar_page_get_operations (_tmp16_);
		_tmp18_ = _tmp17_;
		graphs_operations_set_entry_sensitivity (_tmp18_, FALSE);
		_tmp19_ = export_data_action;
		g_simple_action_set_enabled (_tmp19_, FALSE);
		_g_object_unref0 (export_data_action);
		return;
	}
	items_selected = FALSE;
	data_items_selected = FALSE;
	{
		GeeIterator* _item_it = NULL;
		GraphsData* _tmp20_;
		GeeIterator* _tmp21_;
		_tmp20_ = self->priv->_data;
		_tmp21_ = gee_iterable_iterator ((GeeIterable*) _tmp20_);
		_item_it = _tmp21_;
		while (TRUE) {
			GeeIterator* _tmp22_;
			GraphsItem* item = NULL;
			GeeIterator* _tmp23_;
			gpointer _tmp24_;
			gboolean data_item = FALSE;
			GraphsItem* _tmp25_;
			gboolean _tmp26_ = FALSE;
			gboolean _tmp30_ = FALSE;
			gboolean _tmp35_ = FALSE;
			_tmp22_ = _item_it;
			if (!gee_iterator_next (_tmp22_)) {
				break;
			}
			_tmp23_ = _item_it;
			_tmp24_ = gee_iterator_get (_tmp23_);
			item = (GraphsItem*) _tmp24_;
			_tmp25_ = item;
			data_item = GRAPHS_IS_DATA_ITEM (_tmp25_);
			if (items_selected) {
				_tmp26_ = TRUE;
			} else {
				GraphsItem* _tmp27_;
				gboolean _tmp28_;
				gboolean _tmp29_;
				_tmp27_ = item;
				_tmp28_ = graphs_item_get_selected (_tmp27_);
				_tmp29_ = _tmp28_;
				_tmp26_ = _tmp29_;
			}
			items_selected = _tmp26_;
			if (data_items_selected) {
				_tmp30_ = TRUE;
			} else {
				gboolean _tmp31_ = FALSE;
				GraphsItem* _tmp32_;
				gboolean _tmp33_;
				gboolean _tmp34_;
				_tmp32_ = item;
				_tmp33_ = graphs_item_get_selected (_tmp32_);
				_tmp34_ = _tmp33_;
				if (_tmp34_) {
					_tmp31_ = data_item;
				} else {
					_tmp31_ = FALSE;
				}
				_tmp30_ = _tmp31_;
			}
			data_items_selected = _tmp30_;
			if (items_selected) {
				_tmp35_ = data_items_selected;
			} else {
				_tmp35_ = FALSE;
			}
			if (_tmp35_) {
				_g_object_unref0 (item);
				break;
			}
			_g_object_unref0 (item);
		}
		_g_object_unref0 (_item_it);
	}
	_tmp36_ = self->priv->_main_page;
	_tmp37_ = graphs_main_sidebar_page_get_operations (_tmp36_);
	_tmp38_ = _tmp37_;
	_tmp39_ = graphs_operations_get_shift_button (_tmp38_);
	_tmp40_ = _tmp39_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp40_, items_selected);
	_tmp41_ = self->priv->_main_page;
	_tmp42_ = graphs_main_sidebar_page_get_operations (_tmp41_);
	_tmp43_ = _tmp42_;
	_tmp44_ = graphs_operations_get_smoothen_button (_tmp43_);
	_tmp45_ = _tmp44_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp45_, data_items_selected);
	if (data_items_selected) {
		GraphsMode _tmp47_;
		GraphsMode _tmp48_;
		_tmp47_ = graphs_window_get_mode (self);
		_tmp48_ = _tmp47_;
		_tmp46_ = _tmp48_ == GRAPHS_MODE_SELECT;
	} else {
		_tmp46_ = FALSE;
	}
	_tmp49_ = self->priv->_main_page;
	_tmp50_ = graphs_main_sidebar_page_get_operations (_tmp49_);
	_tmp51_ = _tmp50_;
	graphs_operations_set_cut_sensitivity (_tmp51_, _tmp46_);
	_tmp52_ = self->priv->_main_page;
	_tmp53_ = graphs_main_sidebar_page_get_operations (_tmp52_);
	_tmp54_ = _tmp53_;
	graphs_operations_set_entry_sensitivity (_tmp54_, items_selected);
	_tmp55_ = export_data_action;
	g_simple_action_set_enabled (_tmp55_, items_selected);
	_g_object_unref0 (export_data_action);
}

static Block25Data*
block25_data_ref (Block25Data* _data25_)
{
	g_atomic_int_inc (&_data25_->_ref_count_);
	return _data25_;
}

static void
block25_data_unref (void * _userdata_)
{
	Block25Data* _data25_;
	_data25_ = (Block25Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data25_->_ref_count_)) {
		GraphsWindow* self;
		self = _data25_->self;
		_g_object_unref0 (_data25_->row);
		_g_object_unref0 (_data25_->item);
		_g_object_unref0 (self);
		g_slice_free (Block25Data, _data25_);
	}
}

static GdkContentProvider*
__lambda26_ (Block25Data* _data25_,
             gdouble x,
             gdouble y)
{
	GraphsWindow* self;
	GValue val = {0};
	GValue _tmp0_ = {0};
	GValue _tmp1_;
	GdkContentProvider* _tmp2_;
	GdkContentProvider* result;
	self = _data25_->self;
	_data25_->drag_x = x;
	_data25_->drag_y = y;
	g_value_init (&_tmp0_, GRAPHS_TYPE_ITEM_BOX);
	val = _tmp0_;
	g_value_set_object (&val, (GObject*) _data25_->row);
	_tmp1_ = val;
	_tmp2_ = gdk_content_provider_new_for_value (&_tmp1_);
	result = _tmp2_;
	G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
	return result;
}

static GdkContentProvider*
___lambda26__gtk_drag_source_prepare (GtkDragSource* _sender,
                                      gdouble x,
                                      gdouble y,
                                      gpointer self)
{
	GdkContentProvider* result;
	result = __lambda26_ (self, x, y);
	return result;
}

static void
__lambda27_ (Block25Data* _data25_,
             GdkDrag* drag)
{
	GraphsWindow* self;
	GtkListBox* drag_widget = NULL;
	GtkListBox* _tmp0_;
	GraphsItemBox* drag_row = NULL;
	GraphsItemBox* _tmp1_;
	GtkDragIcon* icon = NULL;
	GtkDragIcon* _tmp2_;
	self = _data25_->self;
	g_return_if_fail (drag != NULL);
	_tmp0_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp0_);
	drag_widget = _tmp0_;
	gtk_widget_set_size_request ((GtkWidget*) drag_widget, gtk_widget_get_width ((GtkWidget*) _data25_->row), gtk_widget_get_height ((GtkWidget*) _data25_->row));
	gtk_widget_add_css_class ((GtkWidget*) drag_widget, "boxed-list");
	_tmp1_ = graphs_item_box_new (self, _data25_->item, _data25_->index);
	g_object_ref_sink (_tmp1_);
	drag_row = _tmp1_;
	gtk_list_box_append (drag_widget, (GtkWidget*) drag_row);
	gtk_list_box_drag_highlight_row (drag_widget, (GtkListBoxRow*) drag_row);
	_tmp2_ = (GtkDragIcon*) gtk_drag_icon_get_for_drag (drag);
	g_object_ref_sink (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_drag_icon_get_type (), GtkDragIcon));
	icon = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_drag_icon_get_type (), GtkDragIcon);
	gtk_drag_icon_set_child (icon, (GtkWidget*) drag_widget);
	gdk_drag_set_hotspot (drag, (gint) _data25_->drag_x, (gint) _data25_->drag_y);
	_g_object_unref0 (icon);
	_g_object_unref0 (drag_row);
	_g_object_unref0 (drag_widget);
}

static void
___lambda27__gtk_drag_source_drag_begin (GtkDragSource* _sender,
                                         GdkDrag* drag,
                                         gpointer self)
{
	__lambda27_ (self, drag);
}

static void
__lambda28_ (Block25Data* _data25_)
{
	GraphsWindow* self;
	GraphsMainSidebarPage* _tmp0_;
	GtkListBox* _tmp1_;
	GtkListBox* _tmp2_;
	self = _data25_->self;
	_tmp0_ = self->priv->_main_page;
	_tmp1_ = graphs_main_sidebar_page_get_item_list (_tmp0_);
	_tmp2_ = _tmp1_;
	gtk_list_box_drag_highlight_row (_tmp2_, (GtkListBoxRow*) _data25_->row);
}

static void
___lambda28__gtk_drop_controller_motion_enter (GtkDropControllerMotion* _sender,
                                               gdouble x,
                                               gdouble y,
                                               gpointer self)
{
	__lambda28_ (self);
}

static void
__lambda29_ (GraphsWindow* self)
{
	GraphsMainSidebarPage* _tmp0_;
	GtkListBox* _tmp1_;
	GtkListBox* _tmp2_;
	_tmp0_ = self->priv->_main_page;
	_tmp1_ = graphs_main_sidebar_page_get_item_list (_tmp0_);
	_tmp2_ = _tmp1_;
	gtk_list_box_drag_unhighlight_row (_tmp2_);
}

static void
___lambda29__gtk_drop_controller_motion_leave (GtkDropControllerMotion* _sender,
                                               gpointer self)
{
	__lambda29_ ((GraphsWindow*) self);
}

static void
__lambda30_ (Block25Data* _data25_)
{
	GraphsWindow* self;
	self = _data25_->self;
	graphs_window_edit_item (self, _data25_->item);
}

static void
___lambda30__adw_action_row_activated (AdwActionRow* _sender,
                                       gpointer self)
{
	__lambda30_ (self);
}

static void
graphs_window_append_item_row (GraphsWindow* self,
                               GraphsItem* item,
                               guint index,
                               gboolean is_data_item)
{
	Block25Data* _data25_;
	GraphsItem* _tmp0_;
	GraphsItemBox* _tmp1_;
	GtkDropControllerMotion* drop_controller = NULL;
	GtkDropControllerMotion* _tmp2_;
	GtkDragSource* drag_source = NULL;
	GtkDragSource* _tmp3_ = NULL;
	GtkEventController* _tmp4_;
	GtkEventController* _tmp5_;
	GraphsMainSidebarPage* _tmp6_;
	GtkListBox* _tmp7_;
	GtkListBox* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_data25_ = g_slice_new0 (Block25Data);
	_data25_->_ref_count_ = 1;
	_data25_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (item);
	_g_object_unref0 (_data25_->item);
	_data25_->item = _tmp0_;
	_data25_->index = index;
	_tmp1_ = graphs_item_box_new (self, _data25_->item, _data25_->index);
	g_object_ref_sink (_tmp1_);
	_data25_->row = _tmp1_;
	graphs_item_box_setup_interactions (_data25_->row, is_data_item);
	_data25_->drag_x = 0.0;
	_data25_->drag_y = 0.0;
	_tmp2_ = (GtkDropControllerMotion*) gtk_drop_controller_motion_new ();
	drop_controller = _tmp2_;
	_tmp3_ = gtk_drag_source_new ();
	gtk_drag_source_set_actions (_tmp3_, GDK_ACTION_MOVE);
	drag_source = _tmp3_;
	_tmp4_ = _g_object_ref0 ((GtkEventController*) drag_source);
	gtk_widget_add_controller ((GtkWidget*) _data25_->row, _tmp4_);
	_tmp5_ = _g_object_ref0 ((GtkEventController*) drop_controller);
	gtk_widget_add_controller ((GtkWidget*) _data25_->row, _tmp5_);
	g_signal_connect_data (drag_source, "prepare", (GCallback) ___lambda26__gtk_drag_source_prepare, block25_data_ref (_data25_), (GClosureNotify) block25_data_unref, 0);
	g_signal_connect_data (drag_source, "drag-begin", (GCallback) ___lambda27__gtk_drag_source_drag_begin, block25_data_ref (_data25_), (GClosureNotify) block25_data_unref, 0);
	g_signal_connect_data (drop_controller, "enter", (GCallback) ___lambda28__gtk_drop_controller_motion_enter, block25_data_ref (_data25_), (GClosureNotify) block25_data_unref, 0);
	g_signal_connect_object (drop_controller, "leave", (GCallback) ___lambda29__gtk_drop_controller_motion_leave, self, 0);
	g_signal_connect_data ((AdwActionRow*) _data25_->row, "activated", (GCallback) ___lambda30__adw_action_row_activated, block25_data_ref (_data25_), (GClosureNotify) block25_data_unref, 0);
	_tmp6_ = self->priv->_main_page;
	_tmp7_ = graphs_main_sidebar_page_get_item_list (_tmp6_);
	_tmp8_ = _tmp7_;
	gtk_list_box_append (_tmp8_, (GtkWidget*) _data25_->row);
	_g_object_unref0 (drag_source);
	_g_object_unref0 (drop_controller);
	block25_data_unref (_data25_);
	_data25_ = NULL;
}

void
graphs_window_push_sidebar_page (GraphsWindow* self,
                                 AdwNavigationPage* page)
{
	AdwNavigationView* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (page != NULL);
	_tmp0_ = self->priv->_sidebar_navigation_view;
	adw_navigation_view_push (_tmp0_, page);
}

void
graphs_window_edit_item (GraphsWindow* self,
                         GraphsItem* item)
{
	GraphsEditItemPage* _tmp0_;
	GraphsEditItemPage* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = self->priv->_edit_page;
	graphs_edit_item_page_load_item (_tmp0_, item);
	_tmp1_ = self->priv->_edit_page;
	graphs_window_push_sidebar_page (self, (AdwNavigationPage*) _tmp1_);
}

void
graphs_window_open_figure_settings (GraphsWindow* self,
                                    const gchar* highlighted)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp4_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = graphs_window_get_is_main_view (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		GraphsFigureSettingsPage* _tmp2_;
		GraphsFigureSettingsPage* _tmp3_;
		_tmp2_ = graphs_figure_settings_page_new (self);
		g_object_ref_sink (_tmp2_);
		_g_object_unref0 (self->priv->figure_settings_page);
		self->priv->figure_settings_page = _tmp2_;
		_tmp3_ = self->priv->figure_settings_page;
		graphs_window_push_sidebar_page (self, (AdwNavigationPage*) _tmp3_);
	}
	if (highlighted != NULL) {
		AdwNavigationView* _tmp5_;
		AdwNavigationPage* _tmp6_;
		GraphsFigureSettingsPage* _tmp7_;
		_tmp5_ = self->priv->_sidebar_navigation_view;
		_tmp6_ = adw_navigation_view_get_visible_page (_tmp5_);
		_tmp7_ = self->priv->figure_settings_page;
		_tmp4_ = _tmp6_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, adw_navigation_page_get_type (), AdwNavigationPage);
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		GraphsFigureSettingsPage* _tmp8_;
		_tmp8_ = self->priv->figure_settings_page;
		graphs_figure_settings_page_focus_widget (_tmp8_, highlighted);
	}
}

/**
         * Add a toast to the window.
         */
void
graphs_window_add_toast (GraphsWindow* 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_);
}

/**
         * Add a toast to the window.
         *
         * The toast is created automatically with the given title.
         */
void
graphs_window_add_toast_string (GraphsWindow* self,
                                const gchar* title)
{
	AdwToast* _tmp0_;
	AdwToast* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (title != NULL);
	_tmp0_ = adw_toast_new (title);
	_tmp1_ = _tmp0_;
	graphs_window_add_toast (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
}

/**
         * Add a toast to the window.
         *
         * The toast is created automatically with the given title.
         * An action is automatically created, to open the containing folder
         * of file.
         */
static Block26Data*
block26_data_ref (Block26Data* _data26_)
{
	g_atomic_int_inc (&_data26_->_ref_count_);
	return _data26_;
}

static void
block26_data_unref (void * _userdata_)
{
	Block26Data* _data26_;
	_data26_ = (Block26Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data26_->_ref_count_)) {
		GraphsWindow* self;
		self = _data26_->self;
		_g_object_unref0 (_data26_->file);
		_g_object_unref0 (self);
		g_slice_free (Block26Data, _data26_);
	}
}

static void
__lambda31_ (Block26Data* _data26_)
{
	GraphsWindow* self;
	self = _data26_->self;
	graphs_tools_open_file_location (_data26_->file);
}

static void
___lambda31__g_simple_action_activate (GSimpleAction* _sender,
                                       GVariant* parameter,
                                       gpointer self)
{
	__lambda31_ (self);
}

void
graphs_window_add_toast_string_with_file (GraphsWindow* self,
                                          const gchar* title,
                                          GFile* file)
{
	Block26Data* _data26_;
	GFile* _tmp0_;
	GSimpleAction* action = NULL;
	GSimpleAction* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	AdwToast* _tmp4_ = NULL;
	AdwToast* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (title != NULL);
	g_return_if_fail (file != NULL);
	_data26_ = g_slice_new0 (Block26Data);
	_data26_->_ref_count_ = 1;
	_data26_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (file);
	_g_object_unref0 (_data26_->file);
	_data26_->file = _tmp0_;
	_tmp1_ = g_simple_action_new ("open-file-location", NULL);
	action = _tmp1_;
	g_signal_connect_data (action, "activate", (GCallback) ___lambda31__g_simple_action_activate, block26_data_ref (_data26_), (GClosureNotify) block26_data_unref, 0);
	g_action_map_add_action ((GActionMap*) self, (GAction*) action);
	_tmp2_ = g_strdup (_ ("Open Location"));
	_tmp3_ = g_strdup ("win.open-file-location");
	_tmp4_ = adw_toast_new (title);
	adw_toast_set_button_label (_tmp4_, _tmp2_);
	_g_free0 (_tmp2_);
	adw_toast_set_action_name (_tmp4_, _tmp3_);
	_g_free0 (_tmp3_);
	_tmp5_ = _tmp4_;
	graphs_window_add_toast (self, _tmp5_);
	_g_object_unref0 (_tmp5_);
	_g_object_unref0 (action);
	block26_data_unref (_data26_);
	_data26_ = NULL;
}

/**
         * Add Toast with undo action.
         */
void
graphs_window_add_undo_toast (GraphsWindow* self,
                              const gchar* title)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	AdwToast* _tmp2_ = NULL;
	AdwToast* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (title != NULL);
	_tmp0_ = g_strdup (_ ("Undo"));
	_tmp1_ = g_strdup ("win.undo");
	_tmp2_ = adw_toast_new (title);
	adw_toast_set_button_label (_tmp2_, _tmp0_);
	_g_free0 (_tmp0_);
	adw_toast_set_action_name (_tmp2_, _tmp1_);
	_g_free0 (_tmp1_);
	_tmp3_ = _tmp2_;
	graphs_window_add_toast (self, _tmp3_);
	_g_object_unref0 (_tmp3_);
}

static void
____lambda33_ (GraphsWindow* self,
               GObject* o,
               GAsyncResult* _result_)
{
	g_return_if_fail (_result_ != NULL);
	if (graphs_project_save_finish (_result_)) {
		self->priv->_force_close = TRUE;
		gtk_window_close ((GtkWindow*) self);
	}
}

static void
_____lambda33__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda33_ ((GraphsWindow*) self, source_object, res);
	g_object_unref (self);
}

static void
___lambda32_ (GraphsWindow* self,
              AdwAlertDialog* d,
              const gchar* response)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	g_return_if_fail (d != NULL);
	g_return_if_fail (response != NULL);
	_tmp0_ = response;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("discard")))) {
		switch (0) {
			default:
			{
				{
					self->priv->_force_close = TRUE;
					gtk_window_close ((GtkWindow*) self);
					break;
				}
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("save")))) {
		switch (0) {
			default:
			{
				{
					graphs_project_save (self, FALSE, _____lambda33__gasync_ready_callback, g_object_ref (self));
					break;
				}
			}
		}
	}
}

static void
____lambda32__adw_alert_dialog_response (AdwAlertDialog* _sender,
                                         const gchar* response,
                                         gpointer self)
{
	___lambda32_ ((GraphsWindow*) self, _sender, response);
}

static gboolean
graphs_window_real_close_request (GtkWindow* base)
{
	GraphsWindow * self;
	GraphsApplication* application = NULL;
	GtkApplication* _tmp0_;
	GtkApplication* _tmp1_;
	GraphsApplication* _tmp2_;
	GraphsData* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	GraphsApplication* _tmp10_;
	gboolean result;
	self = (GraphsWindow*) base;
	_tmp0_ = gtk_window_get_application ((GtkWindow*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GRAPHS_TYPE_APPLICATION, GraphsApplication));
	application = _tmp2_;
	if (self->priv->_force_close) {
		GraphsApplication* _tmp3_;
		_tmp3_ = application;
		graphs_application_on_main_window_closed (_tmp3_, self);
		result = FALSE;
		_g_object_unref0 (application);
		return result;
	}
	_tmp4_ = self->priv->_data;
	_tmp5_ = graphs_data_get_unsaved (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_) {
		AdwAlertDialog* dialog = NULL;
		GObject* _tmp7_;
		AdwAlertDialog* _tmp8_;
		AdwAlertDialog* _tmp9_;
		_tmp7_ = graphs_tools_build_dialog ("save_project_changes");
		dialog = G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, adw_alert_dialog_get_type (), AdwAlertDialog);
		_tmp8_ = dialog;
		g_signal_connect_object (_tmp8_, "response", (GCallback) ____lambda32__adw_alert_dialog_response, self, 0);
		_tmp9_ = dialog;
		adw_dialog_present ((AdwDialog*) _tmp9_, (GtkWidget*) self);
		result = TRUE;
		_g_object_unref0 (dialog);
		_g_object_unref0 (application);
		return result;
	}
	_tmp10_ = application;
	graphs_application_on_main_window_closed (_tmp10_, self);
	result = FALSE;
	_g_object_unref0 (application);
	return result;
}

gdouble
graphs_window_get_operation_value (GraphsWindow* self,
                                   const gchar* name,
                                   GError** error)
{
	GtkEntry* entry = NULL;
	GraphsMainSidebarPage* _tmp0_;
	GraphsOperations* _tmp1_;
	GraphsOperations* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GtkEntry* _tmp5_ = NULL;
	gdouble _tmp6_ = 0.0;
	const gchar* _tmp7_;
	GError* _inner_error0_ = NULL;
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	g_return_val_if_fail (name != NULL, -1.0);
	_tmp0_ = self->priv->_main_page;
	_tmp1_ = graphs_main_sidebar_page_get_operations (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strconcat (name, "_entry", NULL);
	_tmp4_ = _tmp3_;
	g_object_get ((GObject*) _tmp2_, _tmp4_, &_tmp5_, NULL);
	_g_object_unref0 (entry);
	entry = _tmp5_;
	_g_free0 (_tmp4_);
	_tmp7_ = gtk_editable_get_text ((GtkEditable*) entry);
	_tmp6_ = graphs_evaluate_string (_tmp7_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == GRAPHS_MATH_ERROR) {
			gdouble _tmp8_ = -1.0;
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (entry);
			return _tmp8_;
		} else {
			gdouble _tmp9_ = -1.0;
			_g_object_unref0 (entry);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp9_;
		}
	}
	result = _tmp6_;
	_g_object_unref0 (entry);
	return result;
}

GraphsWindow*
graphs_window_construct (GType object_type)
{
	GraphsWindow * self = NULL;
	self = (GraphsWindow*) g_object_new (object_type, NULL);
	return self;
}

GraphsWindow*
graphs_window_new (void)
{
	return graphs_window_construct (GRAPHS_TYPE_WINDOW);
}

static GtkButton*
graphs_window_get_view_back_button (GraphsWindow* self)
{
	GtkButton* result;
	GtkButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_view_back_button;
	result = _tmp0_;
	return result;
}

static GtkButton*
graphs_window_get_view_forward_button (GraphsWindow* self)
{
	GtkButton* result;
	GtkButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_view_forward_button;
	result = _tmp0_;
	return result;
}

static GtkButton*
graphs_window_get_optimize_limits_button (GraphsWindow* self)
{
	GtkButton* result;
	GtkButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_optimize_limits_button;
	result = _tmp0_;
	return result;
}

AdwOverlaySplitView*
graphs_window_get_overlay_split_view (GraphsWindow* self)
{
	AdwOverlaySplitView* result;
	AdwOverlaySplitView* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_overlay_split_view;
	result = _tmp0_;
	return result;
}

static AdwToastOverlay*
graphs_window_get_toast_overlay (GraphsWindow* self)
{
	AdwToastOverlay* result;
	AdwToastOverlay* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_toast_overlay;
	result = _tmp0_;
	return result;
}

static AdwWindowTitle*
graphs_window_get_content_title (GraphsWindow* self)
{
	AdwWindowTitle* result;
	AdwWindowTitle* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content_title;
	result = _tmp0_;
	return result;
}

static GtkOverlay*
graphs_window_get_drag_overlay (GraphsWindow* self)
{
	GtkOverlay* result;
	GtkOverlay* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_drag_overlay;
	result = _tmp0_;
	return result;
}

static GtkRevealer*
graphs_window_get_drag_revealer (GraphsWindow* self)
{
	GtkRevealer* result;
	GtkRevealer* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_drag_revealer;
	result = _tmp0_;
	return result;
}

AdwToolbarView*
graphs_window_get_content_view (GraphsWindow* self)
{
	AdwToolbarView* result;
	AdwToolbarView* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content_view;
	result = _tmp0_;
	return result;
}

static AdwNavigationView*
graphs_window_get_sidebar_navigation_view (GraphsWindow* self)
{
	AdwNavigationView* result;
	AdwNavigationView* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_sidebar_navigation_view;
	result = _tmp0_;
	return result;
}

static GraphsMainSidebarPage*
graphs_window_get_main_page (GraphsWindow* self)
{
	GraphsMainSidebarPage* result;
	GraphsMainSidebarPage* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_main_page;
	result = _tmp0_;
	return result;
}

static GraphsEditItemPage*
graphs_window_get_edit_page (GraphsWindow* self)
{
	GraphsEditItemPage* result;
	GraphsEditItemPage* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_edit_page;
	result = _tmp0_;
	return result;
}

GraphsData*
graphs_window_get_data (GraphsWindow* self)
{
	GraphsData* result;
	GraphsData* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_data;
	result = _tmp0_;
	return result;
}

void
graphs_window_set_data (GraphsWindow* self,
                        GraphsData* value)
{
	GraphsData* old_value;
	g_return_if_fail (self != NULL);
	old_value = graphs_window_get_data (self);
	if (old_value != value) {
		GraphsData* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_data);
		self->priv->_data = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, graphs_window_properties[GRAPHS_WINDOW_DATA_PROPERTY]);
	}
}

GtkCssProvider*
graphs_window_get_css_provider (GraphsWindow* self)
{
	GtkCssProvider* result;
	GtkCssProvider* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_css_provider;
	result = _tmp0_;
	return result;
}

static void
graphs_window_set_css_provider (GraphsWindow* self,
                                GtkCssProvider* value)
{
	GtkCssProvider* old_value;
	g_return_if_fail (self != NULL);
	old_value = graphs_window_get_css_provider (self);
	if (old_value != value) {
		GtkCssProvider* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_css_provider);
		self->priv->_css_provider = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, graphs_window_properties[GRAPHS_WINDOW_CSS_PROVIDER_PROPERTY]);
	}
}

GtkEventControllerKey*
graphs_window_get_key_controller (GraphsWindow* self)
{
	GtkEventControllerKey* result;
	GtkEventControllerKey* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_key_controller;
	result = _tmp0_;
	return result;
}

static void
graphs_window_set_key_controller (GraphsWindow* self,
                                  GtkEventControllerKey* value)
{
	GtkEventControllerKey* old_value;
	g_return_if_fail (self != NULL);
	old_value = graphs_window_get_key_controller (self);
	if (old_value != value) {
		GtkEventControllerKey* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_key_controller);
		self->priv->_key_controller = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, graphs_window_properties[GRAPHS_WINDOW_KEY_CONTROLLER_PROPERTY]);
	}
}

GraphsMode
graphs_window_get_mode (GraphsWindow* self)
{
	GraphsMode result;
	GraphsMainSidebarPage* _tmp0_;
	GraphsMode _tmp1_;
	GraphsMode _tmp2_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_main_page;
	_tmp1_ = graphs_main_sidebar_page_get_mode (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
graphs_window_set_mode (GraphsWindow* self,
                        GraphsMode value)
{
	GraphsMainSidebarPage* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_main_page;
	graphs_main_sidebar_page_set_mode (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, graphs_window_properties[GRAPHS_WINDOW_MODE_PROPERTY]);
}

GraphsCanvas*
graphs_window_get_canvas (GraphsWindow* self)
{
	GraphsCanvas* result;
	AdwToastOverlay* _tmp0_;
	GtkWidget* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_toast_overlay;
	_tmp1_ = adw_toast_overlay_get_child (_tmp0_);
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GRAPHS_TYPE_CANVAS, GraphsCanvas);
	return result;
}

void
graphs_window_set_canvas (GraphsWindow* self,
                          GraphsCanvas* value)
{
	AdwToastOverlay* _tmp0_;
	g_return_if_fail (self != NULL);
	g_object_bind_property_with_closures ((GObject*) value, "mode", (GObject*) self, "mode", 2, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp0_ = self->priv->_toast_overlay;
	adw_toast_overlay_set_child (_tmp0_, (GtkWidget*) value);
	gtk_widget_grab_focus ((GtkWidget*) value);
	g_object_notify_by_pspec ((GObject *) self, graphs_window_properties[GRAPHS_WINDOW_CANVAS_PROPERTY]);
}

gboolean
graphs_window_get_is_main_view (GraphsWindow* self)
{
	gboolean result;
	AdwNavigationView* _tmp0_;
	AdwNavigationPage* _tmp1_;
	GraphsMainSidebarPage* _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_sidebar_navigation_view;
	_tmp1_ = adw_navigation_view_get_visible_page (_tmp0_);
	_tmp2_ = self->priv->_main_page;
	result = _tmp1_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, adw_navigation_page_get_type (), AdwNavigationPage);
	return result;
}

static Block27Data*
block27_data_ref (Block27Data* _data27_)
{
	g_atomic_int_inc (&_data27_->_ref_count_);
	return _data27_;
}

static void
block27_data_unref (void * _userdata_)
{
	Block27Data* _data27_;
	_data27_ = (Block27Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data27_->_ref_count_)) {
		GraphsWindow* self;
		self = _data27_->self;
		_g_object_unref0 (_data27_->file_drop_target);
		_g_object_unref0 (self);
		g_slice_free (Block27Data, _data27_);
	}
}

static gboolean
_graphs_window___lambda34_ (GraphsWindow* self,
                            GtkDropTarget* drop,
                            GValue* val,
                            gdouble x,
                            gdouble y)
{
	GraphsItemBox* value_row = NULL;
	GObject* _tmp0_;
	GraphsItemBox* _tmp1_;
	GraphsItemBox* target_row = NULL;
	GraphsMainSidebarPage* _tmp2_;
	GtkListBox* _tmp3_;
	GtkListBox* _tmp4_;
	GtkListBoxRow* _tmp5_;
	GraphsItemBox* _tmp6_;
	gboolean _tmp7_ = FALSE;
	GraphsItemBox* _tmp8_;
	GraphsItemBox* _tmp10_;
	GraphsWindow* _tmp11_;
	GraphsWindow* _tmp12_;
	GraphsItemBox* _tmp13_;
	GraphsItemBox* _tmp14_;
	GraphsItemBox* _tmp15_;
	gboolean result;
	g_return_val_if_fail (drop != NULL, FALSE);
	g_return_val_if_fail (val != NULL, FALSE);
	_tmp0_ = g_value_get_object (val);
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GRAPHS_TYPE_ITEM_BOX, GraphsItemBox));
	value_row = _tmp1_;
	_tmp2_ = self->priv->_main_page;
	_tmp3_ = graphs_main_sidebar_page_get_item_list (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = gtk_list_box_get_row_at_y (_tmp4_, (gint) y);
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GRAPHS_TYPE_ITEM_BOX, GraphsItemBox));
	target_row = _tmp6_;
	_tmp8_ = value_row;
	if (_tmp8_ == NULL) {
		_tmp7_ = TRUE;
	} else {
		GraphsItemBox* _tmp9_;
		_tmp9_ = target_row;
		_tmp7_ = _tmp9_ == NULL;
	}
	if (_tmp7_) {
		result = FALSE;
		_g_object_unref0 (target_row);
		_g_object_unref0 (value_row);
		return result;
	}
	_tmp10_ = value_row;
	_tmp11_ = graphs_item_box_get_window (_tmp10_);
	_tmp12_ = _tmp11_;
	if (_tmp12_ != self) {
		result = FALSE;
		_g_object_unref0 (target_row);
		_g_object_unref0 (value_row);
		return result;
	}
	_tmp13_ = target_row;
	_tmp14_ = value_row;
	graphs_item_box_change_position (_tmp13_, (guint) gtk_list_box_row_get_index ((GtkListBoxRow*) _tmp14_));
	_tmp15_ = target_row;
	gtk_widget_set_state_flags ((GtkWidget*) _tmp15_, GTK_STATE_FLAG_NORMAL, TRUE);
	result = TRUE;
	_g_object_unref0 (target_row);
	_g_object_unref0 (value_row);
	return result;
}

static gboolean
__graphs_window___lambda34__gtk_drop_target_drop (GtkDropTarget* _sender,
                                                  GValue* value,
                                                  gdouble x,
                                                  gdouble y,
                                                  gpointer self)
{
	gboolean result;
	result = _graphs_window___lambda34_ ((GraphsWindow*) self, _sender, value, x, y);
	return result;
}

static void
_graphs_window___lambda35_ (Block27Data* _data27_)
{
	GraphsWindow* self;
	gboolean reveal = FALSE;
	GtkDropTarget* _tmp0_;
	GdkDrop* _tmp1_;
	GdkDrop* _tmp2_;
	GtkRevealer* _tmp3_;
	self = _data27_->self;
	_tmp0_ = _data27_->file_drop_target;
	_tmp1_ = gtk_drop_target_get_current_drop (_tmp0_);
	_tmp2_ = _tmp1_;
	reveal = _tmp2_ != NULL;
	_tmp3_ = self->priv->_drag_revealer;
	gtk_revealer_set_reveal_child (_tmp3_, reveal);
	if (reveal) {
		GtkOverlay* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		_tmp4_ = self->priv->_drag_overlay;
		_tmp5_ = gtk_overlay_get_child (_tmp4_);
		_tmp6_ = _tmp5_;
		gtk_widget_add_css_class (_tmp6_, "blurred");
	} else {
		GtkOverlay* _tmp7_;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp9_;
		_tmp7_ = self->priv->_drag_overlay;
		_tmp8_ = gtk_overlay_get_child (_tmp7_);
		_tmp9_ = _tmp8_;
		gtk_widget_remove_css_class (_tmp9_, "blurred");
	}
}

static void
__graphs_window___lambda35__g_object_notify (GObject* _sender,
                                             GParamSpec* pspec,
                                             gpointer self)
{
	_graphs_window___lambda35_ (self);
}

static gboolean
_graphs_window___lambda36_ (GraphsWindow* self,
                            GtkDropTarget* drop,
                            GValue* val,
                            gdouble x,
                            gdouble y)
{
	GSList* file_list = NULL;
	GValue _tmp0_;
	GSList* _tmp1_;
	GListStore* settings_list = NULL;
	GListStore* _tmp2_;
	GSList* _tmp3_;
	GListStore* _tmp9_;
	GraphsImportDialog* _tmp10_;
	GraphsImportDialog* _tmp11_;
	gboolean result;
	g_return_val_if_fail (drop != NULL, FALSE);
	g_return_val_if_fail (val != NULL, FALSE);
	_tmp0_ = *val;
	_tmp1_ = gdk_file_list_get_files (g_value_get_boxed (&_tmp0_));
	file_list = _tmp1_;
	_tmp2_ = g_list_store_new (GRAPHS_TYPE_IMPORT_SETTINGS);
	settings_list = _tmp2_;
	_tmp3_ = file_list;
	{
		GSList* file_collection = NULL;
		GSList* file_it = NULL;
		file_collection = _tmp3_;
		for (file_it = file_collection; file_it != NULL; file_it = file_it->next) {
			GFile* _tmp4_;
			GFile* file = NULL;
			_tmp4_ = _g_object_ref0 ((GFile*) file_it->data);
			file = _tmp4_;
			{
				GListStore* _tmp5_;
				GFile* _tmp6_;
				GraphsImportSettings* _tmp7_;
				GraphsImportSettings* _tmp8_;
				_tmp5_ = settings_list;
				_tmp6_ = file;
				_tmp7_ = graphs_data_importer_get_settings_for_file (_tmp6_);
				_tmp8_ = _tmp7_;
				g_list_store_append (_tmp5_, (GObject*) _tmp8_);
				_g_object_unref0 (_tmp8_);
				_g_object_unref0 (file);
			}
		}
	}
	_tmp9_ = settings_list;
	_tmp10_ = graphs_import_dialog_new (self, _tmp9_);
	g_object_ref_sink (_tmp10_);
	_tmp11_ = _tmp10_;
	_g_object_unref0 (_tmp11_);
	result = TRUE;
	_g_object_unref0 (settings_list);
	(file_list == NULL) ? NULL : (file_list = (g_slist_free (file_list), NULL));
	return result;
}

static gboolean
__graphs_window___lambda36__gtk_drop_target_drop (GtkDropTarget* _sender,
                                                  GValue* value,
                                                  gdouble x,
                                                  gdouble y,
                                                  gpointer self)
{
	gboolean result;
	result = _graphs_window___lambda36_ ((GraphsWindow*) self, _sender, value, x, y);
	return result;
}

static void
_graphs_window___lambda40_ (GraphsWindow* self)
{
	g_object_notify ((GObject*) self, "is_main_view");
	graphs_window_update_history_actions (self);
	graphs_window_update_close_project_action (self);
}

static void
__graphs_window___lambda40__adw_navigation_view_pushed (AdwNavigationView* _sender,
                                                        gpointer self)
{
	_graphs_window___lambda40_ ((GraphsWindow*) self);
}

static void
_graphs_window___lambda41_ (GraphsWindow* self,
                            AdwNavigationView* view,
                            AdwNavigationPage* page)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (view != NULL);
	g_return_if_fail (page != NULL);
	_tmp0_ = graphs_window_get_is_main_view (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		GraphsData* _tmp2_;
		_tmp2_ = self->priv->_data;
		graphs_data_add_history_state (_tmp2_);
	}
	g_object_notify ((GObject*) self, "is_main_view");
	graphs_window_update_history_actions (self);
	graphs_window_update_close_project_action (self);
}

static void
__graphs_window___lambda41__adw_navigation_view_popped (AdwNavigationView* _sender,
                                                        AdwNavigationPage* page,
                                                        gpointer self)
{
	_graphs_window___lambda41_ ((GraphsWindow*) self, _sender, page);
}

static void
_graphs_window_update_history_actions_g_object_notify (GObject* _sender,
                                                       GParamSpec* pspec,
                                                       gpointer self)
{
	graphs_window_update_history_actions ((GraphsWindow*) self);
}

static void
_graphs_window_on_items_changed_g_list_model_items_changed (GListModel* _sender,
                                                            guint position,
                                                            guint removed,
                                                            guint added,
                                                            gpointer self)
{
	graphs_window_on_items_changed ((GraphsWindow*) self);
}

static void
_graphs_window_on_selection_changed_gtk_selection_model_selection_changed (GtkSelectionModel* _sender,
                                                                           guint position,
                                                                           guint n_items,
                                                                           gpointer self)
{
	graphs_window_on_selection_changed ((GraphsWindow*) self);
}

static void
_graphs_window_on_unsaved_change_g_object_notify (GObject* _sender,
                                                  GParamSpec* pspec,
                                                  gpointer self)
{
	graphs_window_on_unsaved_change ((GraphsWindow*) self);
}

static GObject *
graphs_window_constructor (GType type,
                           guint n_construct_properties,
                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GraphsWindow * self;
	Block27Data* _data27_;
	GtkCssProvider* _tmp0_;
	GtkCssProvider* _tmp1_;
	GdkDisplay* _tmp2_;
	GtkCssProvider* _tmp3_;
	AdwToolbarView* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GtkEventControllerKey* _tmp7_;
	GtkEventControllerKey* _tmp8_;
	GtkEventControllerKey* _tmp9_;
	GtkEventController* _tmp10_;
	GtkDropTarget* item_drop_target = NULL;
	GtkDropTarget* _tmp11_;
	GtkDropTarget* _tmp12_;
	GraphsMainSidebarPage* _tmp13_;
	GtkListBox* _tmp14_;
	GtkListBox* _tmp15_;
	GtkDropTarget* _tmp16_;
	GtkEventController* _tmp17_;
	GtkDropTarget* _tmp18_;
	GtkDropTarget* _tmp19_;
	GtkDropTarget* _tmp20_;
	GtkOverlay* _tmp21_;
	GtkDropTarget* _tmp22_;
	GtkEventController* _tmp23_;
	AdwNavigationView* _tmp24_;
	AdwNavigationView* _tmp25_;
	GraphsMainSidebarPage* _tmp26_;
	GraphsOperations* _tmp27_;
	GraphsOperations* _tmp28_;
	GraphsData* _tmp29_;
	GraphsData* _tmp30_;
	GraphsData* _tmp31_;
	GraphsData* _tmp32_;
	GraphsData* _tmp33_;
	parent_class = G_OBJECT_CLASS (graphs_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_WINDOW, GraphsWindow);
	_data27_ = g_slice_new0 (Block27Data);
	_data27_->_ref_count_ = 1;
	_data27_->self = g_object_ref (self);
	_tmp0_ = gtk_css_provider_new ();
	_tmp1_ = _tmp0_;
	graphs_window_set_css_provider (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = gdk_display_get_default ();
	_tmp3_ = self->priv->_css_provider;
	gtk_style_context_add_provider_for_display (_tmp2_, (GtkStyleProvider*) _tmp3_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
	_tmp4_ = self->priv->_content_view;
	_tmp5_ = graphs_application_get_next_css_name ();
	_tmp6_ = _tmp5_;
	gtk_widget_set_name ((GtkWidget*) _tmp4_, _tmp6_);
	_g_free0 (_tmp6_);
	_tmp7_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	_tmp8_ = _tmp7_;
	graphs_window_set_key_controller (self, _tmp8_);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = self->priv->_key_controller;
	_tmp10_ = _g_object_ref0 ((GtkEventController*) _tmp9_);
	gtk_widget_add_controller (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), _tmp10_);
	_tmp11_ = gtk_drop_target_new (GRAPHS_TYPE_ITEM_BOX, GDK_ACTION_MOVE);
	item_drop_target = _tmp11_;
	_tmp12_ = item_drop_target;
	g_signal_connect_object (_tmp12_, "drop", (GCallback) __graphs_window___lambda34__gtk_drop_target_drop, self, 0);
	_tmp13_ = self->priv->_main_page;
	_tmp14_ = graphs_main_sidebar_page_get_item_list (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = item_drop_target;
	_tmp17_ = _g_object_ref0 ((GtkEventController*) _tmp16_);
	gtk_widget_add_controller ((GtkWidget*) _tmp15_, _tmp17_);
	_tmp18_ = gtk_drop_target_new (gdk_file_list_get_type (), GDK_ACTION_COPY);
	_data27_->file_drop_target = _tmp18_;
	_tmp19_ = _data27_->file_drop_target;
	g_signal_connect_data ((GObject*) _tmp19_, "notify::current-drop", (GCallback) __graphs_window___lambda35__g_object_notify, block27_data_ref (_data27_), (GClosureNotify) block27_data_unref, 0);
	_tmp20_ = _data27_->file_drop_target;
	g_signal_connect_object (_tmp20_, "drop", (GCallback) __graphs_window___lambda36__gtk_drop_target_drop, self, 0);
	_tmp21_ = self->priv->_drag_overlay;
	_tmp22_ = _data27_->file_drop_target;
	_tmp23_ = _g_object_ref0 ((GtkEventController*) _tmp22_);
	gtk_widget_add_controller ((GtkWidget*) _tmp21_, _tmp23_);
	_tmp24_ = self->priv->_sidebar_navigation_view;
	g_signal_connect_object (_tmp24_, "pushed", (GCallback) __graphs_window___lambda40__adw_navigation_view_pushed, self, 0);
	_tmp25_ = self->priv->_sidebar_navigation_view;
	g_signal_connect_object (_tmp25_, "popped", (GCallback) __graphs_window___lambda41__adw_navigation_view_popped, self, 0);
	graphs_actions_setup_local (self);
	_tmp26_ = self->priv->_main_page;
	_tmp27_ = graphs_operations_new (self);
	g_object_ref_sink (_tmp27_);
	_tmp28_ = _tmp27_;
	graphs_main_sidebar_page_set_operations (_tmp26_, _tmp28_);
	_g_object_unref0 (_tmp28_);
	_tmp29_ = self->priv->_data;
	g_signal_connect_object ((GObject*) _tmp29_, "notify::can-undo", (GCallback) _graphs_window_update_history_actions_g_object_notify, self, 0);
	_tmp30_ = self->priv->_data;
	g_signal_connect_object ((GObject*) _tmp30_, "notify::can-redo", (GCallback) _graphs_window_update_history_actions_g_object_notify, self, 0);
	graphs_window_update_history_actions (self);
	graphs_window_update_close_project_action (self);
	_tmp31_ = self->priv->_data;
	g_signal_connect_object ((GListModel*) _tmp31_, "items-changed", (GCallback) _graphs_window_on_items_changed_g_list_model_items_changed, self, 0);
	_tmp32_ = self->priv->_data;
	g_signal_connect_object ((GtkSelectionModel*) _tmp32_, "selection-changed", (GCallback) _graphs_window_on_selection_changed_gtk_selection_model_selection_changed, self, 0);
	_tmp33_ = self->priv->_data;
	g_signal_connect_object ((GObject*) _tmp33_, "notify::unsaved", (GCallback) _graphs_window_on_unsaved_change_g_object_notify, self, 0);
	graphs_window_on_items_changed (self);
	graphs_window_on_unsaved_change (self);
	_g_object_unref0 (item_drop_target);
	block27_data_unref (_data27_);
	_data27_ = NULL;
	return obj;
}

static void
graphs_window_class_init (GraphsWindowClass * klass,
                          gpointer klass_data)
{
	graphs_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsWindow_private_offset);
	((GtkWindowClass *) klass)->close_request = (gboolean (*) (GtkWindow*)) graphs_window_real_close_request;
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_graphs_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = graphs_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = graphs_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_WINDOW_OVERLAY_SPLIT_VIEW_PROPERTY, graphs_window_properties[GRAPHS_WINDOW_OVERLAY_SPLIT_VIEW_PROPERTY] = g_param_spec_object ("overlay-split-view", "overlay-split-view", "overlay-split-view", adw_overlay_split_view_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_WINDOW_CONTENT_VIEW_PROPERTY, graphs_window_properties[GRAPHS_WINDOW_CONTENT_VIEW_PROPERTY] = g_param_spec_object ("content-view", "content-view", "content-view", adw_toolbar_view_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_WINDOW_DATA_PROPERTY, graphs_window_properties[GRAPHS_WINDOW_DATA_PROPERTY] = g_param_spec_object ("data", "data", "data", GRAPHS_TYPE_DATA, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_WINDOW_CSS_PROVIDER_PROPERTY, graphs_window_properties[GRAPHS_WINDOW_CSS_PROVIDER_PROPERTY] = g_param_spec_object ("css-provider", "css-provider", "css-provider", gtk_css_provider_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_WINDOW_KEY_CONTROLLER_PROPERTY, graphs_window_properties[GRAPHS_WINDOW_KEY_CONTROLLER_PROPERTY] = g_param_spec_object ("key-controller", "key-controller", "key-controller", gtk_event_controller_key_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_WINDOW_MODE_PROPERTY, graphs_window_properties[GRAPHS_WINDOW_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_WINDOW_CANVAS_PROPERTY, graphs_window_properties[GRAPHS_WINDOW_CANVAS_PROPERTY] = g_param_spec_object ("canvas", "canvas", "canvas", GRAPHS_TYPE_CANVAS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_WINDOW_IS_MAIN_VIEW_PROPERTY, graphs_window_properties[GRAPHS_WINDOW_IS_MAIN_VIEW_PROPERTY] = g_param_spec_boolean ("is-main-view", "is-main-view", "is-main-view", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/se/sjoerd/Graphs/ui/window.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "view_back_button", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _view_back_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "view_forward_button", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _view_forward_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "optimize_limits_button", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _optimize_limits_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "overlay_split_view", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _overlay_split_view));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "toast_overlay", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _toast_overlay));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "content_title", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _content_title));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "drag_overlay", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _drag_overlay));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "drag_revealer", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _drag_revealer));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "content_view", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _content_view));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "sidebar_navigation_view", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _sidebar_navigation_view));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "main_page", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _main_page));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "edit_page", FALSE, GraphsWindow_private_offset + G_STRUCT_OFFSET (GraphsWindowPrivate, _edit_page));
}

static void
graphs_window_instance_init (GraphsWindow * self,
                             gpointer klass)
{
	self->priv = graphs_window_get_instance_private (self);
	self->priv->_force_close = FALSE;
	self->priv->_inhibit_cookie = (guint) 0;
	g_type_ensure (GRAPHS_TYPE_MAIN_SIDEBAR_PAGE);
	g_type_ensure (GRAPHS_TYPE_EDIT_ITEM_PAGE);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
graphs_window_finalize (GObject * obj)
{
	GraphsWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_WINDOW, GraphsWindow);
	_g_object_unref0 (self->priv->_data);
	_g_object_unref0 (self->priv->_css_provider);
	_g_object_unref0 (self->priv->_key_controller);
	_g_object_unref0 (self->priv->figure_settings_page);
	G_OBJECT_CLASS (graphs_window_parent_class)->finalize (obj);
}

/**
     * Main window
     */
static GType
graphs_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsWindow), 0, (GInstanceInitFunc) graphs_window_instance_init, NULL };
	GType graphs_window_type_id;
	graphs_window_type_id = g_type_register_static (adw_application_window_get_type (), "GraphsWindow", &g_define_type_info, 0);
	GraphsWindow_private_offset = g_type_add_instance_private (graphs_window_type_id, sizeof (GraphsWindowPrivate));
	return graphs_window_type_id;
}

GType
graphs_window_get_type (void)
{
	static volatile gsize graphs_window_type_id__once = 0;
	if (g_once_init_enter (&graphs_window_type_id__once)) {
		GType graphs_window_type_id;
		graphs_window_type_id = graphs_window_get_type_once ();
		g_once_init_leave (&graphs_window_type_id__once, graphs_window_type_id);
	}
	return graphs_window_type_id__once;
}

static void
_vala_graphs_window_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	GraphsWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_WINDOW, GraphsWindow);
	switch (property_id) {
		case GRAPHS_WINDOW_OVERLAY_SPLIT_VIEW_PROPERTY:
		g_value_set_object (value, graphs_window_get_overlay_split_view (self));
		break;
		case GRAPHS_WINDOW_CONTENT_VIEW_PROPERTY:
		g_value_set_object (value, graphs_window_get_content_view (self));
		break;
		case GRAPHS_WINDOW_DATA_PROPERTY:
		g_value_set_object (value, graphs_window_get_data (self));
		break;
		case GRAPHS_WINDOW_CSS_PROVIDER_PROPERTY:
		g_value_set_object (value, graphs_window_get_css_provider (self));
		break;
		case GRAPHS_WINDOW_KEY_CONTROLLER_PROPERTY:
		g_value_set_object (value, graphs_window_get_key_controller (self));
		break;
		case GRAPHS_WINDOW_MODE_PROPERTY:
		g_value_set_enum (value, graphs_window_get_mode (self));
		break;
		case GRAPHS_WINDOW_CANVAS_PROPERTY:
		g_value_set_object (value, graphs_window_get_canvas (self));
		break;
		case GRAPHS_WINDOW_IS_MAIN_VIEW_PROPERTY:
		g_value_set_boolean (value, graphs_window_get_is_main_view (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_graphs_window_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	GraphsWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_WINDOW, GraphsWindow);
	switch (property_id) {
		case GRAPHS_WINDOW_DATA_PROPERTY:
		graphs_window_set_data (self, g_value_get_object (value));
		break;
		case GRAPHS_WINDOW_CSS_PROVIDER_PROPERTY:
		graphs_window_set_css_provider (self, g_value_get_object (value));
		break;
		case GRAPHS_WINDOW_KEY_CONTROLLER_PROPERTY:
		graphs_window_set_key_controller (self, g_value_get_object (value));
		break;
		case GRAPHS_WINDOW_MODE_PROPERTY:
		graphs_window_set_mode (self, g_value_get_enum (value));
		break;
		case GRAPHS_WINDOW_CANVAS_PROPERTY:
		graphs_window_set_canvas (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;
}

