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

/*
 Copyright (C) 2012-2013 Christian Dywan <christian@twotoasts.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 <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include "webkit/webkit.h"
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include <glib/gstdio.h>
#include <unistd.h>

#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define MIDORI_TYPE_TAB (midori_tab_get_type ())
#define MIDORI_TAB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_TAB, MidoriTab))
#define MIDORI_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIDORI_TYPE_TAB, MidoriTabClass))
#define MIDORI_IS_TAB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_TAB))
#define MIDORI_IS_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIDORI_TYPE_TAB))
#define MIDORI_TAB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIDORI_TYPE_TAB, MidoriTabClass))

typedef struct _MidoriTab MidoriTab;
typedef struct _MidoriTabClass MidoriTabClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))



gboolean sokoke_message_dialog (GtkMessageType type, const gchar* _short_, const gchar* detailed, gboolean modal);
gboolean midori_download_is_finished (WebKitDownload* download);
gint midori_download_get_type (WebKitDownload* download);
void midori_download_set_type (WebKitDownload* download, gint type);
gdouble midori_download_get_progress (WebKitDownload* download);
gchar* midori_download_calculate_tooltip (WebKitDownload* download);
gchar* midori_download_get_basename_for_display (const gchar* uri);
static guint64* _uint64_dup (guint64* self);
static gboolean _uint64_equal (const guint64* s1, const guint64* s2);
gchar* midori_download_get_content_type (WebKitDownload* download, const gchar* mime_type);
gboolean midori_download_has_wrong_checksum (WebKitDownload* download);
GChecksumType midori_uri_get_fingerprint (const gchar* uri, gchar** checksum, gchar** label);
gboolean midori_download_action_clear (WebKitDownload* download, GtkWidget* widget, GError** error);
gboolean midori_download_open (WebKitDownload* download, GtkWidget* widget, GError** error);
gchar* midori_download_action_stock_id (WebKitDownload* download);
GType midori_tab_get_type (void) G_GNUC_CONST;
const gchar* midori_download_fallback_extension (const gchar* extension, const gchar* mime_type);
gchar* midori_download_clean_filename (const gchar* filename);
gchar* midori_download_get_suggested_filename (WebKitDownload* download);
gchar* midori_download_get_filename_suggestion_for_uri (const gchar* mime_type, const gchar* uri);
gboolean midori_uri_is_location (const gchar* uri);
gchar* midori_download_get_extension_for_uri (const gchar* uri, gchar** basename);
gchar* midori_download_get_unique_filename (const gchar* filename);
gchar* midori_download_prepare_destination_uri (WebKitDownload* download, const gchar* folder);
const gchar* midori_paths_get_tmp_dir (void);
gchar* katze_mkdir_with_parents (const gchar* pathname, gint mode);
gboolean midori_download_has_enough_space (WebKitDownload* download, const gchar* destination_uri, gboolean quiet);


gboolean midori_download_is_finished (WebKitDownload* download) {
	gboolean result = FALSE;
	WebKitDownload* _tmp0_ = NULL;
	WebKitDownloadStatus _tmp1_ = 0;
	WebKitDownloadStatus _tmp2_ = 0;
#line 18 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, FALSE);
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = webkit_download_get_status (_tmp0_);
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = _tmp1_;
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	switch (_tmp2_) {
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_FINISHED:
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_CANCELLED:
#line 20 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_ERROR:
#line 95 "midori-download.c"
		{
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			result = TRUE;
#line 24 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			return result;
#line 101 "midori-download.c"
		}
		default:
		{
#line 26 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			result = FALSE;
#line 26 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			return result;
#line 109 "midori-download.c"
		}
	}
}


gint midori_download_get_type (WebKitDownload* download) {
	gint result = 0;
	WebKitDownload* _tmp0_ = NULL;
	gconstpointer _tmp1_ = NULL;
#line 35 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, 0);
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = g_object_get_data ((GObject*) _tmp0_, "midori-download-type");
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = (gint) ((gintptr) _tmp1_);
#line 36 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 129 "midori-download.c"
}


void midori_download_set_type (WebKitDownload* download, gint type) {
	WebKitDownload* _tmp0_ = NULL;
	gint _tmp1_ = 0;
#line 39 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_if_fail (download != NULL);
#line 40 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 40 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = type;
#line 40 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_object_set_data_full ((GObject*) _tmp0_, "midori-download-type", (gpointer) ((gintptr) _tmp1_), NULL);
#line 144 "midori-download.c"
}


gdouble midori_download_get_progress (WebKitDownload* download) {
	gdouble result = 0.0;
	WebKitDownload* _tmp0_ = NULL;
	WebKitDownloadStatus _tmp1_ = 0;
	WebKitDownloadStatus _tmp2_ = 0;
	WebKitDownload* _tmp3_ = NULL;
	gdouble _tmp4_ = 0.0;
	gdouble _tmp5_ = 0.0;
#line 51 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, 0.0);
#line 54 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 54 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = webkit_download_get_status (_tmp0_);
#line 54 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = _tmp1_;
#line 54 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp2_ == WEBKIT_DOWNLOAD_STATUS_CREATED) {
#line 55 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = 0.0;
#line 55 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 170 "midori-download.c"
	}
#line 56 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp3_ = download;
#line 56 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp4_ = webkit_download_get_progress (_tmp3_);
#line 56 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp5_ = _tmp4_;
#line 56 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = _tmp5_;
#line 56 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 182 "midori-download.c"
}


static guint64* _uint64_dup (guint64* self) {
	guint64* dup;
#line 103 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	dup = g_new0 (guint64, 1);
#line 103 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	memcpy (dup, self, sizeof (guint64));
#line 103 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return dup;
#line 194 "midori-download.c"
}


static gpointer __uint64_dup0 (gpointer self) {
#line 103 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return self ? _uint64_dup (self) : NULL;
#line 201 "midori-download.c"
}


static gboolean _uint64_equal (const guint64* s1, const guint64* s2) {
#line 105 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (s1 == s2) {
#line 105 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return TRUE;
#line 210 "midori-download.c"
	}
#line 105 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (s1 == NULL) {
#line 105 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return FALSE;
#line 216 "midori-download.c"
	}
#line 105 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (s2 == NULL) {
#line 105 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return FALSE;
#line 222 "midori-download.c"
	}
#line 105 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return (*s1) == (*s2);
#line 226 "midori-download.c"
}


gchar* midori_download_calculate_tooltip (WebKitDownload* download) {
	gchar* result = NULL;
	gchar* filename = NULL;
	WebKitDownload* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gchar* size = NULL;
	const gchar* _tmp4_ = NULL;
	WebKitDownload* _tmp5_ = NULL;
	guint64 _tmp6_ = 0ULL;
	guint64 _tmp7_ = 0ULL;
	gchar* _tmp8_ = NULL;
	gchar* _tmp9_ = NULL;
	WebKitDownload* _tmp10_ = NULL;
	guint64 _tmp11_ = 0ULL;
	guint64 _tmp12_ = 0ULL;
	gchar* _tmp13_ = NULL;
	gchar* _tmp14_ = NULL;
	gchar* _tmp15_ = NULL;
	gchar* _tmp16_ = NULL;
	gboolean _tmp17_ = FALSE;
	WebKitDownload* _tmp18_ = NULL;
	gboolean _tmp19_ = FALSE;
	guint64 total_size = 0ULL;
	WebKitDownload* _tmp26_ = NULL;
	guint64 _tmp27_ = 0ULL;
	guint64 _tmp28_ = 0ULL;
	guint64 current_size = 0ULL;
	WebKitDownload* _tmp29_ = NULL;
	guint64 _tmp30_ = 0ULL;
	guint64 _tmp31_ = 0ULL;
	gdouble elapsed = 0.0;
	WebKitDownload* _tmp32_ = NULL;
	gdouble _tmp33_ = 0.0;
	gdouble diff = 0.0;
	gdouble _tmp34_ = 0.0;
	guint64 _tmp35_ = 0ULL;
	gdouble estimated = 0.0;
	guint64 _tmp36_ = 0ULL;
	guint64 _tmp37_ = 0ULL;
	gdouble _tmp38_ = 0.0;
	gint hour = 0;
	gint minute = 0;
	gint hours = 0;
	gdouble _tmp39_ = 0.0;
	gint _tmp40_ = 0;
	gint minutes = 0;
	gdouble _tmp41_ = 0.0;
	gint _tmp42_ = 0;
	gint _tmp43_ = 0;
	gint _tmp44_ = 0;
	gint seconds = 0;
	gdouble _tmp45_ = 0.0;
	gint _tmp46_ = 0;
	gint _tmp47_ = 0;
	gint _tmp48_ = 0;
	gint _tmp49_ = 0;
	gchar* hours_ = NULL;
	gint _tmp50_ = 0;
	const gchar* _tmp51_ = NULL;
	gint _tmp52_ = 0;
	gchar* _tmp53_ = NULL;
	gchar* minutes_ = NULL;
	gint _tmp54_ = 0;
	const gchar* _tmp55_ = NULL;
	gint _tmp56_ = 0;
	gchar* _tmp57_ = NULL;
	gchar* seconds_ = NULL;
	gint _tmp58_ = 0;
	const gchar* _tmp59_ = NULL;
	gint _tmp60_ = 0;
	gchar* _tmp61_ = NULL;
	gdouble last_time = 0.0;
	WebKitDownload* _tmp62_ = NULL;
	gconstpointer _tmp63_ = NULL;
	gchar* eta = NULL;
	gchar* _tmp64_ = NULL;
	gdouble _tmp65_ = 0.0;
	gchar* speed = NULL;
	gchar* _tmp90_ = NULL;
	guint64* last_size = NULL;
	WebKitDownload* _tmp91_ = NULL;
	gconstpointer _tmp92_ = NULL;
	guint64* _tmp93_ = NULL;
	gboolean _tmp94_ = FALSE;
	guint64* _tmp95_ = NULL;
	const gchar* _tmp113_ = NULL;
	const gchar* _tmp114_ = NULL;
	gchar* _tmp115_ = NULL;
	gdouble _tmp116_ = 0.0;
	gdouble _tmp117_ = 0.0;
	const gchar* _tmp123_ = NULL;
	const gchar* _tmp124_ = NULL;
	const gchar* _tmp125_ = NULL;
	const gchar* _tmp126_ = NULL;
	gchar* _tmp127_ = NULL;
#line 62 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, NULL);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = webkit_download_get_destination_uri (_tmp0_);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = _tmp1_;
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp3_ = midori_download_get_basename_for_display (_tmp2_);
#line 64 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	filename = _tmp3_;
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp4_ = _ ("%s of %s");
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp5_ = download;
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp6_ = webkit_download_get_current_size (_tmp5_);
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp7_ = _tmp6_;
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp8_ = g_format_size_full (_tmp7_, G_FORMAT_SIZE_DEFAULT);
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp9_ = _tmp8_;
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp10_ = download;
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp11_ = webkit_download_get_total_size (_tmp10_);
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp12_ = _tmp11_;
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp13_ = g_format_size_full (_tmp12_, G_FORMAT_SIZE_DEFAULT);
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp14_ = _tmp13_;
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp15_ = g_strdup_printf (_tmp4_, _tmp9_, _tmp14_);
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp16_ = _tmp15_;
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (_tmp14_);
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (_tmp9_);
#line 66 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	size = _tmp16_;
#line 71 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp18_ = download;
#line 71 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp19_ = midori_download_is_finished (_tmp18_);
#line 71 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp19_) {
#line 71 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp17_ = TRUE;
#line 379 "midori-download.c"
	} else {
		WebKitDownload* _tmp20_ = NULL;
		WebKitDownloadStatus _tmp21_ = 0;
		WebKitDownloadStatus _tmp22_ = 0;
#line 71 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp20_ = download;
#line 71 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp21_ = webkit_download_get_status (_tmp20_);
#line 71 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp22_ = _tmp21_;
#line 71 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp17_ = _tmp22_ == WEBKIT_DOWNLOAD_STATUS_CREATED;
#line 392 "midori-download.c"
	}
#line 71 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp17_) {
#line 396 "midori-download.c"
		const gchar* _tmp23_ = NULL;
		const gchar* _tmp24_ = NULL;
		gchar* _tmp25_ = NULL;
#line 72 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp23_ = filename;
#line 72 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp24_ = size;
#line 72 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp25_ = g_strdup_printf ("%s\n%s", _tmp23_, _tmp24_);
#line 72 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = _tmp25_;
#line 72 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (size);
#line 72 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (filename);
#line 72 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 414 "midori-download.c"
	}
#line 74 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp26_ = download;
#line 74 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp27_ = webkit_download_get_total_size (_tmp26_);
#line 74 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp28_ = _tmp27_;
#line 74 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	total_size = _tmp28_;
#line 74 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp29_ = download;
#line 74 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp30_ = webkit_download_get_current_size (_tmp29_);
#line 74 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp31_ = _tmp30_;
#line 74 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	current_size = _tmp31_;
#line 75 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp32_ = download;
#line 75 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp33_ = webkit_download_get_elapsed_time (_tmp32_);
#line 75 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	elapsed = _tmp33_;
#line 76 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp34_ = elapsed;
#line 76 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp35_ = current_size;
#line 76 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	diff = _tmp34_ / _tmp35_;
#line 77 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp36_ = total_size;
#line 77 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp37_ = current_size;
#line 77 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp38_ = diff;
#line 77 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	estimated = (_tmp36_ - _tmp37_) * _tmp38_;
#line 78 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	hour = 3600;
#line 78 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	minute = 60;
#line 79 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp39_ = estimated;
#line 79 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp40_ = hour;
#line 79 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	hours = (gint) (_tmp39_ / _tmp40_);
#line 80 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp41_ = estimated;
#line 80 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp42_ = hours;
#line 80 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp43_ = hour;
#line 80 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp44_ = minute;
#line 80 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	minutes = (gint) ((_tmp41_ - (_tmp42_ * _tmp43_)) / _tmp44_);
#line 81 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp45_ = estimated;
#line 81 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp46_ = hours;
#line 81 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp47_ = hour;
#line 81 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp48_ = minutes;
#line 81 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp49_ = minute;
#line 81 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	seconds = (gint) ((_tmp45_ - (_tmp46_ * _tmp47_)) - (_tmp48_ * _tmp49_));
#line 82 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp50_ = hours;
#line 82 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp51_ = ngettext ("%d hour", "%d hours", (gulong) _tmp50_);
#line 82 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp52_ = hours;
#line 82 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp53_ = g_strdup_printf (_tmp51_, _tmp52_);
#line 82 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	hours_ = _tmp53_;
#line 83 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp54_ = minutes;
#line 83 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp55_ = ngettext ("%d minute", "%d minutes", (gulong) _tmp54_);
#line 83 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp56_ = minutes;
#line 83 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp57_ = g_strdup_printf (_tmp55_, _tmp56_);
#line 83 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	minutes_ = _tmp57_;
#line 84 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp58_ = seconds;
#line 84 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp59_ = ngettext ("%d second", "%d seconds", (gulong) _tmp58_);
#line 84 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp60_ = seconds;
#line 84 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp61_ = g_strdup_printf (_tmp59_, _tmp60_);
#line 84 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	seconds_ = _tmp61_;
#line 85 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp62_ = download;
#line 85 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp63_ = g_object_get_data ((GObject*) _tmp62_, "last-time");
#line 85 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	last_time = (gdouble) ((gint) ((gintptr) _tmp63_));
#line 87 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp64_ = g_strdup ("");
#line 87 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	eta = _tmp64_;
#line 88 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp65_ = estimated;
#line 88 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp65_ > ((gdouble) 0)) {
#line 528 "midori-download.c"
		gint _tmp66_ = 0;
		const gchar* _tmp86_ = NULL;
#line 89 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp66_ = hours;
#line 89 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (_tmp66_ > 0) {
#line 535 "midori-download.c"
			const gchar* _tmp67_ = NULL;
			gchar* _tmp68_ = NULL;
			gchar* _tmp69_ = NULL;
			const gchar* _tmp70_ = NULL;
			gchar* _tmp71_ = NULL;
#line 90 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp67_ = hours_;
#line 90 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp68_ = g_strconcat (_tmp67_, ", ", NULL);
#line 90 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp69_ = _tmp68_;
#line 90 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp70_ = minutes_;
#line 90 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp71_ = g_strconcat (_tmp69_, _tmp70_, NULL);
#line 90 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (eta);
#line 90 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			eta = _tmp71_;
#line 90 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (_tmp69_);
#line 557 "midori-download.c"
		} else {
			gint _tmp72_ = 0;
#line 91 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp72_ = minutes;
#line 91 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			if (_tmp72_ >= 10) {
#line 564 "midori-download.c"
				const gchar* _tmp73_ = NULL;
				gchar* _tmp74_ = NULL;
#line 92 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp73_ = minutes_;
#line 92 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp74_ = g_strdup (_tmp73_);
#line 92 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (eta);
#line 92 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				eta = _tmp74_;
#line 575 "midori-download.c"
			} else {
				gboolean _tmp75_ = FALSE;
				gint _tmp76_ = 0;
#line 93 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp76_ = minutes;
#line 93 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				if (_tmp76_ < 10) {
#line 583 "midori-download.c"
					gint _tmp77_ = 0;
#line 93 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp77_ = minutes;
#line 93 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp75_ = _tmp77_ > 0;
#line 589 "midori-download.c"
				} else {
#line 93 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp75_ = FALSE;
#line 593 "midori-download.c"
				}
#line 93 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				if (_tmp75_) {
#line 597 "midori-download.c"
					const gchar* _tmp78_ = NULL;
					gchar* _tmp79_ = NULL;
					gchar* _tmp80_ = NULL;
					const gchar* _tmp81_ = NULL;
					gchar* _tmp82_ = NULL;
#line 94 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp78_ = minutes_;
#line 94 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp79_ = g_strconcat (_tmp78_, ", ", NULL);
#line 94 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp80_ = _tmp79_;
#line 94 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp81_ = seconds_;
#line 94 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp82_ = g_strconcat (_tmp80_, _tmp81_, NULL);
#line 94 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_g_free0 (eta);
#line 94 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					eta = _tmp82_;
#line 94 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_g_free0 (_tmp80_);
#line 619 "midori-download.c"
				} else {
					gint _tmp83_ = 0;
#line 95 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp83_ = seconds;
#line 95 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					if (_tmp83_ > 0) {
#line 626 "midori-download.c"
						const gchar* _tmp84_ = NULL;
						gchar* _tmp85_ = NULL;
#line 96 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
						_tmp84_ = seconds_;
#line 96 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
						_tmp85_ = g_strdup (_tmp84_);
#line 96 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
						_g_free0 (eta);
#line 96 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
						eta = _tmp85_;
#line 637 "midori-download.c"
					}
				}
			}
		}
#line 97 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp86_ = eta;
#line 97 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (g_strcmp0 (_tmp86_, "") != 0) {
#line 646 "midori-download.c"
			const gchar* _tmp87_ = NULL;
			const gchar* _tmp88_ = NULL;
			gchar* _tmp89_ = NULL;
#line 99 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp87_ = _ (" - %s remaining");
#line 99 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp88_ = eta;
#line 99 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp89_ = g_strdup_printf (_tmp87_, _tmp88_);
#line 99 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (eta);
#line 99 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			eta = _tmp89_;
#line 660 "midori-download.c"
		}
	}
#line 102 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp90_ = g_strdup ("");
#line 102 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	speed = _tmp90_;
#line 103 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp91_ = download;
#line 103 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp92_ = g_object_get_data ((GObject*) _tmp91_, "last-size");
#line 103 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp93_ = __uint64_dup0 ((guint64*) _tmp92_);
#line 103 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	last_size = _tmp93_;
#line 104 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp95_ = last_size;
#line 104 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp95_ != NULL) {
#line 679 "midori-download.c"
		gdouble _tmp96_ = 0.0;
		gdouble _tmp97_ = 0.0;
#line 104 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp96_ = elapsed;
#line 104 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp97_ = last_time;
#line 104 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp94_ = _tmp96_ != _tmp97_;
#line 688 "midori-download.c"
	} else {
#line 104 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp94_ = FALSE;
#line 692 "midori-download.c"
	}
#line 104 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp94_) {
#line 696 "midori-download.c"
		guint64 _tmp98_ = 0ULL;
		guint64* _tmp99_ = NULL;
#line 105 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp98_ = current_size;
#line 105 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp99_ = last_size;
#line 105 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (_uint64_equal (&_tmp98_, _tmp99_) != TRUE) {
#line 705 "midori-download.c"
			guint64 _tmp100_ = 0ULL;
			guint64* _tmp101_ = NULL;
			gdouble _tmp102_ = 0.0;
			gdouble _tmp103_ = 0.0;
			gchar* _tmp104_ = NULL;
			WebKitDownload* _tmp105_ = NULL;
			const gchar* _tmp106_ = NULL;
			gchar* _tmp107_ = NULL;
#line 106 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp100_ = current_size;
#line 106 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp101_ = last_size;
#line 106 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp102_ = elapsed;
#line 106 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp103_ = last_time;
#line 106 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp104_ = g_format_size_full ((guint64) ((_tmp100_ - (*_tmp101_)) / (_tmp102_ - _tmp103_)), G_FORMAT_SIZE_DEFAULT);
#line 106 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (speed);
#line 106 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			speed = _tmp104_;
#line 108 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp105_ = download;
#line 108 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp106_ = speed;
#line 108 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp107_ = g_strdup (_tmp106_);
#line 108 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			g_object_set_data_full ((GObject*) _tmp105_, "last-speed", _tmp107_, g_free);
#line 736 "midori-download.c"
		} else {
			WebKitDownload* _tmp108_ = NULL;
			gconstpointer _tmp109_ = NULL;
			gchar* _tmp110_ = NULL;
#line 111 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp108_ = download;
#line 111 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp109_ = g_object_get_data ((GObject*) _tmp108_, "last-speed");
#line 111 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp110_ = g_strdup ((const gchar*) _tmp109_);
#line 111 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (speed);
#line 111 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			speed = _tmp110_;
#line 751 "midori-download.c"
		}
	} else {
		const gchar* _tmp111_ = NULL;
		gchar* _tmp112_ = NULL;
#line 116 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp111_ = _ ("?B");
#line 116 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp112_ = g_strdup (_tmp111_);
#line 116 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (speed);
#line 116 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		speed = _tmp112_;
#line 764 "midori-download.c"
	}
#line 118 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp113_ = _ (" (%s/s)");
#line 118 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp114_ = speed;
#line 118 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp115_ = g_strdup_printf (_tmp113_, _tmp114_);
#line 118 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (speed);
#line 118 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	speed = _tmp115_;
#line 120 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp116_ = elapsed;
#line 120 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp117_ = last_time;
#line 120 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if ((_tmp116_ - _tmp117_) > 0.0) {
#line 782 "midori-download.c"
		WebKitDownload* _tmp118_ = NULL;
		gdouble _tmp119_ = 0.0;
		WebKitDownload* _tmp120_ = NULL;
		guint64 _tmp121_ = 0ULL;
		guint64* _tmp122_ = NULL;
#line 121 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp118_ = download;
#line 121 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp119_ = elapsed;
#line 121 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		g_object_set_data_full ((GObject*) _tmp118_, "last-time", (gpointer) ((gintptr) ((gint) _tmp119_)), NULL);
#line 122 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp120_ = download;
#line 122 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp121_ = current_size;
#line 122 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp122_ = __uint64_dup0 (&_tmp121_);
#line 122 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		g_object_set_data_full ((GObject*) _tmp120_, "last-size", _tmp122_, g_free);
#line 802 "midori-download.c"
	}
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp123_ = filename;
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp124_ = size;
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp125_ = speed;
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp126_ = eta;
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp127_ = g_strdup_printf ("%s\n%s %s%s", _tmp123_, _tmp124_, _tmp125_, _tmp126_);
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = _tmp127_;
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (last_size);
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (speed);
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (eta);
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (seconds_);
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (minutes_);
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (hours_);
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (size);
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (filename);
#line 125 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 834 "midori-download.c"
}


gchar* midori_download_get_content_type (WebKitDownload* download, const gchar* mime_type) {
	gchar* result = NULL;
	gchar* content_type = NULL;
	WebKitDownload* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
#line 140 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, NULL);
#line 146 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 146 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = webkit_download_get_suggested_filename (_tmp0_);
#line 146 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = _tmp1_;
#line 146 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp3_ = g_content_type_guess (_tmp2_, NULL, (gsize) 0, NULL);
#line 146 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	content_type = _tmp3_;
#line 148 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp4_ = content_type;
#line 148 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp4_ == NULL) {
#line 862 "midori-download.c"
		const gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
#line 149 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp5_ = mime_type;
#line 149 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp6_ = g_content_type_from_mime_type (_tmp5_);
#line 149 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (content_type);
#line 149 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		content_type = _tmp6_;
#line 150 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp7_ = content_type;
#line 150 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (_tmp7_ == NULL) {
#line 878 "midori-download.c"
			gchar* _tmp8_ = NULL;
#line 151 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp8_ = g_content_type_from_mime_type ("application/octet-stream");
#line 151 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (content_type);
#line 151 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			content_type = _tmp8_;
#line 886 "midori-download.c"
		}
	}
#line 153 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = content_type;
#line 153 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 893 "midori-download.c"
}


gboolean midori_download_has_wrong_checksum (WebKitDownload* download) {
	gboolean result = FALSE;
	gint status = 0;
	WebKitDownload* _tmp0_ = NULL;
	gconstpointer _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gint _tmp35_ = 0;
	GError * _inner_error_ = NULL;
#line 156 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, FALSE);
#line 157 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 157 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = g_object_get_data ((GObject*) _tmp0_, "checksum-status");
#line 157 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	status = (gint) ((gintptr) _tmp1_);
#line 158 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = status;
#line 158 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp2_ == 0) {
#line 917 "midori-download.c"
		gchar* original_uri = NULL;
		WebKitDownload* _tmp3_ = NULL;
		WebKitNetworkRequest* _tmp4_ = NULL;
		WebKitNetworkRequest* _tmp5_ = NULL;
		gconstpointer _tmp6_ = NULL;
		gchar* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		gchar* fingerprint = NULL;
		GChecksumType checksum_type = 0;
		const gchar* _tmp12_ = NULL;
		gchar* _tmp13_ = NULL;
		GChecksumType _tmp14_ = 0;
		const gchar* _tmp15_ = NULL;
		WebKitDownload* _tmp33_ = NULL;
		gint _tmp34_ = 0;
#line 163 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp3_ = download;
#line 163 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp4_ = webkit_download_get_network_request (_tmp3_);
#line 163 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp5_ = _tmp4_;
#line 163 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp6_ = g_object_get_data ((GObject*) _tmp5_, "midori-original-uri");
#line 163 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp7_ = g_strdup ((const gchar*) _tmp6_);
#line 163 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		original_uri = _tmp7_;
#line 164 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp8_ = original_uri;
#line 164 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (_tmp8_ == NULL) {
#line 949 "midori-download.c"
			WebKitDownload* _tmp9_ = NULL;
			const gchar* _tmp10_ = NULL;
			gchar* _tmp11_ = NULL;
#line 165 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp9_ = download;
#line 165 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp10_ = webkit_download_get_uri (_tmp9_);
#line 165 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp11_ = g_strdup (_tmp10_);
#line 165 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (original_uri);
#line 165 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			original_uri = _tmp11_;
#line 963 "midori-download.c"
		}
#line 168 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp12_ = original_uri;
#line 168 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp14_ = midori_uri_get_fingerprint (_tmp12_, &_tmp13_, NULL);
#line 168 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (fingerprint);
#line 168 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		fingerprint = _tmp13_;
#line 168 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		checksum_type = _tmp14_;
#line 170 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		status = 2;
#line 171 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp15_ = fingerprint;
#line 171 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (_tmp15_ != NULL) {
#line 981 "midori-download.c"
			{
				gchar* filename = NULL;
				WebKitDownload* _tmp16_ = NULL;
				const gchar* _tmp17_ = NULL;
				const gchar* _tmp18_ = NULL;
				gchar* _tmp19_ = NULL;
				gchar* contents = NULL;
				gsize length = 0UL;
				gboolean y = FALSE;
				const gchar* _tmp20_ = NULL;
				gchar* _tmp21_ = NULL;
				gsize _tmp22_ = 0UL;
				gboolean _tmp23_ = FALSE;
				gchar* checksum = NULL;
				GChecksumType _tmp24_ = 0;
				const gchar* _tmp25_ = NULL;
				gsize _tmp26_ = 0UL;
				gchar* _tmp27_ = NULL;
				gboolean _tmp28_ = FALSE;
				gboolean _tmp29_ = FALSE;
#line 176 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp16_ = download;
#line 176 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp17_ = webkit_download_get_destination_uri (_tmp16_);
#line 176 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp18_ = _tmp17_;
#line 176 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp19_ = g_filename_from_uri (_tmp18_, NULL, &_inner_error_);
#line 176 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				filename = _tmp19_;
#line 176 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 1014 "midori-download.c"
					goto __catch16_g_error;
				}
#line 180 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp20_ = filename;
#line 180 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp23_ = g_file_get_contents (_tmp20_, &_tmp21_, &_tmp22_, &_inner_error_);
#line 180 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (contents);
#line 180 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				contents = _tmp21_;
#line 180 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				length = _tmp22_;
#line 180 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				y = _tmp23_;
#line 180 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 180 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_g_free0 (contents);
#line 180 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_g_free0 (filename);
#line 1035 "midori-download.c"
					goto __catch16_g_error;
				}
#line 181 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp24_ = checksum_type;
#line 181 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp25_ = contents;
#line 181 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp26_ = length;
#line 181 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp27_ = g_compute_checksum_for_string (_tmp24_, _tmp25_, _tmp26_);
#line 181 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				checksum = _tmp27_;
#line 183 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp29_ = y;
#line 183 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				if (!_tmp29_) {
#line 183 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp28_ = TRUE;
#line 1054 "midori-download.c"
				} else {
					const gchar* _tmp30_ = NULL;
					const gchar* _tmp31_ = NULL;
					gint _tmp32_ = 0;
#line 183 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp30_ = fingerprint;
#line 183 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp31_ = checksum;
#line 183 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp32_ = g_ascii_strcasecmp (_tmp30_, _tmp31_);
#line 183 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp28_ = _tmp32_ != 0;
#line 1067 "midori-download.c"
				}
#line 183 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				if (_tmp28_) {
#line 184 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					status = 1;
#line 1073 "midori-download.c"
				}
#line 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (checksum);
#line 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (contents);
#line 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (filename);
#line 1081 "midori-download.c"
			}
			goto __finally16;
			__catch16_g_error:
			{
				GError* _error_ = NULL;
#line 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_error_ = _inner_error_;
#line 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_inner_error_ = NULL;
#line 187 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				status = 1;
#line 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_error_free0 (_error_);
#line 1095 "midori-download.c"
			}
			__finally16:
#line 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (fingerprint);
#line 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (original_uri);
#line 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.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 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				g_clear_error (&_inner_error_);
#line 172 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				return FALSE;
#line 1110 "midori-download.c"
			}
		}
#line 190 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp33_ = download;
#line 190 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp34_ = status;
#line 190 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		g_object_set_data_full ((GObject*) _tmp33_, "checksum-status", (gpointer) ((gintptr) _tmp34_), NULL);
#line 158 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (fingerprint);
#line 158 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (original_uri);
#line 1123 "midori-download.c"
	}
#line 192 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp35_ = status;
#line 192 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = _tmp35_ == 1;
#line 192 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 1131 "midori-download.c"
}


gboolean midori_download_action_clear (WebKitDownload* download, GtkWidget* widget, GError** error) {
	gboolean result = FALSE;
	WebKitDownload* _tmp0_ = NULL;
	WebKitDownloadStatus _tmp1_ = 0;
	WebKitDownloadStatus _tmp2_ = 0;
	GError * _inner_error_ = NULL;
#line 196 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, FALSE);
#line 196 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (widget != NULL, FALSE);
#line 198 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 198 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = webkit_download_get_status (_tmp0_);
#line 198 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = _tmp1_;
#line 198 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	switch (_tmp2_) {
#line 198 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_CREATED:
#line 198 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_STARTED:
#line 1157 "midori-download.c"
		{
			WebKitDownload* _tmp3_ = NULL;
#line 201 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp3_ = download;
#line 201 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			webkit_download_cancel (_tmp3_);
#line 202 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			break;
#line 1166 "midori-download.c"
		}
#line 198 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_FINISHED:
#line 1170 "midori-download.c"
		{
			gboolean _tmp4_ = FALSE;
			WebKitDownload* _tmp5_ = NULL;
			GtkWidget* _tmp6_ = NULL;
			gboolean _tmp7_ = FALSE;
#line 204 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp5_ = download;
#line 204 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp6_ = widget;
#line 204 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp7_ = midori_download_open (_tmp5_, _tmp6_, &_inner_error_);
#line 204 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp4_ = _tmp7_;
#line 204 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 204 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				g_propagate_error (error, _inner_error_);
#line 204 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				return FALSE;
#line 1190 "midori-download.c"
			}
#line 204 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			if (_tmp4_) {
#line 205 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				result = TRUE;
#line 205 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				return result;
#line 1198 "midori-download.c"
			}
#line 206 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			break;
#line 1202 "midori-download.c"
		}
#line 198 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_CANCELLED:
#line 1206 "midori-download.c"
		{
#line 208 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			result = TRUE;
#line 208 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			return result;
#line 1212 "midori-download.c"
		}
		default:
		{
			WebKitDownload* _tmp8_ = NULL;
			WebKitDownloadStatus _tmp9_ = 0;
			WebKitDownloadStatus _tmp10_ = 0;
#line 210 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp8_ = download;
#line 210 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp9_ = webkit_download_get_status (_tmp8_);
#line 210 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp10_ = _tmp9_;
#line 210 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			g_critical ("midori-download.vala:210: action_clear: %d", (gint) _tmp10_);
#line 211 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			g_warn_if_reached ();
#line 212 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			break;
#line 1231 "midori-download.c"
		}
	}
#line 223 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = FALSE;
#line 223 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 1238 "midori-download.c"
}


gchar* midori_download_action_stock_id (WebKitDownload* download) {
	gchar* result = NULL;
	WebKitDownload* _tmp0_ = NULL;
	WebKitDownloadStatus _tmp1_ = 0;
	WebKitDownloadStatus _tmp2_ = 0;
#line 226 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, NULL);
#line 228 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 228 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = webkit_download_get_status (_tmp0_);
#line 228 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = _tmp1_;
#line 228 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	switch (_tmp2_) {
#line 228 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_CREATED:
#line 228 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_STARTED:
#line 1261 "midori-download.c"
		{
			gchar* _tmp3_ = NULL;
#line 231 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp3_ = g_strdup (GTK_STOCK_CANCEL);
#line 231 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			result = _tmp3_;
#line 231 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			return result;
#line 1270 "midori-download.c"
		}
#line 228 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_FINISHED:
#line 1274 "midori-download.c"
		{
			WebKitDownload* _tmp4_ = NULL;
			gboolean _tmp5_ = FALSE;
			gchar* _tmp7_ = NULL;
#line 233 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp4_ = download;
#line 233 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp5_ = midori_download_has_wrong_checksum (_tmp4_);
#line 233 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			if (_tmp5_) {
#line 1285 "midori-download.c"
				gchar* _tmp6_ = NULL;
#line 234 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp6_ = g_strdup (GTK_STOCK_DIALOG_WARNING);
#line 234 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				result = _tmp6_;
#line 234 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				return result;
#line 1293 "midori-download.c"
			}
#line 235 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp7_ = g_strdup (GTK_STOCK_OPEN);
#line 235 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			result = _tmp7_;
#line 235 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			return result;
#line 1301 "midori-download.c"
		}
#line 228 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_CANCELLED:
#line 1305 "midori-download.c"
		{
			gchar* _tmp8_ = NULL;
#line 237 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp8_ = g_strdup (GTK_STOCK_CLEAR);
#line 237 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			result = _tmp8_;
#line 237 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			return result;
#line 1314 "midori-download.c"
		}
#line 228 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		case WEBKIT_DOWNLOAD_STATUS_ERROR:
#line 1318 "midori-download.c"
		{
			gchar* _tmp9_ = NULL;
#line 239 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp9_ = g_strdup (GTK_STOCK_DIALOG_ERROR);
#line 239 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			result = _tmp9_;
#line 239 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			return result;
#line 1327 "midori-download.c"
		}
		default:
		{
			WebKitDownload* _tmp10_ = NULL;
			WebKitDownloadStatus _tmp11_ = 0;
			WebKitDownloadStatus _tmp12_ = 0;
			gchar* _tmp13_ = NULL;
#line 241 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp10_ = download;
#line 241 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp11_ = webkit_download_get_status (_tmp10_);
#line 241 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp12_ = _tmp11_;
#line 241 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			g_critical ("midori-download.vala:241: action_stock_id: %d", (gint) _tmp12_);
#line 242 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			g_warn_if_reached ();
#line 243 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp13_ = g_strdup (GTK_STOCK_MISSING_IMAGE);
#line 243 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			result = _tmp13_;
#line 243 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			return result;
#line 1351 "midori-download.c"
		}
	}
}


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


gboolean midori_download_open (WebKitDownload* download, GtkWidget* widget, GError** error) {
	gboolean result = FALSE;
	WebKitDownload* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
#line 256 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, FALSE);
#line 256 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (widget != NULL, FALSE);
#line 257 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 257 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = midori_download_has_wrong_checksum (_tmp0_);
#line 257 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp1_) {
#line 1378 "midori-download.c"
		const gchar* _tmp2_ = NULL;
		const gchar* _tmp3_ = NULL;
#line 258 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp2_ = _ ("The downloaded file is erroneous.");
#line 258 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp3_ = _ ("The checksum provided with the link did not match. This means the file" \
" is probably incomplete or was modified afterwards.");
#line 258 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		sokoke_message_dialog (GTK_MESSAGE_WARNING, _tmp2_, _tmp3_, TRUE);
#line 262 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = TRUE;
#line 262 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 1391 "midori-download.c"
	} else {
		GtkWidget* browser = NULL;
		GtkWidget* _tmp4_ = NULL;
		GtkWidget* _tmp5_ = NULL;
		GtkWidget* _tmp6_ = NULL;
		MidoriTab* tab = NULL;
		GtkWidget* _tmp7_ = NULL;
		MidoriTab* _tmp8_ = NULL;
#line 264 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp4_ = widget;
#line 264 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp5_ = gtk_widget_get_toplevel (_tmp4_);
#line 264 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp6_ = _g_object_ref0 (_tmp5_);
#line 264 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		browser = _tmp6_;
#line 265 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		tab = NULL;
#line 266 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp7_ = browser;
#line 266 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		g_object_get ((GObject*) _tmp7_, "tab", &tab, NULL);
#line 267 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp8_ = tab;
#line 267 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (_tmp8_ != NULL) {
#line 1418 "midori-download.c"
			MidoriTab* _tmp9_ = NULL;
			WebKitDownload* _tmp10_ = NULL;
			const gchar* _tmp11_ = NULL;
			const gchar* _tmp12_ = NULL;
			gboolean _tmp13_ = FALSE;
#line 271 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp9_ = tab;
#line 271 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp10_ = download;
#line 271 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp11_ = webkit_download_get_destination_uri (_tmp10_);
#line 271 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp12_ = _tmp11_;
#line 271 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			g_signal_emit_by_name (_tmp9_, "open-uri", _tmp12_, &_tmp13_);
#line 271 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			result = _tmp13_;
#line 271 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_object_unref0 (tab);
#line 271 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_object_unref0 (browser);
#line 271 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			return result;
#line 1442 "midori-download.c"
		}
#line 257 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_object_unref0 (tab);
#line 257 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_object_unref0 (browser);
#line 1448 "midori-download.c"
	}
#line 274 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = FALSE;
#line 274 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 1454 "midori-download.c"
}


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_ = 0L;
	gchar _tmp1_ = '\0';
#line 996 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, '\0');
#line 997 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp0_ = index;
#line 997 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp1_ = ((gchar*) self)[_tmp0_];
#line 997 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	result = _tmp1_;
#line 997 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	return result;
#line 1472 "midori-download.c"
}


static gboolean string_contains (const gchar* self, const gchar* needle) {
	gboolean result = FALSE;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
#line 1278 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, FALSE);
#line 1278 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail (needle != NULL, FALSE);
#line 1279 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp0_ = needle;
#line 1279 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_);
#line 1279 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	result = _tmp1_ != NULL;
#line 1279 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	return result;
#line 1492 "midori-download.c"
}


const gchar* midori_download_fallback_extension (const gchar* extension, const gchar* mime_type) {
	const gchar* result = NULL;
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp5_ = NULL;
	gboolean _tmp6_ = FALSE;
	const gchar* _tmp7_ = NULL;
	gboolean _tmp8_ = FALSE;
	const gchar* _tmp9_ = NULL;
	gboolean _tmp10_ = FALSE;
	const gchar* _tmp11_ = NULL;
	gboolean _tmp12_ = FALSE;
#line 277 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (mime_type != NULL, NULL);
#line 278 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = extension;
#line 278 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp1_ != NULL) {
#line 1514 "midori-download.c"
		const gchar* _tmp2_ = NULL;
		gchar _tmp3_ = '\0';
#line 278 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp2_ = extension;
#line 278 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp3_ = string_get (_tmp2_, (glong) 0);
#line 278 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp0_ = _tmp3_ != '\0';
#line 1523 "midori-download.c"
	} else {
#line 278 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp0_ = FALSE;
#line 1527 "midori-download.c"
	}
#line 278 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp0_) {
#line 1531 "midori-download.c"
		const gchar* _tmp4_ = NULL;
#line 279 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp4_ = extension;
#line 279 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = _tmp4_;
#line 279 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 1539 "midori-download.c"
	}
#line 280 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp5_ = mime_type;
#line 280 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp6_ = string_contains (_tmp5_, "css");
#line 280 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp6_) {
#line 281 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = ".css";
#line 281 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 1551 "midori-download.c"
	}
#line 282 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp7_ = mime_type;
#line 282 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp8_ = string_contains (_tmp7_, "javascript");
#line 282 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp8_) {
#line 283 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = ".js";
#line 283 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 1563 "midori-download.c"
	}
#line 284 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp9_ = mime_type;
#line 284 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp10_ = string_contains (_tmp9_, "html");
#line 284 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp10_) {
#line 285 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = ".htm";
#line 285 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 1575 "midori-download.c"
	}
#line 286 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp11_ = mime_type;
#line 286 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp12_ = string_contains (_tmp11_, "plain");
#line 286 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp12_) {
#line 287 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = ".txt";
#line 287 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 1587 "midori-download.c"
	}
#line 288 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = "";
#line 288 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 1593 "midori-download.c"
}


static gchar* string_delimit (const gchar* self, const gchar* delimiters, gchar new_delimiter) {
	gchar* result = NULL;
	gchar* _result_ = NULL;
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gchar _tmp3_ = '\0';
#line 1123 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1123 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail (delimiters != NULL, NULL);
#line 1124 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp0_ = g_strdup (self);
#line 1124 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_result_ = _tmp0_;
#line 1125 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp1_ = _result_;
#line 1125 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp2_ = delimiters;
#line 1125 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp3_ = new_delimiter;
#line 1125 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_strdelimit (_tmp1_, _tmp2_, _tmp3_);
#line 1126 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	result = _result_;
#line 1126 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	return result;
#line 1624 "midori-download.c"
}


gchar* midori_download_clean_filename (const gchar* filename) {
	gchar* result = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
#line 291 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (filename != NULL, NULL);
#line 295 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = filename;
#line 295 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = string_delimit (_tmp0_, "/ ", '_');
#line 295 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = _tmp1_;
#line 295 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 1642 "midori-download.c"
}


gchar* midori_download_get_suggested_filename (WebKitDownload* download) {
	gchar* result = NULL;
	WebKitDownload* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
#line 299 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, NULL);
#line 303 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 303 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = webkit_download_get_suggested_filename (_tmp0_);
#line 303 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = midori_download_clean_filename (_tmp1_);
#line 303 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = _tmp2_;
#line 303 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 1663 "midori-download.c"
}


/**
         * Returns a filename of the form "name.ext" to use as a suggested name for
         * a download of the given uri
         */
