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

/*
 * Copyright 2011-2020 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 2 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 "notifications.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <gio/gdesktopappinfo.h>
#include <pango/pango.h>
#include <float.h>
#include <math.h>
#include <granite-7.h>

#define WIDGETS_APP_ENTRY_BUBBLES_KEY "bubbles"
#define WIDGETS_APP_ENTRY_SOUNDS_KEY "sounds"
#define WIDGETS_APP_ENTRY_REMEMBER_KEY "remember"
#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  {
	WIDGETS_APP_ENTRY_0_PROPERTY,
	WIDGETS_APP_ENTRY_APP_PROPERTY,
	WIDGETS_APP_ENTRY_NUM_PROPERTIES
};
static GParamSpec* widgets_app_entry_properties[WIDGETS_APP_ENTRY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block2Data Block2Data;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _WidgetsAppEntryPrivate {
	BackendApp* _app;
};

struct _Block2Data {
	int _ref_count_;
	WidgetsAppEntry* self;
	GtkLabel* description_label;
};

static gint WidgetsAppEntry_private_offset;
static gpointer widgets_app_entry_parent_class = NULL;

static gchar* widgets_app_entry_get_permissions_string (WidgetsAppEntry* self,
                                                 BackendApp* app);
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 GObject * widgets_app_entry_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void _widgets_app_entry___lambda4_ (Block2Data* _data2_);
static void __widgets_app_entry___lambda4__g_settings_changed (GSettings* _sender,
                                                        const gchar* key,
                                                        gpointer self);
static void widgets_app_entry_finalize (GObject * obj);
static GType widgets_app_entry_get_type_once (void);
static void _vala_widgets_app_entry_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);
static void _vala_widgets_app_entry_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 inline gpointer
widgets_app_entry_get_instance_private (WidgetsAppEntry* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsAppEntry_private_offset);
}

WidgetsAppEntry*
widgets_app_entry_construct (GType object_type,
                             BackendApp* app)
{
	WidgetsAppEntry * self = NULL;
	g_return_val_if_fail (app != NULL, NULL);
	self = (WidgetsAppEntry*) g_object_new (object_type, "app", app, NULL);
	return self;
}

WidgetsAppEntry*
widgets_app_entry_new (BackendApp* app)
{
	return widgets_app_entry_construct (WIDGETS_TYPE_APP_ENTRY, app);
}

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 gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

static gchar*
widgets_app_entry_get_permissions_string (WidgetsAppEntry* self,
                                          BackendApp* app)
{
	gchar** items = NULL;
	gchar** _tmp0_;
	gint items_length1;
	gint _items_size_;
	GSettings* _tmp1_;
	GSettings* _tmp2_;
	GSettings* _tmp4_;
	GSettings* _tmp5_;
	GSettings* _tmp7_;
	GSettings* _tmp8_;
	gchar** _tmp10_;
	gint _tmp10__length1;
	gchar** _tmp12_;
	gint _tmp12__length1;
	gchar* _tmp13_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (app != NULL, NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	items = _tmp0_;
	items_length1 = 0;
	_items_size_ = items_length1;
	_tmp1_ = backend_app_get_settings (app);
	_tmp2_ = _tmp1_;
	if (g_settings_get_boolean (_tmp2_, WIDGETS_APP_ENTRY_BUBBLES_KEY)) {
		gchar* _tmp3_;
		_tmp3_ = g_strdup (_ ("Bubbles"));
		_vala_array_add1 (&items, &items_length1, &_items_size_, _tmp3_);
	}
	_tmp4_ = backend_app_get_settings (app);
	_tmp5_ = _tmp4_;
	if (g_settings_get_boolean (_tmp5_, WIDGETS_APP_ENTRY_SOUNDS_KEY)) {
		gchar* _tmp6_;
		_tmp6_ = g_strdup (_ ("Sounds"));
		_vala_array_add2 (&items, &items_length1, &_items_size_, _tmp6_);
	}
	_tmp7_ = backend_app_get_settings (app);
	_tmp8_ = _tmp7_;
	if (g_settings_get_boolean (_tmp8_, WIDGETS_APP_ENTRY_REMEMBER_KEY)) {
		gchar* _tmp9_;
		_tmp9_ = g_strdup (_ ("Notification Center"));
		_vala_array_add3 (&items, &items_length1, &_items_size_, _tmp9_);
	}
	_tmp10_ = items;
	_tmp10__length1 = items_length1;
	if (_tmp10__length1 == 0) {
		gchar* _tmp11_;
		_tmp11_ = g_strdup (_ ("Disabled"));
		_vala_array_add4 (&items, &items_length1, &_items_size_, _tmp11_);
	}
	_tmp12_ = items;
	_tmp12__length1 = items_length1;
	_tmp13_ = _vala_g_strjoinv (", ", _tmp12_, (gint) _tmp12__length1);
	result = _tmp13_;
	items = (_vala_array_free (items, items_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

BackendApp*
widgets_app_entry_get_app (WidgetsAppEntry* self)
{
	BackendApp* result;
	BackendApp* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_app;
	result = _tmp0_;
	return result;
}

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

static void
widgets_app_entry_set_app (WidgetsAppEntry* self,
                           BackendApp* value)
{
	BackendApp* old_value;
	g_return_if_fail (self != NULL);
	old_value = widgets_app_entry_get_app (self);
	if (old_value != value) {
		BackendApp* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_app);
		self->priv->_app = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, widgets_app_entry_properties[WIDGETS_APP_ENTRY_APP_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_)) {
		WidgetsAppEntry* self;
		self = _data2_->self;
		_g_object_unref0 (_data2_->description_label);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

static void
_widgets_app_entry___lambda4_ (Block2Data* _data2_)
{
	WidgetsAppEntry* self;
	GtkLabel* _tmp0_;
	BackendApp* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	self = _data2_->self;
	_tmp0_ = _data2_->description_label;
	_tmp1_ = self->priv->_app;
	_tmp2_ = widgets_app_entry_get_permissions_string (self, _tmp1_);
	_tmp3_ = _tmp2_;
	gtk_label_set_markup (_tmp0_, _tmp3_);
	_g_free0 (_tmp3_);
}

static void
__widgets_app_entry___lambda4__g_settings_changed (GSettings* _sender,
                                                   const gchar* key,
                                                   gpointer self)
{
	_widgets_app_entry___lambda4_ (self);
}

static GObject *
widgets_app_entry_constructor (GType type,
                               guint n_construct_properties,
                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsAppEntry * self;
	Block2Data* _data2_;
	GtkImage* image = NULL;
	BackendApp* _tmp0_;
	GDesktopAppInfo* _tmp1_;
	GDesktopAppInfo* _tmp2_;
	GIcon* _tmp3_;
	GtkImage* _tmp4_ = NULL;
	GtkLabel* title_label = NULL;
	BackendApp* _tmp5_;
	GDesktopAppInfo* _tmp6_;
	GDesktopAppInfo* _tmp7_;
	const gchar* _tmp8_;
	GtkLabel* _tmp9_ = NULL;
	GtkLabel* _tmp10_;
	BackendApp* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GtkLabel* _tmp14_ = NULL;
	GtkLabel* _tmp15_;
	GtkLabel* _tmp16_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp17_ = NULL;
	GtkGrid* _tmp18_;
	GtkImage* _tmp19_;
	GtkGrid* _tmp20_;
	GtkLabel* _tmp21_;
	GtkGrid* _tmp22_;
	GtkLabel* _tmp23_;
	GtkGrid* _tmp24_;
	BackendApp* _tmp25_;
	GSettings* _tmp26_;
	GSettings* _tmp27_;
	parent_class = G_OBJECT_CLASS (widgets_app_entry_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_APP_ENTRY, WidgetsAppEntry);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_data2_->self = g_object_ref (self);
	_tmp0_ = self->priv->_app;
	_tmp1_ = backend_app_get_app_info (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_app_info_get_icon ((GAppInfo*) _tmp2_);
	_tmp4_ = (GtkImage*) gtk_image_new_from_gicon (_tmp3_);
	gtk_image_set_icon_size (_tmp4_, GTK_ICON_SIZE_LARGE);
	g_object_ref_sink (_tmp4_);
	image = _tmp4_;
	_tmp5_ = self->priv->_app;
	_tmp6_ = backend_app_get_app_info (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_app_info_get_display_name ((GAppInfo*) _tmp7_);
	_tmp9_ = (GtkLabel*) gtk_label_new (_tmp8_);
	gtk_label_set_ellipsize (_tmp9_, PANGO_ELLIPSIZE_END);
	gtk_label_set_xalign (_tmp9_, (gfloat) 0);
	gtk_widget_set_valign ((GtkWidget*) _tmp9_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp9_);
	title_label = _tmp9_;
	_tmp10_ = title_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp10_, GRANITE_STYLE_CLASS_H3_LABEL);
	_tmp11_ = self->priv->_app;
	_tmp12_ = widgets_app_entry_get_permissions_string (self, _tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = (GtkLabel*) gtk_label_new (_tmp13_);
	gtk_label_set_use_markup (_tmp14_, TRUE);
	gtk_label_set_ellipsize (_tmp14_, PANGO_ELLIPSIZE_END);
	gtk_label_set_xalign (_tmp14_, (gfloat) 0);
	gtk_widget_set_valign ((GtkWidget*) _tmp14_, GTK_ALIGN_START);
	g_object_ref_sink (_tmp14_);
	_tmp15_ = _tmp14_;
	_g_free0 (_tmp13_);
	_data2_->description_label = _tmp15_;
	_tmp16_ = _data2_->description_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp16_, GRANITE_STYLE_CLASS_SMALL_LABEL);
	_tmp17_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp17_, 6);
	g_object_ref_sink (_tmp17_);
	grid = _tmp17_;
	_tmp18_ = grid;
	_tmp19_ = image;
	gtk_grid_attach (_tmp18_, (GtkWidget*) _tmp19_, 0, 0, 1, 2);
	_tmp20_ = grid;
	_tmp21_ = title_label;
	gtk_grid_attach (_tmp20_, (GtkWidget*) _tmp21_, 1, 0, 1, 1);
	_tmp22_ = grid;
	_tmp23_ = _data2_->description_label;
	gtk_grid_attach (_tmp22_, (GtkWidget*) _tmp23_, 1, 1, 1, 1);
	_tmp24_ = grid;
	gtk_list_box_row_set_child ((GtkListBoxRow*) self, (GtkWidget*) _tmp24_);
	_tmp25_ = self->priv->_app;
	_tmp26_ = backend_app_get_settings (_tmp25_);
	_tmp27_ = _tmp26_;
	g_signal_connect_data (_tmp27_, "changed", (GCallback) __widgets_app_entry___lambda4__g_settings_changed, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
	_g_object_unref0 (grid);
	_g_object_unref0 (title_label);
	_g_object_unref0 (image);
	block2_data_unref (_data2_);
	_data2_ = NULL;
	return obj;
}

static void
widgets_app_entry_class_init (WidgetsAppEntryClass * klass,
                              gpointer klass_data)
{
	widgets_app_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsAppEntry_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_widgets_app_entry_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_widgets_app_entry_set_property;
	G_OBJECT_CLASS (klass)->constructor = widgets_app_entry_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_app_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WIDGETS_APP_ENTRY_APP_PROPERTY, widgets_app_entry_properties[WIDGETS_APP_ENTRY_APP_PROPERTY] = g_param_spec_object ("app", "app", "app", BACKEND_TYPE_APP, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
widgets_app_entry_instance_init (WidgetsAppEntry * self,
                                 gpointer klass)
{
	self->priv = widgets_app_entry_get_instance_private (self);
}

static void
widgets_app_entry_finalize (GObject * obj)
{
	WidgetsAppEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_APP_ENTRY, WidgetsAppEntry);
	_g_object_unref0 (self->priv->_app);
	G_OBJECT_CLASS (widgets_app_entry_parent_class)->finalize (obj);
}

static GType
widgets_app_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsAppEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_app_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsAppEntry), 0, (GInstanceInitFunc) widgets_app_entry_instance_init, NULL };
	GType widgets_app_entry_type_id;
	widgets_app_entry_type_id = g_type_register_static (gtk_list_box_row_get_type (), "WidgetsAppEntry", &g_define_type_info, 0);
	WidgetsAppEntry_private_offset = g_type_add_instance_private (widgets_app_entry_type_id, sizeof (WidgetsAppEntryPrivate));
	return widgets_app_entry_type_id;
}

GType
widgets_app_entry_get_type (void)
{
	static volatile gsize widgets_app_entry_type_id__once = 0;
	if (g_once_init_enter (&widgets_app_entry_type_id__once)) {
		GType widgets_app_entry_type_id;
		widgets_app_entry_type_id = widgets_app_entry_get_type_once ();
		g_once_init_leave (&widgets_app_entry_type_id__once, widgets_app_entry_type_id);
	}
	return widgets_app_entry_type_id__once;
}

static void
_vala_widgets_app_entry_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	WidgetsAppEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_APP_ENTRY, WidgetsAppEntry);
	switch (property_id) {
		case WIDGETS_APP_ENTRY_APP_PROPERTY:
		g_value_set_object (value, widgets_app_entry_get_app (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_widgets_app_entry_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec)
{
	WidgetsAppEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WIDGETS_TYPE_APP_ENTRY, WidgetsAppEntry);
	switch (property_id) {
		case WIDGETS_APP_ENTRY_APP_PROPERTY:
		widgets_app_entry_set_app (self, g_value_get_object (value));
		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);
}

