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

/* enchant: Provider
 * Copyright (C) 2003, 2004 Dom Lachowicz
 * Copyright (C) 2016-2025 Reuben Thomas <rrt@sc3d.org>
 *
 * 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 2.1 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.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along along with this program; if not, see
 * <https://www.gnu.org/licenses/>.
 *
 * In addition, as a special exception, the copyright holders
 * give permission to link the code of this program with
 * non-LGPL Spelling Provider libraries (eg: a MSFT Office
 * spell checker backend) and distribute linked combinations including
 * the two.  You must obey the GNU Lesser General Public License in all
 * respects for all of the code used other than said providers.  If you modify
 * this file, you may extend this exception to your version of the
 * file, but you are not obligated to do so.  If you do not wish to
 * do so, delete this exception statement from your version.
 */

#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <relocatable.h>
#include <configmake.h>
#include <glib-object.h>
#include <gmodule.h>
#include <gobject/gvaluecollector.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_ENCHANT_PROVIDER (enchant_provider_get_type ())
#define ENCHANT_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ENCHANT_PROVIDER, EnchantProvider))
#define ENCHANT_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ENCHANT_PROVIDER, EnchantProviderClass))
#define IS_ENCHANT_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ENCHANT_PROVIDER))
#define IS_ENCHANT_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ENCHANT_PROVIDER))
#define ENCHANT_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ENCHANT_PROVIDER, EnchantProviderClass))

typedef struct _EnchantProvider EnchantProvider;
typedef struct _EnchantProviderClass EnchantProviderClass;
typedef void (*ProviderDispose) (EnchantProvider* me);

#define TYPE_ENCHANT_PROVIDER_DICT (enchant_provider_dict_get_type ())
#define ENCHANT_PROVIDER_DICT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ENCHANT_PROVIDER_DICT, EnchantProviderDict))
#define ENCHANT_PROVIDER_DICT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ENCHANT_PROVIDER_DICT, EnchantProviderDictClass))
#define IS_ENCHANT_PROVIDER_DICT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ENCHANT_PROVIDER_DICT))
#define IS_ENCHANT_PROVIDER_DICT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ENCHANT_PROVIDER_DICT))
#define ENCHANT_PROVIDER_DICT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ENCHANT_PROVIDER_DICT, EnchantProviderDictClass))

typedef struct _EnchantProviderDict EnchantProviderDict;
typedef struct _EnchantProviderDictClass EnchantProviderDictClass;
typedef EnchantProviderDict* (*ProviderRequestDict) (EnchantProvider* me, const gchar* tag);
typedef void (*ProviderDisposeDict) (EnchantProvider* me, EnchantProviderDict* dict);
typedef gint (*ProviderDictionaryExists) (EnchantProvider* me, const gchar* tag);
typedef const gchar* (*ProviderIdentify) (EnchantProvider* me);
typedef const gchar* (*ProviderDescribe) (EnchantProvider* me);
typedef gchar** (*ProviderListDicts) (EnchantProvider* me, size_t* result_length1);
typedef struct _EnchantProviderPrivate EnchantProviderPrivate;
typedef struct _EnchantBroker EnchantBroker;
#define _g_module_close0(var) ((var == NULL) ? NULL : (var = (g_module_close (var), NULL)))
typedef struct _ParamSpecEnchantProvider ParamSpecEnchantProvider;

struct _EnchantProvider {
	GTypeInstance parent_instance;
	volatile int ref_count;
	EnchantProviderPrivate * priv;
	void* user_data;
	GModule* module;
	EnchantBroker* owner;
	ProviderDispose dispose;
	ProviderRequestDict request_dict;
	ProviderDisposeDict dispose_dict;
	ProviderDictionaryExists dictionary_exists;
	ProviderIdentify identify;
	ProviderDescribe describe;
	ProviderListDicts list_dicts;
};

struct _EnchantProviderClass {
	GTypeClass parent_class;
	void (*finalize) (EnchantProvider *self);
};

struct _ParamSpecEnchantProvider {
	GParamSpec parent_instance;
};

