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

/*
 * Copyright 2018–2019 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.
 *
 * Authors: Corentin Noël <corentin@elementary.io>
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>

#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_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;
typedef struct _GreeterPasswordEntryPrivate GreeterPasswordEntryPrivate;
enum  {
	GREETER_PASSWORD_ENTRY_0_PROPERTY,
	GREETER_PASSWORD_ENTRY_NUM_PROPERTIES
};
static GParamSpec* greeter_password_entry_properties[GREETER_PASSWORD_ENTRY_NUM_PROPERTIES];

struct _GreeterPasswordEntry {
	GtkEntry parent_instance;
	GreeterPasswordEntryPrivate * priv;
};

struct _GreeterPasswordEntryClass {
	GtkEntryClass parent_class;
};

static gpointer greeter_password_entry_parent_class = NULL;

VALA_EXTERN GType greeter_password_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterPasswordEntry, g_object_unref)
VALA_EXTERN GreeterPasswordEntry* greeter_password_entry_new (void);
VALA_EXTERN GreeterPasswordEntry* greeter_password_entry_construct (GType object_type);
static GObject * greeter_password_entry_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties);
static void _greeter_password_entry___lambda9_ (GreeterPasswordEntry* self,
                                         GtkEntryIconPosition pos,
                                         GdkEvent* event);
static void __greeter_password_entry___lambda9__gtk_entry_icon_press (GtkEntry* _sender,
                                                               GtkEntryIconPosition icon_pos,
                                                               GdkEvent* event,
                                                               gpointer self);
static GType greeter_password_entry_get_type_once (void);

GreeterPasswordEntry*
greeter_password_entry_construct (GType object_type)
{
	GreeterPasswordEntry * self = NULL;
	self = (GreeterPasswordEntry*) g_object_new (object_type, NULL);
	return self;
}

GreeterPasswordEntry*
greeter_password_entry_new (void)
{
	return greeter_password_entry_construct (GREETER_TYPE_PASSWORD_ENTRY);
}

static void
_greeter_password_entry___lambda9_ (GreeterPasswordEntry* self,
                                    GtkEntryIconPosition pos,
                                    GdkEvent* event)
{
	g_return_if_fail (event != NULL);
	if (pos == GTK_ENTRY_ICON_SECONDARY) {
		g_signal_emit_by_name ((GtkEntry*) self, "activate");
	}
}

static void
__greeter_password_entry___lambda9__gtk_entry_icon_press (GtkEntry* _sender,
                                                          GtkEntryIconPosition icon_pos,
                                                          GdkEvent* event,
                                                          gpointer self)
{
	_greeter_password_entry___lambda9_ ((GreeterPasswordEntry*) self, icon_pos, event);
}

static GObject *
greeter_password_entry_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GreeterPasswordEntry * self;
	parent_class = G_OBJECT_CLASS (greeter_password_entry_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_TYPE_PASSWORD_ENTRY, GreeterPasswordEntry);
	gtk_widget_set_tooltip_text ((GtkWidget*) self, _ ("Password"));
	g_object_set ((GtkEntry*) self, "primary-icon-name", "dialog-password-symbolic", NULL);
	g_object_set ((GtkEntry*) self, "secondary-icon-name", "go-jump-symbolic", NULL);
	g_object_set ((GtkEntry*) self, "secondary-icon-tooltip-text", _ ("Log In"), NULL);
	gtk_widget_set_hexpand ((GtkWidget*) self, TRUE);
	gtk_entry_set_visibility ((GtkEntry*) self, FALSE);
	gtk_entry_set_input_purpose ((GtkEntry*) self, GTK_INPUT_PURPOSE_PASSWORD);
	g_signal_connect_object ((GtkEntry*) self, "icon-press", (GCallback) __greeter_password_entry___lambda9__gtk_entry_icon_press, self, 0);
	return obj;
}

static void
greeter_password_entry_class_init (GreeterPasswordEntryClass * klass,
                                   gpointer klass_data)
{
	greeter_password_entry_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = greeter_password_entry_constructor;
}

static void
greeter_password_entry_instance_init (GreeterPasswordEntry * self,
                                      gpointer klass)
{
}

static GType
greeter_password_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GreeterPasswordEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) greeter_password_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GreeterPasswordEntry), 0, (GInstanceInitFunc) greeter_password_entry_instance_init, NULL };
	GType greeter_password_entry_type_id;
	greeter_password_entry_type_id = g_type_register_static (gtk_entry_get_type (), "GreeterPasswordEntry", &g_define_type_info, 0);
	return greeter_password_entry_type_id;
}

GType
greeter_password_entry_get_type (void)
{
	static volatile gsize greeter_password_entry_type_id__once = 0;
	if (g_once_init_enter (&greeter_password_entry_type_id__once)) {
		GType greeter_password_entry_type_id;
		greeter_password_entry_type_id = greeter_password_entry_get_type_once ();
		g_once_init_leave (&greeter_password_entry_type_id__once, greeter_password_entry_type_id);
	}
	return greeter_password_entry_type_id__once;
}