static gint string_index_of_char (const gchar* self, gunichar c, gint start_index) {
	gint result = 0;
	gchar* _result_ = NULL;
	gint _tmp0_ = 0;
	gunichar _tmp1_ = 0U;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
#line 920 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, 0);
#line 921 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp0_ = start_index;
#line 921 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp1_ = c;
#line 921 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp2_ = g_utf8_strchr (((gchar*) self) + _tmp0_, (gssize) (-1), _tmp1_);
#line 921 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_result_ = _tmp2_;
#line 923 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp3_ = _result_;
#line 923 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	if (_tmp3_ != NULL) {
#line 1692 "midori-download.c"
		gchar* _tmp4_ = NULL;
#line 924 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp4_ = _result_;
#line 924 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		result = (gint) (_tmp4_ - ((gchar*) self));
#line 924 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		return result;
#line 1700 "midori-download.c"
	} else {
#line 926 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		result = -1;
#line 926 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		return result;
#line 1706 "midori-download.c"
	}
}


gchar* midori_download_get_filename_suggestion_for_uri (const gchar* mime_type, const gchar* uri) {
	gchar* result = NULL;
	const gchar* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_ = NULL;
	gchar* filename = NULL;
	const gchar* _tmp3_ = NULL;
	GFile* _tmp4_ = NULL;
	GFile* _tmp5_ = NULL;
	gchar* _tmp6_ = NULL;
	gchar* _tmp7_ = NULL;
	const gchar* _tmp8_ = NULL;
	gint _tmp9_ = 0;
#line 316 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (mime_type != NULL, NULL);
#line 316 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (uri != NULL, NULL);
#line 317 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = uri;
#line 317 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = midori_uri_is_location (_tmp0_);
#line 317 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = uri;
#line 317 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (_tmp1_, _tmp2_);
#line 318 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp3_ = uri;
#line 318 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp4_ = g_file_new_for_uri (_tmp3_);
#line 318 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp5_ = _tmp4_;
#line 318 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp6_ = g_file_get_basename (_tmp5_);
#line 318 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp7_ = _tmp6_;
#line 318 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_object_unref0 (_tmp5_);
#line 318 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	filename = _tmp7_;
#line 319 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp8_ = uri;
#line 319 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp9_ = string_index_of_char (_tmp8_, (gunichar) '.', 0);
#line 319 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp9_ == (-1)) {
#line 1756 "midori-download.c"
		const gchar* _tmp10_ = NULL;
		const gchar* _tmp11_ = NULL;
		const gchar* _tmp12_ = NULL;
		gchar* _tmp13_ = NULL;
#line 320 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp10_ = filename;
#line 320 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp11_ = mime_type;
#line 320 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp12_ = midori_download_fallback_extension (NULL, _tmp11_);
#line 320 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp13_ = g_build_filename (_tmp10_, _tmp12_, NULL);
#line 320 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = _tmp13_;
#line 320 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (filename);
#line 320 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 1775 "midori-download.c"
	}