static gpointer enchant_provider_parent_class = NULL;

VALA_EXTERN gchar* enchant_get_user_config_dir (void);
VALA_EXTERN GSList* enchant_get_conf_dirs (void);
VALA_EXTERN gchar* enchant_get_prefix_dir (void);
VALA_EXTERN gpointer enchant_provider_ref (gpointer instance);
VALA_EXTERN void enchant_provider_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_enchant_provider (const gchar* name,
                                         const gchar* nick,
                                         const gchar* blurb,
                                         GType object_type,
                                         GParamFlags flags);
VALA_EXTERN void value_set_enchant_provider (GValue* value,
                                 gpointer v_object);
VALA_EXTERN void value_take_enchant_provider (GValue* value,
                                  gpointer v_object);
VALA_EXTERN gpointer value_get_enchant_provider (const GValue* value);
VALA_EXTERN GType enchant_provider_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (EnchantProvider, enchant_provider_unref)
VALA_EXTERN gpointer enchant_provider_dict_ref (gpointer instance);
VALA_EXTERN void enchant_provider_dict_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_enchant_provider_dict (const gchar* name,
                                              const gchar* nick,
                                              const gchar* blurb,
                                              GType object_type,
                                              GParamFlags flags);
VALA_EXTERN void value_set_enchant_provider_dict (GValue* value,
                                      gpointer v_object);
VALA_EXTERN void value_take_enchant_provider_dict (GValue* value,
                                       gpointer v_object);
VALA_EXTERN gpointer value_get_enchant_provider_dict (const GValue* value);
VALA_EXTERN GType enchant_provider_dict_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (EnchantProviderDict, enchant_provider_dict_unref)
VALA_EXTERN void enchant_broker_free (EnchantBroker * self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (EnchantBroker, enchant_broker_free)
VALA_EXTERN gboolean enchant_provider_is_valid (EnchantProvider* provider);
VALA_EXTERN void enchant_provider_set_error (EnchantProvider* self,
                                 const gchar* err);
VALA_EXTERN void enchant_broker_set_error (EnchantBroker* self,
                               const gchar* value);
VALA_EXTERN gint _enchant_provider_dictionary_exists (EnchantProvider* self,
                                          const gchar* tag);
VALA_EXTERN gchar* enchant_provider_get_user_dict_dir (EnchantProvider* self);
VALA_EXTERN EnchantProvider* enchant_provider_new (void);
VALA_EXTERN EnchantProvider* enchant_provider_construct (GType object_type);
static void enchant_provider_finalize (EnchantProvider * obj);
static GType enchant_provider_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

gchar*
enchant_get_user_config_dir (void)
{
	const gchar* env = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	GError* _inner_error0_ = NULL;
	gchar* result;
#line 34 "provider.vala"
	_tmp0_ = g_getenv ("ENCHANT_CONFIG_DIR");
#line 34 "provider.vala"
	env = _tmp0_;
#line 35 "provider.vala"
	_tmp1_ = env;
#line 35 "provider.vala"
	if (_tmp1_ != NULL) {
#line 191 "provider.c"
		{
			gchar* _tmp2_ = NULL;
			const gchar* _tmp3_;
			gchar* _tmp4_;
			gchar* _tmp5_;
#line 37 "provider.vala"
			_tmp3_ = env;
#line 37 "provider.vala"
			_tmp4_ = g_filename_to_utf8 (_tmp3_, (gssize) -1, NULL, NULL, &_inner_error0_);
#line 37 "provider.vala"
			_tmp2_ = _tmp4_;
#line 37 "provider.vala"
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 37 "provider.vala"
				if (_inner_error0_->domain == G_CONVERT_ERROR) {
#line 207 "provider.c"
					goto __catch0_g_convert_error;
				}
#line 37 "provider.vala"
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
#line 37 "provider.vala"
				g_clear_error (&_inner_error0_);
#line 37 "provider.vala"
				return NULL;
#line 216 "provider.c"
			}
#line 37 "provider.vala"
			_tmp5_ = _tmp2_;
#line 37 "provider.vala"
			_tmp2_ = NULL;
#line 37 "provider.vala"
			result = _tmp5_;
#line 37 "provider.vala"
			_g_free0 (_tmp2_);
#line 37 "provider.vala"
			return result;
#line 228 "provider.c"
		}
		goto __finally0;
		__catch0_g_convert_error:
		{
#line 36 "provider.vala"
			g_clear_error (&_inner_error0_);
#line 235 "provider.c"
		}
		__finally0:
#line 36 "provider.vala"
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 36 "provider.vala"
			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);
#line 36 "provider.vala"
			g_clear_error (&_inner_error0_);
#line 36 "provider.vala"
			return NULL;
#line 246 "provider.c"
		}
	}
