/* InstallDialog.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from InstallDialog.vala, do not modify */

/* Copyright 2011-2017 elementary LLC. (https://elementary.io)
*
* 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 "io.elementary.settings.locale.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <granite-7.h>
#include <glib/gi18n-lib.h>
#include <float.h>
#include <math.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_0_PROPERTY,
	SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_NUM_PROPERTIES
};
static GParamSpec* switchboard_plug_locale_widgets_install_dialog_properties[SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW (switchboard_plug_locale_widgets_install_dialog_lang_row_get_type ())
#define SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW, SwitchboardPlugLocaleWidgetsInstallDialogLangRow))
#define SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW, SwitchboardPlugLocaleWidgetsInstallDialogLangRowClass))
#define SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_IS_LANG_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW))
#define SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_IS_LANG_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW))
#define SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW, SwitchboardPlugLocaleWidgetsInstallDialogLangRowClass))

typedef struct _SwitchboardPlugLocaleWidgetsInstallDialogLangRow SwitchboardPlugLocaleWidgetsInstallDialogLangRow;
typedef struct _SwitchboardPlugLocaleWidgetsInstallDialogLangRowClass SwitchboardPlugLocaleWidgetsInstallDialogLangRowClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _SwitchboardPlugLocaleWidgetsInstallDialogLangRowPrivate SwitchboardPlugLocaleWidgetsInstallDialogLangRowPrivate;
enum  {
	SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW_0_PROPERTY,
	SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW_LANG_PROPERTY,
	SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW_NUM_PROPERTIES
};
static GParamSpec* switchboard_plug_locale_widgets_install_dialog_lang_row_properties[SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW_NUM_PROPERTIES];
typedef struct _Block4Data Block4Data;

struct _SwitchboardPlugLocaleWidgetsInstallDialogPrivate {
	GtkSearchEntry* search_entry;
	GtkListBox* list_box;
};

struct _SwitchboardPlugLocaleWidgetsInstallDialogLangRow {
	GtkListBoxRow parent_instance;
	SwitchboardPlugLocaleWidgetsInstallDialogLangRowPrivate * priv;
};

struct _SwitchboardPlugLocaleWidgetsInstallDialogLangRowClass {
	GtkListBoxRowClass parent_class;
};

struct _SwitchboardPlugLocaleWidgetsInstallDialogLangRowPrivate {
	gchar* _lang;
};

struct _Block4Data {
	int _ref_count_;
	SwitchboardPlugLocaleWidgetsInstallDialog* self;
	GtkButton* button_add;
};

static gint SwitchboardPlugLocaleWidgetsInstallDialog_private_offset;
static gpointer switchboard_plug_locale_widgets_install_dialog_parent_class = NULL;
static gint SwitchboardPlugLocaleWidgetsInstallDialogLangRow_private_offset;
static gpointer switchboard_plug_locale_widgets_install_dialog_lang_row_parent_class = NULL;

static void switchboard_plug_locale_widgets_install_dialog_install_selected (SwitchboardPlugLocaleWidgetsInstallDialog* self);
static GType switchboard_plug_locale_widgets_install_dialog_lang_row_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static const gchar* switchboard_plug_locale_widgets_install_dialog_lang_row_get_lang (SwitchboardPlugLocaleWidgetsInstallDialogLangRow* self);
static void __lambda30_ (SwitchboardPlugLocaleWidgetsInstallDialog* self,
                  GObject* obj,
                  GAsyncResult* res);
static void _gtk_window_destroy_gtk_dialog_response (GtkDialog* _sender,
                                              gint response_id,
                                              gpointer self);
static void ___lambda30__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static gint switchboard_plug_locale_widgets_install_dialog_sort_function (SwitchboardPlugLocaleWidgetsInstallDialogLangRow* row1,
                                                                   SwitchboardPlugLocaleWidgetsInstallDialogLangRow* row2,
                                                                   SwitchboardPlugLocaleWidgetsInstallDialog* self);
static gboolean switchboard_plug_locale_widgets_install_dialog_filter_function (SwitchboardPlugLocaleWidgetsInstallDialogLangRow* row,
                                                                         SwitchboardPlugLocaleWidgetsInstallDialog* self);
static void switchboard_plug_locale_widgets_install_dialog_load_languagelist (SwitchboardPlugLocaleWidgetsInstallDialog* self);
static void _g_free0_ (gpointer var);
static inline void _g_list_free__g_free0_ (GList* self);
static SwitchboardPlugLocaleWidgetsInstallDialogLangRow* switchboard_plug_locale_widgets_install_dialog_lang_row_new (const gchar* lang);
static SwitchboardPlugLocaleWidgetsInstallDialogLangRow* switchboard_plug_locale_widgets_install_dialog_lang_row_construct (GType object_type,
                                                                                                                     const gchar* lang);
static void switchboard_plug_locale_widgets_install_dialog_lang_row_set_lang (SwitchboardPlugLocaleWidgetsInstallDialogLangRow* self,
                                                                       const gchar* value);
static GObject * switchboard_plug_locale_widgets_install_dialog_lang_row_constructor (GType type,
                                                                               guint n_construct_properties,
                                                                               GObjectConstructParam * construct_properties);
static void switchboard_plug_locale_widgets_install_dialog_lang_row_finalize (GObject * obj);
static GType switchboard_plug_locale_widgets_install_dialog_lang_row_get_type_once (void);
static void _vala_switchboard_plug_locale_widgets_install_dialog_lang_row_get_property (GObject * object,
                                                                                 guint property_id,
                                                                                 GValue * value,
                                                                                 GParamSpec * pspec);
static void _vala_switchboard_plug_locale_widgets_install_dialog_lang_row_set_property (GObject * object,
                                                                                 guint property_id,
                                                                                 const GValue * value,
                                                                                 GParamSpec * pspec);
static GObject * switchboard_plug_locale_widgets_install_dialog_constructor (GType type,
                                                                      guint n_construct_properties,
                                                                      GObjectConstructParam * construct_properties);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static void _switchboard_plug_locale_widgets_install_dialog___lambda31_ (Block4Data* _data4_,
                                                                  GtkListBoxRow* row);
static void __switchboard_plug_locale_widgets_install_dialog___lambda31__gtk_list_box_row_selected (GtkListBox* _sender,
                                                                                             GtkListBoxRow* row,
                                                                                             gpointer self);
static void _switchboard_plug_locale_widgets_install_dialog___lambda32_ (SwitchboardPlugLocaleWidgetsInstallDialog* self);
static void __switchboard_plug_locale_widgets_install_dialog___lambda32__gtk_list_box_row_activated (GtkListBox* _sender,
                                                                                              GtkListBoxRow* row,
                                                                                              gpointer self);
static void _switchboard_plug_locale_widgets_install_dialog___lambda33_ (SwitchboardPlugLocaleWidgetsInstallDialog* self,
                                                                  gint response);
static void __switchboard_plug_locale_widgets_install_dialog___lambda33__gtk_dialog_response (GtkDialog* _sender,
                                                                                       gint response_id,
                                                                                       gpointer self);
static void _switchboard_plug_locale_widgets_install_dialog___lambda34_ (SwitchboardPlugLocaleWidgetsInstallDialog* self);
static void __switchboard_plug_locale_widgets_install_dialog___lambda34__gtk_search_entry_activate (GtkSearchEntry* _sender,
                                                                                             gpointer self);
static void _switchboard_plug_locale_widgets_install_dialog___lambda35_ (SwitchboardPlugLocaleWidgetsInstallDialog* self);
static void __switchboard_plug_locale_widgets_install_dialog___lambda35__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                                                   gpointer self);
static void switchboard_plug_locale_widgets_install_dialog_finalize (GObject * obj);
static GType switchboard_plug_locale_widgets_install_dialog_get_type_once (void);

static inline gpointer
switchboard_plug_locale_widgets_install_dialog_get_instance_private (SwitchboardPlugLocaleWidgetsInstallDialog* self)
{
	return G_STRUCT_MEMBER_P (self, SwitchboardPlugLocaleWidgetsInstallDialog_private_offset);
}

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

static void
_gtk_window_destroy_gtk_dialog_response (GtkDialog* _sender,
                                         gint response_id,
                                         gpointer self)
{
	gtk_window_destroy ((GtkWindow*) self);
}

static void
__lambda30_ (SwitchboardPlugLocaleWidgetsInstallDialog* self,
             GObject* obj,
             GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		switchboard_plug_locale_installer_ubuntu_installer_install_finish (G_TYPE_CHECK_INSTANCE_CAST (obj, SWITCHBOARD_PLUG_LOCALE_INSTALLER_TYPE_UBUNTU_INSTALLER, SwitchboardPlugLocaleInstallerUbuntuInstaller), res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp0_;
		GraniteMessageDialog* dialog = NULL;
		GError* _tmp1_;
		const gchar* _tmp2_;
		GThemedIcon* _tmp3_;
		GThemedIcon* _tmp4_;
		GThemedIcon* _tmp5_;
		GApplication* _tmp6_;
		GtkWindow* _tmp7_;
		GtkWindow* _tmp8_;
		GtkWindow* _tmp9_;
		GraniteMessageDialog* _tmp10_ = NULL;
		GraniteMessageDialog* _tmp11_;
		GraniteMessageDialog* _tmp12_;
		GraniteMessageDialog* _tmp13_;
		GraniteMessageDialog* _tmp14_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = e;
		if (g_error_matches (_tmp0_, g_dbus_error_quark (), G_DBUS_ERROR_ACCESS_DENIED)) {
			_g_error_free0 (e);
			return;
		}
		_tmp1_ = e;
		_tmp2_ = _tmp1_->message;
		_tmp3_ = (GThemedIcon*) g_themed_icon_new ("preferences-desktop-locale");
		_tmp4_ = _tmp3_;
		_tmp5_ = (GThemedIcon*) g_themed_icon_new ("dialog-error");
		_tmp6_ = g_application_get_default ();
		_tmp7_ = gtk_application_get_active_window (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_application_get_type (), GtkApplication));
		_tmp8_ = _tmp7_;
		_tmp9_ = _g_object_ref0 (_tmp8_);
		_tmp10_ = granite_message_dialog_new (_ ("Couldn't install language pack"), _tmp2_, (GIcon*) _tmp4_, GTK_BUTTONS_CLOSE);
		granite_message_dialog_set_badge_icon (_tmp10_, (GIcon*) _tmp5_);
		_g_object_unref0 (_tmp5_);
		gtk_window_set_modal ((GtkWindow*) _tmp10_, TRUE);
		gtk_window_set_transient_for ((GtkWindow*) _tmp10_, _tmp9_);
		_g_object_unref0 (_tmp9_);
		g_object_ref_sink (_tmp10_);
		_tmp11_ = _tmp10_;
		_g_object_unref0 (_tmp4_);
		dialog = _tmp11_;
		_tmp12_ = dialog;
		gtk_window_present ((GtkWindow*) _tmp12_);
		_tmp13_ = dialog;
		_tmp14_ = dialog;
		g_signal_connect_object ((GtkDialog*) _tmp13_, "response", (GCallback) _gtk_window_destroy_gtk_dialog_response, (GtkWindow*) _tmp14_, 0);
		_g_object_unref0 (dialog);
		_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
___lambda30__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda30_ ((SwitchboardPlugLocaleWidgetsInstallDialog*) self, source_object, res);
	g_object_unref (self);
}

static void
switchboard_plug_locale_widgets_install_dialog_install_selected (SwitchboardPlugLocaleWidgetsInstallDialog* self)
{
	SwitchboardPlugLocaleWidgetsInstallDialogLangRow* lang_row = NULL;
	GtkListBox* _tmp0_;
	GtkListBoxRow* _tmp1_;
	SwitchboardPlugLocaleInstallerUbuntuInstaller* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->list_box;
	_tmp1_ = gtk_list_box_get_selected_row (_tmp0_);
	lang_row = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW, SwitchboardPlugLocaleWidgetsInstallDialogLangRow);
	_tmp2_ = switchboard_plug_locale_installer_ubuntu_installer_get_default ();
	_tmp3_ = switchboard_plug_locale_widgets_install_dialog_lang_row_get_lang (lang_row);
	_tmp4_ = _tmp3_;
	switchboard_plug_locale_installer_ubuntu_installer_install (_tmp2_, _tmp4_, ___lambda30__gasync_ready_callback, g_object_ref (self));
}

static gint
switchboard_plug_locale_widgets_install_dialog_sort_function (SwitchboardPlugLocaleWidgetsInstallDialogLangRow* row1,
                                                              SwitchboardPlugLocaleWidgetsInstallDialogLangRow* row2,
                                                              SwitchboardPlugLocaleWidgetsInstallDialog* self)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (row1 != NULL, 0);
	g_return_val_if_fail (row2 != NULL, 0);
	_tmp0_ = switchboard_plug_locale_widgets_install_dialog_lang_row_get_lang (row1);
	_tmp1_ = _tmp0_;
	_tmp2_ = switchboard_plug_locale_widgets_install_dialog_lang_row_get_lang (row2);
	_tmp3_ = _tmp2_;
	result = g_utf8_collate (_tmp1_, _tmp3_);
	return result;
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gboolean
switchboard_plug_locale_widgets_install_dialog_filter_function (SwitchboardPlugLocaleWidgetsInstallDialogLangRow* row,
                                                                SwitchboardPlugLocaleWidgetsInstallDialog* self)
{
	GtkSearchEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* search_term = NULL;
	GtkSearchEntry* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* english_lang = NULL;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* translated_lang = NULL;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gboolean _tmp19_ = FALSE;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (row != NULL, FALSE);
	_tmp0_ = self->priv->search_entry;
	_tmp1_ = gtk_editable_get_text ((GtkEditable*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, "") == 0) {
		result = TRUE;
		return result;
	}
	_tmp3_ = self->priv->search_entry;
	_tmp4_ = gtk_editable_get_text ((GtkEditable*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_utf8_strdown (_tmp5_, (gssize) -1);
	search_term = _tmp6_;
	_tmp7_ = switchboard_plug_locale_widgets_install_dialog_lang_row_get_lang (row);
	_tmp8_ = _tmp7_;
	_tmp9_ = switchboard_plug_locale_utils_translate (_tmp8_, "C");
	_tmp10_ = _tmp9_;
	_tmp11_ = g_utf8_strdown (_tmp10_, (gssize) -1);
	_tmp12_ = _tmp11_;
	_g_free0 (_tmp10_);
	english_lang = _tmp12_;
	_tmp13_ = switchboard_plug_locale_widgets_install_dialog_lang_row_get_lang (row);
	_tmp14_ = _tmp13_;
	_tmp15_ = switchboard_plug_locale_utils_translate (_tmp14_, NULL);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_utf8_strdown (_tmp16_, (gssize) -1);
	_tmp18_ = _tmp17_;
	_g_free0 (_tmp16_);
	translated_lang = _tmp18_;
	_tmp20_ = english_lang;
	_tmp21_ = search_term;
	if (string_contains (_tmp20_, _tmp21_)) {
		_tmp19_ = TRUE;
	} else {
		const gchar* _tmp22_;
		const gchar* _tmp23_;
		_tmp22_ = translated_lang;
		_tmp23_ = search_term;
		_tmp19_ = string_contains (_tmp22_, _tmp23_);
	}
	if (_tmp19_) {
		result = TRUE;
		_g_free0 (translated_lang);
		_g_free0 (english_lang);
		_g_free0 (search_term);
		return result;
	}
	result = FALSE;
	_g_free0 (translated_lang);
	_g_free0 (english_lang);
	_g_free0 (search_term);
	return result;
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static inline void
_g_list_free__g_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_free0_);
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

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

static void
switchboard_plug_locale_widgets_install_dialog_load_languagelist (SwitchboardPlugLocaleWidgetsInstallDialog* self)
{
	GFile* file = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	GFile* _tmp2_;
	GFile* _tmp3_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_build_path ("/", CONSTANTS_PKGDATADIR, "languagelist", NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_file_new_for_path (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	file = _tmp3_;
	{
		GFileInputStream* _tmp4_ = NULL;
		GFile* _tmp5_;
		GFileInputStream* _tmp6_;
		GDataInputStream* dis = NULL;
		GDataInputStream* _tmp7_;
		gchar* line = NULL;
		GList* langs = NULL;
		_tmp5_ = file;
		_tmp6_ = g_file_read (_tmp5_, NULL, &_inner_error0_);
		_tmp4_ = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp7_ = g_data_input_stream_new ((GInputStream*) _tmp4_);
		dis = _tmp7_;
		langs = NULL;
		while (TRUE) {
			gchar* _tmp8_ = NULL;
			GDataInputStream* _tmp9_;
			gchar* _tmp10_;
			gchar* _tmp11_;
			const gchar* _tmp12_;
			gboolean _tmp13_ = FALSE;
			const gchar* _tmp14_;
			gchar* _tmp15_;
			gchar* _tmp16_;
			gboolean _tmp17_;
			_tmp9_ = dis;
			_tmp10_ = g_data_input_stream_read_line (_tmp9_, NULL, NULL, &_inner_error0_);
			_tmp8_ = _tmp10_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				(langs == NULL) ? NULL : (langs = (_g_list_free__g_free0_ (langs), NULL));
				_g_free0 (line);
				_g_object_unref0 (dis);
				_g_object_unref0 (_tmp4_);
				goto __catch0_g_error;
			}
			_tmp11_ = _tmp8_;
			_tmp8_ = NULL;
			_g_free0 (line);
			line = _tmp11_;
			_tmp12_ = line;
			if (!(_tmp12_ != NULL)) {
				_g_free0 (_tmp8_);
				break;
			}
			_tmp14_ = line;
			_tmp15_ = string_substring (_tmp14_, (glong) 0, (glong) 1);
			_tmp16_ = _tmp15_;
			_tmp17_ = g_strcmp0 (_tmp16_, "#") != 0;
			_g_free0 (_tmp16_);
			if (_tmp17_) {
				const gchar* _tmp18_;
				_tmp18_ = line;
				_tmp13_ = g_strcmp0 (_tmp18_, "") != 0;
			} else {
				_tmp13_ = FALSE;
			}
			if (_tmp13_) {
				const gchar* _tmp19_;
				GList* _tmp20_;
				const gchar* _tmp21_;
				GCompareFunc _tmp22_;
				GList* _tmp23_;
				_tmp19_ = line;
				if (g_strcmp0 (_tmp19_, "ia") == 0) {
					_g_free0 (_tmp8_);
					continue;
				}
				_tmp20_ = langs;
				_tmp21_ = line;
				_tmp22_ = ((GCompareFunc) g_strcmp0);
				_tmp23_ = g_list_find_custom (_tmp20_, _tmp21_, _tmp22_);
				if (g_list_length (_tmp23_) == ((guint) 0)) {
					SwitchboardPlugLocaleWidgetsInstallDialogLangRow* langrow = NULL;
					const gchar* _tmp24_;
					SwitchboardPlugLocaleWidgetsInstallDialogLangRow* _tmp25_;
					GtkListBox* _tmp26_;
					SwitchboardPlugLocaleWidgetsInstallDialogLangRow* _tmp27_;
					const gchar* _tmp28_;
					gchar* _tmp29_;
					_tmp24_ = line;
					_tmp25_ = switchboard_plug_locale_widgets_install_dialog_lang_row_new (_tmp24_);
					g_object_ref_sink (_tmp25_);
					langrow = _tmp25_;
					_tmp26_ = self->priv->list_box;
					_tmp27_ = langrow;
					gtk_list_box_append (_tmp26_, (GtkWidget*) _tmp27_);
					_tmp28_ = line;
					_tmp29_ = g_strdup (_tmp28_);
					langs = g_list_append (langs, _tmp29_);
					_g_object_unref0 (langrow);
				}
			}
			_g_free0 (_tmp8_);
		}
		(langs == NULL) ? NULL : (langs = (_g_list_free__g_free0_ (langs), NULL));
		_g_free0 (line);
		_g_object_unref0 (dis);
		_g_object_unref0 (_tmp4_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp30_;
		const gchar* _tmp31_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp30_ = e;
		_tmp31_ = _tmp30_->message;
		g_critical ("InstallDialog.vala:154: %s", _tmp31_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (file);
		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;
	}
	_g_object_unref0 (file);
}

SwitchboardPlugLocaleWidgetsInstallDialog*
switchboard_plug_locale_widgets_install_dialog_construct (GType object_type)
{
	SwitchboardPlugLocaleWidgetsInstallDialog * self = NULL;
	self = (SwitchboardPlugLocaleWidgetsInstallDialog*) granite_dialog_construct (object_type);
	return self;
}

SwitchboardPlugLocaleWidgetsInstallDialog*
switchboard_plug_locale_widgets_install_dialog_new (void)
{
	return switchboard_plug_locale_widgets_install_dialog_construct (SWITCHBOARD_PLUG_LOCALE_WIDGETS_TYPE_INSTALL_DIALOG);
}

static inline gpointer
switchboard_plug_locale_widgets_install_dialog_lang_row_get_instance_private (SwitchboardPlugLocaleWidgetsInstallDialogLangRow* self)
{
	return G_STRUCT_MEMBER_P (self, SwitchboardPlugLocaleWidgetsInstallDialogLangRow_private_offset);
}

static SwitchboardPlugLocaleWidgetsInstallDialogLangRow*
switchboard_plug_locale_widgets_install_dialog_lang_row_construct (GType object_type,
                                                                   const gchar* lang)
{
	SwitchboardPlugLocaleWidgetsInstallDialogLangRow * self = NULL;
	g_return_val_if_fail (lang != NULL, NULL);
	self = (SwitchboardPlugLocaleWidgetsInstallDialogLangRow*) g_object_new (object_type, "lang", lang, NULL);
	return self;
}

static SwitchboardPlugLocaleWidgetsInstallDialogLangRow*
switchboard_plug_locale_widgets_install_dialog_lang_row_new (const gchar* lang)
{
	return switchboard_plug_locale_widgets_install_dialog_lang_row_construct (SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW, lang);
}

static const gchar*
switchboard_plug_locale_widgets_install_dialog_lang_row_get_lang (SwitchboardPlugLocaleWidgetsInstallDialogLangRow* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_lang;
	result = _tmp0_;
	return result;
}

static void
switchboard_plug_locale_widgets_install_dialog_lang_row_set_lang (SwitchboardPlugLocaleWidgetsInstallDialogLangRow* self,
                                                                  const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = switchboard_plug_locale_widgets_install_dialog_lang_row_get_lang (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_lang);
		self->priv->_lang = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, switchboard_plug_locale_widgets_install_dialog_lang_row_properties[SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW_LANG_PROPERTY]);
	}
}

static GObject *
switchboard_plug_locale_widgets_install_dialog_lang_row_constructor (GType type,
                                                                     guint n_construct_properties,
                                                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SwitchboardPlugLocaleWidgetsInstallDialogLangRow * self;
	GtkLabel* label = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GtkLabel* _tmp3_ = NULL;
	GtkLabel* _tmp4_;
	GtkLabel* _tmp5_;
	parent_class = G_OBJECT_CLASS (switchboard_plug_locale_widgets_install_dialog_lang_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW, SwitchboardPlugLocaleWidgetsInstallDialogLangRow);
	_tmp0_ = self->priv->_lang;
	_tmp1_ = switchboard_plug_locale_utils_translate (_tmp0_, NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = (GtkLabel*) gtk_label_new (_tmp2_);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp3_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp3_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp3_, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp3_, 6);
	gtk_label_set_xalign (_tmp3_, (gfloat) 0);
	g_object_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp2_);
	label = _tmp4_;
	_tmp5_ = label;
	gtk_list_box_row_set_child ((GtkListBoxRow*) self, (GtkWidget*) _tmp5_);
	_g_object_unref0 (label);
	return obj;
}

static void
switchboard_plug_locale_widgets_install_dialog_lang_row_class_init (SwitchboardPlugLocaleWidgetsInstallDialogLangRowClass * klass,
                                                                    gpointer klass_data)
{
	switchboard_plug_locale_widgets_install_dialog_lang_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SwitchboardPlugLocaleWidgetsInstallDialogLangRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_switchboard_plug_locale_widgets_install_dialog_lang_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_switchboard_plug_locale_widgets_install_dialog_lang_row_set_property;
	G_OBJECT_CLASS (klass)->constructor = switchboard_plug_locale_widgets_install_dialog_lang_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = switchboard_plug_locale_widgets_install_dialog_lang_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW_LANG_PROPERTY, switchboard_plug_locale_widgets_install_dialog_lang_row_properties[SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW_LANG_PROPERTY] = g_param_spec_string ("lang", "lang", "lang", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
switchboard_plug_locale_widgets_install_dialog_lang_row_instance_init (SwitchboardPlugLocaleWidgetsInstallDialogLangRow * self,
                                                                       gpointer klass)
{
	self->priv = switchboard_plug_locale_widgets_install_dialog_lang_row_get_instance_private (self);
}

static void
switchboard_plug_locale_widgets_install_dialog_lang_row_finalize (GObject * obj)
{
	SwitchboardPlugLocaleWidgetsInstallDialogLangRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW, SwitchboardPlugLocaleWidgetsInstallDialogLangRow);
	_g_free0 (self->priv->_lang);
	G_OBJECT_CLASS (switchboard_plug_locale_widgets_install_dialog_lang_row_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
switchboard_plug_locale_widgets_install_dialog_lang_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SwitchboardPlugLocaleWidgetsInstallDialogLangRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) switchboard_plug_locale_widgets_install_dialog_lang_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SwitchboardPlugLocaleWidgetsInstallDialogLangRow), 0, (GInstanceInitFunc) switchboard_plug_locale_widgets_install_dialog_lang_row_instance_init, NULL };
	GType switchboard_plug_locale_widgets_install_dialog_lang_row_type_id;
	switchboard_plug_locale_widgets_install_dialog_lang_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "SwitchboardPlugLocaleWidgetsInstallDialogLangRow", &g_define_type_info, 0);
	SwitchboardPlugLocaleWidgetsInstallDialogLangRow_private_offset = g_type_add_instance_private (switchboard_plug_locale_widgets_install_dialog_lang_row_type_id, sizeof (SwitchboardPlugLocaleWidgetsInstallDialogLangRowPrivate));
	return switchboard_plug_locale_widgets_install_dialog_lang_row_type_id;
}

static GType
switchboard_plug_locale_widgets_install_dialog_lang_row_get_type (void)
{
	static gsize switchboard_plug_locale_widgets_install_dialog_lang_row_type_id__once = 0;
	if (g_once_init_enter (&switchboard_plug_locale_widgets_install_dialog_lang_row_type_id__once)) {
		GType switchboard_plug_locale_widgets_install_dialog_lang_row_type_id;
		switchboard_plug_locale_widgets_install_dialog_lang_row_type_id = switchboard_plug_locale_widgets_install_dialog_lang_row_get_type_once ();
		g_once_init_leave (&switchboard_plug_locale_widgets_install_dialog_lang_row_type_id__once, switchboard_plug_locale_widgets_install_dialog_lang_row_type_id);
	}
	return switchboard_plug_locale_widgets_install_dialog_lang_row_type_id__once;
}

static void
_vala_switchboard_plug_locale_widgets_install_dialog_lang_row_get_property (GObject * object,
                                                                            guint property_id,
                                                                            GValue * value,
                                                                            GParamSpec * pspec)
{
	SwitchboardPlugLocaleWidgetsInstallDialogLangRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW, SwitchboardPlugLocaleWidgetsInstallDialogLangRow);
	switch (property_id) {
		case SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW_LANG_PROPERTY:
		g_value_set_string (value, switchboard_plug_locale_widgets_install_dialog_lang_row_get_lang (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_switchboard_plug_locale_widgets_install_dialog_lang_row_set_property (GObject * object,
                                                                            guint property_id,
                                                                            const GValue * value,
                                                                            GParamSpec * pspec)
{
	SwitchboardPlugLocaleWidgetsInstallDialogLangRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW, SwitchboardPlugLocaleWidgetsInstallDialogLangRow);
	switch (property_id) {
		case SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_LANG_ROW_LANG_PROPERTY:
		switchboard_plug_locale_widgets_install_dialog_lang_row_set_lang (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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_)) {
		SwitchboardPlugLocaleWidgetsInstallDialog* self;
		self = _data4_->self;
		_g_object_unref0 (_data4_->button_add);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static void
_switchboard_plug_locale_widgets_install_dialog___lambda31_ (Block4Data* _data4_,
                                                             GtkListBoxRow* row)
{
	SwitchboardPlugLocaleWidgetsInstallDialog* self;
	SwitchboardPlugLocaleWidgetsInstallDialogLangRow* langrow = NULL;
	GtkListBox* _tmp0_;
	GtkListBoxRow* _tmp1_;
	SwitchboardPlugLocaleWidgetsInstallDialogLangRow* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	SwitchboardPlugLocaleWidgetsInstallDialogLangRow* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	self = _data4_->self;
	_tmp0_ = self->priv->list_box;
	_tmp1_ = gtk_list_box_get_selected_row (_tmp0_);
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, SWITCHBOARD_PLUG_LOCALE_WIDGETS_INSTALL_DIALOG_TYPE_LANG_ROW, SwitchboardPlugLocaleWidgetsInstallDialogLangRow));
	langrow = _tmp2_;
	_tmp3_ = _data4_->button_add;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, row != NULL);
	_tmp4_ = _data4_->button_add;
	_tmp5_ = langrow;
	_tmp6_ = switchboard_plug_locale_widgets_install_dialog_lang_row_get_lang (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = switchboard_plug_locale_utils_translate (_tmp7_, "C");
	_tmp9_ = _tmp8_;
	_tmp10_ = g_strdup_printf (_ ("Install %s"), _tmp9_);
	_tmp11_ = _tmp10_;
	gtk_button_set_label (_tmp4_, _tmp11_);
	_g_free0 (_tmp11_);
	_g_free0 (_tmp9_);
	_g_object_unref0 (langrow);
}

static void
__switchboard_plug_locale_widgets_install_dialog___lambda31__gtk_list_box_row_selected (GtkListBox* _sender,
                                                                                        GtkListBoxRow* row,
                                                                                        gpointer self)
{
	_switchboard_plug_locale_widgets_install_dialog___lambda31_ (self, row);
}

static void
_switchboard_plug_locale_widgets_install_dialog___lambda32_ (SwitchboardPlugLocaleWidgetsInstallDialog* self)
{
	switchboard_plug_locale_widgets_install_dialog_install_selected (self);
	gtk_widget_hide ((GtkWidget*) self);
}

static void
__switchboard_plug_locale_widgets_install_dialog___lambda32__gtk_list_box_row_activated (GtkListBox* _sender,
                                                                                         GtkListBoxRow* row,
                                                                                         gpointer self)
{
	_switchboard_plug_locale_widgets_install_dialog___lambda32_ ((SwitchboardPlugLocaleWidgetsInstallDialog*) self);
}

static void
_switchboard_plug_locale_widgets_install_dialog___lambda33_ (SwitchboardPlugLocaleWidgetsInstallDialog* self,
                                                             gint response)
{
	if (response == ((gint) GTK_RESPONSE_ACCEPT)) {
		switchboard_plug_locale_widgets_install_dialog_install_selected (self);
	}
	gtk_widget_hide ((GtkWidget*) self);
}

static void
__switchboard_plug_locale_widgets_install_dialog___lambda33__gtk_dialog_response (GtkDialog* _sender,
                                                                                  gint response_id,
                                                                                  gpointer self)
{
	_switchboard_plug_locale_widgets_install_dialog___lambda33_ ((SwitchboardPlugLocaleWidgetsInstallDialog*) self, response_id);
}

static void
_switchboard_plug_locale_widgets_install_dialog___lambda34_ (SwitchboardPlugLocaleWidgetsInstallDialog* self)
{
	GtkListBox* _tmp0_;
	GtkListBoxRow* _tmp1_;
	_tmp0_ = self->priv->list_box;
	_tmp1_ = gtk_list_box_get_row_at_y (_tmp0_, 0);
	g_signal_emit_by_name (_tmp1_, "activate");
}

static void
__switchboard_plug_locale_widgets_install_dialog___lambda34__gtk_search_entry_activate (GtkSearchEntry* _sender,
                                                                                        gpointer self)
{
	_switchboard_plug_locale_widgets_install_dialog___lambda34_ ((SwitchboardPlugLocaleWidgetsInstallDialog*) self);
}

static void
_switchboard_plug_locale_widgets_install_dialog___lambda35_ (SwitchboardPlugLocaleWidgetsInstallDialog* self)
{
	GtkListBox* _tmp0_;
	_tmp0_ = self->priv->list_box;
	gtk_list_box_invalidate_filter (_tmp0_);
}

static void
__switchboard_plug_locale_widgets_install_dialog___lambda35__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                                                              gpointer self)
{
	_switchboard_plug_locale_widgets_install_dialog___lambda35_ ((SwitchboardPlugLocaleWidgetsInstallDialog*) self);
}

static GObject *
switchboard_plug_locale_widgets_install_dialog_constructor (GType type,
                                                            guint n_construct_properties,
                                                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SwitchboardPlugLocaleWidgetsInstallDialog * self;
	Block4Data* _data4_;
	GtkSearchEntry* _tmp0_;
	GtkListBox* _tmp1_ = NULL;
	GtkListBox* _tmp2_;
	GtkListBox* _tmp3_;
	GtkScrolledWindow* scrolled = NULL;
	GtkListBox* _tmp4_;
	GtkWidget* _tmp5_;
	GtkScrolledWindow* _tmp6_ = NULL;
	GtkScrolledWindow* _tmp7_;
	GtkBox* box = NULL;
	GtkBox* _tmp8_;
	GtkBox* _tmp9_;
	GtkSearchEntry* _tmp10_;
	GtkBox* _tmp11_;
	GtkScrolledWindow* _tmp12_;
	GtkBox* _tmp13_;
	GtkBox* _tmp14_;
	GtkWidget* _tmp15_;
	GtkButton* _tmp16_;
	GtkButton* _tmp17_;
	GtkButton* _tmp18_;
	GtkSearchEntry* _tmp19_;
	GtkListBox* _tmp20_;
	GtkListBox* _tmp21_;
	GtkSearchEntry* _tmp22_;
	GtkSearchEntry* _tmp23_;
	parent_class = G_OBJECT_CLASS (switchboard_plug_locale_widgets_install_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWITCHBOARD_PLUG_LOCALE_WIDGETS_TYPE_INSTALL_DIALOG, SwitchboardPlugLocaleWidgetsInstallDialog);
	_data4_ = g_slice_new0 (Block4Data);
	_data4_->_ref_count_ = 1;
	_data4_->self = g_object_ref (self);
	g_object_set ((GtkWindow*) self, "default-height", 400, NULL);
	g_object_set ((GtkWindow*) self, "default-width", 400, NULL);
	gtk_window_set_modal ((GtkWindow*) self, TRUE);
	_tmp0_ = (GtkSearchEntry*) gtk_search_entry_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->search_entry);
	self->priv->search_entry = _tmp0_;
	_tmp1_ = (GtkListBox*) gtk_list_box_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp1_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp1_, TRUE);
	gtk_list_box_set_activate_on_single_click (_tmp1_, FALSE);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->list_box);
	self->priv->list_box = _tmp1_;
	_tmp2_ = self->priv->list_box;
	gtk_list_box_set_filter_func (_tmp2_, (GtkListBoxFilterFunc) switchboard_plug_locale_widgets_install_dialog_filter_function, g_object_ref (self), g_object_unref);
	_tmp3_ = self->priv->list_box;
	gtk_list_box_set_sort_func (_tmp3_, (GtkListBoxSortFunc) switchboard_plug_locale_widgets_install_dialog_sort_function, g_object_ref (self), g_object_unref);
	_tmp4_ = self->priv->list_box;
	_tmp5_ = _g_object_ref0 ((GtkWidget*) _tmp4_);
	_tmp6_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_scrolled_window_set_child (_tmp6_, _tmp5_);
	_g_object_unref0 (_tmp5_);
	g_object_ref_sink (_tmp6_);
	scrolled = _tmp6_;
	_tmp7_ = scrolled;
	gtk_widget_add_css_class ((GtkWidget*) _tmp7_, GRANITE_STYLE_CLASS_FRAME);
	_tmp8_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
	g_object_ref_sink (_tmp8_);
	box = _tmp8_;
	_tmp9_ = box;
	_tmp10_ = self->priv->search_entry;
	gtk_box_append (_tmp9_, (GtkWidget*) _tmp10_);
	_tmp11_ = box;
	_tmp12_ = scrolled;
	gtk_box_append (_tmp11_, (GtkWidget*) _tmp12_);
	_tmp13_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	_tmp14_ = box;
	gtk_box_append (_tmp13_, (GtkWidget*) _tmp14_);
	granite_dialog_add_button ((GraniteDialog*) self, _ ("Cancel"), (gint) GTK_RESPONSE_CANCEL);
	_tmp15_ = granite_dialog_add_button ((GraniteDialog*) self, _ ("Install Language"), (gint) GTK_RESPONSE_ACCEPT);
	_tmp16_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, gtk_button_get_type (), GtkButton));
	_data4_->button_add = _tmp16_;
	_tmp17_ = _data4_->button_add;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp17_, FALSE);
	_tmp18_ = _data4_->button_add;
	gtk_widget_add_css_class ((GtkWidget*) _tmp18_, GRANITE_STYLE_CLASS_SUGGESTED_ACTION);
	switchboard_plug_locale_widgets_install_dialog_load_languagelist (self);
	_tmp19_ = self->priv->search_entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp19_);
	_tmp20_ = self->priv->list_box;
	g_signal_connect_data (_tmp20_, "row-selected", (GCallback) __switchboard_plug_locale_widgets_install_dialog___lambda31__gtk_list_box_row_selected, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
	_tmp21_ = self->priv->list_box;
	g_signal_connect_object (_tmp21_, "row-activated", (GCallback) __switchboard_plug_locale_widgets_install_dialog___lambda32__gtk_list_box_row_activated, self, 0);
	g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) __switchboard_plug_locale_widgets_install_dialog___lambda33__gtk_dialog_response, self, 0);
	_tmp22_ = self->priv->search_entry;
	g_signal_connect_object (_tmp22_, "activate", (GCallback) __switchboard_plug_locale_widgets_install_dialog___lambda34__gtk_search_entry_activate, self, 0);
	_tmp23_ = self->priv->search_entry;
	g_signal_connect_object (_tmp23_, "search-changed", (GCallback) __switchboard_plug_locale_widgets_install_dialog___lambda35__gtk_search_entry_search_changed, self, 0);
	_g_object_unref0 (box);
	_g_object_unref0 (scrolled);
	block4_data_unref (_data4_);
	_data4_ = NULL;
	return obj;
}

static void
switchboard_plug_locale_widgets_install_dialog_class_init (SwitchboardPlugLocaleWidgetsInstallDialogClass * klass,
                                                           gpointer klass_data)
{
	switchboard_plug_locale_widgets_install_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SwitchboardPlugLocaleWidgetsInstallDialog_private_offset);
	G_OBJECT_CLASS (klass)->constructor = switchboard_plug_locale_widgets_install_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = switchboard_plug_locale_widgets_install_dialog_finalize;
}

static void
switchboard_plug_locale_widgets_install_dialog_instance_init (SwitchboardPlugLocaleWidgetsInstallDialog * self,
                                                              gpointer klass)
{
	self->priv = switchboard_plug_locale_widgets_install_dialog_get_instance_private (self);
}

static void
switchboard_plug_locale_widgets_install_dialog_finalize (GObject * obj)
{
	SwitchboardPlugLocaleWidgetsInstallDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWITCHBOARD_PLUG_LOCALE_WIDGETS_TYPE_INSTALL_DIALOG, SwitchboardPlugLocaleWidgetsInstallDialog);
	_g_object_unref0 (self->priv->search_entry);
	_g_object_unref0 (self->priv->list_box);
	G_OBJECT_CLASS (switchboard_plug_locale_widgets_install_dialog_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
switchboard_plug_locale_widgets_install_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SwitchboardPlugLocaleWidgetsInstallDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) switchboard_plug_locale_widgets_install_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SwitchboardPlugLocaleWidgetsInstallDialog), 0, (GInstanceInitFunc) switchboard_plug_locale_widgets_install_dialog_instance_init, NULL };
	GType switchboard_plug_locale_widgets_install_dialog_type_id;
	switchboard_plug_locale_widgets_install_dialog_type_id = g_type_register_static (GRANITE_TYPE_DIALOG, "SwitchboardPlugLocaleWidgetsInstallDialog", &g_define_type_info, 0);
	SwitchboardPlugLocaleWidgetsInstallDialog_private_offset = g_type_add_instance_private (switchboard_plug_locale_widgets_install_dialog_type_id, sizeof (SwitchboardPlugLocaleWidgetsInstallDialogPrivate));
	return switchboard_plug_locale_widgets_install_dialog_type_id;
}

GType
switchboard_plug_locale_widgets_install_dialog_get_type (void)
{
	static gsize switchboard_plug_locale_widgets_install_dialog_type_id__once = 0;
	if (g_once_init_enter (&switchboard_plug_locale_widgets_install_dialog_type_id__once)) {
		GType switchboard_plug_locale_widgets_install_dialog_type_id;
		switchboard_plug_locale_widgets_install_dialog_type_id = switchboard_plug_locale_widgets_install_dialog_get_type_once ();
		g_once_init_leave (&switchboard_plug_locale_widgets_install_dialog_type_id__once, switchboard_plug_locale_widgets_install_dialog_type_id);
	}
	return switchboard_plug_locale_widgets_install_dialog_type_id__once;
}

