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


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


#define TYPE_ITEM_PREFERENCES (item_preferences_get_type ())
#define ITEM_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ITEM_PREFERENCES, ItemPreferences))
#define ITEM_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ITEM_PREFERENCES, ItemPreferencesClass))
#define IS_ITEM_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ITEM_PREFERENCES))
#define IS_ITEM_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ITEM_PREFERENCES))
#define ITEM_PREFERENCES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ITEM_PREFERENCES, ItemPreferencesClass))

typedef struct _ItemPreferences ItemPreferences;
typedef struct _ItemPreferencesClass ItemPreferencesClass;
typedef struct _ItemPreferencesPrivate ItemPreferencesPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL)))

#define TYPE_SETTINGS_CACHE (settings_cache_get_type ())
#define SETTINGS_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS_CACHE, SettingsCache))
#define SETTINGS_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SETTINGS_CACHE, SettingsCacheClass))
#define IS_SETTINGS_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SETTINGS_CACHE))
#define IS_SETTINGS_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SETTINGS_CACHE))
#define SETTINGS_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SETTINGS_CACHE, SettingsCacheClass))

typedef struct _SettingsCache SettingsCache;
typedef struct _SettingsCacheClass SettingsCacheClass;

struct _ItemPreferences {
	GObject parent_instance;
	ItemPreferencesPrivate * priv;
};

struct _ItemPreferencesClass {
	GObjectClass parent_class;
};

struct _ItemPreferencesPrivate {
	GSettings* itemsettings;
	GtkDialog* items;
	GtkListStore* itemstore;
	GtkTreeView* itemview;
	GtkTreeSelection* itemselection;
	GtkButton* itemadd;
	GtkButton* itemremove;
	GtkButton* itemedit;
	GtkButton* itemup;
	GtkButton* itemdown;
	gboolean itemsignoresignals;
	gchar* _settingskey;
};


static gpointer item_preferences_parent_class = NULL;

GType item_preferences_get_type (void) G_GNUC_CONST;
#define ITEM_PREFERENCES_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_ITEM_PREFERENCES, ItemPreferencesPrivate))
enum  {
	ITEM_PREFERENCES_DUMMY_PROPERTY,
	ITEM_PREFERENCES_SETTINGSKEY
};
ItemPreferences* item_preferences_new (const gchar* settingskey);
ItemPreferences* item_preferences_construct (GType object_type, const gchar* settingskey);
void item_preferences_show (ItemPreferences* self);
GObject* utils_get_ui (const gchar* objectid, GObject* signalhandlers, gchar** additional, int additional_length1, GtkBuilder** builder);
static void item_preferences_itemsgsettingstostore (ItemPreferences* self);
void item_preferences_reset_itemstore (ItemPreferences* self);
void item_preferences_on_itemdialog_destroy (GtkWidget* source, ItemPreferences* self);
void item_preferences_on_itemdialog_response (GtkDialog* source, gint response, ItemPreferences* self);
const gchar* item_preferences_get_settingskey (ItemPreferences* self);
void item_preferences_on_expressionrenderer_edited (GtkCellRendererText* renderer, const gchar* path, const gchar* new_text, ItemPreferences* self);
void item_preferences_on_itemselection_changed (GtkTreeSelection* selection, ItemPreferences* self);
static void item_preferences_updatebuttons (ItemPreferences* self);
void item_preferences_on_itemstore_row_inserted (GtkTreeModel* model, const gchar* path, GtkTreeIter* iter, ItemPreferences* self);
static void item_preferences_itemsstoretogsettings (ItemPreferences* self);
void item_preferences_on_itemstore_row_changed (GtkTreeModel* model, const gchar* path, GtkTreeIter* iter, ItemPreferences* self);
void item_preferences_on_itemstore_row_deleted (GtkTreeModel* model, const gchar* path, ItemPreferences* self);
void item_preferences_on_itemadd_clicked (GtkButton* button, ItemPreferences* self);
static gint* _vala_array_dup16 (gint* self, int length);
void item_preferences_on_itemremove_clicked (GtkButton* button, ItemPreferences* self);
void item_preferences_on_itemedit_clicked (GtkButton* button, ItemPreferences* self);
void item_preferences_on_itemup_clicked (GtkButton* button, ItemPreferences* self);
void item_preferences_on_itemdown_clicked (GtkButton* button, ItemPreferences* self);
static gint* _vala_array_dup17 (gint* self, int length);
static void item_preferences_set_settingskey (ItemPreferences* self, const gchar* value);
static GObject * item_preferences_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
SettingsCache* settings_cache_new (void);
SettingsCache* settings_cache_construct (GType object_type);
GType settings_cache_get_type (void) G_GNUC_CONST;
GSettings* settings_cache_generalsettings (SettingsCache* self);
static void _item_preferences_reset_itemstore_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void item_preferences_finalize (GObject* obj);
static void _vala_item_preferences_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_item_preferences_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
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);


ItemPreferences* item_preferences_construct (GType object_type, const gchar* settingskey) {
	ItemPreferences * self = NULL;
	const gchar* _tmp0_ = NULL;
	g_return_val_if_fail (settingskey != NULL, NULL);
	_tmp0_ = settingskey;
	self = (ItemPreferences*) g_object_new (object_type, "settingskey", _tmp0_, NULL);
	return self;
}


ItemPreferences* item_preferences_new (const gchar* settingskey) {
	return item_preferences_construct (TYPE_ITEM_PREFERENCES, settingskey);
}


