/* accounts-signature-web-view.c generated by valac 0.56.19, the Vala compiler
 * generated from accounts-signature-web-view.vala, do not modify */

/*
 * Copyright 2019 Michael Gratton <mike@vee.net>
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include "geary-client-46.0.h"
#include <webkit2/webkit2.h>
#include <glib.h>
#include <glib-object.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  {
	ACCOUNTS_SIGNATURE_WEB_VIEW_0_PROPERTY,
	ACCOUNTS_SIGNATURE_WEB_VIEW_NUM_PROPERTIES
};
static GParamSpec* accounts_signature_web_view_properties[ACCOUNTS_SIGNATURE_WEB_VIEW_NUM_PROPERTIES];
#define _webkit_user_script_unref0(var) ((var == NULL) ? NULL : (var = (webkit_user_script_unref (var), NULL)))

static gpointer accounts_signature_web_view_parent_class = NULL;
static WebKitUserScript* accounts_signature_web_view_app_script;
static WebKitUserScript* accounts_signature_web_view_app_script = NULL;

static void accounts_signature_web_view_finalize (GObject * obj);
static GType accounts_signature_web_view_get_type_once (void);

void
accounts_signature_web_view_load_resources (GError** error)
{
	WebKitUserScript* _tmp0_ = NULL;
	WebKitUserScript* _tmp1_;
	WebKitUserScript* _tmp2_;
	GError* _inner_error0_ = NULL;
	_tmp1_ = components_web_view_load_app_script ("signature-web-view.js", &_inner_error0_);
	_tmp0_ = _tmp1_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp2_ = _tmp0_;
	_tmp0_ = NULL;
	_webkit_user_script_unref0 (accounts_signature_web_view_app_script);
	accounts_signature_web_view_app_script = _tmp2_;
	_webkit_user_script_unref0 (_tmp0_);
}

AccountsSignatureWebView*
accounts_signature_web_view_construct (GType object_type,
                                       ApplicationConfiguration* config)
{
	AccountsSignatureWebView * self = NULL;
	WebKitUserContentManager* _tmp0_;
	WebKitUserContentManager* _tmp1_;
	WebKitUserScript* _tmp2_;
	g_return_val_if_fail (APPLICATION_IS_CONFIGURATION (config), NULL);
	self = (AccountsSignatureWebView*) components_web_view_construct (object_type, config, NULL, NULL);
	_tmp0_ = webkit_web_view_get_user_content_manager (G_TYPE_CHECK_INSTANCE_CAST (self, webkit_web_view_get_type (), WebKitWebView));
	_tmp1_ = _tmp0_;
	_tmp2_ = accounts_signature_web_view_app_script;
	webkit_user_content_manager_add_script (_tmp1_, _tmp2_);
	return self;
}

AccountsSignatureWebView*
accounts_signature_web_view_new (ApplicationConfiguration* config)
{
	return accounts_signature_web_view_construct (ACCOUNTS_TYPE_SIGNATURE_WEB_VIEW, config);
}

static void
accounts_signature_web_view_class_init (AccountsSignatureWebViewClass * klass,
                                        gpointer klass_data)
{
	accounts_signature_web_view_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = accounts_signature_web_view_finalize;
}

static void
accounts_signature_web_view_instance_init (AccountsSignatureWebView * self,
                                           gpointer klass)
{
}

static void
accounts_signature_web_view_finalize (GObject * obj)
{
	AccountsSignatureWebView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ACCOUNTS_TYPE_SIGNATURE_WEB_VIEW, AccountsSignatureWebView);
	G_OBJECT_CLASS (accounts_signature_web_view_parent_class)->finalize (obj);
}

/**
 * A class for editing signatures in the accounts editor.
 */
static GType
accounts_signature_web_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (AccountsSignatureWebViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) accounts_signature_web_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AccountsSignatureWebView), 0, (GInstanceInitFunc) accounts_signature_web_view_instance_init, NULL };
	GType accounts_signature_web_view_type_id;
	accounts_signature_web_view_type_id = g_type_register_static (COMPONENTS_TYPE_WEB_VIEW, "AccountsSignatureWebView", &g_define_type_info, 0);
	return accounts_signature_web_view_type_id;
}

GType
accounts_signature_web_view_get_type (void)
{
	static volatile gsize accounts_signature_web_view_type_id__once = 0;
	if (g_once_init_enter (&accounts_signature_web_view_type_id__once)) {
		GType accounts_signature_web_view_type_id;
		accounts_signature_web_view_type_id = accounts_signature_web_view_get_type_once ();
		g_once_init_leave (&accounts_signature_web_view_type_id__once, accounts_signature_web_view_type_id);
	}
	return accounts_signature_web_view_type_id__once;
}

