/* Application.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from Application.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, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
*/

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

#define GETTEXT_PACKAGE "io.elementary.sideload"
#define LOCALEDIR "/usr/share/locale"
#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 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 _SideloadApplicationPrivate SideloadApplicationPrivate;
enum  {
	SIDELOAD_APPLICATION_0_PROPERTY,
	SIDELOAD_APPLICATION_NUM_PROPERTIES
};
static GParamSpec* sideload_application_properties[SIDELOAD_APPLICATION_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#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;
typedef struct _Block3Data Block3Data;

#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;
typedef struct _SideloadApplicationOpenFileData SideloadApplicationOpenFileData;
typedef struct _Block4Data Block4Data;

struct _SideloadApplication {
	GtkApplication parent_instance;
	SideloadApplicationPrivate * priv;
};

struct _SideloadApplicationClass {
	GtkApplicationClass parent_class;
};

struct _Block3Data {
	int _ref_count_;
	SideloadApplication* self;
	SideloadMainWindow* main_window;
	gpointer _async_data_;
};

struct _SideloadApplicationOpenFileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SideloadApplication* self;
	GFile* file;
	Block3Data* _data3_;
	SideloadMainWindow* _tmp0_;
	SideloadMainWindow* _tmp1_;
	GSimpleAction* launch_action;
	GSimpleAction* _tmp2_;
};

struct _Block4Data {
	int _ref_count_;
	SideloadApplication* self;
	GraniteSettings* granite_settings;
	GtkSettings* gtk_settings;
};

static gpointer sideload_application_parent_class = NULL;

VALA_EXTERN GType sideload_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SideloadApplication, g_object_unref)
VALA_EXTERN SideloadApplication* sideload_application_new (void);
VALA_EXTERN SideloadApplication* sideload_application_construct (GType object_type);
static void sideload_application_real_open (GApplication* base,
                                     GFile** files,
                                     gint files_length1,
                                     const gchar* hint);
static void sideload_application_open_file (SideloadApplication* self,
                                     GFile* file,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static void sideload_application_open_file_finish (SideloadApplication* self,
                                            GAsyncResult* _res_);
static void sideload_application_open_file_data_free (gpointer _data);
static gboolean sideload_application_open_file_co (SideloadApplicationOpenFileData* _data_);
VALA_EXTERN GType sideload_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SideloadMainWindow, g_object_unref)
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
VALA_EXTERN SideloadMainWindow* sideload_main_window_new (GtkApplication* application,
                                              GFile* file);
VALA_EXTERN SideloadMainWindow* sideload_main_window_construct (GType object_type,
                                                    GtkApplication* application,
                                                    GFile* file);
