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

/*
 * This file is part of GNOME LaTeX.
 *
 * Copyright © 2010-2012 Sébastien Wilmet
 *
 * GNOME LaTeX 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.
 *
 * GNOME LaTeX 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 GNOME LaTeX.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Author: Sébastien Wilmet
 */

#include <glib-object.h>
#include <gtk/gtk.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

typedef enum  {
	SYMBOLS_CATEGORY_TYPE_NORMAL,
	SYMBOLS_CATEGORY_TYPE_MOST_USED
} SymbolsCategoryType;

#define TYPE_SYMBOLS_CATEGORY_TYPE (symbols_category_type_get_type ())
typedef enum  {
	SYMBOLS_CATEGORY_COLUMN_TYPE,
	SYMBOLS_CATEGORY_COLUMN_ICON,
	SYMBOLS_CATEGORY_COLUMN_NAME,
	SYMBOLS_CATEGORY_COLUMN_SYMBOLS_STORE,
	SYMBOLS_CATEGORY_COLUMN_N_COLUMNS
} SymbolsCategoryColumn;

#define TYPE_SYMBOLS_CATEGORY_COLUMN (symbols_category_column_get_type ())
typedef enum  {
	SYMBOL_COLUMN_PIXBUF,
	SYMBOL_COLUMN_COMMAND,
	SYMBOL_COLUMN_TOOLTIP,
	SYMBOL_COLUMN_ID,
	SYMBOL_COLUMN_N_COLUMNS
} SymbolColumn;

#define TYPE_SYMBOL_COLUMN (symbol_column_get_type ())

#define TYPE_SYMBOLS (symbols_get_type ())
#define SYMBOLS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SYMBOLS, Symbols))
#define SYMBOLS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SYMBOLS, SymbolsClass))
#define IS_SYMBOLS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SYMBOLS))
#define IS_SYMBOLS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SYMBOLS))
#define SYMBOLS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SYMBOLS, SymbolsClass))

typedef struct _Symbols Symbols;
typedef struct _SymbolsClass SymbolsClass;
typedef struct _SymbolsPrivate SymbolsPrivate;

#define TYPE_NORMAL_SYMBOLS (normal_symbols_get_type ())
#define NORMAL_SYMBOLS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NORMAL_SYMBOLS, NormalSymbols))
#define NORMAL_SYMBOLS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NORMAL_SYMBOLS, NormalSymbolsClass))
#define IS_NORMAL_SYMBOLS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NORMAL_SYMBOLS))
#define IS_NORMAL_SYMBOLS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NORMAL_SYMBOLS))
#define NORMAL_SYMBOLS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NORMAL_SYMBOLS, NormalSymbolsClass))

typedef struct _NormalSymbols NormalSymbols;
typedef struct _NormalSymbolsClass NormalSymbolsClass;
enum  {
	SYMBOLS_0_PROPERTY,
	SYMBOLS_NUM_PROPERTIES
};
static GParamSpec* symbols_properties[SYMBOLS_NUM_PROPERTIES];

#define SYMBOLS_TYPE_CATEGORY_INFO (symbols_category_info_get_type ())
typedef struct _SymbolsCategoryInfo SymbolsCategoryInfo;
#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_MOST_USED_SYMBOLS (most_used_symbols_get_type ())
#define MOST_USED_SYMBOLS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MOST_USED_SYMBOLS, MostUsedSymbols))
#define MOST_USED_SYMBOLS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MOST_USED_SYMBOLS, MostUsedSymbolsClass))
#define IS_MOST_USED_SYMBOLS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MOST_USED_SYMBOLS))
#define IS_MOST_USED_SYMBOLS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MOST_USED_SYMBOLS))
#define MOST_USED_SYMBOLS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MOST_USED_SYMBOLS, MostUsedSymbolsClass))

typedef struct _MostUsedSymbols MostUsedSymbols;
typedef struct _MostUsedSymbolsClass MostUsedSymbolsClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _NormalSymbolsPrivate NormalSymbolsPrivate;

#define NORMAL_SYMBOLS_TYPE_SYMBOL_INFO (normal_symbols_symbol_info_get_type ())
typedef struct _NormalSymbolsSymbolInfo NormalSymbolsSymbolInfo;
enum  {
	NORMAL_SYMBOLS_0_PROPERTY,
	NORMAL_SYMBOLS_NUM_PROPERTIES
};
static GParamSpec* normal_symbols_properties[NORMAL_SYMBOLS_NUM_PROPERTIES];
#define _normal_symbols_symbol_info_free0(var) ((var == NULL) ? NULL : (var = (normal_symbols_symbol_info_free (var), NULL)))
#define _g_markup_parse_context_unref0(var) ((var == NULL) ? NULL : (var = (g_markup_parse_context_unref (var), NULL)))

struct _Symbols {
	GObject parent_instance;
	SymbolsPrivate * priv;
};

struct _SymbolsClass {
	GObjectClass parent_class;
};

struct _SymbolsPrivate {
	GtkListStore* _categories_store;
	GeeMap* _normal_symbols_map;
};

struct _SymbolsCategoryInfo {
	gchar* name;
	gchar* icon;
	gchar* id;
};

struct _NormalSymbols {
	GtkListStore parent_instance;
	NormalSymbolsPrivate * priv;
};

struct _NormalSymbolsClass {
	GtkListStoreClass parent_class;
};

struct _NormalSymbolsSymbolInfo {
	gchar* latex_command;
	gchar* package_required;
};

struct _NormalSymbolsPrivate {
	gchar* _category_id;
	gchar* _resource_path;
	GeeMap* _data;
};

static gint Symbols_private_offset;
static gpointer symbols_parent_class = NULL;
static Symbols* symbols__instance;
static Symbols* symbols__instance = NULL;
static gint NormalSymbols_private_offset;
static gpointer normal_symbols_parent_class = NULL;

