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


#include <glib.h>
#include <glib-object.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <gio/gio.h>
#include <gobject/gvaluecollector.h>


#define PDFPC_TYPE_CONFIG_FILE_READER (pdfpc_config_file_reader_get_type ())
#define PDFPC_CONFIG_FILE_READER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_CONFIG_FILE_READER, pdfpcConfigFileReader))
#define PDFPC_CONFIG_FILE_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_CONFIG_FILE_READER, pdfpcConfigFileReaderClass))
#define PDFPC_IS_CONFIG_FILE_READER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_CONFIG_FILE_READER))
#define PDFPC_IS_CONFIG_FILE_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_CONFIG_FILE_READER))
#define PDFPC_CONFIG_FILE_READER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_CONFIG_FILE_READER, pdfpcConfigFileReaderClass))

typedef struct _pdfpcConfigFileReader pdfpcConfigFileReader;
typedef struct _pdfpcConfigFileReaderClass pdfpcConfigFileReaderClass;
typedef struct _pdfpcConfigFileReaderPrivate pdfpcConfigFileReaderPrivate;

#define PDFPC_TYPE_PRESENTATION_CONTROLLER (pdfpc_presentation_controller_get_type ())
#define PDFPC_PRESENTATION_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationController))
#define PDFPC_PRESENTATION_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationControllerClass))
#define PDFPC_IS_PRESENTATION_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER))
#define PDFPC_IS_PRESENTATION_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_PRESENTATION_CONTROLLER))
#define PDFPC_PRESENTATION_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationControllerClass))

typedef struct _pdfpcPresentationController pdfpcPresentationController;
typedef struct _pdfpcPresentationControllerClass pdfpcPresentationControllerClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _pdfpcParamSpecConfigFileReader pdfpcParamSpecConfigFileReader;

struct _pdfpcConfigFileReader {
	GTypeInstance parent_instance;
	volatile int ref_count;
	pdfpcConfigFileReaderPrivate * priv;
	pdfpcPresentationController* presentation_controller;
};

struct _pdfpcConfigFileReaderClass {
	GTypeClass parent_class;
	void (*finalize) (pdfpcConfigFileReader *self);
};

typedef guint (*pdfpcConfigFileReaderbinding2uint) (const gchar* a, void* user_data);
struct _pdfpcParamSpecConfigFileReader {
	GParamSpec parent_instance;
};


static gpointer pdfpc_config_file_reader_parent_class = NULL;
extern gboolean pdfpc_options_display_switch;

