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

/*
 * Copyright 2018–2021 elementary, Inc. (https://elementary.io)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA.
 */

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

#define GREETER_BASE_CARD_ERROR_SHAKE_DURATION 450
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define GREETER_TYPE_BASE_CARD (greeter_base_card_get_type ())
#define GREETER_BASE_CARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GREETER_TYPE_BASE_CARD, GreeterBaseCard))
#define GREETER_BASE_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GREETER_TYPE_BASE_CARD, GreeterBaseCardClass))
#define GREETER_IS_BASE_CARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_TYPE_BASE_CARD))
#define GREETER_IS_BASE_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GREETER_TYPE_BASE_CARD))
#define GREETER_BASE_CARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GREETER_TYPE_BASE_CARD, GreeterBaseCardClass))

typedef struct _GreeterBaseCard GreeterBaseCard;
typedef struct _GreeterBaseCardClass GreeterBaseCardClass;
typedef struct _GreeterBaseCardPrivate GreeterBaseCardPrivate;

#define GREETER_TYPE_MANUAL_CARD (greeter_manual_card_get_type ())
#define GREETER_MANUAL_CARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GREETER_TYPE_MANUAL_CARD, GreeterManualCard))
#define GREETER_MANUAL_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GREETER_TYPE_MANUAL_CARD, GreeterManualCardClass))
#define GREETER_IS_MANUAL_CARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_TYPE_MANUAL_CARD))
#define GREETER_IS_MANUAL_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GREETER_TYPE_MANUAL_CARD))
#define GREETER_MANUAL_CARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GREETER_TYPE_MANUAL_CARD, GreeterManualCardClass))

typedef struct _GreeterManualCard GreeterManualCard;
typedef struct _GreeterManualCardClass GreeterManualCardClass;
typedef struct _GreeterManualCardPrivate GreeterManualCardPrivate;

#define GREETER_TYPE_PASSWORD_ENTRY (greeter_password_entry_get_type ())
#define GREETER_PASSWORD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GREETER_TYPE_PASSWORD_ENTRY, GreeterPasswordEntry))
#define GREETER_PASSWORD_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GREETER_TYPE_PASSWORD_ENTRY, GreeterPasswordEntryClass))
#define GREETER_IS_PASSWORD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_TYPE_PASSWORD_ENTRY))
#define GREETER_IS_PASSWORD_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GREETER_TYPE_PASSWORD_ENTRY))
#define GREETER_PASSWORD_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GREETER_TYPE_PASSWORD_ENTRY, GreeterPasswordEntryClass))