#line 39 "provider.vala"
	_tmp6_ = g_get_user_config_dir ();
#line 39 "provider.vala"
	_tmp7_ = g_build_filename (_tmp6_, "enchant", NULL);
#line 39 "provider.vala"
	result = _tmp7_;
#line 39 "provider.vala"
	return result;
#line 257 "provider.c"
}

static gchar*
_vala_gnulib_relocate (const gchar* path)
{
	gchar* newpath = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
#line 77 "gnu.vapi"
	g_return_val_if_fail (path != NULL, NULL);
#line 78 "gnu.vapi"
	_tmp0_ = (gchar*) relocate (path);
#line 78 "gnu.vapi"
	newpath = _tmp0_;
#line 79 "gnu.vapi"
	_tmp1_ = newpath;
#line 79 "gnu.vapi"
	if (_tmp1_ != path) {
#line 277 "provider.c"
		gchar* _tmp2_;
#line 82 "gnu.vapi"
		_tmp2_ = newpath;
#line 82 "gnu.vapi"
		newpath = NULL;
#line 82 "gnu.vapi"
		result = (gchar*) _tmp2_;
#line 82 "gnu.vapi"
		return result;
#line 287 "provider.c"
	} else {
		gchar* _tmp3_;
		gchar* _tmp4_;
#line 85 "gnu.vapi"
		_tmp3_ = newpath;
#line 85 "gnu.vapi"
		_tmp4_ = g_strdup ((const gchar*) _tmp3_);
#line 85 "gnu.vapi"
		result = _tmp4_;
#line 85 "gnu.vapi"
		return result;
#line 299 "provider.c"
	}
}

