/* nsplugin-manager.c generated by valac 0.38.8, 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;
enum  {
	NS_PLUGINS_EXTENSION_0_PROPERTY,
	NS_PLUGINS_EXTENSION_NUM_PROPERTIES
};
static GParamSpec* ns_plugins_extension_properties[NS_PLUGINS_EXTENSION_NUM_PROPERTIES];
#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;
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 inline void _g_slist_free__g_object_unref0_ (GSList* self);


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


static gpointer _g_object_ref0 (gpointer self) {
#line 25 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	return self ? g_object_ref (self) : NULL;
#line 118 "nsplugin-manager.c"
}


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


static gchar* string_replace (const gchar* self, const gchar* old, const gchar* replacement) {
	gchar* result = NULL;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError * _inner_error_ = NULL;
#line 1415 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1415 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
	g_return_val_if_fail (old != NULL, NULL);
#line 1415 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
	g_return_val_if_fail (replacement != NULL, NULL);
#line 1416 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
	if ((*((gchar*) self)) == '\0') {
#line 1416 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp1_ = TRUE;
#line 181 "nsplugin-manager.c"
	} else {
		const gchar* _tmp2_;
#line 1416 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp2_ = old;
#line 1416 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp1_ = (*((gchar*) _tmp2_)) == '\0';
#line 188 "nsplugin-manager.c"
	}
#line 1416 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
	if (_tmp1_) {
#line 1416 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp0_ = TRUE;
#line 194 "nsplugin-manager.c"
	} else {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
#line 1416 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp3_ = old;
#line 1416 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp4_ = replacement;
#line 1416 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp0_ = g_strcmp0 (_tmp3_, _tmp4_) == 0;
#line 204 "nsplugin-manager.c"
	}
#line 1416 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
	if (_tmp0_) {
#line 208 "nsplugin-manager.c"
		gchar* _tmp5_;
#line 1417 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp5_ = g_strdup (self);
#line 1417 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		result = _tmp5_;
#line 1417 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		return result;
#line 216 "nsplugin-manager.c"
	}
	{
		GRegex* regex = NULL;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		GRegex* _tmp9_;
		GRegex* _tmp10_;
		gchar* _tmp11_ = NULL;
		GRegex* _tmp12_;
		const gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
#line 1420 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp6_ = old;
#line 1420 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp7_ = g_regex_escape_string (_tmp6_, -1);
#line 1420 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp8_ = _tmp7_;
#line 1420 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp9_ = g_regex_new (_tmp8_, 0, 0, &_inner_error_);
#line 1420 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp10_ = _tmp9_;
#line 1420 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_g_free0 (_tmp8_);
#line 1420 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		regex = _tmp10_;
#line 1420 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 1420 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
			if (_inner_error_->domain == G_REGEX_ERROR) {
#line 248 "nsplugin-manager.c"
				goto __catch1_g_regex_error;
			}
#line 1420 "/usr/share/vala-0.38/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 1420 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
			g_clear_error (&_inner_error_);
#line 1420 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
			return NULL;
#line 257 "nsplugin-manager.c"
		}
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp12_ = regex;
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp13_ = replacement;
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp14_ = g_regex_replace_literal (_tmp12_, self, (gssize) -1, 0, _tmp13_, 0, &_inner_error_);
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp11_ = _tmp14_;
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
			_g_regex_unref0 (regex);
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
			if (_inner_error_->domain == G_REGEX_ERROR) {
#line 273 "nsplugin-manager.c"
				goto __catch1_g_regex_error;
			}
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
			_g_regex_unref0 (regex);
#line 1421 "/usr/share/vala-0.38/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 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
			g_clear_error (&_inner_error_);
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
			return NULL;
#line 284 "nsplugin-manager.c"
		}
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp15_ = _tmp11_;
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_tmp11_ = NULL;
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		result = _tmp15_;
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_g_free0 (_tmp11_);
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_g_regex_unref0 (regex);
#line 1421 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		return result;
#line 298 "nsplugin-manager.c"
	}
	goto __finally1;
	__catch1_g_regex_error:
	{
		GError* e = NULL;
#line 1419 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		e = _inner_error_;
#line 1419 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_inner_error_ = NULL;
#line 1423 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		g_assert_not_reached ();
#line 1419 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		_g_error_free0 (e);
#line 312 "nsplugin-manager.c"
	}
	__finally1:
#line 1419 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 1419 "/usr/share/vala-0.38/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 1419 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		g_clear_error (&_inner_error_);
#line 1419 "/usr/share/vala-0.38/vapi/glib-2.0.vapi"
		return NULL;
#line 323 "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.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	ns_plugins_extension_activated ((NSPluginsExtension*) self, app);
#line 331 "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.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	ns_plugins_extension_deactivated ((NSPluginsExtension*) self);
#line 338 "nsplugin-manager.c"
}


NSPluginsExtension* ns_plugins_extension_construct (GType object_type, WebKitWebPlugin* plugin) {
	NSPluginsExtension * self = NULL;
	gchar* desc = NULL;
	WebKitWebPlugin* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	WebKitWebPlugin* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	WebKitWebPlugin* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	WebKitWebPlugin* _tmp20_;
	WebKitWebPlugin* _tmp21_;
	WebKitWebPlugin* _tmp22_;
	GError * _inner_error_ = NULL;
#line 31 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	g_return_val_if_fail (plugin != NULL, NULL);
#line 32 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp0_ = plugin;
#line 32 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp1_ = webkit_web_plugin_get_description (_tmp0_);
#line 32 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp2_ = g_strdup (_tmp1_);
#line 32 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	desc = _tmp2_;
#line 371 "nsplugin-manager.c"
	{
		GRegex* regex = NULL;
		GRegex* _tmp3_;
		gchar* _tmp4_ = NULL;
		GRegex* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
#line 34 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_tmp3_ = g_regex_new ("<a.+href.+>(.+)</a>", 0, 0, &_inner_error_);
#line 34 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		regex = _tmp3_;
#line 34 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 388 "nsplugin-manager.c"
			goto __catch0_g_error;
		}
#line 35 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_tmp5_ = regex;
#line 35 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_tmp6_ = desc;
#line 35 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/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.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_tmp4_ = _tmp7_;
#line 35 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 35 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
			_g_regex_unref0 (regex);
#line 403 "nsplugin-manager.c"
			goto __catch0_g_error;
		}
#line 35 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_tmp8_ = _tmp4_;
#line 35 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_tmp4_ = NULL;
#line 35 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_g_free0 (desc);
#line 35 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		desc = _tmp8_;
#line 36 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_tmp9_ = desc;
#line 36 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_tmp10_ = string_replace (_tmp9_, "<br>", "\n");
#line 36 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_g_free0 (desc);
#line 36 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		desc = _tmp10_;
#line 33 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_g_free0 (_tmp4_);
#line 33 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_g_regex_unref0 (regex);
#line 426 "nsplugin-manager.c"
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
#line 33 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_error_ = _inner_error_;
#line 33 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_inner_error_ = NULL;
#line 33 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_g_error_free0 (_error_);
#line 438 "nsplugin-manager.c"
	}
	__finally0:
#line 33 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 33 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		_g_free0 (desc);
#line 33 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/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.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		g_clear_error (&_inner_error_);
#line 33 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
		return NULL;
#line 451 "nsplugin-manager.c"
	}
#line 39 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp11_ = plugin;
#line 39 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp12_ = webkit_web_plugin_get_name (_tmp11_);
#line 39 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp13_ = desc;
#line 39 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp14_ = plugin;
#line 39 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp15_ = webkit_web_plugin_get_path (_tmp14_);
#line 39 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp16_ = g_path_get_basename (_tmp15_);
#line 39 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp17_ = _tmp16_;
#line 39 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp18_ = g_strdup_printf ("(%s)", "Netscape plugins");
#line 39 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp19_ = _tmp18_;
#line 39 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/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.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_g_free0 (_tmp19_);
#line 39 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_g_free0 (_tmp17_);
#line 47 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp20_ = plugin;
#line 47 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp21_ = _g_object_ref0 (_tmp20_);
#line 47 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_g_object_unref0 (self->plugin);
#line 47 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	self->plugin = _tmp21_;
#line 48 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_tmp22_ = self->plugin;
#line 48 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	webkit_web_plugin_set_enabled (_tmp22_, FALSE);
#line 50 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/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.11-2.i686/src/midori-0.5.11/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.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_g_free0 (desc);
#line 31 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	return self;
#line 497 "nsplugin-manager.c"
}


NSPluginsExtension* ns_plugins_extension_new (WebKitWebPlugin* plugin) {
#line 31 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	return ns_plugins_extension_construct (NS_PLUGINS_TYPE_EXTENSION, plugin);
#line 504 "nsplugin-manager.c"
}


static void ns_plugins_extension_class_init (NSPluginsExtensionClass * klass) {
#line 15 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	ns_plugins_extension_parent_class = g_type_class_peek_parent (klass);
#line 15 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	G_OBJECT_CLASS (klass)->finalize = ns_plugins_extension_finalize;
#line 513 "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.11-2.i686/src/midori-0.5.11/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.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	_g_object_unref0 (self->plugin);
#line 15 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	G_OBJECT_CLASS (ns_plugins_extension_parent_class)->finalize (obj);
#line 529 "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.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
#line 548 "nsplugin-manager.c"
}


static inline void _g_slist_free__g_object_unref0_ (GSList* self) {
#line 69 "/usr/src/ports/midori/midori-0.5.11-2.i686/src/midori-0.5.11/extensions/nsplugin-manager.vala"
	g_slist_free_full (self, (GDestroyNotify) _g_object_unref0_);
#line 555 "nsplugin-manager.c"
}


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