VALA_EXTERN GType symbols_category_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType symbols_category_column_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType symbol_column_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType symbols_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Symbols, g_object_unref)
VALA_EXTERN GType normal_symbols_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NormalSymbols, g_object_unref)
static GType symbols_category_info_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static SymbolsCategoryInfo* symbols_category_info_dup (const SymbolsCategoryInfo* self);
static void symbols_category_info_free (SymbolsCategoryInfo* self);
static void symbols_category_info_copy (const SymbolsCategoryInfo* self,
                                 SymbolsCategoryInfo* dest);
static void symbols_category_info_destroy (SymbolsCategoryInfo* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (SymbolsCategoryInfo, symbols_category_info_destroy)
static Symbols* symbols_new (void);
static Symbols* symbols_construct (GType object_type);
static void symbols_add_normal_category (Symbols* self,
                                  SymbolsCategoryInfo* info);
VALA_EXTERN Symbols* symbols_get_default (void);
static void symbols_add_most_used_category (Symbols* self);
VALA_EXTERN GtkTreeModel* symbols_get_categories_model (Symbols* self);
VALA_EXTERN gboolean symbols_get_symbol_info (Symbols* self,
                                  const gchar* id,
                                  gchar** command,
                                  gchar** tooltip);
VALA_EXTERN gboolean normal_symbols_get_symbol_info (NormalSymbols* self,
                                         const gchar* icon_file,
                                         gchar** command,
                                         gchar** package);
VALA_EXTERN gchar* symbols_get_tooltip (const gchar* latex_command,
                            const gchar* package_required);
VALA_EXTERN NormalSymbols* normal_symbols_new (const gchar* category_id);
VALA_EXTERN NormalSymbols* normal_symbols_construct (GType object_type,
                                         const gchar* category_id);
VALA_EXTERN GType most_used_symbols_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MostUsedSymbols, g_object_unref)
VALA_EXTERN MostUsedSymbols* most_used_symbols_get_default (void);
VALA_EXTERN GtkTreeModel* most_used_symbols_get_model (MostUsedSymbols* self);
VALA_EXTERN GdkPixbuf* symbols_get_pixbuf (const gchar* symbol_id);
static void symbols_finalize (GObject * obj);
static GType symbols_get_type_once (void);
static GType normal_symbols_symbol_info_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static NormalSymbolsSymbolInfo* normal_symbols_symbol_info_dup (const NormalSymbolsSymbolInfo* self);
static void normal_symbols_symbol_info_free (NormalSymbolsSymbolInfo* self);
static void normal_symbols_symbol_info_copy (const NormalSymbolsSymbolInfo* self,
                                      NormalSymbolsSymbolInfo* dest);
