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

/*
Copyright (C) 2014 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_FILE_CHOOSER_0_PROPERTY,
	BIRD_FONT_FILE_CHOOSER_NUM_PROPERTIES
};
static GParamSpec* bird_font_file_chooser_properties[BIRD_FONT_FILE_CHOOSER_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))
enum  {
	BIRD_FONT_FILE_CHOOSER_FILE_SELECTED_SIGNAL,
	BIRD_FONT_FILE_CHOOSER_NUM_SIGNALS
};
static guint bird_font_file_chooser_signals[BIRD_FONT_FILE_CHOOSER_NUM_SIGNALS] = {0};

struct _BirdFontFileChooserPrivate {
	GeeArrayList* extensions;
};

static gint BirdFontFileChooser_private_offset;
static gpointer bird_font_file_chooser_parent_class = NULL;

static void bird_font_file_chooser_finalize (GObject * obj);
static GType bird_font_file_chooser_get_type_once (void);

static inline gpointer
bird_font_file_chooser_get_instance_private (BirdFontFileChooser* self)
{
	return G_STRUCT_MEMBER_P (self, BirdFontFileChooser_private_offset);
}

BirdFontFileChooser*
bird_font_file_chooser_construct (GType object_type)
{
	BirdFontFileChooser * self = NULL;
	self = (BirdFontFileChooser*) g_object_new (object_type, NULL);
	return self;
}

BirdFontFileChooser*
bird_font_file_chooser_new (void)
{
	return bird_font_file_chooser_construct (BIRD_FONT_TYPE_FILE_CHOOSER);
}

gint
bird_font_file_chooser_extensions_size (BirdFontFileChooser* self)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->extensions;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

gchar*
bird_font_file_chooser_get_extension (BirdFontFileChooser* self,
                                      gint i)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GeeArrayList* _tmp6_;
	gpointer _tmp7_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->extensions;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = i;
	_tmp4_ = g_strdup ("");
	_tmp5_ = _tmp4_;
	g_return_val_if_fail ((0 <= _tmp3_) && (_tmp3_ < _tmp2_), _tmp5_);
	_g_free0 (_tmp5_);
	_tmp6_ = self->priv->extensions;
	_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, i);
	result = (gchar*) _tmp7_;
	return result;
}

void
bird_font_file_chooser_add_extension (BirdFontFileChooser* self,
                                      const gchar* file_extension)
{
	GeeArrayList* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file_extension != NULL);
	_tmp0_ = self->priv->extensions;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, file_extension);
}

void
bird_font_file_chooser_selected (BirdFontFileChooser* self,
                                 const gchar* path)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, bird_font_file_chooser_signals[BIRD_FONT_FILE_CHOOSER_FILE_SELECTED_SIGNAL], 0, path);
}

void
bird_font_file_chooser_cancel (BirdFontFileChooser* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, bird_font_file_chooser_signals[BIRD_FONT_FILE_CHOOSER_FILE_SELECTED_SIGNAL], 0, NULL);
}

static void
bird_font_file_chooser_class_init (BirdFontFileChooserClass * klass,
                                   gpointer klass_data)
{
	bird_font_file_chooser_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BirdFontFileChooser_private_offset);
	G_OBJECT_CLASS (klass)->finalize = bird_font_file_chooser_finalize;
	bird_font_file_chooser_signals[BIRD_FONT_FILE_CHOOSER_FILE_SELECTED_SIGNAL] = g_signal_new ("file-selected", BIRD_FONT_TYPE_FILE_CHOOSER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
bird_font_file_chooser_instance_init (BirdFontFileChooser * self,
                                      gpointer klass)
{
	GeeArrayList* _tmp0_;
	self->priv = bird_font_file_chooser_get_instance_private (self);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	self->priv->extensions = _tmp0_;
}

static void
bird_font_file_chooser_finalize (GObject * obj)
{
	BirdFontFileChooser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_FILE_CHOOSER, BirdFontFileChooser);
	_g_object_unref0 (self->priv->extensions);
	G_OBJECT_CLASS (bird_font_file_chooser_parent_class)->finalize (obj);
}

static GType
bird_font_file_chooser_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontFileChooserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_file_chooser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontFileChooser), 0, (GInstanceInitFunc) bird_font_file_chooser_instance_init, NULL };
	GType bird_font_file_chooser_type_id;
	bird_font_file_chooser_type_id = g_type_register_static (G_TYPE_OBJECT, "BirdFontFileChooser", &g_define_type_info, 0);
	BirdFontFileChooser_private_offset = g_type_add_instance_private (bird_font_file_chooser_type_id, sizeof (BirdFontFileChooserPrivate));
	return bird_font_file_chooser_type_id;
}

GType
bird_font_file_chooser_get_type (void)
{
	static volatile gsize bird_font_file_chooser_type_id__once = 0;
	if (g_once_init_enter (&bird_font_file_chooser_type_id__once)) {
		GType bird_font_file_chooser_type_id;
		bird_font_file_chooser_type_id = bird_font_file_chooser_get_type_once ();
		g_once_init_leave (&bird_font_file_chooser_type_id__once, bird_font_file_chooser_type_id);
	}
	return bird_font_file_chooser_type_id__once;
}

