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

/*
* This file is part of budgie-desktop
*
* Copyright Budgie Desktop Developers
*
* 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 2 of the License, or
* (at your option) any later version.
*/

#include "budgie-private.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <gio/gdesktopappinfo.h>
#include <gtk/gtk.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

enum  {
	BUDGIE_APPLICATION_0_PROPERTY,
	BUDGIE_APPLICATION_NAME_PROPERTY,
	BUDGIE_APPLICATION_DESCRIPTION_PROPERTY,
	BUDGIE_APPLICATION_DESKTOP_ID_PROPERTY,
	BUDGIE_APPLICATION_EXEC_PROPERTY,
	BUDGIE_APPLICATION_KEYWORDS_PROPERTY,
	BUDGIE_APPLICATION_ICON_PROPERTY,
	BUDGIE_APPLICATION_DESKTOP_PATH_PROPERTY,
	BUDGIE_APPLICATION_CATEGORIES_PROPERTY,
	BUDGIE_APPLICATION_CONTENT_TYPES_PROPERTY,
	BUDGIE_APPLICATION_GENERIC_NAME_PROPERTY,
	BUDGIE_APPLICATION_PREFERS_DEFAULT_GPU_PROPERTY,
	BUDGIE_APPLICATION_SHOULD_SHOW_PROPERTY,
	BUDGIE_APPLICATION_DBUS_ACTIVATABLE_PROPERTY,
	BUDGIE_APPLICATION_ACTIONS_PROPERTY,
	BUDGIE_APPLICATION_NUM_PROPERTIES
};
static GParamSpec* budgie_application_properties[BUDGIE_APPLICATION_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	BUDGIE_APPLICATION_LAUNCHED_SIGNAL,
	BUDGIE_APPLICATION_LAUNCH_FAILED_SIGNAL,
	BUDGIE_APPLICATION_NUM_SIGNALS
};
static guint budgie_application_signals[BUDGIE_APPLICATION_NUM_SIGNALS] = {0};

struct _BudgieApplicationPrivate {
	gchar* _name;
	gchar* _description;
	gchar* _desktop_id;
	gchar* _exec;
	gchar** _keywords;
	gint _keywords_length1;
	gint __keywords_size_;
	GIcon* _icon;
	gchar* _desktop_path;
	gchar* _categories;
	gchar** _content_types;
	gint _content_types_length1;
	gint __content_types_size_;
	gchar* _generic_name;
	gboolean _prefers_default_gpu;
	gboolean _should_show;
	gboolean _dbus_activatable;
	gchar** _actions;
	gint _actions_length1;
	gint __actions_size_;
	BudgieSwitcheroo* switcheroo;
};

static gint BudgieApplication_private_offset;
static gpointer budgie_application_parent_class = NULL;

static void budgie_application_set_description (BudgieApplication* self,
                                         const gchar* value);
static void budgie_application_set_exec (BudgieApplication* self,
                                  const gchar* value);
static void budgie_application_set_desktop_path (BudgieApplication* self,
                                          const gchar* value);
static void budgie_application_set_keywords (BudgieApplication* self,
                                      gchar** value,
                                      gint value_length1);
static void budgie_application_set_categories (BudgieApplication* self,
                                        const gchar* value);
static void budgie_application_set_content_types (BudgieApplication* self,
                                           gchar** value,
                                           gint value_length1);
static void budgie_application_set_generic_name (BudgieApplication* self,
                                          const gchar* value);
static void budgie_application_set_prefers_default_gpu (BudgieApplication* self,
                                                 gboolean value);
static void budgie_application_set_should_show (BudgieApplication* self,
                                         gboolean value);
static void budgie_application_set_dbus_activatable (BudgieApplication* self,
                                              gboolean value);
static void budgie_application_set_actions (BudgieApplication* self,
                                     gchar** value,
                                     gint value_length1);
static void budgie_application_set_icon (BudgieApplication* self,
                                  GIcon* value);
static void __lambda4_ (BudgieApplication* self,
                 GAppInfo* info,
                 GVariant* data);
static void ___lambda4__g_app_launch_context_launched (GAppLaunchContext* _sender,
                                                GAppInfo* info,
                                                GVariant* platform_data,
                                                gpointer self);
static void __lambda5_ (BudgieApplication* self,
                 const gchar* startup_id);
static void ___lambda5__g_app_launch_context_launch_failed (GAppLaunchContext* _sender,
                                                     const gchar* startup_notify_id,
                                                     gpointer self);
static void _vala_array_add1 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add2 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add3 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add4 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add5 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void ___lambda6_ (BudgieApplication* self,
                  GPid pid,
                  gint status);
static void ____lambda6__gchild_watch_func (GPid pid,
                                     gint wait_status,
                                     gpointer self);
static gchar** _vala_array_dup1 (gchar** self,
                          gssize length);
static gchar** _vala_array_dup2 (gchar** self,
                          gssize length);
static gchar** _vala_array_dup3 (gchar** self,
                          gssize length);
static void g_cclosure_user_marshal_VOID__OBJECT_VARIANT (GClosure * closure,
                                                   GValue * return_value,
                                                   guint n_param_values,
                                                   const GValue * param_values,
                                                   gpointer invocation_hint,
                                                   gpointer marshal_data);
static GObject * budgie_application_constructor (GType type,
                                          guint n_construct_properties,
                                          GObjectConstructParam * construct_properties);