static void normal_symbols_symbol_info_destroy (NormalSymbolsSymbolInfo* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (NormalSymbolsSymbolInfo, normal_symbols_symbol_info_destroy)
static void normal_symbols_load_symbols (NormalSymbols* self);
VALA_EXTERN const gchar* utils_get_string_from_resource (const gchar* resource_path);
static void normal_symbols_parser_start (NormalSymbols* self,
                                  GMarkupParseContext* context,
                                  const gchar* name,
                                  gchar** attr_names,
                                  gint attr_names_length1,
                                  gchar** attr_values,
                                  gint attr_values_length1,
                                  GError** error);
static void _normal_symbols_parser_start_gmarkup_parser_start_element_func (GMarkupParseContext* context,
                                                                     const gchar* element_name,
                                                                     gchar** attribute_names,
                                                                     gchar** attribute_values,
                                                                     gpointer self,
                                                                     GError** error);
static void normal_symbols_add_symbol (NormalSymbols* self,
                                const gchar* icon_file,
                                NormalSymbolsSymbolInfo* symbol);
static void normal_symbols_finalize (GObject * obj);
static GType normal_symbols_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static const SymbolsCategoryInfo SYMBOLS__normal_categories[7] = {{N_ ("Greek"), "symbol_greek", "greek"}, {N_ ("Arrows"), "symbol_arrows", "arrows"}, {N_ ("Relations"), "symbol_relations", "relations"}, {N_ ("Operators"), "symbol_operators", "operators"}, {N_ ("Delimiters"), "symbol_delimiters", "delimiters"}, {N_ ("Misc math"), "symbol_misc_math", "misc-math"}, {N_ ("Misc text"), "symbol_misc_text", "misc-text"}};

 G_GNUC_NO_INLINE static GType
symbols_category_type_get_type_once (void)
{
	static const GEnumValue values[] = {{SYMBOLS_CATEGORY_TYPE_NORMAL, "SYMBOLS_CATEGORY_TYPE_NORMAL", "normal"}, {SYMBOLS_CATEGORY_TYPE_MOST_USED, "SYMBOLS_CATEGORY_TYPE_MOST_USED", "most-used"}, {0, NULL, NULL}};
	GType symbols_category_type_type_id;
	symbols_category_type_type_id = g_enum_register_static ("SymbolsCategoryType", values);
	return symbols_category_type_type_id;
}

GType
symbols_category_type_get_type (void)
{
	static gsize symbols_category_type_type_id__volatile = 0;
	if (g_once_init_enter (&symbols_category_type_type_id__volatile)) {
		GType symbols_category_type_type_id;
		symbols_category_type_type_id = symbols_category_type_get_type_once ();
		g_once_init_leave (&symbols_category_type_type_id__volatile, symbols_category_type_type_id);
	}
	return symbols_category_type_type_id__volatile;
}

 G_GNUC_NO_INLINE static GType
symbols_category_column_get_type_once (void)
{
	static const GEnumValue values[] = {{SYMBOLS_CATEGORY_COLUMN_TYPE, "SYMBOLS_CATEGORY_COLUMN_TYPE", "type"}, {SYMBOLS_CATEGORY_COLUMN_ICON, "SYMBOLS_CATEGORY_COLUMN_ICON", "icon"}, {SYMBOLS_CATEGORY_COLUMN_NAME, "SYMBOLS_CATEGORY_COLUMN_NAME", "name"}, {SYMBOLS_CATEGORY_COLUMN_SYMBOLS_STORE, "SYMBOLS_CATEGORY_COLUMN_SYMBOLS_STORE", "symbols-store"}, {SYMBOLS_CATEGORY_COLUMN_N_COLUMNS, "SYMBOLS_CATEGORY_COLUMN_N_COLUMNS", "n-columns"}, {0, NULL, NULL}};
	GType symbols_category_column_type_id;
	symbols_category_column_type_id = g_enum_register_static ("SymbolsCategoryColumn", values);
	return symbols_category_column_type_id;
}

GType
symbols_category_column_get_type (void)
{
	static gsize symbols_category_column_type_id__volatile = 0;
	if (g_once_init_enter (&symbols_category_column_type_id__volatile)) {
		GType symbols_category_column_type_id;
		symbols_category_column_type_id = symbols_category_column_get_type_once ();
		g_once_init_leave (&symbols_category_column_type_id__volatile, symbols_category_column_type_id);
	}
	return symbols_category_column_type_id__volatile;
}

 G_GNUC_NO_INLINE static GType
symbol_column_get_type_once (void)
{
	static const GEnumValue values[] = {{SYMBOL_COLUMN_PIXBUF, "SYMBOL_COLUMN_PIXBUF", "pixbuf"}, {SYMBOL_COLUMN_COMMAND, "SYMBOL_COLUMN_COMMAND", "command"}, {SYMBOL_COLUMN_TOOLTIP, "SYMBOL_COLUMN_TOOLTIP", "tooltip"}, {SYMBOL_COLUMN_ID, "SYMBOL_COLUMN_ID", "id"}, {SYMBOL_COLUMN_N_COLUMNS, "SYMBOL_COLUMN_N_COLUMNS", "n-columns"}, {0, NULL, NULL}};
	GType symbol_column_type_id;
	symbol_column_type_id = g_enum_register_static ("SymbolColumn", values);
	return symbol_column_type_id;
}

GType
symbol_column_get_type (void)
{
	static gsize symbol_column_type_id__volatile = 0;
	if (g_once_init_enter (&symbol_column_type_id__volatile)) {
		GType symbol_column_type_id;
		symbol_column_type_id = symbol_column_get_type_once ();
		g_once_init_leave (&symbol_column_type_id__volatile, symbol_column_type_id);
	}
	return symbol_column_type_id__volatile;
}

static inline gpointer
symbols_get_instance_private (Symbols* self)
{
	return G_STRUCT_MEMBER_P (self, Symbols_private_offset);
}

static Symbols*
symbols_construct (GType object_type)
{
	Symbols * self = NULL;
	GtkListStore* _tmp0_;
	GeeHashMap* _tmp1_;
	self = (Symbols*) g_object_new (object_type, NULL);
	_tmp0_ = gtk_list_store_new ((gint) SYMBOLS_CATEGORY_COLUMN_N_COLUMNS, TYPE_SYMBOLS_CATEGORY_TYPE, G_TYPE_STRING, G_TYPE_STRING, gtk_tree_model_get_type (), -1);
	_g_object_unref0 (self->priv->_categories_store);
	self->priv->_categories_store = _tmp0_;
	_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, TYPE_NORMAL_SYMBOLS, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->_normal_symbols_map);
	self->priv->_normal_symbols_map = (GeeMap*) _tmp1_;
	{
		SymbolsCategoryInfo* info_collection = NULL;
		gint info_collection_length1 = 0;
		gint _info_collection_size_ = 0;
		gint info_it = 0;
		info_collection = SYMBOLS__normal_categories;
		info_collection_length1 = G_N_ELEMENTS (SYMBOLS__normal_categories);
		for (info_it = 0; info_it < info_collection_length1; info_it = info_it + 1) {
			SymbolsCategoryInfo _tmp2_;
			SymbolsCategoryInfo _tmp3_ = {0};
			SymbolsCategoryInfo info = {0};
			_tmp2_ = info_collection[info_it];
			symbols_category_info_copy (&_tmp2_, &_tmp3_);
			info = _tmp3_;
			{
				SymbolsCategoryInfo _tmp4_;
				_tmp4_ = info;
				symbols_add_normal_category (self, &_tmp4_);
				symbols_category_info_destroy (&info);
			}
		}
	}
	return self;
}

static Symbols*
symbols_new (void)
{
	return symbols_construct (TYPE_SYMBOLS);
}

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

Symbols*
symbols_get_default (void)
{
	Symbols* _tmp0_;
	Symbols* _tmp3_;
	Symbols* _tmp4_;
	Symbols* result = NULL;
	_tmp0_ = symbols__instance;
	if (_tmp0_ == NULL) {
		Symbols* _tmp1_;
		Symbols* _tmp2_;
		_tmp1_ = symbols_new ();
		_g_object_unref0 (symbols__instance);
		symbols__instance = _tmp1_;
		_tmp2_ = symbols__instance;
		symbols_add_most_used_category (_tmp2_);
	}
	_tmp3_ = symbols__instance;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	result = _tmp4_;
	return result;
}

GtkTreeModel*
symbols_get_categories_model (Symbols* self)
{
	GtkListStore* _tmp0_;
	GtkTreeModel* _tmp1_;
	GtkTreeModel* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_categories_store;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_tree_model_get_type ()) ? ((GtkTreeModel*) _tmp0_) : NULL);
	result = _tmp1_;
	return result;
}

