/* preferences_dialog.c generated by valac 0.18.0.1-c1117, the Vala compiler
 * generated from preferences_dialog.vala, do not modify */

/*
 * This file is part of LaTeXila.
 *
 * Copyright © 2010-2012 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 <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <float.h>
#include <math.h>
#include <gtksourceview/gtksource.h>


#define TYPE_PREFERENCES_DIALOG (preferences_dialog_get_type ())
#define PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PREFERENCES_DIALOG, PreferencesDialog))
#define PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PREFERENCES_DIALOG, PreferencesDialogClass))
#define IS_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PREFERENCES_DIALOG))
#define IS_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PREFERENCES_DIALOG))
#define PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PREFERENCES_DIALOG, PreferencesDialogClass))

typedef struct _PreferencesDialog PreferencesDialog;
typedef struct _PreferencesDialogClass PreferencesDialogClass;
typedef struct _PreferencesDialogPrivate PreferencesDialogPrivate;

#define PREFERENCES_DIALOG_TYPE_STYLE_SCHEMES (preferences_dialog_style_schemes_get_type ())
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define TYPE_MAIN_WINDOW (main_window_get_type ())
#define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
#define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
#define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
#define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
#define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;
typedef struct _Block26Data Block26Data;

#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;
#define __g_list_free__gtk_tree_path_free0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__gtk_tree_path_free0_ (var), NULL)))
#define _gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL)))
typedef struct _Block27Data Block27Data;
typedef struct _Block28Data Block28Data;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

struct _PreferencesDialog {
	GtkDialog parent_instance;
	PreferencesDialogPrivate * priv;
};

struct _PreferencesDialogClass {
	GtkDialogClass parent_class;
};

typedef enum  {
	PREFERENCES_DIALOG_STYLE_SCHEMES_ID,
	PREFERENCES_DIALOG_STYLE_SCHEMES_DESC,
	PREFERENCES_DIALOG_STYLE_SCHEMES_N_COLUMNS
} PreferencesDialogStyleSchemes;

typedef const gchar* (*PreferencesDialogPlural) (gulong n, void* user_data);
struct _Block26Data {
	int _ref_count_;
	PreferencesDialog * self;
	GSettings* settings;
	GtkButton* default_font_checkbutton;
	GtkTreeView* schemes_treeview;
	GtkTreeSelection* schemes_select;
};

struct _Block27Data {
	int _ref_count_;
	PreferencesDialog * self;
	GtkWidget* widget;
	gboolean must_be_enabled;
};

struct _Block28Data {
	int _ref_count_;
	PreferencesDialog * self;
	GtkLabel* label;
	PreferencesDialogPlural plural;
	gpointer plural_target;
};


static gpointer preferences_dialog_parent_class = NULL;
static PreferencesDialog* preferences_dialog__instance;
static PreferencesDialog* preferences_dialog__instance = NULL;

GType preferences_dialog_get_type (void) G_GNUC_CONST;
enum  {
	PREFERENCES_DIALOG_DUMMY_PROPERTY
};
static GType preferences_dialog_style_schemes_get_type (void) G_GNUC_UNUSED;
static PreferencesDialog* preferences_dialog_new (void);
static PreferencesDialog* preferences_dialog_construct (GType object_type);
static void __lambda19_ (PreferencesDialog* self, gint response_id);
static void preferences_dialog_reset_all (PreferencesDialog* self);
static void ___lambda19__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
static void preferences_dialog_init_editor_tab (PreferencesDialog* self, GtkBuilder* builder);
static void preferences_dialog_init_font_and_colors_tab (PreferencesDialog* self, GtkBuilder* builder);
static void preferences_dialog_init_interactive_completion_setting (PreferencesDialog* self, GtkBuilder* builder);
static void preferences_dialog_init_other_tab (PreferencesDialog* self, GtkBuilder* builder);
GType main_window_get_type (void) G_GNUC_CONST;
void preferences_dialog_show_me (MainWindow* parent);
static void ___lambda27_ (void);
static void ____lambda27__gtk_widget_destroy (GtkWidget* _sender, gpointer self);
GtkDialog* utils_get_reset_all_confirm_dialog (GtkWindow* window, const gchar* msg);
static void preferences_dialog_set_spin_button_range (PreferencesDialog* self, GtkSpinButton* spin_button, GSettings* settings, const gchar* key);
static void preferences_dialog_set_sensitivity (PreferencesDialog* self, GSettings* settings, const gchar* key, GtkWidget* widget, gboolean must_be_enabled);
static void preferences_dialog_set_plural (PreferencesDialog* self, GtkLabel* label, GSettings* settings, const gchar* key, PreferencesDialogPlural plural, void* plural_target);
static const gchar* __lambda22_ (PreferencesDialog* self, gulong n);
static const gchar* ___lambda22__preferences_dialog_plural (gulong n, gpointer self);
static Block26Data* block26_data_ref (Block26Data* _data26_);
static void block26_data_unref (void * _userdata_);
static void preferences_dialog_set_system_font_label (PreferencesDialog* self, GtkButton* button);
GType app_settings_get_type (void) G_GNUC_CONST;
AppSettings* app_settings_get_default (void);
static void __lambda23_ (Block26Data* _data26_);
static void ___lambda23__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void preferences_dialog_init_schemes_treeview (PreferencesDialog* self, GtkTreeView* treeview, const gchar* current_id);
static void __lambda24_ (Block26Data* _data26_);
static void _gtk_tree_path_free0_ (gpointer var);
static void _g_list_free__gtk_tree_path_free0_ (GList* self);
static void ___lambda24__gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self);
static void __lambda25_ (Block26Data* _data26_, GSettings* setting, const gchar* key);
static void ___lambda25__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static const gchar* __lambda26_ (PreferencesDialog* self, gulong n);
static const gchar* ___lambda26__preferences_dialog_plural (gulong n, gpointer self);
static Block27Data* block27_data_ref (Block27Data* _data27_);
static void block27_data_unref (void * _userdata_);
static void __lambda20_ (Block27Data* _data27_, GSettings* setting, const gchar* k);
static void ___lambda20__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
const gchar* app_settings_get_system_font (AppSettings* self);
static Block28Data* block28_data_ref (Block28Data* _data28_);
static void block28_data_unref (void * _userdata_);
static void __lambda21_ (Block28Data* _data28_, GSettings* setting, const gchar* k);
static void ___lambda21__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void preferences_dialog_finalize (GObject* 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 GType preferences_dialog_style_schemes_get_type (void) {
	static volatile gsize preferences_dialog_style_schemes_type_id__volatile = 0;
	if (g_once_init_enter (&preferences_dialog_style_schemes_type_id__volatile)) {
		static const GEnumValue values[] = {{PREFERENCES_DIALOG_STYLE_SCHEMES_ID, "PREFERENCES_DIALOG_STYLE_SCHEMES_ID", "id"}, {PREFERENCES_DIALOG_STYLE_SCHEMES_DESC, "PREFERENCES_DIALOG_STYLE_SCHEMES_DESC", "desc"}, {PREFERENCES_DIALOG_STYLE_SCHEMES_N_COLUMNS, "PREFERENCES_DIALOG_STYLE_SCHEMES_N_COLUMNS", "n-columns"}, {0, NULL, NULL}};
		GType preferences_dialog_style_schemes_type_id;
		preferences_dialog_style_schemes_type_id = g_enum_register_static ("PreferencesDialogStyleSchemes", values);
		g_once_init_leave (&preferences_dialog_style_schemes_type_id__volatile, preferences_dialog_style_schemes_type_id);
	}
	return preferences_dialog_style_schemes_type_id__volatile;
}


static void __lambda19_ (PreferencesDialog* self, gint response_id) {
	gint _tmp0_;
	_tmp0_ = response_id;
	switch (_tmp0_) {
		case GTK_RESPONSE_CLOSE:
		{
			gtk_widget_hide ((GtkWidget*) self);
			return;
		}
		case GTK_RESPONSE_APPLY:
		{
			preferences_dialog_reset_all (self);
			return;
		}
		default:
		break;
	}
}


static void ___lambda19__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
	__lambda19_ (self, response_id);
}


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


static PreferencesDialog* preferences_dialog_construct (GType object_type) {
	PreferencesDialog * self = NULL;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	GtkButton* _tmp2_;
	GtkButton* reset_button;
	GtkImage* _tmp3_;
	GtkImage* image;
	GtkButton* _tmp4_;
	GtkImage* _tmp5_;
	GtkButton* _tmp6_;
	const gchar* _tmp7_ = NULL;
	GtkButton* _tmp8_;
	GtkButton* _tmp9_;
	GtkBuilder* _tmp10_;
	GtkBuilder* builder;
	GtkBuilder* _tmp26_;
	GtkBuilder* _tmp27_;
	GtkBuilder* _tmp28_;
	GtkBuilder* _tmp29_;
	GtkBuilder* _tmp30_;
	GObject* _tmp31_ = NULL;
	GtkNotebook* _tmp32_;
	GtkNotebook* notebook;
	GtkNotebook* _tmp33_;
	GtkBox* _tmp34_ = NULL;
	GtkBox* _tmp35_;
	GtkBox* content_area;
	GtkBox* _tmp36_;
	GtkNotebook* _tmp37_;
	GError * _inner_error_ = NULL;
	self = (PreferencesDialog*) g_object_new (object_type, NULL);
	_tmp0_ = _ ("Preferences");
	gtk_window_set_title ((GtkWindow*) self, _tmp0_);
	gtk_window_set_destroy_with_parent ((GtkWindow*) self, TRUE);
	gtk_container_set_border_width ((GtkContainer*) self, (guint) 5);
	_tmp1_ = _ ("Reset All");
	_tmp2_ = (GtkButton*) gtk_button_new_with_label (_tmp1_);
	g_object_ref_sink (_tmp2_);
	reset_button = _tmp2_;
	_tmp3_ = (GtkImage*) gtk_image_new_from_stock (GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp3_);
	image = _tmp3_;
	_tmp4_ = reset_button;
	_tmp5_ = image;
	gtk_button_set_image (_tmp4_, (GtkWidget*) _tmp5_);
	_tmp6_ = reset_button;
	_tmp7_ = _ ("Reset all preferences");
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp6_, _tmp7_);
	_tmp8_ = reset_button;
	gtk_widget_show_all ((GtkWidget*) _tmp8_);
	_tmp9_ = reset_button;
	gtk_dialog_add_action_widget ((GtkDialog*) self, (GtkWidget*) _tmp9_, (gint) GTK_RESPONSE_APPLY);
	gtk_dialog_add_button ((GtkDialog*) self, GTK_STOCK_CLOSE, (gint) GTK_RESPONSE_CLOSE);
	g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) ___lambda19__gtk_dialog_response, self, 0);
	_tmp10_ = gtk_builder_new ();
	builder = _tmp10_;
	{
		gchar* _tmp11_ = NULL;
		gchar* ui_path;
		GtkBuilder* _tmp12_;
		const gchar* _tmp13_;
		_tmp11_ = g_build_filename (DATA_DIR, "ui", "preferences_dialog.ui", NULL);
		ui_path = _tmp11_;
		_tmp12_ = builder;
		_tmp13_ = ui_path;
		gtk_builder_add_from_file (_tmp12_, _tmp13_, &_inner_error_);
		if (_inner_error_ != NULL) {
			_g_free0 (ui_path);
			goto __catch49_g_error;
		}
		_g_free0 (ui_path);
	}
	goto __finally49;
	__catch49_g_error:
	{
		GError* e = NULL;
		GError* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_ = NULL;
		gchar* message;
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		GtkLabel* _tmp19_;
		GtkLabel* label_error;
		GtkLabel* _tmp20_;
		GtkBox* _tmp21_ = NULL;
		GtkBox* _tmp22_;
		GtkBox* content_area;
		GtkBox* _tmp23_;
		GtkLabel* _tmp24_;
		GtkBox* _tmp25_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp14_ = e;
		_tmp15_ = _tmp14_->message;
		_tmp16_ = g_strdup_printf ("Error: %s", _tmp15_);
		message = _tmp16_;
		_tmp17_ = message;
		g_warning ("preferences_dialog.vala:72: %s", _tmp17_);
		_tmp18_ = message;
		_tmp19_ = (GtkLabel*) gtk_label_new (_tmp18_);
		g_object_ref_sink (_tmp19_);
		label_error = _tmp19_;
		_tmp20_ = label_error;
		gtk_label_set_line_wrap (_tmp20_, TRUE);
		_tmp21_ = gtk_dialog_get_content_area ((GtkDialog*) self);
		_tmp22_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, GTK_TYPE_BOX, GtkBox));
		content_area = _tmp22_;
		_tmp23_ = content_area;
		_tmp24_ = label_error;
		gtk_box_pack_start (_tmp23_, (GtkWidget*) _tmp24_, TRUE, TRUE, (guint) 0);
		_tmp25_ = content_area;
		gtk_widget_show_all ((GtkWidget*) _tmp25_);
		_g_object_unref0 (content_area);
		_g_object_unref0 (label_error);
		_g_free0 (message);
		_g_error_free0 (e);
		_g_object_unref0 (builder);
		_g_object_unref0 (image);
		_g_object_unref0 (reset_button);
		return self;
	}
	__finally49:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (builder);
		_g_object_unref0 (image);
		_g_object_unref0 (reset_button);
		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 NULL;
	}
	_tmp26_ = builder;
	preferences_dialog_init_editor_tab (self, _tmp26_);
	_tmp27_ = builder;
	preferences_dialog_init_font_and_colors_tab (self, _tmp27_);
	_tmp28_ = builder;
	preferences_dialog_init_interactive_completion_setting (self, _tmp28_);
	_tmp29_ = builder;
	preferences_dialog_init_other_tab (self, _tmp29_);
	_tmp30_ = builder;
	_tmp31_ = gtk_builder_get_object (_tmp30_, "notebook");
	_tmp32_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp31_, GTK_TYPE_NOTEBOOK) ? ((GtkNotebook*) _tmp31_) : NULL);
	notebook = _tmp32_;
	_tmp33_ = notebook;
	gtk_widget_unparent ((GtkWidget*) _tmp33_);
	_tmp34_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	_tmp35_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp34_, GTK_TYPE_BOX, GtkBox));
	content_area = _tmp35_;
	_tmp36_ = content_area;
	_tmp37_ = notebook;
	gtk_box_pack_start (_tmp36_, (GtkWidget*) _tmp37_, TRUE, TRUE, (guint) 0);
	_g_object_unref0 (content_area);
	_g_object_unref0 (notebook);
	_g_object_unref0 (builder);
	_g_object_unref0 (image);
	_g_object_unref0 (reset_button);
	return self;
}


static PreferencesDialog* preferences_dialog_new (void) {
	return preferences_dialog_construct (TYPE_PREFERENCES_DIALOG);
}


static void ___lambda27_ (void) {
	PreferencesDialog* _tmp0_;
	_tmp0_ = preferences_dialog__instance;
	if (_tmp0_ != NULL) {
		_g_object_unref0 (preferences_dialog__instance);
		preferences_dialog__instance = NULL;
	}
}


static void ____lambda27__gtk_widget_destroy (GtkWidget* _sender, gpointer self) {
	___lambda27_ ();
}


void preferences_dialog_show_me (MainWindow* parent) {
	PreferencesDialog* _tmp0_;
	MainWindow* _tmp3_;
	PreferencesDialog* _tmp4_;
	GtkWindow* _tmp5_ = NULL;
	PreferencesDialog* _tmp8_;
	g_return_if_fail (parent != NULL);
	_tmp0_ = preferences_dialog__instance;
	if (_tmp0_ == NULL) {
		PreferencesDialog* _tmp1_;
		PreferencesDialog* _tmp2_;
		_tmp1_ = preferences_dialog_new ();
		g_object_ref_sink (_tmp1_);
		_g_object_unref0 (preferences_dialog__instance);
		preferences_dialog__instance = _tmp1_;
		_tmp2_ = preferences_dialog__instance;
		g_signal_connect ((GtkWidget*) _tmp2_, "destroy", (GCallback) ____lambda27__gtk_widget_destroy, NULL);
	}
	_tmp3_ = parent;
	_tmp4_ = preferences_dialog__instance;
	_tmp5_ = gtk_window_get_transient_for ((GtkWindow*) _tmp4_);
	if (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GTK_TYPE_WINDOW, GtkWindow) != _tmp5_) {
		PreferencesDialog* _tmp6_;
		MainWindow* _tmp7_;
		_tmp6_ = preferences_dialog__instance;
		_tmp7_ = parent;
		gtk_window_set_transient_for ((GtkWindow*) _tmp6_, (GtkWindow*) _tmp7_);
	}
	_tmp8_ = preferences_dialog__instance;
	gtk_window_present ((GtkWindow*) _tmp8_);
}


static void preferences_dialog_reset_all (PreferencesDialog* self) {
	const gchar* _tmp0_ = NULL;
	GtkDialog* _tmp1_ = NULL;
	GtkDialog* dialog;
	GtkDialog* _tmp2_;
	gint _tmp3_ = 0;
	gint resp;
	GtkDialog* _tmp4_;
	gint _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar** _tmp8_ = NULL;
	gchar** settings_str;
	gint settings_str_length1;
	gint _settings_str_size_;
	gchar** _tmp9_;
	gint _tmp9__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = _ ("Do you really want to reset all preferences?");
	_tmp1_ = utils_get_reset_all_confirm_dialog ((GtkWindow*) self, _tmp0_);
	dialog = _tmp1_;
	_tmp2_ = dialog;
	_tmp3_ = gtk_dialog_run (_tmp2_);
	resp = _tmp3_;
	_tmp4_ = dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp4_);
	_tmp5_ = resp;
	if (_tmp5_ != ((gint) GTK_RESPONSE_YES)) {
		_g_object_unref0 (dialog);
		return;
	}
	_tmp6_ = g_strdup ("org.gnome.latexila.preferences.editor");
	_tmp7_ = g_strdup ("org.gnome.latexila.preferences.latex");
	_tmp8_ = g_new0 (gchar*, 2 + 1);
	_tmp8_[0] = _tmp6_;
	_tmp8_[1] = _tmp7_;
	settings_str = _tmp8_;
	settings_str_length1 = 2;
	_settings_str_size_ = settings_str_length1;
	_tmp9_ = settings_str;
	_tmp9__length1 = settings_str_length1;
	{
		gchar** setting_str_collection = NULL;
		gint setting_str_collection_length1 = 0;
		gint _setting_str_collection_size_ = 0;
		gint setting_str_it = 0;
		setting_str_collection = _tmp9_;
		setting_str_collection_length1 = _tmp9__length1;
		for (setting_str_it = 0; setting_str_it < _tmp9__length1; setting_str_it = setting_str_it + 1) {
			gchar* _tmp10_;
			gchar* setting_str = NULL;
			_tmp10_ = g_strdup (setting_str_collection[setting_str_it]);
			setting_str = _tmp10_;
			{
				const gchar* _tmp11_;
				GSettings* _tmp12_;
				GSettings* settings;
				GSettings* _tmp13_;
				gchar** _tmp14_;
				gchar** _tmp15_ = NULL;
				gchar** keys;
				gint keys_length1;
				gint _keys_size_;
				gchar** _tmp16_;
				gint _tmp16__length1;
				_tmp11_ = setting_str;
				_tmp12_ = g_settings_new (_tmp11_);
				settings = _tmp12_;
				_tmp13_ = settings;
				_tmp15_ = _tmp14_ = g_settings_list_keys (_tmp13_);
				keys = _tmp15_;
				keys_length1 = _vala_array_length (_tmp14_);
				_keys_size_ = keys_length1;
				_tmp16_ = keys;
				_tmp16__length1 = keys_length1;
				{
					gchar** key_collection = NULL;
					gint key_collection_length1 = 0;
					gint _key_collection_size_ = 0;
					gint key_it = 0;
					key_collection = _tmp16_;
					key_collection_length1 = _tmp16__length1;
					for (key_it = 0; key_it < _tmp16__length1; key_it = key_it + 1) {
						gchar* _tmp17_;
						gchar* key = NULL;
						_tmp17_ = g_strdup (key_collection[key_it]);
						key = _tmp17_;
						{
							GSettings* _tmp18_;
							const gchar* _tmp19_;
							_tmp18_ = settings;
							_tmp19_ = key;
							g_settings_reset (_tmp18_, _tmp19_);
							_g_free0 (key);
						}
					}
				}
				keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
				_g_object_unref0 (settings);
				_g_free0 (setting_str);
			}
		}
	}
	settings_str = (_vala_array_free (settings_str, settings_str_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (dialog);
}


static const gchar* __lambda22_ (PreferencesDialog* self, gulong n) {
	const gchar* result = NULL;
	gulong _tmp0_;
	const gchar* _tmp1_ = NULL;
	_tmp0_ = n;
	_tmp1_ = ngettext ("minute", "minutes", _tmp0_);
	result = _tmp1_;
	return result;
}


static const gchar* ___lambda22__preferences_dialog_plural (gulong n, gpointer self) {
	const gchar* result;
	result = __lambda22_ (self, n);
	return result;
}


static void preferences_dialog_init_editor_tab (PreferencesDialog* self, GtkBuilder* builder) {
	GSettings* _tmp0_;
	GSettings* settings;
	GtkBuilder* _tmp1_;
	GObject* _tmp2_ = NULL;
	GObject* _tmp3_;
	GObject* display_line_nb_checkbutton;
	GtkBuilder* _tmp4_;
	GObject* _tmp5_ = NULL;
	GtkSpinButton* _tmp6_;
	GtkSpinButton* tab_width_spinbutton;
	GtkBuilder* _tmp7_;
	GObject* _tmp8_ = NULL;
	GObject* _tmp9_;
	GObject* insert_spaces_checkbutton;
	GtkBuilder* _tmp10_;
	GObject* _tmp11_ = NULL;
	GtkWidget* _tmp12_;
	GtkWidget* forget_no_tabs;
	GtkBuilder* _tmp13_;
	GObject* _tmp14_ = NULL;
	GObject* _tmp15_;
	GObject* hl_current_line_checkbutton;
	GtkBuilder* _tmp16_;
	GObject* _tmp17_ = NULL;
	GObject* _tmp18_;
	GObject* bracket_matching_checkbutton;
	GtkBuilder* _tmp19_;
	GObject* _tmp20_ = NULL;
	GObject* _tmp21_;
	GObject* backup_checkbutton;
	GtkBuilder* _tmp22_;
	GObject* _tmp23_ = NULL;
	GObject* _tmp24_;
	GObject* autosave_checkbutton;
	GtkBuilder* _tmp25_;
	GObject* _tmp26_ = NULL;
	GtkSpinButton* _tmp27_;
	GtkSpinButton* autosave_spinbutton;
	GtkBuilder* _tmp28_;
	GObject* _tmp29_ = NULL;
	GtkLabel* _tmp30_;
	GtkLabel* autosave_label;
	GtkBuilder* _tmp31_;
	GObject* _tmp32_ = NULL;
	GObject* _tmp33_;
	GObject* reopen_checkbutton;
	g_return_if_fail (self != NULL);
	g_return_if_fail (builder != NULL);
	_tmp0_ = g_settings_new ("org.gnome.latexila.preferences.editor");
	settings = _tmp0_;
	_tmp1_ = builder;
	_tmp2_ = gtk_builder_get_object (_tmp1_, "display_line_nb_checkbutton");
	_tmp3_ = _g_object_ref0 (_tmp2_);
	display_line_nb_checkbutton = _tmp3_;
	g_settings_bind (settings, "display-line-numbers", display_line_nb_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp4_ = builder;
	_tmp5_ = gtk_builder_get_object (_tmp4_, "tab_width_spinbutton");
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, GTK_TYPE_SPIN_BUTTON) ? ((GtkSpinButton*) _tmp5_) : NULL);
	tab_width_spinbutton = _tmp6_;
	preferences_dialog_set_spin_button_range (self, tab_width_spinbutton, settings, "tabs-size");
	g_settings_bind (settings, "tabs-size", (GObject*) tab_width_spinbutton, "value", G_SETTINGS_BIND_DEFAULT);
	_tmp7_ = builder;
	_tmp8_ = gtk_builder_get_object (_tmp7_, "insert_spaces_checkbutton");
	_tmp9_ = _g_object_ref0 (_tmp8_);
	insert_spaces_checkbutton = _tmp9_;
	g_settings_bind (settings, "insert-spaces", insert_spaces_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp10_ = builder;
	_tmp11_ = gtk_builder_get_object (_tmp10_, "forget_no_tabs");
	_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp11_, GTK_TYPE_WIDGET) ? ((GtkWidget*) _tmp11_) : NULL);
	forget_no_tabs = _tmp12_;
	g_settings_bind (settings, "forget-no-tabs", (GObject*) forget_no_tabs, "active", G_SETTINGS_BIND_DEFAULT);
	preferences_dialog_set_sensitivity (self, settings, "insert-spaces", forget_no_tabs, TRUE);
	_tmp13_ = builder;
	_tmp14_ = gtk_builder_get_object (_tmp13_, "hl_current_line_checkbutton");
	_tmp15_ = _g_object_ref0 (_tmp14_);
	hl_current_line_checkbutton = _tmp15_;
	g_settings_bind (settings, "highlight-current-line", hl_current_line_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp16_ = builder;
	_tmp17_ = gtk_builder_get_object (_tmp16_, "bracket_matching_checkbutton");
	_tmp18_ = _g_object_ref0 (_tmp17_);
	bracket_matching_checkbutton = _tmp18_;
	g_settings_bind (settings, "bracket-matching", bracket_matching_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp19_ = builder;
	_tmp20_ = gtk_builder_get_object (_tmp19_, "backup_checkbutton");
	_tmp21_ = _g_object_ref0 (_tmp20_);
	backup_checkbutton = _tmp21_;
	g_settings_bind (settings, "create-backup-copy", backup_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp22_ = builder;
	_tmp23_ = gtk_builder_get_object (_tmp22_, "autosave_checkbutton");
	_tmp24_ = _g_object_ref0 (_tmp23_);
	autosave_checkbutton = _tmp24_;
	g_settings_bind (settings, "auto-save", autosave_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp25_ = builder;
	_tmp26_ = gtk_builder_get_object (_tmp25_, "autosave_spinbutton");
	_tmp27_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp26_, GTK_TYPE_SPIN_BUTTON) ? ((GtkSpinButton*) _tmp26_) : NULL);
	autosave_spinbutton = _tmp27_;
	preferences_dialog_set_spin_button_range (self, autosave_spinbutton, settings, "auto-save-interval");
	g_settings_bind (settings, "auto-save-interval", (GObject*) autosave_spinbutton, "value", G_SETTINGS_BIND_DEFAULT);
	preferences_dialog_set_sensitivity (self, settings, "auto-save", (GtkWidget*) autosave_spinbutton, TRUE);
	_tmp28_ = builder;
	_tmp29_ = gtk_builder_get_object (_tmp28_, "autosave_label");
	_tmp30_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp29_, GTK_TYPE_LABEL) ? ((GtkLabel*) _tmp29_) : NULL);
	autosave_label = _tmp30_;
	preferences_dialog_set_plural (self, autosave_label, settings, "auto-save-interval", ___lambda22__preferences_dialog_plural, self);
	_tmp31_ = builder;
	_tmp32_ = gtk_builder_get_object (_tmp31_, "reopen_checkbutton");
	_tmp33_ = _g_object_ref0 (_tmp32_);
	reopen_checkbutton = _tmp33_;
	g_settings_bind (settings, "reopen-files", reopen_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
	_g_object_unref0 (reopen_checkbutton);
	_g_object_unref0 (autosave_label);
	_g_object_unref0 (autosave_spinbutton);
	_g_object_unref0 (autosave_checkbutton);
	_g_object_unref0 (backup_checkbutton);
	_g_object_unref0 (bracket_matching_checkbutton);
	_g_object_unref0 (hl_current_line_checkbutton);
	_g_object_unref0 (forget_no_tabs);
	_g_object_unref0 (insert_spaces_checkbutton);
	_g_object_unref0 (tab_width_spinbutton);
	_g_object_unref0 (display_line_nb_checkbutton);
	_g_object_unref0 (settings);
}


static Block26Data* block26_data_ref (Block26Data* _data26_) {
	g_atomic_int_inc (&_data26_->_ref_count_);
	return _data26_;
}


static void block26_data_unref (void * _userdata_) {
	Block26Data* _data26_;
	_data26_ = (Block26Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data26_->_ref_count_)) {
		PreferencesDialog * self;
		self = _data26_->self;
		_g_object_unref0 (_data26_->schemes_select);
		_g_object_unref0 (_data26_->schemes_treeview);
		_g_object_unref0 (_data26_->default_font_checkbutton);
		_g_object_unref0 (_data26_->settings);
		_g_object_unref0 (self);
		g_slice_free (Block26Data, _data26_);
	}
}


static void __lambda23_ (Block26Data* _data26_) {
	PreferencesDialog * self;
	self = _data26_->self;
	preferences_dialog_set_system_font_label (self, _data26_->default_font_checkbutton);
}


static void ___lambda23__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	__lambda23_ (self);
}


static void _gtk_tree_path_free0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL));
}


static void _g_list_free__gtk_tree_path_free0_ (GList* self) {
	g_list_foreach (self, (GFunc) _gtk_tree_path_free0_, NULL);
	g_list_free (self);
}


static gpointer _gtk_tree_path_copy0 (gpointer self) {
	return self ? gtk_tree_path_copy (self) : NULL;
}


static void __lambda24_ (Block26Data* _data26_) {
	PreferencesDialog * self;
	GtkTreeModel* model = NULL;
	GtkTreeModel* _tmp0_ = NULL;
	GList* _tmp1_ = NULL;
	GList* rows;
	GList* _tmp2_;
	guint _tmp3_ = 0U;
	GList* _tmp4_;
	gconstpointer _tmp5_ = NULL;
	GtkTreePath* _tmp6_;
	GtkTreePath* path;
	GtkTreeIter iter = {0};
	GtkTreeModel* _tmp7_;
	GtkTreePath* _tmp8_;
	GtkTreeIter _tmp9_ = {0};
	gchar* id = NULL;
	GtkTreeModel* _tmp10_;
	GtkTreeIter _tmp11_;
	const gchar* _tmp12_;
	self = _data26_->self;
	_tmp1_ = gtk_tree_selection_get_selected_rows (_data26_->schemes_select, &_tmp0_);
	model = _tmp0_;
	rows = _tmp1_;
	_tmp2_ = rows;
	_tmp3_ = g_list_length (_tmp2_);
	if (_tmp3_ != ((guint) 1)) {
		__g_list_free__gtk_tree_path_free0_0 (rows);
		return;
	}
	_tmp4_ = rows;
	_tmp5_ = g_list_nth_data (_tmp4_, (guint) 0);
	_tmp6_ = _gtk_tree_path_copy0 ((GtkTreePath*) _tmp5_);
	path = _tmp6_;
	_tmp7_ = model;
	_tmp8_ = path;
	gtk_tree_model_get_iter (_tmp7_, &_tmp9_, _tmp8_);
	iter = _tmp9_;
	_tmp10_ = model;
	_tmp11_ = iter;
	gtk_tree_model_get (_tmp10_, &_tmp11_, PREFERENCES_DIALOG_STYLE_SCHEMES_ID, &id, -1);
	_tmp12_ = id;
	g_settings_set_string (_data26_->settings, "scheme", _tmp12_);
	_g_free0 (id);
	_gtk_tree_path_free0 (path);
	__g_list_free__gtk_tree_path_free0_0 (rows);
}


static void ___lambda24__gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self) {
	__lambda24_ (self);
}


static void __lambda25_ (Block26Data* _data26_, GSettings* setting, const gchar* key) {
	PreferencesDialog * self;
	GSettings* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_ = NULL;
	gchar* val;
	GtkTreeModel* _tmp3_;
	GtkTreeModel* _tmp4_;
	GtkTreeModel* _tmp5_;
	GtkTreeModel* model;
	GtkTreeIter iter = {0};
	GtkTreeModel* _tmp6_;
	GtkTreeIter _tmp7_ = {0};
	gboolean _tmp8_ = FALSE;
	gboolean valid;
	self = _data26_->self;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = setting;
	_tmp1_ = key;
	_tmp2_ = g_settings_get_string (_tmp0_, _tmp1_);
	val = _tmp2_;
	_tmp3_ = gtk_tree_view_get_model (_data26_->schemes_treeview);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	model = _tmp5_;
	_tmp6_ = model;
	_tmp8_ = gtk_tree_model_get_iter_first (_tmp6_, &_tmp7_);
	iter = _tmp7_;
	valid = _tmp8_;
	while (TRUE) {
		gboolean _tmp9_;
		gchar* scheme = NULL;
		GtkTreeModel* _tmp10_;
		GtkTreeIter _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		GtkTreeModel* _tmp18_;
		gboolean _tmp19_ = FALSE;
		_tmp9_ = valid;
		if (!_tmp9_) {
			break;
		}
		_tmp10_ = model;
		_tmp11_ = iter;
		gtk_tree_model_get (_tmp10_, &_tmp11_, PREFERENCES_DIALOG_STYLE_SCHEMES_ID, &scheme, -1, -1);
		_tmp12_ = scheme;
		_tmp13_ = val;
		if (g_strcmp0 (_tmp12_, _tmp13_) == 0) {
			GtkTreeSelection* _tmp14_ = NULL;
			GtkTreeSelection* _tmp15_;
			GtkTreeSelection* select;
			GtkTreeSelection* _tmp16_;
			GtkTreeIter _tmp17_;
			_tmp14_ = gtk_tree_view_get_selection (_data26_->schemes_treeview);
			_tmp15_ = _g_object_ref0 (_tmp14_);
			select = _tmp15_;
			_tmp16_ = select;
			_tmp17_ = iter;
			gtk_tree_selection_select_iter (_tmp16_, &_tmp17_);
			_g_object_unref0 (select);
			_g_free0 (scheme);
			_g_object_unref0 (model);
			_g_free0 (val);
			return;
		}
		_tmp18_ = model;
		_tmp19_ = gtk_tree_model_iter_next (_tmp18_, &iter);
		valid = _tmp19_;
		_g_free0 (scheme);
	}
	_g_object_unref0 (model);
	_g_free0 (val);
}


static void ___lambda25__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda25_ (self, _sender, key);
}


static void preferences_dialog_init_font_and_colors_tab (PreferencesDialog* self, GtkBuilder* builder) {
	Block26Data* _data26_;
	GSettings* _tmp0_;
	GtkBuilder* _tmp1_;
	GObject* _tmp2_ = NULL;
	GtkButton* _tmp3_;
	AppSettings* _tmp4_ = NULL;
	AppSettings* app_settings;
	GtkBuilder* _tmp5_;
	GObject* _tmp6_ = NULL;
	GObject* _tmp7_;
	GObject* font_button;
	GtkBuilder* _tmp8_;
	GObject* _tmp9_ = NULL;
	GtkWidget* _tmp10_;
	GtkWidget* font_hbox;
	GtkBuilder* _tmp11_;
	GObject* _tmp12_ = NULL;
	GtkTreeView* _tmp13_;
	gchar* _tmp14_ = NULL;
	gchar* current_scheme_id;
	GtkTreeSelection* _tmp15_ = NULL;
	GtkTreeSelection* _tmp16_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (builder != NULL);
	_data26_ = g_slice_new0 (Block26Data);
	_data26_->_ref_count_ = 1;
	_data26_->self = g_object_ref (self);
	_tmp0_ = g_settings_new ("org.gnome.latexila.preferences.editor");
	_data26_->settings = _tmp0_;
	_tmp1_ = builder;
	_tmp2_ = gtk_builder_get_object (_tmp1_, "default_font_checkbutton");
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GTK_TYPE_BUTTON) ? ((GtkButton*) _tmp2_) : NULL);
	_data26_->default_font_checkbutton = _tmp3_;
	g_settings_bind (_data26_->settings, "use-default-font", (GObject*) _data26_->default_font_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
	preferences_dialog_set_system_font_label (self, _data26_->default_font_checkbutton);
	_tmp4_ = app_settings_get_default ();
	app_settings = _tmp4_;
	g_signal_connect_data ((GObject*) app_settings, "notify::system-font", (GCallback) ___lambda23__g_object_notify, block26_data_ref (_data26_), (GClosureNotify) block26_data_unref, 0);
	_tmp5_ = builder;
	_tmp6_ = gtk_builder_get_object (_tmp5_, "font_button");
	_tmp7_ = _g_object_ref0 (_tmp6_);
	font_button = _tmp7_;
	g_settings_bind (_data26_->settings, "editor-font", font_button, "font-name", G_SETTINGS_BIND_DEFAULT);
	_tmp8_ = builder;
	_tmp9_ = gtk_builder_get_object (_tmp8_, "font_hbox");
	_tmp10_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, GTK_TYPE_WIDGET) ? ((GtkWidget*) _tmp9_) : NULL);
	font_hbox = _tmp10_;
	preferences_dialog_set_sensitivity (self, _data26_->settings, "use-default-font", font_hbox, FALSE);
	_tmp11_ = builder;
	_tmp12_ = gtk_builder_get_object (_tmp11_, "schemes_treeview");
	_tmp13_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp12_, GTK_TYPE_TREE_VIEW) ? ((GtkTreeView*) _tmp12_) : NULL);
	_data26_->schemes_treeview = _tmp13_;
	_tmp14_ = g_settings_get_string (_data26_->settings, "scheme");
	current_scheme_id = _tmp14_;
	preferences_dialog_init_schemes_treeview (self, _data26_->schemes_treeview, current_scheme_id);
	_tmp15_ = gtk_tree_view_get_selection (_data26_->schemes_treeview);
	_tmp16_ = _g_object_ref0 (_tmp15_);
	_data26_->schemes_select = _tmp16_;
	g_signal_connect_data (_data26_->schemes_select, "changed", (GCallback) ___lambda24__gtk_tree_selection_changed, block26_data_ref (_data26_), (GClosureNotify) block26_data_unref, 0);
	g_signal_connect_data (_data26_->settings, "changed::scheme", (GCallback) ___lambda25__g_settings_changed, block26_data_ref (_data26_), (GClosureNotify) block26_data_unref, 0);
	_g_free0 (current_scheme_id);
	_g_object_unref0 (font_hbox);
	_g_object_unref0 (font_button);
	_g_object_unref0 (app_settings);
	block26_data_unref (_data26_);
	_data26_ = NULL;
}


static const gchar* __lambda26_ (PreferencesDialog* self, gulong n) {
	const gchar* result = NULL;
	gulong _tmp0_;
	const gchar* _tmp1_ = NULL;
	_tmp0_ = n;
	_tmp1_ = ngettext ("character", "characters", _tmp0_);
	result = _tmp1_;
	return result;
}


static const gchar* ___lambda26__preferences_dialog_plural (gulong n, gpointer self) {
	const gchar* result;
	result = __lambda26_ (self, n);
	return result;
}


static void preferences_dialog_init_interactive_completion_setting (PreferencesDialog* self, GtkBuilder* builder) {
	GSettings* _tmp0_;
	GSettings* settings;
	GtkBuilder* _tmp1_;
	GObject* _tmp2_ = NULL;
	GObject* _tmp3_;
	GObject* interactive_comp_checkbutton;
	GtkBuilder* _tmp4_;
	GObject* _tmp5_ = NULL;
	GtkSpinButton* _tmp6_;
	GtkSpinButton* interactive_comp_spinbutton;
	GtkBuilder* _tmp7_;
	GObject* _tmp8_ = NULL;
	GtkLabel* _tmp9_;
	GtkLabel* interactive_comp_label;
	g_return_if_fail (self != NULL);
	g_return_if_fail (builder != NULL);
	_tmp0_ = g_settings_new ("org.gnome.latexila.preferences.latex");
	settings = _tmp0_;
	_tmp1_ = builder;
	_tmp2_ = gtk_builder_get_object (_tmp1_, "interactive_comp_checkbutton");
	_tmp3_ = _g_object_ref0 (_tmp2_);
	interactive_comp_checkbutton = _tmp3_;
	g_settings_bind (settings, "interactive-completion", interactive_comp_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp4_ = builder;
	_tmp5_ = gtk_builder_get_object (_tmp4_, "interactive_comp_spinbutton");
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, GTK_TYPE_SPIN_BUTTON) ? ((GtkSpinButton*) _tmp5_) : NULL);
	interactive_comp_spinbutton = _tmp6_;
	preferences_dialog_set_spin_button_range (self, interactive_comp_spinbutton, settings, "interactive-completion-num");
	g_settings_bind (settings, "interactive-completion-num", (GObject*) interactive_comp_spinbutton, "value", G_SETTINGS_BIND_DEFAULT);
	preferences_dialog_set_sensitivity (self, settings, "interactive-completion", (GtkWidget*) interactive_comp_spinbutton, TRUE);
	_tmp7_ = builder;
	_tmp8_ = gtk_builder_get_object (_tmp7_, "interactive_comp_label");
	_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, GTK_TYPE_LABEL) ? ((GtkLabel*) _tmp8_) : NULL);
	interactive_comp_label = _tmp9_;
	preferences_dialog_set_plural (self, interactive_comp_label, settings, "interactive-completion-num", ___lambda26__preferences_dialog_plural, self);
	_g_object_unref0 (interactive_comp_label);
	_g_object_unref0 (interactive_comp_spinbutton);
	_g_object_unref0 (interactive_comp_checkbutton);
	_g_object_unref0 (settings);
}


static void preferences_dialog_init_other_tab (PreferencesDialog* self, GtkBuilder* builder) {
	GSettings* _tmp0_;
	GSettings* latex_settings;
	GtkBuilder* _tmp1_;
	GObject* _tmp2_ = NULL;
	GObject* _tmp3_;
	GObject* confirm_clean_up_checkbutton;
	GtkBuilder* _tmp4_;
	GObject* _tmp5_ = NULL;
	GtkWidget* _tmp6_;
	GtkWidget* auto_clean_up_checkbutton;
	GtkBuilder* _tmp7_;
	GObject* _tmp8_ = NULL;
	GObject* _tmp9_;
	GObject* clean_up_entry;
	g_return_if_fail (self != NULL);
	g_return_if_fail (builder != NULL);
	_tmp0_ = g_settings_new ("org.gnome.latexila.preferences.latex");
	latex_settings = _tmp0_;
	_tmp1_ = builder;
	_tmp2_ = gtk_builder_get_object (_tmp1_, "confirm_clean_up_checkbutton");
	_tmp3_ = _g_object_ref0 (_tmp2_);
	confirm_clean_up_checkbutton = _tmp3_;
	g_settings_bind (latex_settings, "no-confirm-clean", confirm_clean_up_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp4_ = builder;
	_tmp5_ = gtk_builder_get_object (_tmp4_, "auto_clean_up_checkbutton");
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, GTK_TYPE_WIDGET) ? ((GtkWidget*) _tmp5_) : NULL);
	auto_clean_up_checkbutton = _tmp6_;
	g_settings_bind (latex_settings, "automatic-clean", (GObject*) auto_clean_up_checkbutton, "active", G_SETTINGS_BIND_DEFAULT);
	preferences_dialog_set_sensitivity (self, latex_settings, "no-confirm-clean", auto_clean_up_checkbutton, TRUE);
	_tmp7_ = builder;
	_tmp8_ = gtk_builder_get_object (_tmp7_, "clean_up_entry");
	_tmp9_ = _g_object_ref0 (_tmp8_);
	clean_up_entry = _tmp9_;
	g_settings_bind (latex_settings, "clean-extensions", clean_up_entry, "text", G_SETTINGS_BIND_DEFAULT);
	_g_object_unref0 (clean_up_entry);
	_g_object_unref0 (auto_clean_up_checkbutton);
	_g_object_unref0 (confirm_clean_up_checkbutton);
	_g_object_unref0 (latex_settings);
}


static Block27Data* block27_data_ref (Block27Data* _data27_) {
	g_atomic_int_inc (&_data27_->_ref_count_);
	return _data27_;
}


static void block27_data_unref (void * _userdata_) {
	Block27Data* _data27_;
	_data27_ = (Block27Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data27_->_ref_count_)) {
		PreferencesDialog * self;
		self = _data27_->self;
		_g_object_unref0 (_data27_->widget);
		_g_object_unref0 (self);
		g_slice_free (Block27Data, _data27_);
	}
}


static void __lambda20_ (Block27Data* _data27_, GSettings* setting, const gchar* k) {
	PreferencesDialog * self;
	GSettings* _tmp0_;
	const gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean v;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_;
	GtkWidget* _tmp7_;
	gboolean _tmp8_;
	self = _data27_->self;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (k != NULL);
	_tmp0_ = setting;
	_tmp1_ = k;
	_tmp2_ = g_settings_get_boolean (_tmp0_, _tmp1_);
	v = _tmp2_;
	_tmp4_ = _data27_->must_be_enabled;
	if (_tmp4_) {
		gboolean _tmp5_;
		_tmp5_ = v;
		_tmp3_ = _tmp5_;
	} else {
		gboolean _tmp6_;
		_tmp6_ = v;
		_tmp3_ = !_tmp6_;
	}
	_tmp7_ = _data27_->widget;
	_tmp8_ = _tmp3_;
	gtk_widget_set_sensitive (_tmp7_, _tmp8_);
}


static void ___lambda20__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda20_ (self, _sender, key);
}


static void preferences_dialog_set_sensitivity (PreferencesDialog* self, GSettings* settings, const gchar* key, GtkWidget* widget, gboolean must_be_enabled) {
	Block27Data* _data27_;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	gboolean _tmp2_;
	GSettings* _tmp3_;
	const gchar* _tmp4_;
	gboolean _tmp5_ = FALSE;
	gboolean val;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_;
	GtkWidget* _tmp10_;
	gboolean _tmp11_;
	GSettings* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (settings != NULL);
	g_return_if_fail (key != NULL);
	g_return_if_fail (widget != NULL);
	_data27_ = g_slice_new0 (Block27Data);
	_data27_->_ref_count_ = 1;
	_data27_->self = g_object_ref (self);
	_tmp0_ = widget;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data27_->widget);
	_data27_->widget = _tmp1_;
	_tmp2_ = must_be_enabled;
	_data27_->must_be_enabled = _tmp2_;
	_tmp3_ = settings;
	_tmp4_ = key;
	_tmp5_ = g_settings_get_boolean (_tmp3_, _tmp4_);
	val = _tmp5_;
	_tmp7_ = _data27_->must_be_enabled;
	if (_tmp7_) {
		gboolean _tmp8_;
		_tmp8_ = val;
		_tmp6_ = _tmp8_;
	} else {
		gboolean _tmp9_;
		_tmp9_ = val;
		_tmp6_ = !_tmp9_;
	}
	_tmp10_ = _data27_->widget;
	_tmp11_ = _tmp6_;
	gtk_widget_set_sensitive (_tmp10_, _tmp11_);
	_tmp12_ = settings;
	_tmp13_ = key;
	_tmp14_ = g_strconcat ("changed::", _tmp13_, NULL);
	g_signal_connect_data (_tmp12_, _tmp14_, (GCallback) ___lambda20__g_settings_changed, block27_data_ref (_data27_), (GClosureNotify) block27_data_unref, 0);
	_g_free0 (_tmp14_);
	block27_data_unref (_data27_);
	_data27_ = NULL;
}


static void preferences_dialog_set_system_font_label (PreferencesDialog* self, GtkButton* button) {
	AppSettings* _tmp0_ = NULL;
	AppSettings* app_settings;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_ = NULL;
	gchar* label;
	GtkButton* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = app_settings_get_default ();
	app_settings = _tmp0_;
	_tmp1_ = _ ("Use the system fixed width font (%s)");
	_tmp2_ = app_settings_get_system_font (app_settings);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup_printf (_tmp1_, _tmp3_);
	label = _tmp4_;
	_tmp5_ = button;
	gtk_button_set_label (_tmp5_, label);
	_g_free0 (label);
	_g_object_unref0 (app_settings);
}


static Block28Data* block28_data_ref (Block28Data* _data28_) {
	g_atomic_int_inc (&_data28_->_ref_count_);
	return _data28_;
}


static void block28_data_unref (void * _userdata_) {
	Block28Data* _data28_;
	_data28_ = (Block28Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data28_->_ref_count_)) {
		PreferencesDialog * self;
		self = _data28_->self;
		_g_object_unref0 (_data28_->label);
		_g_object_unref0 (self);
		g_slice_free (Block28Data, _data28_);
	}
}


static void __lambda21_ (Block28Data* _data28_, GSettings* setting, const gchar* k) {
	PreferencesDialog * self;
	guint v = 0U;
	GSettings* _tmp0_;
	const gchar* _tmp1_;
	GtkLabel* _tmp2_;
	PreferencesDialogPlural _tmp3_;
	void* _tmp3__target;
	const gchar* _tmp4_ = NULL;
	self = _data28_->self;
	g_return_if_fail (setting != NULL);
	g_return_if_fail (k != NULL);
	_tmp0_ = setting;
	_tmp1_ = k;
	g_settings_get (_tmp0_, _tmp1_, "u", &v);
	_tmp2_ = _data28_->label;
	_tmp3_ = _data28_->plural;
	_tmp3__target = _data28_->plural_target;
	_tmp4_ = _tmp3_ ((gulong) v, _tmp3__target);
	gtk_label_set_label (_tmp2_, _tmp4_);
}


static void ___lambda21__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
	__lambda21_ (self, _sender, key);
}


static void preferences_dialog_set_plural (PreferencesDialog* self, GtkLabel* label, GSettings* settings, const gchar* key, PreferencesDialogPlural plural, void* plural_target) {
	Block28Data* _data28_;
	GtkLabel* _tmp0_;
	GtkLabel* _tmp1_;
	PreferencesDialogPlural _tmp2_;
	void* _tmp2__target;
	guint val = 0U;
	GSettings* _tmp3_;
	const gchar* _tmp4_;
	GtkLabel* _tmp5_;
	PreferencesDialogPlural _tmp6_;
	void* _tmp6__target;
	const gchar* _tmp7_ = NULL;
	GSettings* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label != NULL);
	g_return_if_fail (settings != NULL);
	g_return_if_fail (key != NULL);
	_data28_ = g_slice_new0 (Block28Data);
	_data28_->_ref_count_ = 1;
	_data28_->self = g_object_ref (self);
	_tmp0_ = label;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data28_->label);
	_data28_->label = _tmp1_;
	_tmp2_ = plural;
	_tmp2__target = plural_target;
	_data28_->plural = _tmp2_;
	_data28_->plural_target = _tmp2__target;
	_tmp3_ = settings;
	_tmp4_ = key;
	g_settings_get (_tmp3_, _tmp4_, "u", &val);
	_tmp5_ = _data28_->label;
	_tmp6_ = _data28_->plural;
	_tmp6__target = _data28_->plural_target;
	_tmp7_ = _tmp6_ ((gulong) val, _tmp6__target);
	gtk_label_set_label (_tmp5_, _tmp7_);
	_tmp8_ = settings;
	_tmp9_ = key;
	_tmp10_ = g_strconcat ("changed::", _tmp9_, NULL);
	g_signal_connect_data (_tmp8_, _tmp10_, (GCallback) ___lambda21__g_settings_changed, block28_data_ref (_data28_), (GClosureNotify) block28_data_unref, 0);
	_g_free0 (_tmp10_);
	block28_data_unref (_data28_);
	_data28_ = NULL;
}


static void preferences_dialog_set_spin_button_range (PreferencesDialog* self, GtkSpinButton* spin_button, GSettings* settings, const gchar* key) {
	GSettings* _tmp0_;
	const gchar* _tmp1_;
	GVariant* _tmp2_ = NULL;
	GVariant* range;
	gchar* range_type = NULL;
	GVariant* range_contents = NULL;
	guint min = 0U;
	guint max = 0U;
	guint cur_value = 0U;
	GSettings* _tmp3_;
	const gchar* _tmp4_;
	GtkAdjustment* _tmp5_;
	GtkAdjustment* adjustment;
	GtkSpinButton* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (spin_button != NULL);
	g_return_if_fail (settings != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = settings;
	_tmp1_ = key;
	_tmp2_ = g_settings_get_range (_tmp0_, _tmp1_);
	range = _tmp2_;
	g_variant_get (range, "(sv)", &range_type, &range_contents, NULL);
	g_return_if_fail (g_strcmp0 (range_type, "range") == 0);
	g_variant_get (range_contents, "(uu)", &min, &max, NULL);
	_tmp3_ = settings;
	_tmp4_ = key;
	g_settings_get (_tmp3_, _tmp4_, "u", &cur_value);
	_tmp5_ = gtk_adjustment_new ((gdouble) cur_value, (gdouble) min, (gdouble) max, 1.0, (gdouble) 0, (gdouble) 0);
	g_object_ref_sink (_tmp5_);
	adjustment = _tmp5_;
	_tmp6_ = spin_button;
	gtk_spin_button_set_adjustment (_tmp6_, adjustment);
	_g_object_unref0 (adjustment);
	_g_variant_unref0 (range_contents);
	_g_free0 (range_type);
	_g_variant_unref0 (range);
}


static void preferences_dialog_init_schemes_treeview (PreferencesDialog* self, GtkTreeView* treeview, const gchar* current_id) {
	GtkListStore* _tmp0_;
	GtkListStore* list_store;
	GtkListStore* _tmp1_;
	GtkTreeView* _tmp2_;
	GtkListStore* _tmp3_;
	GtkCellRendererText* _tmp4_;
	GtkCellRendererText* renderer;
	GtkCellRendererText* _tmp5_;
	GtkTreeViewColumn* _tmp6_;
	GtkTreeViewColumn* column;
	GtkTreeView* _tmp7_;
	GtkTreeViewColumn* _tmp8_;
	GtkTreeView* _tmp9_;
	GtkTreeSelection* _tmp10_ = NULL;
	GtkTreeSelection* _tmp11_;
	GtkTreeSelection* select;
	GtkTreeSelection* _tmp12_;
	GtkSourceStyleSchemeManager* _tmp13_ = NULL;
	GtkSourceStyleSchemeManager* _tmp14_;
	GtkSourceStyleSchemeManager* manager;
	GtkSourceStyleSchemeManager* _tmp15_;
	gchar** _tmp16_;
	gchar** _tmp17_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (treeview != NULL);
	g_return_if_fail (current_id != NULL);
	_tmp0_ = gtk_list_store_new ((gint) PREFERENCES_DIALOG_STYLE_SCHEMES_N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
	list_store = _tmp0_;
	_tmp1_ = list_store;
	gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable*) _tmp1_, (gint) PREFERENCES_DIALOG_STYLE_SCHEMES_ID, GTK_SORT_ASCENDING);
	_tmp2_ = treeview;
	_tmp3_ = list_store;
	gtk_tree_view_set_model (_tmp2_, (GtkTreeModel*) _tmp3_);
	_tmp4_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp4_);
	renderer = _tmp4_;
	_tmp5_ = renderer;
	_tmp6_ = gtk_tree_view_column_new_with_attributes ("Name and description", (GtkCellRenderer*) _tmp5_, "markup", PREFERENCES_DIALOG_STYLE_SCHEMES_DESC, NULL, NULL);
	g_object_ref_sink (_tmp6_);
	column = _tmp6_;
	_tmp7_ = treeview;
	_tmp8_ = column;
	gtk_tree_view_append_column (_tmp7_, _tmp8_);
	_tmp9_ = treeview;
	_tmp10_ = gtk_tree_view_get_selection (_tmp9_);
	_tmp11_ = _g_object_ref0 (_tmp10_);
	select = _tmp11_;
	_tmp12_ = select;
	gtk_tree_selection_set_mode (_tmp12_, GTK_SELECTION_SINGLE);
	_tmp13_ = gtk_source_style_scheme_manager_get_default ();
	_tmp14_ = _g_object_ref0 (_tmp13_);
	manager = _tmp14_;
	_tmp15_ = manager;
	_tmp17_ = _tmp16_ = gtk_source_style_scheme_manager_get_scheme_ids (_tmp15_);
	{
		gchar** id_collection = NULL;
		gint id_collection_length1 = 0;
		gint _id_collection_size_ = 0;
		gint id_it = 0;
		id_collection = _tmp17_;
		id_collection_length1 = _vala_array_length (_tmp16_);
		for (id_it = 0; id_it < _vala_array_length (_tmp16_); id_it = id_it + 1) {
			gchar* _tmp18_;
			gchar* id = NULL;
			_tmp18_ = g_strdup (id_collection[id_it]);
			id = _tmp18_;
			{
				GtkSourceStyleSchemeManager* _tmp19_;
				const gchar* _tmp20_;
				GtkSourceStyleScheme* _tmp21_ = NULL;
				GtkSourceStyleScheme* _tmp22_;
				GtkSourceStyleScheme* scheme;
				GtkSourceStyleScheme* _tmp23_;
				const gchar* _tmp24_;
				const gchar* _tmp25_;
				GtkSourceStyleScheme* _tmp26_;
				const gchar* _tmp27_;
				const gchar* _tmp28_;
				gchar* _tmp29_ = NULL;
				gchar* desc;
				GtkTreeIter iter = {0};
				GtkListStore* _tmp30_;
				GtkTreeIter _tmp31_ = {0};
				GtkListStore* _tmp32_;
				GtkTreeIter _tmp33_;
				GtkSourceStyleScheme* _tmp34_;
				const gchar* _tmp35_;
				const gchar* _tmp36_;
				const gchar* _tmp37_;
				const gchar* _tmp38_;
				const gchar* _tmp39_;
				_tmp19_ = manager;
				_tmp20_ = id;
				_tmp21_ = gtk_source_style_scheme_manager_get_scheme (_tmp19_, _tmp20_);
				_tmp22_ = _g_object_ref0 (_tmp21_);
				scheme = _tmp22_;
				_tmp23_ = scheme;
				_tmp24_ = gtk_source_style_scheme_get_name (_tmp23_);
				_tmp25_ = _tmp24_;
				_tmp26_ = scheme;
				_tmp27_ = gtk_source_style_scheme_get_description (_tmp26_);
				_tmp28_ = _tmp27_;
				_tmp29_ = g_strdup_printf ("<b>%s</b> - %s", _tmp25_, _tmp28_);
				desc = _tmp29_;
				_tmp30_ = list_store;
				gtk_list_store_append (_tmp30_, &_tmp31_);
				iter = _tmp31_;
				_tmp32_ = list_store;
				_tmp33_ = iter;
				_tmp34_ = scheme;
				_tmp35_ = gtk_source_style_scheme_get_id (_tmp34_);
				_tmp36_ = _tmp35_;
				_tmp37_ = desc;
				gtk_list_store_set (_tmp32_, &_tmp33_, PREFERENCES_DIALOG_STYLE_SCHEMES_ID, _tmp36_, PREFERENCES_DIALOG_STYLE_SCHEMES_DESC, _tmp37_, -1, -1);
				_tmp38_ = id;
				_tmp39_ = current_id;
				if (g_strcmp0 (_tmp38_, _tmp39_) == 0) {
					GtkTreeSelection* _tmp40_;
					GtkTreeIter _tmp41_;
					_tmp40_ = select;
					_tmp41_ = iter;
					gtk_tree_selection_select_iter (_tmp40_, &_tmp41_);
				}
				_g_free0 (desc);
				_g_object_unref0 (scheme);
				_g_free0 (id);
			}
		}
	}
	_g_object_unref0 (manager);
	_g_object_unref0 (select);
	_g_object_unref0 (column);
	_g_object_unref0 (renderer);
	_g_object_unref0 (list_store);
}


static void preferences_dialog_class_init (PreferencesDialogClass * klass) {
	preferences_dialog_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = preferences_dialog_finalize;
}


static void preferences_dialog_instance_init (PreferencesDialog * self) {
}


static void preferences_dialog_finalize (GObject* obj) {
	PreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PREFERENCES_DIALOG, PreferencesDialog);
	G_OBJECT_CLASS (preferences_dialog_parent_class)->finalize (obj);
}


GType preferences_dialog_get_type (void) {
	static volatile gsize preferences_dialog_type_id__volatile = 0;
	if (g_once_init_enter (&preferences_dialog_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (PreferencesDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) preferences_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PreferencesDialog), 0, (GInstanceInitFunc) preferences_dialog_instance_init, NULL };
		GType preferences_dialog_type_id;
		preferences_dialog_type_id = g_type_register_static (GTK_TYPE_DIALOG, "PreferencesDialog", &g_define_type_info, 0);
		g_once_init_leave (&preferences_dialog_type_id__volatile, preferences_dialog_type_id);
	}
	return preferences_dialog_type_id__volatile;
}


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;
}



