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

/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: 2014-2023 elementary, Inc. (https://elementary.io)
 */

#include "useraccounts.h"
#include <gtk/gtk.h>
#include <granite-7.h>
#include <glib.h>
#include <act/act.h>
#include <stdlib.h>
#include <string.h>
#include <polkit/polkit.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <glib-object.h>
#include <adwaita.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_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_0_PROPERTY,
	SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_NUM_PROPERTIES
};
static GParamSpec* switchboard_plug_user_accounts_widgets_main_view_properties[SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_TYPE_SIDEBAR (switchboard_plug_user_accounts_widgets_main_view_sidebar_get_type ())
#define SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_TYPE_SIDEBAR, SwitchboardPlugUserAccountsWidgetsMainViewSidebar))
#define SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_TYPE_SIDEBAR, SwitchboardPlugUserAccountsWidgetsMainViewSidebarClass))
#define SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_IS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_TYPE_SIDEBAR))
#define SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_IS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_TYPE_SIDEBAR))
#define SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_SIDEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_TYPE_SIDEBAR, SwitchboardPlugUserAccountsWidgetsMainViewSidebarClass))

typedef struct _SwitchboardPlugUserAccountsWidgetsMainViewSidebar SwitchboardPlugUserAccountsWidgetsMainViewSidebar;
typedef struct _SwitchboardPlugUserAccountsWidgetsMainViewSidebarClass SwitchboardPlugUserAccountsWidgetsMainViewSidebarClass;
typedef struct _SwitchboardPlugUserAccountsWidgetsMainViewSidebarPrivate SwitchboardPlugUserAccountsWidgetsMainViewSidebarPrivate;
enum  {
	SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_SIDEBAR_0_PROPERTY,
	SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_SIDEBAR_NUM_PROPERTIES
};
static GParamSpec* switchboard_plug_user_accounts_widgets_main_view_sidebar_properties[SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_SIDEBAR_NUM_PROPERTIES];
#define _g_settings_schema_unref0(var) ((var == NULL) ? NULL : (var = (g_settings_schema_unref (var), NULL)))

struct _SwitchboardPlugUserAccountsWidgetsMainViewPrivate {
	GtkListBox* listbox;
	GraniteToast* toast;
	GtkStack* content;
	SwitchboardPlugUserAccountsWidgetsGuestSettingsView* guest;
	GraniteHeaderLabel* my_account_label;
	GraniteHeaderLabel* other_accounts_label;
	GtkListBoxRow* guest_session_row;
	GtkLabel* guest_description_label;
};

struct _SwitchboardPlugUserAccountsWidgetsMainViewSidebar {
	GtkBox parent_instance;
	SwitchboardPlugUserAccountsWidgetsMainViewSidebarPrivate * priv;
};

struct _SwitchboardPlugUserAccountsWidgetsMainViewSidebarClass {
	GtkBoxClass parent_class;
};

static gint SwitchboardPlugUserAccountsWidgetsMainView_private_offset;
static gpointer switchboard_plug_user_accounts_widgets_main_view_parent_class = NULL;
static gpointer switchboard_plug_user_accounts_widgets_main_view_sidebar_parent_class = NULL;

static void switchboard_plug_user_accounts_widgets_main_view_update (SwitchboardPlugUserAccountsWidgetsMainView* self);
static void switchboard_plug_user_accounts_widgets_main_view_add_user_settings (SwitchboardPlugUserAccountsWidgetsMainView* self,
                                                                         ActUser* user);
static void _switchboard_plug_user_accounts_widgets_main_view_add_user_settings_act_user_manager_user_added (ActUserManager* _sender,
                                                                                                      ActUser* user,
                                                                                                      gpointer self);
static void __lambda23_ (SwitchboardPlugUserAccountsWidgetsMainView* self,
                  ActUser* user);
static void switchboard_plug_user_accounts_widgets_main_view_remove_user_settings (SwitchboardPlugUserAccountsWidgetsMainView* self,
                                                                            ActUser* user);
static void ___lambda23__act_user_manager_user_removed (ActUserManager* _sender,
                                                 ActUser* user,
                                                 gpointer self);
static void switchboard_plug_user_accounts_widgets_main_view_update_guest (SwitchboardPlugUserAccountsWidgetsMainView* self);
static void _switchboard_plug_user_accounts_widgets_main_view_update_guest_switchboard_plug_user_accounts_widgets_guest_settings_view_guest_switch_changed (SwitchboardPlugUserAccountsWidgetsGuestSettingsView* _sender,
                                                                                                                                                     gpointer self);
static void switchboard_plug_user_accounts_widgets_main_view_remove_user (SwitchboardPlugUserAccountsWidgetsMainView* self);
static void _gtk_window_destroy_gtk_dialog_response (GtkDialog* _sender,
                                              gint response_id,
                                              gpointer self);
static void _switchboard_plug_user_accounts_widgets_main_view_remove_user_switchboard_plug_user_accounts_widgets_user_settings_view_remove_user (SwitchboardPlugUserAccountsWidgetsUserSettingsView* _sender,
                                                                                                                                          gpointer self);
static void switchboard_plug_user_accounts_widgets_main_view_update_listbox (SwitchboardPlugUserAccountsWidgetsMainView* self);
static void switchboard_plug_user_accounts_widgets_main_view_listbox_selected (SwitchboardPlugUserAccountsWidgetsMainView* self,
                                                                        GtkListBoxRow* user_item);
static void switchboard_plug_user_accounts_widgets_main_view_update_headers (SwitchboardPlugUserAccountsWidgetsMainView* self,
                                                                      GtkListBoxRow* row,
                                                                      GtkListBoxRow* before);
static GType switchboard_plug_user_accounts_widgets_main_view_sidebar_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static SwitchboardPlugUserAccountsWidgetsMainViewSidebar* switchboard_plug_user_accounts_widgets_main_view_sidebar_new (void);
static SwitchboardPlugUserAccountsWidgetsMainViewSidebar* switchboard_plug_user_accounts_widgets_main_view_sidebar_construct (GType object_type);
static GObject * switchboard_plug_user_accounts_widgets_main_view_sidebar_constructor (GType type,
                                                                                guint n_construct_properties,
                                                                                GObjectConstructParam * construct_properties);
static GType switchboard_plug_user_accounts_widgets_main_view_sidebar_get_type_once (void);
static GObject * switchboard_plug_user_accounts_widgets_main_view_constructor (GType type,
                                                                        guint n_construct_properties,
                                                                        GObjectConstructParam * construct_properties);
static void _switchboard_plug_user_accounts_widgets_main_view_update_headers_gtk_list_box_update_header_func (GtkListBoxRow* row,
                                                                                                       GtkListBoxRow* before,
                                                                                                       gpointer self);
static void _switchboard_plug_user_accounts_widgets_main_view_update_g_object_notify (GObject* _sender,
                                                                               GParamSpec* pspec,
                                                                               gpointer self);
static void _switchboard_plug_user_accounts_widgets_main_view___lambda24_ (SwitchboardPlugUserAccountsWidgetsMainView* self);
static void __switchboard_plug_user_accounts_widgets_main_view___lambda24__gtk_button_clicked (GtkButton* _sender,
                                                                                        gpointer self);
static void _switchboard_plug_user_accounts_widgets_main_view___lambda29_ (SwitchboardPlugUserAccountsWidgetsMainView* self);
static void __switchboard_plug_user_accounts_widgets_main_view___lambda29__g_object_notify (GObject* _sender,
                                                                                     GParamSpec* pspec,
                                                                                     gpointer self);
static void _switchboard_plug_user_accounts_widgets_main_view___lambda30_ (SwitchboardPlugUserAccountsWidgetsMainView* self);
static void __switchboard_plug_user_accounts_widgets_main_view___lambda30__granite_toast_default_action (GraniteToast* _sender,
                                                                                                  gpointer self);
static void _switchboard_plug_user_accounts_widgets_main_view_listbox_selected_gtk_list_box_row_selected (GtkListBox* _sender,
                                                                                                   GtkListBoxRow* row,
                                                                                                   gpointer self);
static void switchboard_plug_user_accounts_widgets_main_view_finalize (GObject * obj);
static GType switchboard_plug_user_accounts_widgets_main_view_get_type_once (void);

static inline gpointer
switchboard_plug_user_accounts_widgets_main_view_get_instance_private (SwitchboardPlugUserAccountsWidgetsMainView* self)
{
	return G_STRUCT_MEMBER_P (self, SwitchboardPlugUserAccountsWidgetsMainView_private_offset);
}

static void
_switchboard_plug_user_accounts_widgets_main_view_add_user_settings_act_user_manager_user_added (ActUserManager* _sender,
                                                                                                 ActUser* user,
                                                                                                 gpointer self)
{
	switchboard_plug_user_accounts_widgets_main_view_add_user_settings ((SwitchboardPlugUserAccountsWidgetsMainView*) self, user);
}

static void
__lambda23_ (SwitchboardPlugUserAccountsWidgetsMainView* self,
             ActUser* user)
{
	GList* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (user != NULL);
	switchboard_plug_user_accounts_widgets_main_view_remove_user_settings (self, user);
	_tmp0_ = switchboard_plug_user_accounts_get_removal_list ();
	_tmp1_ = g_list_last (_tmp0_);
	if (_tmp1_ == NULL) {
		GraniteToast* _tmp2_;
		_tmp2_ = self->priv->toast;
		granite_toast_withdraw (_tmp2_);
	}
}

static void
___lambda23__act_user_manager_user_removed (ActUserManager* _sender,
                                            ActUser* user,
                                            gpointer self)
{
	__lambda23_ ((SwitchboardPlugUserAccountsWidgetsMainView*) self, user);
}

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

static void
_switchboard_plug_user_accounts_widgets_main_view_update_guest_switchboard_plug_user_accounts_widgets_guest_settings_view_guest_switch_changed (SwitchboardPlugUserAccountsWidgetsGuestSettingsView* _sender,
                                                                                                                                                gpointer self)
{
	switchboard_plug_user_accounts_widgets_main_view_update_guest ((SwitchboardPlugUserAccountsWidgetsMainView*) self);
}

static void
switchboard_plug_user_accounts_widgets_main_view_update (SwitchboardPlugUserAccountsWidgetsMainView* self)
{
	ActUserManager* _tmp0_;
	ActUserManager* _tmp1_;
	ActUserManager* _tmp2_;
	GSList* _tmp3_;
	const gchar* _tmp6_;
	GtkListBox* _tmp8_;
	GtkListBox* _tmp9_;
	GtkListBoxRow* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = switchboard_plug_user_accounts_get_usermanager ();
	g_signal_connect_object (_tmp0_, "user-added", (GCallback) _switchboard_plug_user_accounts_widgets_main_view_add_user_settings_act_user_manager_user_added, self, 0);
	_tmp1_ = switchboard_plug_user_accounts_get_usermanager ();
	g_signal_connect_object (_tmp1_, "user-removed", (GCallback) ___lambda23__act_user_manager_user_removed, self, 0);
	_tmp2_ = switchboard_plug_user_accounts_get_usermanager ();
	_tmp3_ = act_user_manager_list_users (_tmp2_);
	{
		GSList* user_collection = NULL;
		GSList* user_it = NULL;
		user_collection = _tmp3_;
		for (user_it = user_collection; user_it != NULL; user_it = user_it->next) {
			ActUser* _tmp4_;
			ActUser* user = NULL;
			_tmp4_ = _g_object_ref0 ((ActUser*) user_it->data);
			user = _tmp4_;
			{
				ActUser* _tmp5_;
				_tmp5_ = user;
				switchboard_plug_user_accounts_widgets_main_view_add_user_settings (self, _tmp5_);
				_g_object_unref0 (user);
			}
		}
		(user_collection == NULL) ? NULL : (user_collection = (g_slist_free (user_collection), NULL));
	}
	_tmp6_ = switchboard_plug_user_accounts_get_display_manager ();
	if (g_strcmp0 (_tmp6_, "lightdm") == 0) {
		SwitchboardPlugUserAccountsWidgetsGuestSettingsView* _tmp7_;
		_tmp7_ = self->priv->guest;
		g_signal_connect_object (_tmp7_, "guest-switch-changed", (GCallback) _switchboard_plug_user_accounts_widgets_main_view_update_guest_switchboard_plug_user_accounts_widgets_guest_settings_view_guest_switch_changed, self, 0);
	}
	_tmp8_ = self->priv->listbox;
	_tmp9_ = self->priv->listbox;
	_tmp10_ = gtk_list_box_get_row_at_index (_tmp9_, 0);
	gtk_list_box_select_row (_tmp8_, _tmp10_);
}

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

static void
switchboard_plug_user_accounts_widgets_main_view_remove_user (SwitchboardPlugUserAccountsWidgetsMainView* self)
{
	PolkitPermission* permission = NULL;
	PolkitPermission* _tmp0_;
	PolkitPermission* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	ActUser* selected_user = NULL;
	GtkListBox* _tmp16_;
	GtkListBoxRow* _tmp17_;
	ActUser* _tmp18_;
	ActUser* _tmp19_;
	ActUser* _tmp20_;
	ActUser* _tmp21_;
	GtkListBox* _tmp22_;
	GtkListBox* _tmp23_;
	GtkListBoxRow* _tmp24_;
	GtkListBox* _tmp25_;
	GtkListBox* _tmp26_;
	GtkListBoxRow* _tmp27_;
	GraniteToast* _tmp28_;
	ActUser* _tmp29_;
	const gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	GraniteToast* _tmp33_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = switchboard_plug_user_accounts_get_permission ();
	permission = _tmp0_;
	_tmp1_ = permission;
	_tmp2_ = g_permission_get_allowed ((GPermission*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		{
			PolkitPermission* _tmp4_;
			_tmp4_ = permission;
			g_permission_acquire ((GPermission*) _tmp4_, NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GError* _tmp5_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp5_ = e;
			if (!g_error_matches (_tmp5_, g_io_error_quark (), G_IO_ERROR_CANCELLED)) {
				GraniteMessageDialog* message_dialog = NULL;
				GThemedIcon* _tmp6_;
				GtkRoot* _tmp7_;
				GtkWindow* _tmp8_;
				GraniteMessageDialog* _tmp9_ = NULL;
				GraniteMessageDialog* _tmp10_;
				GError* _tmp11_;
				const gchar* _tmp12_;
				GraniteMessageDialog* _tmp13_;
				GraniteMessageDialog* _tmp14_;
				GraniteMessageDialog* _tmp15_;
				_tmp6_ = (GThemedIcon*) g_themed_icon_new ("dialog-error");
				_tmp7_ = gtk_widget_get_root ((GtkWidget*) self);
				_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, gtk_window_get_type (), GtkWindow));
				_tmp9_ = granite_message_dialog_new_with_image_from_icon_name (_ ("Unable to acquire permission"), _ ("An account cannot be removed without the required system permission."), "dialog-password", GTK_BUTTONS_CLOSE);
				granite_message_dialog_set_badge_icon (_tmp9_, (GIcon*) _tmp6_);
				_g_object_unref0 (_tmp6_);
				gtk_window_set_transient_for ((GtkWindow*) _tmp9_, _tmp8_);
				_g_object_unref0 (_tmp8_);
				g_object_ref_sink (_tmp9_);
				message_dialog = _tmp9_;
				_tmp10_ = message_dialog;
				_tmp11_ = e;
				_tmp12_ = _tmp11_->message;
				granite_message_dialog_show_error_details (_tmp10_, _tmp12_);
				_tmp13_ = message_dialog;
				_tmp14_ = message_dialog;
				g_signal_connect_object ((GtkDialog*) _tmp13_, "response", (GCallback) _gtk_window_destroy_gtk_dialog_response, (GtkWindow*) _tmp14_, 0);
				_tmp15_ = message_dialog;
				gtk_window_present ((GtkWindow*) _tmp15_);
				_g_object_unref0 (message_dialog);
			}
			_g_error_free0 (e);
			_g_object_unref0 (permission);
			return;
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (permission);
			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;
		}
	}
	_tmp16_ = self->priv->listbox;
	_tmp17_ = gtk_list_box_get_selected_row (_tmp16_);
	_tmp18_ = switchboard_plug_user_accounts_widgets_user_item_get_user (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_TYPE_USER_ITEM, SwitchboardPlugUserAccountsWidgetsUserItem));
	_tmp19_ = _tmp18_;
	_tmp20_ = _g_object_ref0 (_tmp19_);
	selected_user = _tmp20_;
	_tmp21_ = selected_user;
	switchboard_plug_user_accounts_mark_removal (_tmp21_);
	_tmp22_ = self->priv->listbox;
	_tmp23_ = self->priv->listbox;
	_tmp24_ = gtk_list_box_get_selected_row (_tmp23_);
	gtk_list_box_remove (_tmp22_, (GtkWidget*) _tmp24_);
	_tmp25_ = self->priv->listbox;
	_tmp26_ = self->priv->listbox;
	_tmp27_ = gtk_list_box_get_row_at_index (_tmp26_, 0);
	gtk_list_box_select_row (_tmp25_, _tmp27_);
	_tmp28_ = self->priv->toast;
	_tmp29_ = selected_user;
	_tmp30_ = act_user_get_user_name (_tmp29_);
	_tmp31_ = g_strdup_printf (_ ("Removed “%s”"), _tmp30_);
	_tmp32_ = _tmp31_;
	granite_toast_set_title (_tmp28_, _tmp32_);
	_g_free0 (_tmp32_);
	_tmp33_ = self->priv->toast;
	granite_toast_send_notification (_tmp33_);
	_g_object_unref0 (selected_user);
	_g_object_unref0 (permission);
}