gpointer pdfpc_config_file_reader_ref (gpointer instance);
void pdfpc_config_file_reader_unref (gpointer instance);
GParamSpec* pdfpc_param_spec_config_file_reader (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void pdfpc_value_set_config_file_reader (GValue* value, gpointer v_object);
void pdfpc_value_take_config_file_reader (GValue* value, gpointer v_object);
gpointer pdfpc_value_get_config_file_reader (const GValue* value);
GType pdfpc_config_file_reader_get_type (void) G_GNUC_CONST;
GType pdfpc_presentation_controller_get_type (void) G_GNUC_CONST;
enum  {
	PDFPC_CONFIG_FILE_READER_DUMMY_PROPERTY
};
pdfpcConfigFileReader* pdfpc_config_file_reader_new (pdfpcPresentationController* controller);
pdfpcConfigFileReader* pdfpc_config_file_reader_construct (GType object_type, pdfpcPresentationController* controller);
void pdfpc_presentation_controller_set_accepted_key_mods (pdfpcPresentationController* self, guint value);
static void pdfpc_config_file_reader_readBindDef (pdfpcConfigFileReader* self, const gchar* name, pdfpcConfigFileReaderbinding2uint conversor, void* conversor_target, guint* code, guint* modMask);
static void pdfpc_config_file_reader_bindKey (pdfpcConfigFileReader* self, const gchar* wholeLine, gchar** fields, int fields_length1);
static guint _gdk_keyval_from_name_pdfpc_config_file_readerbinding2uint (const gchar* a, gpointer self);
void pdfpc_presentation_controller_bind (pdfpcPresentationController* self, guint keycode, guint modMask, const gchar* function);
static void pdfpc_config_file_reader_unbindKey (pdfpcConfigFileReader* self, const gchar* wholeLine, gchar** fields, int fields_length1);
void pdfpc_presentation_controller_unbind (pdfpcPresentationController* self, guint keycode, guint modMask);
static void pdfpc_config_file_reader_bindMouse (pdfpcConfigFileReader* self, const gchar* wholeLine, gchar** fields, int fields_length1);
static guint __lambda8_ (pdfpcConfigFileReader* self, const gchar* x);
static guint ___lambda8__pdfpc_config_file_readerbinding2uint (const gchar* a, gpointer self);
void pdfpc_presentation_controller_bindMouse (pdfpcPresentationController* self, guint button, guint modMask, const gchar* function);
static void pdfpc_config_file_reader_unbindMouse (pdfpcConfigFileReader* self, const gchar* wholeLine, gchar** fields, int fields_length1);
static guint __lambda9_ (pdfpcConfigFileReader* self, const gchar* x);
static guint ___lambda9__pdfpc_config_file_readerbinding2uint (const gchar* a, gpointer self);
void pdfpc_presentation_controller_unbindMouse (pdfpcPresentationController* self, guint keycode, guint modMask);
void pdfpc_config_file_reader_readConfig (pdfpcConfigFileReader* self, const gchar* fname);
void pdfpc_presentation_controller_unbindAll (pdfpcPresentationController* self);
void pdfpc_presentation_controller_unbindAllMouse (pdfpcPresentationController* self);
static void pdfpc_config_file_reader_finalize (pdfpcConfigFileReader* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


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


pdfpcConfigFileReader* pdfpc_config_file_reader_construct (GType object_type, pdfpcPresentationController* controller) {
	pdfpcConfigFileReader* self = NULL;
	pdfpcPresentationController* _tmp0_;
	pdfpcPresentationController* _tmp1_;
	guint supportedModifiers;
	pdfpcPresentationController* _tmp2_;
	g_return_val_if_fail (controller != NULL, NULL);
	self = (pdfpcConfigFileReader*) g_type_create_instance (object_type);
	_tmp0_ = controller;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->presentation_controller);
	self->presentation_controller = _tmp1_;
	supportedModifiers = (guint) ((GDK_SHIFT_MASK | GDK_CONTROL_MASK) | GDK_META_MASK);
	_tmp2_ = self->presentation_controller;
	pdfpc_presentation_controller_set_accepted_key_mods (_tmp2_, supportedModifiers);
	return self;
}


pdfpcConfigFileReader* pdfpc_config_file_reader_new (pdfpcPresentationController* controller) {
	return pdfpc_config_file_reader_construct (PDFPC_TYPE_CONFIG_FILE_READER, controller);
}


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_;
	gchar _tmp1_;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = index;
	_tmp1_ = ((gchar*) self)[_tmp0_];
	result = _tmp1_;
	return result;
}