void item_preferences_show (ItemPreferences* self) {
	GtkDialog* _tmp0_ = NULL;
	GtkBuilder* builder = NULL;
	gchar* _tmp2_ = NULL;
	gchar** _tmp3_ = NULL;
	gchar** _tmp4_ = NULL;
	gint _tmp4__length1 = 0;
	GtkBuilder* _tmp5_ = NULL;
	GObject* _tmp6_ = NULL;
	GtkDialog* _tmp7_ = NULL;
	GtkDialog* _tmp8_ = NULL;
	GtkBuilder* _tmp9_ = NULL;
	GObject* _tmp10_ = NULL;
	GtkBuilder* _tmp11_ = NULL;
	GObject* _tmp12_ = NULL;
	GtkBuilder* _tmp13_ = NULL;
	GObject* _tmp14_ = NULL;
	GtkBuilder* _tmp15_ = NULL;
	GObject* _tmp16_ = NULL;
	GtkBuilder* _tmp17_ = NULL;
	GObject* _tmp18_ = NULL;
	GtkBuilder* _tmp19_ = NULL;
	GObject* _tmp20_ = NULL;
	GtkBuilder* _tmp21_ = NULL;
	GObject* _tmp22_ = NULL;
	GtkBuilder* _tmp23_ = NULL;
	GObject* _tmp24_ = NULL;
	GtkTreeSelection* _tmp25_ = NULL;
	GtkTreeSelection* _tmp26_ = NULL;
	GtkTreePath* _tmp27_ = NULL;
	GtkTreePath* _tmp28_ = NULL;
	GtkDialog* _tmp29_ = NULL;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	_tmp0_ = self->priv->items;
	if (_tmp0_ != NULL) {
		GtkDialog* _tmp1_ = NULL;
		_tmp1_ = self->priv->items;
		gtk_window_present (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GTK_TYPE_WINDOW, GtkWindow));
		return;
	}
	_tmp2_ = g_strdup ("itemstore");
	_tmp3_ = g_new0 (gchar*, 1 + 1);
	_tmp3_[0] = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp4__length1 = 1;
	_tmp6_ = utils_get_ui ("itemdialog", G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject), _tmp4_, 1, &_tmp5_);
	_g_object_unref0 (builder);
	builder = _tmp5_;
	_tmp7_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, GTK_TYPE_DIALOG) ? ((GtkDialog*) _tmp6_) : NULL;
	if (_tmp7_ == NULL) {
		_g_object_unref0 (_tmp6_);
	}
	_g_object_unref0 (self->priv->items);
	self->priv->items = _tmp7_;
	_tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (GDestroyNotify) g_free), NULL);
	_tmp8_ = self->priv->items;
	g_return_if_fail (_tmp8_ != NULL);
	_tmp9_ = builder;
	_tmp10_ = gtk_builder_get_object (_tmp9_, "itemstore");
	self->priv->itemstore = G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, GTK_TYPE_LIST_STORE) ? ((GtkListStore*) _tmp10_) : NULL;
	_tmp11_ = builder;
	_tmp12_ = gtk_builder_get_object (_tmp11_, "itemview");
	self->priv->itemview = G_TYPE_CHECK_INSTANCE_TYPE (_tmp12_, GTK_TYPE_TREE_VIEW) ? ((GtkTreeView*) _tmp12_) : NULL;
	_tmp13_ = builder;
	_tmp14_ = gtk_builder_get_object (_tmp13_, "itemadd");
	self->priv->itemadd = G_TYPE_CHECK_INSTANCE_TYPE (_tmp14_, GTK_TYPE_BUTTON) ? ((GtkButton*) _tmp14_) : NULL;
	_tmp15_ = builder;
	_tmp16_ = gtk_builder_get_object (_tmp15_, "itemremove");
	self->priv->itemremove = G_TYPE_CHECK_INSTANCE_TYPE (_tmp16_, GTK_TYPE_BUTTON) ? ((GtkButton*) _tmp16_) : NULL;
	_tmp17_ = builder;
	_tmp18_ = gtk_builder_get_object (_tmp17_, "itemedit");
	self->priv->itemedit = G_TYPE_CHECK_INSTANCE_TYPE (_tmp18_, GTK_TYPE_BUTTON) ? ((GtkButton*) _tmp18_) : NULL;
	_tmp19_ = builder;
	_tmp20_ = gtk_builder_get_object (_tmp19_, "itemup");
	self->priv->itemup = G_TYPE_CHECK_INSTANCE_TYPE (_tmp20_, GTK_TYPE_BUTTON) ? ((GtkButton*) _tmp20_) : NULL;
	_tmp21_ = builder;
	_tmp22_ = gtk_builder_get_object (_tmp21_, "itemdown");
	self->priv->itemdown = G_TYPE_CHECK_INSTANCE_TYPE (_tmp22_, GTK_TYPE_BUTTON) ? ((GtkButton*) _tmp22_) : NULL;
	_tmp23_ = builder;
	_tmp24_ = gtk_builder_get_object (_tmp23_, "itemview");
	_tmp25_ = gtk_tree_view_get_selection (G_TYPE_CHECK_INSTANCE_TYPE (_tmp24_, GTK_TYPE_TREE_VIEW) ? ((GtkTreeView*) _tmp24_) : NULL);
	self->priv->itemselection = _tmp25_;
	item_preferences_itemsgsettingstostore (self);
	_tmp26_ = self->priv->itemselection;
	_tmp27_ = gtk_tree_path_new_from_indices (0, -1);
	_tmp28_ = _tmp27_;
	gtk_tree_selection_select_path (_tmp26_, _tmp28_);
	_gtk_tree_path_free0 (_tmp28_);
	_tmp29_ = self->priv->items;
	gtk_widget_show_all (G_TYPE_CHECK_INSTANCE_CAST (_tmp29_, GTK_TYPE_WIDGET, GtkWidget));
	_g_object_unref0 (builder);
}


