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

/* Copyright 2011-2015 Switchboard Locale Plug Developers
*
* This program is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser 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, see http://www.gnu.org/licenses/.
*/

#include "locale-plug.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <glib-object.h>
#include <gio/gio.h>

#define SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_LANGUAGE_CHECKER "/usr/bin/check-language-support"

enum  {
	SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_0_PROPERTY,
	SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_CANCELLABLE_PROPERTY,
	SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_PROPERTY,
	SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_LANGUAGE_CODE_PROPERTY,
	SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_NUM_PROPERTIES
};
static GParamSpec* switchboard_plug_locale_installer_ubuntu_installer_properties[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block2Data Block2Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _SwitchboardPlugLocaleInstallerUbuntuInstallerCheckMissingLanguagesData SwitchboardPlugLocaleInstallerUbuntuInstallerCheckMissingLanguagesData;
typedef struct _Block3Data Block3Data;
typedef struct _Block4Data Block4Data;
enum  {
	SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_FINISHED_SIGNAL,
	SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_FAILED_SIGNAL,
	SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_REMOVE_FINISHED_SIGNAL,
	SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_CHECK_MISSING_FINISHED_SIGNAL,
	SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_PROGRESS_CHANGED_SIGNAL,
	SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_NUM_SIGNALS
};
static guint switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_NUM_SIGNALS] = {0};

struct _SwitchboardPlugLocaleInstallerUbuntuInstallerPrivate {
	AptdProxy* aptd;
	AptdTransactionProxy* proxy;
	gchar** missing_packages;
	gint missing_packages_length1;
	gint _missing_packages_size_;
	gboolean _install_cancellable;
	SwitchboardPlugLocaleInstallerUbuntuInstallerTransactionMode _transaction_mode;
	gchar* _transaction_language_code;
	GeeHashMap* transactions;
};

struct _Block2Data {
	int _ref_count_;
	SwitchboardPlugLocaleInstallerUbuntuInstaller* self;
	gchar* language;
};

struct _SwitchboardPlugLocaleInstallerUbuntuInstallerCheckMissingLanguagesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SwitchboardPlugLocaleInstallerUbuntuInstaller* self;
	gint _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
};

struct _Block3Data {
	int _ref_count_;
	SwitchboardPlugLocaleInstallerUbuntuInstaller* self;
	gchar* languagecode;
};

struct _Block4Data {
	int _ref_count_;
	SwitchboardPlugLocaleInstallerUbuntuInstaller* self;
	gchar* transaction_id;
};

static gint SwitchboardPlugLocaleInstallerUbuntuInstaller_private_offset;
static gpointer switchboard_plug_locale_installer_ubuntu_installer_parent_class = NULL;
static GOnce switchboard_plug_locale_installer_ubuntu_installer_instance;
static GOnce switchboard_plug_locale_installer_ubuntu_installer_instance = (GOnce) G_ONCE_INIT;

static SwitchboardPlugLocaleInstallerUbuntuInstaller* __lambda18_ (void);
static SwitchboardPlugLocaleInstallerUbuntuInstaller* switchboard_plug_locale_installer_ubuntu_installer_new (void);
static SwitchboardPlugLocaleInstallerUbuntuInstaller* switchboard_plug_locale_installer_ubuntu_installer_construct (GType object_type);
static gpointer ___lambda18__gthread_func (gpointer self);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void switchboard_plug_locale_installer_ubuntu_installer_set_transaction_mode (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                              SwitchboardPlugLocaleInstallerUbuntuInstallerTransactionMode value);
static gchar** switchboard_plug_locale_installer_ubuntu_installer_get_remaining_packages_for_language (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                                                const gchar* langcode,
                                                                                                gint* result_length1);
static void switchboard_plug_locale_installer_ubuntu_installer_set_transaction_language_code (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                                       const gchar* value);
static void __lambda19_ (Block2Data* _data2_,
                  GObject* obj,
                  GAsyncResult* res);
static void switchboard_plug_locale_installer_ubuntu_installer_run_transaction (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                         const gchar* transaction_id);
static void ___lambda19__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void switchboard_plug_locale_installer_ubuntu_installer_install_packages (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                          gchar** packages,
                                                                          gint packages_length1);