static void pdfpc_config_file_reader_readBindDef (pdfpcConfigFileReader* self, const gchar* name, pdfpcConfigFileReaderbinding2uint conversor, void* conversor_target, guint* code, guint* modMask) {
	guint _vala_code = 0U;
	guint _vala_modMask = 0U;
	const gchar* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_ = NULL;
	gchar** fields;
	gint fields_length1;
	gint _fields_size_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = name;
	_tmp2_ = _tmp1_ = g_strsplit (_tmp0_, "+", 0);
	fields = _tmp2_;
	fields_length1 = _vala_array_length (_tmp1_);
	_fields_size_ = fields_length1;
	_vala_modMask = (guint) 0x0;
	_vala_code = (guint) 0x0;
	_tmp3_ = fields;
	_tmp3__length1 = fields_length1;
	if (_tmp3__length1 == 1) {
		pdfpcConfigFileReaderbinding2uint _tmp4_;
		void* _tmp4__target;
		const gchar* _tmp5_;
		guint _tmp6_ = 0U;
		_tmp4_ = conversor;
		_tmp4__target = conversor_target;
		_tmp5_ = name;
		_tmp6_ = _tmp4_ (_tmp5_, _tmp4__target);
		_vala_code = _tmp6_;
	} else {
		gchar** _tmp7_;
		gint _tmp7__length1;
		_tmp7_ = fields;
		_tmp7__length1 = fields_length1;
		if (_tmp7__length1 == 2) {
			gchar** _tmp8_;
			gint _tmp8__length1;
			const gchar* _tmp9_;
			gchar* _tmp10_;
			gchar* modString;
			pdfpcConfigFileReaderbinding2uint _tmp28_;
			void* _tmp28__target;
			gchar** _tmp29_;
			gint _tmp29__length1;
			const gchar* _tmp30_;
			guint _tmp31_ = 0U;
			_tmp8_ = fields;
			_tmp8__length1 = fields_length1;
			_tmp9_ = _tmp8_[0];
			_tmp10_ = g_strdup (_tmp9_);
			modString = _tmp10_;
			{
				gint m;
				m = 0;
				{
					gboolean _tmp11_;
					_tmp11_ = TRUE;
					while (TRUE) {
						gboolean _tmp12_;
						gint _tmp14_;
						const gchar* _tmp15_;
						gint _tmp16_;
						gint _tmp17_;
						const gchar* _tmp18_;
						gint _tmp19_;
						gchar _tmp20_ = '\0';
						_tmp12_ = _tmp11_;
						if (!_tmp12_) {
							gint _tmp13_;
							_tmp13_ = m;
							m = _tmp13_ + 1;
						}
						_tmp11_ = FALSE;
						_tmp14_ = m;
						_tmp15_ = modString;
						_tmp16_ = strlen (_tmp15_);
						_tmp17_ = _tmp16_;
						if (!(_tmp14_ < _tmp17_)) {
							break;
						}
						_tmp18_ = modString;
						_tmp19_ = m;
						_tmp20_ = string_get (_tmp18_, (glong) _tmp19_);
						switch (_tmp20_) {
							case 'S':
							{
								guint _tmp21_;
								_tmp21_ = _vala_modMask;
								_vala_modMask = _tmp21_ | GDK_SHIFT_MASK;
								break;
							}
							case 'C':
							{
								guint _tmp22_;
								_tmp22_ = _vala_modMask;
								_vala_modMask = _tmp22_ | GDK_CONTROL_MASK;
								break;
							}
							case 'A':
							case 'M':
							{
								guint _tmp23_;
								_tmp23_ = _vala_modMask;
								_vala_modMask = _tmp23_ | GDK_META_MASK;
								break;
							}
							default:
							{
								FILE* _tmp24_;
								const gchar* _tmp25_;
								gint _tmp26_;
								gchar _tmp27_ = '\0';
								_tmp24_ = stderr;
								_tmp25_ = modString;
								_tmp26_ = m;
								_tmp27_ = string_get (_tmp25_, (glong) _tmp26_);
								fprintf (_tmp24_, "Warning: Ignoring unknown modifier '%c'\n", (gint) _tmp27_);
								break;
							}
						}
					}
				}
			}
			_tmp28_ = conversor;
			_tmp28__target = conversor_target;
			_tmp29_ = fields;
			_tmp29__length1 = fields_length1;
			_tmp30_ = _tmp29_[1];
			_tmp31_ = _tmp28_ (_tmp30_, _tmp28__target);
			_vala_code = _tmp31_;
			_g_free0 (modString);
		}
	}
	fields = (_vala_array_free (fields, fields_length1, (GDestroyNotify) g_free), NULL);
	if (code) {
		*code = _vala_code;
	}
	if (modMask) {
		*modMask = _vala_modMask;
	}
}


static guint _gdk_keyval_from_name_pdfpc_config_file_readerbinding2uint (const gchar* a, gpointer self) {
	guint result;
	result = gdk_keyval_from_name (a);
	return result;
}


static void pdfpc_config_file_reader_bindKey (pdfpcConfigFileReader* self, const gchar* wholeLine, gchar** fields, int fields_length1) {
	gchar** _tmp0_;
	gint _tmp0__length1;
	guint modMask;
	guint keycode;
	gchar** _tmp3_;
	gint _tmp3__length1;
	const gchar* _tmp4_;
	guint _tmp5_ = 0U;
	guint _tmp6_ = 0U;
	guint _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (wholeLine != NULL);
	_tmp0_ = fields;
	_tmp0__length1 = fields_length1;
	if (_tmp0__length1 != 3) {
		FILE* _tmp1_;
		const gchar* _tmp2_;
		_tmp1_ = stderr;
		_tmp2_ = wholeLine;
		fprintf (_tmp1_, "Bad key specification: %s\n", _tmp2_);
		return;
	}
	modMask = (guint) 0;
	keycode = (guint) 0;
	_tmp3_ = fields;
	_tmp3__length1 = fields_length1;
	_tmp4_ = _tmp3_[1];
	pdfpc_config_file_reader_readBindDef (self, _tmp4_, _gdk_keyval_from_name_pdfpc_config_file_readerbinding2uint, NULL, &_tmp5_, &_tmp6_);
	keycode = _tmp5_;
	modMask = _tmp6_;
	_tmp7_ = keycode;
	if (_tmp7_ == ((guint) 0x0)) {
		FILE* _tmp8_;
		gchar** _tmp9_;
		gint _tmp9__length1;
		const gchar* _tmp10_;
		_tmp8_ = stderr;
		_tmp9_ = fields;
		_tmp9__length1 = fields_length1;
		_tmp10_ = _tmp9_[1];
		fprintf (_tmp8_, "Warning: Unknown key: %s\n", _tmp10_);
	} else {
		pdfpcPresentationController* _tmp11_;
		guint _tmp12_;
		guint _tmp13_;
		gchar** _tmp14_;
		gint _tmp14__length1;
		const gchar* _tmp15_;
		_tmp11_ = self->presentation_controller;
		_tmp12_ = keycode;
		_tmp13_ = modMask;
		_tmp14_ = fields;
		_tmp14__length1 = fields_length1;
		_tmp15_ = _tmp14_[2];
		pdfpc_presentation_controller_bind (_tmp11_, _tmp12_, _tmp13_, _tmp15_);
	}
}