static void
_switchboard_plug_user_accounts_widgets_main_view_remove_user_switchboard_plug_user_accounts_widgets_user_settings_view_remove_user (SwitchboardPlugUserAccountsWidgetsUserSettingsView* _sender,
                                                                                                                                     gpointer self)
{
	switchboard_plug_user_accounts_widgets_main_view_remove_user ((SwitchboardPlugUserAccountsWidgetsMainView*) self);
}

static void
switchboard_plug_user_accounts_widgets_main_view_add_user_settings (SwitchboardPlugUserAccountsWidgetsMainView* self,
                                                                    ActUser* user)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	SwitchboardPlugUserAccountsWidgetsUserSettingsView* page = NULL;
	SwitchboardPlugUserAccountsWidgetsUserSettingsView* _tmp3_;
	GtkStack* _tmp4_;
	const gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (user != NULL);
	_tmp0_ = act_user_get_user_name (user);
	_tmp1_ = g_strdup_printf ("Adding UserSettingsView Widget for User '%s'", _tmp0_);
	_tmp2_ = _tmp1_;
	g_debug ("MainView.vala:253: %s", _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = switchboard_plug_user_accounts_widgets_user_settings_view_new (user);
	g_object_ref_sink (_tmp3_);
	page = _tmp3_;
	g_signal_connect_object (page, "remove-user", (GCallback) _switchboard_plug_user_accounts_widgets_main_view_remove_user_switchboard_plug_user_accounts_widgets_user_settings_view_remove_user, self, 0);
	_tmp4_ = self->priv->content;
	_tmp5_ = act_user_get_user_name (user);
	gtk_stack_add_named (_tmp4_, (GtkWidget*) page, _tmp5_);
	switchboard_plug_user_accounts_widgets_main_view_update_listbox (self);
	_g_object_unref0 (page);
}