gboolean
symbols_get_symbol_info (Symbols* self,
                         const gchar* id,
                         gchar** command,
                         gchar** tooltip)
{
	gchar* _vala_command = NULL;
	gchar* _vala_tooltip = NULL;
	gchar** id_components = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint id_components_length1;
	gint _id_components_size_;
	gchar* category_id = NULL;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* icon_file = NULL;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	GeeMap* _tmp6_;
	NormalSymbols* normal_symbols = NULL;
	GeeMap* _tmp7_;
	gpointer _tmp8_;
	gchar* package = NULL;
	gboolean ok = FALSE;
	gchar* _tmp9_ = NULL;
	gchar* _tmp10_ = NULL;
	gboolean _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (id != NULL, FALSE);
	_g_free0 (_vala_command);
	_vala_command = NULL;
	_g_free0 (_vala_tooltip);
	_vala_tooltip = NULL;
	_tmp1_ = _tmp0_ = g_strsplit (id, "/", 0);
	id_components = _tmp1_;
	id_components_length1 = _vala_array_length (_tmp0_);
	_id_components_size_ = id_components_length1;
	g_return_val_if_fail (id_components_length1 == 2, FALSE);
	_tmp2_ = id_components[0];
	_tmp3_ = g_strdup (_tmp2_);
	category_id = _tmp3_;
	_tmp4_ = id_components[1];
	_tmp5_ = g_strdup (_tmp4_);
	icon_file = _tmp5_;
	_tmp6_ = self->priv->_normal_symbols_map;
	g_return_val_if_fail (gee_map_has_key (_tmp6_, category_id), FALSE);
	_tmp7_ = self->priv->_normal_symbols_map;
	_tmp8_ = gee_map_get (_tmp7_, category_id);
	normal_symbols = (NormalSymbols*) _tmp8_;
	package = NULL;
	_tmp11_ = normal_symbols_get_symbol_info (normal_symbols, icon_file, &_tmp9_, &_tmp10_);
	_g_free0 (_vala_command);
	_vala_command = _tmp9_;
	_g_free0 (package);
	package = _tmp10_;
	ok = _tmp11_;
	g_return_val_if_fail (ok, FALSE);
	_tmp12_ = _vala_command;
	_tmp13_ = package;
	_tmp14_ = symbols_get_tooltip (_tmp12_, _tmp13_);
	_g_free0 (_vala_tooltip);
	_vala_tooltip = _tmp14_;
	result = TRUE;
	_g_free0 (package);
	_g_object_unref0 (normal_symbols);
	_g_free0 (icon_file);
	_g_free0 (category_id);
	id_components = (_vala_array_free (id_components, id_components_length1, (GDestroyNotify) g_free), NULL);
	if (command) {
		*command = _vala_command;
	} else {
		_g_free0 (_vala_command);
	}
	if (tooltip) {
		*tooltip = _vala_tooltip;
	} else {
		_g_free0 (_vala_tooltip);
	}
	return result;
}

static void
symbols_add_normal_category (Symbols* self,
                             SymbolsCategoryInfo* info)
{
	GtkListStore* store = NULL;
	SymbolsCategoryInfo _tmp0_;
	const gchar* _tmp1_;
	NormalSymbols* _tmp2_;
	GeeMap* _tmp3_;
	SymbolsCategoryInfo _tmp4_;
	const gchar* _tmp5_;
	GtkTreeIter iter = {0};
	GtkListStore* _tmp6_;
	GtkTreeIter _tmp7_ = {0};
	GtkListStore* _tmp8_;
	GtkTreeIter _tmp9_;
	SymbolsCategoryInfo _tmp10_;
	const gchar* _tmp11_;
	SymbolsCategoryInfo _tmp12_;
	const gchar* _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (info != NULL);
	_tmp0_ = *info;
	_tmp1_ = _tmp0_.id;
	_tmp2_ = normal_symbols_new (_tmp1_);
	store = (GtkListStore*) _tmp2_;
	_tmp3_ = self->priv->_normal_symbols_map;
	_tmp4_ = *info;
	_tmp5_ = _tmp4_.id;
	gee_map_set (_tmp3_, _tmp5_, IS_NORMAL_SYMBOLS (store) ? ((NormalSymbols*) store) : NULL);
	_tmp6_ = self->priv->_categories_store;
	gtk_list_store_append (_tmp6_, &_tmp7_);
	iter = _tmp7_;
	_tmp8_ = self->priv->_categories_store;
	_tmp9_ = iter;
	_tmp10_ = *info;
	_tmp11_ = _tmp10_.icon;
	_tmp12_ = *info;
	_tmp13_ = _tmp12_.name;
	gtk_list_store_set (_tmp8_, &_tmp9_, SYMBOLS_CATEGORY_COLUMN_TYPE, SYMBOLS_CATEGORY_TYPE_NORMAL, SYMBOLS_CATEGORY_COLUMN_ICON, _tmp11_, SYMBOLS_CATEGORY_COLUMN_NAME, _ (_tmp13_), SYMBOLS_CATEGORY_COLUMN_SYMBOLS_STORE, store, -1);
	_g_object_unref0 (store);
}