#line 321 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = filename;
#line 321 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 1781 "midori-download.c"
}


static gint string_last_index_of_char (const gchar* self, gunichar c, gint start_index) {
	gint result = 0;
	gchar* _result_ = NULL;
	gint _tmp0_ = 0;
	gunichar _tmp1_ = 0U;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
#line 930 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, 0);
#line 931 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp0_ = start_index;
#line 931 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp1_ = c;
#line 931 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp2_ = g_utf8_strrchr (((gchar*) self) + _tmp0_, (gssize) (-1), _tmp1_);
#line 931 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_result_ = _tmp2_;
#line 933 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp3_ = _result_;
#line 933 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	if (_tmp3_ != NULL) {
#line 1806 "midori-download.c"
		gchar* _tmp4_ = NULL;
#line 934 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp4_ = _result_;
#line 934 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		result = (gint) (_tmp4_ - ((gchar*) self));
#line 934 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		return result;
#line 1814 "midori-download.c"
	} else {
#line 936 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		result = -1;
#line 936 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		return result;
#line 1820 "midori-download.c"
	}
}


static glong string_strnlen (gchar* str, glong maxlen) {
	glong result = 0L;
	gchar* end = NULL;
	gchar* _tmp0_ = NULL;
	glong _tmp1_ = 0L;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
#line 1197 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp0_ = str;
#line 1197 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp1_ = maxlen;
#line 1197 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
#line 1197 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	end = _tmp2_;
#line 1198 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp3_ = end;
#line 1198 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	if (_tmp3_ == NULL) {
#line 1844 "midori-download.c"
		glong _tmp4_ = 0L;
#line 1199 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp4_ = maxlen;
#line 1199 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		result = _tmp4_;
#line 1199 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		return result;
#line 1852 "midori-download.c"
	} else {
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
#line 1201 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp5_ = end;
#line 1201 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp6_ = str;
#line 1201 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		result = (glong) (_tmp5_ - _tmp6_);
#line 1201 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		return result;
#line 1864 "midori-download.c"
	}
}