GSList*
enchant_get_conf_dirs (void)
{
	GSList* conf_dirs = NULL;
	gchar* pkgdatadir = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* sysconfdir = NULL;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp17_;
	GSList* result;
#line 43 "provider.vala"
	conf_dirs = NULL;
#line 45 "provider.vala"
	_tmp0_ = g_strdup_printf ("%s-%s", PKGDATADIR, ENCHANT_MAJOR_VERSION);
#line 45 "provider.vala"
	_tmp1_ = _tmp0_;
#line 45 "provider.vala"
	_tmp2_ = _vala_gnulib_relocate (_tmp1_);
#line 45 "provider.vala"
	_tmp3_ = _tmp2_;
#line 45 "provider.vala"
	_g_free0 (_tmp1_);
#line 45 "provider.vala"
	pkgdatadir = _tmp3_;
#line 46 "provider.vala"
	_tmp4_ = pkgdatadir;
#line 46 "provider.vala"
	if (_tmp4_ != NULL) {
#line 336 "provider.c"
		const gchar* _tmp5_;
		gchar* _tmp6_;
#line 47 "provider.vala"
		_tmp5_ = pkgdatadir;
#line 47 "provider.vala"
		_tmp6_ = g_strdup (_tmp5_);
#line 47 "provider.vala"
		conf_dirs = g_slist_append (conf_dirs, _tmp6_);
#line 345 "provider.c"
	}
#line 49 "provider.vala"
	_tmp7_ = _vala_gnulib_relocate (SYSCONFDIR);
#line 49 "provider.vala"
	sysconfdir = _tmp7_;
#line 50 "provider.vala"
	_tmp8_ = sysconfdir;
#line 50 "provider.vala"
	if (_tmp8_ != NULL) {
#line 355 "provider.c"
		gchar* pkgconfdir = NULL;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		const gchar* _tmp14_;
#line 51 "provider.vala"
		_tmp9_ = sysconfdir;
#line 51 "provider.vala"
		_tmp10_ = g_strdup_printf ("enchant-%s", ENCHANT_MAJOR_VERSION);
#line 51 "provider.vala"
		_tmp11_ = _tmp10_;
#line 51 "provider.vala"
		_tmp12_ = g_build_filename (_tmp9_, _tmp11_, NULL);
#line 51 "provider.vala"
		_tmp13_ = _tmp12_;
#line 51 "provider.vala"
		_g_free0 (_tmp11_);
#line 51 "provider.vala"
		pkgconfdir = _tmp13_;
#line 52 "provider.vala"
		_tmp14_ = pkgconfdir;
#line 52 "provider.vala"
		if (_tmp14_ != NULL) {
#line 381 "provider.c"
			const gchar* _tmp15_;
			gchar* _tmp16_;
#line 53 "provider.vala"
			_tmp15_ = pkgconfdir;
#line 53 "provider.vala"
			_tmp16_ = g_strdup (_tmp15_);
#line 53 "provider.vala"
			conf_dirs = g_slist_append (conf_dirs, _tmp16_);
#line 390 "provider.c"
		}
#line 50 "provider.vala"
		_g_free0 (pkgconfdir);
#line 394 "provider.c"
	}
#line 56 "provider.vala"
	_tmp17_ = enchant_get_user_config_dir ();
#line 56 "provider.vala"
	conf_dirs = g_slist_append (conf_dirs, _tmp17_);
#line 58 "provider.vala"
	result = conf_dirs;
#line 58 "provider.vala"
	_g_free0 (sysconfdir);
#line 58 "provider.vala"
	_g_free0 (pkgdatadir);
#line 58 "provider.vala"
	return result;
#line 408 "provider.c"
}

gchar*
enchant_get_prefix_dir (void)
{
	gchar* _tmp0_;
	gchar* result;
#line 62 "provider.vala"
	_tmp0_ = _vala_gnulib_relocate (INSTALLPREFIX);
#line 62 "provider.vala"
	result = _tmp0_;
#line 62 "provider.vala"
	return result;
#line 422 "provider.c"
}

