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

/*
Copyright (C) 2016 Johan Mattsson

This library is free software; you can redistribute it and/or modify 
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation; either version 3 of the 
License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but 
WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
Lesser General Public License for more details.
*/

#include "birdfont.h"
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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  {
	BIRD_FONT_SPACING_CLASS_TOOLS_0_PROPERTY,
	BIRD_FONT_SPACING_CLASS_TOOLS_NUM_PROPERTIES
};
static GParamSpec* bird_font_spacing_class_tools_properties[BIRD_FONT_SPACING_CLASS_TOOLS_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))

static gpointer bird_font_spacing_class_tools_parent_class = NULL;
GeeArrayList* bird_font_spacing_class_tools_expanders = NULL;

static void __lambda264_ (BirdFontSpacingClassTools* self,
                   BirdFontTool* _self_);
static void __lambda265_ (BirdFontSpacingClassTools* self,
                   BirdFontGlyphCollection* glyph_collection);
static void ___lambda265__bird_font_glyph_selection_selected_glyph (BirdFontGlyphSelection* _sender,
                                                             BirdFontGlyphCollection* gc,
                                                             gpointer self);
static void ___lambda264__bird_font_tool_select_action (BirdFontTool* _sender,
                                                 BirdFontTool* selected,
                                                 gpointer self);
static GeeArrayList* bird_font_spacing_class_tools_real_get_expanders (BirdFontToolCollection* base);
static GeeArrayList* bird_font_spacing_class_tools_real_get_displays (BirdFontToolCollection* base);
static void bird_font_spacing_class_tools_finalize (GObject * obj);
static GType bird_font_spacing_class_tools_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static void
__lambda265_ (BirdFontSpacingClassTools* self,
              BirdFontGlyphCollection* glyph_collection)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	BirdFontTabBar* _tmp2_;
	BirdFontTabBar* _tmp3_;
	g_return_if_fail (glyph_collection != NULL);
	_tmp0_ = bird_font_glyph_collection_get_name (glyph_collection);
	_tmp1_ = _tmp0_;
	bird_font_spacing_class_tab_set_class (_tmp1_);
	_g_free0 (_tmp1_);
	_tmp2_ = bird_font_main_window_get_tab_bar ();
	_tmp3_ = _tmp2_;
	bird_font_tab_bar_select_tab_name (_tmp3_, "SpacingClasses");
	_g_object_unref0 (_tmp3_);
}

static void
___lambda265__bird_font_glyph_selection_selected_glyph (BirdFontGlyphSelection* _sender,
                                                        BirdFontGlyphCollection* gc,
                                                        gpointer self)
{
	__lambda265_ ((BirdFontSpacingClassTools*) self, gc);
}

static void
__lambda264_ (BirdFontSpacingClassTools* self,
              BirdFontTool* _self_)
{
	BirdFontGlyphSelection* glyph_selection = NULL;
	BirdFontGlyphSelection* _tmp0_;
	g_return_if_fail (_self_ != NULL);
	_tmp0_ = bird_font_glyph_selection_new ();
	glyph_selection = _tmp0_;
	g_signal_connect_object (glyph_selection, "selected-glyph", (GCallback) ___lambda265__bird_font_glyph_selection_selected_glyph, self, 0);
	bird_font_glyph_canvas_set_display ((BirdFontFontDisplay*) glyph_selection);
	bird_font_tool_set_selected (_self_, FALSE);
	bird_font_tab_content_hide_text_input ();
	_g_object_unref0 (glyph_selection);
}

static void
___lambda264__bird_font_tool_select_action (BirdFontTool* _sender,
                                            BirdFontTool* selected,
                                            gpointer self)
{
	__lambda264_ ((BirdFontSpacingClassTools*) self, selected);
}