static gchar* string_substring (const gchar* self, glong offset, glong len) {
	gchar* result = NULL;
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	glong _tmp1_ = 0L;
	glong _tmp8_ = 0L;
	glong _tmp14_ = 0L;
	glong _tmp17_ = 0L;
	glong _tmp18_ = 0L;
	glong _tmp19_ = 0L;
	glong _tmp20_ = 0L;
	glong _tmp21_ = 0L;
	gchar* _tmp22_ = NULL;
#line 1208 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1210 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp1_ = offset;
#line 1210 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	if (_tmp1_ >= ((glong) 0)) {
#line 1888 "midori-download.c"
		glong _tmp2_ = 0L;
#line 1210 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp2_ = len;
#line 1210 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp0_ = _tmp2_ >= ((glong) 0);
#line 1894 "midori-download.c"
	} else {
#line 1210 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp0_ = FALSE;
#line 1898 "midori-download.c"
	}
#line 1210 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	if (_tmp0_) {
#line 1902 "midori-download.c"
		glong _tmp3_ = 0L;
		glong _tmp4_ = 0L;
		glong _tmp5_ = 0L;
#line 1212 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp3_ = offset;
#line 1212 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp4_ = len;
#line 1212 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp5_ = string_strnlen ((gchar*) self, _tmp3_ + _tmp4_);
#line 1212 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		string_length = _tmp5_;
#line 1914 "midori-download.c"
	} else {
		gint _tmp6_ = 0;
		gint _tmp7_ = 0;
#line 1214 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp6_ = strlen (self);
#line 1214 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp7_ = _tmp6_;
#line 1214 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		string_length = (glong) _tmp7_;
#line 1924 "midori-download.c"
	}