void item_preferences_reset_itemstore (ItemPreferences* self) {
	gboolean _tmp0_ = FALSE;
	GtkDialog* _tmp1_ = NULL;
	gboolean _tmp3_ = FALSE;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	_tmp1_ = self->priv->items;
	if (_tmp1_ != NULL) {
		gboolean _tmp2_ = FALSE;
		_tmp2_ = self->priv->itemsignoresignals;
		_tmp0_ = !_tmp2_;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp3_ = _tmp0_;
	if (_tmp3_) {
		item_preferences_itemsgsettingstostore (self);
	}
}


void item_preferences_on_itemdialog_destroy (GtkWidget* source, ItemPreferences* self) {
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_WIDGET (source));
	_g_object_unref0 (self->priv->items);
	self->priv->items = NULL;
}


void item_preferences_on_itemdialog_response (GtkDialog* source, gint response, ItemPreferences* self) {
	gint _tmp0_ = 0;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_DIALOG (source));
	_tmp0_ = response;
	switch (_tmp0_) {
		case 0:
		{
			GtkDialog* _tmp1_ = NULL;
			_tmp1_ = source;
			gtk_widget_destroy (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GTK_TYPE_WIDGET, GtkWidget));
			return;
		}
		case 1:
		{
			GSettings* _tmp2_ = NULL;
			const gchar* _tmp3_ = NULL;
			GtkTreeSelection* _tmp4_ = NULL;
			GtkTreePath* _tmp5_ = NULL;
			GtkTreePath* _tmp6_ = NULL;
			_tmp2_ = self->priv->itemsettings;
			_tmp3_ = self->priv->_settingskey;
			g_settings_reset (_tmp2_, _tmp3_);
			_tmp4_ = self->priv->itemselection;
			_tmp5_ = gtk_tree_path_new_from_indices (0, -1);
			_tmp6_ = _tmp5_;
			gtk_tree_selection_select_path (_tmp4_, _tmp6_);
			_gtk_tree_path_free0 (_tmp6_);
			return;
		}
		case 2:
		{
			g_signal_emit_by_name (self, "itemhelp-show");
			return;
		}
		default:
		break;
	}
}


void item_preferences_on_expressionrenderer_edited (GtkCellRendererText* renderer, const gchar* path, const gchar* new_text, ItemPreferences* self) {
	GtkTreeIter iter = {0};
	GtkListStore* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	GtkTreeIter _tmp2_ = {0};
	GtkListStore* _tmp3_ = NULL;
	GtkTreeIter _tmp4_ = {0};
	const gchar* _tmp5_ = NULL;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_CELL_RENDERER_TEXT (renderer));
	g_return_if_fail (path != NULL);
	g_return_if_fail (new_text != NULL);
	_tmp0_ = self->priv->itemstore;
	_tmp1_ = path;
	gtk_tree_model_get_iter_from_string (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp2_, _tmp1_);
	iter = _tmp2_;
	_tmp3_ = self->priv->itemstore;
	_tmp4_ = iter;
	_tmp5_ = new_text;
	gtk_list_store_set (_tmp3_, &_tmp4_, 0, _tmp5_, -1);
}


void item_preferences_on_itemselection_changed (GtkTreeSelection* selection, ItemPreferences* self) {
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
	item_preferences_updatebuttons (self);
}


void item_preferences_on_itemstore_row_inserted (GtkTreeModel* model, const gchar* path, GtkTreeIter* iter, ItemPreferences* self) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_TREE_MODEL (model));
	g_return_if_fail (path != NULL);
	g_return_if_fail (iter != NULL);
	_tmp0_ = self->priv->itemsignoresignals;
	if (!_tmp0_) {
		item_preferences_itemsstoretogsettings (self);
	}
}


void item_preferences_on_itemstore_row_changed (GtkTreeModel* model, const gchar* path, GtkTreeIter* iter, ItemPreferences* self) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_TREE_MODEL (model));
	g_return_if_fail (path != NULL);
	g_return_if_fail (iter != NULL);
	_tmp0_ = self->priv->itemsignoresignals;
	if (!_tmp0_) {
		item_preferences_itemsstoretogsettings (self);
	}
}


void item_preferences_on_itemstore_row_deleted (GtkTreeModel* model, const gchar* path, ItemPreferences* self) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_TREE_MODEL (model));
	g_return_if_fail (path != NULL);
	_tmp0_ = self->priv->itemsignoresignals;
	if (!_tmp0_) {
		item_preferences_itemsstoretogsettings (self);
	}
}


static gint* _vala_array_dup16 (gint* self, int length) {
	return g_memdup (self, length * sizeof (gint));
}