static void budgie_application_finalize (GObject * obj);
static GType budgie_application_get_type_once (void);
static void _vala_budgie_application_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec);
static void _vala_budgie_application_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec);
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
budgie_application_get_instance_private (BudgieApplication* self)
{
	return G_STRUCT_MEMBER_P (self, BudgieApplication_private_offset);
}

/**
* Create a new application from a `DesktopAppInfo`.
*/
static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

BudgieApplication*
budgie_application_construct (GType object_type,
                              GDesktopAppInfo* app_info)
{
	BudgieApplication * self = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	const gchar* _tmp9_;
	gchar** _tmp10_;
	gchar** _tmp11_;
	const gchar* _tmp12_;
	gchar** _tmp13_;
	gchar** _tmp14_;
	GIcon* desktop_icon = NULL;
	GIcon* _tmp15_;
	GIcon* _tmp16_;
	GIcon* _tmp17_;
	g_return_val_if_fail (app_info != NULL, NULL);
	self = (BudgieApplication*) g_object_new (object_type, NULL);
	_tmp0_ = g_app_info_get_display_name ((GAppInfo*) app_info);
	budgie_application_set_name (self, _tmp0_);
	_tmp2_ = g_app_info_get_description ((GAppInfo*) app_info);
	_tmp1_ = _tmp2_;
	if (_tmp1_ == NULL) {
		const gchar* _tmp3_;
		_tmp3_ = self->priv->_name;
		_tmp1_ = _tmp3_;
	}
	budgie_application_set_description (self, _tmp1_);
	_tmp4_ = g_app_info_get_commandline ((GAppInfo*) app_info);
	budgie_application_set_exec (self, _tmp4_);
	_tmp5_ = g_app_info_get_id ((GAppInfo*) app_info);
	budgie_application_set_desktop_id (self, _tmp5_);
	_tmp6_ = g_desktop_app_info_get_filename (app_info);
	budgie_application_set_desktop_path (self, _tmp6_);
	_tmp8_ = _tmp7_ = g_desktop_app_info_get_keywords (app_info);
	budgie_application_set_keywords (self, _tmp8_, _vala_array_length (_tmp7_));
	_tmp9_ = g_desktop_app_info_get_categories (app_info);
	budgie_application_set_categories (self, _tmp9_);
	_tmp11_ = _tmp10_ = g_app_info_get_supported_types ((GAppInfo*) app_info);
	budgie_application_set_content_types (self, _tmp11_, _vala_array_length (_tmp10_));
	_tmp12_ = g_desktop_app_info_get_generic_name (app_info);
	budgie_application_set_generic_name (self, _tmp12_);
	budgie_application_set_prefers_default_gpu (self, !g_desktop_app_info_get_boolean (app_info, "PrefersNonDefaultGPU"));
	budgie_application_set_should_show (self, g_app_info_should_show ((GAppInfo*) app_info));
	budgie_application_set_dbus_activatable (self, g_desktop_app_info_get_boolean (app_info, "DBusActivatable"));
	_tmp14_ = _tmp13_ = g_desktop_app_info_list_actions (app_info);
	budgie_application_set_actions (self, _tmp14_, _vala_array_length (_tmp13_));
	_tmp15_ = g_app_info_get_icon ((GAppInfo*) app_info);
	_tmp16_ = _g_object_ref0 (_tmp15_);
	desktop_icon = _tmp16_;
	_tmp17_ = desktop_icon;
	if (_tmp17_ != NULL) {
		GtkIconTheme* theme = NULL;
		GtkIconTheme* _tmp18_;
		GtkIconTheme* _tmp19_;
		GIcon* _tmp20_;
		GtkIconInfo* _tmp21_;
		GtkIconInfo* _tmp22_;
		gboolean _tmp23_;
		_tmp18_ = gtk_icon_theme_get_default ();
		theme = _tmp18_;
		_tmp19_ = theme;
		_tmp20_ = desktop_icon;
		_tmp21_ = gtk_icon_theme_lookup_by_gicon (_tmp19_, _tmp20_, 64, GTK_ICON_LOOKUP_USE_BUILTIN);
		_tmp22_ = _tmp21_;
		_tmp23_ = _tmp22_ != NULL;
		_g_object_unref0 (_tmp22_);
		if (_tmp23_) {
			GIcon* _tmp24_;
			_tmp24_ = desktop_icon;
			budgie_application_set_icon (self, _tmp24_);
		}
	}
	_g_object_unref0 (desktop_icon);
	return self;
}

BudgieApplication*
budgie_application_new (GDesktopAppInfo* app_info)
{
	return budgie_application_construct (BUDGIE_TYPE_APPLICATION, app_info);
}

static void
__lambda4_ (BudgieApplication* self,
            GAppInfo* info,
            GVariant* data)
{
	g_return_if_fail (info != NULL);
	g_return_if_fail (data != NULL);
	g_signal_emit (self, budgie_application_signals[BUDGIE_APPLICATION_LAUNCHED_SIGNAL], 0, info, data);
}

static void
___lambda4__g_app_launch_context_launched (GAppLaunchContext* _sender,
                                           GAppInfo* info,
                                           GVariant* platform_data,
                                           gpointer self)
{
	__lambda4_ ((BudgieApplication*) self, info, platform_data);
}

static void
__lambda5_ (BudgieApplication* self,
            const gchar* startup_id)
{
	g_return_if_fail (startup_id != NULL);
	g_signal_emit (self, budgie_application_signals[BUDGIE_APPLICATION_LAUNCH_FAILED_SIGNAL], 0, startup_id);
}