static void
symbols_add_most_used_category (Symbols* self)
{
	GtkTreeModel* model = NULL;
	MostUsedSymbols* _tmp0_;
	MostUsedSymbols* _tmp1_;
	GtkTreeModel* _tmp2_;
	GtkTreeModel* _tmp3_;
	GtkTreeIter iter = {0};
	GtkListStore* _tmp4_;
	GtkTreeIter _tmp5_ = {0};
	GtkListStore* _tmp6_;
	GtkTreeIter _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = most_used_symbols_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = most_used_symbols_get_model (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	model = _tmp3_;
	_tmp4_ = self->priv->_categories_store;
	gtk_list_store_append (_tmp4_, &_tmp5_);
	iter = _tmp5_;
	_tmp6_ = self->priv->_categories_store;
	_tmp7_ = iter;
	gtk_list_store_set (_tmp6_, &_tmp7_, SYMBOLS_CATEGORY_COLUMN_TYPE, SYMBOLS_CATEGORY_TYPE_MOST_USED, SYMBOLS_CATEGORY_COLUMN_ICON, "help-about", SYMBOLS_CATEGORY_COLUMN_NAME, _ ("Most Used"), SYMBOLS_CATEGORY_COLUMN_SYMBOLS_STORE, model, -1);
	_g_object_unref0 (model);
}

gchar*
symbols_get_tooltip (const gchar* latex_command,
                     const gchar* package_required)
{
	gchar* tooltip = NULL;
	gchar* _tmp0_;
	gchar* result = NULL;
	g_return_val_if_fail (latex_command != NULL, NULL);
	_tmp0_ = g_markup_escape_text (latex_command, (gssize) -1);
	tooltip = _tmp0_;
	if (package_required != NULL) {
		const gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp1_ = tooltip;
		_tmp2_ = g_strdup_printf (" (package %s)", package_required);
		_tmp3_ = _tmp2_;
		_tmp4_ = g_strconcat (_tmp1_, _tmp3_, NULL);
		_g_free0 (tooltip);
		tooltip = _tmp4_;
		_g_free0 (_tmp3_);
	}
	result = tooltip;
	return result;
}

GdkPixbuf*
symbols_get_pixbuf (const gchar* symbol_id)
{
	GError* _inner_error0_ = NULL;
	GdkPixbuf* result = NULL;
	g_return_val_if_fail (symbol_id != NULL, NULL);
	{
		GdkPixbuf* _tmp0_ = NULL;
		gchar* _tmp1_;
		gchar* _tmp2_;
		GdkPixbuf* _tmp3_;
		GdkPixbuf* _tmp4_;
		GdkPixbuf* _tmp5_;
		_tmp1_ = g_strconcat ("/org/gnome/gnome-latex/symbols/", symbol_id, NULL);
		_tmp2_ = _tmp1_;
		_tmp3_ = gdk_pixbuf_new_from_resource (_tmp2_, &_inner_error0_);
		_tmp4_ = _tmp3_;
		_g_free0 (_tmp2_);
		_tmp0_ = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp5_ = _tmp0_;
		_tmp0_ = NULL;
		result = _tmp5_;
		_g_object_unref0 (_tmp0_);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp6_;
		const gchar* _tmp7_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp6_ = e;
		_tmp7_ = _tmp6_->message;
		g_warning ("symbols.vala:185: Impossible to load the symbol '%s': %s", symbol_id, _tmp7_);
		result = NULL;
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static void
symbols_category_info_copy (const SymbolsCategoryInfo* self,
                            SymbolsCategoryInfo* dest)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	_tmp0_ = (*self).name;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).name);
	(*dest).name = _tmp1_;
	_tmp2_ = (*self).icon;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 ((*dest).icon);
	(*dest).icon = _tmp3_;
	_tmp4_ = (*self).id;
	_tmp5_ = g_strdup (_tmp4_);
	_g_free0 ((*dest).id);
	(*dest).id = _tmp5_;
}

static void
symbols_category_info_destroy (SymbolsCategoryInfo* self)
{
	_g_free0 ((*self).name);
	_g_free0 ((*self).icon);
	_g_free0 ((*self).id);
}

static SymbolsCategoryInfo*
symbols_category_info_dup (const SymbolsCategoryInfo* self)
{
	SymbolsCategoryInfo* dup;
	dup = g_new0 (SymbolsCategoryInfo, 1);
	symbols_category_info_copy (self, dup);
	return dup;
}

static void
symbols_category_info_free (SymbolsCategoryInfo* self)
{
	symbols_category_info_destroy (self);
	g_free (self);
}

 G_GNUC_NO_INLINE static GType
symbols_category_info_get_type_once (void)
{
	GType symbols_category_info_type_id;
	symbols_category_info_type_id = g_boxed_type_register_static ("SymbolsCategoryInfo", (GBoxedCopyFunc) symbols_category_info_dup, (GBoxedFreeFunc) symbols_category_info_free);
	return symbols_category_info_type_id;
}

static GType
symbols_category_info_get_type (void)
{
	static gsize symbols_category_info_type_id__volatile = 0;
	if (g_once_init_enter (&symbols_category_info_type_id__volatile)) {
		GType symbols_category_info_type_id;
		symbols_category_info_type_id = symbols_category_info_get_type_once ();
		g_once_init_leave (&symbols_category_info_type_id__volatile, symbols_category_info_type_id);
	}
	return symbols_category_info_type_id__volatile;
}

static void
symbols_class_init (SymbolsClass * klass,
                    gpointer klass_data)
{
	symbols_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &Symbols_private_offset);
	G_OBJECT_CLASS (klass)->finalize = symbols_finalize;
}

static void
symbols_instance_init (Symbols * self,
                       gpointer klass)
{
	self->priv = symbols_get_instance_private (self);
}

static void
symbols_finalize (GObject * obj)
{
	Symbols * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SYMBOLS, Symbols);
	_g_object_unref0 (self->priv->_categories_store);
	_g_object_unref0 (self->priv->_normal_symbols_map);
	G_OBJECT_CLASS (symbols_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
symbols_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SymbolsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) symbols_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Symbols), 0, (GInstanceInitFunc) symbols_instance_init, NULL };
	GType symbols_type_id;
	symbols_type_id = g_type_register_static (G_TYPE_OBJECT, "Symbols", &g_define_type_info, 0);
	Symbols_private_offset = g_type_add_instance_private (symbols_type_id, sizeof (SymbolsPrivate));
	return symbols_type_id;
}

GType
symbols_get_type (void)
{
	static gsize symbols_type_id__volatile = 0;
	if (g_once_init_enter (&symbols_type_id__volatile)) {
		GType symbols_type_id;
		symbols_type_id = symbols_get_type_once ();
		g_once_init_leave (&symbols_type_id__volatile, symbols_type_id);
	}
	return symbols_type_id__volatile;
}

