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


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


#define TYPE_SETTINGS_CONVERSION (settings_conversion_get_type ())
#define SETTINGS_CONVERSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS_CONVERSION, SettingsConversion))
#define SETTINGS_CONVERSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SETTINGS_CONVERSION, SettingsConversionClass))
#define IS_SETTINGS_CONVERSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SETTINGS_CONVERSION))
#define IS_SETTINGS_CONVERSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SETTINGS_CONVERSION))
#define SETTINGS_CONVERSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SETTINGS_CONVERSION, SettingsConversionClass))

typedef struct _SettingsConversion SettingsConversion;
typedef struct _SettingsConversionClass SettingsConversionClass;
typedef struct _SettingsConversionPrivate SettingsConversionPrivate;

#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;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _SettingsConversion {
	GObject parent_instance;
	SettingsConversionPrivate * priv;
};

struct _SettingsConversionClass {
	GObjectClass parent_class;
};

struct _SettingsConversionPrivate {
	SettingsCache* settingscache;
};


static gpointer settings_conversion_parent_class = NULL;

GType settings_conversion_get_type (void) G_GNUC_CONST;
GType settings_cache_get_type (void) G_GNUC_CONST;
#define SETTINGS_CONVERSION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_SETTINGS_CONVERSION, SettingsConversionPrivate))
enum  {
	SETTINGS_CONVERSION_DUMMY_PROPERTY
};
SettingsCache* settings_cache_new (void);
SettingsCache* settings_cache_construct (GType object_type);
void settings_conversion_convert (SettingsConversion* self);
GSettings* settings_cache_generalsettings (SettingsCache* self);
static void settings_conversion_convert_version2 (SettingsConversion* self);
static void settings_conversion_convert_version1 (SettingsConversion* self);
static GVariant* _variant_new1 (guint value);
GSettings* settings_cache_graphsettings (SettingsCache* self, const gchar* graphid);
GSettings* settings_cache_tracesettings (SettingsCache* self, const gchar* graphid, const gchar* traceid);
static void settings_conversion_copysettings (SettingsConversion* self, GSettings* oldsettings, GSettings* newsettings, gchar** ignore, int ignore_length1);
static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle);
SettingsConversion* settings_conversion_new (void);
SettingsConversion* settings_conversion_construct (GType object_type);
static void settings_conversion_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 const gchar* SETTINGS_CONVERSION_version2graphs[6] = {"cpu", "mem", "net", "swap", "load", "disk"};
static const guint SETTINGS_CONVERSION_version2traces[6] = {(guint) 4, (guint) 4, (guint) 3, (guint) 1, (guint) 1, (guint) 2};

static GVariant* _variant_new1 (guint value) {
	return g_variant_ref_sink (g_variant_new_uint32 (value));
}


void settings_conversion_convert (SettingsConversion* self) {
	GSettings* settings = NULL;
	SettingsCache* _tmp0_ = NULL;
	GSettings* _tmp1_ = NULL;
	GSettings* _tmp2_ = NULL;
	GVariant* _tmp3_ = NULL;
	GVariant* _tmp4_ = NULL;
	guint32 _tmp5_ = 0U;
	gboolean _tmp6_ = FALSE;
	GSettings* _tmp7_ = NULL;
	GSettings* _tmp8_ = NULL;
	GVariant* _tmp9_ = NULL;
	GVariant* _tmp10_ = NULL;
	guint32 _tmp11_ = 0U;
	gboolean _tmp12_ = FALSE;
	GSettings* _tmp13_ = NULL;
	GVariant* _tmp14_ = NULL;
	g_return_if_fail (IS_SETTINGS_CONVERSION (self));
	_tmp0_ = self->priv->settingscache;
	_tmp1_ = settings_cache_generalsettings (_tmp0_);
	settings = _tmp1_;
	_tmp2_ = settings;
	_tmp3_ = g_settings_get_value (_tmp2_, "settings-version");
	_tmp4_ = _tmp3_;
	_tmp5_ = g_variant_get_uint32 (_tmp4_);
	_tmp6_ = _tmp5_ == ((guint32) 3);
	_g_variant_unref0 (_tmp4_);
	if (_tmp6_) {
		_g_object_unref0 (settings);
		return;
	}
	_tmp7_ = g_settings_new_with_path ("de.mh21.indicator-multiload.version2.general", "/apps/indicators/multiload/general/");
	_tmp8_ = _tmp7_;
	_tmp9_ = g_settings_get_value (_tmp8_, "settings-version");
	_tmp10_ = _tmp9_;
	_tmp11_ = g_variant_get_uint32 (_tmp10_);
	_tmp12_ = _tmp11_ == ((guint32) 2);
	_g_variant_unref0 (_tmp10_);
	_g_object_unref0 (_tmp8_);
	if (_tmp12_) {
		settings_conversion_convert_version2 (self);
	} else {
		settings_conversion_convert_version1 (self);
	}
	_tmp13_ = settings;
	_tmp14_ = _variant_new1 (3U);
	g_settings_set_value (_tmp13_, "settings-version", _tmp14_);
	_g_variant_unref0 (_tmp14_);
	_g_object_unref0 (settings);
}