BirdFontSpacingClassTools*
bird_font_spacing_class_tools_construct (GType object_type)
{
	BirdFontSpacingClassTools * self = NULL;
	GeeArrayList* _tmp0_;
	BirdFontExpander* font_name = NULL;
	BirdFontExpander* _tmp1_;
	BirdFontFontName* _tmp2_;
	BirdFontFontName* _tmp3_;
	BirdFontExpander* spacing_class_tools = NULL;
	BirdFontExpander* _tmp4_;
	BirdFontTool* insert = NULL;
	gchar* _tmp5_;
	gchar* _tmp6_;
	BirdFontTool* _tmp7_;
	BirdFontTool* _tmp8_;
	GeeArrayList* _tmp9_;
	GeeArrayList* _tmp10_;
	self = (BirdFontSpacingClassTools*) bird_font_tool_collection_construct (object_type);
	_tmp0_ = gee_array_list_new (BIRD_FONT_TYPE_EXPANDER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (bird_font_spacing_class_tools_expanders);
	bird_font_spacing_class_tools_expanders = _tmp0_;
	_tmp1_ = bird_font_expander_new (NULL);
	font_name = _tmp1_;
	_tmp2_ = bird_font_font_name_new (NULL, "");
	_tmp3_ = _tmp2_;
	bird_font_expander_add_tool (font_name, (BirdFontTool*) _tmp3_, -1);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = bird_font_expander_new (NULL);
	spacing_class_tools = _tmp4_;
	_tmp5_ = bird_font_t_ ("Insert glyph from overview");
	_tmp6_ = _tmp5_;
	_tmp7_ = bird_font_tool_new ("insert_glyph_from_overview_in_spacing_class", _tmp6_);
	_tmp8_ = _tmp7_;
	_g_free0 (_tmp6_);
	insert = _tmp8_;
	bird_font_tool_set_icon (insert, "insert_glyph_from_overview");
	g_signal_connect_object (insert, "select-action", (GCallback) ___lambda264__bird_font_tool_select_action, self, 0);
	bird_font_expander_add_tool (spacing_class_tools, insert, -1);
	_tmp9_ = bird_font_spacing_class_tools_expanders;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, font_name);
	_tmp10_ = bird_font_spacing_class_tools_expanders;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, spacing_class_tools);
	_g_object_unref0 (insert);
	_g_object_unref0 (spacing_class_tools);
	_g_object_unref0 (font_name);
	return self;
}

BirdFontSpacingClassTools*
bird_font_spacing_class_tools_new (void)
{
	return bird_font_spacing_class_tools_construct (BIRD_FONT_TYPE_SPACING_CLASS_TOOLS);
}

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

static GeeArrayList*
bird_font_spacing_class_tools_real_get_expanders (BirdFontToolCollection* base)
{
	BirdFontSpacingClassTools * self;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* result;
	self = (BirdFontSpacingClassTools*) base;
	_tmp0_ = bird_font_spacing_class_tools_expanders;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static GeeArrayList*
bird_font_spacing_class_tools_real_get_displays (BirdFontToolCollection* base)
{
	BirdFontSpacingClassTools * self;
	GeeArrayList* d = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* result;
	self = (BirdFontSpacingClassTools*) base;
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	d = _tmp0_;
	gee_abstract_collection_add ((GeeAbstractCollection*) d, "SpacingClasses");
	result = d;
	return result;
}

static void
bird_font_spacing_class_tools_class_init (BirdFontSpacingClassToolsClass * klass,
                                          gpointer klass_data)
{
	bird_font_spacing_class_tools_parent_class = g_type_class_peek_parent (klass);
	((BirdFontToolCollectionClass *) klass)->get_expanders = (GeeArrayList* (*) (BirdFontToolCollection*)) bird_font_spacing_class_tools_real_get_expanders;
	((BirdFontToolCollectionClass *) klass)->get_displays = (GeeArrayList* (*) (BirdFontToolCollection*)) bird_font_spacing_class_tools_real_get_displays;
	G_OBJECT_CLASS (klass)->finalize = bird_font_spacing_class_tools_finalize;
}

static void
bird_font_spacing_class_tools_instance_init (BirdFontSpacingClassTools * self,
                                             gpointer klass)
{
}

static void
bird_font_spacing_class_tools_finalize (GObject * obj)
{
	BirdFontSpacingClassTools * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_SPACING_CLASS_TOOLS, BirdFontSpacingClassTools);
	G_OBJECT_CLASS (bird_font_spacing_class_tools_parent_class)->finalize (obj);
}

static GType
bird_font_spacing_class_tools_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontSpacingClassToolsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_spacing_class_tools_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontSpacingClassTools), 0, (GInstanceInitFunc) bird_font_spacing_class_tools_instance_init, NULL };
	GType bird_font_spacing_class_tools_type_id;
	bird_font_spacing_class_tools_type_id = g_type_register_static (BIRD_FONT_TYPE_TOOL_COLLECTION, "BirdFontSpacingClassTools", &g_define_type_info, 0);
	return bird_font_spacing_class_tools_type_id;
}

GType
bird_font_spacing_class_tools_get_type (void)
{
	static volatile gsize bird_font_spacing_class_tools_type_id__once = 0;
	if (g_once_init_enter (&bird_font_spacing_class_tools_type_id__once)) {
		GType bird_font_spacing_class_tools_type_id;
		bird_font_spacing_class_tools_type_id = bird_font_spacing_class_tools_get_type_once ();
		g_once_init_leave (&bird_font_spacing_class_tools_type_id__once, bird_font_spacing_class_tools_type_id);
	}
	return bird_font_spacing_class_tools_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