static void __lambda22_ (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda22__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages_data_free (gpointer _data);
static gboolean switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages_co (SwitchboardPlugLocaleInstallerUbuntuInstallerCheckMissingLanguagesData* _data_);
static void switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages_ready (GObject* source_object,
                                                                                       GAsyncResult* _res_,
                                                                                       gpointer _user_data_);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static gchar** switchboard_plug_locale_installer_ubuntu_installer_get_to_remove_packages_for_language (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                                                const gchar* language,
                                                                                                gint* result_length1);
static void __lambda23_ (Block3Data* _data3_,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda23__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static void __lambda20_ (Block4Data* _data4_);
static void switchboard_plug_locale_installer_ubuntu_installer_on_apt_finshed (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                        const gchar* id,
                                                                        gboolean success);
static void ___lambda20__aptd_transaction_proxy_finished (AptdTransactionProxy* _sender,
                                                   const gchar* transaction_id,
                                                   gpointer self);
static void __lambda21_ (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                  const gchar* prop,
                  GVariant* val);
static void switchboard_plug_locale_installer_ubuntu_installer_set_install_cancellable (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                                 gboolean value);
static void ___lambda21__aptd_transaction_proxy_property_changed (AptdTransactionProxy* _sender,
                                                           const gchar* property,
                                                           GVariant* variant,
                                                           gpointer self);
static gchar** switchboard_plug_locale_installer_ubuntu_installer_get_installed_packages_for_language (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                                                const gchar* langcode,
                                                                                                gint* result_length1);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data);
static GObject * switchboard_plug_locale_installer_ubuntu_installer_constructor (GType type,
                                                                          guint n_construct_properties,
                                                                          GObjectConstructParam * construct_properties);
static void switchboard_plug_locale_installer_ubuntu_installer_finalize (GObject * obj);
static GType switchboard_plug_locale_installer_ubuntu_installer_get_type_once (void);
static void _vala_switchboard_plug_locale_installer_ubuntu_installer_get_property (GObject * object,
                                                                            guint property_id,
                                                                            GValue * value,
                                                                            GParamSpec * pspec);
static void _vala_switchboard_plug_locale_installer_ubuntu_installer_set_property (GObject * object,
                                                                            guint property_id,
                                                                            const GValue * value,
                                                                            GParamSpec * pspec);
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 inline gpointer
switchboard_plug_locale_installer_ubuntu_installer_get_instance_private (SwitchboardPlugLocaleInstallerUbuntuInstaller* self)
{
	return G_STRUCT_MEMBER_P (self, SwitchboardPlugLocaleInstallerUbuntuInstaller_private_offset);
}

static GType
switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_get_type_once (void)
{
	static const GEnumValue values[] = {{SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_INSTALL, "SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_INSTALL", "install"}, {SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_REMOVE, "SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_REMOVE", "remove"}, {SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_INSTALL_MISSING, "SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_INSTALL_MISSING", "install-missing"}, {0, NULL, NULL}};
	GType switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_type_id;
	switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_type_id = g_enum_register_static ("SwitchboardPlugLocaleInstallerUbuntuInstallerTransactionMode", values);
	return switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_type_id;
}

GType
switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_get_type (void)
{
	static volatile gsize switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_type_id__once = 0;
	if (g_once_init_enter (&switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_type_id__once)) {
		GType switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_type_id;
		switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_type_id = switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_get_type_once ();
		g_once_init_leave (&switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_type_id__once, switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_type_id);
	}
	return switchboard_plug_locale_installer_ubuntu_installer_transaction_mode_type_id__once;
}

static SwitchboardPlugLocaleInstallerUbuntuInstaller*
__lambda18_ (void)
{
	SwitchboardPlugLocaleInstallerUbuntuInstaller* _tmp0_;
	SwitchboardPlugLocaleInstallerUbuntuInstaller* result;
	_tmp0_ = switchboard_plug_locale_installer_ubuntu_installer_new ();
	result = _tmp0_;
	return result;
}

static gpointer
___lambda18__gthread_func (gpointer self)
{
	gpointer result;
	result = __lambda18_ ();
	return result;
}

SwitchboardPlugLocaleInstallerUbuntuInstaller*
switchboard_plug_locale_installer_ubuntu_installer_get_default (void)
{
	gconstpointer _tmp0_;
	SwitchboardPlugLocaleInstallerUbuntuInstaller* result;
	_tmp0_ = g_once (&switchboard_plug_locale_installer_ubuntu_installer_instance, ___lambda18__gthread_func, NULL);
	result = (SwitchboardPlugLocaleInstallerUbuntuInstaller*) _tmp0_;
	return result;
}

static SwitchboardPlugLocaleInstallerUbuntuInstaller*
switchboard_plug_locale_installer_ubuntu_installer_construct (GType object_type)
{
	SwitchboardPlugLocaleInstallerUbuntuInstaller * self = NULL;
	self = (SwitchboardPlugLocaleInstallerUbuntuInstaller*) g_object_new (object_type, NULL);
	return self;
}

static SwitchboardPlugLocaleInstallerUbuntuInstaller*
switchboard_plug_locale_installer_ubuntu_installer_new (void)
{
	return switchboard_plug_locale_installer_ubuntu_installer_construct (SWITCHBOARD_PLUG_LOCALE_INSTALLER_TYPE_UBUNTU_INSTALLER);
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		SwitchboardPlugLocaleInstallerUbuntuInstaller* self;
		self = _data2_->self;
		_g_free0 (_data2_->language);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

static void
__lambda19_ (Block2Data* _data2_,
             GObject* obj,
             GAsyncResult* res)
{
	SwitchboardPlugLocaleInstallerUbuntuInstaller* self;
	GError* _inner_error0_ = NULL;
	self = _data2_->self;
	g_return_if_fail (res != NULL);
	{
		gchar* transaction_id = NULL;
		AptdProxy* _tmp0_;
		gchar* _tmp1_;
		GeeHashMap* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp0_ = self->priv->aptd;
		_tmp1_ = aptd_proxy_install_packages_finish (_tmp0_, res, &_inner_error0_);
		transaction_id = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = self->priv->transactions;
		_tmp3_ = g_strconcat ("i-", _data2_->language, NULL);
		_tmp4_ = _tmp3_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp2_, transaction_id, _tmp4_);
		_g_free0 (_tmp4_);
		switchboard_plug_locale_installer_ubuntu_installer_run_transaction (self, transaction_id);
		_g_free0 (transaction_id);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		g_warning ("UbuntuInstaller.vala:77: Could not queue downloads: %s", _tmp6_);
		_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
___lambda19__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda19_ (self, source_object, res);
	block2_data_unref (self);
}

void
switchboard_plug_locale_installer_ubuntu_installer_install (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                            const gchar* language)
{
	Block2Data* _data2_;
	gchar* _tmp0_;
	gchar** packages = NULL;
	gint _tmp1_ = 0;
	gchar** _tmp2_;
	gint packages_length1;
	gint _packages_size_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	AptdProxy* _tmp6_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	g_return_if_fail (self != NULL);
	g_return_if_fail (language != NULL);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_data2_->self = g_object_ref (self);
	_tmp0_ = g_strdup (language);
	_g_free0 (_data2_->language);
	_data2_->language = _tmp0_;
	switchboard_plug_locale_installer_ubuntu_installer_set_transaction_mode (self, SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_INSTALL);
	_tmp2_ = switchboard_plug_locale_installer_ubuntu_installer_get_remaining_packages_for_language (self, _data2_->language, &_tmp1_);
	packages = _tmp2_;
	packages_length1 = _tmp1_;
	_packages_size_ = packages_length1;
	switchboard_plug_locale_installer_ubuntu_installer_set_transaction_language_code (self, _data2_->language);
	_tmp3_ = packages;
	_tmp3__length1 = packages_length1;
	{
		gchar** packet_collection = NULL;
		gint packet_collection_length1 = 0;
		gint _packet_collection_size_ = 0;
		gint packet_it = 0;
		packet_collection = _tmp3_;
		packet_collection_length1 = _tmp3__length1;
		for (packet_it = 0; packet_it < packet_collection_length1; packet_it = packet_it + 1) {
			gchar* _tmp4_;
			gchar* packet = NULL;
			_tmp4_ = g_strdup (packet_collection[packet_it]);
			packet = _tmp4_;
			{
				const gchar* _tmp5_;
				_tmp5_ = packet;
				g_message ("UbuntuInstaller.vala:68: Packet: %s", _tmp5_);
				_g_free0 (packet);
			}
		}
	}
	_tmp6_ = self->priv->aptd;
	_tmp7_ = packages;
	_tmp7__length1 = packages_length1;
	aptd_proxy_install_packages (_tmp6_, _tmp7_, (gint) _tmp7__length1, ___lambda19__gasync_ready_callback, block2_data_ref (_data2_));
	packages = (_vala_array_free (packages, packages_length1, (GDestroyNotify) g_free), NULL);
	block2_data_unref (_data2_);
	_data2_ = NULL;
}

static void
__lambda22_ (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
             GObject* obj,
             GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		gchar* transaction_id = NULL;
		AptdProxy* _tmp0_;
		gchar* _tmp1_;
		GeeHashMap* _tmp2_;
		_tmp0_ = self->priv->aptd;
		_tmp1_ = aptd_proxy_install_packages_finish (_tmp0_, res, &_inner_error0_);
		transaction_id = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = self->priv->transactions;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp2_, transaction_id, "install-missing");
		switchboard_plug_locale_installer_ubuntu_installer_run_transaction (self, transaction_id);
		_g_free0 (transaction_id);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		const gchar* _tmp4_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		g_warning ("UbuntuInstaller.vala:93: Could not queue downloads: %s", _tmp4_);
		_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
___lambda22__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda22_ ((SwitchboardPlugLocaleInstallerUbuntuInstaller*) self, source_object, res);
	g_object_unref (self);
}

static void
switchboard_plug_locale_installer_ubuntu_installer_install_packages (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                     gchar** packages,
                                                                     gint packages_length1)
{
	AptdProxy* _tmp2_;
	g_return_if_fail (self != NULL);
	{
		gchar** packet_collection = NULL;
		gint packet_collection_length1 = 0;
		gint _packet_collection_size_ = 0;
		gint packet_it = 0;
		packet_collection = packages;
		packet_collection_length1 = packages_length1;
		for (packet_it = 0; packet_it < packet_collection_length1; packet_it = packet_it + 1) {
			gchar* _tmp0_;
			gchar* packet = NULL;
			_tmp0_ = g_strdup (packet_collection[packet_it]);
			packet = _tmp0_;
			{
				const gchar* _tmp1_;
				_tmp1_ = packet;
				g_message ("UbuntuInstaller.vala:84: will install: %s", _tmp1_);
				_g_free0 (packet);
			}
		}
	}
	_tmp2_ = self->priv->aptd;
	aptd_proxy_install_packages (_tmp2_, packages, (gint) packages_length1, ___lambda22__gasync_ready_callback, g_object_ref (self));
}

static void
switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages_data_free (gpointer _data)
{
	SwitchboardPlugLocaleInstallerUbuntuInstallerCheckMissingLanguagesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (SwitchboardPlugLocaleInstallerUbuntuInstallerCheckMissingLanguagesData, _data_);
}

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

void
switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                            GAsyncReadyCallback _callback_,
                                                                            gpointer _user_data_)
{
	SwitchboardPlugLocaleInstallerUbuntuInstallerCheckMissingLanguagesData* _data_;
	SwitchboardPlugLocaleInstallerUbuntuInstaller* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (SwitchboardPlugLocaleInstallerUbuntuInstallerCheckMissingLanguagesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages_co (_data_);
}

void
switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages_finish (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                                   GAsyncResult* _res_)
{
	SwitchboardPlugLocaleInstallerUbuntuInstallerCheckMissingLanguagesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages_ready (GObject* source_object,
                                                                                  GAsyncResult* _res_,
                                                                                  gpointer _user_data_)
{
	SwitchboardPlugLocaleInstallerUbuntuInstallerCheckMissingLanguagesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages_co (_data_);
}

static gboolean
switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages_co (SwitchboardPlugLocaleInstallerUbuntuInstallerCheckMissingLanguagesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = 0;
	_data_->_state_ = 1;
	switchboard_plug_locale_utils_get_missing_languages (switchboard_plug_locale_installer_ubuntu_installer_check_missing_languages_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp1_ = switchboard_plug_locale_utils_get_missing_languages_finish (_data_->_res_, &_data_->_tmp0_);
	_data_->self->priv->missing_packages = (_vala_array_free (_data_->self->priv->missing_packages, _data_->self->priv->missing_packages_length1, (GDestroyNotify) g_free), NULL);
	_data_->self->priv->missing_packages = _data_->_tmp1_;
	_data_->self->priv->missing_packages_length1 = _data_->_tmp0_;
	_data_->self->priv->_missing_packages_size_ = _data_->self->priv->missing_packages_length1;
	_data_->_tmp2_ = _data_->self->priv->missing_packages;
	_data_->_tmp2__length1 = _data_->self->priv->missing_packages_length1;
	g_signal_emit (_data_->self, switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_CHECK_MISSING_FINISHED_SIGNAL], 0, _data_->_tmp2_, (gint) _data_->_tmp2__length1);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
switchboard_plug_locale_installer_ubuntu_installer_install_missing_languages (SwitchboardPlugLocaleInstallerUbuntuInstaller* self)
{
	gboolean _tmp0_ = FALSE;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->missing_packages;
	_tmp1__length1 = self->priv->missing_packages_length1;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		gchar** _tmp2_;
		gint _tmp2__length1;
		_tmp2_ = self->priv->missing_packages;
		_tmp2__length1 = self->priv->missing_packages_length1;
		_tmp0_ = _tmp2__length1 == 0;
	}
	if (_tmp0_) {
		return;
	}
	switchboard_plug_locale_installer_ubuntu_installer_set_transaction_mode (self, SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_INSTALL_MISSING);
	_tmp3_ = self->priv->missing_packages;
	_tmp3__length1 = self->priv->missing_packages_length1;
	switchboard_plug_locale_installer_ubuntu_installer_install_packages (self, _tmp3_, (gint) _tmp3__length1);
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		SwitchboardPlugLocaleInstallerUbuntuInstaller* self;
		self = _data3_->self;
		_g_free0 (_data3_->languagecode);
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static void
__lambda23_ (Block3Data* _data3_,
             GObject* obj,
             GAsyncResult* res)
{
	SwitchboardPlugLocaleInstallerUbuntuInstaller* self;
	GError* _inner_error0_ = NULL;
	self = _data3_->self;
	g_return_if_fail (res != NULL);
	{
		gchar* transaction_id = NULL;
		AptdProxy* _tmp0_;
		gchar* _tmp1_;
		GeeHashMap* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp0_ = self->priv->aptd;
		_tmp1_ = aptd_proxy_remove_packages_finish (_tmp0_, res, &_inner_error0_);
		transaction_id = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = self->priv->transactions;
		_tmp3_ = g_strconcat ("r-", _data3_->languagecode, NULL);
		_tmp4_ = _tmp3_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp2_, transaction_id, _tmp4_);
		_g_free0 (_tmp4_);
		switchboard_plug_locale_installer_ubuntu_installer_run_transaction (self, transaction_id);
		_g_free0 (transaction_id);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		g_warning ("UbuntuInstaller.vala:125: Could not queue deletions: %s", _tmp6_);
		_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
___lambda23__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda23_ (self, source_object, res);
	block3_data_unref (self);
}

void
switchboard_plug_locale_installer_ubuntu_installer_remove (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                           const gchar* languagecode)
{
	Block3Data* _data3_;
	gchar* _tmp0_;
	gchar** installed = NULL;
	gint _tmp1_ = 0;
	gchar** _tmp2_;
	gint installed_length1;
	gint _installed_size_;
	AptdProxy* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (languagecode != NULL);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_data3_->self = g_object_ref (self);
	_tmp0_ = g_strdup (languagecode);
	_g_free0 (_data3_->languagecode);
	_data3_->languagecode = _tmp0_;
	switchboard_plug_locale_installer_ubuntu_installer_set_transaction_mode (self, SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_REMOVE);
	switchboard_plug_locale_installer_ubuntu_installer_set_transaction_language_code (self, _data3_->languagecode);
	_tmp2_ = switchboard_plug_locale_installer_ubuntu_installer_get_to_remove_packages_for_language (self, _data3_->languagecode, &_tmp1_);
	installed = _tmp2_;
	installed_length1 = _tmp1_;
	_installed_size_ = installed_length1;
	_tmp3_ = self->priv->aptd;
	aptd_proxy_remove_packages (_tmp3_, installed, (gint) installed_length1, ___lambda23__gasync_ready_callback, block3_data_ref (_data3_));
	installed = (_vala_array_free (installed, installed_length1, (GDestroyNotify) g_free), NULL);
	block3_data_unref (_data3_);
	_data3_ = NULL;
}

void
switchboard_plug_locale_installer_ubuntu_installer_cancel_install (SwitchboardPlugLocaleInstallerUbuntuInstaller* self)
{
	gboolean _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_install_cancellable;
	if (_tmp0_) {
		g_warning ("UbuntuInstaller.vala:132: cancel_install");
		{
			AptdTransactionProxy* _tmp1_;
			_tmp1_ = self->priv->proxy;
			aptd_transaction_proxy_cancel (_tmp1_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GError* _tmp2_;
			const gchar* _tmp3_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp2_ = e;
			_tmp3_ = _tmp2_->message;
			g_warning ("UbuntuInstaller.vala:136: cannot cancel installation:%s", _tmp3_);
			_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 Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		SwitchboardPlugLocaleInstallerUbuntuInstaller* self;
		self = _data4_->self;
		_g_free0 (_data4_->transaction_id);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static void
__lambda20_ (Block4Data* _data4_)
{
	SwitchboardPlugLocaleInstallerUbuntuInstaller* self;
	self = _data4_->self;
	switchboard_plug_locale_installer_ubuntu_installer_on_apt_finshed (self, _data4_->transaction_id, TRUE);
}

static void
___lambda20__aptd_transaction_proxy_finished (AptdTransactionProxy* _sender,
                                              const gchar* transaction_id,
                                              gpointer self)
{
	__lambda20_ (self);
}

static void
__lambda21_ (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
             const gchar* prop,
             GVariant* val)
{
	g_return_if_fail (prop != NULL);
	g_return_if_fail (val != NULL);
	if (g_strcmp0 (prop, "Progress") == 0) {
		g_signal_emit (self, switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_PROGRESS_CHANGED_SIGNAL], 0, (gint) g_variant_get_int32 (val));
	}
	if (g_strcmp0 (prop, "Cancellable") == 0) {
		switchboard_plug_locale_installer_ubuntu_installer_set_install_cancellable (self, g_variant_get_boolean (val));
	}
}

static void
___lambda21__aptd_transaction_proxy_property_changed (AptdTransactionProxy* _sender,
                                                      const gchar* property,
                                                      GVariant* variant,
                                                      gpointer self)
{
	__lambda21_ ((SwitchboardPlugLocaleInstallerUbuntuInstaller*) self, property, variant);
}

static void
switchboard_plug_locale_installer_ubuntu_installer_run_transaction (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                    const gchar* transaction_id)
{
	Block4Data* _data4_;
	gchar* _tmp0_;
	AptdTransactionProxy* _tmp1_;
	AptdTransactionProxy* _tmp2_;
	AptdTransactionProxy* _tmp3_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (transaction_id != NULL);
	_data4_ = g_slice_new0 (Block4Data);
	_data4_->_ref_count_ = 1;
	_data4_->self = g_object_ref (self);
	_tmp0_ = g_strdup (transaction_id);
	_g_free0 (_data4_->transaction_id);
	_data4_->transaction_id = _tmp0_;
	_tmp1_ = aptd_transaction_proxy_new ();
	_g_object_unref0 (self->priv->proxy);
	self->priv->proxy = _tmp1_;
	_tmp2_ = self->priv->proxy;
	g_signal_connect_data (_tmp2_, "finished", (GCallback) ___lambda20__aptd_transaction_proxy_finished, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
	_tmp3_ = self->priv->proxy;
	g_signal_connect_object (_tmp3_, "property-changed", (GCallback) ___lambda21__aptd_transaction_proxy_property_changed, self, 0);
	{
		AptdTransactionProxy* _tmp4_;
		AptdTransactionProxy* _tmp5_;
		AptdTransactionProxy* _tmp6_;
		_tmp4_ = self->priv->proxy;
		aptd_transaction_proxy_connect_to_aptd (_tmp4_, _data4_->transaction_id, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp5_ = self->priv->proxy;
		aptd_transaction_proxy_simulate (_tmp5_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp6_ = self->priv->proxy;
		aptd_transaction_proxy_run (_tmp6_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp7_;
		const gchar* _tmp8_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		switchboard_plug_locale_installer_ubuntu_installer_on_apt_finshed (self, _data4_->transaction_id, FALSE);
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		g_warning ("UbuntuInstaller.vala:164: Could no run transaction: %s", _tmp8_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		block4_data_unref (_data4_);
		_data4_ = 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;
	}
	block4_data_unref (_data4_);
	_data4_ = NULL;
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static void
switchboard_plug_locale_installer_ubuntu_installer_on_apt_finshed (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                   const gchar* id,
                                                                   gboolean success)
{
	GeeHashMap* _tmp1_;
	gchar* action = NULL;
	GeeHashMap* _tmp2_;
	gpointer _tmp3_;
	const gchar* _tmp4_;
	gchar* lang = NULL;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gchar* _tmp10_;
	const gchar* _tmp11_ = NULL;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gboolean _tmp15_;
	GeeHashMap* _tmp18_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	if (!success) {
		GeeHashMap* _tmp0_;
		g_signal_emit (self, switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_FAILED_SIGNAL], 0);
		_tmp0_ = self->priv->transactions;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp0_, id, NULL);
		return;
	}
	_tmp1_ = self->priv->transactions;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp1_, id)) {
		return;
	}
	_tmp2_ = self->priv->transactions;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp2_, id);
	action = (gchar*) _tmp3_;
	_tmp4_ = action;
	if (g_strcmp0 (_tmp4_, "install-missing") == 0) {
		GeeHashMap* _tmp5_;
		g_signal_emit (self, switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_FINISHED_SIGNAL], 0, "");
		_tmp5_ = self->priv->transactions;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp5_, id, NULL);
		_g_free0 (action);
		return;
	}
	_tmp6_ = action;
	_tmp7_ = action;
	_tmp8_ = strlen (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = string_slice (_tmp6_, (glong) 2, (glong) _tmp9_);
	lang = _tmp10_;
	if (success) {
		_tmp11_ = "success";
	} else {
		_tmp11_ = "failed";
	}
	g_message ("UbuntuInstaller.vala:188: ID %s -> %s", id, _tmp11_);
	_tmp12_ = action;
	_tmp13_ = string_slice (_tmp12_, (glong) 0, (glong) 1);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_strcmp0 (_tmp14_, "i") == 0;
	_g_free0 (_tmp14_);
	if (_tmp15_) {
		const gchar* _tmp16_;
		_tmp16_ = lang;
		g_signal_emit (self, switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_FINISHED_SIGNAL], 0, _tmp16_);
	} else {
		const gchar* _tmp17_;
		_tmp17_ = lang;
		g_signal_emit (self, switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_REMOVE_FINISHED_SIGNAL], 0, _tmp17_);
	}
	_tmp18_ = self->priv->transactions;
	gee_abstract_map_unset ((GeeAbstractMap*) _tmp18_, id, NULL);
	_g_free0 (lang);
	_g_free0 (action);
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static gchar**
switchboard_plug_locale_installer_ubuntu_installer_get_remaining_packages_for_language (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                                        const gchar* langcode,
                                                                                        gint* result_length1)
{
	gchar* output = NULL;
	gint status = 0;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar** _tmp12_;
	gchar** _tmp13_;
	gchar** _tmp14_;
	gint _tmp14__length1;
	gchar** _tmp15_;
	gint _tmp15__length1;
	GError* _inner_error0_ = NULL;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (langcode != NULL, NULL);
	{
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar** _tmp3_;
		gchar** _tmp4_;
		gint _tmp4__length1;
		gchar** _tmp5_;
		gchar** _tmp6_;
		gchar** _tmp7_;
		gint _tmp7__length1;
		gchar* _tmp8_ = NULL;
		gint _tmp9_ = 0;
		_tmp0_ = g_strdup (SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_LANGUAGE_CHECKER);
		_tmp1_ = g_strdup ("-l");
		_tmp2_ = g_strdup (langcode);
		_tmp3_ = g_new0 (gchar*, 4 + 1);
		_tmp3_[0] = _tmp0_;
		_tmp3_[1] = _tmp1_;
		_tmp3_[2] = _tmp2_;
		_tmp3_[3] = NULL;
		_tmp4_ = _tmp3_;
		_tmp4__length1 = 4;
		_tmp6_ = _tmp5_ = g_get_environ ();
		_tmp7_ = _tmp6_;
		_tmp7__length1 = _vala_array_length (_tmp5_);
		g_spawn_sync (NULL, _tmp4_, _tmp7_, G_SPAWN_SEARCH_PATH, NULL, NULL, &_tmp8_, NULL, &_tmp9_, &_inner_error0_);
		_g_free0 (output);
		output = _tmp8_;
		status = _tmp9_;
		_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL);
		_tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (GDestroyNotify) g_free), NULL);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		g_warning ("UbuntuInstaller.vala:213: Could not get remaining language packages fo" \
"r %s", langcode);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (output);
		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;
	}
	_tmp10_ = string_strip (output);
	_tmp11_ = _tmp10_;
	_tmp13_ = _tmp12_ = g_strsplit (_tmp11_, " ", 0);
	_tmp14_ = _tmp13_;
	_tmp14__length1 = _vala_array_length (_tmp12_);
	_g_free0 (_tmp11_);
	_tmp15_ = _tmp14_;
	_tmp15__length1 = _tmp14__length1;
	if (result_length1) {
		*result_length1 = _tmp15__length1;
	}
	result = _tmp15_;
	_g_free0 (output);
	return result;
}

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

static gchar**
switchboard_plug_locale_installer_ubuntu_installer_get_to_remove_packages_for_language (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                                        const gchar* language,
                                                                                        gint* result_length1)
{
	gchar** installed = NULL;
	gint _tmp0_ = 0;
	gchar** _tmp1_;
	gint installed_length1;
	gint _installed_size_;
	gchar** multilang_packs = NULL;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar** _tmp4_;
	gint multilang_packs_length1;
	gint _multilang_packs_size_;
	gchar** missing_packs = NULL;
	gint _tmp5_ = 0;
	gchar** _tmp6_;
	gint missing_packs_length1;
	gint _missing_packs_size_;
	GeeArrayList* removable = NULL;
	GeeArrayList* _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	GeeArrayList* _tmp17_;
	gint _tmp18_ = 0;
	gpointer* _tmp19_;
	gchar** _tmp20_;
	gint _tmp20__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (language != NULL, NULL);
	_tmp1_ = switchboard_plug_locale_installer_ubuntu_installer_get_installed_packages_for_language (self, language, &_tmp0_);
	installed = _tmp1_;
	installed_length1 = _tmp0_;
	_installed_size_ = installed_length1;
	_tmp2_ = g_strdup ("chromium-browser-l10n");
	_tmp3_ = g_strdup ("poppler-data");
	_tmp4_ = g_new0 (gchar*, 2 + 1);
	_tmp4_[0] = _tmp2_;
	_tmp4_[1] = _tmp3_;
	multilang_packs = _tmp4_;
	multilang_packs_length1 = 2;
	_multilang_packs_size_ = multilang_packs_length1;
	_tmp6_ = switchboard_plug_locale_installer_ubuntu_installer_get_remaining_packages_for_language (self, language, &_tmp5_);
	missing_packs = _tmp6_;
	missing_packs_length1 = _tmp5_;
	_missing_packs_size_ = missing_packs_length1;
	_tmp7_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	removable = _tmp7_;
	_tmp8_ = installed;
	_tmp8__length1 = installed_length1;
	{
		gchar** packet_collection = NULL;
		gint packet_collection_length1 = 0;
		gint _packet_collection_size_ = 0;
		gint packet_it = 0;
		packet_collection = _tmp8_;
		packet_collection_length1 = _tmp8__length1;
		for (packet_it = 0; packet_it < packet_collection_length1; packet_it = packet_it + 1) {
			gchar* _tmp9_;
			gchar* packet = NULL;
			_tmp9_ = g_strdup (packet_collection[packet_it]);
			packet = _tmp9_;
			{
				gboolean _tmp10_ = FALSE;
				const gchar* _tmp11_;
				gchar** _tmp12_;
				gint _tmp12__length1;
				_tmp11_ = packet;
				_tmp12_ = multilang_packs;
				_tmp12__length1 = multilang_packs_length1;
				if (!_vala_string_array_contains (_tmp12_, _tmp12__length1, _tmp11_)) {
					const gchar* _tmp13_;
					gchar** _tmp14_;
					gint _tmp14__length1;
					_tmp13_ = packet;
					_tmp14_ = missing_packs;
					_tmp14__length1 = missing_packs_length1;
					_tmp10_ = !_vala_string_array_contains (_tmp14_, _tmp14__length1, _tmp13_);
				} else {
					_tmp10_ = FALSE;
				}
				if (_tmp10_) {
					GeeArrayList* _tmp15_;
					const gchar* _tmp16_;
					_tmp15_ = removable;
					_tmp16_ = packet;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_);
				}
				_g_free0 (packet);
			}
		}
	}
	_tmp17_ = removable;
	_tmp19_ = gee_collection_to_array ((GeeCollection*) _tmp17_, &_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp20__length1 = _tmp18_;
	if (result_length1) {
		*result_length1 = _tmp20__length1;
	}
	result = _tmp20_;
	_g_object_unref0 (removable);
	missing_packs = (_vala_array_free (missing_packs, missing_packs_length1, (GDestroyNotify) g_free), NULL);
	multilang_packs = (_vala_array_free (multilang_packs, multilang_packs_length1, (GDestroyNotify) g_free), NULL);
	installed = (_vala_array_free (installed, installed_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static gchar**
switchboard_plug_locale_installer_ubuntu_installer_get_installed_packages_for_language (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                                        const gchar* langcode,
                                                                                        gint* result_length1)
{
	gchar* output = NULL;
	gint status = 0;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar** _tmp13_;
	gchar** _tmp14_;
	gchar** _tmp15_;
	gint _tmp15__length1;
	gchar** _tmp16_;
	gint _tmp16__length1;
	GError* _inner_error0_ = NULL;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (langcode != NULL, NULL);
	{
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar** _tmp4_;
		gchar** _tmp5_;
		gint _tmp5__length1;
		gchar** _tmp6_;
		gchar** _tmp7_;
		gchar** _tmp8_;
		gint _tmp8__length1;
		gchar* _tmp9_ = NULL;
		gint _tmp10_ = 0;
		_tmp0_ = g_strdup (SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_LANGUAGE_CHECKER);
		_tmp1_ = g_strdup ("--show-installed");
		_tmp2_ = g_strdup ("-l");
		_tmp3_ = g_strdup (langcode);
		_tmp4_ = g_new0 (gchar*, 5 + 1);
		_tmp4_[0] = _tmp0_;
		_tmp4_[1] = _tmp1_;
		_tmp4_[2] = _tmp2_;
		_tmp4_[3] = _tmp3_;
		_tmp4_[4] = NULL;
		_tmp5_ = _tmp4_;
		_tmp5__length1 = 5;
		_tmp7_ = _tmp6_ = g_get_environ ();
		_tmp8_ = _tmp7_;
		_tmp8__length1 = _vala_array_length (_tmp6_);
		g_spawn_sync (NULL, _tmp5_, _tmp8_, G_SPAWN_SEARCH_PATH, NULL, NULL, &_tmp9_, NULL, &_tmp10_, &_inner_error0_);
		_g_free0 (output);
		output = _tmp9_;
		status = _tmp10_;
		_tmp8_ = (_vala_array_free (_tmp8_, _tmp8__length1, (GDestroyNotify) g_free), NULL);
		_tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		g_warning ("UbuntuInstaller.vala:248: Could not get remaining language packages fo" \
"r %s", langcode);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (output);
		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;
	}
	_tmp11_ = string_strip (output);
	_tmp12_ = _tmp11_;
	_tmp14_ = _tmp13_ = g_strsplit (_tmp12_, " ", 0);
	_tmp15_ = _tmp14_;
	_tmp15__length1 = _vala_array_length (_tmp13_);
	_g_free0 (_tmp12_);
	_tmp16_ = _tmp15_;
	_tmp16__length1 = _tmp15__length1;
	if (result_length1) {
		*result_length1 = _tmp16__length1;
	}
	result = _tmp16_;
	_g_free0 (output);
	return result;
}

gboolean
switchboard_plug_locale_installer_ubuntu_installer_get_install_cancellable (SwitchboardPlugLocaleInstallerUbuntuInstaller* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_install_cancellable;
	return result;
}

static void
switchboard_plug_locale_installer_ubuntu_installer_set_install_cancellable (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                            gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = switchboard_plug_locale_installer_ubuntu_installer_get_install_cancellable (self);
	if (old_value != value) {
		self->priv->_install_cancellable = value;
		g_object_notify_by_pspec ((GObject *) self, switchboard_plug_locale_installer_ubuntu_installer_properties[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_CANCELLABLE_PROPERTY]);
	}
}

SwitchboardPlugLocaleInstallerUbuntuInstallerTransactionMode
switchboard_plug_locale_installer_ubuntu_installer_get_transaction_mode (SwitchboardPlugLocaleInstallerUbuntuInstaller* self)
{
	SwitchboardPlugLocaleInstallerUbuntuInstallerTransactionMode result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_transaction_mode;
	return result;
}

static void
switchboard_plug_locale_installer_ubuntu_installer_set_transaction_mode (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                         SwitchboardPlugLocaleInstallerUbuntuInstallerTransactionMode value)
{
	SwitchboardPlugLocaleInstallerUbuntuInstallerTransactionMode old_value;
	g_return_if_fail (self != NULL);
	old_value = switchboard_plug_locale_installer_ubuntu_installer_get_transaction_mode (self);
	if (old_value != value) {
		self->priv->_transaction_mode = value;
		g_object_notify_by_pspec ((GObject *) self, switchboard_plug_locale_installer_ubuntu_installer_properties[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_PROPERTY]);
	}
}

const gchar*
switchboard_plug_locale_installer_ubuntu_installer_get_transaction_language_code (SwitchboardPlugLocaleInstallerUbuntuInstaller* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_transaction_language_code;
	result = _tmp0_;
	return result;
}

static void
switchboard_plug_locale_installer_ubuntu_installer_set_transaction_language_code (SwitchboardPlugLocaleInstallerUbuntuInstaller* self,
                                                                                  const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = switchboard_plug_locale_installer_ubuntu_installer_get_transaction_language_code (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_transaction_language_code);
		self->priv->_transaction_language_code = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, switchboard_plug_locale_installer_ubuntu_installer_properties[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_LANGUAGE_CODE_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure,
                                         GValue * return_value,
                                         guint n_param_values,
                                         const GValue * param_values,
                                         gpointer invocation_hint,
                                         gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__BOXED_INT) (gpointer data1, gpointer arg_1, gint arg_2, gpointer data2);
	register GMarshalFunc_VOID__BOXED_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__BOXED_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_boxed (param_values + 1), g_value_get_int (param_values + 2), data2);
}

static GObject *
switchboard_plug_locale_installer_ubuntu_installer_constructor (GType type,
                                                                guint n_construct_properties,
                                                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SwitchboardPlugLocaleInstallerUbuntuInstaller * self;
	GeeHashMap* _tmp0_;
	AptdProxy* _tmp1_;
	GError* _inner_error0_ = NULL;
	parent_class = G_OBJECT_CLASS (switchboard_plug_locale_installer_ubuntu_installer_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWITCHBOARD_PLUG_LOCALE_INSTALLER_TYPE_UBUNTU_INSTALLER, SwitchboardPlugLocaleInstallerUbuntuInstaller);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->transactions);
	self->priv->transactions = _tmp0_;
	_tmp1_ = aptd_proxy_new ();
	_g_object_unref0 (self->priv->aptd);
	self->priv->aptd = _tmp1_;
	{
		AptdProxy* _tmp2_;
		_tmp2_ = self->priv->aptd;
		aptd_proxy_connect_to_aptd (_tmp2_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		g_warning ("UbuntuInstaller.vala:58: Could not connect to APT daemon");
	}
	__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 obj;
}

static void
switchboard_plug_locale_installer_ubuntu_installer_class_init (SwitchboardPlugLocaleInstallerUbuntuInstallerClass * klass,
                                                               gpointer klass_data)
{
	switchboard_plug_locale_installer_ubuntu_installer_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SwitchboardPlugLocaleInstallerUbuntuInstaller_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_switchboard_plug_locale_installer_ubuntu_installer_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_switchboard_plug_locale_installer_ubuntu_installer_set_property;
	G_OBJECT_CLASS (klass)->constructor = switchboard_plug_locale_installer_ubuntu_installer_constructor;
	G_OBJECT_CLASS (klass)->finalize = switchboard_plug_locale_installer_ubuntu_installer_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_CANCELLABLE_PROPERTY, switchboard_plug_locale_installer_ubuntu_installer_properties[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_CANCELLABLE_PROPERTY] = g_param_spec_boolean ("install-cancellable", "install-cancellable", "install-cancellable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_PROPERTY, switchboard_plug_locale_installer_ubuntu_installer_properties[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_PROPERTY] = g_param_spec_enum ("transaction-mode", "transaction-mode", "transaction-mode", SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TYPE_TRANSACTION_MODE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_LANGUAGE_CODE_PROPERTY, switchboard_plug_locale_installer_ubuntu_installer_properties[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_LANGUAGE_CODE_PROPERTY] = g_param_spec_string ("transaction-language-code", "transaction-language-code", "transaction-language-code", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_FINISHED_SIGNAL] = g_signal_new ("install-finished", SWITCHBOARD_PLUG_LOCALE_INSTALLER_TYPE_UBUNTU_INSTALLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_FAILED_SIGNAL] = g_signal_new ("install-failed", SWITCHBOARD_PLUG_LOCALE_INSTALLER_TYPE_UBUNTU_INSTALLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_REMOVE_FINISHED_SIGNAL] = g_signal_new ("remove-finished", SWITCHBOARD_PLUG_LOCALE_INSTALLER_TYPE_UBUNTU_INSTALLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_CHECK_MISSING_FINISHED_SIGNAL] = g_signal_new ("check-missing-finished", SWITCHBOARD_PLUG_LOCALE_INSTALLER_TYPE_UBUNTU_INSTALLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOXED_INT, G_TYPE_NONE, 2, G_TYPE_STRV, G_TYPE_INT);
	switchboard_plug_locale_installer_ubuntu_installer_signals[SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_PROGRESS_CHANGED_SIGNAL] = g_signal_new ("progress-changed", SWITCHBOARD_PLUG_LOCALE_INSTALLER_TYPE_UBUNTU_INSTALLER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
}

static void
switchboard_plug_locale_installer_ubuntu_installer_instance_init (SwitchboardPlugLocaleInstallerUbuntuInstaller * self,
                                                                  gpointer klass)
{
	self->priv = switchboard_plug_locale_installer_ubuntu_installer_get_instance_private (self);
	self->priv->missing_packages = NULL;
	self->priv->missing_packages_length1 = 0;
	self->priv->_missing_packages_size_ = self->priv->missing_packages_length1;
}

static void
switchboard_plug_locale_installer_ubuntu_installer_finalize (GObject * obj)
{
	SwitchboardPlugLocaleInstallerUbuntuInstaller * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWITCHBOARD_PLUG_LOCALE_INSTALLER_TYPE_UBUNTU_INSTALLER, SwitchboardPlugLocaleInstallerUbuntuInstaller);
	_g_object_unref0 (self->priv->aptd);
	_g_object_unref0 (self->priv->proxy);
	self->priv->missing_packages = (_vala_array_free (self->priv->missing_packages, self->priv->missing_packages_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (self->priv->_transaction_language_code);
	_g_object_unref0 (self->priv->transactions);
	G_OBJECT_CLASS (switchboard_plug_locale_installer_ubuntu_installer_parent_class)->finalize (obj);
}

static GType
switchboard_plug_locale_installer_ubuntu_installer_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SwitchboardPlugLocaleInstallerUbuntuInstallerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) switchboard_plug_locale_installer_ubuntu_installer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SwitchboardPlugLocaleInstallerUbuntuInstaller), 0, (GInstanceInitFunc) switchboard_plug_locale_installer_ubuntu_installer_instance_init, NULL };
	GType switchboard_plug_locale_installer_ubuntu_installer_type_id;
	switchboard_plug_locale_installer_ubuntu_installer_type_id = g_type_register_static (G_TYPE_OBJECT, "SwitchboardPlugLocaleInstallerUbuntuInstaller", &g_define_type_info, 0);
	SwitchboardPlugLocaleInstallerUbuntuInstaller_private_offset = g_type_add_instance_private (switchboard_plug_locale_installer_ubuntu_installer_type_id, sizeof (SwitchboardPlugLocaleInstallerUbuntuInstallerPrivate));
	return switchboard_plug_locale_installer_ubuntu_installer_type_id;
}

GType
switchboard_plug_locale_installer_ubuntu_installer_get_type (void)
{
	static volatile gsize switchboard_plug_locale_installer_ubuntu_installer_type_id__once = 0;
	if (g_once_init_enter (&switchboard_plug_locale_installer_ubuntu_installer_type_id__once)) {
		GType switchboard_plug_locale_installer_ubuntu_installer_type_id;
		switchboard_plug_locale_installer_ubuntu_installer_type_id = switchboard_plug_locale_installer_ubuntu_installer_get_type_once ();
		g_once_init_leave (&switchboard_plug_locale_installer_ubuntu_installer_type_id__once, switchboard_plug_locale_installer_ubuntu_installer_type_id);
	}
	return switchboard_plug_locale_installer_ubuntu_installer_type_id__once;
}

static void
_vala_switchboard_plug_locale_installer_ubuntu_installer_get_property (GObject * object,
                                                                       guint property_id,
                                                                       GValue * value,
                                                                       GParamSpec * pspec)
{
	SwitchboardPlugLocaleInstallerUbuntuInstaller * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SWITCHBOARD_PLUG_LOCALE_INSTALLER_TYPE_UBUNTU_INSTALLER, SwitchboardPlugLocaleInstallerUbuntuInstaller);
	switch (property_id) {
		case SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_CANCELLABLE_PROPERTY:
		g_value_set_boolean (value, switchboard_plug_locale_installer_ubuntu_installer_get_install_cancellable (self));
		break;
		case SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_PROPERTY:
		g_value_set_enum (value, switchboard_plug_locale_installer_ubuntu_installer_get_transaction_mode (self));
		break;
		case SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_LANGUAGE_CODE_PROPERTY:
		g_value_set_string (value, switchboard_plug_locale_installer_ubuntu_installer_get_transaction_language_code (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_switchboard_plug_locale_installer_ubuntu_installer_set_property (GObject * object,
                                                                       guint property_id,
                                                                       const GValue * value,
                                                                       GParamSpec * pspec)
{
	SwitchboardPlugLocaleInstallerUbuntuInstaller * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SWITCHBOARD_PLUG_LOCALE_INSTALLER_TYPE_UBUNTU_INSTALLER, SwitchboardPlugLocaleInstallerUbuntuInstaller);
	switch (property_id) {
		case SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_INSTALL_CANCELLABLE_PROPERTY:
		switchboard_plug_locale_installer_ubuntu_installer_set_install_cancellable (self, g_value_get_boolean (value));
		break;
		case SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_MODE_PROPERTY:
		switchboard_plug_locale_installer_ubuntu_installer_set_transaction_mode (self, g_value_get_enum (value));
		break;
		case SWITCHBOARD_PLUG_LOCALE_INSTALLER_UBUNTU_INSTALLER_TRANSACTION_LANGUAGE_CODE_PROPERTY:
		switchboard_plug_locale_installer_ubuntu_installer_set_transaction_language_code (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,
                     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;
}