#line 1217 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp8_ = offset;
#line 1217 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	if (_tmp8_ < ((glong) 0)) {
#line 1930 "midori-download.c"
		glong _tmp9_ = 0L;
		glong _tmp10_ = 0L;
		glong _tmp11_ = 0L;
#line 1218 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp9_ = string_length;
#line 1218 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp10_ = offset;
#line 1218 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		offset = _tmp9_ + _tmp10_;
#line 1219 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp11_ = offset;
#line 1219 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		g_return_val_if_fail (_tmp11_ >= ((glong) 0), NULL);
#line 1944 "midori-download.c"
	} else {
		glong _tmp12_ = 0L;
		glong _tmp13_ = 0L;
#line 1221 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp12_ = offset;
#line 1221 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp13_ = string_length;
#line 1221 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		g_return_val_if_fail (_tmp12_ <= _tmp13_, NULL);
#line 1954 "midori-download.c"
	}
#line 1223 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp14_ = len;
#line 1223 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	if (_tmp14_ < ((glong) 0)) {
#line 1960 "midori-download.c"
		glong _tmp15_ = 0L;
		glong _tmp16_ = 0L;
#line 1224 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp15_ = string_length;
#line 1224 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		_tmp16_ = offset;
#line 1224 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
		len = _tmp15_ - _tmp16_;
