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

/*
 * Seahorse
 *
 * Copyright (C) 2004,2005 Stefan Walter
 * Copyright (C) 2011 Collabora Ltd.
 *
 * 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, see <http://www.gnu.org/licenses/>.
 */

#include "seahorse-common.h"
#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>

static GType seahorse_lockable_get_type_once (void);

void
seahorse_lockable_lock (SeahorseLockable* self,
                        GTlsInteraction* interaction,
                        GCancellable* cancellable,
                        GAsyncReadyCallback _callback_,
                        gpointer _user_data_)
{
	SeahorseLockableIface* _iface_;
	_iface_ = SEAHORSE_LOCKABLE_GET_INTERFACE (self);
	if (_iface_->lock) {
		_iface_->lock (self, interaction, cancellable, _callback_, _user_data_);
	}
}

gboolean
seahorse_lockable_lock_finish (SeahorseLockable* self,
                               GAsyncResult* _res_,
                               GError** error)
{
	SeahorseLockableIface* _iface_;
	_iface_ = SEAHORSE_LOCKABLE_GET_INTERFACE (self);
	if (_iface_->lock_finish) {
		return _iface_->lock_finish (self, _res_, error);
	}
	return FALSE;
}

void
seahorse_lockable_unlock (SeahorseLockable* self,
                          GTlsInteraction* interaction,
                          GCancellable* cancellable,
                          GAsyncReadyCallback _callback_,
                          gpointer _user_data_)
{
	SeahorseLockableIface* _iface_;
	_iface_ = SEAHORSE_LOCKABLE_GET_INTERFACE (self);
	if (_iface_->unlock) {
		_iface_->unlock (self, interaction, cancellable, _callback_, _user_data_);
	}
}

gboolean
seahorse_lockable_unlock_finish (SeahorseLockable* self,
                                 GAsyncResult* _res_,
                                 GError** error)
{
	SeahorseLockableIface* _iface_;
	_iface_ = SEAHORSE_LOCKABLE_GET_INTERFACE (self);
	if (_iface_->unlock_finish) {
		return _iface_->unlock_finish (self, _res_, error);
	}
	return FALSE;
}

gboolean
seahorse_lockable_can_lock (GObject* object)
{
	gboolean result;
	g_return_val_if_fail (object != NULL, FALSE);
	if (SEAHORSE_IS_LOCKABLE (object)) {
		gboolean _tmp0_;
		gboolean _tmp1_;
		_tmp0_ = seahorse_lockable_get_lockable (G_TYPE_CHECK_INSTANCE_CAST (object, SEAHORSE_TYPE_LOCKABLE, SeahorseLockable));
		_tmp1_ = _tmp0_;
		result = _tmp1_;
		return result;
	}
	result = FALSE;
	return result;
}

gboolean
seahorse_lockable_can_unlock (GObject* object)
{
	gboolean result;
	g_return_val_if_fail (object != NULL, FALSE);
	if (SEAHORSE_IS_LOCKABLE (object)) {
		gboolean _tmp0_;
		gboolean _tmp1_;
		_tmp0_ = seahorse_lockable_get_unlockable (G_TYPE_CHECK_INSTANCE_CAST (object, SEAHORSE_TYPE_LOCKABLE, SeahorseLockable));
		_tmp1_ = _tmp0_;
		result = _tmp1_;
		return result;
	}
	result = FALSE;
	return result;
}

gboolean
seahorse_lockable_get_lockable (SeahorseLockable* self)
{
	SeahorseLockableIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = SEAHORSE_LOCKABLE_GET_INTERFACE (self);
	if (_iface_->get_lockable) {
		return _iface_->get_lockable (self);
	}
	return FALSE;
}

gboolean
seahorse_lockable_get_unlockable (SeahorseLockable* self)
{
	SeahorseLockableIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = SEAHORSE_LOCKABLE_GET_INTERFACE (self);
	if (_iface_->get_unlockable) {
		return _iface_->get_unlockable (self);
	}
	return FALSE;
}

static void
seahorse_lockable_default_init (SeahorseLockableIface * iface,
                                gpointer iface_data)
{
	g_object_interface_install_property (iface, g_param_spec_boolean ("lockable", "lockable", "lockable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_boolean ("unlockable", "unlockable", "unlockable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

 G_GNUC_NO_INLINE static GType
seahorse_lockable_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SeahorseLockableIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_lockable_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType seahorse_lockable_type_id;
	seahorse_lockable_type_id = g_type_register_static (G_TYPE_INTERFACE, "SeahorseLockable", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (seahorse_lockable_type_id, G_TYPE_OBJECT);
	return seahorse_lockable_type_id;
}

GType
seahorse_lockable_get_type (void)
{
	static volatile gsize seahorse_lockable_type_id__once = 0;
	if (g_once_init_enter (&seahorse_lockable_type_id__once)) {
		GType seahorse_lockable_type_id;
		seahorse_lockable_type_id = seahorse_lockable_get_type_once ();
		g_once_init_leave (&seahorse_lockable_type_id__once, seahorse_lockable_type_id);
	}
	return seahorse_lockable_type_id__once;
}