gboolean
enchant_provider_is_valid (EnchantProvider* provider)
{
	gboolean result;
#line 102 "provider.vala"
	g_return_val_if_fail (provider != NULL, FALSE);
#line 103 "provider.vala"
	if (provider == NULL) {
#line 104 "provider.vala"
		g_warning ("provider.vala:104: EnchantProvider cannot be NULL");
#line 435 "provider.c"
	} else {
		ProviderRequestDict _tmp0_;
#line 105 "provider.vala"
		_tmp0_ = provider->request_dict;
#line 105 "provider.vala"
		if (_tmp0_ == NULL) {
#line 106 "provider.vala"
			g_warning ("provider.vala:106: EnchantProvider's request_dict method cannot be NUL" \
"L");
#line 444 "provider.c"
		} else {
			ProviderDisposeDict _tmp1_;
#line 107 "provider.vala"
			_tmp1_ = provider->dispose_dict;
#line 107 "provider.vala"
			if (_tmp1_ == NULL) {
#line 108 "provider.vala"
				g_warning ("provider.vala:108: EnchantProvider's dispose_dict method cannot be NUL" \
"L");
#line 453 "provider.c"
			} else {
				ProviderIdentify _tmp2_;
#line 109 "provider.vala"
				_tmp2_ = provider->identify;
#line 109 "provider.vala"
				if (_tmp2_ == NULL) {
#line 110 "provider.vala"
					g_warning ("provider.vala:110: EnchantProvider's identify method cannot be NULL");
#line 462 "provider.c"
				} else {
					ProviderIdentify _tmp3_;
					const gchar* _tmp4_;
#line 111 "provider.vala"
					_tmp3_ = provider->identify;
#line 111 "provider.vala"
					_tmp4_ = _tmp3_ (provider);
#line 111 "provider.vala"
					if (!g_utf8_validate (_tmp4_, (gssize) -1, NULL)) {
#line 112 "provider.vala"
						g_warning ("provider.vala:112: EnchantProvider's identify method does not return v" \
"alid UTF-8");
#line 474 "provider.c"
					} else {
						ProviderDescribe _tmp5_;
#line 113 "provider.vala"
						_tmp5_ = provider->describe;
#line 113 "provider.vala"
						if (_tmp5_ == NULL) {
#line 114 "provider.vala"
							g_warning ("provider.vala:114: EnchantProvider's describe method cannot be NULL");
#line 483 "provider.c"
						} else {
							ProviderDescribe _tmp6_;
							const gchar* _tmp7_;
#line 115 "provider.vala"
							_tmp6_ = provider->describe;
#line 115 "provider.vala"
							_tmp7_ = _tmp6_ (provider);
#line 115 "provider.vala"
							if (!g_utf8_validate (_tmp7_, (gssize) -1, NULL)) {
#line 116 "provider.vala"
								g_warning ("provider.vala:116: EnchantProvider's describe method does not return v" \
"alid UTF-8");
#line 495 "provider.c"
							} else {
								ProviderListDicts _tmp8_;
#line 117 "provider.vala"
								_tmp8_ = provider->list_dicts;
#line 117 "provider.vala"
								if (_tmp8_ == NULL) {
#line 118 "provider.vala"
									g_warning ("provider.vala:118: EnchantProvider's list_dicts method cannot be NULL");
#line 504 "provider.c"
								} else {
#line 120 "provider.vala"
									result = TRUE;
#line 120 "provider.vala"
									return result;
#line 510 "provider.c"
								}
							}
						}
					}
				}
			}
		}
	}
#line 122 "provider.vala"
	result = FALSE;
#line 122 "provider.vala"
	return result;
#line 523 "provider.c"
}

void
enchant_provider_set_error (EnchantProvider* self,
                            const gchar* err)
{
	EnchantBroker* broker = NULL;
	EnchantBroker* _tmp0_;
	EnchantBroker* _tmp1_;
	EnchantBroker* _tmp2_;
#line 125 "provider.vala"
	g_return_if_fail (self != NULL);
#line 125 "provider.vala"
	g_return_if_fail (err != NULL);
#line 126 "provider.vala"
	_tmp0_ = self->owner;
#line 126 "provider.vala"
	broker = _tmp0_;
#line 127 "provider.vala"
	_tmp1_ = broker;
#line 127 "provider.vala"
	if (_tmp1_ == NULL) {
#line 128 "provider.vala"
		return;
#line 548 "provider.c"
	}
#line 130 "provider.vala"
	g_debug ("provider.vala:130: enchant_provider_set_error: %s", err);
#line 131 "provider.vala"
	_tmp2_ = broker;
#line 131 "provider.vala"
	enchant_broker_set_error (_tmp2_, err);
#line 556 "provider.c"
}