typedef struct _GreeterPasswordEntry GreeterPasswordEntry;
typedef struct _GreeterPasswordEntryClass GreeterPasswordEntryClass;
enum  {
	GREETER_MANUAL_CARD_0_PROPERTY,
	GREETER_MANUAL_CARD_NUM_PROPERTIES
};
static GParamSpec* greeter_manual_card_properties[GREETER_MANUAL_CARD_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block5Data Block5Data;
typedef struct _Block6Data Block6Data;
#define _g_free0(var) (var = (g_free (var), NULL))

#define GREETER_TYPE_CAPS_LOCK_REVEALER (greeter_caps_lock_revealer_get_type ())
#define GREETER_CAPS_LOCK_REVEALER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GREETER_TYPE_CAPS_LOCK_REVEALER, GreeterCapsLockRevealer))
#define GREETER_CAPS_LOCK_REVEALER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GREETER_TYPE_CAPS_LOCK_REVEALER, GreeterCapsLockRevealerClass))
#define GREETER_IS_CAPS_LOCK_REVEALER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_TYPE_CAPS_LOCK_REVEALER))
#define GREETER_IS_CAPS_LOCK_REVEALER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GREETER_TYPE_CAPS_LOCK_REVEALER))
#define GREETER_CAPS_LOCK_REVEALER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GREETER_TYPE_CAPS_LOCK_REVEALER, GreeterCapsLockRevealerClass))

typedef struct _GreeterCapsLockRevealer GreeterCapsLockRevealer;
typedef struct _GreeterCapsLockRevealerClass GreeterCapsLockRevealerClass;

#define GREETER_TYPE_SESSION_BUTTON (greeter_session_button_get_type ())
#define GREETER_SESSION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GREETER_TYPE_SESSION_BUTTON, GreeterSessionButton))
#define GREETER_SESSION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GREETER_TYPE_SESSION_BUTTON, GreeterSessionButtonClass))
#define GREETER_IS_SESSION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_TYPE_SESSION_BUTTON))
#define GREETER_IS_SESSION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GREETER_TYPE_SESSION_BUTTON))
#define GREETER_SESSION_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GREETER_TYPE_SESSION_BUTTON, GreeterSessionButtonClass))

typedef struct _GreeterSessionButton GreeterSessionButton;
typedef struct _GreeterSessionButtonClass GreeterSessionButtonClass;
enum  {
	GREETER_MANUAL_CARD_DO_CONNECT_USERNAME_SIGNAL,
	GREETER_MANUAL_CARD_NUM_SIGNALS
};
static guint greeter_manual_card_signals[GREETER_MANUAL_CARD_NUM_SIGNALS] = {0};

struct _GreeterBaseCard {
	GtkRevealer parent_instance;
	GreeterBaseCardPrivate * priv;
};

struct _GreeterBaseCardClass {
	GtkRevealerClass parent_class;
	void (*wrong_credentials) (GreeterBaseCard* self);
};

struct _GreeterManualCard {
	GreeterBaseCard parent_instance;
	GreeterManualCardPrivate * priv;
};

struct _GreeterManualCardClass {
	GreeterBaseCardClass parent_class;
};

struct _GreeterManualCardPrivate {
	GreeterPasswordEntry* password_entry;
	GtkEntry* username_entry;
	GtkGrid* main_grid;
};

struct _Block5Data {
	int _ref_count_;
	GreeterManualCard* self;
	GtkStyleContext* username_entry_style_context;
	GtkStyleContext* password_entry_style_context;
	GtkStyleContext* grid_style_context;
};

struct _Block6Data {
	int _ref_count_;
	GreeterManualCard* self;
	GtkStyleContext* entry_style_context;
	GtkStyleContext* grid_style_context;
};

static gint GreeterManualCard_private_offset;
static gpointer greeter_manual_card_parent_class = NULL;
VALA_EXTERN GtkCssProvider* greeter_base_card_css_provider;

VALA_EXTERN GType greeter_base_card_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterBaseCard, g_object_unref)
VALA_EXTERN GType greeter_manual_card_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterManualCard, g_object_unref)
VALA_EXTERN GType greeter_password_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterPasswordEntry, g_object_unref)
VALA_EXTERN void greeter_base_card_wrong_credentials (GreeterBaseCard* self);
static void greeter_manual_card_on_login (GreeterManualCard* self);
VALA_EXTERN void greeter_base_card_set_connecting (GreeterBaseCard* self,
                                       gboolean value);
static void greeter_manual_card_focus_username_entry (GreeterManualCard* self);
static void greeter_manual_card_focus_password_entry (GreeterManualCard* self);
static void greeter_manual_card_real_wrong_credentials (GreeterBaseCard* base);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
static gboolean __lambda26_ (Block5Data* _data5_);
static gboolean ___lambda26__gsource_func (gpointer self);
VALA_EXTERN void greeter_manual_card_ask_password (GreeterManualCard* self);
VALA_EXTERN void greeter_manual_card_wrong_username (GreeterManualCard* self);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static gboolean __lambda27_ (Block6Data* _data6_);
static gboolean ___lambda27__gsource_func (gpointer self);
VALA_EXTERN GreeterManualCard* greeter_manual_card_new (void);
VALA_EXTERN GreeterManualCard* greeter_manual_card_construct (GType object_type);
VALA_EXTERN GreeterBaseCard* greeter_base_card_construct (GType object_type);
static GObject * greeter_manual_card_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties);
VALA_EXTERN GreeterPasswordEntry* greeter_password_entry_new (void);
VALA_EXTERN GreeterPasswordEntry* greeter_password_entry_construct (GType object_type);
VALA_EXTERN GType greeter_caps_lock_revealer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterCapsLockRevealer, g_object_unref)
VALA_EXTERN GreeterCapsLockRevealer* greeter_caps_lock_revealer_new (void);
VALA_EXTERN GreeterCapsLockRevealer* greeter_caps_lock_revealer_construct (GType object_type);
VALA_EXTERN GType greeter_session_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterSessionButton, g_object_unref)
VALA_EXTERN GreeterSessionButton* greeter_session_button_new (void);
VALA_EXTERN GreeterSessionButton* greeter_session_button_construct (GType object_type);
static void _greeter_manual_card___lambda28_ (GreeterManualCard* self);
static void __greeter_manual_card___lambda28__gtk_entry_activate (GtkEntry* _sender,
                                                           gpointer self);