void item_preferences_on_itemadd_clicked (GtkButton* button, ItemPreferences* self) {
	guint pos = 0U;
	GtkTreeIter iter = {0};
	GtkTreeSelection* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	gboolean _tmp2_ = FALSE;
	GtkListStore* _tmp12_ = NULL;
	guint _tmp13_ = 0U;
	GtkTreeIter _tmp14_ = {0};
	GtkTreeView* _tmp15_ = NULL;
	GtkTreeView* _tmp16_ = NULL;
	GtkListStore* _tmp17_ = NULL;
	GtkTreeIter _tmp18_ = {0};
	GtkTreePath* _tmp19_ = NULL;
	GtkTreePath* _tmp20_ = NULL;
	GtkTreeView* _tmp21_ = NULL;
	GtkTreeViewColumn* _tmp22_ = NULL;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_BUTTON (button));
	pos = (guint) 0;
	_tmp0_ = self->priv->itemselection;
	_tmp2_ = gtk_tree_selection_get_selected (_tmp0_, NULL, &_tmp1_);
	iter = _tmp1_;
	if (_tmp2_) {
		GtkTreePath* path = NULL;
		GtkListStore* _tmp3_ = NULL;
		GtkTreeIter _tmp4_ = {0};
		GtkTreePath* _tmp5_ = NULL;
		gint* indices = NULL;
		GtkTreePath* _tmp6_ = NULL;
		gint _tmp7_ = 0;
		gint* _tmp8_ = NULL;
		gint* _tmp9_ = NULL;
		gint _tmp9__length1 = 0;
		gint indices_length1 = 0;
		gint _indices_size_ = 0;
		gint* _tmp10_ = NULL;
		gint _tmp10__length1 = 0;
		gint _tmp11_ = 0;
		_tmp3_ = self->priv->itemstore;
		_tmp4_ = iter;
		_tmp5_ = gtk_tree_model_get_path (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp4_);
		path = _tmp5_;
		_tmp6_ = path;
		_tmp8_ = gtk_tree_path_get_indices_with_depth (_tmp6_, &_tmp7_);
		_tmp9_ = (_tmp8_ != NULL) ? _vala_array_dup16 (_tmp8_, _tmp7_) : ((gpointer) _tmp8_);
		_tmp9__length1 = _tmp7_;
		indices = _tmp9_;
		indices_length1 = _tmp9__length1;
		_indices_size_ = indices_length1;
		_tmp10_ = indices;
		_tmp10__length1 = indices_length1;
		_tmp11_ = _tmp10_[0];
		pos = (guint) (_tmp11_ + 1);
		indices = (g_free (indices), NULL);
		_gtk_tree_path_free0 (path);
	}
	_tmp12_ = self->priv->itemstore;
	_tmp13_ = pos;
	gtk_list_store_insert (_tmp12_, &_tmp14_, (gint) _tmp13_);
	iter = _tmp14_;
	_tmp15_ = self->priv->itemview;
	gtk_widget_grab_focus (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, GTK_TYPE_WIDGET, GtkWidget));
	_tmp16_ = self->priv->itemview;
	_tmp17_ = self->priv->itemstore;
	_tmp18_ = iter;
	_tmp19_ = gtk_tree_model_get_path (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = self->priv->itemview;
	_tmp22_ = gtk_tree_view_get_column (_tmp21_, 0);
	gtk_tree_view_set_cursor (_tmp16_, _tmp20_, _tmp22_, TRUE);
	_gtk_tree_path_free0 (_tmp20_);
}


void item_preferences_on_itemremove_clicked (GtkButton* button, ItemPreferences* self) {
	GtkTreeIter iter = {0};
	GtkTreeSelection* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	gboolean _tmp2_ = FALSE;
	GtkTreePath* path = NULL;
	GtkListStore* _tmp3_ = NULL;
	GtkTreeIter _tmp4_ = {0};
	GtkTreePath* _tmp5_ = NULL;
	GtkListStore* _tmp6_ = NULL;
	GtkTreeIter _tmp7_ = {0};
	GtkListStore* _tmp8_ = NULL;
	GtkTreePath* _tmp9_ = NULL;
	GtkTreeIter _tmp10_ = {0};
	gboolean _tmp11_ = FALSE;
	GtkTreeSelection* _tmp13_ = NULL;
	GtkTreePath* _tmp14_ = NULL;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_BUTTON (button));
	_tmp0_ = self->priv->itemselection;
	_tmp2_ = gtk_tree_selection_get_selected (_tmp0_, NULL, &_tmp1_);
	iter = _tmp1_;
	if (!_tmp2_) {
		return;
	}
	_tmp3_ = self->priv->itemstore;
	_tmp4_ = iter;
	_tmp5_ = gtk_tree_model_get_path (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp4_);
	path = _tmp5_;
	_tmp6_ = self->priv->itemstore;
	_tmp7_ = iter;
	gtk_list_store_remove (_tmp6_, &_tmp7_);
	_tmp8_ = self->priv->itemstore;
	_tmp9_ = path;
	_tmp11_ = gtk_tree_model_get_iter (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp10_, _tmp9_);
	iter = _tmp10_;
	if (!_tmp11_) {
		GtkTreePath* _tmp12_ = NULL;
		_tmp12_ = path;
		gtk_tree_path_prev (_tmp12_);
	}
	_tmp13_ = self->priv->itemselection;
	_tmp14_ = path;
	gtk_tree_selection_select_path (_tmp13_, _tmp14_);
	_gtk_tree_path_free0 (path);
}


void item_preferences_on_itemedit_clicked (GtkButton* button, ItemPreferences* self) {
	GtkTreeIter iter = {0};
	GtkTreeSelection* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	gboolean _tmp2_ = FALSE;
	GtkTreeView* _tmp3_ = NULL;
	GtkTreeView* _tmp4_ = NULL;
	GtkListStore* _tmp5_ = NULL;
	GtkTreeIter _tmp6_ = {0};
	GtkTreePath* _tmp7_ = NULL;
	GtkTreePath* _tmp8_ = NULL;
	GtkTreeView* _tmp9_ = NULL;
	GtkTreeViewColumn* _tmp10_ = NULL;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_BUTTON (button));
	_tmp0_ = self->priv->itemselection;
	_tmp2_ = gtk_tree_selection_get_selected (_tmp0_, NULL, &_tmp1_);
	iter = _tmp1_;
	if (!_tmp2_) {
		return;
	}
	_tmp3_ = self->priv->itemview;
	gtk_widget_grab_focus (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GTK_TYPE_WIDGET, GtkWidget));
	_tmp4_ = self->priv->itemview;
	_tmp5_ = self->priv->itemstore;
	_tmp6_ = iter;
	_tmp7_ = gtk_tree_model_get_path (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->itemview;
	_tmp10_ = gtk_tree_view_get_column (_tmp9_, 0);
	gtk_tree_view_set_cursor (_tmp4_, _tmp8_, _tmp10_, TRUE);
	_gtk_tree_path_free0 (_tmp8_);
}