gint
_enchant_provider_dictionary_exists (EnchantProvider* self,
                                     const gchar* tag)
{
	ProviderDictionaryExists _tmp0_;
	ProviderListDicts _tmp2_;
	size_t _tmp3_ = 0;
	gchar** _tmp4_;
	gint result;
#line 134 "provider.vala"
	g_return_val_if_fail (self != NULL, 0);
#line 134 "provider.vala"
	g_return_val_if_fail (tag != NULL, 0);
#line 135 "provider.vala"
	_tmp0_ = self->dictionary_exists;
#line 135 "provider.vala"
	if (_tmp0_ != NULL) {
#line 576 "provider.c"
		ProviderDictionaryExists _tmp1_;
#line 136 "provider.vala"
		_tmp1_ = self->dictionary_exists;
#line 136 "provider.vala"
		result = _tmp1_ (self, tag);
#line 136 "provider.vala"
		return result;
#line 584 "provider.c"
	}
#line 138 "provider.vala"
	_tmp2_ = self->list_dicts;
#line 138 "provider.vala"
	_tmp4_ = _tmp2_ (self, &_tmp3_);
#line 590 "provider.c"
	{
		gchar** dict_collection = NULL;
		gint dict_collection_length1 = 0;
		gint _dict_collection_size_ = 0;
		gint dict_it = 0;
#line 138 "provider.vala"
		dict_collection = _tmp4_;
#line 138 "provider.vala"
		dict_collection_length1 = _tmp3_;
#line 138 "provider.vala"
		for (dict_it = 0; dict_it < dict_collection_length1; dict_it = dict_it + 1) {
#line 602 "provider.c"
			gchar* _tmp5_;
			gchar* dict = NULL;
#line 138 "provider.vala"
			_tmp5_ = g_strdup (dict_collection[dict_it]);
#line 138 "provider.vala"
			dict = _tmp5_;
#line 609 "provider.c"
			{
				const gchar* _tmp6_;
#line 139 "provider.vala"
				_tmp6_ = dict;
#line 139 "provider.vala"
				if (g_strcmp0 (_tmp6_, tag) == 0) {
#line 140 "provider.vala"
					result = 1;
#line 140 "provider.vala"
					_g_free0 (dict);
#line 140 "provider.vala"
					dict_collection = (_vala_array_free (dict_collection, dict_collection_length1, (GDestroyNotify) g_free), NULL);
#line 140 "provider.vala"
					return result;
#line 624 "provider.c"
				}
#line 138 "provider.vala"
				_g_free0 (dict);
#line 628 "provider.c"
			}
		}
#line 138 "provider.vala"
		dict_collection = (_vala_array_free (dict_collection, dict_collection_length1, (GDestroyNotify) g_free), NULL);
#line 633 "provider.c"
	}
#line 141 "provider.vala"
	result = 0;
#line 141 "provider.vala"
	return result;
#line 639 "provider.c"
}

gchar*
enchant_provider_get_user_dict_dir (EnchantProvider* self)
{
	gchar* config_dir = NULL;
	gchar* _tmp0_;
	ProviderIdentify _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
#line 144 "provider.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 145 "provider.vala"
	_tmp0_ = enchant_get_user_config_dir ();
#line 145 "provider.vala"
	config_dir = _tmp0_;
#line 146 "provider.vala"
	_tmp1_ = self->identify;
#line 146 "provider.vala"
	_tmp2_ = _tmp1_ (self);
#line 146 "provider.vala"
	_tmp3_ = g_build_filename (config_dir, _tmp2_, NULL);
#line 146 "provider.vala"
	result = _tmp3_;
#line 146 "provider.vala"
	_g_free0 (config_dir);
#line 146 "provider.vala"
	return result;
#line 669 "provider.c"
}

EnchantProvider*
enchant_provider_construct (GType object_type)
{
	EnchantProvider* self = NULL;
#line 82 "provider.vala"
	self = (EnchantProvider*) g_type_create_instance (object_type);
#line 82 "provider.vala"
	return self;
#line 680 "provider.c"
}

EnchantProvider*
enchant_provider_new (void)
{
#line 82 "provider.vala"
	return enchant_provider_construct (TYPE_ENCHANT_PROVIDER);
#line 688 "provider.c"
}

static void
value_enchant_provider_init (GValue* value)
{
#line 82 "provider.vala"
	value->data[0].v_pointer = NULL;
#line 696 "provider.c"
}

static void
value_enchant_provider_free_value (GValue* value)
{
#line 82 "provider.vala"
	if (value->data[0].v_pointer) {
#line 82 "provider.vala"
		enchant_provider_unref (value->data[0].v_pointer);
#line 706 "provider.c"
	}
}

static void
value_enchant_provider_copy_value (const GValue* src_value,
                                   GValue* dest_value)
{
#line 82 "provider.vala"
	if (src_value->data[0].v_pointer) {
#line 82 "provider.vala"
		dest_value->data[0].v_pointer = enchant_provider_ref (src_value->data[0].v_pointer);
#line 718 "provider.c"
	} else {
#line 82 "provider.vala"
		dest_value->data[0].v_pointer = NULL;
#line 722 "provider.c"
	}
}

