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

/*
   Copyright (C) 2013 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 "midori/midori-app.h"
#include "midori/midori-browser.h"
#include "midori-core.h"
#include <sqlite3.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>
#include "flummi.h"


#define FLUMMI_TYPE_MANAGER (flummi_manager_get_type ())
#define FLUMMI_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLUMMI_TYPE_MANAGER, FlummiManager))
#define FLUMMI_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FLUMMI_TYPE_MANAGER, FlummiManagerClass))
#define FLUMMI_IS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLUMMI_TYPE_MANAGER))
#define FLUMMI_IS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FLUMMI_TYPE_MANAGER))
#define FLUMMI_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FLUMMI_TYPE_MANAGER, FlummiManagerClass))

typedef struct _FlummiManager FlummiManager;
typedef struct _FlummiManagerClass FlummiManagerClass;
typedef struct _FlummiManagerPrivate FlummiManagerPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _sqlite3_finalize0(var) ((var == NULL) ? NULL : (var = (sqlite3_finalize (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)))

struct _FlummiManager {
	MidoriExtension parent_instance;
	FlummiManagerPrivate * priv;
};

struct _FlummiManagerClass {
	MidoriExtensionClass parent_class;
};


static gpointer flummi_manager_parent_class = NULL;

GType flummi_manager_get_type (void) G_GNUC_CONST;
enum  {
	FLUMMI_MANAGER_DUMMY_PROPERTY
};
static gboolean flummi_manager_bounce (FlummiManager* self);
static void flummi_manager_activated (FlummiManager* self, MidoriApp* app);
static gboolean _flummi_manager_bounce_gsource_func (gpointer self);
FlummiManager* flummi_manager_new (void);
FlummiManager* flummi_manager_construct (GType object_type);
static void _flummi_manager_activated_midori_extension_activate (MidoriExtension* _sender, MidoriApp* app, gpointer self);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


static gpointer _g_object_ref0 (gpointer self) {
#line 16 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	return self ? g_object_ref (self) : NULL;
#line 75 "flummi.c"
}


static gboolean flummi_manager_bounce (FlummiManager* self) {
	gboolean result = FALSE;
	GError * _inner_error_ = NULL;
#line 14 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 84 "flummi.c"
	{
		MidoriApp* app = NULL;
		MidoriApp* _tmp0_ = NULL;
		MidoriApp* _tmp1_ = NULL;
		MidoriBrowser* browser = NULL;
		MidoriApp* _tmp2_ = NULL;
		MidoriBrowser* _tmp3_ = NULL;
		MidoriBrowser* _tmp4_ = NULL;
		MidoriBrowser* _tmp5_ = NULL;
		gboolean _tmp6_ = FALSE;
		MidoriBrowser* _tmp7_ = NULL;
		MidoriDatabase* database = NULL;
		MidoriDatabase* _tmp11_ = NULL;
		sqlite3* db = NULL;
		MidoriDatabase* _tmp12_ = NULL;
		sqlite3* _tmp13_ = NULL;
		sqlite3* _tmp14_ = NULL;
		gchar* sqlcmd = NULL;
		gchar* _tmp15_ = NULL;
		sqlite3_stmt* stmt = NULL;
		sqlite3* _tmp16_ = NULL;
		const gchar* _tmp17_ = NULL;
		sqlite3_stmt* _tmp18_ = NULL;
		gint _tmp19_ = 0;
		gint _result_ = 0;
		sqlite3_stmt* _tmp22_ = NULL;
		gint _tmp23_ = 0;
		gboolean _tmp24_ = FALSE;
		gint _tmp25_ = 0;
		sqlite3_stmt* del_stmt = NULL;
		gchar* _tmp29_ = NULL;
		sqlite3* _tmp30_ = NULL;
		const gchar* _tmp31_ = NULL;
		sqlite3_stmt* _tmp32_ = NULL;
		gint _tmp33_ = 0;
#line 16 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp0_ = midori_extension_get_app ((MidoriExtension*) self);
#line 16 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp1_ = _g_object_ref0 (_tmp0_);
#line 16 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		app = _tmp1_;
#line 17 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp2_ = app;
#line 17 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp3_ = midori_app_get_browser (_tmp2_);
#line 17 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp4_ = _tmp3_;
#line 17 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp5_ = _g_object_ref0 (_tmp4_);
#line 17 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		browser = _tmp5_;
#line 19 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp7_ = browser;
#line 19 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		if (_tmp7_ == NULL) {
#line 19 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp6_ = TRUE;
#line 142 "flummi.c"
		} else {
			MidoriBrowser* _tmp8_ = NULL;
			GtkWidget* _tmp9_ = NULL;
			GtkWidget* _tmp10_ = NULL;
#line 19 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp8_ = browser;
#line 19 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp9_ = midori_browser_get_tab (_tmp8_);
#line 19 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp10_ = _tmp9_;
#line 19 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp6_ = _tmp10_ == NULL;
#line 155 "flummi.c"
		}
#line 19 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		if (_tmp6_) {
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			result = TRUE;
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (browser);
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (app);
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			return result;
#line 167 "flummi.c"
		}
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp11_ = midori_database_new ("flummi.db", &_inner_error_);
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		database = _tmp11_;
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (browser);
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (app);
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			if (_inner_error_->domain == MIDORI_DATABASE_ERROR) {
#line 181 "flummi.c"
				goto __catch0_midori_database_error;
			}
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (browser);
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (app);
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			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 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			g_clear_error (&_inner_error_);
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			return FALSE;
#line 194 "flummi.c"
		}
#line 25 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp12_ = database;
#line 25 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp13_ = midori_database_get_db (_tmp12_);
#line 25 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp14_ = _tmp13_;
#line 25 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		db = _tmp14_;
#line 27 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp15_ = g_strdup ("SELECT id, once, command FROM tasks ORDER BY id;");
#line 27 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		sqlcmd = _tmp15_;
#line 30 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp16_ = db;
#line 30 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp17_ = sqlcmd;
#line 30 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp19_ = sqlite3_prepare_v2 (_tmp16_, _tmp17_, -1, &_tmp18_, NULL);
#line 30 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_sqlite3_finalize0 (stmt);
#line 30 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		stmt = _tmp18_;
#line 30 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		if (_tmp19_ != SQLITE_OK) {
#line 220 "flummi.c"
			sqlite3* _tmp20_ = NULL;
			const gchar* _tmp21_ = NULL;
#line 31 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp20_ = db;
#line 31 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp21_ = sqlite3_errmsg (_tmp20_);
#line 31 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			g_critical ("flummi.vala:31: Failed to select from database: %s", _tmp21_);
#line 32 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			result = FALSE;
#line 32 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_sqlite3_finalize0 (stmt);
#line 32 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_free0 (sqlcmd);
#line 32 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (database);
#line 32 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (browser);
#line 32 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (app);
#line 32 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			return result;
#line 243 "flummi.c"
		}
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp22_ = stmt;
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp23_ = sqlite3_step (_tmp22_);
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_result_ = _tmp23_;
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp25_ = _result_;
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		if (_tmp25_ == SQLITE_DONE) {
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp24_ = TRUE;
#line 257 "flummi.c"
		} else {
			gint _tmp26_ = 0;
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp26_ = _result_;
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp24_ = _tmp26_ == SQLITE_ROW;
#line 264 "flummi.c"
		}
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		if (!_tmp24_) {
#line 268 "flummi.c"
			sqlite3* _tmp27_ = NULL;
			const gchar* _tmp28_ = NULL;
#line 37 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp27_ = db;
#line 37 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp28_ = sqlite3_errmsg (_tmp27_);
#line 37 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			g_critical ("flummi.vala:37: Failed to select from database: %s", _tmp28_);
#line 38 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			result = FALSE;
#line 38 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_sqlite3_finalize0 (stmt);
#line 38 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_free0 (sqlcmd);
#line 38 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (database);
#line 38 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (browser);
#line 38 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (app);
#line 38 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			return result;
#line 291 "flummi.c"
		}
#line 42 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp29_ = g_strdup ("DELETE FROM `tasks` WHERE id = :task_id;");
#line 42 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_g_free0 (sqlcmd);
#line 42 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		sqlcmd = _tmp29_;
#line 43 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp30_ = db;
#line 43 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp31_ = sqlcmd;
#line 43 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp33_ = sqlite3_prepare_v2 (_tmp30_, _tmp31_, -1, &_tmp32_, NULL);
#line 43 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_sqlite3_finalize0 (del_stmt);
#line 43 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		del_stmt = _tmp32_;
#line 43 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		if (_tmp33_ != SQLITE_OK) {
#line 311 "flummi.c"
			sqlite3* _tmp34_ = NULL;
			const gchar* _tmp35_ = NULL;
#line 44 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp34_ = db;
#line 44 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp35_ = sqlite3_errmsg (_tmp34_);
#line 44 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			g_critical ("flummi.vala:44: Failed to update database: %s", _tmp35_);
#line 45 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			result = FALSE;
#line 45 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_sqlite3_finalize0 (del_stmt);
#line 45 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_sqlite3_finalize0 (stmt);
#line 45 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_free0 (sqlcmd);
#line 45 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (database);
#line 45 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (browser);
#line 45 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_object_unref0 (app);
#line 45 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			return result;
#line 336 "flummi.c"
		}
#line 48 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		while (TRUE) {
#line 340 "flummi.c"
			gint _tmp36_ = 0;
			gint64 id = 0LL;
			sqlite3_stmt* _tmp37_ = NULL;
			gint64 _tmp38_ = 0LL;
			gint64 once = 0LL;
			sqlite3_stmt* _tmp39_ = NULL;
			gint64 _tmp40_ = 0LL;
			gchar* command = NULL;
			sqlite3_stmt* _tmp41_ = NULL;
			const gchar* _tmp42_ = NULL;
			gchar* _tmp43_ = NULL;
			gchar** commands = NULL;
			const gchar* _tmp44_ = NULL;
			gchar* _tmp45_ = NULL;
			gchar** _tmp46_ = NULL;
			gint commands_length1 = 0;
			gint _commands_size_ = 0;
			MidoriApp* _tmp47_ = NULL;
			gchar** _tmp48_ = NULL;
			gint _tmp48__length1 = 0;
			gboolean _tmp49_ = FALSE;
			gint64 _tmp51_ = 0LL;
			sqlite3_stmt* _tmp61_ = NULL;
			gint _tmp62_ = 0;
#line 48 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp36_ = _result_;
#line 48 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			if (!(_tmp36_ == SQLITE_ROW)) {
#line 48 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				break;
#line 371 "flummi.c"
			}
#line 49 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp37_ = stmt;
#line 49 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp38_ = sqlite3_column_int64 (_tmp37_, 0);
#line 49 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			id = _tmp38_;
#line 50 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp39_ = stmt;
#line 50 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp40_ = sqlite3_column_int64 (_tmp39_, 1);
#line 50 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			once = _tmp40_;
#line 51 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp41_ = stmt;
#line 51 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp42_ = sqlite3_column_text (_tmp41_, 2);
#line 51 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp43_ = g_strdup (_tmp42_);
#line 51 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			command = _tmp43_;
#line 53 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp44_ = command;
#line 53 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp45_ = g_strdup (_tmp44_);
#line 53 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp46_ = g_new0 (gchar*, 1 + 1);
#line 53 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp46_[0] = _tmp45_;
#line 53 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			commands = _tmp46_;
#line 53 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			commands_length1 = 1;
#line 53 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_commands_size_ = commands_length1;
#line 55 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp47_ = app;
#line 55 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp48_ = commands;
#line 55 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp48__length1 = commands_length1;
#line 55 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp49_ = midori_app_send_command (_tmp47_, _tmp48_);
#line 55 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			if (!_tmp49_) {
#line 417 "flummi.c"
				const gchar* _tmp50_ = NULL;
#line 56 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_tmp50_ = command;
#line 56 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				g_critical ("flummi.vala:56: Command failed: %s", _tmp50_);
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				result = FALSE;
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				commands = (_vala_array_free (commands, commands_length1, (GDestroyNotify) g_free), NULL);
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_g_free0 (command);
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_sqlite3_finalize0 (del_stmt);
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_sqlite3_finalize0 (stmt);
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_g_free0 (sqlcmd);
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_g_object_unref0 (database);
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_g_object_unref0 (browser);
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_g_object_unref0 (app);
#line 57 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				return result;
#line 443 "flummi.c"
			}
#line 60 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp51_ = once;
#line 60 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			if (_tmp51_ > ((gint64) 0)) {
#line 449 "flummi.c"
				sqlite3_stmt* _tmp52_ = NULL;
				sqlite3_stmt* _tmp53_ = NULL;
				gint _tmp54_ = 0;
				gint64 _tmp55_ = 0LL;
				sqlite3_stmt* _tmp56_ = NULL;
				gint _tmp57_ = 0;
#line 61 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_tmp52_ = del_stmt;
#line 61 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_tmp53_ = del_stmt;
#line 61 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_tmp54_ = sqlite3_bind_parameter_index (_tmp53_, ":task_id");
#line 61 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_tmp55_ = id;
#line 61 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				sqlite3_bind_int64 (_tmp52_, _tmp54_, _tmp55_);
#line 62 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_tmp56_ = del_stmt;
#line 62 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				_tmp57_ = sqlite3_step (_tmp56_);
#line 62 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
				if (_tmp57_ != SQLITE_DONE) {
#line 472 "flummi.c"
					gint64 _tmp58_ = 0LL;
					sqlite3* _tmp59_ = NULL;
					const gchar* _tmp60_ = NULL;
#line 63 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					_tmp58_ = id;
#line 63 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					_tmp59_ = db;
#line 63 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					_tmp60_ = sqlite3_errmsg (_tmp59_);
#line 63 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					g_critical ("flummi.vala:63: Failed to delete record %lf.\nError: %s", (gdouble) _tmp58_, _tmp60_);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					result = FALSE;
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					commands = (_vala_array_free (commands, commands_length1, (GDestroyNotify) g_free), NULL);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					_g_free0 (command);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					_sqlite3_finalize0 (del_stmt);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					_sqlite3_finalize0 (stmt);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					_g_free0 (sqlcmd);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					_g_object_unref0 (database);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					_g_object_unref0 (browser);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					_g_object_unref0 (app);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
					return result;
#line 504 "flummi.c"
				}
			}
#line 68 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp61_ = stmt;
#line 68 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_tmp62_ = sqlite3_step (_tmp61_);
#line 68 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_result_ = _tmp62_;
#line 48 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			commands = (_vala_array_free (commands, commands_length1, (GDestroyNotify) g_free), NULL);
#line 48 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
			_g_free0 (command);
#line 517 "flummi.c"
		}
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_sqlite3_finalize0 (del_stmt);
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_sqlite3_finalize0 (stmt);
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_g_free0 (sqlcmd);
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_g_object_unref0 (database);
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_g_object_unref0 (browser);
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_g_object_unref0 (app);
#line 531 "flummi.c"
	}
	goto __finally0;
	__catch0_midori_database_error:
	{
		GError* schema_error = NULL;
		const gchar* _tmp63_ = NULL;
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		schema_error = _inner_error_;
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_inner_error_ = NULL;
#line 71 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_tmp63_ = schema_error->message;
#line 71 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		g_error ("flummi.vala:71: %s", _tmp63_);
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		_g_error_free0 (schema_error);
#line 548 "flummi.c"
	}
	__finally0:
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.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 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		g_clear_error (&_inner_error_);
#line 15 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
		return FALSE;
#line 559 "flummi.c"
	}
#line 74 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	result = FALSE;
#line 74 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	return result;
#line 565 "flummi.c"
}


static gboolean _flummi_manager_bounce_gsource_func (gpointer self) {
	gboolean result;
	result = flummi_manager_bounce ((FlummiManager*) self);
#line 78 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	return result;
#line 574 "flummi.c"
}


static void flummi_manager_activated (FlummiManager* self, MidoriApp* app) {
#line 77 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	g_return_if_fail (self != NULL);
#line 77 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	g_return_if_fail (app != NULL);
#line 78 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _flummi_manager_bounce_gsource_func, g_object_ref (self), g_object_unref);
#line 585 "flummi.c"
}


static void _flummi_manager_activated_midori_extension_activate (MidoriExtension* _sender, MidoriApp* app, gpointer self) {
#line 87 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	flummi_manager_activated ((FlummiManager*) self, app);
#line 592 "flummi.c"
}


FlummiManager* flummi_manager_construct (GType object_type) {
	FlummiManager * self = NULL;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
#line 82 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	_tmp0_ = _ ("Flummi");
#line 82 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	_tmp1_ = _ ("This extension provides a task queue for update jobs or recurring even" \
"ts.");
#line 82 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	self = (FlummiManager*) g_object_new (object_type, "name", _tmp0_, "description", _tmp1_, "version", "0.1", "authors", "André Stösel <andre@stoesel.de>", NULL);
#line 87 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	g_signal_connect_object ((MidoriExtension*) self, "activate", (GCallback) _flummi_manager_activated_midori_extension_activate, self, 0);
#line 81 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	return self;
#line 610 "flummi.c"
}


FlummiManager* flummi_manager_new (void) {
#line 81 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	return flummi_manager_construct (FLUMMI_TYPE_MANAGER);
#line 617 "flummi.c"
}


static void flummi_manager_class_init (FlummiManagerClass * klass) {
#line 13 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	flummi_manager_parent_class = g_type_class_peek_parent (klass);
#line 624 "flummi.c"
}


static void flummi_manager_instance_init (FlummiManager * self) {
}


GType flummi_manager_get_type (void) {
	static volatile gsize flummi_manager_type_id__volatile = 0;
	if (g_once_init_enter (&flummi_manager_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FlummiManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) flummi_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FlummiManager), 0, (GInstanceInitFunc) flummi_manager_instance_init, NULL };
		GType flummi_manager_type_id;
		flummi_manager_type_id = g_type_register_static (MIDORI_TYPE_EXTENSION, "FlummiManager", &g_define_type_info, 0);
		g_once_init_leave (&flummi_manager_type_id__volatile, flummi_manager_type_id);
	}
	return flummi_manager_type_id__volatile;
}


MidoriExtension* extension_init (void) {
	MidoriExtension* result = NULL;
	FlummiManager* _tmp0_ = NULL;
#line 93 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	_tmp0_ = flummi_manager_new ();
#line 93 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	result = (MidoriExtension*) _tmp0_;
#line 93 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/extensions/flummi.vala"
	return result;
#line 653 "flummi.c"
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



