/* rhel-download-dialog.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from rhel-download-dialog.vala, do not modify */

/* This file is part of GNOME Boxes. License: LGPLv2+*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <webkit2/webkit2.h>
#include <glib.h>
#include <gio/gio.h>
#include <handy.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include <osinfo/osinfo.h>
#include <libsoup/soup.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>

#define BOXES_RHEL_DOWNLOAD_DIALOG_progress_bar_id_timeout ((guint) 500)
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define BOXES_TYPE_RHEL_DOWNLOAD_DIALOG (boxes_rhel_download_dialog_get_type ())
#define BOXES_RHEL_DOWNLOAD_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_RHEL_DOWNLOAD_DIALOG, BoxesRHELDownloadDialog))
#define BOXES_RHEL_DOWNLOAD_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_RHEL_DOWNLOAD_DIALOG, BoxesRHELDownloadDialogClass))
#define BOXES_IS_RHEL_DOWNLOAD_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_RHEL_DOWNLOAD_DIALOG))
#define BOXES_IS_RHEL_DOWNLOAD_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_RHEL_DOWNLOAD_DIALOG))
#define BOXES_RHEL_DOWNLOAD_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_RHEL_DOWNLOAD_DIALOG, BoxesRHELDownloadDialogClass))

typedef struct _BoxesRHELDownloadDialog BoxesRHELDownloadDialog;
typedef struct _BoxesRHELDownloadDialogClass BoxesRHELDownloadDialogClass;
typedef struct _BoxesRHELDownloadDialogPrivate BoxesRHELDownloadDialogPrivate;

#define BOXES_TYPE_ASSISTANT_MEDIA_ENTRY (boxes_assistant_media_entry_get_type ())
#define BOXES_ASSISTANT_MEDIA_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_ASSISTANT_MEDIA_ENTRY, BoxesAssistantMediaEntry))
#define BOXES_ASSISTANT_MEDIA_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_ASSISTANT_MEDIA_ENTRY, BoxesAssistantMediaEntryClass))
#define BOXES_IS_ASSISTANT_MEDIA_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_ASSISTANT_MEDIA_ENTRY))
#define BOXES_IS_ASSISTANT_MEDIA_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_ASSISTANT_MEDIA_ENTRY))
#define BOXES_ASSISTANT_MEDIA_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_ASSISTANT_MEDIA_ENTRY, BoxesAssistantMediaEntryClass))

typedef struct _BoxesAssistantMediaEntry BoxesAssistantMediaEntry;
typedef struct _BoxesAssistantMediaEntryClass BoxesAssistantMediaEntryClass;

#define BOXES_TYPE_ASSISTANT_DOWNLOADABLE_ENTRY (boxes_assistant_downloadable_entry_get_type ())
#define BOXES_ASSISTANT_DOWNLOADABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_ASSISTANT_DOWNLOADABLE_ENTRY, BoxesAssistantDownloadableEntry))
#define BOXES_ASSISTANT_DOWNLOADABLE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_ASSISTANT_DOWNLOADABLE_ENTRY, BoxesAssistantDownloadableEntryClass))
#define BOXES_IS_ASSISTANT_DOWNLOADABLE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_ASSISTANT_DOWNLOADABLE_ENTRY))
#define BOXES_IS_ASSISTANT_DOWNLOADABLE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_ASSISTANT_DOWNLOADABLE_ENTRY))
#define BOXES_ASSISTANT_DOWNLOADABLE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_ASSISTANT_DOWNLOADABLE_ENTRY, BoxesAssistantDownloadableEntryClass))

typedef struct _BoxesAssistantDownloadableEntry BoxesAssistantDownloadableEntry;
typedef struct _BoxesAssistantDownloadableEntryClass BoxesAssistantDownloadableEntryClass;
enum  {
	BOXES_RHEL_DOWNLOAD_DIALOG_0_PROPERTY,
	BOXES_RHEL_DOWNLOAD_DIALOG_NUM_PROPERTIES
};
static GParamSpec* boxes_rhel_download_dialog_properties[BOXES_RHEL_DOWNLOAD_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define BOXES_TYPE_APP (boxes_app_get_type ())
#define BOXES_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_APP, BoxesApp))
#define BOXES_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_APP, BoxesAppClass))
#define BOXES_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_APP))
#define BOXES_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_APP))
#define BOXES_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_APP, BoxesAppClass))

typedef struct _BoxesApp BoxesApp;
typedef struct _BoxesAppClass BoxesAppClass;

#define BOXES_TYPE_APP_WINDOW (boxes_app_window_get_type ())
#define BOXES_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_APP_WINDOW, BoxesAppWindow))
#define BOXES_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_APP_WINDOW, BoxesAppWindowClass))
#define BOXES_IS_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_APP_WINDOW))
#define BOXES_IS_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_APP_WINDOW))
#define BOXES_APP_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_APP_WINDOW, BoxesAppWindowClass))

typedef struct _BoxesAppWindow BoxesAppWindow;
typedef struct _BoxesAppWindowClass BoxesAppWindowClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _BoxesAssistantMediaEntryPrivate BoxesAssistantMediaEntryPrivate;

#define BOXES_TYPE_INSTALLER_MEDIA (boxes_installer_media_get_type ())
#define BOXES_INSTALLER_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMedia))
#define BOXES_INSTALLER_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMediaClass))
#define BOXES_IS_INSTALLER_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_INSTALLER_MEDIA))
#define BOXES_IS_INSTALLER_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_INSTALLER_MEDIA))
#define BOXES_INSTALLER_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMediaClass))

typedef struct _BoxesInstallerMedia BoxesInstallerMedia;
typedef struct _BoxesInstallerMediaClass BoxesInstallerMediaClass;
typedef struct _BoxesAssistantDownloadableEntryPrivate BoxesAssistantDownloadableEntryPrivate;
#define __vala_WebKitNavigationAction_free0(var) ((var == NULL) ? NULL : (var = (_vala_WebKitNavigationAction_free (var), NULL)))
#define _g_uri_unref0(var) ((var == NULL) ? NULL : (var = (g_uri_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))

#define BOXES_TYPE_DOWNLOADS_HUB (boxes_downloads_hub_get_type ())
#define BOXES_DOWNLOADS_HUB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DOWNLOADS_HUB, BoxesDownloadsHub))
#define BOXES_DOWNLOADS_HUB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DOWNLOADS_HUB, BoxesDownloadsHubClass))
#define BOXES_IS_DOWNLOADS_HUB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DOWNLOADS_HUB))
#define BOXES_IS_DOWNLOADS_HUB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DOWNLOADS_HUB))
#define BOXES_DOWNLOADS_HUB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DOWNLOADS_HUB, BoxesDownloadsHubClass))

typedef struct _BoxesDownloadsHub BoxesDownloadsHub;
typedef struct _BoxesDownloadsHubClass BoxesDownloadsHubClass;

struct _BoxesRHELDownloadDialog {
	GtkDialog parent_instance;
	BoxesRHELDownloadDialogPrivate * priv;
};

struct _BoxesRHELDownloadDialogClass {
	GtkDialogClass parent_class;
};

struct _BoxesRHELDownloadDialogPrivate {
	GtkProgressBar* progress_bar;
	WebKitWebView* web_view;
	guint hide_progress_bar_id;
	gboolean is_rhel8;
	GCancellable* cancellable;
	BoxesAssistantDownloadableEntry* entry;
};

struct _BoxesAssistantMediaEntry {
	HdyActionRow parent_instance;
	BoxesAssistantMediaEntryPrivate * priv;
	BoxesInstallerMedia* media;
	GtkImage* media_image;
};

struct _BoxesAssistantMediaEntryClass {
	HdyActionRowClass parent_class;
};

struct _BoxesAssistantDownloadableEntry {
	BoxesAssistantMediaEntry parent_instance;
	BoxesAssistantDownloadableEntryPrivate * priv;
	OsinfoOs* os;
	gchar* url;
};

struct _BoxesAssistantDownloadableEntryClass {
	BoxesAssistantMediaEntryClass parent_class;
};

static gint BoxesRHELDownloadDialog_private_offset;
static gpointer boxes_rhel_download_dialog_parent_class = NULL;
VALA_EXTERN BoxesApp* boxes_app_app;

VALA_EXTERN GType boxes_rhel_download_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesRHELDownloadDialog, g_object_unref)
VALA_EXTERN GType boxes_assistant_media_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesAssistantMediaEntry, g_object_unref)
VALA_EXTERN GType boxes_assistant_downloadable_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesAssistantDownloadableEntry, g_object_unref)
VALA_EXTERN BoxesRHELDownloadDialog* boxes_rhel_download_dialog_new (BoxesAssistantDownloadableEntry* entry);
VALA_EXTERN BoxesRHELDownloadDialog* boxes_rhel_download_dialog_construct (GType object_type,
                                                               BoxesAssistantDownloadableEntry* entry);
VALA_EXTERN GType boxes_app_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesApp, g_object_unref)
VALA_EXTERN GType boxes_app_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesAppWindow, g_object_unref)
VALA_EXTERN BoxesAppWindow* boxes_app_get_main_window (BoxesApp* self);
VALA_EXTERN GType boxes_installer_media_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesInstallerMedia, g_object_unref)
static gboolean boxes_rhel_download_dialog_on_decide_policy (BoxesRHELDownloadDialog* self,
                                                      WebKitWebView* web_view,
                                                      WebKitPolicyDecision* decision,
                                                      WebKitPolicyDecisionType decision_type);
static WebKitNavigationAction* _vala_WebKitNavigationAction_copy (WebKitNavigationAction* self);
static void _vala_WebKitNavigationAction_free (WebKitNavigationAction* self);
VALA_EXTERN GType boxes_downloads_hub_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesDownloadsHub, g_object_unref)
VALA_EXTERN BoxesDownloadsHub* boxes_downloads_hub_get_default (void);
VALA_EXTERN void boxes_downloads_hub_add_item (BoxesDownloadsHub* self,
                                   BoxesAssistantDownloadableEntry* entry);
static gboolean _boxes_rhel_download_dialog_on_decide_policy_webkit_web_view_decide_policy (WebKitWebView* _sender,
                                                                                     WebKitPolicyDecision* decision,
                                                                                     WebKitPolicyDecisionType type,
                                                                                     gpointer self);
static void boxes_rhel_download_dialog_real_dispose (GObject* base);
static gboolean boxes_rhel_download_dialog_on_context_menu (BoxesRHELDownloadDialog* self,
                                                     WebKitWebView* web_view,
                                                     WebKitContextMenu* context_menu,
                                                     GdkEvent* event,
                                                     WebKitHitTestResult* hit_test_result);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static gboolean _boxes_rhel_download_dialog_on_context_menu_webkit_web_view_context_menu (WebKitWebView* _sender,
                                                                                   WebKitContextMenu* context_menu,
                                                                                   GdkEvent* event,
                                                                                   WebKitHitTestResult* hit_test_result,
                                                                                   gpointer self);
static void boxes_rhel_download_dialog_on_notify_estimated_load_progress (BoxesRHELDownloadDialog* self);
static gboolean ___lambda125_ (BoxesRHELDownloadDialog* self);
static gboolean ____lambda125__gsource_func (gpointer self);
static void _boxes_rhel_download_dialog_on_notify_estimated_load_progress_g_object_notify (GObject* _sender,
                                                                                    GParamSpec* pspec,
                                                                                    gpointer self);
static void boxes_rhel_download_dialog_real_close (GtkDialog* base);
static GObject * boxes_rhel_download_dialog_constructor (GType type,
                                                  guint n_construct_properties,
                                                  GObjectConstructParam * construct_properties);
static gchar** _vala_array_dup5 (gchar** self,
                          gssize length);
static void _boxes_rhel_download_dialog___lambda126_ (BoxesRHELDownloadDialog* self);
static void __boxes_rhel_download_dialog___lambda126__gfunc (gconstpointer data,
                                                      gpointer self);
static void boxes_rhel_download_dialog_finalize (GObject * obj);
static GType boxes_rhel_download_dialog_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
boxes_rhel_download_dialog_get_instance_private (BoxesRHELDownloadDialog* self)
{
	return G_STRUCT_MEMBER_P (self, BoxesRHELDownloadDialog_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

BoxesRHELDownloadDialog*
boxes_rhel_download_dialog_construct (GType object_type,
                                      BoxesAssistantDownloadableEntry* entry)
{
	BoxesRHELDownloadDialog * self = NULL;
	BoxesApp* _tmp0_;
	BoxesAppWindow* _tmp1_;
	BoxesAppWindow* _tmp2_;
	BoxesAssistantDownloadableEntry* _tmp3_;
	gchar* user_agent = NULL;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* authentication_uri = NULL;
	gchar* _tmp8_;
	OsinfoOs* os = NULL;
	OsinfoOs* _tmp9_;
	OsinfoOs* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	WebKitWebView* _tmp14_;
	g_return_val_if_fail (entry != NULL, NULL);
	self = (BoxesRHELDownloadDialog*) g_object_new (object_type, NULL);
	_tmp0_ = boxes_app_app;
	_tmp1_ = boxes_app_get_main_window (_tmp0_);
	_tmp2_ = _tmp1_;
	gtk_window_set_transient_for ((GtkWindow*) self, (GtkWindow*) _tmp2_);
	_tmp3_ = _g_object_ref0 (entry);
	_g_object_unref0 (self->priv->entry);
	self->priv->entry = _tmp3_;
	_tmp4_ = boxes_get_user_agent ();
	_tmp5_ = _tmp4_;
	_tmp6_ = g_uri_escape_string (_tmp5_, NULL, FALSE);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	user_agent = _tmp7_;
	_tmp8_ = g_strconcat ("https://developers.redhat.com/download-manager/rest/featured/file/rhel" "?tag=", user_agent, NULL);
	authentication_uri = _tmp8_;
	_tmp9_ = entry->os;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	os = _tmp10_;
	g_object_get ((OsinfoEntity*) os, "id", &_tmp11_, NULL);
	_tmp12_ = _tmp11_;
	_tmp13_ = _tmp12_;
	self->priv->is_rhel8 = g_str_has_prefix (_tmp13_, "http://redhat.com/rhel/8");
	_g_free0 (_tmp13_);
	_tmp14_ = self->priv->web_view;
	webkit_web_view_load_uri (_tmp14_, authentication_uri);
	_g_object_unref0 (os);
	_g_free0 (authentication_uri);
	_g_free0 (user_agent);
	return self;
}

BoxesRHELDownloadDialog*
boxes_rhel_download_dialog_new (BoxesAssistantDownloadableEntry* entry)
{
	return boxes_rhel_download_dialog_construct (BOXES_TYPE_RHEL_DOWNLOAD_DIALOG, entry);
}

static WebKitNavigationAction*
_vala_WebKitNavigationAction_copy (WebKitNavigationAction* self)
{
	return g_boxed_copy (webkit_navigation_action_get_type (), self);
}

static gpointer
__vala_WebKitNavigationAction_copy0 (gpointer self)
{
	return self ? _vala_WebKitNavigationAction_copy (self) : NULL;
}

static void
_vala_WebKitNavigationAction_free (WebKitNavigationAction* self)
{
	g_boxed_free (webkit_navigation_action_get_type (), self);
}

static gboolean
boxes_rhel_download_dialog_on_decide_policy (BoxesRHELDownloadDialog* self,
                                             WebKitWebView* web_view,
                                             WebKitPolicyDecision* decision,
                                             WebKitPolicyDecisionType decision_type)
{
	WebKitNavigationPolicyDecision* navigation_policy_decision = NULL;
	WebKitNavigationPolicyDecision* _tmp0_;
	WebKitNavigationAction* action = NULL;
	WebKitNavigationPolicyDecision* _tmp1_;
	WebKitNavigationAction* _tmp2_;
	WebKitNavigationAction* _tmp3_;
	WebKitURIRequest* request = NULL;
	WebKitNavigationAction* _tmp4_;
	WebKitURIRequest* _tmp5_;
	WebKitURIRequest* _tmp6_;
	gchar* request_uri = NULL;
	WebKitURIRequest* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gboolean _tmp10_ = FALSE;
	const gchar* _tmp11_;
	GUri* uri = NULL;
	gchar* query = NULL;
	GUri* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	const gchar* _tmp22_;
	GHashTable* key_value_pairs = NULL;
	const gchar* _tmp23_;
	GHashTable* _tmp24_;
	const gchar* _tmp25_ = NULL;
	gchar* download_uri = NULL;
	gchar* _tmp29_;
	const gchar* _tmp30_;
	const gchar* _tmp31_;
	BoxesAssistantDownloadableEntry* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	BoxesDownloadsHub* _tmp35_;
	BoxesDownloadsHub* _tmp36_;
	BoxesAssistantDownloadableEntry* _tmp37_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (web_view != NULL, FALSE);
	g_return_val_if_fail (decision != NULL, FALSE);
	if (decision_type != WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION) {
		result = FALSE;
		return result;
	}
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (decision, webkit_navigation_policy_decision_get_type ()) ? ((WebKitNavigationPolicyDecision*) decision) : NULL);
	navigation_policy_decision = _tmp0_;
	_tmp1_ = navigation_policy_decision;
	_tmp2_ = webkit_navigation_policy_decision_get_navigation_action (_tmp1_);
	_tmp3_ = __vala_WebKitNavigationAction_copy0 (_tmp2_);
	action = _tmp3_;
	_tmp4_ = action;
	_tmp5_ = webkit_navigation_action_get_request (_tmp4_);
	_tmp6_ = _g_object_ref0 (_tmp5_);
	request = _tmp6_;
	_tmp7_ = request;
	_tmp8_ = webkit_uri_request_get_uri (_tmp7_);
	_tmp9_ = g_strdup (_tmp8_);
	request_uri = _tmp9_;
	_tmp11_ = request_uri;
	if (!g_str_has_prefix (_tmp11_, "https://developers.redhat.com/products/rhel")) {
		const gchar* _tmp12_;
		_tmp12_ = request_uri;
		_tmp10_ = !g_str_has_prefix (_tmp12_, "https://access.cdn.redhat.com");
	} else {
		_tmp10_ = FALSE;
	}
	if (_tmp10_) {
		result = FALSE;
		_g_free0 (request_uri);
		_g_object_unref0 (request);
		__vala_WebKitNavigationAction_free0 (action);
		_g_object_unref0 (navigation_policy_decision);
		return result;
	}
	uri = NULL;
	{
		GUri* _tmp13_ = NULL;
		const gchar* _tmp14_;
		GUri* _tmp15_;
		GUri* _tmp17_;
		_tmp14_ = request_uri;
		_tmp15_ = g_uri_parse (_tmp14_, G_URI_FLAGS_NONE, &_inner_error0_);
		_tmp13_ = _tmp15_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp16_ = FALSE;
			if (_inner_error0_->domain == G_URI_ERROR) {
				goto __catch0_g_uri_error;
			}
			_g_uri_unref0 (uri);
			_g_free0 (request_uri);
			_g_object_unref0 (request);
			__vala_WebKitNavigationAction_free0 (action);
			_g_object_unref0 (navigation_policy_decision);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp16_;
		}
		_tmp17_ = _tmp13_;
		_tmp13_ = NULL;
		_g_uri_unref0 (uri);
		uri = _tmp17_;
		_g_uri_unref0 (_tmp13_);
	}
	goto __finally0;
	__catch0_g_uri_error:
	{
		g_clear_error (&_inner_error0_);
		result = FALSE;
		_g_uri_unref0 (uri);
		_g_free0 (request_uri);
		_g_object_unref0 (request);
		__vala_WebKitNavigationAction_free0 (action);
		_g_object_unref0 (navigation_policy_decision);
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp18_ = FALSE;
		_g_uri_unref0 (uri);
		_g_free0 (request_uri);
		_g_object_unref0 (request);
		__vala_WebKitNavigationAction_free0 (action);
		_g_object_unref0 (navigation_policy_decision);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp18_;
	}
	_tmp19_ = uri;
	_tmp20_ = g_uri_get_query (_tmp19_);
	_tmp21_ = g_strdup (_tmp20_);
	query = _tmp21_;
	_tmp22_ = query;
	if (_tmp22_ == NULL) {
		result = FALSE;
		_g_free0 (query);
		_g_uri_unref0 (uri);
		_g_free0 (request_uri);
		_g_object_unref0 (request);
		__vala_WebKitNavigationAction_free0 (action);
		_g_object_unref0 (navigation_policy_decision);
		return result;
	}
	_tmp23_ = query;
	_tmp24_ = soup_form_decode (_tmp23_);
	key_value_pairs = _tmp24_;
	if (self->priv->is_rhel8) {
		const gchar* _tmp26_;
		_tmp26_ = request_uri;
		_tmp25_ = _tmp26_;
	} else {
		GHashTable* _tmp27_;
		gconstpointer _tmp28_;
		_tmp27_ = key_value_pairs;
		_tmp28_ = g_hash_table_lookup (_tmp27_, "tcDownloadURL");
		_tmp25_ = (const gchar*) _tmp28_;
	}
	_tmp29_ = g_strdup (_tmp25_);
	download_uri = _tmp29_;
	_tmp30_ = download_uri;
	if (_tmp30_ == NULL) {
		result = FALSE;
		_g_free0 (download_uri);
		_g_hash_table_unref0 (key_value_pairs);
		_g_free0 (query);
		_g_uri_unref0 (uri);
		_g_free0 (request_uri);
		_g_object_unref0 (request);
		__vala_WebKitNavigationAction_free0 (action);
		_g_object_unref0 (navigation_policy_decision);
		return result;
	}
	_tmp31_ = download_uri;
	g_debug ("rhel-download-dialog.vala:81: RHEL ISO download URI: %s", _tmp31_);
	_tmp32_ = self->priv->entry;
	_tmp33_ = download_uri;
	_tmp34_ = g_strdup (_tmp33_);
	_g_free0 (_tmp32_->url);
	_tmp32_->url = _tmp34_;
	_tmp35_ = boxes_downloads_hub_get_default ();
	_tmp36_ = _tmp35_;
	_tmp37_ = self->priv->entry;
	boxes_downloads_hub_add_item (_tmp36_, _tmp37_);
	_g_object_unref0 (_tmp36_);
	webkit_policy_decision_ignore (decision);
	g_signal_emit_by_name ((GtkDialog*) self, "close");
	result = TRUE;
	_g_free0 (download_uri);
	_g_hash_table_unref0 (key_value_pairs);
	_g_free0 (query);
	_g_uri_unref0 (uri);
	_g_free0 (request_uri);
	_g_object_unref0 (request);
	__vala_WebKitNavigationAction_free0 (action);
	_g_object_unref0 (navigation_policy_decision);
	return result;
}

static gboolean
_boxes_rhel_download_dialog_on_decide_policy_webkit_web_view_decide_policy (WebKitWebView* _sender,
                                                                            WebKitPolicyDecision* decision,
                                                                            WebKitPolicyDecisionType type,
                                                                            gpointer self)
{
	gboolean result;
	result = boxes_rhel_download_dialog_on_decide_policy ((BoxesRHELDownloadDialog*) self, _sender, decision, type);
	return result;
}

static void
boxes_rhel_download_dialog_real_dispose (GObject* base)
{
	BoxesRHELDownloadDialog * self;
	self = (BoxesRHELDownloadDialog*) base;
	if (self->priv->hide_progress_bar_id != ((guint) 0)) {
		g_source_remove (self->priv->hide_progress_bar_id);
		self->priv->hide_progress_bar_id = (guint) 0;
	}
	G_OBJECT_CLASS (boxes_rhel_download_dialog_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_dialog_get_type (), GtkDialog));
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static gboolean
boxes_rhel_download_dialog_on_context_menu (BoxesRHELDownloadDialog* self,
                                            WebKitWebView* web_view,
                                            WebKitContextMenu* context_menu,
                                            GdkEvent* event,
                                            WebKitHitTestResult* hit_test_result)
{
	GList* items_to_remove = NULL;
	GList* _tmp0_;
	GList* _tmp17_;
	GList* separators_to_remove = NULL;
	WebKitContextMenuAction previous_action = 0;
	GList* _tmp20_;
	GList* _tmp26_;
	guint n_items = 0U;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (web_view != NULL, FALSE);
	g_return_val_if_fail (context_menu != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	g_return_val_if_fail (hit_test_result != NULL, FALSE);
	items_to_remove = NULL;
	_tmp0_ = webkit_context_menu_get_items (context_menu);
	{
		GList* item_collection = NULL;
		GList* item_it = NULL;
		item_collection = _tmp0_;
		for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
			WebKitContextMenuItem* _tmp1_;
			WebKitContextMenuItem* item = NULL;
			_tmp1_ = _g_object_ref0 ((WebKitContextMenuItem*) item_it->data);
			item = _tmp1_;
			{
				WebKitContextMenuAction action = 0;
				WebKitContextMenuItem* _tmp2_;
				gboolean _tmp3_ = FALSE;
				gboolean _tmp4_ = FALSE;
				gboolean _tmp5_ = FALSE;
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gboolean _tmp8_ = FALSE;
				gboolean _tmp9_ = FALSE;
				gboolean _tmp10_ = FALSE;
				gboolean _tmp11_ = FALSE;
				gboolean _tmp12_ = FALSE;
				gboolean _tmp13_ = FALSE;
				gboolean _tmp14_ = FALSE;
				_tmp2_ = item;
				action = webkit_context_menu_item_get_stock_action (_tmp2_);
				if (action == WEBKIT_CONTEXT_MENU_ACTION_GO_BACK) {
					_tmp14_ = TRUE;
				} else {
					_tmp14_ = action == WEBKIT_CONTEXT_MENU_ACTION_GO_FORWARD;
				}
				if (_tmp14_) {
					_tmp13_ = TRUE;
				} else {
					_tmp13_ = action == WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_AUDIO_TO_DISK;
				}
				if (_tmp13_) {
					_tmp12_ = TRUE;
				} else {
					_tmp12_ = action == WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_IMAGE_TO_DISK;
				}
				if (_tmp12_) {
					_tmp11_ = TRUE;
				} else {
					_tmp11_ = action == WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_LINK_TO_DISK;
				}
				if (_tmp11_) {
					_tmp10_ = TRUE;
				} else {
					_tmp10_ = action == WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_VIDEO_TO_DISK;
				}
				if (_tmp10_) {
					_tmp9_ = TRUE;
				} else {
					_tmp9_ = action == WEBKIT_CONTEXT_MENU_ACTION_OPEN_AUDIO_IN_NEW_WINDOW;
				}
				if (_tmp9_) {
					_tmp8_ = TRUE;
				} else {
					_tmp8_ = action == WEBKIT_CONTEXT_MENU_ACTION_OPEN_FRAME_IN_NEW_WINDOW;
				}
				if (_tmp8_) {
					_tmp7_ = TRUE;
				} else {
					_tmp7_ = action == WEBKIT_CONTEXT_MENU_ACTION_OPEN_IMAGE_IN_NEW_WINDOW;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					_tmp6_ = action == WEBKIT_CONTEXT_MENU_ACTION_OPEN_LINK_IN_NEW_WINDOW;
				}
				if (_tmp6_) {
					_tmp5_ = TRUE;
				} else {
					_tmp5_ = action == WEBKIT_CONTEXT_MENU_ACTION_OPEN_VIDEO_IN_NEW_WINDOW;
				}
				if (_tmp5_) {
					_tmp4_ = TRUE;
				} else {
					_tmp4_ = action == WEBKIT_CONTEXT_MENU_ACTION_RELOAD;
				}
				if (_tmp4_) {
					_tmp3_ = TRUE;
				} else {
					_tmp3_ = action == WEBKIT_CONTEXT_MENU_ACTION_STOP;
				}
				if (_tmp3_) {
					WebKitContextMenuItem* _tmp15_;
					WebKitContextMenuItem* _tmp16_;
					_tmp15_ = item;
					_tmp16_ = _g_object_ref0 (_tmp15_);
					items_to_remove = g_list_prepend (items_to_remove, _tmp16_);
				}
				_g_object_unref0 (item);
			}
		}
	}
	_tmp17_ = items_to_remove;
	{
		GList* item_collection = NULL;
		GList* item_it = NULL;
		item_collection = _tmp17_;
		for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
			WebKitContextMenuItem* _tmp18_;
			WebKitContextMenuItem* item = NULL;
			_tmp18_ = _g_object_ref0 ((WebKitContextMenuItem*) item_it->data);
			item = _tmp18_;
			{
				WebKitContextMenuItem* _tmp19_;
				_tmp19_ = item;
				webkit_context_menu_remove (context_menu, _tmp19_);
				_g_object_unref0 (item);
			}
		}
	}
	separators_to_remove = NULL;
	previous_action = WEBKIT_CONTEXT_MENU_ACTION_NO_ACTION;
	_tmp20_ = webkit_context_menu_get_items (context_menu);
	{
		GList* item_collection = NULL;
		GList* item_it = NULL;
		item_collection = _tmp20_;
		for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
			WebKitContextMenuItem* _tmp21_;
			WebKitContextMenuItem* item = NULL;
			_tmp21_ = _g_object_ref0 ((WebKitContextMenuItem*) item_it->data);
			item = _tmp21_;
			{
				WebKitContextMenuAction action = 0;
				WebKitContextMenuItem* _tmp22_;
				gboolean _tmp23_ = FALSE;
				_tmp22_ = item;
				action = webkit_context_menu_item_get_stock_action (_tmp22_);
				if (action == WEBKIT_CONTEXT_MENU_ACTION_NO_ACTION) {
					_tmp23_ = action == previous_action;
				} else {
					_tmp23_ = FALSE;
				}
				if (_tmp23_) {
					WebKitContextMenuItem* _tmp24_;
					WebKitContextMenuItem* _tmp25_;
					_tmp24_ = item;
					_tmp25_ = _g_object_ref0 (_tmp24_);
					separators_to_remove = g_list_prepend (separators_to_remove, _tmp25_);
				}
				previous_action = action;
				_g_object_unref0 (item);
			}
		}
	}
	_tmp26_ = separators_to_remove;
	{
		GList* item_collection = NULL;
		GList* item_it = NULL;
		item_collection = _tmp26_;
		for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
			WebKitContextMenuItem* _tmp27_;
			WebKitContextMenuItem* item = NULL;
			_tmp27_ = _g_object_ref0 ((WebKitContextMenuItem*) item_it->data);
			item = _tmp27_;
			{
				WebKitContextMenuItem* _tmp28_;
				_tmp28_ = item;
				webkit_context_menu_remove (context_menu, _tmp28_);
				_g_object_unref0 (item);
			}
		}
	}
	n_items = webkit_context_menu_get_n_items (context_menu);
	result = n_items == ((guint) 0);
	(separators_to_remove == NULL) ? NULL : (separators_to_remove = (_g_list_free__g_object_unref0_ (separators_to_remove), NULL));
	(items_to_remove == NULL) ? NULL : (items_to_remove = (_g_list_free__g_object_unref0_ (items_to_remove), NULL));
	return result;
}

static gboolean
_boxes_rhel_download_dialog_on_context_menu_webkit_web_view_context_menu (WebKitWebView* _sender,
                                                                          WebKitContextMenu* context_menu,
                                                                          GdkEvent* event,
                                                                          WebKitHitTestResult* hit_test_result,
                                                                          gpointer self)
{
	gboolean result;
	result = boxes_rhel_download_dialog_on_context_menu ((BoxesRHELDownloadDialog*) self, _sender, context_menu, event, hit_test_result);
	return result;
}

static gboolean
___lambda125_ (BoxesRHELDownloadDialog* self)
{
	GtkProgressBar* _tmp0_;
	gboolean result;
	_tmp0_ = self->priv->progress_bar;
	gtk_widget_hide ((GtkWidget*) _tmp0_);
	self->priv->hide_progress_bar_id = (guint) 0;
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
____lambda125__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda125_ ((BoxesRHELDownloadDialog*) self);
	return result;
}

static void
boxes_rhel_download_dialog_on_notify_estimated_load_progress (BoxesRHELDownloadDialog* self)
{
	gchar* uri = NULL;
	WebKitWebView* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp4_;
	gdouble progress = 0.0;
	WebKitWebView* _tmp6_;
	gboolean loading = FALSE;
	WebKitWebView* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_ = FALSE;
	gdouble _tmp12_ = 0.0;
	gboolean _tmp13_ = FALSE;
	GtkProgressBar* _tmp14_;
	g_return_if_fail (self != NULL);
	if (self->priv->hide_progress_bar_id != ((guint) 0)) {
		g_source_remove (self->priv->hide_progress_bar_id);
		self->priv->hide_progress_bar_id = (guint) 0;
	}
	_tmp0_ = self->priv->web_view;
	_tmp1_ = webkit_web_view_get_uri (_tmp0_);
	_tmp2_ = g_strdup (_tmp1_);
	uri = _tmp2_;
	_tmp4_ = uri;
	if (_tmp4_ == NULL) {
		_tmp3_ = TRUE;
	} else {
		const gchar* _tmp5_;
		_tmp5_ = uri;
		_tmp3_ = g_strcmp0 (_tmp5_, "about:blank") == 0;
	}
	if (_tmp3_) {
		_g_free0 (uri);
		return;
	}
	_tmp6_ = self->priv->web_view;
	progress = webkit_web_view_get_estimated_load_progress (_tmp6_);
	_tmp7_ = self->priv->web_view;
	g_object_get (_tmp7_, "is-loading", &_tmp8_, NULL);
	_tmp9_ = _tmp8_;
	loading = _tmp9_;
	if (progress == 1.0) {
		_tmp10_ = TRUE;
	} else {
		_tmp10_ = !loading;
	}
	if (_tmp10_) {
		self->priv->hide_progress_bar_id = g_timeout_add_full (G_PRIORITY_DEFAULT, BOXES_RHEL_DOWNLOAD_DIALOG_progress_bar_id_timeout, ____lambda125__gsource_func, g_object_ref (self), g_object_unref);
	} else {
		GtkProgressBar* _tmp11_;
		_tmp11_ = self->priv->progress_bar;
		gtk_widget_show ((GtkWidget*) _tmp11_);
	}
	if (loading) {
		_tmp13_ = TRUE;
	} else {
		_tmp13_ = progress == 1.0;
	}
	if (_tmp13_) {
		_tmp12_ = progress;
	} else {
		_tmp12_ = 0.0;
	}
	_tmp14_ = self->priv->progress_bar;
	gtk_progress_bar_set_fraction (_tmp14_, _tmp12_);
	_g_free0 (uri);
}

static void
_boxes_rhel_download_dialog_on_notify_estimated_load_progress_g_object_notify (GObject* _sender,
                                                                               GParamSpec* pspec,
                                                                               gpointer self)
{
	boxes_rhel_download_dialog_on_notify_estimated_load_progress ((BoxesRHELDownloadDialog*) self);
}

static void
boxes_rhel_download_dialog_real_close (GtkDialog* base)
{
	BoxesRHELDownloadDialog * self;
	GCancellable* _tmp0_;
	self = (BoxesRHELDownloadDialog*) base;
	_tmp0_ = self->priv->cancellable;
	g_cancellable_cancel (_tmp0_);
	GTK_DIALOG_CLASS (boxes_rhel_download_dialog_parent_class)->close (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_dialog_get_type (), GtkDialog));
	gtk_widget_destroy ((GtkWidget*) self);
}

static gchar**
_vala_array_dup5 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static void
_boxes_rhel_download_dialog___lambda126_ (BoxesRHELDownloadDialog* self)
{
	WebKitWebView* _tmp0_;
	WebKitWebView* _tmp1_;
	WebKitWebsiteDataManager* data_manager = NULL;
	WebKitWebView* _tmp2_;
	WebKitWebsiteDataManager* _tmp3_;
	WebKitWebsiteDataManager* _tmp4_;
	WebKitWebsiteDataManager* _tmp5_;
	_tmp0_ = self->priv->web_view;
	webkit_web_view_stop_loading (_tmp0_);
	_tmp1_ = self->priv->web_view;
	webkit_web_view_load_uri (_tmp1_, "about:blank");
	_tmp2_ = self->priv->web_view;
	_tmp3_ = webkit_web_view_get_website_data_manager (_tmp2_);
	_tmp4_ = _g_object_ref0 (_tmp3_);
	data_manager = _tmp4_;
	_tmp5_ = data_manager;
	webkit_website_data_manager_clear (_tmp5_, WEBKIT_WEBSITE_DATA_COOKIES, (GTimeSpan) 0, NULL, NULL, NULL);
	_g_object_unref0 (data_manager);
}

static void
__boxes_rhel_download_dialog___lambda126__gfunc (gconstpointer data,
                                                 gpointer self)
{
	_boxes_rhel_download_dialog___lambda126_ ((BoxesRHELDownloadDialog*) self);
}

static GObject *
boxes_rhel_download_dialog_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	BoxesRHELDownloadDialog * self;
	WebKitWebContext* context = NULL;
	WebKitWebView* _tmp0_;
	WebKitWebContext* _tmp1_;
	WebKitWebContext* _tmp2_;
	gchar** language_names = NULL;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gint language_names_length1;
	gint _language_names_size_;
	WebKitWebContext* _tmp6_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	GCancellable* _tmp8_;
	parent_class = G_OBJECT_CLASS (boxes_rhel_download_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_RHEL_DOWNLOAD_DIALOG, BoxesRHELDownloadDialog);
	_tmp0_ = self->priv->web_view;
	_tmp1_ = webkit_web_view_get_context (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	context = _tmp2_;
	_tmp4_ = _tmp3_ = g_get_language_names ();
	_tmp5_ = (_tmp4_ != NULL) ? _vala_array_dup5 (_tmp4_, _vala_array_length (_tmp3_)) : _tmp4_;
	_tmp5__length1 = _vala_array_length (_tmp3_);
	language_names = _tmp5_;
	language_names_length1 = _tmp5__length1;
	_language_names_size_ = language_names_length1;
	_tmp6_ = context;
	_tmp7_ = language_names;
	_tmp7__length1 = language_names_length1;
	webkit_web_context_set_preferred_languages (_tmp6_, _tmp7_);
	_tmp8_ = self->priv->cancellable;
	g_cancellable_connect (_tmp8_, (GCallback) __boxes_rhel_download_dialog___lambda126__gfunc, g_object_ref (self), g_object_unref);
	language_names = (_vala_array_free (language_names, language_names_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (context);
	return obj;
}

static void
boxes_rhel_download_dialog_class_init (BoxesRHELDownloadDialogClass * klass,
                                       gpointer klass_data)
{
	boxes_rhel_download_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoxesRHELDownloadDialog_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) boxes_rhel_download_dialog_real_dispose;
	((GtkDialogClass *) klass)->close = (void (*) (GtkDialog*)) boxes_rhel_download_dialog_real_close;
	G_OBJECT_CLASS (klass)->constructor = boxes_rhel_download_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = boxes_rhel_download_dialog_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Boxes/ui/assistant/rhel-download-dialog.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "progress_bar", FALSE, BoxesRHELDownloadDialog_private_offset + G_STRUCT_OFFSET (BoxesRHELDownloadDialogPrivate, progress_bar));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "web_view", FALSE, BoxesRHELDownloadDialog_private_offset + G_STRUCT_OFFSET (BoxesRHELDownloadDialogPrivate, web_view));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_decide_policy", G_CALLBACK(_boxes_rhel_download_dialog_on_decide_policy_webkit_web_view_decide_policy));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_context_menu", G_CALLBACK(_boxes_rhel_download_dialog_on_context_menu_webkit_web_view_context_menu));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_notify_estimated_load_progress", G_CALLBACK(_boxes_rhel_download_dialog_on_notify_estimated_load_progress_g_object_notify));
}

static void
boxes_rhel_download_dialog_instance_init (BoxesRHELDownloadDialog * self,
                                          gpointer klass)
{
	GCancellable* _tmp0_;
	self->priv = boxes_rhel_download_dialog_get_instance_private (self);
	self->priv->is_rhel8 = FALSE;
	_tmp0_ = g_cancellable_new ();
	self->priv->cancellable = _tmp0_;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
boxes_rhel_download_dialog_finalize (GObject * obj)
{
	BoxesRHELDownloadDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_RHEL_DOWNLOAD_DIALOG, BoxesRHELDownloadDialog);
	_g_object_unref0 (self->priv->cancellable);
	_g_object_unref0 (self->priv->entry);
	G_OBJECT_CLASS (boxes_rhel_download_dialog_parent_class)->finalize (obj);
}

static GType
boxes_rhel_download_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoxesRHELDownloadDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_rhel_download_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesRHELDownloadDialog), 0, (GInstanceInitFunc) boxes_rhel_download_dialog_instance_init, NULL };
	GType boxes_rhel_download_dialog_type_id;
	boxes_rhel_download_dialog_type_id = g_type_register_static (gtk_dialog_get_type (), "BoxesRHELDownloadDialog", &g_define_type_info, 0);
	BoxesRHELDownloadDialog_private_offset = g_type_add_instance_private (boxes_rhel_download_dialog_type_id, sizeof (BoxesRHELDownloadDialogPrivate));
	return boxes_rhel_download_dialog_type_id;
}

GType
boxes_rhel_download_dialog_get_type (void)
{
	static volatile gsize boxes_rhel_download_dialog_type_id__once = 0;
	if (g_once_init_enter (&boxes_rhel_download_dialog_type_id__once)) {
		GType boxes_rhel_download_dialog_type_id;
		boxes_rhel_download_dialog_type_id = boxes_rhel_download_dialog_get_type_once ();
		g_once_init_leave (&boxes_rhel_download_dialog_type_id__once, boxes_rhel_download_dialog_type_id);
	}
	return boxes_rhel_download_dialog_type_id__once;
}

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

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

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

