/* ManifestWidget.c generated by valac 0.56.19, the Vala compiler
 * generated from ManifestWidget.vala, do not modify */

/*
* Copyright (c) 2011-2013 Yorba Foundation
*               2017-2018 elementary, Inc. (https://elementary.io)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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 "io.elementary.photos.h"
#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gio/gio.h>
#include <gdk/gdk.h>
#include <gee.h>

#define PLUGINS_MANIFEST_LIST_VIEW_ICON_SIZE 24
#define PLUGINS_MANIFEST_LIST_VIEW_ICON_X_PADDING 6
#define PLUGINS_MANIFEST_LIST_VIEW_ICON_Y_PADDING 2
#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

#define PLUGINS_TYPE_MANIFEST_LIST_VIEW (plugins_manifest_list_view_get_type ())
#define PLUGINS_MANIFEST_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLUGINS_TYPE_MANIFEST_LIST_VIEW, PluginsManifestListView))
#define PLUGINS_MANIFEST_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PLUGINS_TYPE_MANIFEST_LIST_VIEW, PluginsManifestListViewClass))
#define PLUGINS_IS_MANIFEST_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLUGINS_TYPE_MANIFEST_LIST_VIEW))
#define PLUGINS_IS_MANIFEST_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUGINS_TYPE_MANIFEST_LIST_VIEW))
#define PLUGINS_MANIFEST_LIST_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PLUGINS_TYPE_MANIFEST_LIST_VIEW, PluginsManifestListViewClass))

typedef struct _PluginsManifestListView PluginsManifestListView;
typedef struct _PluginsManifestListViewClass PluginsManifestListViewClass;
enum  {
	PLUGINS_MANIFEST_WIDGET_0_PROPERTY,
	PLUGINS_MANIFEST_WIDGET_NUM_PROPERTIES
};
static GParamSpec* plugins_manifest_widget_properties[PLUGINS_MANIFEST_WIDGET_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _PluginsManifestListViewPrivate PluginsManifestListViewPrivate;
enum  {
	PLUGINS_MANIFEST_LIST_VIEW_0_PROPERTY,
	PLUGINS_MANIFEST_LIST_VIEW_NUM_PROPERTIES
};
static GParamSpec* plugins_manifest_list_view_properties[PLUGINS_MANIFEST_LIST_VIEW_NUM_PROPERTIES];
typedef enum  {
	PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ENABLED,
	PLUGINS_MANIFEST_LIST_VIEW_COLUMN_CAN_ENABLE,
	PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ICON,
	PLUGINS_MANIFEST_LIST_VIEW_COLUMN_NAME,
	PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ID,
	PLUGINS_MANIFEST_LIST_VIEW_COLUMN_N_COLUMNS
} PluginsManifestListViewColumn;

#define PLUGINS_MANIFEST_LIST_VIEW_TYPE_COLUMN (plugins_manifest_list_view_column_get_type ())
#define _plugins_extension_point_unref0(var) ((var == NULL) ? NULL : (var = (plugins_extension_point_unref (var), NULL)))
#define __vala_GtkTreePath_free0(var) ((var == NULL) ? NULL : (var = (_vala_GtkTreePath_free (var), NULL)))

struct _PluginsManifestWidgetPrivate {
	GtkButton* about_button;
	PluginsManifestListView* list;
};

struct _PluginsManifestListView {
	GtkTreeView parent_instance;
	PluginsManifestListViewPrivate * priv;
};

struct _PluginsManifestListViewClass {
	GtkTreeViewClass parent_class;
};

struct _PluginsManifestListViewPrivate {
	GtkTreeStore* store;
};

static gint PluginsManifestWidget_private_offset;
static gpointer plugins_manifest_widget_parent_class = NULL;
static gint PluginsManifestListView_private_offset;
static gpointer plugins_manifest_list_view_parent_class = NULL;

VALA_EXTERN GType plugins_manifest_list_view_get_type (void) G_GNUC_CONST ;
static void plugins_manifest_widget_on_about (PluginsManifestWidget* self);
static void _plugins_manifest_widget_on_about_gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self);
static void plugins_manifest_widget_set_about_button_sensitivity (PluginsManifestWidget* self);
static void _plugins_manifest_widget_set_about_button_sensitivity_gtk_tree_selection_changed (GtkTreeSelection* _sender,
                                                                                       gpointer self);
VALA_EXTERN PluginsManifestListView* plugins_manifest_list_view_new (void);
VALA_EXTERN PluginsManifestListView* plugins_manifest_list_view_construct (GType object_type);
VALA_EXTERN gchar** plugins_manifest_list_view_get_selected_ids (PluginsManifestListView* self,
                                                     gint* result_length1);
static void _vala_array_add98 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void plugins_manifest_widget_finalize (GObject * obj);
static GType plugins_manifest_widget_get_type_once (void);
static GType plugins_manifest_list_view_column_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static gint _plugins_compare_extension_point_names_gcompare_data_func (gconstpointer a,
                                                                gconstpointer b,
                                                                gpointer self);
static gint _plugins_compare_pluggable_names_gcompare_data_func (gconstpointer a,
                                                          gconstpointer b,
                                                          gpointer self);
static GtkTreePath* _vala_GtkTreePath_copy (GtkTreePath* self);
static gchar* plugins_manifest_list_view_get_id_at_path (PluginsManifestListView* self,
                                                  GtkTreePath* path,
                                                  GtkTreeIter* iter);
static void _vala_array_add99 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void _vala_GtkTreePath_free (GtkTreePath* self);
static void __vala_GtkTreePath_free0_ (gpointer var);
static inline void _g_list_free___vala_GtkTreePath_free0_ (GList* self);
static gboolean plugins_manifest_list_view_real_button_press_event (GtkWidget* base,
                                                             GdkEventButton* event);
static void plugins_manifest_list_view_finalize (GObject * obj);
static GType plugins_manifest_list_view_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
plugins_manifest_widget_get_instance_private (PluginsManifestWidget* self)
{
	return G_STRUCT_MEMBER_P (self, PluginsManifestWidget_private_offset);
}

static void
_plugins_manifest_widget_on_about_gtk_button_clicked (GtkButton* _sender,
                                                      gpointer self)
{
	plugins_manifest_widget_on_about ((PluginsManifestWidget*) self);
}

static void
_plugins_manifest_widget_set_about_button_sensitivity_gtk_tree_selection_changed (GtkTreeSelection* _sender,
                                                                                  gpointer self)
{
	plugins_manifest_widget_set_about_button_sensitivity ((PluginsManifestWidget*) self);
}

PluginsManifestWidget*
plugins_manifest_widget_construct (GType object_type)
{
	PluginsManifestWidget * self = NULL;
	PluginsManifestListView* _tmp0_;
	GtkScrolledWindow* list_bin = NULL;
	GtkScrolledWindow* _tmp1_;
	PluginsManifestListView* _tmp2_;
	GtkFrame* frame = NULL;
	GtkFrame* _tmp3_;
	GtkButton* _tmp4_;
	GtkButtonBox* action_area = NULL;
	GtkButtonBox* _tmp5_;
	GtkButton* _tmp6_;
	GtkButton* _tmp7_;
	PluginsManifestListView* _tmp8_;
	GtkTreeSelection* _tmp9_;
	self = (PluginsManifestWidget*) g_object_new (object_type, NULL);
	_tmp0_ = plugins_manifest_list_view_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->list);
	self->priv->list = _tmp0_;
	_tmp1_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp1_);
	list_bin = _tmp1_;
	g_object_set (list_bin, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	g_object_set ((GtkWidget*) list_bin, "expand", TRUE, NULL);
	_tmp2_ = self->priv->list;
	gtk_container_add ((GtkContainer*) list_bin, (GtkWidget*) _tmp2_);
	_tmp3_ = (GtkFrame*) gtk_frame_new (NULL);
	g_object_ref_sink (_tmp3_);
	frame = _tmp3_;
	gtk_container_add ((GtkContainer*) frame, (GtkWidget*) list_bin);
	_tmp4_ = (GtkButton*) gtk_button_new_with_label (_ ("About"));
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->about_button);
	self->priv->about_button = _tmp4_;
	_tmp5_ = (GtkButtonBox*) gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp5_);
	action_area = _tmp5_;
	g_object_set (action_area, "layout-style", GTK_BUTTONBOX_END, NULL);
	_tmp6_ = self->priv->about_button;
	gtk_container_add ((GtkContainer*) action_area, (GtkWidget*) _tmp6_);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	gtk_grid_set_row_spacing ((GtkGrid*) self, 12);
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) frame);
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) action_area);
	_tmp7_ = self->priv->about_button;
	g_signal_connect_object (_tmp7_, "clicked", (GCallback) _plugins_manifest_widget_on_about_gtk_button_clicked, self, 0);
	_tmp8_ = self->priv->list;
	_tmp9_ = gtk_tree_view_get_selection ((GtkTreeView*) _tmp8_);
	g_signal_connect_object (_tmp9_, "changed", (GCallback) _plugins_manifest_widget_set_about_button_sensitivity_gtk_tree_selection_changed, self, 0);
	plugins_manifest_widget_set_about_button_sensitivity (self);
	_g_object_unref0 (action_area);
	_g_object_unref0 (frame);
	_g_object_unref0 (list_bin);
	return self;
}

PluginsManifestWidget*
plugins_manifest_widget_new (void)
{
	return plugins_manifest_widget_construct (PLUGINS_TYPE_MANIFEST_WIDGET);
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static void
_vala_array_add98 (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
plugins_manifest_widget_on_about (PluginsManifestWidget* self)
{
	gchar** ids = NULL;
	PluginsManifestListView* _tmp0_;
	gint _tmp1_ = 0;
	gchar** _tmp2_;
	gint ids_length1;
	gint _ids_size_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar* id = NULL;
	gchar** _tmp4_;
	gint _tmp4__length1;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	SpitPluggableInfo info = {0};
	const gchar* _tmp7_;
	gboolean _tmp8_;
	gchar** authors = NULL;
	gint authors_length1;
	gint _authors_size_;
	SpitPluggableInfo _tmp10_;
	const gchar* _tmp11_;
	GtkAboutDialog* about_dialog = NULL;
	GtkAboutDialog* _tmp27_;
	GtkAboutDialog* _tmp28_;
	gchar** _tmp29_;
	gint _tmp29__length1;
	GtkAboutDialog* _tmp30_;
	SpitPluggableInfo _tmp31_;
	const gchar* _tmp32_;
	GtkAboutDialog* _tmp33_;
	SpitPluggableInfo _tmp34_;
	const gchar* _tmp35_;
	GtkAboutDialog* _tmp36_;
	GtkAboutDialog* _tmp37_;
	SpitPluggableInfo _tmp38_;
	const gchar* _tmp39_;
	GtkAboutDialog* _tmp40_;
	SpitPluggableInfo _tmp41_;
	GdkPixbuf* pix_icon = NULL;
	gint scale = 0;
	GtkAboutDialog* _tmp42_;
	GtkStyleContext* _tmp43_;
	gint size = 0;
	GtkIconLookupFlags flags = 0U;
	SpitPluggableInfo _tmp44_;
	GIcon* _tmp45_;
	GdkPixbuf* _tmp57_;
	GtkAboutDialog* _tmp64_;
	GdkPixbuf* _tmp65_;
	GtkAboutDialog* _tmp66_;
	const gchar* _tmp67_;
	gchar* _tmp68_;
	gchar* _tmp69_;
	GtkAboutDialog* _tmp70_;
	SpitPluggableInfo _tmp71_;
	const gchar* _tmp72_;
	GtkAboutDialog* _tmp73_;
	SpitPluggableInfo _tmp74_;
	const gchar* _tmp75_;
	GtkAboutDialog* _tmp76_;
	SpitPluggableInfo _tmp77_;
	const gchar* _tmp78_;
	GtkAboutDialog* _tmp79_;
	SpitPluggableInfo _tmp80_;
	const gchar* _tmp81_;
	GtkAboutDialog* _tmp82_;
	GtkAboutDialog* _tmp83_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->list;
	_tmp2_ = plugins_manifest_list_view_get_selected_ids (_tmp0_, &_tmp1_);
	ids = _tmp2_;
	ids_length1 = _tmp1_;
	_ids_size_ = ids_length1;
	_tmp3_ = ids;
	_tmp3__length1 = ids_length1;
	if (_tmp3__length1 == 0) {
		ids = (_vala_array_free (ids, ids_length1, (GDestroyNotify) g_free), NULL);
		return;
	}
	_tmp4_ = ids;
	_tmp4__length1 = ids_length1;
	_tmp5_ = _tmp4_[0];
	_tmp6_ = g_strdup (_tmp5_);
	id = _tmp6_;
	memset (&info, 0, sizeof (SpitPluggableInfo));
	_tmp7_ = id;
	_tmp8_ = plugins_get_pluggable_info (_tmp7_, &info);
	if (!_tmp8_) {
		const gchar* _tmp9_;
		_tmp9_ = id;
		g_warning ("ManifestWidget.vala:69: Unable to retrieve information for plugin %s", _tmp9_);
		spit_pluggable_info_destroy (&info);
		_g_free0 (id);
		ids = (_vala_array_free (ids, ids_length1, (GDestroyNotify) g_free), NULL);
		return;
	}
	authors = NULL;
	authors_length1 = 0;
	_authors_size_ = authors_length1;
	_tmp10_ = info;
	_tmp11_ = _tmp10_.authors;
	if (_tmp11_ != NULL) {
		gchar** split = NULL;
		SpitPluggableInfo _tmp12_;
		const gchar* _tmp13_;
		gchar** _tmp14_;
		gchar** _tmp15_;
		gint split_length1;
		gint _split_size_;
		_tmp12_ = info;
		_tmp13_ = _tmp12_.authors;
		_tmp15_ = _tmp14_ = g_strsplit (_tmp13_, ",", 0);
		split = _tmp15_;
		split_length1 = _vala_array_length (_tmp14_);
		_split_size_ = split_length1;
		{
			gint ctr = 0;
			ctr = 0;
			{
				gboolean _tmp16_ = FALSE;
				_tmp16_ = TRUE;
				while (TRUE) {
					gchar** _tmp18_;
					gint _tmp18__length1;
					gchar* stripped = NULL;
					gchar** _tmp19_;
					gint _tmp19__length1;
					const gchar* _tmp20_;
					gchar* _tmp21_;
					const gchar* _tmp22_;
					if (!_tmp16_) {
						gint _tmp17_;
						_tmp17_ = ctr;
						ctr = _tmp17_ + 1;
					}
					_tmp16_ = FALSE;
					_tmp18_ = split;
					_tmp18__length1 = split_length1;
					if (!(ctr < _tmp18__length1)) {
						break;
					}
					_tmp19_ = split;
					_tmp19__length1 = split_length1;
					_tmp20_ = _tmp19_[ctr];
					_tmp21_ = string_strip (_tmp20_);
					stripped = _tmp21_;
					_tmp22_ = stripped;
					if (!is_string_empty (_tmp22_)) {
						gchar** _tmp23_;
						gint _tmp23__length1;
						const gchar* _tmp25_;
						gchar* _tmp26_;
						_tmp23_ = authors;
						_tmp23__length1 = authors_length1;
						if (_tmp23_ == NULL) {
							gchar** _tmp24_;
							_tmp24_ = g_new0 (gchar*, 0 + 1);
							authors = (_vala_array_free (authors, authors_length1, (GDestroyNotify) g_free), NULL);
							authors = _tmp24_;
							authors_length1 = 0;
							_authors_size_ = authors_length1;
						}
						_tmp25_ = stripped;
						_tmp26_ = g_strdup (_tmp25_);
						_vala_array_add98 (&authors, &authors_length1, &_authors_size_, _tmp26_);
					}
					_g_free0 (stripped);
				}
			}
		}
		split = (_vala_array_free (split, split_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp27_ = (GtkAboutDialog*) gtk_about_dialog_new ();
	g_object_ref_sink (_tmp27_);
	about_dialog = _tmp27_;
	_tmp28_ = about_dialog;
	_tmp29_ = authors;
	_tmp29__length1 = authors_length1;
	gtk_about_dialog_set_authors (_tmp28_, _tmp29_);
	_tmp30_ = about_dialog;
	_tmp31_ = info;
	_tmp32_ = _tmp31_.brief_description;
	gtk_about_dialog_set_comments (_tmp30_, _tmp32_);
	_tmp33_ = about_dialog;
	_tmp34_ = info;
	_tmp35_ = _tmp34_.copyright;
	gtk_about_dialog_set_copyright (_tmp33_, _tmp35_);
	_tmp36_ = about_dialog;
	gtk_window_set_deletable ((GtkWindow*) _tmp36_, FALSE);
	_tmp37_ = about_dialog;
	_tmp38_ = info;
	_tmp39_ = _tmp38_.license;
	gtk_about_dialog_set_license (_tmp37_, _tmp39_);
	_tmp40_ = about_dialog;
	_tmp41_ = info;
	gtk_about_dialog_set_wrap_license (_tmp40_, _tmp41_.is_license_wordwrapped);
	pix_icon = NULL;
	_tmp42_ = about_dialog;
	_tmp43_ = gtk_widget_get_style_context ((GtkWidget*) _tmp42_);
	scale = gtk_style_context_get_scale (_tmp43_);
	size = RESOURCES_DEFAULT_ICON_SCALE;
	flags = GTK_ICON_LOOKUP_GENERIC_FALLBACK;
	_tmp44_ = info;
	_tmp45_ = _tmp44_.icon;
	if (_tmp45_ != NULL) {
		{
			GtkIconInfo* icon_info = NULL;
			GtkIconTheme* _tmp46_;
			SpitPluggableInfo _tmp47_;
			GIcon* _tmp48_;
			GtkIconInfo* _tmp49_;
			GtkIconInfo* _tmp50_;
			_tmp46_ = gtk_icon_theme_get_default ();
			_tmp47_ = info;
			_tmp48_ = _tmp47_.icon;
			_tmp49_ = gtk_icon_theme_lookup_by_gicon_for_scale (_tmp46_, _tmp48_, size, scale, flags);
			icon_info = _tmp49_;
			_tmp50_ = icon_info;
			if (_tmp50_ != NULL) {
				GdkPixbuf* _tmp51_ = NULL;
				GtkIconInfo* _tmp52_;
				GdkPixbuf* _tmp53_;
				GdkPixbuf* _tmp54_;
				_tmp52_ = icon_info;
				_tmp53_ = gtk_icon_info_load_icon (_tmp52_, &_inner_error0_);
				_tmp51_ = _tmp53_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_g_object_unref0 (icon_info);
					goto __catch0_g_error;
				}
				_tmp54_ = _tmp51_;
				_tmp51_ = NULL;
				_g_object_unref0 (pix_icon);
				pix_icon = _tmp54_;
				_g_object_unref0 (_tmp51_);
			}
			_g_object_unref0 (icon_info);
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GError* _tmp55_;
			const gchar* _tmp56_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp55_ = e;
			_tmp56_ = _tmp55_->message;
			g_critical ("ManifestWidget.vala:108: %s", _tmp56_);
			_g_error_free0 (e);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (pix_icon);
			_g_object_unref0 (about_dialog);
			authors = (_vala_array_free (authors, authors_length1, (GDestroyNotify) g_free), NULL);
			spit_pluggable_info_destroy (&info);
			_g_free0 (id);
			ids = (_vala_array_free (ids, ids_length1, (GDestroyNotify) g_free), NULL);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp57_ = pix_icon;
	if (_tmp57_ == NULL) {
		{
			GdkPixbuf* _tmp58_ = NULL;
			GtkIconTheme* _tmp59_;
			GdkPixbuf* _tmp60_;
			GdkPixbuf* _tmp61_;
			_tmp59_ = gtk_icon_theme_get_default ();
			_tmp60_ = gtk_icon_theme_load_icon_for_scale (_tmp59_, RESOURCES_ICON_GENERIC_PLUGIN, size, scale, flags, &_inner_error0_);
			_tmp58_ = _tmp60_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch1_g_error;
			}
			_tmp61_ = _tmp58_;
			_tmp58_ = NULL;
			_g_object_unref0 (pix_icon);
			pix_icon = _tmp61_;
			_g_object_unref0 (_tmp58_);
		}
		goto __finally1;
		__catch1_g_error:
		{
			GError* e = NULL;
			GError* _tmp62_;
			const gchar* _tmp63_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp62_ = e;
			_tmp63_ = _tmp62_->message;
			g_critical ("ManifestWidget.vala:116: %s", _tmp63_);
			_g_error_free0 (e);
		}
		__finally1:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (pix_icon);
			_g_object_unref0 (about_dialog);
			authors = (_vala_array_free (authors, authors_length1, (GDestroyNotify) g_free), NULL);
			spit_pluggable_info_destroy (&info);
			_g_free0 (id);
			ids = (_vala_array_free (ids, ids_length1, (GDestroyNotify) g_free), NULL);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp64_ = about_dialog;
	_tmp65_ = pix_icon;
	gtk_about_dialog_set_logo (_tmp64_, _tmp65_);
	_tmp66_ = about_dialog;
	_tmp67_ = id;
	_tmp68_ = plugins_get_pluggable_name (_tmp67_);
	_tmp69_ = _tmp68_;
	gtk_about_dialog_set_program_name (_tmp66_, _tmp69_);
	_g_free0 (_tmp69_);
	_tmp70_ = about_dialog;
	_tmp71_ = info;
	_tmp72_ = _tmp71_.translators;
	gtk_about_dialog_set_translator_credits (_tmp70_, _tmp72_);
	_tmp73_ = about_dialog;
	_tmp74_ = info;
	_tmp75_ = _tmp74_.version;
	gtk_about_dialog_set_version (_tmp73_, _tmp75_);
	_tmp76_ = about_dialog;
	_tmp77_ = info;
	_tmp78_ = _tmp77_.website_url;
	gtk_about_dialog_set_website (_tmp76_, _tmp78_);
	_tmp79_ = about_dialog;
	_tmp80_ = info;
	_tmp81_ = _tmp80_.website_name;
	gtk_about_dialog_set_website_label (_tmp79_, _tmp81_);
	_tmp82_ = about_dialog;
	gtk_dialog_run ((GtkDialog*) _tmp82_);
	_tmp83_ = about_dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp83_);
	_g_object_unref0 (pix_icon);
	_g_object_unref0 (about_dialog);
	authors = (_vala_array_free (authors, authors_length1, (GDestroyNotify) g_free), NULL);
	spit_pluggable_info_destroy (&info);
	_g_free0 (id);
	ids = (_vala_array_free (ids, ids_length1, (GDestroyNotify) g_free), NULL);
}

static void
plugins_manifest_widget_set_about_button_sensitivity (PluginsManifestWidget* self)
{
	gchar** ids = NULL;
	PluginsManifestListView* _tmp0_;
	gint _tmp1_ = 0;
	gchar** _tmp2_;
	gint ids_length1;
	gint _ids_size_;
	GtkButton* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->list;
	_tmp2_ = plugins_manifest_list_view_get_selected_ids (_tmp0_, &_tmp1_);
	ids = _tmp2_;
	ids_length1 = _tmp1_;
	_ids_size_ = ids_length1;
	_tmp3_ = self->priv->about_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, ids_length1 == 1);
	ids = (_vala_array_free (ids, ids_length1, (GDestroyNotify) g_free), NULL);
}

static void
plugins_manifest_widget_class_init (PluginsManifestWidgetClass * klass,
                                    gpointer klass_data)
{
	plugins_manifest_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PluginsManifestWidget_private_offset);
	G_OBJECT_CLASS (klass)->finalize = plugins_manifest_widget_finalize;
}

static void
plugins_manifest_widget_instance_init (PluginsManifestWidget * self,
                                       gpointer klass)
{
	self->priv = plugins_manifest_widget_get_instance_private (self);
}

static void
plugins_manifest_widget_finalize (GObject * obj)
{
	PluginsManifestWidget * self;
	GtkButton* _tmp0_;
	guint _tmp1_;
	PluginsManifestListView* _tmp2_;
	GtkTreeSelection* _tmp3_;
	guint _tmp4_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PLUGINS_TYPE_MANIFEST_WIDGET, PluginsManifestWidget);
	_tmp0_ = self->priv->about_button;
	g_signal_parse_name ("clicked", gtk_button_get_type (), &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _plugins_manifest_widget_on_about_gtk_button_clicked, self);
	_tmp2_ = self->priv->list;
	_tmp3_ = gtk_tree_view_get_selection ((GtkTreeView*) _tmp2_);
	g_signal_parse_name ("changed", gtk_tree_selection_get_type (), &_tmp4_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _plugins_manifest_widget_set_about_button_sensitivity_gtk_tree_selection_changed, self);
	_g_object_unref0 (self->priv->about_button);
	_g_object_unref0 (self->priv->list);
	G_OBJECT_CLASS (plugins_manifest_widget_parent_class)->finalize (obj);
}

static GType
plugins_manifest_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PluginsManifestWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) plugins_manifest_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PluginsManifestWidget), 0, (GInstanceInitFunc) plugins_manifest_widget_instance_init, NULL };
	GType plugins_manifest_widget_type_id;
	plugins_manifest_widget_type_id = g_type_register_static (gtk_grid_get_type (), "PluginsManifestWidget", &g_define_type_info, 0);
	PluginsManifestWidget_private_offset = g_type_add_instance_private (plugins_manifest_widget_type_id, sizeof (PluginsManifestWidgetPrivate));
	return plugins_manifest_widget_type_id;
}

GType
plugins_manifest_widget_get_type (void)
{
	static volatile gsize plugins_manifest_widget_type_id__once = 0;
	if (g_once_init_enter (&plugins_manifest_widget_type_id__once)) {
		GType plugins_manifest_widget_type_id;
		plugins_manifest_widget_type_id = plugins_manifest_widget_get_type_once ();
		g_once_init_leave (&plugins_manifest_widget_type_id__once, plugins_manifest_widget_type_id);
	}
	return plugins_manifest_widget_type_id__once;
}

static inline gpointer
plugins_manifest_list_view_get_instance_private (PluginsManifestListView* self)
{
	return G_STRUCT_MEMBER_P (self, PluginsManifestListView_private_offset);
}

static GType
plugins_manifest_list_view_column_get_type_once (void)
{
	static const GEnumValue values[] = {{PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ENABLED, "PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ENABLED", "enabled"}, {PLUGINS_MANIFEST_LIST_VIEW_COLUMN_CAN_ENABLE, "PLUGINS_MANIFEST_LIST_VIEW_COLUMN_CAN_ENABLE", "can-enable"}, {PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ICON, "PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ICON", "icon"}, {PLUGINS_MANIFEST_LIST_VIEW_COLUMN_NAME, "PLUGINS_MANIFEST_LIST_VIEW_COLUMN_NAME", "name"}, {PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ID, "PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ID", "id"}, {PLUGINS_MANIFEST_LIST_VIEW_COLUMN_N_COLUMNS, "PLUGINS_MANIFEST_LIST_VIEW_COLUMN_N_COLUMNS", "n-columns"}, {0, NULL, NULL}};
	GType plugins_manifest_list_view_column_type_id;
	plugins_manifest_list_view_column_type_id = g_enum_register_static ("PluginsManifestListViewColumn", values);
	return plugins_manifest_list_view_column_type_id;
}

static GType
plugins_manifest_list_view_column_get_type (void)
{
	static volatile gsize plugins_manifest_list_view_column_type_id__once = 0;
	if (g_once_init_enter (&plugins_manifest_list_view_column_type_id__once)) {
		GType plugins_manifest_list_view_column_type_id;
		plugins_manifest_list_view_column_type_id = plugins_manifest_list_view_column_get_type_once ();
		g_once_init_leave (&plugins_manifest_list_view_column_type_id__once, plugins_manifest_list_view_column_type_id);
	}
	return plugins_manifest_list_view_column_type_id__once;
}

static gint
_plugins_compare_extension_point_names_gcompare_data_func (gconstpointer a,
                                                           gconstpointer b,
                                                           gpointer self)
{
	gint result;
	result = plugins_compare_extension_point_names ((PluginsExtensionPoint*) a, (PluginsExtensionPoint*) b);
	return result;
}

static gint
_plugins_compare_pluggable_names_gcompare_data_func (gconstpointer a,
                                                     gconstpointer b,
                                                     gpointer self)
{
	gint result;
	result = plugins_compare_pluggable_names ((SpitPluggable*) a, (SpitPluggable*) b);
	return result;
}

PluginsManifestListView*
plugins_manifest_list_view_construct (GType object_type)
{
	PluginsManifestListView * self = NULL;
	GtkTreeStore* _tmp0_;
	GtkCellRendererToggle* checkbox_renderer = NULL;
	GtkCellRendererToggle* _tmp1_;
	GtkCellRendererToggle* _tmp2_;
	GtkCellRendererToggle* _tmp3_;
	GtkCellRendererPixbuf* icon_renderer = NULL;
	GtkCellRendererPixbuf* _tmp4_;
	GtkCellRendererPixbuf* _tmp5_;
	GtkCellRendererPixbuf* _tmp6_;
	GtkCellRendererPixbuf* _tmp7_;
	GtkCellRendererText* text_renderer = NULL;
	GtkCellRendererText* _tmp8_;
	GtkTreeViewColumn* column = NULL;
	GtkTreeViewColumn* _tmp9_;
	GtkTreeViewColumn* _tmp10_;
	GtkTreeViewColumn* _tmp11_;
	GtkCellRendererToggle* _tmp12_;
	GtkTreeViewColumn* _tmp13_;
	GtkCellRendererPixbuf* _tmp14_;
	GtkTreeViewColumn* _tmp15_;
	GtkCellRendererText* _tmp16_;
	GtkTreeViewColumn* _tmp17_;
	GtkCellRendererToggle* _tmp18_;
	GtkTreeViewColumn* _tmp19_;
	GtkCellRendererToggle* _tmp20_;
	GtkTreeViewColumn* _tmp21_;
	GtkCellRendererPixbuf* _tmp22_;
	GtkTreeViewColumn* _tmp23_;
	GtkCellRendererText* _tmp24_;
	GtkTreeViewColumn* _tmp25_;
	GtkTreeSelection* _tmp26_;
	self = (PluginsManifestListView*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->store;
	gtk_tree_view_set_model ((GtkTreeView*) self, (GtkTreeModel*) _tmp0_);
	_tmp1_ = (GtkCellRendererToggle*) gtk_cell_renderer_toggle_new ();
	g_object_ref_sink (_tmp1_);
	checkbox_renderer = _tmp1_;
	_tmp2_ = checkbox_renderer;
	gtk_cell_renderer_toggle_set_radio (_tmp2_, FALSE);
	_tmp3_ = checkbox_renderer;
	gtk_cell_renderer_toggle_set_activatable (_tmp3_, TRUE);
	_tmp4_ = (GtkCellRendererPixbuf*) gtk_cell_renderer_pixbuf_new ();
	g_object_ref_sink (_tmp4_);
	icon_renderer = _tmp4_;
	_tmp5_ = icon_renderer;
	g_object_set (_tmp5_, "stock-size", (guint) GTK_ICON_SIZE_MENU, NULL);
	_tmp6_ = icon_renderer;
	g_object_set ((GtkCellRenderer*) _tmp6_, "xpad", (guint) PLUGINS_MANIFEST_LIST_VIEW_ICON_X_PADDING, NULL);
	_tmp7_ = icon_renderer;
	g_object_set ((GtkCellRenderer*) _tmp7_, "ypad", (guint) PLUGINS_MANIFEST_LIST_VIEW_ICON_Y_PADDING, NULL);
	_tmp8_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp8_);
	text_renderer = _tmp8_;
	_tmp9_ = gtk_tree_view_column_new ();
	g_object_ref_sink (_tmp9_);
	column = _tmp9_;
	_tmp10_ = column;
	gtk_tree_view_column_set_sizing (_tmp10_, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
	_tmp11_ = column;
	_tmp12_ = checkbox_renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp11_, (GtkCellRenderer*) _tmp12_, FALSE);
	_tmp13_ = column;
	_tmp14_ = icon_renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp13_, (GtkCellRenderer*) _tmp14_, FALSE);
	_tmp15_ = column;
	_tmp16_ = text_renderer;
	gtk_cell_layout_pack_end ((GtkCellLayout*) _tmp15_, (GtkCellRenderer*) _tmp16_, TRUE);
	_tmp17_ = column;
	_tmp18_ = checkbox_renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp17_, (GtkCellRenderer*) _tmp18_, "active", (gint) PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ENABLED);
	_tmp19_ = column;
	_tmp20_ = checkbox_renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp19_, (GtkCellRenderer*) _tmp20_, "visible", (gint) PLUGINS_MANIFEST_LIST_VIEW_COLUMN_CAN_ENABLE);
	_tmp21_ = column;
	_tmp22_ = icon_renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp21_, (GtkCellRenderer*) _tmp22_, "gicon", (gint) PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ICON);
	_tmp23_ = column;
	_tmp24_ = text_renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp23_, (GtkCellRenderer*) _tmp24_, "text", (gint) PLUGINS_MANIFEST_LIST_VIEW_COLUMN_NAME);
	_tmp25_ = column;
	gtk_tree_view_append_column ((GtkTreeView*) self, _tmp25_);
	gtk_tree_view_set_headers_visible ((GtkTreeView*) self, FALSE);
	gtk_tree_view_set_enable_search ((GtkTreeView*) self, FALSE);
	gtk_tree_view_set_show_expanders ((GtkTreeView*) self, TRUE);
	gtk_tree_view_set_reorderable ((GtkTreeView*) self, FALSE);
	gtk_tree_view_set_enable_tree_lines ((GtkTreeView*) self, FALSE);
	gtk_tree_view_set_grid_lines ((GtkTreeView*) self, GTK_TREE_VIEW_GRID_LINES_NONE);
	_tmp26_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	gtk_tree_selection_set_mode (_tmp26_, GTK_SELECTION_BROWSE);
	{
		GeeIterator* _extension_point_it = NULL;
		GeeCollection* _tmp27_;
		GeeCollection* _tmp28_;
		GeeIterator* _tmp29_;
		GeeIterator* _tmp30_;
		_tmp27_ = plugins_get_extension_points (_plugins_compare_extension_point_names_gcompare_data_func, NULL, NULL);
		_tmp28_ = _tmp27_;
		_tmp29_ = gee_iterable_iterator ((GeeIterable*) _tmp28_);
		_tmp30_ = _tmp29_;
		_g_object_unref0 (_tmp28_);
		_extension_point_it = _tmp30_;
		while (TRUE) {
			GeeIterator* _tmp31_;
			PluginsExtensionPoint* extension_point = NULL;
			GeeIterator* _tmp32_;
			gpointer _tmp33_;
			GtkTreeIter category_iter = {0};
			GtkTreeStore* _tmp34_;
			GtkTreeIter _tmp35_ = {0};
			GtkTreeStore* _tmp36_;
			GtkTreeIter _tmp37_;
			PluginsExtensionPoint* _tmp38_;
			const gchar* _tmp39_;
			const gchar* _tmp40_;
			PluginsExtensionPoint* _tmp41_;
			const gchar* _tmp42_;
			const gchar* _tmp43_;
			GThemedIcon* _tmp44_;
			GThemedIcon* _tmp45_;
			GeeCollection* pluggables = NULL;
			PluginsExtensionPoint* _tmp46_;
			GType _tmp47_;
			GType _tmp48_;
			GeeCollection* _tmp49_;
			_tmp31_ = _extension_point_it;
			if (!gee_iterator_next (_tmp31_)) {
				break;
			}
			_tmp32_ = _extension_point_it;
			_tmp33_ = gee_iterator_get (_tmp32_);
			extension_point = (PluginsExtensionPoint*) _tmp33_;
			_tmp34_ = self->priv->store;
			gtk_tree_store_append (_tmp34_, &_tmp35_, NULL);
			category_iter = _tmp35_;
			_tmp36_ = self->priv->store;
			_tmp37_ = category_iter;
			_tmp38_ = extension_point;
			_tmp39_ = plugins_extension_point_get_name (_tmp38_);
			_tmp40_ = _tmp39_;
			_tmp41_ = extension_point;
			_tmp42_ = plugins_extension_point_get_icon_name (_tmp41_);
			_tmp43_ = _tmp42_;
			_tmp44_ = (GThemedIcon*) g_themed_icon_new (_tmp43_);
			_tmp45_ = _tmp44_;
			gtk_tree_store_set (_tmp36_, &_tmp37_, PLUGINS_MANIFEST_LIST_VIEW_COLUMN_NAME, _tmp40_, PLUGINS_MANIFEST_LIST_VIEW_COLUMN_CAN_ENABLE, FALSE, PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ICON, _tmp45_, -1);
			_g_object_unref0 (_tmp45_);
			_tmp46_ = extension_point;
			_tmp47_ = plugins_extension_point_get_pluggable_type (_tmp46_);
			_tmp48_ = _tmp47_;
			_tmp49_ = plugins_get_pluggables_for_type (_tmp48_, _plugins_compare_pluggable_names_gcompare_data_func, NULL, NULL, TRUE);
			pluggables = _tmp49_;
			{
				GeeIterator* _pluggable_it = NULL;
				GeeCollection* _tmp50_;
				GeeIterator* _tmp51_;
				_tmp50_ = pluggables;
				_tmp51_ = gee_iterable_iterator ((GeeIterable*) _tmp50_);
				_pluggable_it = _tmp51_;
				while (TRUE) {
					GeeIterator* _tmp52_;
					SpitPluggable* pluggable = NULL;
					GeeIterator* _tmp53_;
					gpointer _tmp54_;
					gboolean enabled = FALSE;
					SpitPluggable* _tmp55_;
					const gchar* _tmp56_;
					gboolean _tmp57_ = FALSE;
					gboolean _tmp58_;
					SpitPluggableInfo info = {0};
					SpitPluggable* _tmp59_;
					GtkTreeIter plugin_iter = {0};
					GtkTreeStore* _tmp60_;
					GtkTreeIter _tmp61_;
					GtkTreeIter _tmp62_ = {0};
					GtkTreeStore* _tmp63_;
					GtkTreeIter _tmp64_;
					SpitPluggable* _tmp65_;
					const gchar* _tmp66_;
					SpitPluggable* _tmp67_;
					const gchar* _tmp68_;
					SpitPluggableInfo _tmp69_;
					GIcon* _tmp70_;
					_tmp52_ = _pluggable_it;
					if (!gee_iterator_next (_tmp52_)) {
						break;
					}
					_tmp53_ = _pluggable_it;
					_tmp54_ = gee_iterator_get (_tmp53_);
					pluggable = (SpitPluggable*) _tmp54_;
					_tmp55_ = pluggable;
					_tmp56_ = spit_pluggable_get_id (_tmp55_);
					_tmp58_ = plugins_get_pluggable_enabled (_tmp56_, &_tmp57_);
					enabled = _tmp57_;
					if (!_tmp58_) {
						_g_object_unref0 (pluggable);
						continue;
					}
					memset (&info, 0, sizeof (SpitPluggableInfo));
					_tmp59_ = pluggable;
					spit_pluggable_get_info (_tmp59_, &info);
					_tmp60_ = self->priv->store;
					_tmp61_ = category_iter;
					gtk_tree_store_append (_tmp60_, &_tmp62_, &_tmp61_);
					plugin_iter = _tmp62_;
					_tmp63_ = self->priv->store;
					_tmp64_ = plugin_iter;
					_tmp65_ = pluggable;
					_tmp66_ = spit_pluggable_get_pluggable_name (_tmp65_);
					_tmp67_ = pluggable;
					_tmp68_ = spit_pluggable_get_id (_tmp67_);
					_tmp69_ = info;
					_tmp70_ = _tmp69_.icon;
					gtk_tree_store_set (_tmp63_, &_tmp64_, PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ENABLED, enabled, PLUGINS_MANIFEST_LIST_VIEW_COLUMN_NAME, _tmp66_, PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ID, _tmp68_, PLUGINS_MANIFEST_LIST_VIEW_COLUMN_CAN_ENABLE, TRUE, PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ICON, _tmp70_, -1);
					spit_pluggable_info_destroy (&info);
					_g_object_unref0 (pluggable);
				}
				_g_object_unref0 (_pluggable_it);
			}
			_g_object_unref0 (pluggables);
			_plugins_extension_point_unref0 (extension_point);
		}
		_g_object_unref0 (_extension_point_it);
	}
	gtk_tree_view_expand_all ((GtkTreeView*) self);
	_g_object_unref0 (column);
	_g_object_unref0 (text_renderer);
	_g_object_unref0 (icon_renderer);
	_g_object_unref0 (checkbox_renderer);
	return self;
}

PluginsManifestListView*
plugins_manifest_list_view_new (void)
{
	return plugins_manifest_list_view_construct (PLUGINS_TYPE_MANIFEST_LIST_VIEW);
}

static GtkTreePath*
_vala_GtkTreePath_copy (GtkTreePath* self)
{
	return g_boxed_copy (gtk_tree_path_get_type (), self);
}

static gpointer
__vala_GtkTreePath_copy0 (gpointer self)
{
	return self ? _vala_GtkTreePath_copy (self) : NULL;
}

static void
_vala_array_add99 (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_GtkTreePath_free (GtkTreePath* self)
{
	g_boxed_free (gtk_tree_path_get_type (), self);
}

static void
__vala_GtkTreePath_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_GtkTreePath_free (var), NULL));
}

static inline void
_g_list_free___vala_GtkTreePath_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) __vala_GtkTreePath_free0_);
}

gchar**
plugins_manifest_list_view_get_selected_ids (PluginsManifestListView* self,
                                             gint* result_length1)
{
	gchar** ids = NULL;
	gchar** _tmp0_;
	gint ids_length1;
	gint _ids_size_;
	GList* selected = NULL;
	GtkTreeSelection* _tmp1_;
	GList* _tmp2_;
	GList* _tmp3_;
	gchar** _tmp11_;
	gint _tmp11__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	ids = _tmp0_;
	ids_length1 = 0;
	_ids_size_ = ids_length1;
	_tmp1_ = gtk_tree_view_get_selection ((GtkTreeView*) self);
	_tmp2_ = gtk_tree_selection_get_selected_rows (_tmp1_, NULL);
	selected = _tmp2_;
	_tmp3_ = selected;
	{
		GList* path_collection = NULL;
		GList* path_it = NULL;
		path_collection = _tmp3_;
		for (path_it = path_collection; path_it != NULL; path_it = path_it->next) {
			GtkTreePath* _tmp4_;
			GtkTreePath* path = NULL;
			_tmp4_ = __vala_GtkTreePath_copy0 ((GtkTreePath*) path_it->data);
			path = _tmp4_;
			{
				GtkTreeIter iter = {0};
				gchar* id = NULL;
				GtkTreePath* _tmp5_;
				GtkTreeIter _tmp6_ = {0};
				gchar* _tmp7_;
				const gchar* _tmp8_;
				_tmp5_ = path;
				_tmp7_ = plugins_manifest_list_view_get_id_at_path (self, _tmp5_, &_tmp6_);
				iter = _tmp6_;
				id = _tmp7_;
				_tmp8_ = id;
				if (_tmp8_ != NULL) {
					const gchar* _tmp9_;
					gchar* _tmp10_;
					_tmp9_ = id;
					_tmp10_ = g_strdup (_tmp9_);
					_vala_array_add99 (&ids, &ids_length1, &_ids_size_, _tmp10_);
				}
				_g_free0 (id);
				__vala_GtkTreePath_free0 (path);
			}
		}
	}
	_tmp11_ = ids;
	_tmp11__length1 = ids_length1;
	if (result_length1) {
		*result_length1 = _tmp11__length1;
	}
	result = _tmp11_;
	(selected == NULL) ? NULL : (selected = (_g_list_free___vala_GtkTreePath_free0_ (selected), NULL));
	return result;
}

static gchar*
plugins_manifest_list_view_get_id_at_path (PluginsManifestListView* self,
                                           GtkTreePath* path,
                                           GtkTreeIter* iter)
{
	GtkTreeIter _vala_iter = {0};
	GtkTreeStore* _tmp0_;
	GtkTreeIter _tmp1_ = {0};
	gboolean _tmp2_;
	const gchar* id = NULL;
	GtkTreeStore* _tmp3_;
	GtkTreeIter _tmp4_;
	const gchar* _tmp5_ = NULL;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = self->priv->store;
	_tmp2_ = gtk_tree_model_get_iter ((GtkTreeModel*) _tmp0_, &_tmp1_, path);
	_vala_iter = _tmp1_;
	if (!_tmp2_) {
		result = NULL;
		if (iter) {
			*iter = _vala_iter;
		}
		return result;
	}
	_tmp3_ = self->priv->store;
	_tmp4_ = _vala_iter;
	gtk_tree_model_get ((GtkTreeModel*) _tmp3_, &_tmp4_, PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ID, &_tmp5_, -1);
	id = _tmp5_;
	_tmp6_ = id;
	_tmp7_ = g_strdup (_tmp6_);
	result = _tmp7_;
	if (iter) {
		*iter = _vala_iter;
	}
	return result;
}

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

static gboolean
plugins_manifest_list_view_real_button_press_event (GtkWidget* base,
                                                    GdkEventButton* event)
{
	PluginsManifestListView * self;
	GtkTreePath* path = NULL;
	GtkTreeViewColumn* col = NULL;
	gint cellx = 0;
	gint celly = 0;
	GtkTreePath* _tmp0_ = NULL;
	GtkTreeViewColumn* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	gboolean _tmp4_;
	GtkTreeViewColumn* _tmp5_;
	gboolean _tmp6_ = FALSE;
	GtkTreeIter iter = {0};
	gchar* id = NULL;
	GtkTreePath* _tmp7_;
	GtkTreeIter _tmp8_ = {0};
	gchar* _tmp9_;
	const gchar* _tmp10_;
	gboolean enabled = FALSE;
	const gchar* _tmp11_;
	gboolean _tmp12_ = FALSE;
	gboolean _tmp13_;
	const gchar* _tmp14_;
	GtkTreeStore* _tmp15_;
	GtkTreeIter _tmp16_;
	gboolean result;
	self = (PluginsManifestListView*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp4_ = gtk_tree_view_get_path_at_pos ((GtkTreeView*) self, (gint) event->x, (gint) event->y, &_tmp0_, &_tmp1_, &_tmp2_, &_tmp3_);
	__vala_GtkTreePath_free0 (path);
	path = _tmp0_;
	_g_object_unref0 (col);
	_tmp5_ = _g_object_ref0 (_tmp1_);
	col = _tmp5_;
	cellx = _tmp2_;
	celly = _tmp3_;
	if (!_tmp4_) {
		result = GTK_WIDGET_CLASS (plugins_manifest_list_view_parent_class)->button_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), event);
		_g_object_unref0 (col);
		__vala_GtkTreePath_free0 (path);
		return result;
	}
	if (cellx < (PLUGINS_MANIFEST_LIST_VIEW_ICON_SIZE + PLUGINS_MANIFEST_LIST_VIEW_ICON_X_PADDING)) {
		_tmp6_ = TRUE;
	} else {
		_tmp6_ = cellx > (2 * (PLUGINS_MANIFEST_LIST_VIEW_ICON_X_PADDING + PLUGINS_MANIFEST_LIST_VIEW_ICON_SIZE));
	}
	if (_tmp6_) {
		result = GTK_WIDGET_CLASS (plugins_manifest_list_view_parent_class)->button_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), event);
		_g_object_unref0 (col);
		__vala_GtkTreePath_free0 (path);
		return result;
	}
	_tmp7_ = path;
	_tmp9_ = plugins_manifest_list_view_get_id_at_path (self, _tmp7_, &_tmp8_);
	iter = _tmp8_;
	id = _tmp9_;
	_tmp10_ = id;
	if (_tmp10_ == NULL) {
		result = GTK_WIDGET_CLASS (plugins_manifest_list_view_parent_class)->button_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), event);
		_g_free0 (id);
		_g_object_unref0 (col);
		__vala_GtkTreePath_free0 (path);
		return result;
	}
	_tmp11_ = id;
	_tmp13_ = plugins_get_pluggable_enabled (_tmp11_, &_tmp12_);
	enabled = _tmp12_;
	if (!_tmp13_) {
		result = GTK_WIDGET_CLASS (plugins_manifest_list_view_parent_class)->button_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_tree_view_get_type (), GtkTreeView), event);
		_g_free0 (id);
		_g_object_unref0 (col);
		__vala_GtkTreePath_free0 (path);
		return result;
	}
	enabled = !enabled;
	_tmp14_ = id;
	plugins_set_pluggable_enabled (_tmp14_, enabled);
	_tmp15_ = self->priv->store;
	_tmp16_ = iter;
	gtk_tree_store_set (_tmp15_, &_tmp16_, PLUGINS_MANIFEST_LIST_VIEW_COLUMN_ENABLED, enabled, -1);
	result = TRUE;
	_g_free0 (id);
	_g_object_unref0 (col);
	__vala_GtkTreePath_free0 (path);
	return result;
}

static void
plugins_manifest_list_view_class_init (PluginsManifestListViewClass * klass,
                                       gpointer klass_data)
{
	plugins_manifest_list_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PluginsManifestListView_private_offset);
	((GtkWidgetClass *) klass)->button_press_event = (gboolean (*) (GtkWidget*, GdkEventButton*)) plugins_manifest_list_view_real_button_press_event;
	G_OBJECT_CLASS (klass)->finalize = plugins_manifest_list_view_finalize;
}

static void
plugins_manifest_list_view_instance_init (PluginsManifestListView * self,
                                          gpointer klass)
{
	GtkTreeStore* _tmp0_;
	self->priv = plugins_manifest_list_view_get_instance_private (self);
	_tmp0_ = gtk_tree_store_new ((gint) PLUGINS_MANIFEST_LIST_VIEW_COLUMN_N_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, g_icon_get_type (), G_TYPE_STRING, G_TYPE_STRING);
	self->priv->store = _tmp0_;
}

static void
plugins_manifest_list_view_finalize (GObject * obj)
{
	PluginsManifestListView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PLUGINS_TYPE_MANIFEST_LIST_VIEW, PluginsManifestListView);
	_g_object_unref0 (self->priv->store);
	G_OBJECT_CLASS (plugins_manifest_list_view_parent_class)->finalize (obj);
}

static GType
plugins_manifest_list_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PluginsManifestListViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) plugins_manifest_list_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PluginsManifestListView), 0, (GInstanceInitFunc) plugins_manifest_list_view_instance_init, NULL };
	GType plugins_manifest_list_view_type_id;
	plugins_manifest_list_view_type_id = g_type_register_static (gtk_tree_view_get_type (), "PluginsManifestListView", &g_define_type_info, 0);
	PluginsManifestListView_private_offset = g_type_add_instance_private (plugins_manifest_list_view_type_id, sizeof (PluginsManifestListViewPrivate));
	return plugins_manifest_list_view_type_id;
}

GType
plugins_manifest_list_view_get_type (void)
{
	static volatile gsize plugins_manifest_list_view_type_id__once = 0;
	if (g_once_init_enter (&plugins_manifest_list_view_type_id__once)) {
		GType plugins_manifest_list_view_type_id;
		plugins_manifest_list_view_type_id = plugins_manifest_list_view_get_type_once ();
		g_once_init_leave (&plugins_manifest_list_view_type_id__once, plugins_manifest_list_view_type_id);
	}
	return plugins_manifest_list_view_type_id__once;
}

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

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

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

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