static inline gpointer
normal_symbols_get_instance_private (NormalSymbols* self)
{
	return G_STRUCT_MEMBER_P (self, NormalSymbols_private_offset);
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

NormalSymbols*
normal_symbols_construct (GType object_type,
                          const gchar* category_id)
{
	NormalSymbols * self = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	GeeHashMap* _tmp3_;
	GType* column_types = NULL;
	GType* _tmp4_;
	gint column_types_length1;
	gint _column_types_size_;
	g_return_val_if_fail (category_id != NULL, NULL);
	self = (NormalSymbols*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (category_id);
	_g_free0 (self->priv->_category_id);
	self->priv->_category_id = _tmp0_;
	_tmp1_ = string_to_string (category_id);
	_tmp2_ = g_strconcat ("/org/gnome/gnome-latex/symbols/", _tmp1_, "/", NULL);
	_g_free0 (self->priv->_resource_path);
	self->priv->_resource_path = _tmp2_;
	_tmp3_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NORMAL_SYMBOLS_TYPE_SYMBOL_INFO, (GBoxedCopyFunc) normal_symbols_symbol_info_dup, (GDestroyNotify) normal_symbols_symbol_info_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->_data);
	self->priv->_data = (GeeMap*) _tmp3_;
	_tmp4_ = g_new0 (GType, 4);
	_tmp4_[0] = gdk_pixbuf_get_type ();
	_tmp4_[1] = G_TYPE_STRING;
	_tmp4_[2] = G_TYPE_STRING;
	_tmp4_[3] = G_TYPE_STRING;
	column_types = _tmp4_;
	column_types_length1 = 4;
	_column_types_size_ = column_types_length1;
	gtk_list_store_set_column_types ((GtkListStore*) self, (gint) column_types_length1, column_types);
	normal_symbols_load_symbols (self);
	column_types = (g_free (column_types), NULL);
	return self;
}

NormalSymbols*
normal_symbols_new (const gchar* category_id)
{
	return normal_symbols_construct (TYPE_NORMAL_SYMBOLS, category_id);
}

gboolean
normal_symbols_get_symbol_info (NormalSymbols* self,
                                const gchar* icon_file,
                                gchar** command,
                                gchar** package)
{
	gchar* _vala_command = NULL;
	gchar* _vala_package = NULL;
	GeeMap* _tmp0_;
	NormalSymbolsSymbolInfo info = {0};
	GeeMap* _tmp1_;
	gpointer _tmp2_;
	NormalSymbolsSymbolInfo* _tmp3_;
	NormalSymbolsSymbolInfo _tmp4_;
	NormalSymbolsSymbolInfo _tmp5_ = {0};
	NormalSymbolsSymbolInfo _tmp6_;
	NormalSymbolsSymbolInfo _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	NormalSymbolsSymbolInfo _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (icon_file != NULL, FALSE);
	_g_free0 (_vala_command);
	_vala_command = NULL;
	_g_free0 (_vala_package);
	_vala_package = NULL;
	_tmp0_ = self->priv->_data;
	if (!gee_map_has_key (_tmp0_, icon_file)) {
		result = FALSE;
		if (command) {
			*command = _vala_command;
		} else {
			_g_free0 (_vala_command);
		}
		if (package) {
			*package = _vala_package;
		} else {
			_g_free0 (_vala_package);
		}
		return result;
	}
	_tmp1_ = self->priv->_data;
	_tmp2_ = gee_map_get (_tmp1_, icon_file);
	_tmp3_ = (NormalSymbolsSymbolInfo*) _tmp2_;
	_tmp4_ = *_tmp3_;
	normal_symbols_symbol_info_copy (&_tmp4_, &_tmp5_);
	_tmp6_ = _tmp5_;
	_normal_symbols_symbol_info_free0 (_tmp3_);
	info = _tmp6_;
	_tmp7_ = info;
	_tmp8_ = _tmp7_.latex_command;
	_tmp9_ = g_strdup (_tmp8_);
	_g_free0 (_vala_command);
	_vala_command = _tmp9_;
	_tmp10_ = info;
	_tmp11_ = _tmp10_.package_required;
	_tmp12_ = g_strdup (_tmp11_);
	_g_free0 (_vala_package);
	_vala_package = _tmp12_;
	result = TRUE;
	normal_symbols_symbol_info_destroy (&info);
	if (command) {
		*command = _vala_command;
	} else {
		_g_free0 (_vala_command);
	}
	if (package) {
		*package = _vala_package;
	} else {
		_g_free0 (_vala_package);
	}
	return result;
}

static void
_normal_symbols_parser_start_gmarkup_parser_start_element_func (GMarkupParseContext* context,
                                                                const gchar* element_name,
                                                                gchar** attribute_names,
                                                                gchar** attribute_values,
                                                                gpointer self,
                                                                GError** error)
{
	normal_symbols_parser_start ((NormalSymbols*) self, context, element_name, attribute_names, _vala_array_length (attribute_names), attribute_values, _vala_array_length (attribute_values), error);
}

static void
normal_symbols_load_symbols (NormalSymbols* self)
{
	const gchar* contents = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_resource_path;
	_tmp1_ = g_strconcat (_tmp0_, "data.xml", NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = utils_get_string_from_resource (_tmp2_);
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp2_);
	contents = _tmp4_;
	_tmp5_ = contents;
	if (_tmp5_ == NULL) {
		return;
	}
	{
		GMarkupParser parser = {0};
		GMarkupParser _tmp6_ = {0};
		GMarkupParseContext* context = NULL;
		GMarkupParser _tmp7_;
		GMarkupParseContext* _tmp8_;
		GMarkupParseContext* _tmp9_;
		const gchar* _tmp10_;
		_tmp6_.start_element = _normal_symbols_parser_start_gmarkup_parser_start_element_func;
		_tmp6_.end_element = NULL;
		_tmp6_.text = NULL;
		_tmp6_.passthrough = NULL;
		_tmp6_.error = NULL;
		parser = _tmp6_;
		_tmp7_ = parser;
		_tmp8_ = g_markup_parse_context_new (&_tmp7_, 0, self, NULL);
		context = _tmp8_;
		_tmp9_ = context;
		_tmp10_ = contents;
		g_markup_parse_context_parse (_tmp9_, _tmp10_, (gssize) -1, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_markup_parse_context_unref0 (context);
			goto __catch0_g_error;
		}
		_g_markup_parse_context_unref0 (context);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp11_;
		const gchar* _tmp12_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp11_ = e;
		_tmp12_ = _tmp11_->message;
		g_warning ("symbols.vala:255: Impossible to load the symbols: %s", _tmp12_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
normal_symbols_add_symbol (NormalSymbols* self,
                           const gchar* icon_file,
                           NormalSymbolsSymbolInfo* symbol)
{
	GeeMap* _tmp0_;
	NormalSymbolsSymbolInfo _tmp1_;
	gchar* tooltip = NULL;
	NormalSymbolsSymbolInfo _tmp2_;
	const gchar* _tmp3_;
	NormalSymbolsSymbolInfo _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* id = NULL;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	GdkPixbuf* pixbuf = NULL;
	const gchar* _tmp9_;
	GdkPixbuf* _tmp10_;
	GdkPixbuf* _tmp11_;
	GtkTreeIter iter = {0};
	GtkTreeIter _tmp12_ = {0};
	GtkTreeIter _tmp13_;
	GdkPixbuf* _tmp14_;
	NormalSymbolsSymbolInfo _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (icon_file != NULL);
	g_return_if_fail (symbol != NULL);
	_tmp0_ = self->priv->_data;
	_tmp1_ = *symbol;
	gee_map_set (_tmp0_, icon_file, &_tmp1_);
	_tmp2_ = *symbol;
	_tmp3_ = _tmp2_.latex_command;
	_tmp4_ = *symbol;
	_tmp5_ = _tmp4_.package_required;
	_tmp6_ = symbols_get_tooltip (_tmp3_, _tmp5_);
	tooltip = _tmp6_;
	_tmp7_ = self->priv->_category_id;
	_tmp8_ = g_strdup_printf ("%s/%s", _tmp7_, icon_file);
	id = _tmp8_;
	_tmp9_ = id;
	_tmp10_ = symbols_get_pixbuf (_tmp9_);
	pixbuf = _tmp10_;
	_tmp11_ = pixbuf;
	if (_tmp11_ == NULL) {
		_g_object_unref0 (pixbuf);
		_g_free0 (id);
		_g_free0 (tooltip);
		return;
	}
	gtk_list_store_append ((GtkListStore*) self, &_tmp12_);
	iter = _tmp12_;
	_tmp13_ = iter;
	_tmp14_ = pixbuf;
	_tmp15_ = *symbol;
	_tmp16_ = _tmp15_.latex_command;
	_tmp17_ = tooltip;
	_tmp18_ = id;
	gtk_list_store_set ((GtkListStore*) self, &_tmp13_, SYMBOL_COLUMN_PIXBUF, _tmp14_, SYMBOL_COLUMN_COMMAND, _tmp16_, SYMBOL_COLUMN_TOOLTIP, _tmp17_, SYMBOL_COLUMN_ID, _tmp18_, -1);
	_g_object_unref0 (pixbuf);
	_g_free0 (id);
	_g_free0 (tooltip);
}

static void
normal_symbols_parser_start (NormalSymbols* self,
                             GMarkupParseContext* context,
                             const gchar* name,
                             gchar** attr_names,
                             gint attr_names_length1,
                             gchar** attr_values,
                             gint attr_values_length1,
                             GError** error)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = name;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("symbols")))) {
		switch (0) {
			default:
			{
				return;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("symbol")))) {
		switch (0) {
			default:
			{
				NormalSymbolsSymbolInfo symbol = {0};
				gchar* icon_file = NULL;
				const gchar* _tmp22_;
				NormalSymbolsSymbolInfo _tmp23_;
				memset (&symbol, 0, sizeof (NormalSymbolsSymbolInfo));
				_g_free0 (symbol.package_required);
				symbol.package_required = NULL;
				icon_file = NULL;
				{
					gint i = 0;
					i = 0;
					{
						gboolean _tmp3_ = FALSE;
						_tmp3_ = TRUE;
						while (TRUE) {
							const gchar* _tmp5_;
							const gchar* _tmp6_;
							GQuark _tmp8_ = 0U;
							static GQuark _tmp7_label0 = 0;
							static GQuark _tmp7_label1 = 0;
							static GQuark _tmp7_label2 = 0;
							if (!_tmp3_) {
								gint _tmp4_;
								_tmp4_ = i;
								i = _tmp4_ + 1;
							}
							_tmp3_ = FALSE;
							if (!(i < attr_names_length1)) {
								break;
							}
							_tmp5_ = attr_names[i];
							_tmp6_ = _tmp5_;
							_tmp8_ = (NULL == _tmp6_) ? 0 : g_quark_from_string (_tmp6_);
							if (_tmp8_ == ((0 != _tmp7_label0) ? _tmp7_label0 : (_tmp7_label0 = g_quark_from_static_string ("file")))) {
								switch (0) {
									default:
									{
										const gchar* _tmp9_;
										gchar* _tmp10_;
										_tmp9_ = attr_values[i];
										_tmp10_ = g_strdup (_tmp9_);
										_g_free0 (icon_file);
										icon_file = _tmp10_;
										break;
									}
								}
							} else if (_tmp8_ == ((0 != _tmp7_label1) ? _tmp7_label1 : (_tmp7_label1 = g_quark_from_static_string ("command")))) {
								switch (0) {
									default:
									{
										const gchar* _tmp11_;
										gchar* _tmp12_;
										_tmp11_ = attr_values[i];
										_tmp12_ = g_strdup (_tmp11_);
										_g_free0 (symbol.latex_command);
										symbol.latex_command = _tmp12_;
										break;
									}
								}
							} else if (_tmp8_ == ((0 != _tmp7_label2) ? _tmp7_label2 : (_tmp7_label2 = g_quark_from_static_string ("package")))) {
								switch (0) {
									default:
									{
										const gchar* _tmp13_;
										gchar* _tmp14_;
										_tmp13_ = attr_values[i];
										_tmp14_ = g_strdup (_tmp13_);
										_g_free0 (symbol.package_required);
										symbol.package_required = _tmp14_;
										break;
									}
								}
							} else {
								switch (0) {
									default:
									{
										const gchar* _tmp15_;
										gchar* _tmp16_;
										gchar* _tmp17_;
										gchar* _tmp18_;
										gchar* _tmp19_;
										GError* _tmp20_;
										GError* _tmp21_;
										_tmp15_ = attr_names[i];
										_tmp16_ = g_strconcat ("unknown attribute \"", _tmp15_, NULL);
										_tmp17_ = _tmp16_;
										_tmp18_ = g_strconcat (_tmp17_, "\"", NULL);
										_tmp19_ = _tmp18_;
										_tmp20_ = g_error_new_literal (G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, _tmp19_);
										_tmp21_ = _tmp20_;
										_g_free0 (_tmp19_);
										_g_free0 (_tmp17_);
										_inner_error0_ = _tmp21_;
										if (_inner_error0_->domain == G_MARKUP_ERROR) {
											g_propagate_error (error, _inner_error0_);
											_g_free0 (icon_file);
											normal_symbols_symbol_info_destroy (&symbol);
											return;
										} else {
											_g_free0 (icon_file);
											normal_symbols_symbol_info_destroy (&symbol);
											g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
											g_clear_error (&_inner_error0_);
											return;
										}
									}
								}
							}
						}
					}
				}
				_tmp22_ = icon_file;
				_tmp23_ = symbol;
				normal_symbols_add_symbol (self, _tmp22_, &_tmp23_);
				_g_free0 (icon_file);
				normal_symbols_symbol_info_destroy (&symbol);
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				gchar* _tmp24_;
				gchar* _tmp25_;
				gchar* _tmp26_;
				gchar* _tmp27_;
				GError* _tmp28_;
				GError* _tmp29_;
				_tmp24_ = g_strconcat ("unknown element \"", name, NULL);
				_tmp25_ = _tmp24_;
				_tmp26_ = g_strconcat (_tmp25_, "\"", NULL);
				_tmp27_ = _tmp26_;
				_tmp28_ = g_error_new_literal (G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, _tmp27_);
				_tmp29_ = _tmp28_;
				_g_free0 (_tmp27_);
				_g_free0 (_tmp25_);
				_inner_error0_ = _tmp29_;
				if (_inner_error0_->domain == G_MARKUP_ERROR) {
					g_propagate_error (error, _inner_error0_);
					return;
				} else {
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
					g_clear_error (&_inner_error0_);
					return;
				}
			}
		}
	}
}