void item_preferences_on_itemup_clicked (GtkButton* button, ItemPreferences* self) {
	GtkTreeIter iter = {0};
	GtkTreeSelection* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	gboolean _tmp2_ = FALSE;
	GtkTreeIter previter = {0};
	GtkTreePath* prevpath = NULL;
	GtkListStore* _tmp3_ = NULL;
	GtkTreeIter _tmp4_ = {0};
	GtkTreePath* _tmp5_ = NULL;
	GtkTreePath* _tmp6_ = NULL;
	gboolean _tmp7_ = FALSE;
	GtkListStore* _tmp8_ = NULL;
	GtkTreePath* _tmp9_ = NULL;
	GtkTreeIter _tmp10_ = {0};
	gboolean _tmp11_ = FALSE;
	GValue value = {0};
	GValue prevvalue = {0};
	GtkListStore* _tmp12_ = NULL;
	GtkTreeIter _tmp13_ = {0};
	GValue _tmp14_ = {0};
	GtkListStore* _tmp15_ = NULL;
	GtkTreeIter _tmp16_ = {0};
	GValue _tmp17_ = {0};
	GtkListStore* _tmp18_ = NULL;
	GtkTreeIter _tmp19_ = {0};
	GValue _tmp20_ = {0};
	GtkListStore* _tmp21_ = NULL;
	GtkTreeIter _tmp22_ = {0};
	GValue _tmp23_ = {0};
	GtkTreeSelection* _tmp24_ = NULL;
	GtkTreePath* _tmp25_ = NULL;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_BUTTON (button));
	_tmp0_ = self->priv->itemselection;
	_tmp2_ = gtk_tree_selection_get_selected (_tmp0_, NULL, &_tmp1_);
	iter = _tmp1_;
	if (!_tmp2_) {
		return;
	}
	_tmp3_ = self->priv->itemstore;
	_tmp4_ = iter;
	_tmp5_ = gtk_tree_model_get_path (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp4_);
	prevpath = _tmp5_;
	_tmp6_ = prevpath;
	_tmp7_ = gtk_tree_path_prev (_tmp6_);
	if (!_tmp7_) {
		_gtk_tree_path_free0 (prevpath);
		return;
	}
	_tmp8_ = self->priv->itemstore;
	_tmp9_ = prevpath;
	_tmp11_ = gtk_tree_model_get_iter (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp10_, _tmp9_);
	previter = _tmp10_;
	if (!_tmp11_) {
		_gtk_tree_path_free0 (prevpath);
		return;
	}
	_tmp12_ = self->priv->itemstore;
	_tmp13_ = iter;
	gtk_tree_model_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp13_, 0, &_tmp14_);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp14_;
	_tmp15_ = self->priv->itemstore;
	_tmp16_ = previter;
	gtk_tree_model_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp16_, 0, &_tmp17_);
	G_IS_VALUE (&prevvalue) ? (g_value_unset (&prevvalue), NULL) : NULL;
	prevvalue = _tmp17_;
	_tmp18_ = self->priv->itemstore;
	_tmp19_ = iter;
	_tmp20_ = prevvalue;
	gtk_list_store_set_value (_tmp18_, &_tmp19_, 0, &_tmp20_);
	_tmp21_ = self->priv->itemstore;
	_tmp22_ = previter;
	_tmp23_ = value;
	gtk_list_store_set_value (_tmp21_, &_tmp22_, 0, &_tmp23_);
	_tmp24_ = self->priv->itemselection;
	_tmp25_ = prevpath;
	gtk_tree_selection_select_path (_tmp24_, _tmp25_);
	G_IS_VALUE (&prevvalue) ? (g_value_unset (&prevvalue), NULL) : NULL;
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	_gtk_tree_path_free0 (prevpath);
}


