/* nsplugin-manager.c generated by valac 0.26.2, the Vala compiler
 * generated from nsplugin-manager.vala, do not modify */

/*
   Copyright (C) 2012 André Stösel <andre@stoesel.de>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   See the file COPYING for the full license text.
*/

#include <glib.h>
#include <glib-object.h>
#include "midori/midori-extension.h"
#include "webkit/webkit.h"
#include "midori/midori-app.h"
#include <stdlib.h>
#include <string.h>
#include "midori/midori-stock.h"
#include "nsplugin-manager.h"
#include "katze/katze.h"
#include "midori/midori-websettings.h"


#define NS_PLUGINS_TYPE_EXTENSION (ns_plugins_extension_get_type ())
#define NS_PLUGINS_EXTENSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NS_PLUGINS_TYPE_EXTENSION, NSPluginsExtension))
#define NS_PLUGINS_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NS_PLUGINS_TYPE_EXTENSION, NSPluginsExtensionClass))
#define NS_PLUGINS_IS_EXTENSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NS_PLUGINS_TYPE_EXTENSION))
#define NS_PLUGINS_IS_EXTENSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NS_PLUGINS_TYPE_EXTENSION))
#define NS_PLUGINS_EXTENSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NS_PLUGINS_TYPE_EXTENSION, NSPluginsExtensionClass))

typedef struct _NSPluginsExtension NSPluginsExtension;
typedef struct _NSPluginsExtensionClass NSPluginsExtensionClass;
typedef struct _NSPluginsExtensionPrivate NSPluginsExtensionPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define __g_slist_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__g_object_unref0_ (var), NULL)))

struct _NSPluginsExtension {
	MidoriExtension parent_instance;
	NSPluginsExtensionPrivate * priv;
	WebKitWebPlugin* plugin;
};

struct _NSPluginsExtensionClass {
	MidoriExtensionClass parent_class;
};


extern gint ns_plugins_active_plugins;
gint ns_plugins_active_plugins = 0;
static gpointer ns_plugins_extension_parent_class = NULL;

GType ns_plugins_extension_get_type (void) G_GNUC_CONST;
enum  {
	NS_PLUGINS_EXTENSION_DUMMY_PROPERTY
};
static void ns_plugins_extension_activated (NSPluginsExtension* self, MidoriApp* app);
static void ns_plugins_extension_deactivated (NSPluginsExtension* self);
NSPluginsExtension* ns_plugins_extension_new (WebKitWebPlugin* plugin);
NSPluginsExtension* ns_plugins_extension_construct (GType object_type, WebKitWebPlugin* plugin);
static void _ns_plugins_extension_activated_midori_extension_activate (MidoriExtension* _sender, MidoriApp* app, gpointer self);
static void _ns_plugins_extension_deactivated_midori_extension_deactivate (MidoriExtension* _sender, gpointer self);
static void ns_plugins_extension_finalize (GObject* obj);
static void _g_object_unref0_ (gpointer var);
static void _g_slist_free__g_object_unref0_ (GSList* self);


static void ns_plugins_extension_activated (NSPluginsExtension* self, MidoriApp* app) {
	gint _tmp0_ = 0;
	WebKitWebPlugin* _tmp1_ = NULL;
	MidoriApp* _tmp2_ = NULL;
	MidoriWebSettings* _tmp3_ = NULL;
	MidoriWebSettings* _tmp4_ = NULL;
	MidoriWebSettings* _tmp5_ = NULL;
	gint _tmp6_ = 0;
#line 18 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_return_if_fail (self != NULL);
#line 18 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_return_if_fail (app != NULL);
#line 19 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp0_ = ns_plugins_active_plugins;
#line 19 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	ns_plugins_active_plugins = _tmp0_ + 1;
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp1_ = self->plugin;
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	webkit_web_plugin_set_enabled (_tmp1_, TRUE);
#line 21 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp2_ = app;
#line 21 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_object_get (_tmp2_, "settings", &_tmp3_, NULL);
#line 21 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp4_ = _tmp3_;
#line 21 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp5_ = _tmp4_;
#line 21 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp6_ = ns_plugins_active_plugins;
#line 21 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_object_set ((WebKitWebSettings*) _tmp5_, "enable-plugins", _tmp6_ > 0, NULL);
#line 21 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_g_object_unref0 (_tmp5_);
#line 109 "nsplugin-manager.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 25 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	return self ? g_object_ref (self) : NULL;
#line 116 "nsplugin-manager.c"
}