static void
normal_symbols_symbol_info_copy (const NormalSymbolsSymbolInfo* self,
                                 NormalSymbolsSymbolInfo* dest)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	_tmp0_ = (*self).latex_command;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).latex_command);
	(*dest).latex_command = _tmp1_;
	_tmp2_ = (*self).package_required;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 ((*dest).package_required);
	(*dest).package_required = _tmp3_;
}

static void
normal_symbols_symbol_info_destroy (NormalSymbolsSymbolInfo* self)
{
	_g_free0 ((*self).latex_command);
	_g_free0 ((*self).package_required);
}

static NormalSymbolsSymbolInfo*
normal_symbols_symbol_info_dup (const NormalSymbolsSymbolInfo* self)
{
	NormalSymbolsSymbolInfo* dup;
	dup = g_new0 (NormalSymbolsSymbolInfo, 1);
	normal_symbols_symbol_info_copy (self, dup);
	return dup;
}

static void
normal_symbols_symbol_info_free (NormalSymbolsSymbolInfo* self)
{
	normal_symbols_symbol_info_destroy (self);
	g_free (self);
}

 G_GNUC_NO_INLINE static GType
normal_symbols_symbol_info_get_type_once (void)
{
	GType normal_symbols_symbol_info_type_id;
	normal_symbols_symbol_info_type_id = g_boxed_type_register_static ("NormalSymbolsSymbolInfo", (GBoxedCopyFunc) normal_symbols_symbol_info_dup, (GBoxedFreeFunc) normal_symbols_symbol_info_free);
	return normal_symbols_symbol_info_type_id;
}