static void
___lambda5__g_app_launch_context_launch_failed (GAppLaunchContext* _sender,
                                                const gchar* startup_notify_id,
                                                gpointer self)
{
	__lambda5_ ((BudgieApplication*) self, startup_notify_id);
}

GAppLaunchContext*
budgie_application_create_launch_context (BudgieApplication* self)
{
	GAppLaunchContext* context = NULL;
	GAppLaunchContext* _tmp0_;
	BudgieSwitcheroo* _tmp1_;
	gboolean _tmp2_;
	GAppLaunchContext* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_app_launch_context_new ();
	context = _tmp0_;
	g_signal_connect_object (context, "launched", (GCallback) ___lambda4__g_app_launch_context_launched, self, 0);
	g_signal_connect_object (context, "launch-failed", (GCallback) ___lambda5__g_app_launch_context_launch_failed, self, 0);
	_tmp1_ = self->priv->switcheroo;
	_tmp2_ = self->priv->_prefers_default_gpu;
	budgie_switcheroo_apply_gpu_profile (_tmp1_, context, _tmp2_);
	result = context;
	return result;
}

gboolean
budgie_application_launch (BudgieApplication* self)
{
	GAppLaunchContext* context = NULL;
	GAppLaunchContext* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = budgie_application_create_launch_context (self);
	context = _tmp0_;
	result = budgie_application_launch_with_context (self, context);
	_g_object_unref0 (context);
	return result;
}

/**
* Launch this application.
*
* Returns `true` if the application launched successfully,
* otherwise `false`.
*/
static void
_vala_array_add1 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add2 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add3 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add4 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add5 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
___lambda6_ (BudgieApplication* self,
             GPid pid,
             gint status)
{
	g_spawn_close_pid (pid);
}

static void
____lambda6__gchild_watch_func (GPid pid,
                                gint wait_status,
                                gpointer self)
{
	___lambda6_ ((BudgieApplication*) self, pid, wait_status);
}

