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

/*
Copyright (C) 2015 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_THEME_TOOLS_0_PROPERTY,
	BIRD_FONT_THEME_TOOLS_NUM_PROPERTIES
};
static GParamSpec* bird_font_theme_tools_properties[BIRD_FONT_THEME_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))

#define BIRD_FONT_TYPE_SETTINGS_DISPLAY (bird_font_settings_display_get_type ())
#define BIRD_FONT_SETTINGS_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BIRD_FONT_TYPE_SETTINGS_DISPLAY, BirdFontSettingsDisplay))
#define BIRD_FONT_SETTINGS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BIRD_FONT_TYPE_SETTINGS_DISPLAY, BirdFontSettingsDisplayClass))
#define BIRD_FONT_IS_SETTINGS_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BIRD_FONT_TYPE_SETTINGS_DISPLAY))
#define BIRD_FONT_IS_SETTINGS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BIRD_FONT_TYPE_SETTINGS_DISPLAY))
#define BIRD_FONT_SETTINGS_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BIRD_FONT_TYPE_SETTINGS_DISPLAY, BirdFontSettingsDisplayClass))

typedef struct _BirdFontSettingsDisplay BirdFontSettingsDisplay;
typedef struct _BirdFontSettingsDisplayClass BirdFontSettingsDisplayClass;

#define BIRD_FONT_TYPE_THEME_TAB (bird_font_theme_tab_get_type ())
#define BIRD_FONT_THEME_TAB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BIRD_FONT_TYPE_THEME_TAB, BirdFontThemeTab))
#define BIRD_FONT_THEME_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BIRD_FONT_TYPE_THEME_TAB, BirdFontThemeTabClass))
#define BIRD_FONT_IS_THEME_TAB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BIRD_FONT_TYPE_THEME_TAB))
#define BIRD_FONT_IS_THEME_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BIRD_FONT_TYPE_THEME_TAB))
#define BIRD_FONT_THEME_TAB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BIRD_FONT_TYPE_THEME_TAB, BirdFontThemeTabClass))

typedef struct _BirdFontThemeTab BirdFontThemeTab;
typedef struct _BirdFontThemeTabClass BirdFontThemeTabClass;
#define _bird_font_color_unref0(var) ((var == NULL) ? NULL : (var = (bird_font_color_unref (var), NULL)))

static gpointer bird_font_theme_tools_parent_class = NULL;
GeeArrayList* bird_font_theme_tools_expanders = NULL;
BirdFontColorPicker* bird_font_theme_tools_color_picker = NULL;

static void __lambda270_ (BirdFontThemeTools* self);
VALA_EXTERN GType bird_font_settings_display_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType bird_font_theme_tab_get_type (void) G_GNUC_CONST ;
VALA_EXTERN BirdFontThemeTab* bird_font_theme_tab_get_instance (void);
VALA_EXTERN void bird_font_theme_tab_color_updated (BirdFontThemeTab* self,
                                        BirdFontColor* c);
static void ___lambda270__bird_font_color_picker_fill_color_updated (BirdFontColorPicker* _sender,
                                                              gpointer self);
static GeeArrayList* bird_font_theme_tools_real_get_displays (BirdFontToolCollection* base);
static GeeArrayList* bird_font_theme_tools_real_get_expanders (BirdFontToolCollection* base);
static void bird_font_theme_tools_finalize (GObject * obj);
static GType bird_font_theme_tools_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static void
__lambda270_ (BirdFontThemeTools* self)
{
	BirdFontColor* c = NULL;
	BirdFontColorPicker* _tmp0_;
	BirdFontColor* _tmp1_;
	BirdFontThemeTab* _tmp2_;
	BirdFontThemeTab* _tmp3_;
	_tmp0_ = bird_font_theme_tools_color_picker;
	_tmp1_ = bird_font_color_picker_get_fill_color (_tmp0_);
	c = _tmp1_;
	_tmp2_ = bird_font_theme_tab_get_instance ();
	_tmp3_ = _tmp2_;
	bird_font_theme_tab_color_updated (_tmp3_, c);
	_g_object_unref0 (_tmp3_);
	_bird_font_color_unref0 (c);
}

static void
___lambda270__bird_font_color_picker_fill_color_updated (BirdFontColorPicker* _sender,
                                                         gpointer self)
{
	__lambda270_ ((BirdFontThemeTools*) self);
}

BirdFontThemeTools*
bird_font_theme_tools_construct (GType object_type)
{
	BirdFontThemeTools * self = NULL;
	GeeArrayList* _tmp0_;
	BirdFontExpander* font_name = NULL;
	BirdFontExpander* _tmp1_;
	BirdFontFontName* _tmp2_;
	BirdFontFontName* _tmp3_;
	BirdFontExpander* color_tools = NULL;
	gchar* _tmp4_;
	gchar* _tmp5_;
	BirdFontExpander* _tmp6_;
	BirdFontExpander* _tmp7_;
	BirdFontColorPicker* _tmp8_;
	BirdFontColorPicker* _tmp9_;
	BirdFontColorPicker* _tmp10_;
	GeeArrayList* _tmp11_;
	GeeArrayList* _tmp12_;
	self = (BirdFontThemeTools*) 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_theme_tools_expanders);
	bird_font_theme_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_t_ ("Color");
	_tmp5_ = _tmp4_;
	_tmp6_ = bird_font_expander_new (_tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	color_tools = _tmp7_;
	_tmp8_ = bird_font_color_picker_new ("");
	_g_object_unref0 (bird_font_theme_tools_color_picker);
	bird_font_theme_tools_color_picker = _tmp8_;
	_tmp9_ = bird_font_theme_tools_color_picker;
	g_signal_connect_object (_tmp9_, "fill-color-updated", (GCallback) ___lambda270__bird_font_color_picker_fill_color_updated, self, 0);
	_tmp10_ = bird_font_theme_tools_color_picker;
	bird_font_expander_add_tool (color_tools, (BirdFontTool*) _tmp10_, -1);
	_tmp11_ = bird_font_theme_tools_expanders;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, font_name);
	_tmp12_ = bird_font_theme_tools_expanders;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, color_tools);
	_g_object_unref0 (color_tools);
	_g_object_unref0 (font_name);
	return self;
}

BirdFontThemeTools*
bird_font_theme_tools_new (void)
{
	return bird_font_theme_tools_construct (BIRD_FONT_TYPE_THEME_TOOLS);
}

static GeeArrayList*
bird_font_theme_tools_real_get_displays (BirdFontToolCollection* base)
{
	BirdFontThemeTools * self;
	GeeArrayList* d = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* result;
	self = (BirdFontThemeTools*) base;
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	d = _tmp0_;
	result = d;
	return result;
}

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

static GeeArrayList*
bird_font_theme_tools_real_get_expanders (BirdFontToolCollection* base)
{
	BirdFontThemeTools * self;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* result;
	self = (BirdFontThemeTools*) base;
	_tmp0_ = bird_font_theme_tools_expanders;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
bird_font_theme_tools_class_init (BirdFontThemeToolsClass * klass,
                                  gpointer klass_data)
{
	bird_font_theme_tools_parent_class = g_type_class_peek_parent (klass);
	((BirdFontToolCollectionClass *) klass)->get_displays = (GeeArrayList* (*) (BirdFontToolCollection*)) bird_font_theme_tools_real_get_displays;
	((BirdFontToolCollectionClass *) klass)->get_expanders = (GeeArrayList* (*) (BirdFontToolCollection*)) bird_font_theme_tools_real_get_expanders;
	G_OBJECT_CLASS (klass)->finalize = bird_font_theme_tools_finalize;
}

static void
bird_font_theme_tools_instance_init (BirdFontThemeTools * self,
                                     gpointer klass)
{
}

static void
bird_font_theme_tools_finalize (GObject * obj)
{
	BirdFontThemeTools * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_THEME_TOOLS, BirdFontThemeTools);
	G_OBJECT_CLASS (bird_font_theme_tools_parent_class)->finalize (obj);
}

static GType
bird_font_theme_tools_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontThemeToolsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_theme_tools_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontThemeTools), 0, (GInstanceInitFunc) bird_font_theme_tools_instance_init, NULL };
	GType bird_font_theme_tools_type_id;
	bird_font_theme_tools_type_id = g_type_register_static (BIRD_FONT_TYPE_TOOL_COLLECTION, "BirdFontThemeTools", &g_define_type_info, 0);
	return bird_font_theme_tools_type_id;
}

GType
bird_font_theme_tools_get_type (void)
{
	static volatile gsize bird_font_theme_tools_type_id__once = 0;
	if (g_once_init_enter (&bird_font_theme_tools_type_id__once)) {
		GType bird_font_theme_tools_type_id;
		bird_font_theme_tools_type_id = bird_font_theme_tools_get_type_once ();
		g_once_init_leave (&bird_font_theme_tools_type_id__once, bird_font_theme_tools_type_id);
	}
	return bird_font_theme_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;
}