static void
switchboard_plug_user_accounts_widgets_main_view_remove_user_settings (SwitchboardPlugUserAccountsWidgetsMainView* self,
                                                                       ActUser* user)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GtkStack* _tmp3_;
	GtkStack* _tmp4_;
	const gchar* _tmp5_;
	GtkWidget* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (user != NULL);
	_tmp0_ = act_user_get_user_name (user);
	_tmp1_ = g_strdup_printf ("Removing UserSettingsView Widget for User '%s'", _tmp0_);
	_tmp2_ = _tmp1_;
	g_debug ("MainView.vala:262: %s", _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = self->priv->content;
	_tmp4_ = self->priv->content;
	_tmp5_ = act_user_get_user_name (user);
	_tmp6_ = gtk_stack_get_child_by_name (_tmp4_, _tmp5_);
	gtk_stack_remove (_tmp3_, _tmp6_);
}

static void
switchboard_plug_user_accounts_widgets_main_view_listbox_selected (SwitchboardPlugUserAccountsWidgetsMainView* self,
                                                                   GtkListBoxRow* user_item)
{
	ActUser* user = NULL;
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	user = NULL;
	if (user_item != NULL) {
		const gchar* _tmp1_;
		const gchar* _tmp2_;
		_tmp1_ = gtk_widget_get_name ((GtkWidget*) user_item);
		_tmp2_ = _tmp1_;
		_tmp0_ = g_strcmp0 (_tmp2_, "guest_session") != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ActUser* _tmp3_;
		ActUser* _tmp4_;
		ActUser* _tmp5_;
		gchar* username = NULL;
		ActUser* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		GtkStack* _tmp9_;
		const gchar* _tmp10_;
		_tmp3_ = switchboard_plug_user_accounts_widgets_user_item_get_user (G_TYPE_CHECK_INSTANCE_CAST (user_item, SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_TYPE_USER_ITEM, SwitchboardPlugUserAccountsWidgetsUserItem));
		_tmp4_ = _tmp3_;
		_tmp5_ = _g_object_ref0 (_tmp4_);
		_g_object_unref0 (user);
		user = _tmp5_;
		_tmp6_ = user;
		_tmp7_ = act_user_get_user_name (_tmp6_);
		_tmp8_ = g_strdup (_tmp7_);
		username = _tmp8_;
		_tmp9_ = self->priv->content;
		_tmp10_ = username;
		gtk_stack_set_visible_child_name (_tmp9_, _tmp10_);
		_g_free0 (username);
	} else {
		gboolean _tmp11_ = FALSE;
		if (user_item != NULL) {
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			_tmp12_ = gtk_widget_get_name ((GtkWidget*) user_item);
			_tmp13_ = _tmp12_;
			_tmp11_ = g_strcmp0 (_tmp13_, "guest_session") == 0;
		} else {
			_tmp11_ = FALSE;
		}
		if (_tmp11_) {
			GtkStack* _tmp14_;
			_tmp14_ = self->priv->content;
			gtk_stack_set_visible_child_name (_tmp14_, "guest_session");
		}
	}
	_g_object_unref0 (user);
}