static void __lambda30_ (Block3Data* _data3_);
VALA_EXTERN GType sideload_flatpak_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SideloadFlatpakFile, g_object_unref)
VALA_EXTERN SideloadFlatpakFile* sideload_main_window_get_flatpak_file (SideloadMainWindow* self);
VALA_EXTERN void sideload_flatpak_file_launch (SideloadFlatpakFile* self,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void sideload_flatpak_file_launch_finish (SideloadFlatpakFile* self,
                                          GAsyncResult* _res_);
static void __lambda31_ (Block3Data* _data3_,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda31__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void ___lambda30__g_simple_action_activate (GSimpleAction* _sender,
                                            GVariant* parameter,
                                            gpointer self);
static void sideload_application_real_startup (GApplication* base);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static void __lambda32_ (Block4Data* _data4_);
static void ___lambda32__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static void _g_application_quit_g_simple_action_activate (GSimpleAction* _sender,
                                                   GVariant* parameter,
                                                   gpointer self);
static void sideload_application_real_activate (GApplication* base);
VALA_EXTERN gchar* sideload_application_get_appstore_name (SideloadApplication* self);
static gint sideload_application_main (gchar** args,
                                gint args_length1);
static GType sideload_application_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);

SideloadApplication*
sideload_application_construct (GType object_type)
{
	SideloadApplication * self = NULL;
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	self = (SideloadApplication*) g_object_new (object_type, "application-id", "io.elementary.sideload", "flags", G_APPLICATION_HANDLES_OPEN, NULL);
	return self;
}

SideloadApplication*
sideload_application_new (void)
{
	return sideload_application_construct (SIDELOAD_TYPE_APPLICATION);
}

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

static void
sideload_application_real_open (GApplication* base,
                                GFile** files,
                                gint files_length1,
                                const gchar* hint)
{
	SideloadApplication * self;
	GFile* file = NULL;
	GFile* _tmp0_;
	GFile* _tmp1_;
	GList* _tmp2_;
	GFile* _tmp5_;
	self = (SideloadApplication*) base;
	g_return_if_fail (hint != NULL);
	if (files_length1 == 0) {
		return;
	}
	_tmp0_ = files[0];
	_tmp1_ = _g_object_ref0 (_tmp0_);
	file = _tmp1_;
	_tmp2_ = gtk_application_get_windows ((GtkApplication*) self);
	if (g_list_length (_tmp2_) > ((guint) 0)) {
		GList* _tmp3_;
		gconstpointer _tmp4_;
		_tmp3_ = gtk_application_get_windows ((GtkApplication*) self);
		_tmp4_ = _tmp3_->data;
		gtk_window_present ((GtkWindow*) _tmp4_);
		_g_object_unref0 (file);
		return;
	}
	g_application_hold ((GApplication*) self);
	_tmp5_ = file;
	sideload_application_open_file (self, _tmp5_, NULL, NULL);
	_g_object_unref0 (file);
}

static void
sideload_application_open_file_data_free (gpointer _data)
{
	SideloadApplicationOpenFileData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->self);
	g_slice_free (SideloadApplicationOpenFileData, _data_);
}