gboolean
budgie_application_launch_with_context (BudgieApplication* self,
                                        GAppLaunchContext* context)
{
	gboolean _tmp60_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (context != NULL, FALSE);
	{
		GDesktopAppInfo* info = NULL;
		const gchar* _tmp0_;
		GDesktopAppInfo* _tmp1_;
		gchar* cmd = NULL;
		GDesktopAppInfo* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		gchar** parsed_args = NULL;
		gint parsed_args_length1 = 0;
		gint _parsed_args_size_ = 0;
		const gchar* _tmp5_;
		gchar** _tmp6_ = NULL;
		gint _tmp7_ = 0;
		gboolean _tmp8_ = FALSE;
		gchar** _tmp9_;
		gint _tmp9__length1;
		gint pkexec_options = 0;
		gchar* wayland_display = NULL;
		const gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* xdg_runtime_dir = NULL;
		const gchar* _tmp22_;
		gchar* _tmp23_;
		gchar** argv = NULL;
		gchar* _tmp24_;
		gchar** _tmp25_;
		gint argv_length1;
		gint _argv_size_;
		gchar* _tmp31_;
		gboolean _tmp32_ = FALSE;
		const gchar* _tmp33_;
		gboolean _tmp39_ = FALSE;
		const gchar* _tmp40_;
		gchar** envv = NULL;
		gchar** _tmp52_;
		gchar** _tmp53_;
		gint envv_length1;
		gint _envv_size_;
		GPid child_pid = 0;
		gchar** _tmp54_;
		gint _tmp54__length1;
		gchar** _tmp55_;
		gint _tmp55__length1;
		GPid _tmp56_ = 0;
		_tmp0_ = self->priv->_desktop_id;
		_tmp1_ = g_desktop_app_info_new (_tmp0_);
		info = _tmp1_;
		_tmp2_ = info;
		_tmp3_ = g_app_info_get_commandline ((GAppInfo*) _tmp2_);
		_tmp4_ = g_strdup (_tmp3_);
		cmd = _tmp4_;
		_tmp5_ = cmd;
		g_shell_parse_argv (_tmp5_, &_tmp7_, &_tmp6_, &_inner_error0_);
		parsed_args = (_vala_array_free (parsed_args, parsed_args_length1, (GDestroyNotify) g_free), NULL);
		parsed_args = _tmp6_;
		parsed_args_length1 = _tmp7_;
		_parsed_args_size_ = parsed_args_length1;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			parsed_args = (_vala_array_free (parsed_args, parsed_args_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (cmd);
			_g_object_unref0 (info);
			goto __catch0_g_error;
		}
		_tmp9_ = parsed_args;
		_tmp9__length1 = parsed_args_length1;
		if (_tmp9__length1 == 0) {
			_tmp8_ = TRUE;
		} else {
			gchar** _tmp10_;
			gint _tmp10__length1;
			const gchar* _tmp11_;
			_tmp10_ = parsed_args;
			_tmp10__length1 = parsed_args_length1;
			_tmp11_ = _tmp10_[0];
			_tmp8_ = g_strcmp0 (_tmp11_, "pkexec") != 0;
		}
		if (_tmp8_) {
			const gchar* _tmp12_;
			GDesktopAppInfo* _tmp13_;
			GDesktopAppInfo* _tmp14_;
			_tmp12_ = self->priv->_desktop_id;
			_tmp13_ = g_desktop_app_info_new (_tmp12_);
			_tmp14_ = _tmp13_;
			g_app_info_launch ((GAppInfo*) _tmp14_, NULL, context, &_inner_error0_);
			_g_object_unref0 (_tmp14_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				parsed_args = (_vala_array_free (parsed_args, parsed_args_length1, (GDestroyNotify) g_free), NULL);
				_g_free0 (cmd);
				_g_object_unref0 (info);
				goto __catch0_g_error;
			}
			result = TRUE;
			parsed_args = (_vala_array_free (parsed_args, parsed_args_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (cmd);
			_g_object_unref0 (info);
			return result;
		}
		pkexec_options = 1;
		while (TRUE) {
			gboolean _tmp15_ = FALSE;
			gchar** _tmp16_;
			gint _tmp16__length1;
			gint _tmp19_;
			_tmp16_ = parsed_args;
			_tmp16__length1 = parsed_args_length1;
			if (pkexec_options < _tmp16__length1) {
				gchar** _tmp17_;
				gint _tmp17__length1;
				const gchar* _tmp18_;
				_tmp17_ = parsed_args;
				_tmp17__length1 = parsed_args_length1;
				_tmp18_ = _tmp17_[pkexec_options];
				_tmp15_ = g_str_has_prefix (_tmp18_, "-");
			} else {
				_tmp15_ = FALSE;
			}
			if (!_tmp15_) {
				break;
			}
			_tmp19_ = pkexec_options;
			pkexec_options = _tmp19_ + 1;
		}
		_tmp20_ = g_getenv ("WAYLAND_DISPLAY");
		_tmp21_ = g_strdup (_tmp20_);
		wayland_display = _tmp21_;
		_tmp22_ = g_getenv ("XDG_RUNTIME_DIR");
		_tmp23_ = g_strdup (_tmp22_);
		xdg_runtime_dir = _tmp23_;
		_tmp24_ = g_strdup ("pkexec");
		_tmp25_ = g_new0 (gchar*, 1 + 1);
		_tmp25_[0] = _tmp24_;
		argv = _tmp25_;
		argv_length1 = 1;
		_argv_size_ = argv_length1;
		{
			gint pkexec_args = 0;
			pkexec_args = 1;
			{
				gboolean _tmp26_ = FALSE;
				_tmp26_ = TRUE;
				while (TRUE) {
					gchar** _tmp28_;
					gint _tmp28__length1;
					const gchar* _tmp29_;
					gchar* _tmp30_;
					if (!_tmp26_) {
						gint _tmp27_;
						_tmp27_ = pkexec_args;
						pkexec_args = _tmp27_ + 1;
					}
					_tmp26_ = FALSE;
					if (!(pkexec_args < pkexec_options)) {
						break;
					}
					_tmp28_ = parsed_args;
					_tmp28__length1 = parsed_args_length1;
					_tmp29_ = _tmp28_[pkexec_args];
					_tmp30_ = g_strdup (_tmp29_);
					_vala_array_add1 (&argv, &argv_length1, &_argv_size_, _tmp30_);
				}
			}
		}
		_tmp31_ = g_strdup ("env");
		_vala_array_add2 (&argv, &argv_length1, &_argv_size_, _tmp31_);
		_tmp33_ = wayland_display;
		if (_tmp33_ != NULL) {
			const gchar* _tmp34_;
			gint _tmp35_;
			gint _tmp36_;
			_tmp34_ = wayland_display;
			_tmp35_ = strlen (_tmp34_);
			_tmp36_ = _tmp35_;
			_tmp32_ = _tmp36_ > 0;
		} else {
			_tmp32_ = FALSE;
		}
		if (_tmp32_) {
			const gchar* _tmp37_;
			gchar* _tmp38_;
			_tmp37_ = wayland_display;
			_tmp38_ = g_strdup_printf ("WAYLAND_DISPLAY=%s", _tmp37_);
			_vala_array_add3 (&argv, &argv_length1, &_argv_size_, _tmp38_);
		}
		_tmp40_ = xdg_runtime_dir;
		if (_tmp40_ != NULL) {
			const gchar* _tmp41_;
			gint _tmp42_;
			gint _tmp43_;
			_tmp41_ = xdg_runtime_dir;
			_tmp42_ = strlen (_tmp41_);
			_tmp43_ = _tmp42_;
			_tmp39_ = _tmp43_ > 0;
		} else {
			_tmp39_ = FALSE;
		}
		if (_tmp39_) {
			const gchar* _tmp44_;
			gchar* _tmp45_;
			_tmp44_ = xdg_runtime_dir;
			_tmp45_ = g_strdup_printf ("XDG_RUNTIME_DIR=%s", _tmp44_);
			_vala_array_add4 (&argv, &argv_length1, &_argv_size_, _tmp45_);
		}
		{
			gint orig = 0;
			orig = pkexec_options;
			{
				gboolean _tmp46_ = FALSE;
				_tmp46_ = TRUE;
				while (TRUE) {
					gchar** _tmp48_;
					gint _tmp48__length1;
					gchar** _tmp49_;
					gint _tmp49__length1;
					const gchar* _tmp50_;
					gchar* _tmp51_;
					if (!_tmp46_) {
						gint _tmp47_;
						_tmp47_ = orig;
						orig = _tmp47_ + 1;
					}
					_tmp46_ = FALSE;
					_tmp48_ = parsed_args;
					_tmp48__length1 = parsed_args_length1;
					if (!(orig < _tmp48__length1)) {
						break;
					}
					_tmp49_ = parsed_args;
					_tmp49__length1 = parsed_args_length1;
					_tmp50_ = _tmp49_[orig];
					_tmp51_ = g_strdup (_tmp50_);
					_vala_array_add5 (&argv, &argv_length1, &_argv_size_, _tmp51_);
				}
			}
		}
		_tmp53_ = _tmp52_ = g_get_environ ();
		envv = _tmp53_;
		envv_length1 = _vala_array_length (_tmp52_);
		_envv_size_ = envv_length1;
		_tmp54_ = argv;
		_tmp54__length1 = argv_length1;
		_tmp55_ = envv;
		_tmp55__length1 = envv_length1;
		g_spawn_async ("/", _tmp54_, _tmp55_, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &_tmp56_, &_inner_error0_);
		child_pid = _tmp56_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			envv = (_vala_array_free (envv, envv_length1, (GDestroyNotify) g_free), NULL);
			argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (xdg_runtime_dir);
			_g_free0 (wayland_display);
			parsed_args = (_vala_array_free (parsed_args, parsed_args_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (cmd);
			_g_object_unref0 (info);
			goto __catch0_g_error;
		}
		g_child_watch_add_full (G_PRIORITY_DEFAULT_IDLE, child_pid, ____lambda6__gchild_watch_func, g_object_ref (self), g_object_unref);
		result = TRUE;
		envv = (_vala_array_free (envv, envv_length1, (GDestroyNotify) g_free), NULL);
		argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (xdg_runtime_dir);
		_g_free0 (wayland_display);
		parsed_args = (_vala_array_free (parsed_args, parsed_args_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (cmd);
		_g_object_unref0 (info);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp57_;
		GError* _tmp58_;
		const gchar* _tmp59_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp57_ = self->priv->_name;
		_tmp58_ = e;
		_tmp59_ = _tmp58_->message;
		g_warning ("application.vala:180: Failed to launch application '%s': %s", _tmp57_, _tmp59_);
		result = FALSE;
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	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 _tmp60_;
}

/**
* Launch this application with the given action.
*/
void
budgie_application_launch_action (BudgieApplication* self,
                                  const gchar* action)
{
	GAppLaunchContext* context = NULL;
	GAppLaunchContext* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = budgie_application_create_launch_context (self);
	context = _tmp0_;
	budgie_application_launch_action_with_context (self, action, context);
	_g_object_unref0 (context);
}

/**
* Launch this application with the given action and launch context.
*/
void
budgie_application_launch_action_with_context (BudgieApplication* self,
                                               const gchar* action,
                                               GAppLaunchContext* context)
{
	const gchar* _tmp0_;
	GDesktopAppInfo* _tmp1_;
	GDesktopAppInfo* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	g_return_if_fail (context != NULL);
	_tmp0_ = self->priv->_desktop_id;
	_tmp1_ = g_desktop_app_info_new (_tmp0_);
	_tmp2_ = _tmp1_;
	g_desktop_app_info_launch_action (_tmp2_, action, context);
	_g_object_unref0 (_tmp2_);
}

const gchar*
budgie_application_get_name (BudgieApplication* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_name;
	result = _tmp0_;
	return result;
}

void
budgie_application_set_name (BudgieApplication* self,
                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_name);
		self->priv->_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_NAME_PROPERTY]);
	}
}

const gchar*
budgie_application_get_description (BudgieApplication* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_description;
	result = _tmp0_;
	return result;
}

static void
budgie_application_set_description (BudgieApplication* self,
                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_description (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_description);
		self->priv->_description = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_DESCRIPTION_PROPERTY]);
	}
}

