/* security-widget.c generated by valac 0.20.1, the Vala compiler
 * generated from security-widget.vala, do not modify */

/* -*- Mode: vala; tab-width: 4; intend-tabs-mode: t -*- */
/* alm
 *
 * Copyright (C) 2013 Jeremy Bicha <jbicha@ubuntu.com>
 *
 * alm 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 2 of the License, or
 * (at your option) any later version.
 *
 * alm 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

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


#define ALM_TYPE_SECURITY_WIDGET (alm_security_widget_get_type ())
#define ALM_SECURITY_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ALM_TYPE_SECURITY_WIDGET, AlmSecurityWidget))
#define ALM_SECURITY_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ALM_TYPE_SECURITY_WIDGET, AlmSecurityWidgetClass))
#define ALM_IS_SECURITY_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ALM_TYPE_SECURITY_WIDGET))
#define ALM_IS_SECURITY_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ALM_TYPE_SECURITY_WIDGET))
#define ALM_SECURITY_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ALM_TYPE_SECURITY_WIDGET, AlmSecurityWidgetClass))

typedef struct _AlmSecurityWidget AlmSecurityWidget;
typedef struct _AlmSecurityWidgetClass AlmSecurityWidgetClass;
typedef struct _AlmSecurityWidgetPrivate AlmSecurityWidgetPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))

struct _AlmSecurityWidget {
	GtkBox parent_instance;
	AlmSecurityWidgetPrivate * priv;
};

struct _AlmSecurityWidgetClass {
	GtkBoxClass parent_class;
};

struct _AlmSecurityWidgetPrivate {
	GSettings* power_settings;
	GSettings* screensaver_settings;
};

struct _Block1Data {
	int _ref_count_;
	AlmSecurityWidget * self;
	GtkComboBox* combo_delay;
};


static gpointer alm_security_widget_parent_class = NULL;

GType alm_security_widget_get_type (void) G_GNUC_CONST;
#define ALM_SECURITY_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ALM_TYPE_SECURITY_WIDGET, AlmSecurityWidgetPrivate))
enum  {
	ALM_SECURITY_WIDGET_DUMMY_PROPERTY
};
AlmSecurityWidget* alm_security_widget_new (void);
AlmSecurityWidget* alm_security_widget_construct (GType object_type);
static void alm_security_widget_set_up_ui (AlmSecurityWidget* self);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void alm_security_widget_set_delay_cb (AlmSecurityWidget* self, GtkComboBox* combo);
static void _alm_security_widget_set_delay_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self);
static void __lambda2_ (Block1Data* _data1_);
static void ___lambda2__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void __lambda3_ (Block1Data* _data1_);
static void alm_security_widget_get_delay_cb (AlmSecurityWidget* self, GtkComboBox* combo);
static void ___lambda3__g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static gboolean __lambda4_ (AlmSecurityWidget* self);
static gboolean ___lambda4__gtk_link_button_activate_link (GtkLinkButton* _sender, gpointer self);
static gboolean __lambda5_ (AlmSecurityWidget* self);
static gboolean ___lambda5__gtk_link_button_activate_link (GtkLinkButton* _sender, gpointer self);
static void _g_object_unref0_ (gpointer var);
static void _g_list_free__g_object_unref0_ (GList* self);
static void alm_security_widget_finalize (GObject* obj);


AlmSecurityWidget* alm_security_widget_construct (GType object_type) {
	AlmSecurityWidget * self = NULL;
	GSettings* _tmp0_;
	GSettings* _tmp1_;
	self = (AlmSecurityWidget*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, NULL);
	gtk_box_set_spacing ((GtkBox*) self, 5);
	gtk_container_set_border_width ((GtkContainer*) self, (guint) 12);
	_tmp0_ = g_settings_new ("org.gnome.settings-daemon.plugins.power");
	_g_object_unref0 (self->priv->power_settings);
	self->priv->power_settings = _tmp0_;
	_tmp1_ = g_settings_new ("org.gnome.desktop.screensaver");
	_g_object_unref0 (self->priv->screensaver_settings);
	self->priv->screensaver_settings = _tmp1_;
	alm_security_widget_set_up_ui (self);
	return self;
}


AlmSecurityWidget* alm_security_widget_new (void) {
	return alm_security_widget_construct (ALM_TYPE_SECURITY_WIDGET);
}


static Block1Data* block1_data_ref (Block1Data* _data1_) {
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}


static void block1_data_unref (void * _userdata_) {
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		AlmSecurityWidget * self;
		self = _data1_->self;
		_g_object_unref0 (_data1_->combo_delay);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}


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


static void _alm_security_widget_set_delay_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
	alm_security_widget_set_delay_cb (self, _sender);
}


static void __lambda2_ (Block1Data* _data1_) {
	AlmSecurityWidget * self;
	GSettings* _tmp0_;
	gboolean _tmp1_ = FALSE;
	self = _data1_->self;
	_tmp0_ = self->priv->screensaver_settings;
	_tmp1_ = g_settings_get_boolean (_tmp0_, "lock-enabled");
	gtk_widget_set_sensitive ((GtkWidget*) _data1_->combo_delay, _tmp1_);
}


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


static void __lambda3_ (Block1Data* _data1_) {
	AlmSecurityWidget * self;
	self = _data1_->self;
	alm_security_widget_get_delay_cb (self, _data1_->combo_delay);
}


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


static gboolean __lambda4_ (AlmSecurityWidget* self) {
	gboolean result = FALSE;
	GError * _inner_error_ = NULL;
	{
		g_spawn_command_line_async ("gnome-control-center user-accounts", &_inner_error_);
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_SPAWN_ERROR) {
				goto __catch0_g_spawn_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return FALSE;
		}
	}
	goto __finally0;
	__catch0_g_spawn_error:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		g_warning ("security-widget.vala:116: %s", _tmp1_);
		_g_error_free0 (e);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return FALSE;
	}
	result = TRUE;
	return result;
}


static gboolean ___lambda4__gtk_link_button_activate_link (GtkLinkButton* _sender, gpointer self) {
	gboolean result;
	result = __lambda4_ (self);
	return result;
}


static gboolean __lambda5_ (AlmSecurityWidget* self) {
	gboolean result = FALSE;
	GError * _inner_error_ = NULL;
	{
		g_spawn_command_line_async ("gnome-control-center power", &_inner_error_);
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_SPAWN_ERROR) {
				goto __catch1_g_spawn_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return FALSE;
		}
	}
	goto __finally1;
	__catch1_g_spawn_error:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		g_warning ("security-widget.vala:129: %s", _tmp1_);
		_g_error_free0 (e);
	}
	__finally1:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return FALSE;
	}
	result = TRUE;
	return result;
}


static gboolean ___lambda5__gtk_link_button_activate_link (GtkLinkButton* _sender, gpointer self) {
	gboolean result;
	result = __lambda5_ (self);
	return result;
}


static void _g_object_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}


static void _g_list_free__g_object_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
	g_list_free (self);
}


static void alm_security_widget_set_up_ui (AlmSecurityWidget* self) {
	Block1Data* _data1_;
	GtkListStore* _tmp0_;
	GtkListStore* liststore_delay;
	GtkTreeIter iter = {0};
	GtkTreeIter _tmp1_ = {0};
	GtkTreeIter _tmp2_;
	GtkTreeIter _tmp3_ = {0};
	GtkTreeIter _tmp4_;
	GtkTreeIter _tmp5_ = {0};
	GtkTreeIter _tmp6_;
	GtkTreeIter _tmp7_ = {0};
	GtkTreeIter _tmp8_;
	GtkTreeIter _tmp9_ = {0};
	GtkTreeIter _tmp10_;
	GtkTreeIter _tmp11_ = {0};
	GtkTreeIter _tmp12_;
	GtkTreeIter _tmp13_ = {0};
	GtkTreeIter _tmp14_;
	GtkTreeIter _tmp15_ = {0};
	GtkTreeIter _tmp16_;
	GtkTreeIter _tmp17_ = {0};
	GtkTreeIter _tmp18_;
	GtkGrid* _tmp19_;
	GtkGrid* grid;
	GList* list_focus;
	GtkLabel* _tmp20_;
	GtkLabel* header;
	const gchar* _tmp21_ = NULL;
	gchar* _tmp22_ = NULL;
	gchar* _tmp23_;
	const gchar* _tmp24_ = NULL;
	GtkCheckButton* _tmp25_;
	GtkCheckButton* checkbox_suspend;
	GSettings* _tmp26_;
	GtkWidget* _tmp27_;
	const gchar* _tmp28_ = NULL;
	GtkCheckButton* _tmp29_;
	GtkCheckButton* checkbox_screensaver;
	GSettings* _tmp30_;
	GtkWidget* _tmp31_;
	GtkLabel* _tmp32_;
	GtkLabel* label_combo_delay;
	const gchar* _tmp33_ = NULL;
	GtkComboBox* _tmp34_;
	GtkCellRendererText* _tmp35_;
	GtkCellRendererText* cell;
	GtkWidget* _tmp36_;
	GSettings* _tmp37_;
	GSettings* _tmp38_;
	gboolean _tmp39_ = FALSE;
	GSettings* _tmp40_;
	const gchar* _tmp41_ = NULL;
	GtkLinkButton* _tmp42_;
	GtkLinkButton* link_password;
	GtkWidget* _tmp43_;
	const gchar* _tmp44_ = NULL;
	GtkLinkButton* _tmp45_;
	GtkLinkButton* link_power;
	GtkWidget* _tmp46_;
	g_return_if_fail (self != NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	_tmp0_ = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
	liststore_delay = _tmp0_;
	gtk_list_store_append (liststore_delay, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = iter;
	gtk_list_store_set (liststore_delay, &_tmp2_, 0, "1 second", 1, 0, -1);
	gtk_list_store_append (liststore_delay, &_tmp3_);
	iter = _tmp3_;
	_tmp4_ = iter;
	gtk_list_store_set (liststore_delay, &_tmp4_, 0, "30 seconds", 1, 30, -1);
	gtk_list_store_append (liststore_delay, &_tmp5_);
	iter = _tmp5_;
	_tmp6_ = iter;
	gtk_list_store_set (liststore_delay, &_tmp6_, 0, "1 minute", 1, 60, -1);
	gtk_list_store_append (liststore_delay, &_tmp7_);
	iter = _tmp7_;
	_tmp8_ = iter;
	gtk_list_store_set (liststore_delay, &_tmp8_, 0, "2 minutes", 1, 120, -1);
	gtk_list_store_append (liststore_delay, &_tmp9_);
	iter = _tmp9_;
	_tmp10_ = iter;
	gtk_list_store_set (liststore_delay, &_tmp10_, 0, "3 minutes", 1, 180, -1);
	gtk_list_store_append (liststore_delay, &_tmp11_);
	iter = _tmp11_;
	_tmp12_ = iter;
	gtk_list_store_set (liststore_delay, &_tmp12_, 0, "5 minutes", 1, 300, -1);
	gtk_list_store_append (liststore_delay, &_tmp13_);
	iter = _tmp13_;
	_tmp14_ = iter;
	gtk_list_store_set (liststore_delay, &_tmp14_, 0, "10 minutes", 1, 600, -1);
	gtk_list_store_append (liststore_delay, &_tmp15_);
	iter = _tmp15_;
	_tmp16_ = iter;
	gtk_list_store_set (liststore_delay, &_tmp16_, 0, "30 minutes", 1, 1800, -1);
	gtk_list_store_append (liststore_delay, &_tmp17_);
	iter = _tmp17_;
	_tmp18_ = iter;
	gtk_list_store_set (liststore_delay, &_tmp18_, 0, "1 hour", 1, 3600, -1);
	_tmp19_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp19_);
	grid = _tmp19_;
	gtk_widget_set_halign ((GtkWidget*) grid, GTK_ALIGN_START);
	gtk_widget_set_valign ((GtkWidget*) grid, GTK_ALIGN_START);
	gtk_widget_set_margin_top ((GtkWidget*) grid, 25);
	gtk_widget_set_margin_left ((GtkWidget*) grid, 25);
	gtk_grid_set_column_spacing (grid, (guint) 25);
	gtk_grid_set_row_spacing (grid, (guint) 5);
	gtk_grid_set_row_homogeneous (grid, TRUE);
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) grid);
	list_focus = NULL;
	_tmp20_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp20_);
	header = _tmp20_;
	_tmp21_ = _ ("Require my password when:");
	_tmp22_ = g_strdup_printf ("<b>%s</b>", _tmp21_);
	_tmp23_ = _tmp22_;
	gtk_label_set_markup (header, _tmp23_);
	_g_free0 (_tmp23_);
	gtk_grid_attach (grid, (GtkWidget*) header, 0, 0, 1, 1);
	_tmp24_ = _ ("_Waking from suspend");
	_tmp25_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp24_);
	g_object_ref_sink (_tmp25_);
	checkbox_suspend = _tmp25_;
	_tmp26_ = self->priv->screensaver_settings;
	g_settings_bind (_tmp26_, "ubuntu-lock-on-suspend", (GObject*) checkbox_suspend, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp27_ = _g_object_ref0 ((GtkWidget*) checkbox_suspend);
	list_focus = g_list_append (list_focus, _tmp27_);
	gtk_grid_attach (grid, (GtkWidget*) checkbox_suspend, 0, 1, 1, 1);
	_tmp28_ = _ ("_Returning from blank screen");
	_tmp29_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp28_);
	g_object_ref_sink (_tmp29_);
	checkbox_screensaver = _tmp29_;
	_tmp30_ = self->priv->screensaver_settings;
	g_settings_bind (_tmp30_, "lock-enabled", (GObject*) checkbox_screensaver, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp31_ = _g_object_ref0 ((GtkWidget*) checkbox_screensaver);
	list_focus = g_list_append (list_focus, _tmp31_);
	gtk_grid_attach (grid, (GtkWidget*) checkbox_screensaver, 0, 2, 1, 1);
	_tmp32_ = (GtkLabel*) gtk_label_new (NULL);
	g_object_ref_sink (_tmp32_);
	label_combo_delay = _tmp32_;
	_tmp33_ = _ ("_if screen has been blank for");
	gtk_label_set_markup_with_mnemonic (label_combo_delay, _tmp33_);
	gtk_widget_set_margin_left ((GtkWidget*) label_combo_delay, 18);
	gtk_grid_attach (grid, (GtkWidget*) label_combo_delay, 0, 3, 1, 1);
	_tmp34_ = (GtkComboBox*) gtk_combo_box_new_with_model ((GtkTreeModel*) liststore_delay);
	g_object_ref_sink (_tmp34_);
	_data1_->combo_delay = _tmp34_;
	g_signal_connect_object (_data1_->combo_delay, "changed", (GCallback) _alm_security_widget_set_delay_cb_gtk_combo_box_changed, self, 0);
	gtk_label_set_mnemonic_widget (label_combo_delay, (GtkWidget*) _data1_->combo_delay);
	_tmp35_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp35_);
	cell = _tmp35_;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _data1_->combo_delay, (GtkCellRenderer*) cell, FALSE);
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _data1_->combo_delay, (GtkCellRenderer*) cell, "text", 0);
	_tmp36_ = _g_object_ref0 ((GtkWidget*) _data1_->combo_delay);
	list_focus = g_list_append (list_focus, _tmp36_);
	_tmp37_ = self->priv->screensaver_settings;
	g_signal_connect_data (_tmp37_, "changed::lock-enabled", (GCallback) ___lambda2__g_settings_changed, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	_tmp38_ = self->priv->screensaver_settings;
	_tmp39_ = g_settings_get_boolean (_tmp38_, "lock-enabled");
	gtk_widget_set_sensitive ((GtkWidget*) _data1_->combo_delay, _tmp39_);
	_tmp40_ = self->priv->screensaver_settings;
	g_signal_connect_data (_tmp40_, "changed::lock-delay", (GCallback) ___lambda3__g_settings_changed, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	alm_security_widget_get_delay_cb (self, _data1_->combo_delay);
	gtk_grid_attach (grid, (GtkWidget*) _data1_->combo_delay, 1, 3, 1, 1);
	_tmp41_ = _ ("Password Settings");
	_tmp42_ = (GtkLinkButton*) gtk_link_button_new (_tmp41_);
	g_object_ref_sink (_tmp42_);
	link_password = _tmp42_;
	g_signal_connect_object (link_password, "activate-link", (GCallback) ___lambda4__gtk_link_button_activate_link, self, 0);
	gtk_widget_set_halign ((GtkWidget*) link_password, GTK_ALIGN_START);
	_tmp43_ = _g_object_ref0 ((GtkWidget*) link_password);
	list_focus = g_list_append (list_focus, _tmp43_);
	gtk_grid_attach (grid, (GtkWidget*) link_password, 2, 0, 1, 1);
	_tmp44_ = _ ("Power Settings");
	_tmp45_ = (GtkLinkButton*) gtk_link_button_new (_tmp44_);
	g_object_ref_sink (_tmp45_);
	link_power = _tmp45_;
	g_signal_connect_object (link_power, "activate-link", (GCallback) ___lambda5__gtk_link_button_activate_link, self, 0);
	gtk_widget_set_halign ((GtkWidget*) link_power, GTK_ALIGN_START);
	_tmp46_ = _g_object_ref0 ((GtkWidget*) link_power);
	list_focus = g_list_append (list_focus, _tmp46_);
	gtk_grid_attach (grid, (GtkWidget*) link_power, 2, 1, 1, 1);
	gtk_container_set_focus_chain ((GtkContainer*) grid, list_focus);
	_g_object_unref0 (link_power);
	_g_object_unref0 (link_password);
	_g_object_unref0 (cell);
	_g_object_unref0 (label_combo_delay);
	_g_object_unref0 (checkbox_screensaver);
	_g_object_unref0 (checkbox_suspend);
	_g_object_unref0 (header);
	__g_list_free__g_object_unref0_0 (list_focus);
	_g_object_unref0 (grid);
	_g_object_unref0 (liststore_delay);
	block1_data_unref (_data1_);
	_data1_ = NULL;
}


static void alm_security_widget_set_delay_cb (AlmSecurityWidget* self, GtkComboBox* combo) {
	guint seconds = 0U;
	GtkTreeIter iter = {0};
	GtkComboBox* _tmp0_;
	GtkTreeIter _tmp1_ = {0};
	GtkComboBox* _tmp2_;
	GtkTreeModel* _tmp3_;
	GtkTreeModel* _tmp4_;
	GtkTreeIter _tmp5_;
	GSettings* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	_tmp0_ = combo;
	gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = combo;
	_tmp3_ = gtk_combo_box_get_model (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = iter;
	gtk_tree_model_get (_tmp4_, &_tmp5_, 1, &seconds, -1);
	_tmp6_ = self->priv->screensaver_settings;
	g_settings_set_uint (_tmp6_, "lock-delay", seconds);
}


static void alm_security_widget_get_delay_cb (AlmSecurityWidget* self, GtkComboBox* combo) {
	gint i;
	gint value_prev;
	gint value_tmp;
	GtkComboBox* _tmp0_;
	GtkTreeModel* _tmp1_ = NULL;
	GtkTreeModel* _tmp2_;
	GtkTreeModel* model;
	GtkTreeIter iter = {0};
	GtkTreeModel* _tmp3_;
	GtkTreeIter _tmp4_ = {0};
	GSettings* _tmp5_;
	guint _tmp6_ = 0U;
	guint value;
	GtkComboBox* _tmp27_;
	gint _tmp28_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	i = 0;
	value_prev = 0;
	value_tmp = 0;
	_tmp0_ = combo;
	_tmp1_ = gtk_combo_box_get_model (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	model = _tmp2_;
	_tmp3_ = model;
	gtk_tree_model_get_iter_first (_tmp3_, &_tmp4_);
	iter = _tmp4_;
	_tmp5_ = self->priv->screensaver_settings;
	_tmp6_ = g_settings_get_uint (_tmp5_, "lock-delay");
	value = _tmp6_;
	{
		gboolean _tmp7_;
		_tmp7_ = TRUE;
		while (TRUE) {
			gboolean _tmp8_;
			GtkTreeModel* _tmp11_;
			GtkTreeIter _tmp12_;
			gboolean _tmp13_ = FALSE;
			guint _tmp14_;
			gint _tmp15_;
			gboolean _tmp22_;
			gint _tmp25_;
			gint _tmp26_;
			_tmp8_ = _tmp7_;
			if (!_tmp8_) {
				GtkTreeModel* _tmp9_;
				gboolean _tmp10_ = FALSE;
				_tmp9_ = model;
				_tmp10_ = gtk_tree_model_iter_next (_tmp9_, &iter);
				if (!_tmp10_) {
					break;
				}
			}
			_tmp7_ = FALSE;
			_tmp11_ = model;
			_tmp12_ = iter;
			gtk_tree_model_get (_tmp11_, &_tmp12_, 1, &value_tmp, -1);
			_tmp14_ = value;
			_tmp15_ = value_tmp;
			if (_tmp14_ == ((guint) _tmp15_)) {
				_tmp13_ = TRUE;
			} else {
				gboolean _tmp16_ = FALSE;
				gint _tmp17_;
				gint _tmp18_;
				gboolean _tmp21_;
				_tmp17_ = value_tmp;
				_tmp18_ = value_prev;
				if (_tmp17_ > _tmp18_) {
					guint _tmp19_;
					gint _tmp20_;
					_tmp19_ = value;
					_tmp20_ = value_tmp;
					_tmp16_ = _tmp19_ < ((guint) _tmp20_);
				} else {
					_tmp16_ = FALSE;
				}
				_tmp21_ = _tmp16_;
				_tmp13_ = _tmp21_;
			}
			_tmp22_ = _tmp13_;
			if (_tmp22_) {
				GtkComboBox* _tmp23_;
				GtkTreeIter _tmp24_;
				_tmp23_ = combo;
				_tmp24_ = iter;
				gtk_combo_box_set_active_iter (_tmp23_, &_tmp24_);
				_g_object_unref0 (model);
				return;
			}
			_tmp25_ = value_tmp;
			value_prev = _tmp25_;
			_tmp26_ = i;
			i = _tmp26_ + 1;
		}
	}
	_tmp27_ = combo;
	_tmp28_ = i;
	gtk_combo_box_set_active (_tmp27_, _tmp28_ - 1);
	_g_object_unref0 (model);
}


static void alm_security_widget_class_init (AlmSecurityWidgetClass * klass) {
	alm_security_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (AlmSecurityWidgetPrivate));
	G_OBJECT_CLASS (klass)->finalize = alm_security_widget_finalize;
}


static void alm_security_widget_instance_init (AlmSecurityWidget * self) {
	self->priv = ALM_SECURITY_WIDGET_GET_PRIVATE (self);
}


static void alm_security_widget_finalize (GObject* obj) {
	AlmSecurityWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ALM_TYPE_SECURITY_WIDGET, AlmSecurityWidget);
	_g_object_unref0 (self->priv->power_settings);
	_g_object_unref0 (self->priv->screensaver_settings);
	G_OBJECT_CLASS (alm_security_widget_parent_class)->finalize (obj);
}


GType alm_security_widget_get_type (void) {
	static volatile gsize alm_security_widget_type_id__volatile = 0;
	if (g_once_init_enter (&alm_security_widget_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (AlmSecurityWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) alm_security_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AlmSecurityWidget), 0, (GInstanceInitFunc) alm_security_widget_instance_init, NULL };
		GType alm_security_widget_type_id;
		alm_security_widget_type_id = g_type_register_static (GTK_TYPE_BOX, "AlmSecurityWidget", &g_define_type_info, 0);
		g_once_init_leave (&alm_security_widget_type_id__volatile, alm_security_widget_type_id);
	}
	return alm_security_widget_type_id__volatile;
}