static void
switchboard_plug_user_accounts_widgets_main_view_update_listbox (SwitchboardPlugUserAccountsWidgetsMainView* self)
{
	GtkListBox* _tmp5_;
	ActUser* _tmp6_;
	SwitchboardPlugUserAccountsWidgetsUserItem* _tmp7_;
	SwitchboardPlugUserAccountsWidgetsUserItem* _tmp8_;
	gint pos = 0;
	ActUserManager* _tmp9_;
	GSList* _tmp10_;
	const gchar* _tmp20_;
	g_return_if_fail (self != NULL);
	while (TRUE) {
		GtkListBox* _tmp0_;
		GtkListBoxRow* _tmp1_;
		GtkListBox* _tmp2_;
		GtkListBox* _tmp3_;
		GtkListBoxRow* _tmp4_;
		_tmp0_ = self->priv->listbox;
		_tmp1_ = gtk_list_box_get_row_at_index (_tmp0_, 0);
		if (!(_tmp1_ != NULL)) {
			break;
		}
		_tmp2_ = self->priv->listbox;
		_tmp3_ = self->priv->listbox;
		_tmp4_ = gtk_list_box_get_row_at_index (_tmp3_, 0);
		gtk_list_box_remove (_tmp2_, (GtkWidget*) _tmp4_);
	}
	_tmp5_ = self->priv->listbox;
	_tmp6_ = switchboard_plug_user_accounts_get_current_user ();
	_tmp7_ = switchboard_plug_user_accounts_widgets_user_item_new (_tmp6_);
	g_object_ref_sink (_tmp7_);
	_tmp8_ = _tmp7_;
	gtk_list_box_insert (_tmp5_, (GtkWidget*) _tmp8_, 0);
	_g_object_unref0 (_tmp8_);
	pos = 1;
	_tmp9_ = switchboard_plug_user_accounts_get_usermanager ();
	_tmp10_ = act_user_manager_list_users (_tmp9_);
	{
		GSList* temp_user_collection = NULL;
		GSList* temp_user_it = NULL;
		temp_user_collection = _tmp10_;
		for (temp_user_it = temp_user_collection; temp_user_it != NULL; temp_user_it = temp_user_it->next) {
			ActUser* temp_user = NULL;
			temp_user = (ActUser*) temp_user_it->data;
			{
				gboolean _tmp11_ = FALSE;
				ActUser* _tmp12_;
				ActUser* _tmp13_;
				_tmp12_ = switchboard_plug_user_accounts_get_current_user ();
				_tmp13_ = temp_user;
				if (_tmp12_ != _tmp13_) {
					ActUser* _tmp14_;
					_tmp14_ = temp_user;
					_tmp11_ = !switchboard_plug_user_accounts_check_removal (_tmp14_);
				} else {
					_tmp11_ = FALSE;
				}
				if (_tmp11_) {
					GtkListBox* _tmp15_;
					ActUser* _tmp16_;
					SwitchboardPlugUserAccountsWidgetsUserItem* _tmp17_;
					SwitchboardPlugUserAccountsWidgetsUserItem* _tmp18_;
					gint _tmp19_;
					_tmp15_ = self->priv->listbox;
					_tmp16_ = temp_user;
					_tmp17_ = switchboard_plug_user_accounts_widgets_user_item_new (_tmp16_);
					g_object_ref_sink (_tmp17_);
					_tmp18_ = _tmp17_;
					gtk_list_box_insert (_tmp15_, (GtkWidget*) _tmp18_, pos);
					_g_object_unref0 (_tmp18_);
					_tmp19_ = pos;
					pos = _tmp19_ + 1;
				}
			}
		}
		(temp_user_collection == NULL) ? NULL : (temp_user_collection = (g_slist_free (temp_user_collection), NULL));
	}
	_tmp20_ = switchboard_plug_user_accounts_get_display_manager ();
	if (g_strcmp0 (_tmp20_, "lightdm") == 0) {
		GtkListBox* _tmp21_;
		GtkListBoxRow* _tmp22_;
		_tmp21_ = self->priv->listbox;
		_tmp22_ = self->priv->guest_session_row;
		gtk_list_box_insert (_tmp21_, (GtkWidget*) _tmp22_, pos);
	}
}

static void
switchboard_plug_user_accounts_widgets_main_view_update_headers (SwitchboardPlugUserAccountsWidgetsMainView* self,
                                                                 GtkListBoxRow* row,
                                                                 GtkListBoxRow* before)
{
	GtkListBox* _tmp0_;
	GtkListBoxRow* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row != NULL);
	_tmp0_ = self->priv->listbox;
	_tmp1_ = gtk_list_box_get_row_at_index (_tmp0_, 0);
	if (row == _tmp1_) {
		GraniteHeaderLabel* _tmp2_;
		_tmp2_ = self->priv->my_account_label;
		gtk_list_box_row_set_header (row, (GtkWidget*) _tmp2_);
	} else {
		GtkListBox* _tmp3_;
		GtkListBoxRow* _tmp4_;
		_tmp3_ = self->priv->listbox;
		_tmp4_ = gtk_list_box_get_row_at_index (_tmp3_, 1);
		if (row == _tmp4_) {
			GraniteHeaderLabel* _tmp5_;
			_tmp5_ = self->priv->other_accounts_label;
			gtk_list_box_row_set_header (row, (GtkWidget*) _tmp5_);
		}
	}
}

static void
switchboard_plug_user_accounts_widgets_main_view_update_guest (SwitchboardPlugUserAccountsWidgetsMainView* self)
{
	g_return_if_fail (self != NULL);
	if (switchboard_plug_user_accounts_get_guest_session_state ("show")) {
		GtkLabel* _tmp0_;
		_tmp0_ = self->priv->guest_description_label;
		gtk_label_set_label (_tmp0_, _ ("Enabled"));
	} else {
		GtkLabel* _tmp1_;
		_tmp1_ = self->priv->guest_description_label;
		gtk_label_set_label (_tmp1_, _ ("Disabled"));
	}
}

SwitchboardPlugUserAccountsWidgetsMainView*
switchboard_plug_user_accounts_widgets_main_view_construct (GType object_type)
{
	SwitchboardPlugUserAccountsWidgetsMainView * self = NULL;
	self = (SwitchboardPlugUserAccountsWidgetsMainView*) g_object_new (object_type, NULL);
	return self;
}

SwitchboardPlugUserAccountsWidgetsMainView*
switchboard_plug_user_accounts_widgets_main_view_new (void)
{
	return switchboard_plug_user_accounts_widgets_main_view_construct (SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_TYPE_MAIN_VIEW);
}

static SwitchboardPlugUserAccountsWidgetsMainViewSidebar*
switchboard_plug_user_accounts_widgets_main_view_sidebar_construct (GType object_type)
{
	SwitchboardPlugUserAccountsWidgetsMainViewSidebar * self = NULL;
	self = (SwitchboardPlugUserAccountsWidgetsMainViewSidebar*) g_object_new (object_type, NULL);
	return self;
}

static SwitchboardPlugUserAccountsWidgetsMainViewSidebar*
switchboard_plug_user_accounts_widgets_main_view_sidebar_new (void)
{
	return switchboard_plug_user_accounts_widgets_main_view_sidebar_construct (SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_TYPE_SIDEBAR);
}

static GObject *
switchboard_plug_user_accounts_widgets_main_view_sidebar_constructor (GType type,
                                                                      guint n_construct_properties,
                                                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SwitchboardPlugUserAccountsWidgetsMainViewSidebar * self;
	parent_class = G_OBJECT_CLASS (switchboard_plug_user_accounts_widgets_main_view_sidebar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_MAIN_VIEW_TYPE_SIDEBAR, SwitchboardPlugUserAccountsWidgetsMainViewSidebar);
	gtk_widget_add_css_class ((GtkWidget*) self, GRANITE_STYLE_CLASS_SIDEBAR);
	return obj;
}

static void
switchboard_plug_user_accounts_widgets_main_view_sidebar_base_init (SwitchboardPlugUserAccountsWidgetsMainViewSidebarClass * klass)
{
	gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "settingssidebar");
}

static void
switchboard_plug_user_accounts_widgets_main_view_sidebar_class_init (SwitchboardPlugUserAccountsWidgetsMainViewSidebarClass * klass,
                                                                     gpointer klass_data)
{
	switchboard_plug_user_accounts_widgets_main_view_sidebar_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = switchboard_plug_user_accounts_widgets_main_view_sidebar_constructor;
}

static void
switchboard_plug_user_accounts_widgets_main_view_sidebar_instance_init (SwitchboardPlugUserAccountsWidgetsMainViewSidebar * self,
                                                                        gpointer klass)
{
}

static GType
switchboard_plug_user_accounts_widgets_main_view_sidebar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SwitchboardPlugUserAccountsWidgetsMainViewSidebarClass), (GBaseInitFunc) switchboard_plug_user_accounts_widgets_main_view_sidebar_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) switchboard_plug_user_accounts_widgets_main_view_sidebar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SwitchboardPlugUserAccountsWidgetsMainViewSidebar), 0, (GInstanceInitFunc) switchboard_plug_user_accounts_widgets_main_view_sidebar_instance_init, NULL };
	GType switchboard_plug_user_accounts_widgets_main_view_sidebar_type_id;
	switchboard_plug_user_accounts_widgets_main_view_sidebar_type_id = g_type_register_static (gtk_box_get_type (), "SwitchboardPlugUserAccountsWidgetsMainViewSidebar", &g_define_type_info, 0);
	return switchboard_plug_user_accounts_widgets_main_view_sidebar_type_id;
}