#line 1969 "midori-download.c"
	}
#line 1226 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp17_ = offset;
#line 1226 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp18_ = len;
#line 1226 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp19_ = string_length;
#line 1226 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	g_return_val_if_fail ((_tmp17_ + _tmp18_) <= _tmp19_, NULL);
#line 1227 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp20_ = offset;
#line 1227 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp21_ = len;
#line 1227 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	_tmp22_ = g_strndup (((gchar*) self) + _tmp20_, (gsize) _tmp21_);
#line 1227 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	result = _tmp22_;
#line 1227 "/usr/share/vala-0.26/vapi/glib-2.0.vapi"
	return result;
#line 1989 "midori-download.c"
}


gchar* midori_download_get_extension_for_uri (const gchar* uri, gchar** basename) {
	gchar* _vala_basename = NULL;
	gchar* result = NULL;
	gint last_slash = 0;
	const gchar* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	gint period = 0;
	const gchar* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	gint _tmp5_ = 0;
	gint _tmp6_ = 0;
	gint query = 0;
	const gchar* _tmp7_ = NULL;
	gint _tmp8_ = 0;
	gint _tmp9_ = 0;
	gchar* extension = NULL;
	const gchar* _tmp10_ = NULL;
	gint _tmp11_ = 0;
	gint _tmp12_ = 0;
	gint _tmp13_ = 0;
	gchar* _tmp14_ = NULL;
	const gchar* _tmp15_ = NULL;
	gint _tmp16_ = 0;
	gchar* _tmp17_ = NULL;
#line 324 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (uri != NULL, NULL);
#line 325 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (_vala_basename);
#line 325 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_vala_basename = NULL;
#line 327 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = uri;
#line 327 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = string_last_index_of_char (_tmp0_, (gunichar) '/', 0);
#line 327 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	last_slash = _tmp1_;
#line 329 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = last_slash;
#line 329 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp2_ == (-1)) {
#line 330 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = NULL;
#line 330 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (basename) {
#line 330 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			*basename = _vala_basename;
#line 2040 "midori-download.c"
		} else {
#line 330 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (_vala_basename);
#line 2044 "midori-download.c"
		}
#line 330 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 2048 "midori-download.c"
	}
#line 331 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp3_ = uri;
#line 331 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp4_ = last_slash;
#line 331 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp5_ = string_last_index_of_char (_tmp3_, (gunichar) '.', _tmp4_);
#line 331 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	period = _tmp5_;
#line 332 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp6_ = period;
#line 332 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp6_ == (-1)) {
#line 333 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = NULL;
#line 333 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (basename) {
#line 333 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			*basename = _vala_basename;
#line 2068 "midori-download.c"
		} else {
#line 333 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (_vala_basename);
#line 2072 "midori-download.c"
		}
#line 333 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 2076 "midori-download.c"
	}
#line 335 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp7_ = uri;
#line 335 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp8_ = period;
#line 335 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp9_ = string_last_index_of_char (_tmp7_, (gunichar) '?', _tmp8_);
#line 335 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	query = _tmp9_;
#line 337 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp10_ = uri;
#line 337 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp11_ = period;
#line 337 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp12_ = query;
#line 337 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp13_ = period;
#line 337 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp14_ = string_substring (_tmp10_, (glong) _tmp11_, (glong) (_tmp12_ - _tmp13_));
#line 337 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	extension = _tmp14_;
#line 338 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp15_ = uri;
#line 338 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp16_ = period;
#line 338 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp17_ = string_substring (_tmp15_, (glong) 0, (glong) _tmp16_);
#line 338 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (_vala_basename);
#line 338 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_vala_basename = _tmp17_;
#line 339 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = extension;
#line 339 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (basename) {
#line 339 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		*basename = _vala_basename;
#line 2114 "midori-download.c"
	} else {
#line 339 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (_vala_basename);
#line 2118 "midori-download.c"
	}