const gchar*
budgie_application_get_desktop_id (BudgieApplication* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_desktop_id;
	result = _tmp0_;
	return result;
}

void
budgie_application_set_desktop_id (BudgieApplication* self,
                                   const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_desktop_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_desktop_id);
		self->priv->_desktop_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_DESKTOP_ID_PROPERTY]);
	}
}

const gchar*
budgie_application_get_exec (BudgieApplication* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_exec;
	result = _tmp0_;
	return result;
}

static void
budgie_application_set_exec (BudgieApplication* self,
                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_exec (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_exec);
		self->priv->_exec = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_EXEC_PROPERTY]);
	}
}

gchar**
budgie_application_get_keywords (BudgieApplication* self,
                                 gint* result_length1)
{
	gchar** result;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_keywords;
	_tmp0__length1 = self->priv->_keywords_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

static gchar**
_vala_array_dup1 (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
budgie_application_set_keywords (BudgieApplication* self,
                                 gchar** value,
                                 gint value_length1)
{
	gchar** old_value;
	gint old_value_length;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_keywords (self, &old_value_length);
	if (old_value != value) {
		gchar** _tmp0_;
		gint _tmp0__length1;
		_tmp0_ = (value != NULL) ? _vala_array_dup1 (value, value_length1) : value;
		_tmp0__length1 = value_length1;
		self->priv->_keywords = (_vala_array_free (self->priv->_keywords, self->priv->_keywords_length1, (GDestroyNotify) g_free), NULL);
		self->priv->_keywords = _tmp0_;
		self->priv->_keywords_length1 = _tmp0__length1;
		self->priv->__keywords_size_ = self->priv->_keywords_length1;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_KEYWORDS_PROPERTY]);
	}
}

