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

/*
 * Copyright 2019–2022 elementary, Inc. (https://elementary.io)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <granite-7.h>

#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 TYPE_ABSTRACT_VIEW (abstract_view_get_type ())
#define ABSTRACT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ABSTRACT_VIEW, AbstractView))
#define ABSTRACT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ABSTRACT_VIEW, AbstractViewClass))
#define IS_ABSTRACT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ABSTRACT_VIEW))
#define IS_ABSTRACT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ABSTRACT_VIEW))
#define ABSTRACT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ABSTRACT_VIEW, AbstractViewClass))

typedef struct _AbstractView AbstractView;
typedef struct _AbstractViewClass AbstractViewClass;
typedef struct _AbstractViewPrivate AbstractViewPrivate;

#define SIDELOAD_TYPE_SUCCESS_VIEW (sideload_success_view_get_type ())
#define SIDELOAD_SUCCESS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDELOAD_TYPE_SUCCESS_VIEW, SideloadSuccessView))
#define SIDELOAD_SUCCESS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDELOAD_TYPE_SUCCESS_VIEW, SideloadSuccessViewClass))
#define SIDELOAD_IS_SUCCESS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDELOAD_TYPE_SUCCESS_VIEW))
#define SIDELOAD_IS_SUCCESS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDELOAD_TYPE_SUCCESS_VIEW))
#define SIDELOAD_SUCCESS_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDELOAD_TYPE_SUCCESS_VIEW, SideloadSuccessViewClass))

typedef struct _SideloadSuccessView SideloadSuccessView;
typedef struct _SideloadSuccessViewClass SideloadSuccessViewClass;
typedef struct _SideloadSuccessViewPrivate SideloadSuccessViewPrivate;
typedef enum  {
	SIDELOAD_SUCCESS_VIEW_SUCCESS_TYPE_INSTALLED,
	SIDELOAD_SUCCESS_VIEW_SUCCESS_TYPE_ALREADY_INSTALLED
} SideloadSuccessViewSuccessType;

#define SIDELOAD_SUCCESS_VIEW_TYPE_SUCCESS_TYPE (sideload_success_view_success_type_get_type ())
enum  {
	SIDELOAD_SUCCESS_VIEW_0_PROPERTY,
	SIDELOAD_SUCCESS_VIEW_APP_NAME_PROPERTY,
	SIDELOAD_SUCCESS_VIEW_VIEW_TYPE_PROPERTY,
	SIDELOAD_SUCCESS_VIEW_NUM_PROPERTIES
};
static GParamSpec* sideload_success_view_properties[SIDELOAD_SUCCESS_VIEW_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

#define SIDELOAD_TYPE_FLATPAK_FILE (sideload_flatpak_file_get_type ())
#define SIDELOAD_FLATPAK_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDELOAD_TYPE_FLATPAK_FILE, SideloadFlatpakFile))
#define SIDELOAD_FLATPAK_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDELOAD_TYPE_FLATPAK_FILE, SideloadFlatpakFileClass))
#define SIDELOAD_IS_FLATPAK_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDELOAD_TYPE_FLATPAK_FILE))
#define SIDELOAD_IS_FLATPAK_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDELOAD_TYPE_FLATPAK_FILE))
#define SIDELOAD_FLATPAK_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDELOAD_TYPE_FLATPAK_FILE, SideloadFlatpakFileClass))

typedef struct _SideloadFlatpakFile SideloadFlatpakFile;
typedef struct _SideloadFlatpakFileClass SideloadFlatpakFileClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define SIDELOAD_TYPE_APPLICATION (sideload_application_get_type ())
#define SIDELOAD_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDELOAD_TYPE_APPLICATION, SideloadApplication))
#define SIDELOAD_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDELOAD_TYPE_APPLICATION, SideloadApplicationClass))
#define SIDELOAD_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDELOAD_TYPE_APPLICATION))
#define SIDELOAD_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDELOAD_TYPE_APPLICATION))
#define SIDELOAD_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDELOAD_TYPE_APPLICATION, SideloadApplicationClass))

typedef struct _SideloadApplication SideloadApplication;
typedef struct _SideloadApplicationClass SideloadApplicationClass;
typedef struct _Block2Data Block2Data;

#define SIDELOAD_TYPE_MAIN_WINDOW (sideload_main_window_get_type ())
#define SIDELOAD_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDELOAD_TYPE_MAIN_WINDOW, SideloadMainWindow))
#define SIDELOAD_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDELOAD_TYPE_MAIN_WINDOW, SideloadMainWindowClass))
#define SIDELOAD_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDELOAD_TYPE_MAIN_WINDOW))
#define SIDELOAD_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDELOAD_TYPE_MAIN_WINDOW))
#define SIDELOAD_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDELOAD_TYPE_MAIN_WINDOW, SideloadMainWindowClass))

typedef struct _SideloadMainWindow SideloadMainWindow;
typedef struct _SideloadMainWindowClass SideloadMainWindowClass;

#define SIDELOAD_TYPE_FLATPAK_REF_FILE (sideload_flatpak_ref_file_get_type ())
#define SIDELOAD_FLATPAK_REF_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDELOAD_TYPE_FLATPAK_REF_FILE, SideloadFlatpakRefFile))
#define SIDELOAD_FLATPAK_REF_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDELOAD_TYPE_FLATPAK_REF_FILE, SideloadFlatpakRefFileClass))
#define SIDELOAD_IS_FLATPAK_REF_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDELOAD_TYPE_FLATPAK_REF_FILE))
#define SIDELOAD_IS_FLATPAK_REF_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDELOAD_TYPE_FLATPAK_REF_FILE))
#define SIDELOAD_FLATPAK_REF_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDELOAD_TYPE_FLATPAK_REF_FILE, SideloadFlatpakRefFileClass))

typedef struct _SideloadFlatpakRefFile SideloadFlatpakRefFile;
typedef struct _SideloadFlatpakRefFileClass SideloadFlatpakRefFileClass;

struct _AbstractView {
	GtkBox parent_instance;
	AbstractViewPrivate * priv;
	GtkBox* button_box;
	GtkGrid* content_area;
	GtkImage* badge;
	GtkLabel* primary_label;
	GtkLabel* secondary_label;
};

struct _AbstractViewClass {
	GtkBoxClass parent_class;
};

struct _SideloadSuccessView {
	AbstractView parent_instance;
	SideloadSuccessViewPrivate * priv;
};

struct _SideloadSuccessViewClass {
	AbstractViewClass parent_class;
};

struct _SideloadSuccessViewPrivate {
	gchar* _app_name;
	SideloadSuccessViewSuccessType _view_type;
};

struct _Block1Data {
	int _ref_count_;
	SideloadSuccessView* self;
	SideloadFlatpakFile* file;
};

struct _Block2Data {
	int _ref_count_;
	SideloadSuccessView* self;
	SideloadApplication* app;
	SideloadFlatpakFile* file;
	GtkCheckButton* trash_check;
};

static gint SideloadSuccessView_private_offset;
static gpointer sideload_success_view_parent_class = NULL;

VALA_EXTERN GType abstract_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AbstractView, g_object_unref)
VALA_EXTERN GType sideload_success_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SideloadSuccessView, g_object_unref)
VALA_EXTERN GType sideload_success_view_success_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN SideloadSuccessView* sideload_success_view_new (const gchar* app_name,
                                                SideloadSuccessViewSuccessType type);
VALA_EXTERN SideloadSuccessView* sideload_success_view_construct (GType object_type,
                                                      const gchar* app_name,
                                                      SideloadSuccessViewSuccessType type);
VALA_EXTERN GType sideload_flatpak_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SideloadFlatpakFile, g_object_unref)
static void sideload_success_view_trash_file (SideloadSuccessView* self,
                                       SideloadFlatpakFile* file);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
VALA_EXTERN GFile* sideload_flatpak_file_get_file (SideloadFlatpakFile* self);
static void __lambda18_ (Block1Data* _data1_,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda18__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
VALA_EXTERN const gchar* sideload_success_view_get_app_name (SideloadSuccessView* self);
static void sideload_success_view_set_app_name (SideloadSuccessView* self,
                                         const gchar* value);
VALA_EXTERN SideloadSuccessViewSuccessType sideload_success_view_get_view_type (SideloadSuccessView* self);
static void sideload_success_view_set_view_type (SideloadSuccessView* self,
                                          SideloadSuccessViewSuccessType value);
static GObject * sideload_success_view_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
VALA_EXTERN GType sideload_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SideloadApplication, g_object_unref)
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
VALA_EXTERN gchar* sideload_application_get_appstore_name (SideloadApplication* self);
VALA_EXTERN GType sideload_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SideloadMainWindow, g_object_unref)
VALA_EXTERN SideloadFlatpakFile* sideload_main_window_get_flatpak_file (SideloadMainWindow* self);
VALA_EXTERN GType sideload_flatpak_ref_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SideloadFlatpakRefFile, g_object_unref)
static void _sideload_success_view___lambda19_ (Block2Data* _data2_);
static void __sideload_success_view___lambda19__gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void _sideload_success_view___lambda20_ (Block2Data* _data2_);
static void __sideload_success_view___lambda20__gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void sideload_success_view_finalize (GObject * obj);
static GType sideload_success_view_get_type_once (void);
static void _vala_sideload_success_view_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_sideload_success_view_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);

static inline gpointer
sideload_success_view_get_instance_private (SideloadSuccessView* self)
{
	return G_STRUCT_MEMBER_P (self, SideloadSuccessView_private_offset);
}

static GType
sideload_success_view_success_type_get_type_once (void)
{
	static const GEnumValue values[] = {{SIDELOAD_SUCCESS_VIEW_SUCCESS_TYPE_INSTALLED, "SIDELOAD_SUCCESS_VIEW_SUCCESS_TYPE_INSTALLED", "installed"}, {SIDELOAD_SUCCESS_VIEW_SUCCESS_TYPE_ALREADY_INSTALLED, "SIDELOAD_SUCCESS_VIEW_SUCCESS_TYPE_ALREADY_INSTALLED", "already-installed"}, {0, NULL, NULL}};
	GType sideload_success_view_success_type_type_id;
	sideload_success_view_success_type_type_id = g_enum_register_static ("SideloadSuccessViewSuccessType", values);
	return sideload_success_view_success_type_type_id;
}

GType
sideload_success_view_success_type_get_type (void)
{
	static volatile gsize sideload_success_view_success_type_type_id__once = 0;
	if (g_once_init_enter (&sideload_success_view_success_type_type_id__once)) {
		GType sideload_success_view_success_type_type_id;
		sideload_success_view_success_type_type_id = sideload_success_view_success_type_get_type_once ();
		g_once_init_leave (&sideload_success_view_success_type_type_id__once, sideload_success_view_success_type_type_id);
	}
	return sideload_success_view_success_type_type_id__once;
}

SideloadSuccessView*
sideload_success_view_construct (GType object_type,
                                 const gchar* app_name,
                                 SideloadSuccessViewSuccessType type)
{
	SideloadSuccessView * self = NULL;
	self = (SideloadSuccessView*) g_object_new (object_type, "app-name", app_name, "view-type", type, NULL);
	return self;
}

SideloadSuccessView*
sideload_success_view_new (const gchar* app_name,
                           SideloadSuccessViewSuccessType type)
{
	return sideload_success_view_construct (SIDELOAD_TYPE_SUCCESS_VIEW, app_name, type);
}

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

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		SideloadSuccessView* self;
		self = _data1_->self;
		_g_object_unref0 (_data1_->file);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}

static void
__lambda18_ (Block1Data* _data1_,
             GObject* obj,
             GAsyncResult* res)
{
	SideloadSuccessView* self;
	GError* _inner_error0_ = NULL;
	self = _data1_->self;
	g_return_if_fail (res != NULL);
	{
		GFile* _tmp0_;
		GFile* _tmp1_;
		_tmp0_ = sideload_flatpak_file_get_file (_data1_->file);
		_tmp1_ = _tmp0_;
		g_file_trash_finish (_tmp1_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp2_;
		const gchar* _tmp3_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = e;
		_tmp3_ = _tmp2_->message;
		g_warning ("SuccessView.vala:115: %s", _tmp3_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

static void
___lambda18__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda18_ (self, source_object, res);
	block1_data_unref (self);
}

static void
sideload_success_view_trash_file (SideloadSuccessView* self,
                                  SideloadFlatpakFile* file)
{
	Block1Data* _data1_;
	SideloadFlatpakFile* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (file);
	_g_object_unref0 (_data1_->file);
	_data1_->file = _tmp0_;
	_tmp1_ = sideload_flatpak_file_get_file (_data1_->file);
	_tmp2_ = _tmp1_;
	g_file_trash_async (_tmp2_, G_PRIORITY_DEFAULT, NULL, ___lambda18__gasync_ready_callback, block1_data_ref (_data1_));
	block1_data_unref (_data1_);
	_data1_ = NULL;
}

const gchar*
sideload_success_view_get_app_name (SideloadSuccessView* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_app_name;
	result = _tmp0_;
	return result;
}

static void
sideload_success_view_set_app_name (SideloadSuccessView* self,
                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = sideload_success_view_get_app_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_app_name);
		self->priv->_app_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, sideload_success_view_properties[SIDELOAD_SUCCESS_VIEW_APP_NAME_PROPERTY]);
	}
}

SideloadSuccessViewSuccessType
sideload_success_view_get_view_type (SideloadSuccessView* self)
{
	SideloadSuccessViewSuccessType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_view_type;
	return result;
}

static void
sideload_success_view_set_view_type (SideloadSuccessView* self,
                                     SideloadSuccessViewSuccessType value)
{
	SideloadSuccessViewSuccessType old_value;
	g_return_if_fail (self != NULL);
	old_value = sideload_success_view_get_view_type (self);
	if (old_value != value) {
		self->priv->_view_type = value;
		g_object_notify_by_pspec ((GObject *) self, sideload_success_view_properties[SIDELOAD_SUCCESS_VIEW_VIEW_TYPE_PROPERTY]);
	}
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		SideloadSuccessView* self;
		self = _data2_->self;
		_g_object_unref0 (_data2_->trash_check);
		_g_object_unref0 (_data2_->file);
		_g_object_unref0 (_data2_->app);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

static void
_sideload_success_view___lambda19_ (Block2Data* _data2_)
{
	SideloadSuccessView* self;
	GtkCheckButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	SideloadApplication* _tmp4_;
	self = _data2_->self;
	_tmp0_ = _data2_->trash_check;
	_tmp1_ = gtk_check_button_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		SideloadFlatpakFile* _tmp3_;
		_tmp3_ = _data2_->file;
		sideload_success_view_trash_file (self, _tmp3_);
	}
	_tmp4_ = _data2_->app;
	g_application_quit ((GApplication*) _tmp4_);
}

static void
__sideload_success_view___lambda19__gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	_sideload_success_view___lambda19_ (self);
}

static void
_sideload_success_view___lambda20_ (Block2Data* _data2_)
{
	SideloadSuccessView* self;
	GtkCheckButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	SideloadApplication* _tmp4_;
	self = _data2_->self;
	_tmp0_ = _data2_->trash_check;
	_tmp1_ = gtk_check_button_get_active (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		SideloadFlatpakFile* _tmp3_;
		_tmp3_ = _data2_->file;
		sideload_success_view_trash_file (self, _tmp3_);
	}
	_tmp4_ = _data2_->app;
	g_action_group_activate_action ((GActionGroup*) _tmp4_, "launch", NULL);
}

static void
__sideload_success_view___lambda20__gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	_sideload_success_view___lambda20_ (self);
}

static GObject *
sideload_success_view_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SideloadSuccessView * self;
	Block2Data* _data2_;
	GtkImage* _tmp0_;
	GThemedIcon* _tmp1_;
	GThemedIcon* _tmp2_;
	GApplication* _tmp3_;
	SideloadApplication* _tmp4_;
	gchar* appstore_name = NULL;
	SideloadApplication* _tmp5_;
	gchar* _tmp6_;
	SideloadApplication* _tmp7_;
	GtkWindow* _tmp8_;
	GtkWindow* _tmp9_;
	SideloadFlatpakFile* _tmp10_;
	SideloadFlatpakFile* _tmp11_;
	SideloadFlatpakFile* _tmp12_;
	gchar* secondary_label_string = NULL;
	SideloadSuccessViewSuccessType _tmp13_;
	SideloadFlatpakFile* _tmp29_;
	gchar* settings_path = NULL;
	gchar* _tmp37_;
	gchar* link_markup = NULL;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	const gchar* _tmp40_;
	gchar* _tmp41_;
	const gchar* _tmp42_;
	const gchar* _tmp43_;
	gchar* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	GtkLabel* _tmp47_;
	const gchar* _tmp48_;
	SideloadFlatpakFile* _tmp49_;
	GFile* _tmp50_;
	GFile* _tmp51_;
	gchar* _tmp52_;
	gchar* _tmp53_;
	gchar* _tmp54_;
	gchar* _tmp55_;
	GtkCheckButton* _tmp56_;
	GtkCheckButton* _tmp57_;
	GtkGrid* _tmp58_;
	GtkCheckButton* _tmp59_;
	GSettings* settings = NULL;
	GSettings* _tmp60_;
	GSettings* _tmp61_;
	GtkCheckButton* _tmp62_;
	GtkButton* close_button = NULL;
	GtkButton* _tmp63_;
	GtkButton* open_button = NULL;
	GtkButton* _tmp64_;
	GtkButton* _tmp65_;
	GtkBox* _tmp66_;
	GtkButton* _tmp67_;
	GtkBox* _tmp68_;
	GtkButton* _tmp69_;
	SideloadApplication* _tmp70_;
	GtkWindow* _tmp71_;
	GtkWindow* _tmp72_;
	GtkButton* _tmp73_;
	GtkButton* _tmp74_;
	GtkButton* _tmp75_;
	parent_class = G_OBJECT_CLASS (sideload_success_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SIDELOAD_TYPE_SUCCESS_VIEW, SideloadSuccessView);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_data2_->self = g_object_ref (self);
	_tmp0_ = ((AbstractView*) self)->badge;
	_tmp1_ = (GThemedIcon*) g_themed_icon_new ("process-completed");
	_tmp2_ = _tmp1_;
	g_object_set (_tmp0_, "gicon", (GIcon*) _tmp2_, NULL);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = g_application_get_default ();
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, SIDELOAD_TYPE_APPLICATION, SideloadApplication));
	_data2_->app = _tmp4_;
	_tmp5_ = _data2_->app;
	_tmp6_ = sideload_application_get_appstore_name (_tmp5_);
	appstore_name = _tmp6_;
	_tmp7_ = _data2_->app;
	_tmp8_ = gtk_application_get_active_window ((GtkApplication*) _tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = sideload_main_window_get_flatpak_file (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, SIDELOAD_TYPE_MAIN_WINDOW, SideloadMainWindow));
	_tmp11_ = _tmp10_;
	_tmp12_ = _g_object_ref0 (_tmp11_);
	_data2_->file = _tmp12_;
	_tmp13_ = self->priv->_view_type;
	if (_tmp13_ == SIDELOAD_SUCCESS_VIEW_SUCCESS_TYPE_INSTALLED) {
		const gchar* _tmp14_;
		gchar* _tmp20_;
		_tmp14_ = self->priv->_app_name;
		if (_tmp14_ != NULL) {
			GtkLabel* _tmp15_;
			const gchar* _tmp16_;
			gchar* _tmp17_;
			gchar* _tmp18_;
			_tmp15_ = ((AbstractView*) self)->primary_label;
			_tmp16_ = self->priv->_app_name;
			_tmp17_ = g_strdup_printf (_ ("“%s” has been installed"), _tmp16_);
			_tmp18_ = _tmp17_;
			gtk_label_set_label (_tmp15_, _tmp18_);
			_g_free0 (_tmp18_);
		} else {
			GtkLabel* _tmp19_;
			_tmp19_ = ((AbstractView*) self)->primary_label;
			gtk_label_set_label (_tmp19_, _ ("The app has been installed"));
		}
		_tmp20_ = g_strdup (_ ("Open it any time from the Applications Menu."));
		_g_free0 (secondary_label_string);
		secondary_label_string = _tmp20_;
	} else {
		SideloadSuccessViewSuccessType _tmp21_;
		_tmp21_ = self->priv->_view_type;
		if (_tmp21_ == SIDELOAD_SUCCESS_VIEW_SUCCESS_TYPE_ALREADY_INSTALLED) {
			const gchar* _tmp22_;
			gchar* _tmp28_;
			_tmp22_ = self->priv->_app_name;
			if (_tmp22_ != NULL) {
				GtkLabel* _tmp23_;
				const gchar* _tmp24_;
				gchar* _tmp25_;
				gchar* _tmp26_;
				_tmp23_ = ((AbstractView*) self)->primary_label;
				_tmp24_ = self->priv->_app_name;
				_tmp25_ = g_strdup_printf (_ ("“%s” is already installed"), _tmp24_);
				_tmp26_ = _tmp25_;
				gtk_label_set_label (_tmp23_, _tmp26_);
				_g_free0 (_tmp26_);
			} else {
				GtkLabel* _tmp27_;
				_tmp27_ = ((AbstractView*) self)->primary_label;
				gtk_label_set_label (_tmp27_, _ ("This app is already installed"));
			}
			_tmp28_ = g_strdup (_ ("No changes were made."));
			_g_free0 (secondary_label_string);
			secondary_label_string = _tmp28_;
		}
	}
	_tmp29_ = _data2_->file;
	if (SIDELOAD_IS_FLATPAK_REF_FILE (_tmp29_)) {
		const gchar* _tmp30_;
		gchar* _tmp31_;
		const gchar* _tmp32_;
		const gchar* _tmp33_;
		gchar* _tmp34_;
		gchar* _tmp35_;
		gchar* _tmp36_;
		_tmp30_ = secondary_label_string;
		_tmp31_ = g_strconcat (_tmp30_, " ", NULL);
		_g_free0 (secondary_label_string);
		secondary_label_string = _tmp31_;
		_tmp32_ = secondary_label_string;
		_tmp33_ = appstore_name;
		_tmp34_ = g_strdup_printf (_ ("Visit %s for app information, updates, and to uninstall."), _tmp33_);
		_tmp35_ = _tmp34_;
		_tmp36_ = g_strconcat (_tmp32_, _tmp35_, NULL);
		_g_free0 (secondary_label_string);
		secondary_label_string = _tmp36_;
		_g_free0 (_tmp35_);
	}
	_tmp37_ = g_strdup (_ ("System Settings → Applications…"));
	settings_path = _tmp37_;
	_tmp38_ = settings_path;
	_tmp39_ = g_strdup_printf ("<a href='%s'>%s</a>", "settings://applications/permissions", _tmp38_);
	link_markup = _tmp39_;
	_tmp40_ = secondary_label_string;
	_tmp41_ = g_strconcat (_tmp40_, " ", NULL);
	_g_free0 (secondary_label_string);
	secondary_label_string = _tmp41_;
	_tmp42_ = secondary_label_string;
	_tmp43_ = link_markup;
	_tmp44_ = g_strdup_printf (_ ("Permissions can be changed in %s"), _tmp43_);
	_tmp45_ = _tmp44_;
	_tmp46_ = g_strconcat (_tmp42_, _tmp45_, NULL);
	_g_free0 (secondary_label_string);
	secondary_label_string = _tmp46_;
	_g_free0 (_tmp45_);
	_tmp47_ = ((AbstractView*) self)->secondary_label;
	_tmp48_ = secondary_label_string;
	gtk_label_set_label (_tmp47_, _tmp48_);
	_tmp49_ = _data2_->file;
	_tmp50_ = sideload_flatpak_file_get_file (_tmp49_);
	_tmp51_ = _tmp50_;
	_tmp52_ = g_file_get_basename (_tmp51_);
	_tmp53_ = _tmp52_;
	_tmp54_ = g_strdup_printf (_ ("Move ”%s” to Trash"), _tmp53_);
	_tmp55_ = _tmp54_;
	_tmp56_ = (GtkCheckButton*) gtk_check_button_new_with_label (_tmp55_);
	g_object_ref_sink (_tmp56_);
	_tmp57_ = _tmp56_;
	_g_free0 (_tmp55_);
	_g_free0 (_tmp53_);
	_data2_->trash_check = _tmp57_;
	_tmp58_ = ((AbstractView*) self)->content_area;
	_tmp59_ = _data2_->trash_check;
	gtk_grid_attach (_tmp58_, (GtkWidget*) _tmp59_, 0, 0, 1, 1);
	_tmp60_ = g_settings_new ("io.elementary.sideload");
	settings = _tmp60_;
	_tmp61_ = settings;
	_tmp62_ = _data2_->trash_check;
	g_settings_bind (_tmp61_, "trash-on-success", (GObject*) _tmp62_, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp63_ = (GtkButton*) gtk_button_new_with_label (_ ("Close"));
	g_object_ref_sink (_tmp63_);
	close_button = _tmp63_;
	_tmp64_ = (GtkButton*) gtk_button_new_with_label (_ ("Open App"));
	g_object_ref_sink (_tmp64_);
	open_button = _tmp64_;
	_tmp65_ = open_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp65_, GRANITE_STYLE_CLASS_SUGGESTED_ACTION);
	_tmp66_ = ((AbstractView*) self)->button_box;
	_tmp67_ = close_button;
	gtk_box_append (_tmp66_, (GtkWidget*) _tmp67_);
	_tmp68_ = ((AbstractView*) self)->button_box;
	_tmp69_ = open_button;
	gtk_box_append (_tmp68_, (GtkWidget*) _tmp69_);
	_tmp70_ = _data2_->app;
	_tmp71_ = gtk_application_get_active_window ((GtkApplication*) _tmp70_);
	_tmp72_ = _tmp71_;
	_tmp73_ = open_button;
	gtk_window_set_default_widget ((GtkWindow*) G_TYPE_CHECK_INSTANCE_CAST (_tmp72_, SIDELOAD_TYPE_MAIN_WINDOW, SideloadMainWindow), (GtkWidget*) _tmp73_);
	_tmp74_ = close_button;
	g_signal_connect_data (_tmp74_, "clicked", (GCallback) __sideload_success_view___lambda19__gtk_button_clicked, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
	_tmp75_ = open_button;
	g_signal_connect_data (_tmp75_, "clicked", (GCallback) __sideload_success_view___lambda20__gtk_button_clicked, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
	_g_object_unref0 (open_button);
	_g_object_unref0 (close_button);
	_g_object_unref0 (settings);
	_g_free0 (link_markup);
	_g_free0 (settings_path);
	_g_free0 (secondary_label_string);
	_g_free0 (appstore_name);
	block2_data_unref (_data2_);
	_data2_ = NULL;
	return obj;
}

static void
sideload_success_view_class_init (SideloadSuccessViewClass * klass,
                                  gpointer klass_data)
{
	sideload_success_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SideloadSuccessView_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_sideload_success_view_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_sideload_success_view_set_property;
	G_OBJECT_CLASS (klass)->constructor = sideload_success_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = sideload_success_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SIDELOAD_SUCCESS_VIEW_APP_NAME_PROPERTY, sideload_success_view_properties[SIDELOAD_SUCCESS_VIEW_APP_NAME_PROPERTY] = g_param_spec_string ("app-name", "app-name", "app-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SIDELOAD_SUCCESS_VIEW_VIEW_TYPE_PROPERTY, sideload_success_view_properties[SIDELOAD_SUCCESS_VIEW_VIEW_TYPE_PROPERTY] = g_param_spec_enum ("view-type", "view-type", "view-type", SIDELOAD_SUCCESS_VIEW_TYPE_SUCCESS_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
sideload_success_view_instance_init (SideloadSuccessView * self,
                                     gpointer klass)
{
	self->priv = sideload_success_view_get_instance_private (self);
}

static void
sideload_success_view_finalize (GObject * obj)
{
	SideloadSuccessView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SIDELOAD_TYPE_SUCCESS_VIEW, SideloadSuccessView);
	_g_free0 (self->priv->_app_name);
	G_OBJECT_CLASS (sideload_success_view_parent_class)->finalize (obj);
}

static GType
sideload_success_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SideloadSuccessViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sideload_success_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SideloadSuccessView), 0, (GInstanceInitFunc) sideload_success_view_instance_init, NULL };
	GType sideload_success_view_type_id;
	sideload_success_view_type_id = g_type_register_static (TYPE_ABSTRACT_VIEW, "SideloadSuccessView", &g_define_type_info, 0);
	SideloadSuccessView_private_offset = g_type_add_instance_private (sideload_success_view_type_id, sizeof (SideloadSuccessViewPrivate));
	return sideload_success_view_type_id;
}

GType
sideload_success_view_get_type (void)
{
	static volatile gsize sideload_success_view_type_id__once = 0;
	if (g_once_init_enter (&sideload_success_view_type_id__once)) {
		GType sideload_success_view_type_id;
		sideload_success_view_type_id = sideload_success_view_get_type_once ();
		g_once_init_leave (&sideload_success_view_type_id__once, sideload_success_view_type_id);
	}
	return sideload_success_view_type_id__once;
}

static void
_vala_sideload_success_view_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	SideloadSuccessView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SIDELOAD_TYPE_SUCCESS_VIEW, SideloadSuccessView);
	switch (property_id) {
		case SIDELOAD_SUCCESS_VIEW_APP_NAME_PROPERTY:
		g_value_set_string (value, sideload_success_view_get_app_name (self));
		break;
		case SIDELOAD_SUCCESS_VIEW_VIEW_TYPE_PROPERTY:
		g_value_set_enum (value, sideload_success_view_get_view_type (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_sideload_success_view_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	SideloadSuccessView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SIDELOAD_TYPE_SUCCESS_VIEW, SideloadSuccessView);
	switch (property_id) {
		case SIDELOAD_SUCCESS_VIEW_APP_NAME_PROPERTY:
		sideload_success_view_set_app_name (self, g_value_get_string (value));
		break;
		case SIDELOAD_SUCCESS_VIEW_VIEW_TYPE_PROPERTY:
		sideload_success_view_set_view_type (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