static GType
switchboard_plug_user_accounts_widgets_main_view_sidebar_get_type (void)
{
	static volatile gsize switchboard_plug_user_accounts_widgets_main_view_sidebar_type_id__once = 0;
	if (g_once_init_enter (&switchboard_plug_user_accounts_widgets_main_view_sidebar_type_id__once)) {
		GType switchboard_plug_user_accounts_widgets_main_view_sidebar_type_id;
		switchboard_plug_user_accounts_widgets_main_view_sidebar_type_id = switchboard_plug_user_accounts_widgets_main_view_sidebar_get_type_once ();
		g_once_init_leave (&switchboard_plug_user_accounts_widgets_main_view_sidebar_type_id__once, switchboard_plug_user_accounts_widgets_main_view_sidebar_type_id);
	}
	return switchboard_plug_user_accounts_widgets_main_view_sidebar_type_id__once;
}

static void
_switchboard_plug_user_accounts_widgets_main_view_update_headers_gtk_list_box_update_header_func (GtkListBoxRow* row,
                                                                                                  GtkListBoxRow* before,
                                                                                                  gpointer self)
{
	switchboard_plug_user_accounts_widgets_main_view_update_headers ((SwitchboardPlugUserAccountsWidgetsMainView*) self, row, before);
}

static void
_switchboard_plug_user_accounts_widgets_main_view_update_g_object_notify (GObject* _sender,
                                                                          GParamSpec* pspec,
                                                                          gpointer self)
{
	switchboard_plug_user_accounts_widgets_main_view_update ((SwitchboardPlugUserAccountsWidgetsMainView*) self);
}

static void
_switchboard_plug_user_accounts_widgets_main_view___lambda24_ (SwitchboardPlugUserAccountsWidgetsMainView* self)
{
	PolkitPermission* permission = NULL;
	PolkitPermission* _tmp0_;
	PolkitPermission* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	SwitchboardPlugUserAccountsNewUserDialog* new_user = NULL;
	GtkRoot* _tmp16_;
	SwitchboardPlugUserAccountsNewUserDialog* _tmp17_;
	SwitchboardPlugUserAccountsNewUserDialog* _tmp18_;
	GError* _inner_error0_ = NULL;
	_tmp0_ = switchboard_plug_user_accounts_get_permission ();
	permission = _tmp0_;
	_tmp1_ = permission;
	_tmp2_ = g_permission_get_allowed ((GPermission*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (!_tmp3_) {
		{
			PolkitPermission* _tmp4_;
			_tmp4_ = permission;
			g_permission_acquire ((GPermission*) _tmp4_, NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GError* _tmp5_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp5_ = e;
			if (!g_error_matches (_tmp5_, g_io_error_quark (), G_IO_ERROR_CANCELLED)) {
				GraniteMessageDialog* message_dialog = NULL;
				GThemedIcon* _tmp6_;
				GtkRoot* _tmp7_;
				GtkWindow* _tmp8_;
				GraniteMessageDialog* _tmp9_ = NULL;
				GraniteMessageDialog* _tmp10_;
				GError* _tmp11_;
				const gchar* _tmp12_;
				GraniteMessageDialog* _tmp13_;
				GraniteMessageDialog* _tmp14_;
				GraniteMessageDialog* _tmp15_;
				_tmp6_ = (GThemedIcon*) g_themed_icon_new ("dialog-error");
				_tmp7_ = gtk_widget_get_root ((GtkWidget*) self);
				_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, gtk_window_get_type (), GtkWindow));
				_tmp9_ = granite_message_dialog_new_with_image_from_icon_name (_ ("Unable to acquire permission"), _ ("A new account cannot be created without the required system permission" \
"."), "dialog-password", GTK_BUTTONS_CLOSE);
				granite_message_dialog_set_badge_icon (_tmp9_, (GIcon*) _tmp6_);
				_g_object_unref0 (_tmp6_);
				gtk_window_set_modal ((GtkWindow*) _tmp9_, TRUE);
				gtk_window_set_transient_for ((GtkWindow*) _tmp9_, _tmp8_);
				_g_object_unref0 (_tmp8_);
				g_object_ref_sink (_tmp9_);
				message_dialog = _tmp9_;
				_tmp10_ = message_dialog;
				_tmp11_ = e;
				_tmp12_ = _tmp11_->message;
				granite_message_dialog_show_error_details (_tmp10_, _tmp12_);
				_tmp13_ = message_dialog;
				_tmp14_ = message_dialog;
				g_signal_connect_object ((GtkDialog*) _tmp13_, "response", (GCallback) _gtk_window_destroy_gtk_dialog_response, (GtkWindow*) _tmp14_, 0);
				_tmp15_ = message_dialog;
				gtk_window_present ((GtkWindow*) _tmp15_);
				_g_object_unref0 (message_dialog);
			}
			_g_error_free0 (e);
			_g_object_unref0 (permission);
			return;
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (permission);
			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;
		}
	}
	_tmp16_ = gtk_widget_get_root ((GtkWidget*) self);
	_tmp17_ = switchboard_plug_user_accounts_new_user_dialog_new (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, gtk_window_get_type (), GtkWindow));
	g_object_ref_sink (_tmp17_);
	new_user = _tmp17_;
	_tmp18_ = new_user;
	gtk_window_present ((GtkWindow*) _tmp18_);
	_g_object_unref0 (new_user);
	_g_object_unref0 (permission);
}

static void
__switchboard_plug_user_accounts_widgets_main_view___lambda24__gtk_button_clicked (GtkButton* _sender,
                                                                                   gpointer self)
{
	_switchboard_plug_user_accounts_widgets_main_view___lambda24_ ((SwitchboardPlugUserAccountsWidgetsMainView*) self);
}