static void ns_plugins_extension_deactivated (NSPluginsExtension* self) {
	MidoriApp* app = NULL;
	MidoriApp* _tmp0_ = NULL;
	MidoriApp* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	WebKitWebPlugin* _tmp3_ = NULL;
	MidoriWebSettings* _tmp4_ = NULL;
	MidoriWebSettings* _tmp5_ = NULL;
	MidoriWebSettings* _tmp6_ = NULL;
	gint _tmp7_ = 0;
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_return_if_fail (self != NULL);
#line 25 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp0_ = midori_extension_get_app ((MidoriExtension*) self);
#line 25 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp1_ = _g_object_ref0 (_tmp0_);
#line 25 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	app = _tmp1_;
#line 26 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp2_ = ns_plugins_active_plugins;
#line 26 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	ns_plugins_active_plugins = _tmp2_ - 1;
#line 27 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp3_ = self->plugin;
#line 27 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	webkit_web_plugin_set_enabled (_tmp3_, FALSE);
#line 28 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_object_get (app, "settings", &_tmp4_, NULL);
#line 28 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp5_ = _tmp4_;
#line 28 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp6_ = _tmp5_;
#line 28 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp7_ = ns_plugins_active_plugins;
#line 28 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_object_set ((WebKitWebSettings*) _tmp6_, "enable-plugins", _tmp7_ > 0, NULL);
#line 28 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_g_object_unref0 (_tmp6_);
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_g_object_unref0 (app);
#line 160 "nsplugin-manager.c"
}


static gchar* string_replace (const gchar* self, const gchar* old, const gchar* replacement) {
	gchar* result = NULL;
	GError * _inner_error_ = NULL;
#line 1282 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1282 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail (old != NULL, NULL);
#line 1282 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail (replacement != NULL, NULL);
#line 173 "nsplugin-manager.c"
	{
		GRegex* regex = NULL;
		const gchar* _tmp0_ = NULL;
		gchar* _tmp1_ = NULL;
		gchar* _tmp2_ = NULL;
		GRegex* _tmp3_ = NULL;
		GRegex* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		GRegex* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
		gchar* _tmp8_ = NULL;
		gchar* _tmp9_ = NULL;
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp0_ = old;
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp1_ = g_regex_escape_string (_tmp0_, -1);
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp2_ = _tmp1_;
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp3_ = g_regex_new (_tmp2_, 0, 0, &_inner_error_);
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp4_ = _tmp3_;
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_g_free0 (_tmp2_);
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		regex = _tmp4_;
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
			if (_inner_error_->domain == G_REGEX_ERROR) {
#line 204 "nsplugin-manager.c"
				goto __catch1_g_regex_error;
			}
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
			g_clear_error (&_inner_error_);
#line 1284 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
			return NULL;
#line 213 "nsplugin-manager.c"
		}
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp6_ = regex;
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp7_ = replacement;
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp8_ = g_regex_replace_literal (_tmp6_, self, (gssize) (-1), 0, _tmp7_, 0, &_inner_error_);
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp5_ = _tmp8_;
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
			_g_regex_unref0 (regex);
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
			if (_inner_error_->domain == G_REGEX_ERROR) {
#line 229 "nsplugin-manager.c"
				goto __catch1_g_regex_error;
			}
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
			_g_regex_unref0 (regex);
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
			g_clear_error (&_inner_error_);
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
			return NULL;
#line 240 "nsplugin-manager.c"
		}
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp9_ = _tmp5_;
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp5_ = NULL;
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		result = _tmp9_;
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_g_free0 (_tmp5_);
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_g_regex_unref0 (regex);
#line 1285 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		return result;
#line 254 "nsplugin-manager.c"
	}
	goto __finally1;
	__catch1_g_regex_error:
	{
		GError* e = NULL;
#line 1283 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		e = _inner_error_;
#line 1283 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_inner_error_ = NULL;
#line 1287 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		g_assert_not_reached ();
#line 1283 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_g_error_free0 (e);
#line 268 "nsplugin-manager.c"
	}
	__finally1:
#line 1283 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 1283 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 1283 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		g_clear_error (&_inner_error_);
#line 1283 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		return NULL;
#line 279 "nsplugin-manager.c"
	}
}


static void _ns_plugins_extension_activated_midori_extension_activate (MidoriExtension* _sender, MidoriApp* app, gpointer self) {
#line 50 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	ns_plugins_extension_activated ((NSPluginsExtension*) self, app);
#line 287 "nsplugin-manager.c"
}


static void _ns_plugins_extension_deactivated_midori_extension_deactivate (MidoriExtension* _sender, gpointer self) {
#line 51 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	ns_plugins_extension_deactivated ((NSPluginsExtension*) self);
#line 294 "nsplugin-manager.c"
}


NSPluginsExtension* ns_plugins_extension_construct (GType object_type, WebKitWebPlugin* plugin) {
	NSPluginsExtension * self = NULL;
	gchar* desc = NULL;
	WebKitWebPlugin* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	WebKitWebPlugin* _tmp11_ = NULL;
	const gchar* _tmp12_ = NULL;
	const gchar* _tmp13_ = NULL;
	WebKitWebPlugin* _tmp14_ = NULL;
	const gchar* _tmp15_ = NULL;
	gchar* _tmp16_ = NULL;
	gchar* _tmp17_ = NULL;
	gchar* _tmp18_ = NULL;
	gchar* _tmp19_ = NULL;
	WebKitWebPlugin* _tmp20_ = NULL;
	WebKitWebPlugin* _tmp21_ = NULL;
	WebKitWebPlugin* _tmp22_ = NULL;
	GError * _inner_error_ = NULL;
#line 31 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_return_val_if_fail (plugin != NULL, NULL);
#line 32 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp0_ = plugin;
#line 32 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp1_ = webkit_web_plugin_get_description (_tmp0_);
#line 32 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp2_ = g_strdup (_tmp1_);
#line 32 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	desc = _tmp2_;
#line 327 "nsplugin-manager.c"
	{
		GRegex* regex = NULL;
		GRegex* _tmp3_ = NULL;
		gchar* _tmp4_ = NULL;
		GRegex* _tmp5_ = NULL;
		const gchar* _tmp6_ = NULL;
		gchar* _tmp7_ = NULL;
		gchar* _tmp8_ = NULL;
		const gchar* _tmp9_ = NULL;
		gchar* _tmp10_ = NULL;
#line 34 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_tmp3_ = g_regex_new ("<a.+href.+>(.+)</a>", 0, 0, &_inner_error_);
#line 34 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		regex = _tmp3_;
#line 34 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 344 "nsplugin-manager.c"
			goto __catch0_g_error;
		}
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_tmp5_ = regex;
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_tmp6_ = desc;
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_tmp7_ = g_regex_replace (_tmp5_, _tmp6_, (gssize) (-1), 0, "<u>\\1</u>", 0, &_inner_error_);
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_tmp4_ = _tmp7_;
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
			_g_regex_unref0 (regex);
#line 359 "nsplugin-manager.c"
			goto __catch0_g_error;
		}
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_tmp8_ = _tmp4_;
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_tmp4_ = NULL;
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_g_free0 (desc);
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		desc = _tmp8_;
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_tmp9_ = desc;
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_tmp10_ = string_replace (_tmp9_, "<br>", "\n");
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_g_free0 (desc);
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		desc = _tmp10_;
#line 33 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_g_free0 (_tmp4_);
#line 33 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_g_regex_unref0 (regex);
#line 382 "nsplugin-manager.c"
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
#line 33 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_error_ = _inner_error_;
#line 33 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_inner_error_ = NULL;
#line 33 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_g_error_free0 (_error_);
#line 394 "nsplugin-manager.c"
	}
	__finally0:
#line 33 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 33 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		_g_free0 (desc);
#line 33 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 33 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		g_clear_error (&_inner_error_);
#line 33 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		return NULL;
#line 407 "nsplugin-manager.c"
	}
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp11_ = plugin;
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp12_ = webkit_web_plugin_get_name (_tmp11_);
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp13_ = desc;
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp14_ = plugin;
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp15_ = webkit_web_plugin_get_path (_tmp14_);
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp16_ = g_path_get_basename (_tmp15_);
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp17_ = _tmp16_;
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp18_ = g_strdup_printf ("(%s)", "Netscape plugins");
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp19_ = _tmp18_;
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	self = (NSPluginsExtension*) g_object_new (object_type, "stock-id", MIDORI_STOCK_PLUGINS, "name", _tmp12_, "description", _tmp13_, "use-markup", TRUE, "key", _tmp17_, "version", _tmp19_, "authors", "", NULL);
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_g_free0 (_tmp19_);
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_g_free0 (_tmp17_);
#line 47 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp20_ = plugin;
#line 47 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp21_ = _g_object_ref0 (_tmp20_);
#line 47 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_g_object_unref0 (self->plugin);
#line 47 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	self->plugin = _tmp21_;
#line 48 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp22_ = self->plugin;
#line 48 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	webkit_web_plugin_set_enabled (_tmp22_, FALSE);
#line 50 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_signal_connect_object ((MidoriExtension*) self, "activate", (GCallback) _ns_plugins_extension_activated_midori_extension_activate, self, 0);
#line 51 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_signal_connect_object ((MidoriExtension*) self, "deactivate", (GCallback) _ns_plugins_extension_deactivated_midori_extension_deactivate, self, 0);
#line 31 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_g_free0 (desc);
#line 31 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	return self;
#line 453 "nsplugin-manager.c"
}


NSPluginsExtension* ns_plugins_extension_new (WebKitWebPlugin* plugin) {
#line 31 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	return ns_plugins_extension_construct (NS_PLUGINS_TYPE_EXTENSION, plugin);
#line 460 "nsplugin-manager.c"
}


static void ns_plugins_extension_class_init (NSPluginsExtensionClass * klass) {
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	ns_plugins_extension_parent_class = g_type_class_peek_parent (klass);
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	G_OBJECT_CLASS (klass)->finalize = ns_plugins_extension_finalize;
#line 469 "nsplugin-manager.c"
}


static void ns_plugins_extension_instance_init (NSPluginsExtension * self) {
}


static void ns_plugins_extension_finalize (GObject* obj) {
	NSPluginsExtension * self;
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, NS_PLUGINS_TYPE_EXTENSION, NSPluginsExtension);
#line 16 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_g_object_unref0 (self->plugin);
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	G_OBJECT_CLASS (ns_plugins_extension_parent_class)->finalize (obj);
#line 485 "nsplugin-manager.c"
}