void item_preferences_on_itemdown_clicked (GtkButton* button, ItemPreferences* self) {
	GtkTreeIter iter = {0};
	GtkTreeSelection* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	gboolean _tmp2_ = FALSE;
	GtkTreeIter nextiter = {0};
	GtkTreePath* nextpath = NULL;
	GtkListStore* _tmp3_ = NULL;
	GtkTreeIter _tmp4_ = {0};
	GtkTreePath* _tmp5_ = NULL;
	GtkTreePath* _tmp6_ = NULL;
	GtkListStore* _tmp7_ = NULL;
	GtkTreePath* _tmp8_ = NULL;
	GtkTreeIter _tmp9_ = {0};
	gboolean _tmp10_ = FALSE;
	GValue value = {0};
	GValue nextvalue = {0};
	GtkListStore* _tmp11_ = NULL;
	GtkTreeIter _tmp12_ = {0};
	GValue _tmp13_ = {0};
	GtkListStore* _tmp14_ = NULL;
	GtkTreeIter _tmp15_ = {0};
	GValue _tmp16_ = {0};
	GtkListStore* _tmp17_ = NULL;
	GtkTreeIter _tmp18_ = {0};
	GValue _tmp19_ = {0};
	GtkListStore* _tmp20_ = NULL;
	GtkTreeIter _tmp21_ = {0};
	GValue _tmp22_ = {0};
	GtkTreeSelection* _tmp23_ = NULL;
	GtkTreePath* _tmp24_ = NULL;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	g_return_if_fail (GTK_IS_BUTTON (button));
	_tmp0_ = self->priv->itemselection;
	_tmp2_ = gtk_tree_selection_get_selected (_tmp0_, NULL, &_tmp1_);
	iter = _tmp1_;
	if (!_tmp2_) {
		return;
	}
	_tmp3_ = self->priv->itemstore;
	_tmp4_ = iter;
	_tmp5_ = gtk_tree_model_get_path (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp4_);
	nextpath = _tmp5_;
	_tmp6_ = nextpath;
	gtk_tree_path_next (_tmp6_);
	_tmp7_ = self->priv->itemstore;
	_tmp8_ = nextpath;
	_tmp10_ = gtk_tree_model_get_iter (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp9_, _tmp8_);
	nextiter = _tmp9_;
	if (!_tmp10_) {
		_gtk_tree_path_free0 (nextpath);
		return;
	}
	_tmp11_ = self->priv->itemstore;
	_tmp12_ = iter;
	gtk_tree_model_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp12_, 0, &_tmp13_);
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	value = _tmp13_;
	_tmp14_ = self->priv->itemstore;
	_tmp15_ = nextiter;
	gtk_tree_model_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp15_, 0, &_tmp16_);
	G_IS_VALUE (&nextvalue) ? (g_value_unset (&nextvalue), NULL) : NULL;
	nextvalue = _tmp16_;
	_tmp17_ = self->priv->itemstore;
	_tmp18_ = iter;
	_tmp19_ = nextvalue;
	gtk_list_store_set_value (_tmp17_, &_tmp18_, 0, &_tmp19_);
	_tmp20_ = self->priv->itemstore;
	_tmp21_ = nextiter;
	_tmp22_ = value;
	gtk_list_store_set_value (_tmp20_, &_tmp21_, 0, &_tmp22_);
	_tmp23_ = self->priv->itemselection;
	_tmp24_ = nextpath;
	gtk_tree_selection_select_path (_tmp23_, _tmp24_);
	G_IS_VALUE (&nextvalue) ? (g_value_unset (&nextvalue), NULL) : NULL;
	G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
	_gtk_tree_path_free0 (nextpath);
}


static gint* _vala_array_dup17 (gint* self, int length) {
	return g_memdup (self, length * sizeof (gint));
}


static void item_preferences_updatebuttons (ItemPreferences* self) {
	GtkTreeIter iter = {0};
	gboolean add = FALSE;
	gboolean remove = FALSE;
	gboolean edit = FALSE;
	gboolean up = FALSE;
	gboolean down = FALSE;
	GtkTreeSelection* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	gboolean _tmp2_ = FALSE;
	GtkButton* _tmp16_ = NULL;
	gboolean _tmp17_ = FALSE;
	GtkButton* _tmp18_ = NULL;
	gboolean _tmp19_ = FALSE;
	GtkButton* _tmp20_ = NULL;
	gboolean _tmp21_ = FALSE;
	GtkButton* _tmp22_ = NULL;
	gboolean _tmp23_ = FALSE;
	GtkButton* _tmp24_ = NULL;
	gboolean _tmp25_ = FALSE;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	add = TRUE;
	remove = FALSE;
	edit = FALSE;
	up = FALSE;
	down = FALSE;
	_tmp0_ = self->priv->itemselection;
	_tmp2_ = gtk_tree_selection_get_selected (_tmp0_, NULL, &_tmp1_);
	iter = _tmp1_;
	if (_tmp2_) {
		GtkTreePath* path = NULL;
		GtkListStore* _tmp3_ = NULL;
		GtkTreeIter _tmp4_ = {0};
		GtkTreePath* _tmp5_ = NULL;
		gint* indices = NULL;
		GtkTreePath* _tmp6_ = NULL;
		gint _tmp7_ = 0;
		gint* _tmp8_ = NULL;
		gint* _tmp9_ = NULL;
		gint _tmp9__length1 = 0;
		gint indices_length1 = 0;
		gint _indices_size_ = 0;
		gint* _tmp10_ = NULL;
		gint _tmp10__length1 = 0;
		gint _tmp11_ = 0;
		gint* _tmp12_ = NULL;
		gint _tmp12__length1 = 0;
		gint _tmp13_ = 0;
		GtkListStore* _tmp14_ = NULL;
		gint _tmp15_ = 0;
		edit = TRUE;
		remove = TRUE;
		_tmp3_ = self->priv->itemstore;
		_tmp4_ = iter;
		_tmp5_ = gtk_tree_model_get_path (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp4_);
		path = _tmp5_;
		_tmp6_ = path;
		_tmp8_ = gtk_tree_path_get_indices_with_depth (_tmp6_, &_tmp7_);
		_tmp9_ = (_tmp8_ != NULL) ? _vala_array_dup17 (_tmp8_, _tmp7_) : ((gpointer) _tmp8_);
		_tmp9__length1 = _tmp7_;
		indices = _tmp9_;
		indices_length1 = _tmp9__length1;
		_indices_size_ = indices_length1;
		_tmp10_ = indices;
		_tmp10__length1 = indices_length1;
		_tmp11_ = _tmp10_[0];
		up = _tmp11_ > 0;
		_tmp12_ = indices;
		_tmp12__length1 = indices_length1;
		_tmp13_ = _tmp12_[0];
		_tmp14_ = self->priv->itemstore;
		_tmp15_ = gtk_tree_model_iter_n_children (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, GTK_TYPE_TREE_MODEL, GtkTreeModel), NULL);
		down = (_tmp13_ + 1) < _tmp15_;
		indices = (g_free (indices), NULL);
		_gtk_tree_path_free0 (path);
	}
	_tmp16_ = self->priv->itemadd;
	_tmp17_ = add;
	gtk_widget_set_sensitive (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, GTK_TYPE_WIDGET, GtkWidget), _tmp17_);
	_tmp18_ = self->priv->itemremove;
	_tmp19_ = remove;
	gtk_widget_set_sensitive (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, GTK_TYPE_WIDGET, GtkWidget), _tmp19_);
	_tmp20_ = self->priv->itemedit;
	_tmp21_ = edit;
	gtk_widget_set_sensitive (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, GTK_TYPE_WIDGET, GtkWidget), _tmp21_);
	_tmp22_ = self->priv->itemup;
	_tmp23_ = up;
	gtk_widget_set_sensitive (G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, GTK_TYPE_WIDGET, GtkWidget), _tmp23_);
	_tmp24_ = self->priv->itemdown;
	_tmp25_ = down;
	gtk_widget_set_sensitive (G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, GTK_TYPE_WIDGET, GtkWidget), _tmp25_);
}