static GType
normal_symbols_symbol_info_get_type (void)
{
	static gsize normal_symbols_symbol_info_type_id__volatile = 0;
	if (g_once_init_enter (&normal_symbols_symbol_info_type_id__volatile)) {
		GType normal_symbols_symbol_info_type_id;
		normal_symbols_symbol_info_type_id = normal_symbols_symbol_info_get_type_once ();
		g_once_init_leave (&normal_symbols_symbol_info_type_id__volatile, normal_symbols_symbol_info_type_id);
	}
	return normal_symbols_symbol_info_type_id__volatile;
}

static void
normal_symbols_class_init (NormalSymbolsClass * klass,
                           gpointer klass_data)
{
	normal_symbols_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &NormalSymbols_private_offset);
	G_OBJECT_CLASS (klass)->finalize = normal_symbols_finalize;
}

static void
normal_symbols_instance_init (NormalSymbols * self,
                              gpointer klass)
{
	self->priv = normal_symbols_get_instance_private (self);
}

static void
normal_symbols_finalize (GObject * obj)
{
	NormalSymbols * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_NORMAL_SYMBOLS, NormalSymbols);
	_g_free0 (self->priv->_category_id);
	_g_free0 (self->priv->_resource_path);
	_g_object_unref0 (self->priv->_data);
	G_OBJECT_CLASS (normal_symbols_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
normal_symbols_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (NormalSymbolsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) normal_symbols_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (NormalSymbols), 0, (GInstanceInitFunc) normal_symbols_instance_init, NULL };
	GType normal_symbols_type_id;
	normal_symbols_type_id = g_type_register_static (gtk_list_store_get_type (), "NormalSymbols", &g_define_type_info, 0);
	NormalSymbols_private_offset = g_type_add_instance_private (normal_symbols_type_id, sizeof (NormalSymbolsPrivate));
	return normal_symbols_type_id;
}

GType
normal_symbols_get_type (void)
{
	static gsize normal_symbols_type_id__volatile = 0;
	if (g_once_init_enter (&normal_symbols_type_id__volatile)) {
		GType normal_symbols_type_id;
		normal_symbols_type_id = normal_symbols_get_type_once ();
		g_once_init_leave (&normal_symbols_type_id__volatile, normal_symbols_type_id);
	}
	return normal_symbols_type_id__volatile;
}

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

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

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