static void pdfpc_config_file_reader_unbindKey (pdfpcConfigFileReader* self, const gchar* wholeLine, gchar** fields, int fields_length1) {
	gchar** _tmp0_;
	gint _tmp0__length1;
	guint modMask;
	guint keycode;
	gchar** _tmp3_;
	gint _tmp3__length1;
	const gchar* _tmp4_;
	guint _tmp5_ = 0U;
	guint _tmp6_ = 0U;
	guint _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (wholeLine != NULL);
	_tmp0_ = fields;
	_tmp0__length1 = fields_length1;
	if (_tmp0__length1 != 2) {
		FILE* _tmp1_;
		const gchar* _tmp2_;
		_tmp1_ = stderr;
		_tmp2_ = wholeLine;
		fprintf (_tmp1_, "Bad unbind specification: %s\n", _tmp2_);
		return;
	}
	modMask = (guint) 0;
	keycode = (guint) 0;
	_tmp3_ = fields;
	_tmp3__length1 = fields_length1;
	_tmp4_ = _tmp3_[1];
	pdfpc_config_file_reader_readBindDef (self, _tmp4_, _gdk_keyval_from_name_pdfpc_config_file_readerbinding2uint, NULL, &_tmp5_, &_tmp6_);
	keycode = _tmp5_;
	modMask = _tmp6_;
	_tmp7_ = keycode;
	if (_tmp7_ == ((guint) 0x0)) {
		FILE* _tmp8_;
		gchar** _tmp9_;
		gint _tmp9__length1;
		const gchar* _tmp10_;
		_tmp8_ = stderr;
		_tmp9_ = fields;
		_tmp9__length1 = fields_length1;
		_tmp10_ = _tmp9_[1];
		fprintf (_tmp8_, "Warning: Unknown key: %s\n", _tmp10_);
	} else {
		pdfpcPresentationController* _tmp11_;
		guint _tmp12_;
		guint _tmp13_;
		_tmp11_ = self->presentation_controller;
		_tmp12_ = keycode;
		_tmp13_ = modMask;
		pdfpc_presentation_controller_unbind (_tmp11_, _tmp12_, _tmp13_);
	}
}


static guint __lambda8_ (pdfpcConfigFileReader* self, const gchar* x) {
	guint result = 0U;
	const gchar* _tmp0_;
	gint _tmp1_ = 0;
	g_return_val_if_fail (x != NULL, 0U);
	_tmp0_ = x;
	_tmp1_ = atoi (_tmp0_);
	result = (guint) _tmp1_;
	return result;
}


static guint ___lambda8__pdfpc_config_file_readerbinding2uint (const gchar* a, gpointer self) {
	guint result;
	result = __lambda8_ (self, a);
	return result;
}