GIcon*
budgie_application_get_icon (BudgieApplication* self)
{
	GIcon* result;
	GIcon* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_icon;
	result = _tmp0_;
	return result;
}

static void
budgie_application_set_icon (BudgieApplication* self,
                             GIcon* value)
{
	GIcon* old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_icon (self);
	if (old_value != value) {
		GIcon* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_icon);
		self->priv->_icon = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_ICON_PROPERTY]);
	}
}

const gchar*
budgie_application_get_desktop_path (BudgieApplication* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_desktop_path;
	result = _tmp0_;
	return result;
}

static void
budgie_application_set_desktop_path (BudgieApplication* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_desktop_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_desktop_path);
		self->priv->_desktop_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_DESKTOP_PATH_PROPERTY]);
	}
}

const gchar*
budgie_application_get_categories (BudgieApplication* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_categories;
	result = _tmp0_;
	return result;
}

static void
budgie_application_set_categories (BudgieApplication* self,
                                   const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_categories (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_categories);
		self->priv->_categories = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_CATEGORIES_PROPERTY]);
	}
}

gchar**
budgie_application_get_content_types (BudgieApplication* self,
                                      gint* result_length1)
{
	gchar** result;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content_types;
	_tmp0__length1 = self->priv->_content_types_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

static gchar**
_vala_array_dup2 (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
budgie_application_set_content_types (BudgieApplication* self,
                                      gchar** value,
                                      gint value_length1)
{
	gchar** old_value;
	gint old_value_length;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_content_types (self, &old_value_length);
	if (old_value != value) {
		gchar** _tmp0_;
		gint _tmp0__length1;
		_tmp0_ = (value != NULL) ? _vala_array_dup2 (value, value_length1) : value;
		_tmp0__length1 = value_length1;
		self->priv->_content_types = (_vala_array_free (self->priv->_content_types, self->priv->_content_types_length1, (GDestroyNotify) g_free), NULL);
		self->priv->_content_types = _tmp0_;
		self->priv->_content_types_length1 = _tmp0__length1;
		self->priv->__content_types_size_ = self->priv->_content_types_length1;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_CONTENT_TYPES_PROPERTY]);
	}
}

const gchar*
budgie_application_get_generic_name (BudgieApplication* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_generic_name;
	result = _tmp0_;
	return result;
}

static void
budgie_application_set_generic_name (BudgieApplication* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_generic_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_generic_name);
		self->priv->_generic_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_GENERIC_NAME_PROPERTY]);
	}
}

gboolean
budgie_application_get_prefers_default_gpu (BudgieApplication* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_prefers_default_gpu;
	return result;
}

static void
budgie_application_set_prefers_default_gpu (BudgieApplication* self,
                                            gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_prefers_default_gpu (self);
	if (old_value != value) {
		self->priv->_prefers_default_gpu = value;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_PREFERS_DEFAULT_GPU_PROPERTY]);
	}
}

gboolean
budgie_application_get_should_show (BudgieApplication* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_should_show;
	return result;
}

static void
budgie_application_set_should_show (BudgieApplication* self,
                                    gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_should_show (self);
	if (old_value != value) {
		self->priv->_should_show = value;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_SHOULD_SHOW_PROPERTY]);
	}
}

gboolean
budgie_application_get_dbus_activatable (BudgieApplication* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_dbus_activatable;
	return result;
}

static void
budgie_application_set_dbus_activatable (BudgieApplication* self,
                                         gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_dbus_activatable (self);
	if (old_value != value) {
		self->priv->_dbus_activatable = value;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_DBUS_ACTIVATABLE_PROPERTY]);
	}
}