GType ns_plugins_extension_get_type (void) {
	static volatile gsize ns_plugins_extension_type_id__volatile = 0;
	if (g_once_init_enter (&ns_plugins_extension_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (NSPluginsExtensionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ns_plugins_extension_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (NSPluginsExtension), 0, (GInstanceInitFunc) ns_plugins_extension_instance_init, NULL };
		GType ns_plugins_extension_type_id;
		ns_plugins_extension_type_id = g_type_register_static (MIDORI_TYPE_EXTENSION, "NSPluginsExtension", &g_define_type_info, 0);
		g_once_init_leave (&ns_plugins_extension_type_id__volatile, ns_plugins_extension_type_id);
	}
	return ns_plugins_extension_type_id__volatile;
}


static void _g_object_unref0_ (gpointer var) {
#line 69 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
#line 504 "nsplugin-manager.c"
}


static void _g_slist_free__g_object_unref0_ (GSList* self) {
#line 69 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_slist_foreach (self, (GFunc) _g_object_unref0_, NULL);
#line 69 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	g_slist_free (self);
#line 513 "nsplugin-manager.c"
}


KatzeArray* extension_init (void) {
	KatzeArray* result = NULL;
	gboolean _tmp0_ = FALSE;
	KatzeArray* extensions = NULL;
	KatzeArray* _tmp1_ = NULL;
	WebKitWebPluginDatabase* pdb = NULL;
	WebKitWebPluginDatabase* _tmp2_ = NULL;
	WebKitWebPluginDatabase* _tmp3_ = NULL;
	GSList* plugins = NULL;
	WebKitWebPluginDatabase* _tmp4_ = NULL;
	GSList* _tmp5_ = NULL;
	GSList* _tmp6_ = NULL;
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp0_ = midori_web_settings_has_plugin_support ();
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	if (!_tmp0_) {
#line 58 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		result = NULL;
#line 58 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		return result;
#line 537 "nsplugin-manager.c"
	}
#line 60 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp1_ = katze_array_new (MIDORI_TYPE_EXTENSION);
#line 60 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	extensions = _tmp1_;
#line 61 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp2_ = webkit_get_web_plugin_database ();
#line 61 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp3_ = _g_object_ref0 (_tmp2_);
#line 61 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	pdb = _tmp3_;
#line 62 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp4_ = pdb;
#line 62 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp5_ = webkit_web_plugin_database_get_plugins (_tmp4_);
#line 62 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	plugins = _tmp5_;
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_tmp6_ = plugins;
#line 557 "nsplugin-manager.c"
	{
		GSList* plugin_collection = NULL;
		GSList* plugin_it = NULL;
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		plugin_collection = _tmp6_;
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
		for (plugin_it = plugin_collection; plugin_it != NULL; plugin_it = plugin_it->next) {
#line 565 "nsplugin-manager.c"
			WebKitWebPlugin* _tmp7_ = NULL;
			WebKitWebPlugin* plugin = NULL;
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
			_tmp7_ = _g_object_ref0 ((WebKitWebPlugin*) plugin_it->data);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
			plugin = _tmp7_;
#line 572 "nsplugin-manager.c"
			{
				WebKitWebPlugin* _tmp8_ = NULL;
				const gchar* _tmp9_ = NULL;
				gboolean _tmp10_ = FALSE;
				KatzeArray* _tmp11_ = NULL;
				WebKitWebPlugin* _tmp12_ = NULL;
				NSPluginsExtension* _tmp13_ = NULL;
				NSPluginsExtension* _tmp14_ = NULL;
#line 65 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
				_tmp8_ = plugin;
#line 65 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
				_tmp9_ = webkit_web_plugin_get_path (_tmp8_);
#line 65 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
				_tmp10_ = midori_web_settings_skip_plugin (_tmp9_);
#line 65 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
				if (_tmp10_) {
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
					_g_object_unref0 (plugin);
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
					continue;
#line 593 "nsplugin-manager.c"
				}
#line 67 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
				_tmp11_ = extensions;
#line 67 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
				_tmp12_ = plugin;
#line 67 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
				_tmp13_ = ns_plugins_extension_new (_tmp12_);
#line 67 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
				_tmp14_ = _tmp13_;
#line 67 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
				g_signal_emit_by_name (_tmp11_, "add-item", (GObject*) _tmp14_);
#line 67 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
				_g_object_unref0 (_tmp14_);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
				_g_object_unref0 (plugin);
#line 609 "nsplugin-manager.c"
			}
		}
	}
#line 69 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	result = extensions;
#line 69 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	__g_slist_free__g_object_unref0_0 (plugins);
#line 69 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	_g_object_unref0 (pdb);
#line 69 "/usr/src/ports/midori/midori-0.5.10-1.x86_64/src/extensions/nsplugin-manager.vala"
	return result;
#line 621 "nsplugin-manager.c"
}