static void
sideload_application_open_file (SideloadApplication* self,
                                GFile* file,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	SideloadApplicationOpenFileData* _data_;
	SideloadApplication* _tmp0_;
	GFile* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	_data_ = g_slice_new0 (SideloadApplicationOpenFileData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sideload_application_open_file_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (file);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp1_;
	sideload_application_open_file_co (_data_);
}

static void
sideload_application_open_file_finish (SideloadApplication* self,
                                       GAsyncResult* _res_)
{
	SideloadApplicationOpenFileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		SideloadApplication* self;
		self = _data3_->self;
		_g_object_unref0 (_data3_->main_window);
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static void
__lambda31_ (Block3Data* _data3_,
             GObject* obj,
             GAsyncResult* res)
{
	SideloadApplication* self;
	SideloadMainWindow* _tmp0_;
	SideloadFlatpakFile* _tmp1_;
	SideloadFlatpakFile* _tmp2_;
	SideloadMainWindow* _tmp3_;
	self = _data3_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data3_->main_window;
	_tmp1_ = sideload_main_window_get_flatpak_file (_tmp0_);
	_tmp2_ = _tmp1_;
	sideload_flatpak_file_launch_finish (_tmp2_, res);
	_tmp3_ = _data3_->main_window;
	gtk_window_close ((GtkWindow*) _tmp3_);
}

static void
___lambda31__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda31_ (self, source_object, res);
	block3_data_unref (self);
}

static void
__lambda30_ (Block3Data* _data3_)
{
	SideloadApplication* self;
	SideloadMainWindow* _tmp0_;
	SideloadFlatpakFile* _tmp1_;
	SideloadFlatpakFile* _tmp2_;
	self = _data3_->self;
	_tmp0_ = _data3_->main_window;
	_tmp1_ = sideload_main_window_get_flatpak_file (_tmp0_);
	_tmp2_ = _tmp1_;
	sideload_flatpak_file_launch (_tmp2_, ___lambda31__gasync_ready_callback, block3_data_ref (_data3_));
}

static void
___lambda30__g_simple_action_activate (GSimpleAction* _sender,
                                       GVariant* parameter,
                                       gpointer self)
{
	__lambda30_ (self);
}

static gboolean
sideload_application_open_file_co (SideloadApplicationOpenFileData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data3_ = g_slice_new0 (Block3Data);
	_data_->_data3_->_ref_count_ = 1;
	_data_->_data3_->self = g_object_ref (_data_->self);
	_data_->_data3_->_async_data_ = _data_;
	_data_->_data3_->main_window = NULL;
	_data_->_tmp0_ = sideload_main_window_new ((GtkApplication*) _data_->self, _data_->file);
	g_object_ref_sink (_data_->_tmp0_);
	_g_object_unref0 (_data_->_data3_->main_window);
	_data_->_data3_->main_window = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->_data3_->main_window;
	gtk_window_present ((GtkWindow*) _data_->_tmp1_);
	_data_->_tmp2_ = g_simple_action_new ("launch", NULL);
	_data_->launch_action = _data_->_tmp2_;
	g_action_map_add_action ((GActionMap*) _data_->self, (GAction*) _data_->launch_action);
	g_signal_connect_data (_data_->launch_action, "activate", (GCallback) ___lambda30__g_simple_action_activate, block3_data_ref (_data_->_data3_), (GClosureNotify) block3_data_unref, 0);
	g_application_release ((GApplication*) _data_->self);
	_g_object_unref0 (_data_->launch_action);
	block3_data_unref (_data_->_data3_);
	_data_->_data3_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		SideloadApplication* self;
		self = _data4_->self;
		_g_object_unref0 (_data4_->gtk_settings);
		_g_object_unref0 (_data4_->granite_settings);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static void
__lambda32_ (Block4Data* _data4_)
{
	SideloadApplication* self;
	GraniteSettingsColorScheme _tmp0_;
	GraniteSettingsColorScheme _tmp1_;
	self = _data4_->self;
	_tmp0_ = granite_settings_get_prefers_color_scheme (_data4_->granite_settings);
	_tmp1_ = _tmp0_;
	g_object_set (_data4_->gtk_settings, "gtk-application-prefer-dark-theme", _tmp1_ == GRANITE_SETTINGS_COLOR_SCHEME_DARK, NULL);
}

static void
___lambda32__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda32_ (self);
}

static void
_g_application_quit_g_simple_action_activate (GSimpleAction* _sender,
                                              GVariant* parameter,
                                              gpointer self)
{
	g_application_quit ((GApplication*) self);
}

static void
sideload_application_real_startup (GApplication* base)
{
	SideloadApplication * self;
	Block4Data* _data4_;
	GraniteSettings* _tmp0_;
	GraniteSettings* _tmp1_;
	GtkSettings* _tmp2_;
	GtkSettings* _tmp3_;
	GraniteSettingsColorScheme _tmp4_;
	GraniteSettingsColorScheme _tmp5_;
	GSimpleAction* quit_action = NULL;
	GSimpleAction* _tmp6_;
	gchar* _tmp7_;
	gchar** _tmp8_;
	gchar** _tmp9_;
	gint _tmp9__length1;
	self = (SideloadApplication*) base;
	_data4_ = g_slice_new0 (Block4Data);
	_data4_->_ref_count_ = 1;
	_data4_->self = g_object_ref (self);
	G_APPLICATION_CLASS (sideload_application_parent_class)->startup ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_application_get_type (), GtkApplication));
	granite_init ();
	_tmp0_ = granite_settings_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_data4_->granite_settings = _tmp1_;
	_tmp2_ = gtk_settings_get_default ();
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_data4_->gtk_settings = _tmp3_;
	_tmp4_ = granite_settings_get_prefers_color_scheme (_data4_->granite_settings);
	_tmp5_ = _tmp4_;
	g_object_set (_data4_->gtk_settings, "gtk-application-prefer-dark-theme", _tmp5_ == GRANITE_SETTINGS_COLOR_SCHEME_DARK, NULL);
	g_signal_connect_data ((GObject*) _data4_->granite_settings, "notify::prefers-color-scheme", (GCallback) ___lambda32__g_object_notify, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
	_tmp6_ = g_simple_action_new ("quit", NULL);
	quit_action = _tmp6_;
	g_action_map_add_action ((GActionMap*) self, (GAction*) quit_action);
	_tmp7_ = g_strdup ("<Control>q");
	_tmp8_ = g_new0 (gchar*, 1 + 1);
	_tmp8_[0] = _tmp7_;
	_tmp9_ = _tmp8_;
	_tmp9__length1 = 1;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "app.quit", _tmp9_);
	_tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL);
	g_signal_connect_object (quit_action, "activate", (GCallback) _g_application_quit_g_simple_action_activate, (GApplication*) self, 0);
	_g_object_unref0 (quit_action);
	block4_data_unref (_data4_);
	_data4_ = NULL;
}