gchar**
budgie_application_get_actions (BudgieApplication* self,
                                gint* result_length1)
{
	gchar** result;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_actions;
	_tmp0__length1 = self->priv->_actions_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

static gchar**
_vala_array_dup3 (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
budgie_application_set_actions (BudgieApplication* self,
                                gchar** value,
                                gint value_length1)
{
	gchar** old_value;
	gint old_value_length;
	g_return_if_fail (self != NULL);
	old_value = budgie_application_get_actions (self, &old_value_length);
	if (old_value != value) {
		gchar** _tmp0_;
		gint _tmp0__length1;
		_tmp0_ = (value != NULL) ? _vala_array_dup3 (value, value_length1) : value;
		_tmp0__length1 = value_length1;
		self->priv->_actions = (_vala_array_free (self->priv->_actions, self->priv->_actions_length1, (GDestroyNotify) g_free), NULL);
		self->priv->_actions = _tmp0_;
		self->priv->_actions_length1 = _tmp0__length1;
		self->priv->__actions_size_ = self->priv->_actions_length1;
		g_object_notify_by_pspec ((GObject *) self, budgie_application_properties[BUDGIE_APPLICATION_ACTIONS_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_VOID__OBJECT_VARIANT (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_VARIANT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_VARIANT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_VARIANT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_variant (param_values + 2), data2);
}

static GObject *
budgie_application_constructor (GType type,
                                guint n_construct_properties,
                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	BudgieApplication * self;
	BudgieSwitcheroo* _tmp0_;
	parent_class = G_OBJECT_CLASS (budgie_application_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BUDGIE_TYPE_APPLICATION, BudgieApplication);
	_tmp0_ = budgie_switcheroo_new ();
	_g_object_unref0 (self->priv->switcheroo);
	self->priv->switcheroo = _tmp0_;
	return obj;
}

static void
budgie_application_class_init (BudgieApplicationClass * klass,
                               gpointer klass_data)
{
	budgie_application_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BudgieApplication_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_budgie_application_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_budgie_application_set_property;
	G_OBJECT_CLASS (klass)->constructor = budgie_application_constructor;
	G_OBJECT_CLASS (klass)->finalize = budgie_application_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_NAME_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_DESCRIPTION_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_DESCRIPTION_PROPERTY] = g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_DESKTOP_ID_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_DESKTOP_ID_PROPERTY] = g_param_spec_string ("desktop-id", "desktop-id", "desktop-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_EXEC_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_EXEC_PROPERTY] = g_param_spec_string ("exec", "exec", "exec", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_KEYWORDS_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_KEYWORDS_PROPERTY] = g_param_spec_boxed ("keywords", "keywords", "keywords", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_ICON_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_ICON_PROPERTY] = g_param_spec_object ("icon", "icon", "icon", g_icon_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_DESKTOP_PATH_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_DESKTOP_PATH_PROPERTY] = g_param_spec_string ("desktop-path", "desktop-path", "desktop-path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_CATEGORIES_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_CATEGORIES_PROPERTY] = g_param_spec_string ("categories", "categories", "categories", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_CONTENT_TYPES_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_CONTENT_TYPES_PROPERTY] = g_param_spec_boxed ("content-types", "content-types", "content-types", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_GENERIC_NAME_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_GENERIC_NAME_PROPERTY] = g_param_spec_string ("generic-name", "generic-name", "generic-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_PREFERS_DEFAULT_GPU_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_PREFERS_DEFAULT_GPU_PROPERTY] = g_param_spec_boolean ("prefers-default-gpu", "prefers-default-gpu", "prefers-default-gpu", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_SHOULD_SHOW_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_SHOULD_SHOW_PROPERTY] = g_param_spec_boolean ("should-show", "should-show", "should-show", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_DBUS_ACTIVATABLE_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_DBUS_ACTIVATABLE_PROPERTY] = g_param_spec_boolean ("dbus-activatable", "dbus-activatable", "dbus-activatable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUDGIE_APPLICATION_ACTIONS_PROPERTY, budgie_application_properties[BUDGIE_APPLICATION_ACTIONS_PROPERTY] = g_param_spec_boxed ("actions", "actions", "actions", G_TYPE_STRV, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	* Emitted when the application is launched.
	*
	* See https://valadoc.org/gio-2.0/GLib.AppLaunchContext.launched.html
	*/
	budgie_application_signals[BUDGIE_APPLICATION_LAUNCHED_SIGNAL] = g_signal_new ("launched", BUDGIE_TYPE_APPLICATION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_VARIANT, G_TYPE_NONE, 2, g_app_info_get_type (), G_TYPE_VARIANT);
	/**
	* Emitted when the application fails to launch.
	*
	* See https://valadoc.org/gio-2.0/GLib.AppLaunchContext.launch_failed.html
	*/
	budgie_application_signals[BUDGIE_APPLICATION_LAUNCH_FAILED_SIGNAL] = g_signal_new ("launch-failed", BUDGIE_TYPE_APPLICATION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
budgie_application_instance_init (BudgieApplication * self,
                                  gpointer klass)
{
	gchar* _tmp0_;
	GThemedIcon* _tmp1_;
	gchar* _tmp2_;
	self->priv = budgie_application_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_description = _tmp0_;
	_tmp1_ = (GThemedIcon*) g_themed_icon_new_with_default_fallbacks ("application-default-icon");
	self->priv->_icon = (GIcon*) _tmp1_;
	_tmp2_ = g_strdup ("");
	self->priv->_generic_name = _tmp2_;
	self->priv->_prefers_default_gpu = FALSE;
	self->priv->_should_show = TRUE;
	self->priv->_dbus_activatable = FALSE;
}

static void
budgie_application_finalize (GObject * obj)
{
	BudgieApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BUDGIE_TYPE_APPLICATION, BudgieApplication);
	_g_free0 (self->priv->_name);
	_g_free0 (self->priv->_description);
	_g_free0 (self->priv->_desktop_id);
	_g_free0 (self->priv->_exec);
	self->priv->_keywords = (_vala_array_free (self->priv->_keywords, self->priv->_keywords_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (self->priv->_icon);
	_g_free0 (self->priv->_desktop_path);
	_g_free0 (self->priv->_categories);
	self->priv->_content_types = (_vala_array_free (self->priv->_content_types, self->priv->_content_types_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (self->priv->_generic_name);
	self->priv->_actions = (_vala_array_free (self->priv->_actions, self->priv->_actions_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (self->priv->switcheroo);
	G_OBJECT_CLASS (budgie_application_parent_class)->finalize (obj);
}

/**
* Represents an application that can be ran.
*/
static GType
budgie_application_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BudgieApplicationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) budgie_application_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BudgieApplication), 0, (GInstanceInitFunc) budgie_application_instance_init, NULL };
	GType budgie_application_type_id;
	budgie_application_type_id = g_type_register_static (G_TYPE_OBJECT, "BudgieApplication", &g_define_type_info, 0);
	BudgieApplication_private_offset = g_type_add_instance_private (budgie_application_type_id, sizeof (BudgieApplicationPrivate));
	return budgie_application_type_id;
}

GType
budgie_application_get_type (void)
{
	static volatile gsize budgie_application_type_id__once = 0;
	if (g_once_init_enter (&budgie_application_type_id__once)) {
		GType budgie_application_type_id;
		budgie_application_type_id = budgie_application_get_type_once ();
		g_once_init_leave (&budgie_application_type_id__once, budgie_application_type_id);
	}
	return budgie_application_type_id__once;
}

static void
_vala_budgie_application_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec)
{
	BudgieApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BUDGIE_TYPE_APPLICATION, BudgieApplication);
	switch (property_id) {
		case BUDGIE_APPLICATION_NAME_PROPERTY:
		g_value_set_string (value, budgie_application_get_name (self));
		break;
		case BUDGIE_APPLICATION_DESCRIPTION_PROPERTY:
		g_value_set_string (value, budgie_application_get_description (self));
		break;
		case BUDGIE_APPLICATION_DESKTOP_ID_PROPERTY:
		g_value_set_string (value, budgie_application_get_desktop_id (self));
		break;
		case BUDGIE_APPLICATION_EXEC_PROPERTY:
		g_value_set_string (value, budgie_application_get_exec (self));
		break;
		case BUDGIE_APPLICATION_KEYWORDS_PROPERTY:
		{
			int length;
			g_value_set_boxed (value, budgie_application_get_keywords (self, &length));
		}
		break;
		case BUDGIE_APPLICATION_ICON_PROPERTY:
		g_value_set_object (value, budgie_application_get_icon (self));
		break;
		case BUDGIE_APPLICATION_DESKTOP_PATH_PROPERTY:
		g_value_set_string (value, budgie_application_get_desktop_path (self));
		break;
		case BUDGIE_APPLICATION_CATEGORIES_PROPERTY:
		g_value_set_string (value, budgie_application_get_categories (self));
		break;
		case BUDGIE_APPLICATION_CONTENT_TYPES_PROPERTY:
		{
			int length;
			g_value_set_boxed (value, budgie_application_get_content_types (self, &length));
		}
		break;
		case BUDGIE_APPLICATION_GENERIC_NAME_PROPERTY:
		g_value_set_string (value, budgie_application_get_generic_name (self));
		break;
		case BUDGIE_APPLICATION_PREFERS_DEFAULT_GPU_PROPERTY:
		g_value_set_boolean (value, budgie_application_get_prefers_default_gpu (self));
		break;
		case BUDGIE_APPLICATION_SHOULD_SHOW_PROPERTY:
		g_value_set_boolean (value, budgie_application_get_should_show (self));
		break;
		case BUDGIE_APPLICATION_DBUS_ACTIVATABLE_PROPERTY:
		g_value_set_boolean (value, budgie_application_get_dbus_activatable (self));
		break;
		case BUDGIE_APPLICATION_ACTIONS_PROPERTY:
		{
			int length;
			g_value_set_boxed (value, budgie_application_get_actions (self, &length));
		}
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_budgie_application_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec)
{
	BudgieApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BUDGIE_TYPE_APPLICATION, BudgieApplication);
	switch (property_id) {
		case BUDGIE_APPLICATION_NAME_PROPERTY:
		budgie_application_set_name (self, g_value_get_string (value));
		break;
		case BUDGIE_APPLICATION_DESCRIPTION_PROPERTY:
		budgie_application_set_description (self, g_value_get_string (value));
		break;
		case BUDGIE_APPLICATION_DESKTOP_ID_PROPERTY:
		budgie_application_set_desktop_id (self, g_value_get_string (value));
		break;
		case BUDGIE_APPLICATION_EXEC_PROPERTY:
		budgie_application_set_exec (self, g_value_get_string (value));
		break;
		case BUDGIE_APPLICATION_KEYWORDS_PROPERTY:
		{
			gpointer boxed;
			boxed = g_value_get_boxed (value);
			budgie_application_set_keywords (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
		}
		break;
		case BUDGIE_APPLICATION_ICON_PROPERTY:
		budgie_application_set_icon (self, g_value_get_object (value));
		break;
		case BUDGIE_APPLICATION_DESKTOP_PATH_PROPERTY:
		budgie_application_set_desktop_path (self, g_value_get_string (value));
		break;
		case BUDGIE_APPLICATION_CATEGORIES_PROPERTY:
		budgie_application_set_categories (self, g_value_get_string (value));
		break;
		case BUDGIE_APPLICATION_CONTENT_TYPES_PROPERTY:
		{
			gpointer boxed;
			boxed = g_value_get_boxed (value);
			budgie_application_set_content_types (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
		}
		break;
		case BUDGIE_APPLICATION_GENERIC_NAME_PROPERTY:
		budgie_application_set_generic_name (self, g_value_get_string (value));
		break;
		case BUDGIE_APPLICATION_PREFERS_DEFAULT_GPU_PROPERTY:
		budgie_application_set_prefers_default_gpu (self, g_value_get_boolean (value));
		break;
		case BUDGIE_APPLICATION_SHOULD_SHOW_PROPERTY:
		budgie_application_set_should_show (self, g_value_get_boolean (value));
		break;
		case BUDGIE_APPLICATION_DBUS_ACTIVATABLE_PROPERTY:
		budgie_application_set_dbus_activatable (self, g_value_get_boolean (value));
		break;
		case BUDGIE_APPLICATION_ACTIONS_PROPERTY:
		{
			gpointer boxed;
			boxed = g_value_get_boxed (value);
			budgie_application_set_actions (self, boxed, (boxed == NULL) ? 0 : g_strv_length (boxed));
		}
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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;
}