static void
_switchboard_plug_user_accounts_widgets_main_view___lambda29_ (SwitchboardPlugUserAccountsWidgetsMainView* self)
{
	PolkitPermission* _tmp0_;
	PolkitPermission* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	_tmp0_ = switchboard_plug_user_accounts_get_permission ();
	_tmp1_ = _tmp0_;
	_tmp2_ = g_permission_get_allowed ((GPermission*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = !_tmp3_;
	_g_object_unref0 (_tmp1_);
	if (_tmp4_) {
		GraniteToast* _tmp5_;
		_tmp5_ = self->priv->toast;
		granite_toast_withdraw (_tmp5_);
	}
}

static void
__switchboard_plug_user_accounts_widgets_main_view___lambda29__g_object_notify (GObject* _sender,
                                                                                GParamSpec* pspec,
                                                                                gpointer self)
{
	_switchboard_plug_user_accounts_widgets_main_view___lambda29_ ((SwitchboardPlugUserAccountsWidgetsMainView*) self);
}

static void
_switchboard_plug_user_accounts_widgets_main_view___lambda30_ (SwitchboardPlugUserAccountsWidgetsMainView* self)
{
	switchboard_plug_user_accounts_undo_removal ();
	switchboard_plug_user_accounts_widgets_main_view_update_listbox (self);
}

static void
__switchboard_plug_user_accounts_widgets_main_view___lambda30__granite_toast_default_action (GraniteToast* _sender,
                                                                                             gpointer self)
{
	_switchboard_plug_user_accounts_widgets_main_view___lambda30_ ((SwitchboardPlugUserAccountsWidgetsMainView*) self);
}

static void
_switchboard_plug_user_accounts_widgets_main_view_listbox_selected_gtk_list_box_row_selected (GtkListBox* _sender,
                                                                                              GtkListBoxRow* row,
                                                                                              gpointer self)
{
	switchboard_plug_user_accounts_widgets_main_view_listbox_selected ((SwitchboardPlugUserAccountsWidgetsMainView*) self, row);
}

static GObject *
switchboard_plug_user_accounts_widgets_main_view_constructor (GType type,
                                                              guint n_construct_properties,
                                                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SwitchboardPlugUserAccountsWidgetsMainView * self;
	AdwHeaderBar* headerbar = NULL;
	AdwHeaderBar* _tmp0_ = NULL;
	GtkListBox* _tmp1_ = NULL;
	GtkListBox* _tmp2_;
	GraniteHeaderLabel* _tmp3_;
	GraniteHeaderLabel* _tmp4_;
	GtkScrolledWindow* scrolled_window = NULL;
	GtkListBox* _tmp5_;
	GtkWidget* _tmp6_;
	GtkScrolledWindow* _tmp7_ = NULL;
	GtkLabel* add_button_label = NULL;
	GtkLabel* _tmp8_;
	GtkBox* add_button_box = NULL;
	GtkBox* _tmp9_;
	GtkBox* _tmp10_;
	GtkImage* _tmp11_;
	GtkImage* _tmp12_;
	GtkBox* _tmp13_;
	GtkLabel* _tmp14_;
	GtkButton* button_add = NULL;
	GtkBox* _tmp15_;
	GtkWidget* _tmp16_;
	GtkButton* _tmp17_ = NULL;
	GtkLabel* _tmp18_;
	GtkButton* _tmp19_;
	GtkActionBar* actionbar = NULL;
	GtkActionBar* _tmp20_;
	GtkActionBar* _tmp21_;
	GtkButton* _tmp22_;
	AdwToolbarView* toolbarview = NULL;
	GtkScrolledWindow* _tmp23_;
	GtkWidget* _tmp24_;
	AdwToolbarView* _tmp25_ = NULL;
	AdwToolbarView* _tmp26_;
	AdwHeaderBar* _tmp27_;
	AdwToolbarView* _tmp28_;
	GtkActionBar* _tmp29_;
	SwitchboardPlugUserAccountsWidgetsMainViewSidebar* sidebar = NULL;
	SwitchboardPlugUserAccountsWidgetsMainViewSidebar* _tmp30_;
	SwitchboardPlugUserAccountsWidgetsMainViewSidebar* _tmp31_;
	AdwToolbarView* _tmp32_;
	SwitchboardPlugUserAccountsWidgetsGuestSettingsView* _tmp33_;
	GtkStack* _tmp34_;
	GtkStack* _tmp35_;
	SwitchboardPlugUserAccountsWidgetsGuestSettingsView* _tmp36_;
	GraniteToast* _tmp37_;
	GraniteToast* _tmp38_;
	GtkOverlay* overlay = NULL;
	GtkStack* _tmp39_;
	GtkWidget* _tmp40_;
	GtkOverlay* _tmp41_ = NULL;
	GtkOverlay* _tmp42_;
	GraniteToast* _tmp43_;
	GtkPaned* paned = NULL;
	SwitchboardPlugUserAccountsWidgetsMainViewSidebar* _tmp44_;
	GtkWidget* _tmp45_;
	GtkOverlay* _tmp46_;
	GtkWidget* _tmp47_;
	GtkPaned* _tmp48_ = NULL;
	GtkPaned* _tmp49_;
	GSettingsSchema* sss = NULL;
	GSettingsSchemaSource* _tmp50_;
	GSettingsSchema* _tmp51_;
	gboolean _tmp52_ = FALSE;
	GSettingsSchema* _tmp53_;
	const gchar* _tmp58_;
	ActUserManager* _tmp91_;
	gboolean _tmp92_;
	gboolean _tmp93_;
	GtkButton* _tmp95_;
	PolkitPermission* _tmp96_;
	PolkitPermission* _tmp97_;
	GraniteToast* _tmp98_;
	GtkListBox* _tmp99_;
	parent_class = G_OBJECT_CLASS (switchboard_plug_user_accounts_widgets_main_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_TYPE_MAIN_VIEW, SwitchboardPlugUserAccountsWidgetsMainView);
	_tmp0_ = (AdwHeaderBar*) adw_header_bar_new ();
	adw_header_bar_set_show_end_title_buttons (_tmp0_, FALSE);
	adw_header_bar_set_show_title (_tmp0_, FALSE);
	g_object_ref_sink (_tmp0_);
	headerbar = _tmp0_;
	_tmp1_ = (GtkListBox*) gtk_list_box_new ();
	gtk_list_box_set_selection_mode (_tmp1_, GTK_SELECTION_SINGLE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp1_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp1_, TRUE);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->listbox);
	self->priv->listbox = _tmp1_;
	_tmp2_ = self->priv->listbox;
	gtk_list_box_set_header_func (_tmp2_, _switchboard_plug_user_accounts_widgets_main_view_update_headers_gtk_list_box_update_header_func, g_object_ref (self), g_object_unref);
	_tmp3_ = granite_header_label_new (_ ("My Account"));
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->my_account_label);
	self->priv->my_account_label = _tmp3_;
	_tmp4_ = granite_header_label_new (_ ("Other Accounts"));
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->other_accounts_label);
	self->priv->other_accounts_label = _tmp4_;
	_tmp5_ = self->priv->listbox;
	_tmp6_ = _g_object_ref0 ((GtkWidget*) _tmp5_);
	_tmp7_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_scrolled_window_set_child (_tmp7_, _tmp6_);
	_g_object_unref0 (_tmp6_);
	g_object_set (_tmp7_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	g_object_ref_sink (_tmp7_);
	scrolled_window = _tmp7_;
	_tmp8_ = (GtkLabel*) gtk_label_new (_ ("Create User Account…"));
	g_object_ref_sink (_tmp8_);
	add_button_label = _tmp8_;
	_tmp9_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp9_);
	add_button_box = _tmp9_;
	_tmp10_ = add_button_box;
	_tmp11_ = (GtkImage*) gtk_image_new_from_icon_name ("list-add-symbolic");
	g_object_ref_sink (_tmp11_);
	_tmp12_ = _tmp11_;
	gtk_box_append (_tmp10_, (GtkWidget*) _tmp12_);
	_g_object_unref0 (_tmp12_);
	_tmp13_ = add_button_box;
	_tmp14_ = add_button_label;
	gtk_box_append (_tmp13_, (GtkWidget*) _tmp14_);
	_tmp15_ = add_button_box;
	_tmp16_ = _g_object_ref0 ((GtkWidget*) _tmp15_);
	_tmp17_ = (GtkButton*) gtk_button_new ();
	gtk_button_set_child (_tmp17_, _tmp16_);
	_g_object_unref0 (_tmp16_);
	gtk_button_set_has_frame (_tmp17_, FALSE);
	g_object_ref_sink (_tmp17_);
	button_add = _tmp17_;
	_tmp18_ = add_button_label;
	_tmp19_ = button_add;
	gtk_label_set_mnemonic_widget (_tmp18_, (GtkWidget*) _tmp19_);
	_tmp20_ = (GtkActionBar*) gtk_action_bar_new ();
	g_object_ref_sink (_tmp20_);
	actionbar = _tmp20_;
	_tmp21_ = actionbar;
	_tmp22_ = button_add;
	gtk_action_bar_pack_start (_tmp21_, (GtkWidget*) _tmp22_);
	_tmp23_ = scrolled_window;
	_tmp24_ = _g_object_ref0 ((GtkWidget*) _tmp23_);
	_tmp25_ = (AdwToolbarView*) adw_toolbar_view_new ();
	adw_toolbar_view_set_content (_tmp25_, _tmp24_);
	_g_object_unref0 (_tmp24_);
	adw_toolbar_view_set_top_bar_style (_tmp25_, ADW_TOOLBAR_FLAT);
	adw_toolbar_view_set_bottom_bar_style (_tmp25_, ADW_TOOLBAR_RAISED);
	g_object_ref_sink (_tmp25_);
	toolbarview = _tmp25_;
	_tmp26_ = toolbarview;
	_tmp27_ = headerbar;
	adw_toolbar_view_add_top_bar (_tmp26_, (GtkWidget*) _tmp27_);
	_tmp28_ = toolbarview;
	_tmp29_ = actionbar;
	adw_toolbar_view_add_bottom_bar (_tmp28_, (GtkWidget*) _tmp29_);
	_tmp30_ = switchboard_plug_user_accounts_widgets_main_view_sidebar_new ();
	g_object_ref_sink (_tmp30_);
	sidebar = _tmp30_;
	_tmp31_ = sidebar;
	_tmp32_ = toolbarview;
	gtk_box_append ((GtkBox*) _tmp31_, (GtkWidget*) _tmp32_);
	_tmp33_ = switchboard_plug_user_accounts_widgets_guest_settings_view_new ();
	g_object_ref_sink (_tmp33_);
	_g_object_unref0 (self->priv->guest);
	self->priv->guest = _tmp33_;
	_tmp34_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp34_);
	_g_object_unref0 (self->priv->content);
	self->priv->content = _tmp34_;
	_tmp35_ = self->priv->content;
	_tmp36_ = self->priv->guest;
	gtk_stack_add_named (_tmp35_, (GtkWidget*) _tmp36_, "guest_session");
	_tmp37_ = granite_toast_new ("");
	g_object_ref_sink (_tmp37_);
	_g_object_unref0 (self->priv->toast);
	self->priv->toast = _tmp37_;
	_tmp38_ = self->priv->toast;
	granite_toast_set_default_action (_tmp38_, _ ("Undo"));
	_tmp39_ = self->priv->content;
	_tmp40_ = _g_object_ref0 ((GtkWidget*) _tmp39_);
	_tmp41_ = (GtkOverlay*) gtk_overlay_new ();
	gtk_overlay_set_child (_tmp41_, _tmp40_);
	_g_object_unref0 (_tmp40_);
	g_object_ref_sink (_tmp41_);
	overlay = _tmp41_;
	_tmp42_ = overlay;
	_tmp43_ = self->priv->toast;
	gtk_overlay_add_overlay (_tmp42_, (GtkWidget*) _tmp43_);
	_tmp44_ = sidebar;
	_tmp45_ = _g_object_ref0 ((GtkWidget*) _tmp44_);
	_tmp46_ = overlay;
	_tmp47_ = _g_object_ref0 ((GtkWidget*) _tmp46_);
	_tmp48_ = (GtkPaned*) gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
	gtk_paned_set_start_child (_tmp48_, _tmp45_);
	_g_object_unref0 (_tmp45_);
	gtk_paned_set_end_child (_tmp48_, _tmp47_);
	_g_object_unref0 (_tmp47_);
	gtk_paned_set_resize_start_child (_tmp48_, FALSE);
	gtk_paned_set_shrink_start_child (_tmp48_, FALSE);
	gtk_paned_set_shrink_end_child (_tmp48_, FALSE);
	g_object_ref_sink (_tmp48_);
	paned = _tmp48_;
	_tmp49_ = paned;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp49_);
	_tmp50_ = g_settings_schema_source_get_default ();
	_tmp51_ = g_settings_schema_source_lookup (_tmp50_, "io.elementary.settings", TRUE);
	sss = _tmp51_;
	_tmp53_ = sss;
	if (_tmp53_ != NULL) {
		GSettingsSchema* _tmp54_;
		_tmp54_ = sss;
		_tmp52_ = g_settings_schema_has_key (_tmp54_, "sidebar-position");
	} else {
		_tmp52_ = FALSE;
	}
	if (_tmp52_) {
		GSettings* settings = NULL;
		GSettings* _tmp55_;
		GSettings* _tmp56_;
		GtkPaned* _tmp57_;
		_tmp55_ = g_settings_new ("io.elementary.settings");
		settings = _tmp55_;
		_tmp56_ = settings;
		_tmp57_ = paned;
		g_settings_bind (_tmp56_, "sidebar-position", (GObject*) _tmp57_, "position", G_SETTINGS_BIND_DEFAULT);
		_g_object_unref0 (settings);
	}
	_tmp58_ = switchboard_plug_user_accounts_get_display_manager ();
	if (g_strcmp0 (_tmp58_, "lightdm") == 0) {
		AdwAvatar* avatar = NULL;
		AdwAvatar* _tmp59_ = NULL;
		GtkWidget* avatar_context = NULL;
		AdwAvatar* _tmp60_;
		GtkWidget* _tmp61_;
		GtkWidget* _tmp62_;
		GtkWidget* _tmp63_;
		GtkWidget* _tmp64_;
		GtkWidget* _tmp65_;
		GtkWidget* _tmp66_;
		GtkWidget* _tmp67_;
		GtkWidget* _tmp68_;
		GtkWidget* _tmp69_;
		GtkWidget* _tmp70_;
		GtkWidget* _tmp71_;
		GtkWidget* _tmp72_;
		GtkWidget* _tmp73_;
		GtkWidget* _tmp74_;
		GtkWidget* _tmp75_;
		GtkLabel* full_name_label = NULL;
		GtkLabel* _tmp76_ = NULL;
		GtkLabel* _tmp77_;
		GtkLabel* _tmp78_ = NULL;
		GtkLabel* _tmp79_;
		GtkGrid* row_grid = NULL;
		GtkGrid* _tmp80_ = NULL;
		GtkGrid* _tmp81_;
		AdwAvatar* _tmp82_;
		GtkGrid* _tmp83_;
		GtkLabel* _tmp84_;
		GtkGrid* _tmp85_;
		GtkLabel* _tmp86_;
		GtkGrid* _tmp87_;
		GtkWidget* _tmp88_;
		gchar* _tmp89_;
		GtkListBoxRow* _tmp90_ = NULL;
		_tmp59_ = (AdwAvatar*) adw_avatar_new (32, NULL, FALSE);
		gtk_widget_set_margin_start ((GtkWidget*) _tmp59_, 3);
		g_object_ref_sink (_tmp59_);
		avatar = _tmp59_;
		_tmp60_ = avatar;
		_tmp61_ = gtk_widget_get_first_child ((GtkWidget*) _tmp60_);
		avatar_context = _tmp61_;
		_tmp62_ = avatar_context;
		gtk_widget_remove_css_class (_tmp62_, "color1");
		_tmp63_ = avatar_context;
		gtk_widget_remove_css_class (_tmp63_, "color2");
		_tmp64_ = avatar_context;
		gtk_widget_remove_css_class (_tmp64_, "color3");
		_tmp65_ = avatar_context;
		gtk_widget_remove_css_class (_tmp65_, "color4");
		_tmp66_ = avatar_context;
		gtk_widget_remove_css_class (_tmp66_, "color5");
		_tmp67_ = avatar_context;
		gtk_widget_remove_css_class (_tmp67_, "color6");
		_tmp68_ = avatar_context;
		gtk_widget_remove_css_class (_tmp68_, "color7");
		_tmp69_ = avatar_context;
		gtk_widget_remove_css_class (_tmp69_, "color8");
		_tmp70_ = avatar_context;
		gtk_widget_remove_css_class (_tmp70_, "color9");
		_tmp71_ = avatar_context;
		gtk_widget_remove_css_class (_tmp71_, "color10");
		_tmp72_ = avatar_context;
		gtk_widget_remove_css_class (_tmp72_, "color11");
		_tmp73_ = avatar_context;
		gtk_widget_remove_css_class (_tmp73_, "color12");
		_tmp74_ = avatar_context;
		gtk_widget_remove_css_class (_tmp74_, "color13");
		_tmp75_ = avatar_context;
		gtk_widget_remove_css_class (_tmp75_, "color14");
		_tmp76_ = (GtkLabel*) gtk_label_new (_ ("Guest Session"));
		gtk_widget_set_halign ((GtkWidget*) _tmp76_, GTK_ALIGN_START);
		g_object_ref_sink (_tmp76_);
		full_name_label = _tmp76_;
		_tmp77_ = full_name_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp77_, GRANITE_STYLE_CLASS_H3_LABEL);
		_tmp78_ = (GtkLabel*) gtk_label_new (NULL);
		gtk_widget_set_halign ((GtkWidget*) _tmp78_, GTK_ALIGN_START);
		g_object_ref_sink (_tmp78_);
		_g_object_unref0 (self->priv->guest_description_label);
		self->priv->guest_description_label = _tmp78_;
		_tmp79_ = self->priv->guest_description_label;
		gtk_widget_add_css_class ((GtkWidget*) _tmp79_, GRANITE_STYLE_CLASS_SMALL_LABEL);
		_tmp80_ = (GtkGrid*) gtk_grid_new ();
		gtk_grid_set_column_spacing (_tmp80_, 9);
		g_object_ref_sink (_tmp80_);
		row_grid = _tmp80_;
		_tmp81_ = row_grid;
		_tmp82_ = avatar;
		gtk_grid_attach (_tmp81_, (GtkWidget*) _tmp82_, 0, 0, 1, 2);
		_tmp83_ = row_grid;
		_tmp84_ = full_name_label;
		gtk_grid_attach (_tmp83_, (GtkWidget*) _tmp84_, 1, 0, 1, 1);
		_tmp85_ = row_grid;
		_tmp86_ = self->priv->guest_description_label;
		gtk_grid_attach (_tmp85_, (GtkWidget*) _tmp86_, 1, 1, 1, 1);
		_tmp87_ = row_grid;
		_tmp88_ = _g_object_ref0 ((GtkWidget*) _tmp87_);
		_tmp89_ = g_strdup ("guest_session");
		_tmp90_ = (GtkListBoxRow*) gtk_list_box_row_new ();
		gtk_list_box_row_set_child (_tmp90_, _tmp88_);
		_g_object_unref0 (_tmp88_);
		gtk_widget_set_name ((GtkWidget*) _tmp90_, _tmp89_);
		_g_free0 (_tmp89_);
		g_object_ref_sink (_tmp90_);
		_g_object_unref0 (self->priv->guest_session_row);
		self->priv->guest_session_row = _tmp90_;
		switchboard_plug_user_accounts_widgets_main_view_update_guest (self);
		_g_object_unref0 (row_grid);
		_g_object_unref0 (full_name_label);
		_g_object_unref0 (avatar);
	} else {
		g_debug ("MainView.vala:141: Unsupported display manager found. Guest session se" \
"ttings will be hidden");
	}
	_tmp91_ = switchboard_plug_user_accounts_get_usermanager ();
	g_object_get (_tmp91_, "is-loaded", &_tmp92_, NULL);
	_tmp93_ = _tmp92_;
	if (_tmp93_) {
		switchboard_plug_user_accounts_widgets_main_view_update (self);
	} else {
		ActUserManager* _tmp94_;
		_tmp94_ = switchboard_plug_user_accounts_get_usermanager ();
		g_signal_connect_object ((GObject*) _tmp94_, "notify::is-loaded", (GCallback) _switchboard_plug_user_accounts_widgets_main_view_update_g_object_notify, self, 0);
	}
	_tmp95_ = button_add;
	g_signal_connect_object (_tmp95_, "clicked", (GCallback) __switchboard_plug_user_accounts_widgets_main_view___lambda24__gtk_button_clicked, self, 0);
	_tmp96_ = switchboard_plug_user_accounts_get_permission ();
	_tmp97_ = _tmp96_;
	g_signal_connect_object ((GObject*) _tmp97_, "notify::allowed", (GCallback) __switchboard_plug_user_accounts_widgets_main_view___lambda29__g_object_notify, self, 0);
	_g_object_unref0 (_tmp97_);
	_tmp98_ = self->priv->toast;
	g_signal_connect_object (_tmp98_, "default-action", (GCallback) __switchboard_plug_user_accounts_widgets_main_view___lambda30__granite_toast_default_action, self, 0);
	_tmp99_ = self->priv->listbox;
	g_signal_connect_object (_tmp99_, "row-selected", (GCallback) _switchboard_plug_user_accounts_widgets_main_view_listbox_selected_gtk_list_box_row_selected, self, 0);
	_g_settings_schema_unref0 (sss);
	_g_object_unref0 (paned);
	_g_object_unref0 (overlay);
	_g_object_unref0 (sidebar);
	_g_object_unref0 (toolbarview);
	_g_object_unref0 (actionbar);
	_g_object_unref0 (button_add);
	_g_object_unref0 (add_button_box);
	_g_object_unref0 (add_button_label);
	_g_object_unref0 (scrolled_window);
	_g_object_unref0 (headerbar);
	return obj;
}

