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

/*
 * Copyright (C) 2009-2017 Canonical Ltd.
 * Author: Robert Ancell <robert.ancell@canonical.com>,
 *         Eduard Gotwig <g@ox.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 3 of the License, or (at your option) any later
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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 TYPE_AUTHORIZE_DIALOG (authorize_dialog_get_type ())
#define AUTHORIZE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_AUTHORIZE_DIALOG, AuthorizeDialog))
#define AUTHORIZE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_AUTHORIZE_DIALOG, AuthorizeDialogClass))
#define IS_AUTHORIZE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_AUTHORIZE_DIALOG))
#define IS_AUTHORIZE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_AUTHORIZE_DIALOG))
#define AUTHORIZE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_AUTHORIZE_DIALOG, AuthorizeDialogClass))

typedef struct _AuthorizeDialog AuthorizeDialog;
typedef struct _AuthorizeDialogClass AuthorizeDialogClass;
typedef struct _AuthorizeDialogPrivate AuthorizeDialogPrivate;
enum  {
	AUTHORIZE_DIALOG_0_PROPERTY,
	AUTHORIZE_DIALOG_NUM_PROPERTIES
};
static GParamSpec* authorize_dialog_properties[AUTHORIZE_DIALOG_NUM_PROPERTIES];

struct _AuthorizeDialog {
	GtkDialog parent_instance;
	AuthorizeDialogPrivate * priv;
};

struct _AuthorizeDialogClass {
	GtkDialogClass parent_class;
};

struct _AuthorizeDialogPrivate {
	GtkLabel* authorize_label;
	GtkEntry* username_entry;
	GtkEntry* password_entry;
};

static gint AuthorizeDialog_private_offset;
static gpointer authorize_dialog_parent_class = NULL;

VALA_EXTERN GType authorize_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AuthorizeDialog, g_object_unref)
VALA_EXTERN AuthorizeDialog* authorize_dialog_new (const gchar* title);
VALA_EXTERN AuthorizeDialog* authorize_dialog_construct (GType object_type,
                                             const gchar* title);
VALA_EXTERN gchar* authorize_dialog_get_username (AuthorizeDialog* self);
VALA_EXTERN gchar* authorize_dialog_get_password (AuthorizeDialog* self);
static void authorize_dialog_finalize (GObject * obj);
static GType authorize_dialog_get_type_once (void);

static inline gpointer
authorize_dialog_get_instance_private (AuthorizeDialog* self)
{
	return G_STRUCT_MEMBER_P (self, AuthorizeDialog_private_offset);
}

AuthorizeDialog*
authorize_dialog_construct (GType object_type,
                            const gchar* title)
{
	AuthorizeDialog * self = NULL;
	GtkLabel* _tmp0_;
	g_return_val_if_fail (title != NULL, NULL);
	self = (AuthorizeDialog*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->authorize_label;
	gtk_label_set_text (_tmp0_, title);
	return self;
}

AuthorizeDialog*
authorize_dialog_new (const gchar* title)
{
	return authorize_dialog_construct (TYPE_AUTHORIZE_DIALOG, title);
}

gchar*
authorize_dialog_get_username (AuthorizeDialog* self)
{
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->username_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

gchar*
authorize_dialog_get_password (AuthorizeDialog* self)
{
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->password_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
authorize_dialog_class_init (AuthorizeDialogClass * klass,
                             gpointer klass_data)
{
	authorize_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &AuthorizeDialog_private_offset);
	G_OBJECT_CLASS (klass)->finalize = authorize_dialog_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/SimpleScan/ui/authorize-dialog.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "authorize_label", FALSE, AuthorizeDialog_private_offset + G_STRUCT_OFFSET (AuthorizeDialogPrivate, authorize_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "username_entry", FALSE, AuthorizeDialog_private_offset + G_STRUCT_OFFSET (AuthorizeDialogPrivate, username_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "password_entry", FALSE, AuthorizeDialog_private_offset + G_STRUCT_OFFSET (AuthorizeDialogPrivate, password_entry));
}

static void
authorize_dialog_instance_init (AuthorizeDialog * self,
                                gpointer klass)
{
	self->priv = authorize_dialog_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
authorize_dialog_finalize (GObject * obj)
{
	AuthorizeDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_AUTHORIZE_DIALOG, AuthorizeDialog);
	G_OBJECT_CLASS (authorize_dialog_parent_class)->finalize (obj);
}

static GType
authorize_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (AuthorizeDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) authorize_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AuthorizeDialog), 0, (GInstanceInitFunc) authorize_dialog_instance_init, NULL };
	GType authorize_dialog_type_id;
	authorize_dialog_type_id = g_type_register_static (gtk_dialog_get_type (), "AuthorizeDialog", &g_define_type_info, 0);
	AuthorizeDialog_private_offset = g_type_add_instance_private (authorize_dialog_type_id, sizeof (AuthorizeDialogPrivate));
	return authorize_dialog_type_id;
}

GType
authorize_dialog_get_type (void)
{
	static volatile gsize authorize_dialog_type_id__once = 0;
	if (g_once_init_enter (&authorize_dialog_type_id__once)) {
		GType authorize_dialog_type_id;
		authorize_dialog_type_id = authorize_dialog_get_type_once ();
		g_once_init_leave (&authorize_dialog_type_id__once, authorize_dialog_type_id);
	}
	return authorize_dialog_type_id__once;
}

