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

/*
 * This file is part of LaTeXila.
 *
 * Copyright © 2010-2011 Sébastien Wilmet
 *
 * LaTeXila is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * LaTeXila 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <gtksourceview/gtksource.h>
#include <gee.h>
#include <gtk/gtk.h>


#define TYPE_APP_SETTINGS (app_settings_get_type ())
#define APP_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_APP_SETTINGS, AppSettings))
#define APP_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_APP_SETTINGS, AppSettingsClass))
#define IS_APP_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_APP_SETTINGS))
#define IS_APP_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_APP_SETTINGS))
#define APP_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_APP_SETTINGS, AppSettingsClass))

typedef struct _AppSettings AppSettings;
typedef struct _AppSettingsClass AppSettingsClass;
typedef struct _AppSettingsPrivate AppSettingsPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_DOCUMENT (document_get_type ())
#define DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DOCUMENT, Document))
#define DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DOCUMENT, DocumentClass))
#define IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DOCUMENT))
#define IS_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DOCUMENT))
#define DOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DOCUMENT, DocumentClass))

typedef struct _Document Document;
typedef struct _DocumentClass DocumentClass;

#define TYPE_LATEXILA_APP (latexila_app_get_type ())
#define LATEXILA_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LATEXILA_APP, LatexilaApp))
#define LATEXILA_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LATEXILA_APP, LatexilaAppClass))
#define IS_LATEXILA_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LATEXILA_APP))
#define IS_LATEXILA_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LATEXILA_APP))
#define LATEXILA_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LATEXILA_APP, LatexilaAppClass))

typedef struct _LatexilaApp LatexilaApp;
typedef struct _LatexilaAppClass LatexilaAppClass;

#define TYPE_DOCUMENT_VIEW (document_view_get_type ())
#define DOCUMENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DOCUMENT_VIEW, DocumentView))
#define DOCUMENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DOCUMENT_VIEW, DocumentViewClass))
#define IS_DOCUMENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DOCUMENT_VIEW))
#define IS_DOCUMENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DOCUMENT_VIEW))
#define DOCUMENT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DOCUMENT_VIEW, DocumentViewClass))

typedef struct _DocumentView DocumentView;
typedef struct _DocumentViewClass DocumentViewClass;
typedef struct _DocumentPrivate DocumentPrivate;

#define TYPE_DOCUMENT_TAB (document_tab_get_type ())
#define DOCUMENT_TAB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DOCUMENT_TAB, DocumentTab))
#define DOCUMENT_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DOCUMENT_TAB, DocumentTabClass))
#define IS_DOCUMENT_TAB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DOCUMENT_TAB))
#define IS_DOCUMENT_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DOCUMENT_TAB))
#define DOCUMENT_TAB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DOCUMENT_TAB, DocumentTabClass))

typedef struct _DocumentTab DocumentTab;
typedef struct _DocumentTabClass DocumentTabClass;

struct _AppSettings {
	GSettings parent_instance;
	AppSettingsPrivate * priv;
};

struct _AppSettingsClass {
	GSettingsClass parent_class;
};

struct _AppSettingsPrivate {
	GSettings* editor;
	gchar* _system_font;
};

struct _Document {
	GtkSourceBuffer parent_instance;
	DocumentPrivate * priv;
	DocumentTab* tab;
	guint _unsaved_doc_num;
};

struct _DocumentClass {
	GtkSourceBufferClass parent_class;
};


static gpointer app_settings_parent_class = NULL;
static AppSettings* app_settings_instance;
static AppSettings* app_settings_instance = NULL;

GType app_settings_get_type (void) G_GNUC_CONST;
#define APP_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_APP_SETTINGS, AppSettingsPrivate))
enum  {
	APP_SETTINGS_DUMMY_PROPERTY,
	APP_SETTINGS_SYSTEM_FONT
};
static AppSettings* app_settings_new (void);
static AppSettings* app_settings_construct (GType object_type);
static void app_settings_initialize (AppSettings* self);
AppSettings* app_settings_get_default (void);
static void app_settings_set_system_font (AppSettings* self, const gchar* value);
static void __lambda4_ (AppSettings* self, GSettings* setting, const gchar* key);
static void app_settings_set_font (AppSettings* self, const gchar* font);
const gchar* app_settings_get_system_font (AppSettings* self);
static void ___lambda4__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void __lambda138_ (AppSettings* self, GSettings* setting, const gchar* key);
static void ___lambda138__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void __lambda139_ (AppSettings* self, GSettings* setting, const gchar* key);
static void ___lambda139__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void __lambda140_ (AppSettings* self, GSettings* setting, const gchar* key);
GType document_get_type (void) G_GNUC_CONST;
GType latexila_app_get_type (void) G_GNUC_CONST;
LatexilaApp* latexila_app_get_instance (void);
GeeList* latexila_app_get_documents (LatexilaApp* self);
static void ___lambda140__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void __lambda141_ (AppSettings* self, GSettings* setting, const gchar* key);
GType document_view_get_type (void) G_GNUC_CONST;
GeeList* latexila_app_get_views (LatexilaApp* self);
static void ___lambda141__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void __lambda142_ (AppSettings* self, GSettings* setting, const gchar* key);
static void ___lambda142__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void __lambda143_ (AppSettings* self, GSettings* setting, const gchar* key);
static void ___lambda143__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void __lambda144_ (AppSettings* self, GSettings* setting, const gchar* key);
static void ___lambda144__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void __lambda145_ (AppSettings* self, GSettings* setting, const gchar* key);
static void ___lambda145__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void __lambda146_ (AppSettings* self, GSettings* setting, const gchar* key);
GType document_tab_get_type (void) G_GNUC_CONST;
void document_tab_set_auto_save (DocumentTab* self, gboolean value);
static void ___lambda146__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void __lambda147_ (AppSettings* self, GSettings* setting, const gchar* key);
void document_tab_set_auto_save_interval (DocumentTab* self, guint value);
static void ___lambda147__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
void document_view_set_font_from_string (DocumentView* self, const gchar* font);
static void app_settings_finalize (GObject* obj);
static void _vala_app_settings_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_app_settings_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static AppSettings* app_settings_construct (GType object_type) {
	AppSettings * self = NULL;
	self = (AppSettings*) g_object_new (object_type, "schema-id", "org.gnome.latexila", NULL);
	app_settings_initialize (self);
	return self;
}


static AppSettings* app_settings_new (void) {
	return app_settings_construct (TYPE_APP_SETTINGS);
}


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


AppSettings* app_settings_get_default (void) {
	AppSettings* result = NULL;
	AppSettings* _tmp0_ = NULL;
	AppSettings* _tmp2_ = NULL;
	AppSettings* _tmp3_ = NULL;
	_tmp0_ = app_settings_instance;
	if (_tmp0_ == NULL) {
		AppSettings* _tmp1_ = NULL;
		_tmp1_ = app_settings_new ();
		_g_object_unref0 (app_settings_instance);
		app_settings_instance = _tmp1_;
	}
	_tmp2_ = app_settings_instance;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}


static void __lambda4_ (AppSettings* self, GSettings* setting, const gchar* key) {
	GSettings* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	GSettings* _tmp4_ = NULL;
	gboolean _tmp5_ = FALSE;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = setting;
	_tmp1_ = key;
	_tmp2_ = g_settings_get_string (_tmp0_, _tmp1_);
	_tmp3_ = _tmp2_;
	app_settings_set_system_font (self, _tmp3_);
	_g_free0 (_tmp3_);
	_tmp4_ = self->priv->editor;
	_tmp5_ = g_settings_get_boolean (_tmp4_, "use-default-font");
	if (_tmp5_) {
		const gchar* _tmp6_ = NULL;
		_tmp6_ = self->priv->_system_font;
		app_settings_set_font (self, _tmp6_);
	}
}


static void ___lambda4__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda4_ ((AppSettings*) self, _sender, key);
}


static void __lambda138_ (AppSettings* self, GSettings* setting, const gchar* key) {
	gboolean val = FALSE;
	GSettings* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gchar* _tmp3_ = NULL;
	gboolean _tmp4_ = FALSE;
	gchar* font = NULL;
	gchar* _tmp9_ = NULL;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = setting;
	_tmp1_ = key;
	_tmp2_ = g_settings_get_boolean (_tmp0_, _tmp1_);
	val = _tmp2_;
	_tmp4_ = val;
	if (_tmp4_) {
		const gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		_tmp5_ = self->priv->_system_font;
		_tmp6_ = g_strdup (_tmp5_);
		_g_free0 (_tmp3_);
		_tmp3_ = _tmp6_;
	} else {
		GSettings* _tmp7_ = NULL;
		gchar* _tmp8_ = NULL;
		_tmp7_ = self->priv->editor;
		_tmp8_ = g_settings_get_string (_tmp7_, "editor-font");
		_g_free0 (_tmp3_);
		_tmp3_ = _tmp8_;
	}
	_tmp9_ = g_strdup (_tmp3_);
	font = _tmp9_;
	app_settings_set_font (self, font);
	_g_free0 (font);
	_g_free0 (_tmp3_);
}


static void ___lambda138__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda138_ ((AppSettings*) self, _sender, key);
}


static void __lambda139_ (AppSettings* self, GSettings* setting, const gchar* key) {
	GSettings* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	GSettings* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = self->priv->editor;
	_tmp1_ = g_settings_get_boolean (_tmp0_, "use-default-font");
	if (_tmp1_) {
		return;
	}
	_tmp2_ = setting;
	_tmp3_ = key;
	_tmp4_ = g_settings_get_string (_tmp2_, _tmp3_);
	_tmp5_ = _tmp4_;
	app_settings_set_font (self, _tmp5_);
	_g_free0 (_tmp5_);
}


static void ___lambda139__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda139_ ((AppSettings*) self, _sender, key);
}


static void __lambda140_ (AppSettings* self, GSettings* setting, const gchar* key) {
	gchar* scheme_id = NULL;
	GSettings* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	GtkSourceStyleSchemeManager* manager = NULL;
	GtkSourceStyleSchemeManager* _tmp3_ = NULL;
	GtkSourceStyleSchemeManager* _tmp4_ = NULL;
	GtkSourceStyleScheme* scheme = NULL;
	GtkSourceStyleSchemeManager* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	GtkSourceStyleScheme* _tmp7_ = NULL;
	GtkSourceStyleScheme* _tmp8_ = NULL;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = setting;
	_tmp1_ = key;
	_tmp2_ = g_settings_get_string (_tmp0_, _tmp1_);
	scheme_id = _tmp2_;
	_tmp3_ = gtk_source_style_scheme_manager_get_default ();
	_tmp4_ = _g_object_ref0 (_tmp3_);
	manager = _tmp4_;
	_tmp5_ = manager;
	_tmp6_ = scheme_id;
	_tmp7_ = gtk_source_style_scheme_manager_get_scheme (_tmp5_, _tmp6_);
	_tmp8_ = _g_object_ref0 (_tmp7_);
	scheme = _tmp8_;
	{
		GeeList* _doc_list = NULL;
		LatexilaApp* _tmp9_ = NULL;
		LatexilaApp* _tmp10_ = NULL;
		GeeList* _tmp11_ = NULL;
		GeeList* _tmp12_ = NULL;
		gint _doc_size = 0;
		GeeList* _tmp13_ = NULL;
		gint _tmp14_ = 0;
		gint _tmp15_ = 0;
		gint _doc_index = 0;
		_tmp9_ = latexila_app_get_instance ();
		_tmp10_ = _tmp9_;
		_tmp11_ = latexila_app_get_documents (_tmp10_);
		_tmp12_ = _tmp11_;
		_g_object_unref0 (_tmp10_);
		_doc_list = _tmp12_;
		_tmp13_ = _doc_list;
		_tmp14_ = gee_collection_get_size ((GeeCollection*) _tmp13_);
		_tmp15_ = _tmp14_;
		_doc_size = _tmp15_;
		_doc_index = -1;
		while (TRUE) {
			gint _tmp16_ = 0;
			gint _tmp17_ = 0;
			gint _tmp18_ = 0;
			Document* doc = NULL;
			GeeList* _tmp19_ = NULL;
			gint _tmp20_ = 0;
			gpointer _tmp21_ = NULL;
			Document* _tmp22_ = NULL;
			GtkSourceStyleScheme* _tmp23_ = NULL;
			_tmp16_ = _doc_index;
			_doc_index = _tmp16_ + 1;
			_tmp17_ = _doc_index;
			_tmp18_ = _doc_size;
			if (!(_tmp17_ < _tmp18_)) {
				break;
			}
			_tmp19_ = _doc_list;
			_tmp20_ = _doc_index;
			_tmp21_ = gee_list_get (_tmp19_, _tmp20_);
			doc = (Document*) _tmp21_;
			_tmp22_ = doc;
			_tmp23_ = scheme;
			gtk_source_buffer_set_style_scheme ((GtkSourceBuffer*) _tmp22_, _tmp23_);
			_g_object_unref0 (doc);
		}
		_g_object_unref0 (_doc_list);
	}
	_g_object_unref0 (scheme);
	_g_object_unref0 (manager);
	_g_free0 (scheme_id);
}


static void ___lambda140__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda140_ ((AppSettings*) self, _sender, key);
}


static void __lambda141_ (AppSettings* self, GSettings* setting, const gchar* key) {
	guint val = 0U;
	GSettings* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = setting;
	_tmp1_ = key;
	g_settings_get (_tmp0_, _tmp1_, "u", &val);
	{
		GeeList* _view_list = NULL;
		LatexilaApp* _tmp2_ = NULL;
		LatexilaApp* _tmp3_ = NULL;
		GeeList* _tmp4_ = NULL;
		GeeList* _tmp5_ = NULL;
		gint _view_size = 0;
		GeeList* _tmp6_ = NULL;
		gint _tmp7_ = 0;
		gint _tmp8_ = 0;
		gint _view_index = 0;
		_tmp2_ = latexila_app_get_instance ();
		_tmp3_ = _tmp2_;
		_tmp4_ = latexila_app_get_views (_tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_view_list = _tmp5_;
		_tmp6_ = _view_list;
		_tmp7_ = gee_collection_get_size ((GeeCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_view_size = _tmp8_;
		_view_index = -1;
		while (TRUE) {
			gint _tmp9_ = 0;
			gint _tmp10_ = 0;
			gint _tmp11_ = 0;
			DocumentView* view = NULL;
			GeeList* _tmp12_ = NULL;
			gint _tmp13_ = 0;
			gpointer _tmp14_ = NULL;
			DocumentView* _tmp15_ = NULL;
			guint _tmp16_ = 0U;
			_tmp9_ = _view_index;
			_view_index = _tmp9_ + 1;
			_tmp10_ = _view_index;
			_tmp11_ = _view_size;
			if (!(_tmp10_ < _tmp11_)) {
				break;
			}
			_tmp12_ = _view_list;
			_tmp13_ = _view_index;
			_tmp14_ = gee_list_get (_tmp12_, _tmp13_);
			view = (DocumentView*) _tmp14_;
			_tmp15_ = view;
			_tmp16_ = val;
			gtk_source_view_set_tab_width ((GtkSourceView*) _tmp15_, _tmp16_);
			_g_object_unref0 (view);
		}
		_g_object_unref0 (_view_list);
	}
}


static void ___lambda141__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda141_ ((AppSettings*) self, _sender, key);
}


static void __lambda142_ (AppSettings* self, GSettings* setting, const gchar* key) {
	gboolean val = FALSE;
	GSettings* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = setting;
	_tmp1_ = key;
	_tmp2_ = g_settings_get_boolean (_tmp0_, _tmp1_);
	val = _tmp2_;
	{
		GeeList* _view_list = NULL;
		LatexilaApp* _tmp3_ = NULL;
		LatexilaApp* _tmp4_ = NULL;
		GeeList* _tmp5_ = NULL;
		GeeList* _tmp6_ = NULL;
		gint _view_size = 0;
		GeeList* _tmp7_ = NULL;
		gint _tmp8_ = 0;
		gint _tmp9_ = 0;
		gint _view_index = 0;
		_tmp3_ = latexila_app_get_instance ();
		_tmp4_ = _tmp3_;
		_tmp5_ = latexila_app_get_views (_tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_view_list = _tmp6_;
		_tmp7_ = _view_list;
		_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
		_tmp9_ = _tmp8_;
		_view_size = _tmp9_;
		_view_index = -1;
		while (TRUE) {
			gint _tmp10_ = 0;
			gint _tmp11_ = 0;
			gint _tmp12_ = 0;
			DocumentView* view = NULL;
			GeeList* _tmp13_ = NULL;
			gint _tmp14_ = 0;
			gpointer _tmp15_ = NULL;
			DocumentView* _tmp16_ = NULL;
			gboolean _tmp17_ = FALSE;
			_tmp10_ = _view_index;
			_view_index = _tmp10_ + 1;
			_tmp11_ = _view_index;
			_tmp12_ = _view_size;
			if (!(_tmp11_ < _tmp12_)) {
				break;
			}
			_tmp13_ = _view_list;
			_tmp14_ = _view_index;
			_tmp15_ = gee_list_get (_tmp13_, _tmp14_);
			view = (DocumentView*) _tmp15_;
			_tmp16_ = view;
			_tmp17_ = val;
			gtk_source_view_set_insert_spaces_instead_of_tabs ((GtkSourceView*) _tmp16_, _tmp17_);
			_g_object_unref0 (view);
		}
		_g_object_unref0 (_view_list);
	}
}


static void ___lambda142__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda142_ ((AppSettings*) self, _sender, key);
}


static void __lambda143_ (AppSettings* self, GSettings* setting, const gchar* key) {
	gboolean val = FALSE;
	GSettings* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = setting;
	_tmp1_ = key;
	_tmp2_ = g_settings_get_boolean (_tmp0_, _tmp1_);
	val = _tmp2_;
	{
		GeeList* _view_list = NULL;
		LatexilaApp* _tmp3_ = NULL;
		LatexilaApp* _tmp4_ = NULL;
		GeeList* _tmp5_ = NULL;
		GeeList* _tmp6_ = NULL;
		gint _view_size = 0;
		GeeList* _tmp7_ = NULL;
		gint _tmp8_ = 0;
		gint _tmp9_ = 0;
		gint _view_index = 0;
		_tmp3_ = latexila_app_get_instance ();
		_tmp4_ = _tmp3_;
		_tmp5_ = latexila_app_get_views (_tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_view_list = _tmp6_;
		_tmp7_ = _view_list;
		_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
		_tmp9_ = _tmp8_;
		_view_size = _tmp9_;
		_view_index = -1;
		while (TRUE) {
			gint _tmp10_ = 0;
			gint _tmp11_ = 0;
			gint _tmp12_ = 0;
			DocumentView* view = NULL;
			GeeList* _tmp13_ = NULL;
			gint _tmp14_ = 0;
			gpointer _tmp15_ = NULL;
			DocumentView* _tmp16_ = NULL;
			gboolean _tmp17_ = FALSE;
			_tmp10_ = _view_index;
			_view_index = _tmp10_ + 1;
			_tmp11_ = _view_index;
			_tmp12_ = _view_size;
			if (!(_tmp11_ < _tmp12_)) {
				break;
			}
			_tmp13_ = _view_list;
			_tmp14_ = _view_index;
			_tmp15_ = gee_list_get (_tmp13_, _tmp14_);
			view = (DocumentView*) _tmp15_;
			_tmp16_ = view;
			_tmp17_ = val;
			gtk_source_view_set_show_line_numbers ((GtkSourceView*) _tmp16_, _tmp17_);
			_g_object_unref0 (view);
		}
		_g_object_unref0 (_view_list);
	}
}


static void ___lambda143__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda143_ ((AppSettings*) self, _sender, key);
}


static void __lambda144_ (AppSettings* self, GSettings* setting, const gchar* key) {
	gboolean val = FALSE;
	GSettings* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = setting;
	_tmp1_ = key;
	_tmp2_ = g_settings_get_boolean (_tmp0_, _tmp1_);
	val = _tmp2_;
	{
		GeeList* _view_list = NULL;
		LatexilaApp* _tmp3_ = NULL;
		LatexilaApp* _tmp4_ = NULL;
		GeeList* _tmp5_ = NULL;
		GeeList* _tmp6_ = NULL;
		gint _view_size = 0;
		GeeList* _tmp7_ = NULL;
		gint _tmp8_ = 0;
		gint _tmp9_ = 0;
		gint _view_index = 0;
		_tmp3_ = latexila_app_get_instance ();
		_tmp4_ = _tmp3_;
		_tmp5_ = latexila_app_get_views (_tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_view_list = _tmp6_;
		_tmp7_ = _view_list;
		_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
		_tmp9_ = _tmp8_;
		_view_size = _tmp9_;
		_view_index = -1;
		while (TRUE) {
			gint _tmp10_ = 0;
			gint _tmp11_ = 0;
			gint _tmp12_ = 0;
			DocumentView* view = NULL;
			GeeList* _tmp13_ = NULL;
			gint _tmp14_ = 0;
			gpointer _tmp15_ = NULL;
			DocumentView* _tmp16_ = NULL;
			gboolean _tmp17_ = FALSE;
			_tmp10_ = _view_index;
			_view_index = _tmp10_ + 1;
			_tmp11_ = _view_index;
			_tmp12_ = _view_size;
			if (!(_tmp11_ < _tmp12_)) {
				break;
			}
			_tmp13_ = _view_list;
			_tmp14_ = _view_index;
			_tmp15_ = gee_list_get (_tmp13_, _tmp14_);
			view = (DocumentView*) _tmp15_;
			_tmp16_ = view;
			_tmp17_ = val;
			gtk_source_view_set_highlight_current_line ((GtkSourceView*) _tmp16_, _tmp17_);
			_g_object_unref0 (view);
		}
		_g_object_unref0 (_view_list);
	}
}


static void ___lambda144__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda144_ ((AppSettings*) self, _sender, key);
}


static void __lambda145_ (AppSettings* self, GSettings* setting, const gchar* key) {
	gboolean val = FALSE;
	GSettings* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = setting;
	_tmp1_ = key;
	_tmp2_ = g_settings_get_boolean (_tmp0_, _tmp1_);
	val = _tmp2_;
	{
		GeeList* _doc_list = NULL;
		LatexilaApp* _tmp3_ = NULL;
		LatexilaApp* _tmp4_ = NULL;
		GeeList* _tmp5_ = NULL;
		GeeList* _tmp6_ = NULL;
		gint _doc_size = 0;
		GeeList* _tmp7_ = NULL;
		gint _tmp8_ = 0;
		gint _tmp9_ = 0;
		gint _doc_index = 0;
		_tmp3_ = latexila_app_get_instance ();
		_tmp4_ = _tmp3_;
		_tmp5_ = latexila_app_get_documents (_tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_doc_list = _tmp6_;
		_tmp7_ = _doc_list;
		_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
		_tmp9_ = _tmp8_;
		_doc_size = _tmp9_;
		_doc_index = -1;
		while (TRUE) {
			gint _tmp10_ = 0;
			gint _tmp11_ = 0;
			gint _tmp12_ = 0;
			Document* doc = NULL;
			GeeList* _tmp13_ = NULL;
			gint _tmp14_ = 0;
			gpointer _tmp15_ = NULL;
			Document* _tmp16_ = NULL;
			gboolean _tmp17_ = FALSE;
			_tmp10_ = _doc_index;
			_doc_index = _tmp10_ + 1;
			_tmp11_ = _doc_index;
			_tmp12_ = _doc_size;
			if (!(_tmp11_ < _tmp12_)) {
				break;
			}
			_tmp13_ = _doc_list;
			_tmp14_ = _doc_index;
			_tmp15_ = gee_list_get (_tmp13_, _tmp14_);
			doc = (Document*) _tmp15_;
			_tmp16_ = doc;
			_tmp17_ = val;
			gtk_source_buffer_set_highlight_matching_brackets ((GtkSourceBuffer*) _tmp16_, _tmp17_);
			_g_object_unref0 (doc);
		}
		_g_object_unref0 (_doc_list);
	}
}


static void ___lambda145__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda145_ ((AppSettings*) self, _sender, key);
}


static void __lambda146_ (AppSettings* self, GSettings* setting, const gchar* key) {
	gboolean val = FALSE;
	GSettings* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = setting;
	_tmp1_ = key;
	_tmp2_ = g_settings_get_boolean (_tmp0_, _tmp1_);
	val = _tmp2_;
	{
		GeeList* _doc_list = NULL;
		LatexilaApp* _tmp3_ = NULL;
		LatexilaApp* _tmp4_ = NULL;
		GeeList* _tmp5_ = NULL;
		GeeList* _tmp6_ = NULL;
		gint _doc_size = 0;
		GeeList* _tmp7_ = NULL;
		gint _tmp8_ = 0;
		gint _tmp9_ = 0;
		gint _doc_index = 0;
		_tmp3_ = latexila_app_get_instance ();
		_tmp4_ = _tmp3_;
		_tmp5_ = latexila_app_get_documents (_tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_doc_list = _tmp6_;
		_tmp7_ = _doc_list;
		_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
		_tmp9_ = _tmp8_;
		_doc_size = _tmp9_;
		_doc_index = -1;
		while (TRUE) {
			gint _tmp10_ = 0;
			gint _tmp11_ = 0;
			gint _tmp12_ = 0;
			Document* doc = NULL;
			GeeList* _tmp13_ = NULL;
			gint _tmp14_ = 0;
			gpointer _tmp15_ = NULL;
			Document* _tmp16_ = NULL;
			DocumentTab* _tmp17_ = NULL;
			gboolean _tmp18_ = FALSE;
			_tmp10_ = _doc_index;
			_doc_index = _tmp10_ + 1;
			_tmp11_ = _doc_index;
			_tmp12_ = _doc_size;
			if (!(_tmp11_ < _tmp12_)) {
				break;
			}
			_tmp13_ = _doc_list;
			_tmp14_ = _doc_index;
			_tmp15_ = gee_list_get (_tmp13_, _tmp14_);
			doc = (Document*) _tmp15_;
			_tmp16_ = doc;
			_tmp17_ = _tmp16_->tab;
			_tmp18_ = val;
			document_tab_set_auto_save (_tmp17_, _tmp18_);
			_g_object_unref0 (doc);
		}
		_g_object_unref0 (_doc_list);
	}
}


static void ___lambda146__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda146_ ((AppSettings*) self, _sender, key);
}


static void __lambda147_ (AppSettings* self, GSettings* setting, const gchar* key) {
	guint val = 0U;
	GSettings* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = setting;
	_tmp1_ = key;
	g_settings_get (_tmp0_, _tmp1_, "u", &val);
	{
		GeeList* _doc_list = NULL;
		LatexilaApp* _tmp2_ = NULL;
		LatexilaApp* _tmp3_ = NULL;
		GeeList* _tmp4_ = NULL;
		GeeList* _tmp5_ = NULL;
		gint _doc_size = 0;
		GeeList* _tmp6_ = NULL;
		gint _tmp7_ = 0;
		gint _tmp8_ = 0;
		gint _doc_index = 0;
		_tmp2_ = latexila_app_get_instance ();
		_tmp3_ = _tmp2_;
		_tmp4_ = latexila_app_get_documents (_tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_doc_list = _tmp5_;
		_tmp6_ = _doc_list;
		_tmp7_ = gee_collection_get_size ((GeeCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_doc_size = _tmp8_;
		_doc_index = -1;
		while (TRUE) {
			gint _tmp9_ = 0;
			gint _tmp10_ = 0;
			gint _tmp11_ = 0;
			Document* doc = NULL;
			GeeList* _tmp12_ = NULL;
			gint _tmp13_ = 0;
			gpointer _tmp14_ = NULL;
			Document* _tmp15_ = NULL;
			DocumentTab* _tmp16_ = NULL;
			guint _tmp17_ = 0U;
			_tmp9_ = _doc_index;
			_doc_index = _tmp9_ + 1;
			_tmp10_ = _doc_index;
			_tmp11_ = _doc_size;
			if (!(_tmp10_ < _tmp11_)) {
				break;
			}
			_tmp12_ = _doc_list;
			_tmp13_ = _doc_index;
			_tmp14_ = gee_list_get (_tmp12_, _tmp13_);
			doc = (Document*) _tmp14_;
			_tmp15_ = doc;
			_tmp16_ = _tmp15_->tab;
			_tmp17_ = val;
			document_tab_set_auto_save_interval (_tmp16_, _tmp17_);
			_g_object_unref0 (doc);
		}
		_g_object_unref0 (_doc_list);
	}
}


static void ___lambda147__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda147_ ((AppSettings*) self, _sender, key);
}


static void app_settings_initialize (AppSettings* self) {
	GSettings* prefs = NULL;
	GSettings* _tmp0_ = NULL;
	GSettings* _tmp1_ = NULL;
	GSettings* desktop_interface = NULL;
	GSettings* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	GSettings* _tmp5_ = NULL;
	GSettings* _tmp6_ = NULL;
	GSettings* _tmp7_ = NULL;
	GSettings* _tmp8_ = NULL;
	GSettings* _tmp9_ = NULL;
	GSettings* _tmp10_ = NULL;
	GSettings* _tmp11_ = NULL;
	GSettings* _tmp12_ = NULL;
	GSettings* _tmp13_ = NULL;
	GSettings* _tmp14_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_settings_get_child ((GSettings*) self, "preferences");
	prefs = _tmp0_;
	_tmp1_ = g_settings_get_child (prefs, "editor");
	_g_object_unref0 (self->priv->editor);
	self->priv->editor = _tmp1_;
	_tmp2_ = g_settings_new ("org.gnome.desktop.interface");
	desktop_interface = _tmp2_;
	_tmp3_ = g_settings_get_string (desktop_interface, "monospace-font-name");
	_tmp4_ = _tmp3_;
	app_settings_set_system_font (self, _tmp4_);
	_g_free0 (_tmp4_);
	g_signal_connect_object (desktop_interface, "changed::monospace-font-name", (GCallback) ___lambda4__g_settings_changed, self, 0);
	_tmp5_ = self->priv->editor;
	g_signal_connect_object (_tmp5_, "changed::use-default-font", (GCallback) ___lambda138__g_settings_changed, self, 0);
	_tmp6_ = self->priv->editor;
	g_signal_connect_object (_tmp6_, "changed::editor-font", (GCallback) ___lambda139__g_settings_changed, self, 0);
	_tmp7_ = self->priv->editor;
	g_signal_connect_object (_tmp7_, "changed::scheme", (GCallback) ___lambda140__g_settings_changed, self, 0);
	_tmp8_ = self->priv->editor;
	g_signal_connect_object (_tmp8_, "changed::tabs-size", (GCallback) ___lambda141__g_settings_changed, self, 0);
	_tmp9_ = self->priv->editor;
	g_signal_connect_object (_tmp9_, "changed::insert-spaces", (GCallback) ___lambda142__g_settings_changed, self, 0);
	_tmp10_ = self->priv->editor;
	g_signal_connect_object (_tmp10_, "changed::display-line-numbers", (GCallback) ___lambda143__g_settings_changed, self, 0);
	_tmp11_ = self->priv->editor;
	g_signal_connect_object (_tmp11_, "changed::highlight-current-line", (GCallback) ___lambda144__g_settings_changed, self, 0);
	_tmp12_ = self->priv->editor;
	g_signal_connect_object (_tmp12_, "changed::bracket-matching", (GCallback) ___lambda145__g_settings_changed, self, 0);
	_tmp13_ = self->priv->editor;
	g_signal_connect_object (_tmp13_, "changed::auto-save", (GCallback) ___lambda146__g_settings_changed, self, 0);
	_tmp14_ = self->priv->editor;
	g_signal_connect_object (_tmp14_, "changed::auto-save-interval", (GCallback) ___lambda147__g_settings_changed, self, 0);
	_g_object_unref0 (desktop_interface);
	_g_object_unref0 (prefs);
}


static void app_settings_set_font (AppSettings* self, const gchar* font) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (font != NULL);
	{
		GeeList* _view_list = NULL;
		LatexilaApp* _tmp0_ = NULL;
		LatexilaApp* _tmp1_ = NULL;
		GeeList* _tmp2_ = NULL;
		GeeList* _tmp3_ = NULL;
		gint _view_size = 0;
		GeeList* _tmp4_ = NULL;
		gint _tmp5_ = 0;
		gint _tmp6_ = 0;
		gint _view_index = 0;
		_tmp0_ = latexila_app_get_instance ();
		_tmp1_ = _tmp0_;
		_tmp2_ = latexila_app_get_views (_tmp1_);
		_tmp3_ = _tmp2_;
		_g_object_unref0 (_tmp1_);
		_view_list = _tmp3_;
		_tmp4_ = _view_list;
		_tmp5_ = gee_collection_get_size ((GeeCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_view_size = _tmp6_;
		_view_index = -1;
		while (TRUE) {
			gint _tmp7_ = 0;
			gint _tmp8_ = 0;
			gint _tmp9_ = 0;
			DocumentView* view = NULL;
			GeeList* _tmp10_ = NULL;
			gint _tmp11_ = 0;
			gpointer _tmp12_ = NULL;
			DocumentView* _tmp13_ = NULL;
			const gchar* _tmp14_ = NULL;
			_tmp7_ = _view_index;
			_view_index = _tmp7_ + 1;
			_tmp8_ = _view_index;
			_tmp9_ = _view_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _view_list;
			_tmp11_ = _view_index;
			_tmp12_ = gee_list_get (_tmp10_, _tmp11_);
			view = (DocumentView*) _tmp12_;
			_tmp13_ = view;
			_tmp14_ = font;
			document_view_set_font_from_string (_tmp13_, _tmp14_);
			_g_object_unref0 (view);
		}
		_g_object_unref0 (_view_list);
	}
}


const gchar* app_settings_get_system_font (AppSettings* self) {
	const gchar* result;
	const gchar* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_system_font;
	result = _tmp0_;
	return result;
}


static void app_settings_set_system_font (AppSettings* self, const gchar* value) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_system_font);
	self->priv->_system_font = _tmp1_;
	g_object_notify ((GObject *) self, "system-font");
}


static void app_settings_class_init (AppSettingsClass * klass) {
	app_settings_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (AppSettingsPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_app_settings_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_app_settings_set_property;
	G_OBJECT_CLASS (klass)->finalize = app_settings_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), APP_SETTINGS_SYSTEM_FONT, g_param_spec_string ("system-font", "system-font", "system-font", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void app_settings_instance_init (AppSettings * self) {
	self->priv = APP_SETTINGS_GET_PRIVATE (self);
}


static void app_settings_finalize (GObject* obj) {
	AppSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_APP_SETTINGS, AppSettings);
	_g_object_unref0 (self->priv->editor);
	_g_free0 (self->priv->_system_font);
	G_OBJECT_CLASS (app_settings_parent_class)->finalize (obj);
}


GType app_settings_get_type (void) {
	static volatile gsize app_settings_type_id__volatile = 0;
	if (g_once_init_enter (&app_settings_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (AppSettingsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) app_settings_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AppSettings), 0, (GInstanceInitFunc) app_settings_instance_init, NULL };
		GType app_settings_type_id;
		app_settings_type_id = g_type_register_static (G_TYPE_SETTINGS, "AppSettings", &g_define_type_info, 0);
		g_once_init_leave (&app_settings_type_id__volatile, app_settings_type_id);
	}
	return app_settings_type_id__volatile;
}


static void _vala_app_settings_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	AppSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_APP_SETTINGS, AppSettings);
	switch (property_id) {
		case APP_SETTINGS_SYSTEM_FONT:
		g_value_set_string (value, app_settings_get_system_font (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_app_settings_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	AppSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_APP_SETTINGS, AppSettings);
	switch (property_id) {
		case APP_SETTINGS_SYSTEM_FONT:
		app_settings_set_system_font (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