static void _greeter_manual_card_on_login_gtk_entry_activate (GtkEntry* _sender,
                                                       gpointer self);
static void _greeter_manual_card___lambda29_ (GreeterManualCard* self);
static void __greeter_manual_card___lambda29__gtk_widget_grab_focus (GtkWidget* _sender,
                                                              gpointer self);
static void greeter_manual_card_finalize (GObject * obj);
static GType greeter_manual_card_get_type_once (void);

static inline gpointer
greeter_manual_card_get_instance_private (GreeterManualCard* self)
{
	return G_STRUCT_MEMBER_P (self, GreeterManualCard_private_offset);
}

static void
greeter_manual_card_on_login (GreeterManualCard* self)
{
	GreeterPasswordEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GreeterPasswordEntry* _tmp3_;
	g_return_if_fail (self != NULL);
	greeter_base_card_set_connecting ((GreeterBaseCard*) self, TRUE);
	_tmp0_ = self->priv->password_entry;
	_tmp1_ = gtk_entry_get_text ((GtkEntry*) _tmp0_);
	_tmp2_ = _tmp1_;
	g_signal_emit_by_name ((GreeterBaseCard*) self, "do-connect", _tmp2_);
	_tmp3_ = self->priv->password_entry;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, FALSE);
}

static void
greeter_manual_card_focus_username_entry (GreeterManualCard* self)
{
	GreeterPasswordEntry* _tmp0_;
	GreeterPasswordEntry* _tmp1_;
	GtkEntry* _tmp2_;
	GtkEntry* _tmp3_;
	GtkEntry* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->password_entry;
	g_object_set ((GtkEntry*) _tmp0_, "secondary-icon-name", "", NULL);
	_tmp1_ = self->priv->password_entry;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp1_, FALSE);
	_tmp2_ = self->priv->username_entry;
	g_object_set (_tmp2_, "secondary-icon-name", "go-jump-symbolic", NULL);
	_tmp3_ = self->priv->username_entry;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, TRUE);
	_tmp4_ = self->priv->username_entry;
	gtk_entry_grab_focus_without_selecting (_tmp4_);
}

static void
greeter_manual_card_focus_password_entry (GreeterManualCard* self)
{
	GtkEntry* _tmp0_;
	GtkEntry* _tmp1_;
	GreeterPasswordEntry* _tmp2_;
	GreeterPasswordEntry* _tmp3_;
	GreeterPasswordEntry* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->username_entry;
	g_object_set (_tmp0_, "secondary-icon-name", "", NULL);
	_tmp1_ = self->priv->username_entry;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp1_, FALSE);
	_tmp2_ = self->priv->password_entry;
	g_object_set ((GtkEntry*) _tmp2_, "secondary-icon-name", "go-jump-symbolic", NULL);
	_tmp3_ = self->priv->password_entry;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, TRUE);
	_tmp4_ = self->priv->password_entry;
	gtk_entry_grab_focus_without_selecting ((GtkEntry*) _tmp4_);
}

static Block5Data*
block5_data_ref (Block5Data* _data5_)
{
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		GreeterManualCard* self;
		self = _data5_->self;
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}

static gboolean
__lambda26_ (Block5Data* _data5_)
{
	GreeterManualCard* self;
	gboolean result;
	self = _data5_->self;
	gtk_style_context_remove_class (_data5_->grid_style_context, "shake");
	gtk_style_context_remove_class (_data5_->username_entry_style_context, GTK_STYLE_CLASS_ERROR);
	gtk_style_context_remove_class (_data5_->password_entry_style_context, GTK_STYLE_CLASS_ERROR);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda26__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda26_ (self);
	return result;
}