static gpointer
value_enchant_provider_peek_pointer (const GValue* value)
{
#line 82 "provider.vala"
	return value->data[0].v_pointer;
#line 731 "provider.c"
}

static gchar*
value_enchant_provider_collect_value (GValue* value,
                                      guint n_collect_values,
                                      GTypeCValue* collect_values,
                                      guint collect_flags)
{
#line 82 "provider.vala"
	if (collect_values[0].v_pointer) {
#line 742 "provider.c"
		EnchantProvider * object;
		object = collect_values[0].v_pointer;
#line 82 "provider.vala"
		if (object->parent_instance.g_class == NULL) {
#line 82 "provider.vala"
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 749 "provider.c"
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
#line 82 "provider.vala"
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 753 "provider.c"
		}
#line 82 "provider.vala"
		value->data[0].v_pointer = enchant_provider_ref (object);
#line 757 "provider.c"
	} else {
#line 82 "provider.vala"
		value->data[0].v_pointer = NULL;
#line 761 "provider.c"
	}
#line 82 "provider.vala"
	return NULL;
#line 765 "provider.c"
}

static gchar*
value_enchant_provider_lcopy_value (const GValue* value,
                                    guint n_collect_values,
                                    GTypeCValue* collect_values,
                                    guint collect_flags)
{
	EnchantProvider ** object_p;
	object_p = collect_values[0].v_pointer;
#line 82 "provider.vala"
	if (!object_p) {
#line 82 "provider.vala"
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
#line 780 "provider.c"
	}
#line 82 "provider.vala"
	if (!value->data[0].v_pointer) {
#line 82 "provider.vala"
		*object_p = NULL;
#line 786 "provider.c"
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
#line 82 "provider.vala"
		*object_p = value->data[0].v_pointer;
#line 790 "provider.c"
	} else {
#line 82 "provider.vala"
		*object_p = enchant_provider_ref (value->data[0].v_pointer);
#line 794 "provider.c"
	}
#line 82 "provider.vala"
	return NULL;
#line 798 "provider.c"
}

GParamSpec*
param_spec_enchant_provider (const gchar* name,
                             const gchar* nick,
                             const gchar* blurb,
                             GType object_type,
                             GParamFlags flags)
{
	ParamSpecEnchantProvider* spec;
#line 82 "provider.vala"
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_ENCHANT_PROVIDER), NULL);
#line 82 "provider.vala"
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
#line 82 "provider.vala"
	G_PARAM_SPEC (spec)->value_type = object_type;
#line 82 "provider.vala"
	return G_PARAM_SPEC (spec);
#line 817 "provider.c"
}

gpointer
value_get_enchant_provider (const GValue* value)
{
#line 82 "provider.vala"
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENCHANT_PROVIDER), NULL);
#line 82 "provider.vala"
	return value->data[0].v_pointer;
#line 827 "provider.c"
}

void
value_set_enchant_provider (GValue* value,
                            gpointer v_object)
{
	EnchantProvider * old;
#line 82 "provider.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENCHANT_PROVIDER));
#line 82 "provider.vala"
	old = value->data[0].v_pointer;
#line 82 "provider.vala"
	if (v_object) {
#line 82 "provider.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENCHANT_PROVIDER));
#line 82 "provider.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 82 "provider.vala"
		value->data[0].v_pointer = v_object;
#line 82 "provider.vala"
		enchant_provider_ref (value->data[0].v_pointer);
#line 849 "provider.c"
	} else {
#line 82 "provider.vala"
		value->data[0].v_pointer = NULL;
#line 853 "provider.c"
	}
#line 82 "provider.vala"
	if (old) {
#line 82 "provider.vala"
		enchant_provider_unref (old);
#line 859 "provider.c"
	}
}