static void item_preferences_itemsgsettingstostore (ItemPreferences* self) {
	gchar** expressions = NULL;
	GSettings* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gchar** _tmp3_ = NULL;
	gint expressions_length1 = 0;
	gint _expressions_size_ = 0;
	GtkListStore* _tmp4_ = NULL;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	_tmp0_ = self->priv->itemsettings;
	_tmp1_ = self->priv->_settingskey;
	_tmp3_ = _tmp2_ = g_settings_get_strv (_tmp0_, _tmp1_);
	expressions = _tmp3_;
	expressions_length1 = _vala_array_length (_tmp2_);
	_expressions_size_ = expressions_length1;
	self->priv->itemsignoresignals = TRUE;
	_tmp4_ = self->priv->itemstore;
	gtk_list_store_clear (_tmp4_);
	{
		guint i = 0U;
		guint isize = 0U;
		gchar** _tmp5_ = NULL;
		gint _tmp5__length1 = 0;
		i = (guint) 0;
		_tmp5_ = expressions;
		_tmp5__length1 = expressions_length1;
		isize = (guint) _tmp5__length1;
		{
			gboolean _tmp6_ = FALSE;
			_tmp6_ = TRUE;
			while (TRUE) {
				gboolean _tmp7_ = FALSE;
				guint _tmp9_ = 0U;
				guint _tmp10_ = 0U;
				GtkListStore* _tmp11_ = NULL;
				guint _tmp12_ = 0U;
				gchar** _tmp13_ = NULL;
				gint _tmp13__length1 = 0;
				guint _tmp14_ = 0U;
				const gchar* _tmp15_ = NULL;
				_tmp7_ = _tmp6_;
				if (!_tmp7_) {
					guint _tmp8_ = 0U;
					_tmp8_ = i;
					i = _tmp8_ + 1;
				}
				_tmp6_ = FALSE;
				_tmp9_ = i;
				_tmp10_ = isize;
				if (!(_tmp9_ < _tmp10_)) {
					break;
				}
				_tmp11_ = self->priv->itemstore;
				_tmp12_ = i;
				_tmp13_ = expressions;
				_tmp13__length1 = expressions_length1;
				_tmp14_ = i;
				_tmp15_ = _tmp13_[_tmp14_];
				gtk_list_store_insert_with_values (_tmp11_, NULL, (gint) _tmp12_, 0, _tmp15_, -1);
			}
		}
	}
	self->priv->itemsignoresignals = FALSE;
	expressions = (_vala_array_free (expressions, expressions_length1, (GDestroyNotify) g_free), NULL);
}


static void item_preferences_itemsstoretogsettings (ItemPreferences* self) {
	gchar** _result_ = NULL;
	GtkListStore* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gchar** _tmp2_ = NULL;
	gint _result__length1 = 0;
	gint __result__size_ = 0;
	GtkTreeIter iter = {0};
	GSettings* _tmp20_ = NULL;
	const gchar* _tmp21_ = NULL;
	gchar** _tmp22_ = NULL;
	gint _tmp22__length1 = 0;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	_tmp0_ = self->priv->itemstore;
	_tmp1_ = gtk_tree_model_iter_n_children (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GTK_TYPE_TREE_MODEL, GtkTreeModel), NULL);
	_tmp2_ = g_new0 (gchar*, _tmp1_ + 1);
	_result_ = _tmp2_;
	_result__length1 = _tmp1_;
	__result__size_ = _result__length1;
	{
		guint i = 0U;
		guint isize = 0U;
		gchar** _tmp3_ = NULL;
		gint _tmp3__length1 = 0;
		i = (guint) 0;
		_tmp3_ = _result_;
		_tmp3__length1 = _result__length1;
		isize = (guint) _tmp3__length1;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp5_ = FALSE;
				guint _tmp7_ = 0U;
				guint _tmp8_ = 0U;
				GtkListStore* _tmp9_ = NULL;
				guint _tmp10_ = 0U;
				GtkTreeIter _tmp11_ = {0};
				GValue value = {0};
				GtkListStore* _tmp12_ = NULL;
				GtkTreeIter _tmp13_ = {0};
				GValue _tmp14_ = {0};
				gchar** _tmp15_ = NULL;
				gint _tmp15__length1 = 0;
				guint _tmp16_ = 0U;
				GValue _tmp17_ = {0};
				gchar* _tmp18_ = NULL;
				gchar* _tmp19_ = NULL;
				_tmp5_ = _tmp4_;
				if (!_tmp5_) {
					guint _tmp6_ = 0U;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp4_ = FALSE;
				_tmp7_ = i;
				_tmp8_ = isize;
				if (!(_tmp7_ < _tmp8_)) {
					break;
				}
				_tmp9_ = self->priv->itemstore;
				_tmp10_ = i;
				gtk_tree_model_iter_nth_child (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp11_, NULL, (gint) _tmp10_);
				iter = _tmp11_;
				_tmp12_ = self->priv->itemstore;
				_tmp13_ = iter;
				gtk_tree_model_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, GTK_TYPE_TREE_MODEL, GtkTreeModel), &_tmp13_, 0, &_tmp14_);
				G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
				value = _tmp14_;
				_tmp15_ = _result_;
				_tmp15__length1 = _result__length1;
				_tmp16_ = i;
				_tmp17_ = value;
				_tmp18_ = g_strdup (g_value_get_string (&_tmp17_));
				_g_free0 (_tmp15_[_tmp16_]);
				_tmp15_[_tmp16_] = _tmp18_;
				_tmp19_ = _tmp15_[_tmp16_];
				G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL;
			}
		}
	}
	self->priv->itemsignoresignals = TRUE;
	_tmp20_ = self->priv->itemsettings;
	_tmp21_ = self->priv->_settingskey;
	_tmp22_ = _result_;
	_tmp22__length1 = _result__length1;
	g_settings_set_strv (_tmp20_, _tmp21_, _tmp22_);
	self->priv->itemsignoresignals = FALSE;
	_result_ = (_vala_array_free (_result_, _result__length1, (GDestroyNotify) g_free), NULL);
}