static void
greeter_manual_card_real_wrong_credentials (GreeterBaseCard* base)
{
	GreeterManualCard * self;
	Block5Data* _data5_;
	GreeterPasswordEntry* _tmp0_;
	GtkEntry* _tmp1_;
	GtkStyleContext* _tmp2_;
	GreeterPasswordEntry* _tmp3_;
	GtkStyleContext* _tmp4_;
	GtkGrid* _tmp5_;
	GtkStyleContext* _tmp6_;
	self = (GreeterManualCard*) base;
	_data5_ = g_slice_new0 (Block5Data);
	_data5_->_ref_count_ = 1;
	_data5_->self = g_object_ref (self);
	greeter_manual_card_focus_username_entry (self);
	_tmp0_ = self->priv->password_entry;
	gtk_entry_set_text ((GtkEntry*) _tmp0_, "");
	_tmp1_ = self->priv->username_entry;
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) _tmp1_);
	_data5_->username_entry_style_context = _tmp2_;
	gtk_style_context_add_class (_data5_->username_entry_style_context, GTK_STYLE_CLASS_ERROR);
	_tmp3_ = self->priv->password_entry;
	_tmp4_ = gtk_widget_get_style_context ((GtkWidget*) _tmp3_);
	_data5_->password_entry_style_context = _tmp4_;
	gtk_style_context_add_class (_data5_->password_entry_style_context, GTK_STYLE_CLASS_ERROR);
	_tmp5_ = self->priv->main_grid;
	_tmp6_ = gtk_widget_get_style_context ((GtkWidget*) _tmp5_);
	_data5_->grid_style_context = _tmp6_;
	gtk_style_context_add_class (_data5_->grid_style_context, "shake");
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) GREETER_BASE_CARD_ERROR_SHAKE_DURATION, ___lambda26__gsource_func, block5_data_ref (_data5_), block5_data_unref);
	block5_data_unref (_data5_);
	_data5_ = NULL;
}

void
greeter_manual_card_ask_password (GreeterManualCard* self)
{
	g_return_if_fail (self != NULL);
	greeter_manual_card_focus_password_entry (self);
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		GreeterManualCard* self;
		self = _data6_->self;
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static gboolean
__lambda27_ (Block6Data* _data6_)
{
	GreeterManualCard* self;
	gboolean result;
	self = _data6_->self;
	gtk_style_context_remove_class (_data6_->grid_style_context, "shake");
	gtk_style_context_remove_class (_data6_->entry_style_context, GTK_STYLE_CLASS_ERROR);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda27__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda27_ (self);
	return result;
}

void
greeter_manual_card_wrong_username (GreeterManualCard* self)
{
	Block6Data* _data6_;
	GtkEntry* _tmp0_;
	GtkEntry* _tmp1_;
	GtkEntry* _tmp2_;
	GtkEntry* _tmp3_;
	GtkStyleContext* _tmp4_;
	GtkGrid* _tmp5_;
	GtkStyleContext* _tmp6_;
	g_return_if_fail (self != NULL);
	_data6_ = g_slice_new0 (Block6Data);
	_data6_->_ref_count_ = 1;
	_data6_->self = g_object_ref (self);
	_tmp0_ = self->priv->username_entry;
	gtk_entry_grab_focus_without_selecting (_tmp0_);
	_tmp1_ = self->priv->username_entry;
	g_object_set (_tmp1_, "secondary-icon-name", "", NULL);
	_tmp2_ = self->priv->username_entry;
	gtk_entry_set_text (_tmp2_, "");
	_tmp3_ = self->priv->username_entry;
	_tmp4_ = gtk_widget_get_style_context ((GtkWidget*) _tmp3_);
	_data6_->entry_style_context = _tmp4_;
	gtk_style_context_add_class (_data6_->entry_style_context, GTK_STYLE_CLASS_ERROR);
	_tmp5_ = self->priv->main_grid;
	_tmp6_ = gtk_widget_get_style_context ((GtkWidget*) _tmp5_);
	_data6_->grid_style_context = _tmp6_;
	gtk_style_context_add_class (_data6_->grid_style_context, "shake");
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) GREETER_BASE_CARD_ERROR_SHAKE_DURATION, ___lambda27__gsource_func, block6_data_ref (_data6_), block6_data_unref);
	block6_data_unref (_data6_);
	_data6_ = NULL;
}

GreeterManualCard*
greeter_manual_card_construct (GType object_type)
{
	GreeterManualCard * self = NULL;
	self = (GreeterManualCard*) greeter_base_card_construct (object_type);
	return self;
}

GreeterManualCard*
greeter_manual_card_new (void)
{
	return greeter_manual_card_construct (GREETER_TYPE_MANUAL_CARD);
}

static void
_greeter_manual_card___lambda28_ (GreeterManualCard* self)
{
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	_tmp0_ = self->priv->username_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = _tmp1_;
	g_signal_emit (self, greeter_manual_card_signals[GREETER_MANUAL_CARD_DO_CONNECT_USERNAME_SIGNAL], 0, _tmp2_);
}