static void
switchboard_plug_user_accounts_widgets_main_view_class_init (SwitchboardPlugUserAccountsWidgetsMainViewClass * klass,
                                                             gpointer klass_data)
{
	switchboard_plug_user_accounts_widgets_main_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SwitchboardPlugUserAccountsWidgetsMainView_private_offset);
	G_OBJECT_CLASS (klass)->constructor = switchboard_plug_user_accounts_widgets_main_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = switchboard_plug_user_accounts_widgets_main_view_finalize;
}

static void
switchboard_plug_user_accounts_widgets_main_view_instance_init (SwitchboardPlugUserAccountsWidgetsMainView * self,
                                                                gpointer klass)
{
	self->priv = switchboard_plug_user_accounts_widgets_main_view_get_instance_private (self);
}

static void
switchboard_plug_user_accounts_widgets_main_view_finalize (GObject * obj)
{
	SwitchboardPlugUserAccountsWidgetsMainView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWITCHBOARD_PLUG_USER_ACCOUNTS_WIDGETS_TYPE_MAIN_VIEW, SwitchboardPlugUserAccountsWidgetsMainView);
	_g_object_unref0 (self->priv->listbox);
	_g_object_unref0 (self->priv->toast);
	_g_object_unref0 (self->priv->content);
	_g_object_unref0 (self->priv->guest);
	_g_object_unref0 (self->priv->my_account_label);
	_g_object_unref0 (self->priv->other_accounts_label);
	_g_object_unref0 (self->priv->guest_session_row);
	_g_object_unref0 (self->priv->guest_description_label);
	G_OBJECT_CLASS (switchboard_plug_user_accounts_widgets_main_view_parent_class)->finalize (obj);
}