static void
sideload_application_real_activate (GApplication* base)
{
	SideloadApplication * self;
	self = (SideloadApplication*) base;
}

gchar*
sideload_application_get_appstore_name (SideloadApplication* self)
{
	GAppInfo* appinfo = NULL;
	GAppInfo* _tmp0_;
	GAppInfo* _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_app_info_get_default_for_uri_scheme ("appstream");
	appinfo = _tmp0_;
	_tmp1_ = appinfo;
	if (_tmp1_ != NULL) {
		GAppInfo* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp2_ = appinfo;
		_tmp3_ = g_app_info_get_name (_tmp2_);
		_tmp4_ = g_strdup (_tmp3_);
		result = _tmp4_;
		_g_object_unref0 (appinfo);
		return result;
	} else {
		gchar* _tmp5_;
		_tmp5_ = g_strdup (_ ("your software center"));
		result = _tmp5_;
		_g_object_unref0 (appinfo);
		return result;
	}
}

static gint
sideload_application_main (gchar** args,
                           gint args_length1)
{
	SideloadApplication* app = NULL;
	SideloadApplication* _tmp1_;
	SideloadApplication* _tmp2_;
	gint result;
	if (args_length1 < 2) {
		const gchar* _tmp0_;
		_tmp0_ = args[0];
		g_print ("Usage: %s /path/to/flatpakref or /path/to/flatpak\n", _tmp0_);
		result = 1;
		return result;
	}
	_tmp1_ = sideload_application_new ();
	app = _tmp1_;
	_tmp2_ = app;
	result = g_application_run ((GApplication*) _tmp2_, (gint) args_length1, args);
	_g_object_unref0 (app);
	return result;
}

int
main (int argc,
      char ** argv)
{
	return sideload_application_main (argv, argc);
}

static void
sideload_application_class_init (SideloadApplicationClass * klass,
                                 gpointer klass_data)
{
	sideload_application_parent_class = g_type_class_peek_parent (klass);
	((GApplicationClass *) klass)->open = (void (*) (GApplication*, GFile**, gint, const gchar*)) sideload_application_real_open;
	((GApplicationClass *) klass)->startup = (void (*) (GApplication*)) sideload_application_real_startup;
	((GApplicationClass *) klass)->activate = (void (*) (GApplication*)) sideload_application_real_activate;
}

static void
sideload_application_instance_init (SideloadApplication * self,
                                    gpointer klass)
{
}

static GType
sideload_application_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SideloadApplicationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sideload_application_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SideloadApplication), 0, (GInstanceInitFunc) sideload_application_instance_init, NULL };
	GType sideload_application_type_id;
	sideload_application_type_id = g_type_register_static (gtk_application_get_type (), "SideloadApplication", &g_define_type_info, 0);
	return sideload_application_type_id;
}

GType
sideload_application_get_type (void)
{
	static volatile gsize sideload_application_type_id__once = 0;
	if (g_once_init_enter (&sideload_application_type_id__once)) {
		GType sideload_application_type_id;
		sideload_application_type_id = sideload_application_get_type_once ();
		g_once_init_leave (&sideload_application_type_id__once, sideload_application_type_id);
	}
	return sideload_application_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);
}