static void settings_conversion_convert_version1 (SettingsConversion* self) {
	GSettings* oldsettings = NULL;
	GSettings* _tmp0_ = NULL;
	GSettings* _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gchar** _tmp3_ = NULL;
	g_return_if_fail (IS_SETTINGS_CONVERSION (self));
	_tmp0_ = g_settings_new_with_path ("de.mh21.indicator-multiload.version1", "/apps/indicators/multiload/");
	oldsettings = _tmp0_;
	_tmp1_ = oldsettings;
	_tmp3_ = _tmp2_ = g_settings_list_keys (_tmp1_);
	{
		gchar** key_collection = NULL;
		gint key_collection_length1 = 0;
		gint _key_collection_size_ = 0;
		gint key_it = 0;
		key_collection = _tmp3_;
		key_collection_length1 = _vala_array_length (_tmp2_);
		for (key_it = 0; key_it < _vala_array_length (_tmp2_); key_it = key_it + 1) {
			gchar* _tmp4_ = NULL;
			gchar* key = NULL;
			_tmp4_ = g_strdup (key_collection[key_it]);
			key = _tmp4_;
			{
				GVariant* value = NULL;
				GSettings* _tmp5_ = NULL;
				const gchar* _tmp6_ = NULL;
				GVariant* _tmp7_ = NULL;
				GSettings* _tmp8_ = NULL;
				const gchar* _tmp9_ = NULL;
				GVariant* defaultvalue = NULL;
				GSettings* _tmp10_ = NULL;
				const gchar* _tmp11_ = NULL;
				GVariant* _tmp12_ = NULL;
				GVariant* _tmp13_ = NULL;
				GVariant* _tmp14_ = NULL;
				gboolean _tmp15_ = FALSE;
				_tmp5_ = oldsettings;
				_tmp6_ = key;
				_tmp7_ = g_settings_get_value (_tmp5_, _tmp6_);
				value = _tmp7_;
				_tmp8_ = oldsettings;
				_tmp9_ = key;
				g_settings_reset (_tmp8_, _tmp9_);
				_tmp10_ = oldsettings;
				_tmp11_ = key;
				_tmp12_ = g_settings_get_value (_tmp10_, _tmp11_);
				defaultvalue = _tmp12_;
				_tmp13_ = value;
				_tmp14_ = defaultvalue;
				_tmp15_ = g_variant_equal (_tmp13_, _tmp14_);
				if (!_tmp15_) {
					const gchar* _tmp16_ = NULL;
					const gchar* _tmp17_ = NULL;
					GQuark _tmp19_ = 0U;
					static GQuark _tmp18_label0 = 0;
					static GQuark _tmp18_label1 = 0;
					static GQuark _tmp18_label2 = 0;
					static GQuark _tmp18_label3 = 0;
					static GQuark _tmp18_label4 = 0;
					static GQuark _tmp18_label5 = 0;
					static GQuark _tmp18_label6 = 0;
					static GQuark _tmp18_label7 = 0;
					static GQuark _tmp18_label8 = 0;
					static GQuark _tmp18_label9 = 0;
					static GQuark _tmp18_label10 = 0;
					static GQuark _tmp18_label11 = 0;
					static GQuark _tmp18_label12 = 0;
					static GQuark _tmp18_label13 = 0;
					static GQuark _tmp18_label14 = 0;
					static GQuark _tmp18_label15 = 0;
					static GQuark _tmp18_label16 = 0;
					static GQuark _tmp18_label17 = 0;
					static GQuark _tmp18_label18 = 0;
					static GQuark _tmp18_label19 = 0;
					static GQuark _tmp18_label20 = 0;
					static GQuark _tmp18_label21 = 0;
					static GQuark _tmp18_label22 = 0;
					static GQuark _tmp18_label23 = 0;
					static GQuark _tmp18_label24 = 0;
					static GQuark _tmp18_label25 = 0;
					_tmp16_ = key;
					_tmp17_ = _tmp16_;
					_tmp19_ = (NULL == _tmp17_) ? 0 : g_quark_from_string (_tmp17_);
					if (_tmp19_ == ((0 != _tmp18_label0) ? _tmp18_label0 : (_tmp18_label0 = g_quark_from_static_string ("view-cpuload")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp20_ = NULL;
								GSettings* _tmp21_ = NULL;
								GSettings* _tmp22_ = NULL;
								GVariant* _tmp23_ = NULL;
								_tmp20_ = self->priv->settingscache;
								_tmp21_ = settings_cache_graphsettings (_tmp20_, "cpu");
								_tmp22_ = _tmp21_;
								_tmp23_ = value;
								g_settings_set_value (_tmp22_, "enabled", _tmp23_);
								_g_object_unref0 (_tmp22_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label1) ? _tmp18_label1 : (_tmp18_label1 = g_quark_from_static_string ("view-memload")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp24_ = NULL;
								GSettings* _tmp25_ = NULL;
								GSettings* _tmp26_ = NULL;
								GVariant* _tmp27_ = NULL;
								_tmp24_ = self->priv->settingscache;
								_tmp25_ = settings_cache_graphsettings (_tmp24_, "mem");
								_tmp26_ = _tmp25_;
								_tmp27_ = value;
								g_settings_set_value (_tmp26_, "enabled", _tmp27_);
								_g_object_unref0 (_tmp26_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label2) ? _tmp18_label2 : (_tmp18_label2 = g_quark_from_static_string ("view-netload")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp28_ = NULL;
								GSettings* _tmp29_ = NULL;
								GSettings* _tmp30_ = NULL;
								GVariant* _tmp31_ = NULL;
								_tmp28_ = self->priv->settingscache;
								_tmp29_ = settings_cache_graphsettings (_tmp28_, "net");
								_tmp30_ = _tmp29_;
								_tmp31_ = value;
								g_settings_set_value (_tmp30_, "enabled", _tmp31_);
								_g_object_unref0 (_tmp30_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label3) ? _tmp18_label3 : (_tmp18_label3 = g_quark_from_static_string ("view-swapload")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp32_ = NULL;
								GSettings* _tmp33_ = NULL;
								GSettings* _tmp34_ = NULL;
								GVariant* _tmp35_ = NULL;
								_tmp32_ = self->priv->settingscache;
								_tmp33_ = settings_cache_graphsettings (_tmp32_, "swap");
								_tmp34_ = _tmp33_;
								_tmp35_ = value;
								g_settings_set_value (_tmp34_, "enabled", _tmp35_);
								_g_object_unref0 (_tmp34_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label4) ? _tmp18_label4 : (_tmp18_label4 = g_quark_from_static_string ("view-loadavg")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp36_ = NULL;
								GSettings* _tmp37_ = NULL;
								GSettings* _tmp38_ = NULL;
								GVariant* _tmp39_ = NULL;
								_tmp36_ = self->priv->settingscache;
								_tmp37_ = settings_cache_graphsettings (_tmp36_, "load");
								_tmp38_ = _tmp37_;
								_tmp39_ = value;
								g_settings_set_value (_tmp38_, "enabled", _tmp39_);
								_g_object_unref0 (_tmp38_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label5) ? _tmp18_label5 : (_tmp18_label5 = g_quark_from_static_string ("view-diskload")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp40_ = NULL;
								GSettings* _tmp41_ = NULL;
								GSettings* _tmp42_ = NULL;
								GVariant* _tmp43_ = NULL;
								_tmp40_ = self->priv->settingscache;
								_tmp41_ = settings_cache_graphsettings (_tmp40_, "disk");
								_tmp42_ = _tmp41_;
								_tmp43_ = value;
								g_settings_set_value (_tmp42_, "enabled", _tmp43_);
								_g_object_unref0 (_tmp42_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label6) ? _tmp18_label6 : (_tmp18_label6 = g_quark_from_static_string ("cpuload-color0")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp44_ = NULL;
								GSettings* _tmp45_ = NULL;
								GSettings* _tmp46_ = NULL;
								GVariant* _tmp47_ = NULL;
								_tmp44_ = self->priv->settingscache;
								_tmp45_ = settings_cache_tracesettings (_tmp44_, "cpu", "cpu1");
								_tmp46_ = _tmp45_;
								_tmp47_ = value;
								g_settings_set_value (_tmp46_, "color", _tmp47_);
								_g_object_unref0 (_tmp46_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label7) ? _tmp18_label7 : (_tmp18_label7 = g_quark_from_static_string ("cpuload-color1")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp48_ = NULL;
								GSettings* _tmp49_ = NULL;
								GSettings* _tmp50_ = NULL;
								GVariant* _tmp51_ = NULL;
								_tmp48_ = self->priv->settingscache;
								_tmp49_ = settings_cache_tracesettings (_tmp48_, "cpu", "cpu2");
								_tmp50_ = _tmp49_;
								_tmp51_ = value;
								g_settings_set_value (_tmp50_, "color", _tmp51_);
								_g_object_unref0 (_tmp50_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label8) ? _tmp18_label8 : (_tmp18_label8 = g_quark_from_static_string ("cpuload-color2")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp52_ = NULL;
								GSettings* _tmp53_ = NULL;
								GSettings* _tmp54_ = NULL;
								GVariant* _tmp55_ = NULL;
								_tmp52_ = self->priv->settingscache;
								_tmp53_ = settings_cache_tracesettings (_tmp52_, "cpu", "cpu3");
								_tmp54_ = _tmp53_;
								_tmp55_ = value;
								g_settings_set_value (_tmp54_, "color", _tmp55_);
								_g_object_unref0 (_tmp54_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label9) ? _tmp18_label9 : (_tmp18_label9 = g_quark_from_static_string ("cpuload-color3")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp56_ = NULL;
								GSettings* _tmp57_ = NULL;
								GSettings* _tmp58_ = NULL;
								GVariant* _tmp59_ = NULL;
								_tmp56_ = self->priv->settingscache;
								_tmp57_ = settings_cache_tracesettings (_tmp56_, "cpu", "cpu4");
								_tmp58_ = _tmp57_;
								_tmp59_ = value;
								g_settings_set_value (_tmp58_, "color", _tmp59_);
								_g_object_unref0 (_tmp58_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label10) ? _tmp18_label10 : (_tmp18_label10 = g_quark_from_static_string ("memload-color0")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp60_ = NULL;
								GSettings* _tmp61_ = NULL;
								GSettings* _tmp62_ = NULL;
								GVariant* _tmp63_ = NULL;
								_tmp60_ = self->priv->settingscache;
								_tmp61_ = settings_cache_tracesettings (_tmp60_, "mem", "mem1");
								_tmp62_ = _tmp61_;
								_tmp63_ = value;
								g_settings_set_value (_tmp62_, "color", _tmp63_);
								_g_object_unref0 (_tmp62_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label11) ? _tmp18_label11 : (_tmp18_label11 = g_quark_from_static_string ("memload-color1")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp64_ = NULL;
								GSettings* _tmp65_ = NULL;
								GSettings* _tmp66_ = NULL;
								GVariant* _tmp67_ = NULL;
								_tmp64_ = self->priv->settingscache;
								_tmp65_ = settings_cache_tracesettings (_tmp64_, "mem", "mem2");
								_tmp66_ = _tmp65_;
								_tmp67_ = value;
								g_settings_set_value (_tmp66_, "color", _tmp67_);
								_g_object_unref0 (_tmp66_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label12) ? _tmp18_label12 : (_tmp18_label12 = g_quark_from_static_string ("memload-color2")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp68_ = NULL;
								GSettings* _tmp69_ = NULL;
								GSettings* _tmp70_ = NULL;
								GVariant* _tmp71_ = NULL;
								_tmp68_ = self->priv->settingscache;
								_tmp69_ = settings_cache_tracesettings (_tmp68_, "mem", "mem3");
								_tmp70_ = _tmp69_;
								_tmp71_ = value;
								g_settings_set_value (_tmp70_, "color", _tmp71_);
								_g_object_unref0 (_tmp70_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label13) ? _tmp18_label13 : (_tmp18_label13 = g_quark_from_static_string ("memload-color3")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp72_ = NULL;
								GSettings* _tmp73_ = NULL;
								GSettings* _tmp74_ = NULL;
								GVariant* _tmp75_ = NULL;
								_tmp72_ = self->priv->settingscache;
								_tmp73_ = settings_cache_tracesettings (_tmp72_, "mem", "mem4");
								_tmp74_ = _tmp73_;
								_tmp75_ = value;
								g_settings_set_value (_tmp74_, "color", _tmp75_);
								_g_object_unref0 (_tmp74_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label14) ? _tmp18_label14 : (_tmp18_label14 = g_quark_from_static_string ("netload-color0")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp76_ = NULL;
								GSettings* _tmp77_ = NULL;
								GSettings* _tmp78_ = NULL;
								GVariant* _tmp79_ = NULL;
								_tmp76_ = self->priv->settingscache;
								_tmp77_ = settings_cache_tracesettings (_tmp76_, "net", "net1");
								_tmp78_ = _tmp77_;
								_tmp79_ = value;
								g_settings_set_value (_tmp78_, "color", _tmp79_);
								_g_object_unref0 (_tmp78_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label15) ? _tmp18_label15 : (_tmp18_label15 = g_quark_from_static_string ("netload-color1")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp80_ = NULL;
								GSettings* _tmp81_ = NULL;
								GSettings* _tmp82_ = NULL;
								GVariant* _tmp83_ = NULL;
								_tmp80_ = self->priv->settingscache;
								_tmp81_ = settings_cache_tracesettings (_tmp80_, "net", "net2");
								_tmp82_ = _tmp81_;
								_tmp83_ = value;
								g_settings_set_value (_tmp82_, "color", _tmp83_);
								_g_object_unref0 (_tmp82_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label16) ? _tmp18_label16 : (_tmp18_label16 = g_quark_from_static_string ("netload-color2")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp84_ = NULL;
								GSettings* _tmp85_ = NULL;
								GSettings* _tmp86_ = NULL;
								GVariant* _tmp87_ = NULL;
								_tmp84_ = self->priv->settingscache;
								_tmp85_ = settings_cache_tracesettings (_tmp84_, "net", "net3");
								_tmp86_ = _tmp85_;
								_tmp87_ = value;
								g_settings_set_value (_tmp86_, "color", _tmp87_);
								_g_object_unref0 (_tmp86_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label17) ? _tmp18_label17 : (_tmp18_label17 = g_quark_from_static_string ("swapload-color0")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp88_ = NULL;
								GSettings* _tmp89_ = NULL;
								GSettings* _tmp90_ = NULL;
								GVariant* _tmp91_ = NULL;
								_tmp88_ = self->priv->settingscache;
								_tmp89_ = settings_cache_tracesettings (_tmp88_, "swap", "swap1");
								_tmp90_ = _tmp89_;
								_tmp91_ = value;
								g_settings_set_value (_tmp90_, "color", _tmp91_);
								_g_object_unref0 (_tmp90_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label18) ? _tmp18_label18 : (_tmp18_label18 = g_quark_from_static_string ("loadavg-color0")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp92_ = NULL;
								GSettings* _tmp93_ = NULL;
								GSettings* _tmp94_ = NULL;
								GVariant* _tmp95_ = NULL;
								_tmp92_ = self->priv->settingscache;
								_tmp93_ = settings_cache_tracesettings (_tmp92_, "load", "load1");
								_tmp94_ = _tmp93_;
								_tmp95_ = value;
								g_settings_set_value (_tmp94_, "color", _tmp95_);
								_g_object_unref0 (_tmp94_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label19) ? _tmp18_label19 : (_tmp18_label19 = g_quark_from_static_string ("diskload-color0")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp96_ = NULL;
								GSettings* _tmp97_ = NULL;
								GSettings* _tmp98_ = NULL;
								GVariant* _tmp99_ = NULL;
								_tmp96_ = self->priv->settingscache;
								_tmp97_ = settings_cache_tracesettings (_tmp96_, "disk", "disk1");
								_tmp98_ = _tmp97_;
								_tmp99_ = value;
								g_settings_set_value (_tmp98_, "color", _tmp99_);
								_g_object_unref0 (_tmp98_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label20) ? _tmp18_label20 : (_tmp18_label20 = g_quark_from_static_string ("diskload-color1")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp100_ = NULL;
								GSettings* _tmp101_ = NULL;
								GSettings* _tmp102_ = NULL;
								GVariant* _tmp103_ = NULL;
								_tmp100_ = self->priv->settingscache;
								_tmp101_ = settings_cache_tracesettings (_tmp100_, "disk", "disk2");
								_tmp102_ = _tmp101_;
								_tmp103_ = value;
								g_settings_set_value (_tmp102_, "color", _tmp103_);
								_g_object_unref0 (_tmp102_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label21) ? _tmp18_label21 : (_tmp18_label21 = g_quark_from_static_string ("speed")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp104_ = NULL;
								GSettings* _tmp105_ = NULL;
								GSettings* _tmp106_ = NULL;
								GVariant* _tmp107_ = NULL;
								_tmp104_ = self->priv->settingscache;
								_tmp105_ = settings_cache_generalsettings (_tmp104_);
								_tmp106_ = _tmp105_;
								_tmp107_ = value;
								g_settings_set_value (_tmp106_, "speed", _tmp107_);
								_g_object_unref0 (_tmp106_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label22) ? _tmp18_label22 : (_tmp18_label22 = g_quark_from_static_string ("size")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp108_ = NULL;
								GSettings* _tmp109_ = NULL;
								GSettings* _tmp110_ = NULL;
								GVariant* _tmp111_ = NULL;
								_tmp108_ = self->priv->settingscache;
								_tmp109_ = settings_cache_generalsettings (_tmp108_);
								_tmp110_ = _tmp109_;
								_tmp111_ = value;
								g_settings_set_value (_tmp110_, "width", _tmp111_);
								_g_object_unref0 (_tmp110_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label23) ? _tmp18_label23 : (_tmp18_label23 = g_quark_from_static_string ("height")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp112_ = NULL;
								GSettings* _tmp113_ = NULL;
								GSettings* _tmp114_ = NULL;
								GVariant* _tmp115_ = NULL;
								_tmp112_ = self->priv->settingscache;
								_tmp113_ = settings_cache_generalsettings (_tmp112_);
								_tmp114_ = _tmp113_;
								_tmp115_ = value;
								g_settings_set_value (_tmp114_, "height", _tmp115_);
								_g_object_unref0 (_tmp114_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label24) ? _tmp18_label24 : (_tmp18_label24 = g_quark_from_static_string ("system-monitor")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp116_ = NULL;
								GSettings* _tmp117_ = NULL;
								GSettings* _tmp118_ = NULL;
								GVariant* _tmp119_ = NULL;
								_tmp116_ = self->priv->settingscache;
								_tmp117_ = settings_cache_generalsettings (_tmp116_);
								_tmp118_ = _tmp117_;
								_tmp119_ = value;
								g_settings_set_value (_tmp118_, "system-monitor", _tmp119_);
								_g_object_unref0 (_tmp118_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label25) ? _tmp18_label25 : (_tmp18_label25 = g_quark_from_static_string ("autostart")))) {
						switch (0) {
							default:
							{
								SettingsCache* _tmp120_ = NULL;
								GSettings* _tmp121_ = NULL;
								GSettings* _tmp122_ = NULL;
								GVariant* _tmp123_ = NULL;
								_tmp120_ = self->priv->settingscache;
								_tmp121_ = settings_cache_generalsettings (_tmp120_);
								_tmp122_ = _tmp121_;
								_tmp123_ = value;
								g_settings_set_value (_tmp122_, "autostart", _tmp123_);
								_g_object_unref0 (_tmp122_);
								break;
							}
						}
					}
				}
				_g_variant_unref0 (defaultvalue);
				_g_variant_unref0 (value);
				_g_free0 (key);
			}
		}
		key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_g_object_unref0 (oldsettings);
}


static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle) {
	int i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}


static void settings_conversion_copysettings (SettingsConversion* self, GSettings* oldsettings, GSettings* newsettings, gchar** ignore, int ignore_length1) {
	GSettings* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	g_return_if_fail (IS_SETTINGS_CONVERSION (self));
	g_return_if_fail (G_IS_SETTINGS (oldsettings));
	g_return_if_fail (G_IS_SETTINGS (newsettings));
	_tmp0_ = oldsettings;
	_tmp2_ = _tmp1_ = g_settings_list_keys (_tmp0_);
	{
		gchar** key_collection = NULL;
		gint key_collection_length1 = 0;
		gint _key_collection_size_ = 0;
		gint key_it = 0;
		key_collection = _tmp2_;
		key_collection_length1 = _vala_array_length (_tmp1_);
		for (key_it = 0; key_it < _vala_array_length (_tmp1_); key_it = key_it + 1) {
			gchar* _tmp3_ = NULL;
			gchar* key = NULL;
			_tmp3_ = g_strdup (key_collection[key_it]);
			key = _tmp3_;
			{
				GVariant* value = NULL;
				GSettings* _tmp4_ = NULL;
				const gchar* _tmp5_ = NULL;
				GVariant* _tmp6_ = NULL;
				GSettings* _tmp7_ = NULL;
				const gchar* _tmp8_ = NULL;
				const gchar* _tmp9_ = NULL;
				gchar** _tmp10_ = NULL;
				gint _tmp10__length1 = 0;
				GVariant* defaultvalue = NULL;
				GSettings* _tmp11_ = NULL;
				const gchar* _tmp12_ = NULL;
				GVariant* _tmp13_ = NULL;
				GVariant* _tmp14_ = NULL;
				GVariant* _tmp15_ = NULL;
				gboolean _tmp16_ = FALSE;
				_tmp4_ = oldsettings;
				_tmp5_ = key;
				_tmp6_ = g_settings_get_value (_tmp4_, _tmp5_);
				value = _tmp6_;
				_tmp7_ = oldsettings;
				_tmp8_ = key;
				g_settings_reset (_tmp7_, _tmp8_);
				_tmp9_ = key;
				_tmp10_ = ignore;
				_tmp10__length1 = ignore_length1;
				if (_vala_string_array_contains (_tmp10_, _tmp10__length1, _tmp9_)) {
					_g_variant_unref0 (value);
					_g_free0 (key);
					continue;
				}
				_tmp11_ = oldsettings;
				_tmp12_ = key;
				_tmp13_ = g_settings_get_value (_tmp11_, _tmp12_);
				defaultvalue = _tmp13_;
				_tmp14_ = value;
				_tmp15_ = defaultvalue;
				_tmp16_ = g_variant_equal (_tmp14_, _tmp15_);
				if (!_tmp16_) {
					GSettings* _tmp17_ = NULL;
					const gchar* _tmp18_ = NULL;
					GVariant* _tmp19_ = NULL;
					_tmp17_ = newsettings;
					_tmp18_ = key;
					_tmp19_ = value;
					g_settings_set_value (_tmp17_, _tmp18_, _tmp19_);
				}
				_g_variant_unref0 (defaultvalue);
				_g_variant_unref0 (value);
				_g_free0 (key);
			}
		}
		key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL);
	}
}


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


static void settings_conversion_convert_version2 (SettingsConversion* self) {
	GSettings* _tmp0_ = NULL;
	GSettings* _tmp1_ = NULL;
	SettingsCache* _tmp2_ = NULL;
	GSettings* _tmp3_ = NULL;
	GSettings* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	gchar** _tmp6_ = NULL;
	gchar** _tmp7_ = NULL;
	gint _tmp7__length1 = 0;
	g_return_if_fail (IS_SETTINGS_CONVERSION (self));
	_tmp0_ = g_settings_new_with_path ("de.mh21.indicator-multiload.version2.general", "/apps/indicators/multiload/general/");
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->settingscache;
	_tmp3_ = settings_cache_generalsettings (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strdup ("settings-version");
	_tmp6_ = g_new0 (gchar*, 1 + 1);
	_tmp6_[0] = _tmp5_;
	_tmp7_ = _tmp6_;
	_tmp7__length1 = 1;
	settings_conversion_copysettings (self, _tmp1_, _tmp4_, _tmp7_, 1);
	_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_tmp4_);
	_g_object_unref0 (_tmp1_);
	{
		guint j = 0U;
		guint jsize = 0U;
		j = (guint) 0;
		jsize = (guint) G_N_ELEMENTS (SETTINGS_CONVERSION_version2graphs);
		{
			gboolean _tmp8_ = FALSE;
			_tmp8_ = TRUE;
			while (TRUE) {
				gboolean _tmp9_ = FALSE;
				guint _tmp11_ = 0U;
				guint _tmp12_ = 0U;
				gchar* graph = NULL;
				guint _tmp13_ = 0U;
				const gchar* _tmp14_ = NULL;
				gchar* _tmp15_ = NULL;
				const gchar* _tmp16_ = NULL;
				const gchar* _tmp17_ = NULL;
				gchar* _tmp18_ = NULL;
				gchar* _tmp19_ = NULL;
				const gchar* _tmp20_ = NULL;
				const gchar* _tmp21_ = NULL;
				gchar* _tmp22_ = NULL;
				gchar* _tmp23_ = NULL;
				GSettings* _tmp24_ = NULL;
				GSettings* _tmp25_ = NULL;
				SettingsCache* _tmp26_ = NULL;
				const gchar* _tmp27_ = NULL;
				GSettings* _tmp28_ = NULL;
				GSettings* _tmp29_ = NULL;
				gchar* _tmp30_ = NULL;
				gchar* _tmp31_ = NULL;
				gchar** _tmp32_ = NULL;
				gchar** _tmp33_ = NULL;
				gint _tmp33__length1 = 0;
				_tmp9_ = _tmp8_;
				if (!_tmp9_) {
					guint _tmp10_ = 0U;
					_tmp10_ = j;
					j = _tmp10_ + 1;
				}
				_tmp8_ = FALSE;
				_tmp11_ = j;
				_tmp12_ = jsize;
				if (!(_tmp11_ < _tmp12_)) {
					break;
				}
				_tmp13_ = j;
				_tmp14_ = SETTINGS_CONVERSION_version2graphs[_tmp13_];
				_tmp15_ = g_strdup (_tmp14_);
				graph = _tmp15_;
				_tmp16_ = graph;
				_tmp17_ = string_to_string (_tmp16_);
				_tmp18_ = g_strconcat ("de.mh21.indicator-multiload.version2.graphs.", _tmp17_, NULL);
				_tmp19_ = _tmp18_;
				_tmp20_ = graph;
				_tmp21_ = string_to_string (_tmp20_);
				_tmp22_ = g_strconcat ("/apps/indicators/multiload/graphs/", _tmp21_, "/", NULL);
				_tmp23_ = _tmp22_;
				_tmp24_ = g_settings_new_with_path (_tmp19_, _tmp23_);
				_tmp25_ = _tmp24_;
				_tmp26_ = self->priv->settingscache;
				_tmp27_ = graph;
				_tmp28_ = settings_cache_graphsettings (_tmp26_, _tmp27_);
				_tmp29_ = _tmp28_;
				_tmp30_ = g_strdup ("alpha");
				_tmp31_ = g_strdup ("background-color");
				_tmp32_ = g_new0 (gchar*, 2 + 1);
				_tmp32_[0] = _tmp30_;
				_tmp32_[1] = _tmp31_;
				_tmp33_ = _tmp32_;
				_tmp33__length1 = 2;
				settings_conversion_copysettings (self, _tmp25_, _tmp29_, _tmp33_, 2);
				_tmp33_ = (_vala_array_free (_tmp33_, _tmp33__length1, (GDestroyNotify) g_free), NULL);
				_g_object_unref0 (_tmp29_);
				_g_object_unref0 (_tmp25_);
				_g_free0 (_tmp23_);
				_g_free0 (_tmp19_);
				{
					guint i = 0U;
					guint isize = 0U;
					guint _tmp34_ = 0U;
					guint _tmp35_ = 0U;
					i = (guint) 1;
					_tmp34_ = j;
					_tmp35_ = SETTINGS_CONVERSION_version2traces[_tmp34_];
					isize = _tmp35_;
					{
						gboolean _tmp36_ = FALSE;
						_tmp36_ = TRUE;
						while (TRUE) {
							gboolean _tmp37_ = FALSE;
							guint _tmp39_ = 0U;
							guint _tmp40_ = 0U;
							const gchar* _tmp41_ = NULL;
							const gchar* _tmp42_ = NULL;
							guint _tmp43_ = 0U;
							gchar* _tmp44_ = NULL;
							gchar* _tmp45_ = NULL;
							gchar* _tmp46_ = NULL;
							gchar* _tmp47_ = NULL;
							const gchar* _tmp48_ = NULL;
							const gchar* _tmp49_ = NULL;
							const gchar* _tmp50_ = NULL;
							const gchar* _tmp51_ = NULL;
							guint _tmp52_ = 0U;
							gchar* _tmp53_ = NULL;
							gchar* _tmp54_ = NULL;
							gchar* _tmp55_ = NULL;
							gchar* _tmp56_ = NULL;
							GSettings* _tmp57_ = NULL;
							GSettings* _tmp58_ = NULL;
							SettingsCache* _tmp59_ = NULL;
							const gchar* _tmp60_ = NULL;
							const gchar* _tmp61_ = NULL;
							const gchar* _tmp62_ = NULL;
							guint _tmp63_ = 0U;
							gchar* _tmp64_ = NULL;
							gchar* _tmp65_ = NULL;
							gchar* _tmp66_ = NULL;
							gchar* _tmp67_ = NULL;
							GSettings* _tmp68_ = NULL;
							GSettings* _tmp69_ = NULL;
							gchar** _tmp70_ = NULL;
							gchar** _tmp71_ = NULL;
							gint _tmp71__length1 = 0;
							_tmp37_ = _tmp36_;
							if (!_tmp37_) {
								guint _tmp38_ = 0U;
								_tmp38_ = i;
								i = _tmp38_ + 1;
							}
							_tmp36_ = FALSE;
							_tmp39_ = i;
							_tmp40_ = isize;
							if (!(_tmp39_ <= _tmp40_)) {
								break;
							}
							_tmp41_ = graph;
							_tmp42_ = string_to_string (_tmp41_);
							_tmp43_ = i;
							_tmp44_ = g_strdup_printf ("%u", _tmp43_);
							_tmp45_ = _tmp44_;
							_tmp46_ = g_strconcat ("de.mh21.indicator-multiload.version2.traces.", _tmp42_, _tmp45_, NULL);
							_tmp47_ = _tmp46_;
							_tmp48_ = graph;
							_tmp49_ = string_to_string (_tmp48_);
							_tmp50_ = graph;
							_tmp51_ = string_to_string (_tmp50_);
							_tmp52_ = i;
							_tmp53_ = g_strdup_printf ("%u", _tmp52_);
							_tmp54_ = _tmp53_;
							_tmp55_ = g_strconcat ("/apps/indicators/multiload/graphs/", _tmp49_, "/", _tmp51_, _tmp54_, "/", NULL);
							_tmp56_ = _tmp55_;
							_tmp57_ = g_settings_new_with_path (_tmp47_, _tmp56_);
							_tmp58_ = _tmp57_;
							_tmp59_ = self->priv->settingscache;
							_tmp60_ = graph;
							_tmp61_ = graph;
							_tmp62_ = string_to_string (_tmp61_);
							_tmp63_ = i;
							_tmp64_ = g_strdup_printf ("%u", _tmp63_);
							_tmp65_ = _tmp64_;
							_tmp66_ = g_strconcat (_tmp62_, _tmp65_, NULL);
							_tmp67_ = _tmp66_;
							_tmp68_ = settings_cache_tracesettings (_tmp59_, _tmp60_, _tmp67_);
							_tmp69_ = _tmp68_;
							_tmp70_ = g_new0 (gchar*, 0 + 1);
							_tmp71_ = _tmp70_;
							_tmp71__length1 = 0;
							settings_conversion_copysettings (self, _tmp58_, _tmp69_, _tmp71_, 0);
							_tmp71_ = (_vala_array_free (_tmp71_, _tmp71__length1, (GDestroyNotify) g_free), NULL);
							_g_object_unref0 (_tmp69_);
							_g_free0 (_tmp67_);
							_g_free0 (_tmp65_);
							_g_object_unref0 (_tmp58_);
							_g_free0 (_tmp56_);
							_g_free0 (_tmp54_);
							_g_free0 (_tmp47_);
							_g_free0 (_tmp45_);
						}
					}
				}
				_g_free0 (graph);
			}
		}
	}
}


SettingsConversion* settings_conversion_construct (GType object_type) {
	SettingsConversion * self = NULL;
	self = (SettingsConversion*) g_object_new (object_type, NULL);
	return self;
}


SettingsConversion* settings_conversion_new (void) {
	return settings_conversion_construct (TYPE_SETTINGS_CONVERSION);
}


static void settings_conversion_class_init (SettingsConversionClass * klass) {
	settings_conversion_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (SettingsConversionPrivate));
	G_OBJECT_CLASS (klass)->finalize = settings_conversion_finalize;
}


static void settings_conversion_instance_init (SettingsConversion * self) {
	SettingsCache* _tmp0_ = NULL;
	self->priv = SETTINGS_CONVERSION_GET_PRIVATE (self);
	_tmp0_ = settings_cache_new ();
	self->priv->settingscache = _tmp0_;
}


static void settings_conversion_finalize (GObject* obj) {
	SettingsConversion * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SETTINGS_CONVERSION, SettingsConversion);
	_g_object_unref0 (self->priv->settingscache);
	G_OBJECT_CLASS (settings_conversion_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 settings_conversion_get_type (void) {
	static volatile gsize settings_conversion_type_id__volatile = 0;
	if (g_once_init_enter (&settings_conversion_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SettingsConversionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) settings_conversion_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SettingsConversion), 0, (GInstanceInitFunc) settings_conversion_instance_init, NULL };
		GType settings_conversion_type_id;
		settings_conversion_type_id = g_type_register_static (G_TYPE_OBJECT, "SettingsConversion", &g_define_type_info, 0);
		g_once_init_leave (&settings_conversion_type_id__volatile, settings_conversion_type_id);
	}
	return settings_conversion_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;
}