void
value_take_enchant_provider (GValue* value,
                             gpointer v_object)
{
	EnchantProvider * old;
#line 82 "provider.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENCHANT_PROVIDER));
#line 82 "provider.vala"
	old = value->data[0].v_pointer;
#line 82 "provider.vala"
	if (v_object) {
#line 82 "provider.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENCHANT_PROVIDER));
#line 82 "provider.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 82 "provider.vala"
		value->data[0].v_pointer = v_object;
#line 880 "provider.c"
	} else {
#line 82 "provider.vala"
		value->data[0].v_pointer = NULL;
#line 884 "provider.c"
	}
#line 82 "provider.vala"
	if (old) {
#line 82 "provider.vala"
		enchant_provider_unref (old);
#line 890 "provider.c"
	}
}

static void
enchant_provider_class_init (EnchantProviderClass * klass,
                             gpointer klass_data)
{
#line 82 "provider.vala"
	enchant_provider_parent_class = g_type_class_peek_parent (klass);
#line 82 "provider.vala"
	((EnchantProviderClass *) klass)->finalize = enchant_provider_finalize;
#line 902 "provider.c"
}

static void
enchant_provider_instance_init (EnchantProvider * self,
                                gpointer klass)
{
#line 82 "provider.vala"
	self->ref_count = 1;
#line 911 "provider.c"
}

static void
enchant_provider_finalize (EnchantProvider * obj)
{
	EnchantProvider * self;
	GModule* module = NULL;
	GModule* _tmp0_;
	ProviderDispose _tmp1_;
	GModule* _tmp3_;
#line 82 "provider.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ENCHANT_PROVIDER, EnchantProvider);
#line 82 "provider.vala"
	g_signal_handlers_destroy (self);
#line 95 "provider.vala"
	_tmp0_ = self->module;
#line 95 "provider.vala"
	self->module = NULL;
#line 95 "provider.vala"
	module = _tmp0_;
#line 96 "provider.vala"
	_tmp1_ = self->dispose;
#line 96 "provider.vala"
	if (_tmp1_ != NULL) {
#line 936 "provider.c"
		ProviderDispose _tmp2_;
#line 97 "provider.vala"
		_tmp2_ = self->dispose;
#line 97 "provider.vala"
		_tmp2_ (self);
#line 942 "provider.c"
	}
#line 99 "provider.vala"
	_tmp3_ = module;
#line 99 "provider.vala"
	module = NULL;
#line 99 "provider.vala"
	g_module_close (_tmp3_);
#line 82 "provider.vala"
	_g_module_close0 (module);
#line 84 "provider.vala"
	_g_module_close0 (self->module);
#line 954 "provider.c"
}

static GType
enchant_provider_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_enchant_provider_init, value_enchant_provider_free_value, value_enchant_provider_copy_value, value_enchant_provider_peek_pointer, "p", value_enchant_provider_collect_value, "p", value_enchant_provider_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (EnchantProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) enchant_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EnchantProvider), 0, (GInstanceInitFunc) enchant_provider_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType enchant_provider_type_id;
	enchant_provider_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EnchantProvider", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return enchant_provider_type_id;
}

GType
enchant_provider_get_type (void)
{
	static volatile gsize enchant_provider_type_id__once = 0;
	if (g_once_init_enter (&enchant_provider_type_id__once)) {
		GType enchant_provider_type_id;
		enchant_provider_type_id = enchant_provider_get_type_once ();
		g_once_init_leave (&enchant_provider_type_id__once, enchant_provider_type_id);
	}
	return enchant_provider_type_id__once;
}

gpointer
enchant_provider_ref (gpointer instance)
{
	EnchantProvider * self;
	self = instance;
#line 82 "provider.vala"
	g_atomic_int_inc (&self->ref_count);
#line 82 "provider.vala"
	return instance;
#line 989 "provider.c"
}

void
enchant_provider_unref (gpointer instance)
{
	EnchantProvider * self;
	self = instance;
#line 82 "provider.vala"
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
#line 82 "provider.vala"
		ENCHANT_PROVIDER_GET_CLASS (self)->finalize (self);
#line 82 "provider.vala"
		g_type_free_instance ((GTypeInstance *) self);
#line 1003 "provider.c"
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