static void pdfpc_config_file_reader_bindMouse (pdfpcConfigFileReader* self, const gchar* wholeLine, gchar** fields, int fields_length1) {
	gchar** _tmp0_;
	gint _tmp0__length1;
	guint modMask;
	guint button;
	gchar** _tmp3_;
	gint _tmp3__length1;
	const gchar* _tmp4_;
	guint _tmp5_ = 0U;
	guint _tmp6_ = 0U;
	guint _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (wholeLine != NULL);
	_tmp0_ = fields;
	_tmp0__length1 = fields_length1;
	if (_tmp0__length1 != 3) {
		FILE* _tmp1_;
		const gchar* _tmp2_;
		_tmp1_ = stderr;
		_tmp2_ = wholeLine;
		fprintf (_tmp1_, "Bad mouse specification: %s\n", _tmp2_);
		return;
	}
	modMask = (guint) 0;
	button = (guint) 0;
	_tmp3_ = fields;
	_tmp3__length1 = fields_length1;
	_tmp4_ = _tmp3_[1];
	pdfpc_config_file_reader_readBindDef (self, _tmp4_, ___lambda8__pdfpc_config_file_readerbinding2uint, self, &_tmp5_, &_tmp6_);
	button = _tmp5_;
	modMask = _tmp6_;
	_tmp7_ = button;
	if (_tmp7_ == ((guint) 0x0)) {
		FILE* _tmp8_;
		gchar** _tmp9_;
		gint _tmp9__length1;
		const gchar* _tmp10_;
		_tmp8_ = stderr;
		_tmp9_ = fields;
		_tmp9__length1 = fields_length1;
		_tmp10_ = _tmp9_[1];
		fprintf (_tmp8_, "Warning: Unknown button: %s\n", _tmp10_);
	} else {
		pdfpcPresentationController* _tmp11_;
		guint _tmp12_;
		guint _tmp13_;
		gchar** _tmp14_;
		gint _tmp14__length1;
		const gchar* _tmp15_;
		_tmp11_ = self->presentation_controller;
		_tmp12_ = button;
		_tmp13_ = modMask;
		_tmp14_ = fields;
		_tmp14__length1 = fields_length1;
		_tmp15_ = _tmp14_[2];
		pdfpc_presentation_controller_bindMouse (_tmp11_, _tmp12_, _tmp13_, _tmp15_);
	}
}


static guint __lambda9_ (pdfpcConfigFileReader* self, const gchar* x) {
	guint result = 0U;
	const gchar* _tmp0_;
	gint _tmp1_ = 0;
	g_return_val_if_fail (x != NULL, 0U);
	_tmp0_ = x;
	_tmp1_ = atoi (_tmp0_);
	result = (guint) _tmp1_;
	return result;
}


static guint ___lambda9__pdfpc_config_file_readerbinding2uint (const gchar* a, gpointer self) {
	guint result;
	result = __lambda9_ (self, a);
	return result;
}


static void pdfpc_config_file_reader_unbindMouse (pdfpcConfigFileReader* self, const gchar* wholeLine, gchar** fields, int fields_length1) {
	gchar** _tmp0_;
	gint _tmp0__length1;
	guint modMask;
	guint button;
	gchar** _tmp3_;
	gint _tmp3__length1;
	const gchar* _tmp4_;
	guint _tmp5_ = 0U;
	guint _tmp6_ = 0U;
	guint _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (wholeLine != NULL);
	_tmp0_ = fields;
	_tmp0__length1 = fields_length1;
	if (_tmp0__length1 != 2) {
		FILE* _tmp1_;
		const gchar* _tmp2_;
		_tmp1_ = stderr;
		_tmp2_ = wholeLine;
		fprintf (_tmp1_, "Bad unmouse specification: %s\n", _tmp2_);
		return;
	}
	modMask = (guint) 0;
	button = (guint) 0;
	_tmp3_ = fields;
	_tmp3__length1 = fields_length1;
	_tmp4_ = _tmp3_[1];
	pdfpc_config_file_reader_readBindDef (self, _tmp4_, ___lambda9__pdfpc_config_file_readerbinding2uint, self, &_tmp5_, &_tmp6_);
	button = _tmp5_;
	modMask = _tmp6_;
	_tmp7_ = button;
	if (_tmp7_ == ((guint) 0x0)) {
		FILE* _tmp8_;
		gchar** _tmp9_;
		gint _tmp9__length1;
		const gchar* _tmp10_;
		_tmp8_ = stderr;
		_tmp9_ = fields;
		_tmp9__length1 = fields_length1;
		_tmp10_ = _tmp9_[1];
		fprintf (_tmp8_, "Warning: Unknown button: %s\n", _tmp10_);
	} else {
		pdfpcPresentationController* _tmp11_;
		guint _tmp12_;
		guint _tmp13_;
		_tmp11_ = self->presentation_controller;
		_tmp12_ = button;
		_tmp13_ = modMask;
		pdfpc_presentation_controller_unbindMouse (_tmp11_, _tmp12_, _tmp13_);
	}
}