static void
__greeter_manual_card___lambda28__gtk_entry_activate (GtkEntry* _sender,
                                                      gpointer self)
{
	_greeter_manual_card___lambda28_ ((GreeterManualCard*) self);
}

static void
_greeter_manual_card_on_login_gtk_entry_activate (GtkEntry* _sender,
                                                  gpointer self)
{
	greeter_manual_card_on_login ((GreeterManualCard*) self);
}

static void
_greeter_manual_card___lambda29_ (GreeterManualCard* self)
{
	GtkEntry* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	_tmp0_ = self->priv->username_entry;
	_tmp1_ = gtk_widget_get_sensitive ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkEntry* _tmp3_;
		_tmp3_ = self->priv->username_entry;
		gtk_entry_grab_focus_without_selecting (_tmp3_);
	} else {
		GreeterPasswordEntry* _tmp4_;
		_tmp4_ = self->priv->password_entry;
		gtk_entry_grab_focus_without_selecting ((GtkEntry*) _tmp4_);
	}
}

static void
__greeter_manual_card___lambda29__gtk_widget_grab_focus (GtkWidget* _sender,
                                                         gpointer self)
{
	_greeter_manual_card___lambda29_ ((GreeterManualCard*) self);
}

static GObject *
greeter_manual_card_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GreeterManualCard * self;
	GtkImage* icon = NULL;
	gchar* _tmp0_;
	GtkImage* _tmp1_ = NULL;
	GtkLabel* label = NULL;
	GtkLabel* _tmp2_ = NULL;
	GtkLabel* _tmp3_;
	GtkStyleContext* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GtkEntry* _tmp9_ = NULL;
	gchar* _tmp10_;
	GreeterPasswordEntry* _tmp11_ = NULL;
	GreeterCapsLockRevealer* caps_lock_revealer = NULL;
	GreeterCapsLockRevealer* _tmp12_;
	GtkGrid* password_grid = NULL;
	GtkGrid* _tmp13_ = NULL;
	GtkGrid* _tmp14_;
	GreeterPasswordEntry* _tmp15_;
	GtkGrid* _tmp16_;
	GreeterCapsLockRevealer* _tmp17_;
	GreeterSessionButton* session_button = NULL;
	GreeterSessionButton* _tmp18_;
	GtkGrid* form_grid = NULL;
	GtkGrid* _tmp19_ = NULL;
	GtkGrid* _tmp20_;
	GtkImage* _tmp21_;
	GtkGrid* _tmp22_;
	GtkLabel* _tmp23_;
	GtkGrid* _tmp24_;
	GtkEntry* _tmp25_;
	GtkGrid* _tmp26_;
	GtkGrid* _tmp27_;
	GtkGrid* _tmp28_;
	GreeterSessionButton* _tmp29_;
	GtkGrid* _tmp30_ = NULL;
	GtkGrid* _tmp31_;
	GtkGrid* _tmp32_;
	GtkStyleContext* main_grid_style_context = NULL;
	GtkGrid* _tmp33_;
	GtkStyleContext* _tmp34_;
	GtkStyleContext* _tmp35_;
	GtkStyleContext* _tmp36_;
	GtkStyleContext* _tmp37_;
	GtkCssProvider* _tmp38_;
	GtkGrid* _tmp39_;
	GtkEntry* _tmp40_;
	GreeterPasswordEntry* _tmp41_;
	GtkEntry* _tmp42_;
	GreeterPasswordEntry* _tmp43_;
	parent_class = G_OBJECT_CLASS (greeter_manual_card_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_TYPE_MANUAL_CARD, GreeterManualCard);
	g_object_set ((GtkWidget*) self, "width-request", 350, NULL);
	_tmp0_ = g_strdup ("avatar-default");
	_tmp1_ = (GtkImage*) gtk_image_new ();
	g_object_set (_tmp1_, "icon-name", _tmp0_, NULL);
	_g_free0 (_tmp0_);
	gtk_image_set_pixel_size (_tmp1_, 64);
	g_object_ref_sink (_tmp1_);
	icon = _tmp1_;
	_tmp2_ = (GtkLabel*) gtk_label_new (_ ("Manual Login"));
	gtk_widget_set_hexpand ((GtkWidget*) _tmp2_, TRUE);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp2_, 16);
	g_object_ref_sink (_tmp2_);
	label = _tmp2_;
	_tmp3_ = label;
	_tmp4_ = gtk_widget_get_style_context ((GtkWidget*) _tmp3_);
	gtk_style_context_add_class (_tmp4_, GRANITE_STYLE_CLASS_H2_LABEL);
	_tmp5_ = g_strdup (_ ("Username"));
	_tmp6_ = g_strdup ("avatar-default-symbolic");
	_tmp7_ = g_strdup ("go-jump-symbolic");
	_tmp8_ = g_strdup (_ ("Try username"));
	_tmp9_ = (GtkEntry*) gtk_entry_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp9_, TRUE);
	gtk_entry_set_input_purpose (_tmp9_, GTK_INPUT_PURPOSE_FREE_FORM);
	gtk_entry_set_placeholder_text (_tmp9_, _tmp5_);
	_g_free0 (_tmp5_);
	g_object_set (_tmp9_, "primary-icon-name", _tmp6_, NULL);
	_g_free0 (_tmp6_);
	g_object_set (_tmp9_, "secondary-icon-name", _tmp7_, NULL);
	_g_free0 (_tmp7_);
	g_object_set (_tmp9_, "secondary-icon-tooltip-text", _tmp8_, NULL);
	_g_free0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->username_entry);
	self->priv->username_entry = _tmp9_;
	_tmp10_ = g_strdup ("");
	_tmp11_ = greeter_password_entry_new ();
	g_object_set ((GtkEntry*) _tmp11_, "secondary-icon-name", _tmp10_, NULL);
	_g_free0 (_tmp10_);
	gtk_widget_set_sensitive ((GtkWidget*) _tmp11_, FALSE);
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->password_entry);
	self->priv->password_entry = _tmp11_;
	_tmp12_ = greeter_caps_lock_revealer_new ();
	g_object_ref_sink (_tmp12_);
	caps_lock_revealer = _tmp12_;
	_tmp13_ = (GtkGrid*) gtk_grid_new ();
	gtk_orientable_set_orientation ((GtkOrientable*) _tmp13_, GTK_ORIENTATION_VERTICAL);
	gtk_grid_set_row_spacing (_tmp13_, 6);
	g_object_ref_sink (_tmp13_);
	password_grid = _tmp13_;
	_tmp14_ = password_grid;
	_tmp15_ = self->priv->password_entry;
	gtk_container_add ((GtkContainer*) _tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = password_grid;
	_tmp17_ = caps_lock_revealer;
	gtk_container_add ((GtkContainer*) _tmp16_, (GtkWidget*) _tmp17_);
	_tmp18_ = greeter_session_button_new ();
	g_object_ref_sink (_tmp18_);
	session_button = _tmp18_;
	_tmp19_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp19_, 6);
	g_object_set ((GtkWidget*) _tmp19_, "margin", 24, NULL);
	gtk_grid_set_row_spacing (_tmp19_, 12);
	g_object_ref_sink (_tmp19_);
	form_grid = _tmp19_;
	_tmp20_ = form_grid;
	_tmp21_ = icon;
	gtk_grid_attach (_tmp20_, (GtkWidget*) _tmp21_, 0, 0, 2, 1);
	_tmp22_ = form_grid;
	_tmp23_ = label;
	gtk_grid_attach (_tmp22_, (GtkWidget*) _tmp23_, 0, 1, 2, 1);
	_tmp24_ = form_grid;
	_tmp25_ = self->priv->username_entry;
	gtk_grid_attach (_tmp24_, (GtkWidget*) _tmp25_, 0, 2, 1, 1);
	_tmp26_ = form_grid;
	_tmp27_ = password_grid;
	gtk_grid_attach (_tmp26_, (GtkWidget*) _tmp27_, 0, 3, 1, 1);
	_tmp28_ = form_grid;
	_tmp29_ = session_button;
	gtk_grid_attach (_tmp28_, (GtkWidget*) _tmp29_, 1, 2, 1, 2);
	_tmp30_ = (GtkGrid*) gtk_grid_new ();
	g_object_set ((GtkWidget*) _tmp30_, "margin", 12, NULL);
	g_object_ref_sink (_tmp30_);
	_g_object_unref0 (self->priv->main_grid);
	self->priv->main_grid = _tmp30_;
	_tmp31_ = self->priv->main_grid;
	_tmp32_ = form_grid;
	gtk_container_add ((GtkContainer*) _tmp31_, (GtkWidget*) _tmp32_);
	_tmp33_ = self->priv->main_grid;
	_tmp34_ = gtk_widget_get_style_context ((GtkWidget*) _tmp33_);
	main_grid_style_context = _tmp34_;
	_tmp35_ = main_grid_style_context;
	gtk_style_context_add_class (_tmp35_, GRANITE_STYLE_CLASS_CARD);
	_tmp36_ = main_grid_style_context;
	gtk_style_context_add_class (_tmp36_, GRANITE_STYLE_CLASS_ROUNDED);
	_tmp37_ = main_grid_style_context;
	_tmp38_ = greeter_base_card_css_provider;
	gtk_style_context_add_provider (_tmp37_, (GtkStyleProvider*) _tmp38_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
	_tmp39_ = self->priv->main_grid;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp39_);
	_tmp40_ = self->priv->username_entry;
	g_object_bind_property_with_closures ((GObject*) self, "connecting", (GObject*) _tmp40_, "sensitive", G_BINDING_INVERT_BOOLEAN, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp41_ = self->priv->password_entry;
	g_object_bind_property_with_closures ((GObject*) self, "connecting", (GObject*) _tmp41_, "sensitive", G_BINDING_INVERT_BOOLEAN, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp42_ = self->priv->username_entry;
	g_signal_connect_object (_tmp42_, "activate", (GCallback) __greeter_manual_card___lambda28__gtk_entry_activate, self, 0);
	_tmp43_ = self->priv->password_entry;
	g_signal_connect_object ((GtkEntry*) _tmp43_, "activate", (GCallback) _greeter_manual_card_on_login_gtk_entry_activate, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "grab-focus", (GCallback) __greeter_manual_card___lambda29__gtk_widget_grab_focus, self, 0);
	_g_object_unref0 (form_grid);
	_g_object_unref0 (session_button);
	_g_object_unref0 (password_grid);
	_g_object_unref0 (caps_lock_revealer);
	_g_object_unref0 (label);
	_g_object_unref0 (icon);
	return obj;
}

static void
greeter_manual_card_class_init (GreeterManualCardClass * klass,
                                gpointer klass_data)
{
	greeter_manual_card_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GreeterManualCard_private_offset);
	((GreeterBaseCardClass *) klass)->wrong_credentials = (void (*) (GreeterBaseCard*)) greeter_manual_card_real_wrong_credentials;
	G_OBJECT_CLASS (klass)->constructor = greeter_manual_card_constructor;
	G_OBJECT_CLASS (klass)->finalize = greeter_manual_card_finalize;
	greeter_manual_card_signals[GREETER_MANUAL_CARD_DO_CONNECT_USERNAME_SIGNAL] = g_signal_new ("do-connect-username", GREETER_TYPE_MANUAL_CARD, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
greeter_manual_card_instance_init (GreeterManualCard * self,
                                   gpointer klass)
{
	self->priv = greeter_manual_card_get_instance_private (self);
}

static void
greeter_manual_card_finalize (GObject * obj)
{
	GreeterManualCard * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_TYPE_MANUAL_CARD, GreeterManualCard);
	_g_object_unref0 (self->priv->password_entry);
	_g_object_unref0 (self->priv->username_entry);
	_g_object_unref0 (self->priv->main_grid);
	G_OBJECT_CLASS (greeter_manual_card_parent_class)->finalize (obj);
}

static GType
greeter_manual_card_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GreeterManualCardClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) greeter_manual_card_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GreeterManualCard), 0, (GInstanceInitFunc) greeter_manual_card_instance_init, NULL };
	GType greeter_manual_card_type_id;
	greeter_manual_card_type_id = g_type_register_static (GREETER_TYPE_BASE_CARD, "GreeterManualCard", &g_define_type_info, 0);
	GreeterManualCard_private_offset = g_type_add_instance_private (greeter_manual_card_type_id, sizeof (GreeterManualCardPrivate));
	return greeter_manual_card_type_id;
}

GType
greeter_manual_card_get_type (void)
{
	static volatile gsize greeter_manual_card_type_id__once = 0;
	if (g_once_init_enter (&greeter_manual_card_type_id__once)) {
		GType greeter_manual_card_type_id;
		greeter_manual_card_type_id = greeter_manual_card_get_type_once ();
		g_once_init_leave (&greeter_manual_card_type_id__once, greeter_manual_card_type_id);
	}
	return greeter_manual_card_type_id__once;
}