#line 339 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 2122 "midori-download.c"
}


gchar* midori_download_get_unique_filename (const gchar* filename) {
	gchar* result = NULL;
	const gchar* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	const gchar* _tmp13_ = NULL;
	gchar* _tmp14_ = NULL;
#line 343 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (filename != NULL, NULL);
#line 344 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = filename;
#line 344 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = access (_tmp0_, F_OK);
#line 344 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp1_ == 0) {
#line 2140 "midori-download.c"
		gchar* basename = NULL;
		gchar* extension = NULL;
		const gchar* _tmp2_ = NULL;
		gchar* _tmp3_ = NULL;
		gchar* _tmp4_ = NULL;
		gchar* new_filename = NULL;
		gint i = 0;
#line 346 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp2_ = filename;
#line 346 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp4_ = midori_download_get_extension_for_uri (_tmp2_, &_tmp3_);
#line 346 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (basename);
#line 346 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		basename = _tmp3_;
#line 346 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		extension = _tmp4_;
#line 347 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		new_filename = NULL;
#line 348 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		i = 0;
#line 2162 "midori-download.c"
		{
			gboolean _tmp5_ = FALSE;
#line 349 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp5_ = TRUE;
#line 349 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			while (TRUE) {
#line 2169 "midori-download.c"
				const gchar* _tmp8_ = NULL;
				const gchar* _tmp9_ = NULL;
				const gchar* _tmp10_ = NULL;
				gint _tmp11_ = 0;
				gchar* _tmp12_ = NULL;
#line 349 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				if (!_tmp5_) {
#line 2177 "midori-download.c"
					const gchar* _tmp6_ = NULL;
					gint _tmp7_ = 0;
#line 351 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp6_ = new_filename;
#line 351 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp7_ = access (_tmp6_, F_OK);
#line 351 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					if (!(_tmp7_ == 0)) {
#line 351 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
						break;
#line 2188 "midori-download.c"
					}
				}
#line 349 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp5_ = FALSE;
#line 350 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp9_ = extension;
#line 350 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp8_ = _tmp9_;
#line 350 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				if (_tmp8_ == NULL) {
#line 350 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
					_tmp8_ = "";
#line 2201 "midori-download.c"
				}
#line 350 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp10_ = basename;
#line 350 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp11_ = i;
#line 350 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				i = _tmp11_ + 1;
#line 350 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp12_ = g_strdup_printf ("%s-%d%s", _tmp10_, _tmp11_, _tmp8_);
#line 350 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (new_filename);
#line 350 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				new_filename = _tmp12_;
#line 2215 "midori-download.c"
			}
		}
#line 352 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = new_filename;
#line 352 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (extension);
#line 352 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (basename);
#line 352 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 2226 "midori-download.c"
	}
#line 354 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp13_ = filename;
#line 354 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp14_ = g_strdup (_tmp13_);
#line 354 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = _tmp14_;
#line 354 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 2236 "midori-download.c"
}


/**
         * Returns a string showing a file:// URI's intended filename on
         * disk, suited for displaying to a user.
         * 
         * The string returned is the basename (final path segment) of the
         * filename of the uri. If the uri is invalid, not file://, or has no
         * basename, the uri itself is returned.
         * 
         * Since: 0.5.7
         **/
gchar* midori_download_get_basename_for_display (const gchar* uri) {
	gchar* result = NULL;
	const gchar* _tmp7_ = NULL;
	gchar* _tmp8_ = NULL;
	GError * _inner_error_ = NULL;
#line 367 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (uri != NULL, NULL);
#line 2257 "midori-download.c"
	{
		gchar* filename = NULL;
		const gchar* _tmp0_ = NULL;
		gchar* _tmp1_ = NULL;
		gboolean _tmp2_ = FALSE;
		const gchar* _tmp3_ = NULL;
#line 369 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp0_ = uri;
#line 369 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp1_ = g_filename_from_uri (_tmp0_, NULL, &_inner_error_);
#line 369 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		filename = _tmp1_;
#line 369 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 2272 "midori-download.c"
			goto __catch17_g_error;
		}
#line 370 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp3_ = filename;
#line 370 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (_tmp3_ != NULL) {
#line 2279 "midori-download.c"
			const gchar* _tmp4_ = NULL;
#line 370 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp4_ = filename;
#line 370 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp2_ = g_strcmp0 (_tmp4_, "") != 0;
#line 2285 "midori-download.c"
		} else {
#line 370 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp2_ = FALSE;
#line 2289 "midori-download.c"
		}
#line 370 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (_tmp2_) {
#line 2293 "midori-download.c"
			const gchar* _tmp5_ = NULL;
			gchar* _tmp6_ = NULL;
#line 371 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp5_ = filename;
#line 371 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp6_ = g_path_get_basename (_tmp5_);
#line 371 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			result = _tmp6_;
#line 371 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (filename);
#line 371 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			return result;
#line 2306 "midori-download.c"
		}
#line 368 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (filename);
#line 2310 "midori-download.c"
	}
	goto __finally17;
	__catch17_g_error:
	{
		GError* _error_ = NULL;
#line 368 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_error_ = _inner_error_;
#line 368 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_inner_error_ = NULL;
#line 368 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_error_free0 (_error_);
#line 2322 "midori-download.c"
	}
	__finally17:
#line 368 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 368 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.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 368 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		g_clear_error (&_inner_error_);
#line 368 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return NULL;
#line 2333 "midori-download.c"
	}
#line 373 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp7_ = uri;
#line 373 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp8_ = g_strdup (_tmp7_);
#line 373 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = _tmp8_;
#line 373 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 2343 "midori-download.c"
}


gchar* midori_download_prepare_destination_uri (WebKitDownload* download, const gchar* folder) {
	gchar* result = NULL;
	gchar* suggested_filename = NULL;
	WebKitDownload* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* basename = NULL;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gchar* download_dir = NULL;
	const gchar* _tmp4_ = NULL;
	gchar* destination_filename = NULL;
	const gchar* _tmp12_ = NULL;
	const gchar* _tmp13_ = NULL;
	gchar* _tmp14_ = NULL;
	GError * _inner_error_ = NULL;
#line 376 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, NULL);
#line 377 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = download;
#line 377 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = midori_download_get_suggested_filename (_tmp0_);
#line 377 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	suggested_filename = _tmp1_;
#line 378 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = suggested_filename;
#line 378 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp3_ = g_path_get_basename (_tmp2_);
#line 378 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	basename = _tmp3_;
#line 380 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp4_ = folder;
#line 380 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp4_ == NULL) {
#line 2380 "midori-download.c"
		const gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
		gchar* _tmp8_ = NULL;
		gchar* _tmp9_ = NULL;
#line 381 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp5_ = midori_paths_get_tmp_dir ();
#line 381 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp6_ = g_strdup (_tmp5_);
#line 381 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (download_dir);
#line 381 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		download_dir = _tmp6_;
#line 382 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp7_ = download_dir;
#line 382 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp8_ = katze_mkdir_with_parents (_tmp7_, 0700);
#line 382 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp9_ = _tmp8_;
#line 382 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (_tmp9_);
#line 2402 "midori-download.c"
	} else {
		const gchar* _tmp10_ = NULL;
		gchar* _tmp11_ = NULL;
#line 385 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp10_ = folder;
#line 385 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp11_ = g_strdup (_tmp10_);
#line 385 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (download_dir);
#line 385 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		download_dir = _tmp11_;
#line 2414 "midori-download.c"
	}
#line 386 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp12_ = download_dir;
#line 386 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp13_ = basename;
#line 386 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp14_ = g_build_filename (_tmp12_, _tmp13_, NULL);
#line 386 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	destination_filename = _tmp14_;
#line 2424 "midori-download.c"
	{
		gchar* _tmp15_ = NULL;
		gchar* _tmp16_ = NULL;
		gchar* _tmp17_ = NULL;
		gchar* _tmp18_ = NULL;
		gchar* _tmp19_ = NULL;
		gchar* _tmp20_ = NULL;
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp16_ = midori_download_get_unique_filename (destination_filename);
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp17_ = _tmp16_;
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp18_ = g_filename_to_uri (_tmp17_, NULL, &_inner_error_);
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp19_ = _tmp18_;
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (_tmp17_);
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp15_ = _tmp19_;
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 2446 "midori-download.c"
			goto __catch18_g_error;
		}
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp20_ = _tmp15_;
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp15_ = NULL;
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = _tmp20_;
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (_tmp15_);
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (destination_filename);
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (download_dir);
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (basename);
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (suggested_filename);
#line 388 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 2467 "midori-download.c"
	}
	goto __finally18;
	__catch18_g_error:
	{
		GError* _error_ = NULL;
		gchar* _tmp21_ = NULL;
#line 387 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_error_ = _inner_error_;
#line 387 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_inner_error_ = NULL;
#line 391 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp21_ = g_strconcat ("file://", destination_filename, NULL);
#line 391 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = _tmp21_;
#line 391 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_error_free0 (_error_);
#line 391 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (destination_filename);
#line 391 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (download_dir);
#line 391 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (basename);
#line 391 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (suggested_filename);
#line 391 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 2494 "midori-download.c"
	}
	__finally18:
#line 387 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (destination_filename);
#line 387 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (download_dir);
#line 387 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (basename);
#line 387 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_free0 (suggested_filename);
#line 387 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.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 387 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_clear_error (&_inner_error_);
#line 387 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return NULL;
#line 2511 "midori-download.c"
}


/**
         * Returns whether it seems possible to save @download to the path specified by
         * @destination_uri, considering space on disk and permissions
         */
gboolean midori_download_has_enough_space (WebKitDownload* download, const gchar* destination_uri, gboolean quiet) {
	gboolean result = FALSE;
	GFile* folder = NULL;
	const gchar* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	GFile* _tmp2_ = NULL;
	GFile* _tmp3_ = NULL;
	GFile* _tmp4_ = NULL;
	gboolean can_write = FALSE;
	guint64 free_space = 0ULL;
	gboolean _tmp15_ = FALSE;
	guint64 _tmp16_ = 0ULL;
	WebKitDownload* _tmp17_ = NULL;
	guint64 _tmp18_ = 0ULL;
	guint64 _tmp19_ = 0ULL;
	GError * _inner_error_ = NULL;
#line 399 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (download != NULL, FALSE);
#line 399 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	g_return_val_if_fail (destination_uri != NULL, FALSE);
#line 401 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp0_ = destination_uri;
#line 401 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp1_ = g_file_new_for_uri (_tmp0_);
#line 401 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp2_ = _tmp1_;
#line 401 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp3_ = g_file_get_parent (_tmp2_);
#line 401 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp4_ = _tmp3_;
#line 401 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_object_unref0 (_tmp2_);
#line 401 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	folder = _tmp4_;
#line 2553 "midori-download.c"
	{
		GFileInfo* info = NULL;
		GFile* _tmp5_ = NULL;
		GFileInfo* _tmp6_ = NULL;
		GFileInfo* _tmp7_ = NULL;
		guint64 _tmp8_ = 0ULL;
		GFileInfo* _tmp9_ = NULL;
		GFile* _tmp10_ = NULL;
		GFileInfo* _tmp11_ = NULL;
		GFileInfo* _tmp12_ = NULL;
		GFileInfo* _tmp13_ = NULL;
		gboolean _tmp14_ = FALSE;
#line 405 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp5_ = folder;
#line 405 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp6_ = g_file_query_filesystem_info (_tmp5_, "filesystem::free", NULL, &_inner_error_);
#line 405 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		info = _tmp6_;
#line 405 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 2574 "midori-download.c"
			goto __catch19_g_error;
		}
#line 406 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp7_ = info;
#line 406 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp8_ = g_file_info_get_attribute_uint64 (_tmp7_, "filesystem::free");
#line 406 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		free_space = _tmp8_;
#line 407 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp10_ = folder;
#line 407 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp11_ = g_file_query_info (_tmp10_, "access::can-write", 0, NULL, &_inner_error_);
#line 407 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp9_ = _tmp11_;
#line 407 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 407 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_object_unref0 (info);
#line 2593 "midori-download.c"
			goto __catch19_g_error;
		}
#line 407 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp12_ = _tmp9_;
#line 407 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp9_ = NULL;
#line 407 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_object_unref0 (info);
#line 407 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		info = _tmp12_;
#line 408 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp13_ = info;
#line 408 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp14_ = g_file_info_get_attribute_boolean (_tmp13_, "access::can-write");
#line 408 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		can_write = _tmp14_;
#line 404 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_object_unref0 (_tmp9_);
#line 404 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_object_unref0 (info);
#line 2614 "midori-download.c"
	}
	goto __finally19;
	__catch19_g_error:
	{
		GError* _error_ = NULL;
#line 404 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_error_ = _inner_error_;
#line 404 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_inner_error_ = NULL;
#line 411 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		can_write = FALSE;
#line 412 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		free_space = (guint64) 0;
#line 404 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_error_free0 (_error_);
#line 2630 "midori-download.c"
	}
	__finally19:
#line 404 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 404 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_object_unref0 (folder);
#line 404 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.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 404 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		g_clear_error (&_inner_error_);
#line 404 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return FALSE;
#line 2643 "midori-download.c"
	}
#line 415 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp16_ = free_space;
#line 415 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp17_ = download;
#line 415 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp18_ = webkit_download_get_total_size (_tmp17_);
#line 415 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_tmp19_ = _tmp18_;
#line 415 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp16_ < _tmp19_) {
#line 415 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp15_ = TRUE;
#line 2657 "midori-download.c"
	} else {
		gboolean _tmp20_ = FALSE;
#line 415 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp20_ = can_write;
#line 415 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp15_ = !_tmp20_;
#line 2664 "midori-download.c"
	}
#line 415 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	if (_tmp15_) {
#line 2668 "midori-download.c"
		gchar* message = NULL;
		gchar* detailed_message = NULL;
		gboolean _tmp21_ = FALSE;
		gboolean _tmp48_ = FALSE;
#line 418 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp21_ = can_write;
#line 418 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (!_tmp21_) {
#line 2677 "midori-download.c"
			const gchar* _tmp22_ = NULL;
			const gchar* _tmp23_ = NULL;
			gchar* _tmp24_ = NULL;
			gchar* _tmp25_ = NULL;
			gchar* _tmp26_ = NULL;
			const gchar* _tmp27_ = NULL;
			gchar* _tmp28_ = NULL;
#line 419 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp22_ = _ ("The file \"%s\" can't be saved in this folder.");
#line 419 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp23_ = destination_uri;
#line 419 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp24_ = midori_download_get_basename_for_display (_tmp23_);
#line 419 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp25_ = _tmp24_;
#line 419 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp26_ = g_strdup_printf (_tmp22_, _tmp25_);
#line 419 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (message);
#line 419 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			message = _tmp26_;
#line 419 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (_tmp25_);
#line 421 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp27_ = _ ("You don't have permission to write in this location.");
#line 421 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp28_ = g_strdup (_tmp27_);
#line 421 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_g_free0 (detailed_message);
#line 421 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			detailed_message = _tmp28_;
#line 2709 "midori-download.c"
		} else {
			guint64 _tmp29_ = 0ULL;
			WebKitDownload* _tmp30_ = NULL;
			guint64 _tmp31_ = 0ULL;
			guint64 _tmp32_ = 0ULL;
#line 423 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp29_ = free_space;
#line 423 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp30_ = download;
#line 423 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp31_ = webkit_download_get_total_size (_tmp30_);
#line 423 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp32_ = _tmp31_;
#line 423 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			if (_tmp29_ < _tmp32_) {
#line 2725 "midori-download.c"
				const gchar* _tmp33_ = NULL;
				const gchar* _tmp34_ = NULL;
				gchar* _tmp35_ = NULL;
				gchar* _tmp36_ = NULL;
				gchar* _tmp37_ = NULL;
				const gchar* _tmp38_ = NULL;
				WebKitDownload* _tmp39_ = NULL;
				guint64 _tmp40_ = 0ULL;
				guint64 _tmp41_ = 0ULL;
				gchar* _tmp42_ = NULL;
				gchar* _tmp43_ = NULL;
				guint64 _tmp44_ = 0ULL;
				gchar* _tmp45_ = NULL;
				gchar* _tmp46_ = NULL;
				gchar* _tmp47_ = NULL;
#line 424 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp33_ = _ ("There is not enough free space to download \"%s\".");
#line 424 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp34_ = destination_uri;
#line 424 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp35_ = midori_download_get_basename_for_display (_tmp34_);
#line 424 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp36_ = _tmp35_;
#line 424 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp37_ = g_strdup_printf (_tmp33_, _tmp36_);
#line 424 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (message);
#line 424 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				message = _tmp37_;
#line 424 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (_tmp36_);
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp38_ = _ ("The file needs %s but only %s are left.");
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp39_ = download;
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp40_ = webkit_download_get_total_size (_tmp39_);
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp41_ = _tmp40_;
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp42_ = g_format_size_full (_tmp41_, G_FORMAT_SIZE_DEFAULT);
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp43_ = _tmp42_;
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp44_ = free_space;
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp45_ = g_format_size_full (_tmp44_, G_FORMAT_SIZE_DEFAULT);
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp46_ = _tmp45_;
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_tmp47_ = g_strdup_printf (_tmp38_, _tmp43_, _tmp46_);
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (detailed_message);
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				detailed_message = _tmp47_;
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (_tmp46_);
#line 426 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				_g_free0 (_tmp43_);
#line 2785 "midori-download.c"
			} else {
#line 430 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
				g_assert_not_reached ();
#line 2789 "midori-download.c"
			}
		}
#line 431 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_tmp48_ = quiet;
#line 431 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		if (!_tmp48_) {
#line 2796 "midori-download.c"
			const gchar* _tmp49_ = NULL;
			const gchar* _tmp50_ = NULL;
#line 432 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp49_ = message;
#line 432 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			_tmp50_ = detailed_message;
#line 432 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
			sokoke_message_dialog (GTK_MESSAGE_ERROR, _tmp49_, _tmp50_, FALSE);
#line 2805 "midori-download.c"
		}
#line 433 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		result = FALSE;
#line 433 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (detailed_message);
#line 433 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_free0 (message);
#line 433 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		_g_object_unref0 (folder);
#line 433 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
		return result;
#line 2817 "midori-download.c"
	}
#line 436 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	result = TRUE;
#line 436 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	_g_object_unref0 (folder);
#line 436 "/usr/src/ports/midori/midori-0.5.10-1.i686/src/midori/midori-download.vala"
	return result;
#line 2825 "midori-download.c"
}