static GType
switchboard_plug_user_accounts_widgets_main_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SwitchboardPlugUserAccountsWidgetsMainViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) switchboard_plug_user_accounts_widgets_main_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SwitchboardPlugUserAccountsWidgetsMainView), 0, (GInstanceInitFunc) switchboard_plug_user_accounts_widgets_main_view_instance_init, NULL };
	GType switchboard_plug_user_accounts_widgets_main_view_type_id;
	switchboard_plug_user_accounts_widgets_main_view_type_id = g_type_register_static (gtk_box_get_type (), "SwitchboardPlugUserAccountsWidgetsMainView", &g_define_type_info, 0);
	SwitchboardPlugUserAccountsWidgetsMainView_private_offset = g_type_add_instance_private (switchboard_plug_user_accounts_widgets_main_view_type_id, sizeof (SwitchboardPlugUserAccountsWidgetsMainViewPrivate));
	return switchboard_plug_user_accounts_widgets_main_view_type_id;
}

GType
switchboard_plug_user_accounts_widgets_main_view_get_type (void)
{
	static volatile gsize switchboard_plug_user_accounts_widgets_main_view_type_id__once = 0;
	if (g_once_init_enter (&switchboard_plug_user_accounts_widgets_main_view_type_id__once)) {
		GType switchboard_plug_user_accounts_widgets_main_view_type_id;
		switchboard_plug_user_accounts_widgets_main_view_type_id = switchboard_plug_user_accounts_widgets_main_view_get_type_once ();
		g_once_init_leave (&switchboard_plug_user_accounts_widgets_main_view_type_id__once, switchboard_plug_user_accounts_widgets_main_view_type_id);
	}
	return switchboard_plug_user_accounts_widgets_main_view_type_id__once;
}