const gchar* item_preferences_get_settingskey (ItemPreferences* self) {
	const gchar* result;
	const gchar* _tmp0_ = NULL;
	g_return_val_if_fail (IS_ITEM_PREFERENCES (self), NULL);
	_tmp0_ = self->priv->_settingskey;
	result = _tmp0_;
	return result;
}


static void item_preferences_set_settingskey (ItemPreferences* self, const gchar* value) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	g_return_if_fail (IS_ITEM_PREFERENCES (self));
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_settingskey);
	self->priv->_settingskey = _tmp1_;
	g_object_notify ((GObject *) self, "settingskey");
}


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


static GObject * item_preferences_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	ItemPreferences * self;
	SettingsCache* _tmp0_ = NULL;
	SettingsCache* _tmp1_ = NULL;
	GSettings* _tmp2_ = NULL;
	GSettings* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	parent_class = G_OBJECT_CLASS (item_preferences_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ITEM_PREFERENCES, ItemPreferences);
	_tmp0_ = settings_cache_new ();
	_tmp1_ = _tmp0_;
	_tmp2_ = settings_cache_generalsettings (_tmp1_);
	_g_object_unref0 (self->priv->itemsettings);
	self->priv->itemsettings = _tmp2_;
	_g_object_unref0 (_tmp1_);
	_tmp3_ = self->priv->itemsettings;
	_tmp4_ = self->priv->_settingskey;
	_tmp5_ = g_strconcat ("changed::", _tmp4_, NULL);
	g_signal_connect_object (_tmp3_, _tmp5_, (GCallback) _item_preferences_reset_itemstore_g_settings_changed, self, 0);
	_g_free0 (_tmp5_);
	return obj;
}


static void item_preferences_class_init (ItemPreferencesClass * klass) {
	item_preferences_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ItemPreferencesPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_item_preferences_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_item_preferences_set_property;
	G_OBJECT_CLASS (klass)->constructor = item_preferences_constructor;
	G_OBJECT_CLASS (klass)->finalize = item_preferences_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), ITEM_PREFERENCES_SETTINGSKEY, g_param_spec_string ("settingskey", "settingskey", "settingskey", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_signal_new ("itemhelp_show", TYPE_ITEM_PREFERENCES, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}


static void item_preferences_instance_init (ItemPreferences * self) {
	self->priv = ITEM_PREFERENCES_GET_PRIVATE (self);
}


static void item_preferences_finalize (GObject* obj) {
	ItemPreferences * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ITEM_PREFERENCES, ItemPreferences);
	_g_object_unref0 (self->priv->itemsettings);
	_g_object_unref0 (self->priv->items);
	_g_free0 (self->priv->_settingskey);
	G_OBJECT_CLASS (item_preferences_parent_class)->finalize (obj);
}


/******************************************************************************
 * Copyright (C) 2011-2013  Michael Hofmann <mh21@mh21.de>                    *
 *                                                                            *
 * This program 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.                                        *
 *                                                                            *
 * This program 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 this program; if not, write to the Free Software Foundation, Inc.,    *
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                *
 ******************************************************************************/
GType item_preferences_get_type (void) {
	static volatile gsize item_preferences_type_id__volatile = 0;
	if (g_once_init_enter (&item_preferences_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ItemPreferencesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) item_preferences_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ItemPreferences), 0, (GInstanceInitFunc) item_preferences_instance_init, NULL };
		GType item_preferences_type_id;
		item_preferences_type_id = g_type_register_static (G_TYPE_OBJECT, "ItemPreferences", &g_define_type_info, 0);
		g_once_init_leave (&item_preferences_type_id__volatile, item_preferences_type_id);
	}
	return item_preferences_type_id__volatile;
}


static void _vala_item_preferences_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	ItemPreferences * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_ITEM_PREFERENCES, ItemPreferences);
	switch (property_id) {
		case ITEM_PREFERENCES_SETTINGSKEY:
		g_value_set_string (value, item_preferences_get_settingskey (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_item_preferences_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	ItemPreferences * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_ITEM_PREFERENCES, ItemPreferences);
	switch (property_id) {
		case ITEM_PREFERENCES_SETTINGSKEY:
		item_preferences_set_settingskey (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


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