void pdfpc_config_file_reader_readConfig (pdfpcConfigFileReader* self, const gchar* fname) {
	const gchar* _tmp0_;
	GFile* _tmp1_ = NULL;
	GFile* file;
	GRegex* _tmp2_;
	GRegex* splitRegex;
	GRegex* _tmp3_;
	GRegex* commentRegex;
	guint8* raw_datau8 = NULL;
	gint raw_datau8_length1 = 0;
	gint _raw_datau8_size_ = 0;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (fname != NULL);
	_tmp0_ = fname;
	_tmp1_ = g_file_new_for_path (_tmp0_);
	file = _tmp1_;
	_tmp2_ = g_regex_new ("\\s\\s*", 0, 0, &_inner_error_);
	splitRegex = _tmp2_;
	if (_inner_error_ != NULL) {
		_g_object_unref0 (file);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp3_ = g_regex_new ("\\s*#.*$", 0, 0, &_inner_error_);
	commentRegex = _tmp3_;
	if (_inner_error_ != NULL) {
		_g_regex_unref0 (splitRegex);
		_g_object_unref0 (file);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	{
		GFile* _tmp4_;
		guint8* _tmp5_ = NULL;
		gsize _tmp6_;
		guint8* _tmp7_;
		gint _tmp7__length1;
		gchar** _tmp8_;
		gchar** _tmp9_ = NULL;
		gchar** lines;
		gint lines_length1;
		gint _lines_size_;
		_tmp4_ = file;
		g_file_load_contents (_tmp4_, NULL, &_tmp5_, &_tmp6_, NULL, &_inner_error_);
		raw_datau8 = (g_free (raw_datau8), NULL);
		raw_datau8 = _tmp5_;
		raw_datau8_length1 = _tmp6_;
		_raw_datau8_size_ = raw_datau8_length1;
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
		_tmp7_ = raw_datau8;
		_tmp7__length1 = raw_datau8_length1;
		_tmp9_ = _tmp8_ = g_strsplit ((const gchar*) _tmp7_, "\n", 0);
		lines = _tmp9_;
		lines_length1 = _vala_array_length (_tmp8_);
		_lines_size_ = lines_length1;
		{
			gint i;
			i = 0;
			{
				gboolean _tmp10_;
				_tmp10_ = TRUE;
				while (TRUE) {
					gboolean _tmp11_;
					gint _tmp13_;
					gchar** _tmp14_;
					gint _tmp14__length1;
					GRegex* _tmp15_;
					gchar** _tmp16_;
					gint _tmp16__length1;
					gint _tmp17_;
					const gchar* _tmp18_;
					gchar* _tmp19_ = NULL;
					gchar* uncommentedLine;
					GRegex* _tmp20_;
					const gchar* _tmp21_;
					gchar** _tmp22_;
					gchar** _tmp23_ = NULL;
					gchar** fields;
					gint fields_length1;
					gint _fields_size_;
					gchar** _tmp24_;
					gint _tmp24__length1;
					gchar** _tmp25_;
					gint _tmp25__length1;
					const gchar* _tmp26_;
					const gchar* _tmp27_;
					GQuark _tmp29_ = 0U;
					static GQuark _tmp28_label0 = 0;
					static GQuark _tmp28_label1 = 0;
					static GQuark _tmp28_label2 = 0;
					static GQuark _tmp28_label3 = 0;
					static GQuark _tmp28_label4 = 0;
					static GQuark _tmp28_label5 = 0;
					static GQuark _tmp28_label6 = 0;
					_tmp11_ = _tmp10_;
					if (!_tmp11_) {
						gint _tmp12_;
						_tmp12_ = i;
						i = _tmp12_ + 1;
					}
					_tmp10_ = FALSE;
					_tmp13_ = i;
					_tmp14_ = lines;
					_tmp14__length1 = lines_length1;
					if (!(_tmp13_ < _tmp14__length1)) {
						break;
					}
					_tmp15_ = commentRegex;
					_tmp16_ = lines;
					_tmp16__length1 = lines_length1;
					_tmp17_ = i;
					_tmp18_ = _tmp16_[_tmp17_];
					_tmp19_ = g_regex_replace (_tmp15_, _tmp18_, (gssize) (-1), 0, "", 0, &_inner_error_);
					uncommentedLine = _tmp19_;
					if (_inner_error_ != NULL) {
						lines = (_vala_array_free (lines, lines_length1, (GDestroyNotify) g_free), NULL);
						goto __catch0_g_error;
					}
					_tmp20_ = splitRegex;
					_tmp21_ = uncommentedLine;
					_tmp23_ = _tmp22_ = g_regex_split (_tmp20_, _tmp21_, 0);
					fields = _tmp23_;
					fields_length1 = _vala_array_length (_tmp22_);
					_fields_size_ = fields_length1;
					_tmp24_ = fields;
					_tmp24__length1 = fields_length1;
					if (_tmp24__length1 == 0) {
						fields = (_vala_array_free (fields, fields_length1, (GDestroyNotify) g_free), NULL);
						_g_free0 (uncommentedLine);
						continue;
					}
					_tmp25_ = fields;
					_tmp25__length1 = fields_length1;
					_tmp26_ = _tmp25_[0];
					_tmp27_ = _tmp26_;
					_tmp29_ = (NULL == _tmp27_) ? 0 : g_quark_from_string (_tmp27_);
					if (_tmp29_ == ((0 != _tmp28_label0) ? _tmp28_label0 : (_tmp28_label0 = g_quark_from_static_string ("bind")))) {
						switch (0) {
							default:
							{
								const gchar* _tmp30_;
								gchar** _tmp31_;
								gint _tmp31__length1;
								_tmp30_ = uncommentedLine;
								_tmp31_ = fields;
								_tmp31__length1 = fields_length1;
								pdfpc_config_file_reader_bindKey (self, _tmp30_, _tmp31_, _tmp31__length1);
								break;
							}
						}
					} else if (_tmp29_ == ((0 != _tmp28_label1) ? _tmp28_label1 : (_tmp28_label1 = g_quark_from_static_string ("unbind")))) {
						switch (0) {
							default:
							{
								const gchar* _tmp32_;
								gchar** _tmp33_;
								gint _tmp33__length1;
								_tmp32_ = uncommentedLine;
								_tmp33_ = fields;
								_tmp33__length1 = fields_length1;
								pdfpc_config_file_reader_unbindKey (self, _tmp32_, _tmp33_, _tmp33__length1);
								break;
							}
						}
					} else if (_tmp29_ == ((0 != _tmp28_label2) ? _tmp28_label2 : (_tmp28_label2 = g_quark_from_static_string ("unbind_all")))) {
						switch (0) {
							default:
							{
								pdfpcPresentationController* _tmp34_;
								_tmp34_ = self->presentation_controller;
								pdfpc_presentation_controller_unbindAll (_tmp34_);
								break;
							}
						}
					} else if (_tmp29_ == ((0 != _tmp28_label3) ? _tmp28_label3 : (_tmp28_label3 = g_quark_from_static_string ("mouse")))) {
						switch (0) {
							default:
							{
								const gchar* _tmp35_;
								gchar** _tmp36_;
								gint _tmp36__length1;
								_tmp35_ = uncommentedLine;
								_tmp36_ = fields;
								_tmp36__length1 = fields_length1;
								pdfpc_config_file_reader_bindMouse (self, _tmp35_, _tmp36_, _tmp36__length1);
								break;
							}
						}
					} else if (_tmp29_ == ((0 != _tmp28_label4) ? _tmp28_label4 : (_tmp28_label4 = g_quark_from_static_string ("unmouse")))) {
						switch (0) {
							default:
							{
								const gchar* _tmp37_;
								gchar** _tmp38_;
								gint _tmp38__length1;
								_tmp37_ = uncommentedLine;
								_tmp38_ = fields;
								_tmp38__length1 = fields_length1;
								pdfpc_config_file_reader_unbindMouse (self, _tmp37_, _tmp38_, _tmp38__length1);
								break;
							}
						}
					} else if (_tmp29_ == ((0 != _tmp28_label5) ? _tmp28_label5 : (_tmp28_label5 = g_quark_from_static_string ("unmouse_all")))) {
						switch (0) {
							default:
							{
								pdfpcPresentationController* _tmp39_;
								_tmp39_ = self->presentation_controller;
								pdfpc_presentation_controller_unbindAllMouse (_tmp39_);
								break;
							}
						}
					} else if (_tmp29_ == ((0 != _tmp28_label6) ? _tmp28_label6 : (_tmp28_label6 = g_quark_from_static_string ("switch-screens")))) {
						switch (0) {
							default:
							{
								gboolean _tmp40_;
								_tmp40_ = pdfpc_options_display_switch;
								pdfpc_options_display_switch = !_tmp40_;
								break;
							}
						}
					} else {
						switch (0) {
							default:
							{
								FILE* _tmp41_;
								const gchar* _tmp42_;
								_tmp41_ = stderr;
								_tmp42_ = uncommentedLine;
								fprintf (_tmp41_, "Warning: Unknown command line \"%s\"\n", _tmp42_);
								break;
							}
						}
					}
					fields = (_vala_array_free (fields, fields_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (uncommentedLine);
				}
			}
		}
		lines = (_vala_array_free (lines, lines_length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_g_error_free0 (e);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		raw_datau8 = (g_free (raw_datau8), NULL);
		_g_regex_unref0 (commentRegex);
		_g_regex_unref0 (splitRegex);
		_g_object_unref0 (file);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	raw_datau8 = (g_free (raw_datau8), NULL);
	_g_regex_unref0 (commentRegex);
	_g_regex_unref0 (splitRegex);
	_g_object_unref0 (file);
}


static void pdfpc_value_config_file_reader_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void pdfpc_value_config_file_reader_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		pdfpc_config_file_reader_unref (value->data[0].v_pointer);
	}
}


static void pdfpc_value_config_file_reader_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = pdfpc_config_file_reader_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer pdfpc_value_config_file_reader_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* pdfpc_value_config_file_reader_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		pdfpcConfigFileReader* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = pdfpc_config_file_reader_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* pdfpc_value_config_file_reader_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	pdfpcConfigFileReader** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = pdfpc_config_file_reader_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* pdfpc_param_spec_config_file_reader (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	pdfpcParamSpecConfigFileReader* spec;
	g_return_val_if_fail (g_type_is_a (object_type, PDFPC_TYPE_CONFIG_FILE_READER), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer pdfpc_value_get_config_file_reader (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PDFPC_TYPE_CONFIG_FILE_READER), NULL);
	return value->data[0].v_pointer;
}


void pdfpc_value_set_config_file_reader (GValue* value, gpointer v_object) {
	pdfpcConfigFileReader* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PDFPC_TYPE_CONFIG_FILE_READER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PDFPC_TYPE_CONFIG_FILE_READER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		pdfpc_config_file_reader_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		pdfpc_config_file_reader_unref (old);
	}
}


void pdfpc_value_take_config_file_reader (GValue* value, gpointer v_object) {
	pdfpcConfigFileReader* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PDFPC_TYPE_CONFIG_FILE_READER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PDFPC_TYPE_CONFIG_FILE_READER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		pdfpc_config_file_reader_unref (old);
	}
}


static void pdfpc_config_file_reader_class_init (pdfpcConfigFileReaderClass * klass) {
	pdfpc_config_file_reader_parent_class = g_type_class_peek_parent (klass);
	PDFPC_CONFIG_FILE_READER_CLASS (klass)->finalize = pdfpc_config_file_reader_finalize;
}


static void pdfpc_config_file_reader_instance_init (pdfpcConfigFileReader * self) {
	self->ref_count = 1;
}


static void pdfpc_config_file_reader_finalize (pdfpcConfigFileReader* obj) {
	pdfpcConfigFileReader * self;
	self = PDFPC_CONFIG_FILE_READER (obj);
	_g_object_unref0 (self->presentation_controller);
}


GType pdfpc_config_file_reader_get_type (void) {
	static volatile gsize pdfpc_config_file_reader_type_id__volatile = 0;
	if (g_once_init_enter (&pdfpc_config_file_reader_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { pdfpc_value_config_file_reader_init, pdfpc_value_config_file_reader_free_value, pdfpc_value_config_file_reader_copy_value, pdfpc_value_config_file_reader_peek_pointer, "p", pdfpc_value_config_file_reader_collect_value, "p", pdfpc_value_config_file_reader_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (pdfpcConfigFileReaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_config_file_reader_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcConfigFileReader), 0, (GInstanceInitFunc) pdfpc_config_file_reader_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 pdfpc_config_file_reader_type_id;
		pdfpc_config_file_reader_type_id = g_type_register_fundamental (g_type_fundamental_next (), "pdfpcConfigFileReader", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&pdfpc_config_file_reader_type_id__volatile, pdfpc_config_file_reader_type_id);
	}
	return pdfpc_config_file_reader_type_id__volatile;
}


gpointer pdfpc_config_file_reader_ref (gpointer instance) {
	pdfpcConfigFileReader* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void pdfpc_config_file_reader_unref (gpointer instance) {
	pdfpcConfigFileReader* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		PDFPC_CONFIG_FILE_READER_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int 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, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



