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

/*
* Copyright (c) 2016-2018 elementary LLC. <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, Inc.,; 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-1335 USA.
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <sys/types.h>
#include <glib.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_PERMISSION_BUTTON (permission_button_get_type ())
#define PERMISSION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PERMISSION_BUTTON, PermissionButton))
#define PERMISSION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PERMISSION_BUTTON, PermissionButtonClass))
#define IS_PERMISSION_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PERMISSION_BUTTON))
#define IS_PERMISSION_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PERMISSION_BUTTON))
#define PERMISSION_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PERMISSION_BUTTON, PermissionButtonClass))

typedef struct _PermissionButton PermissionButton;
typedef struct _PermissionButtonClass PermissionButtonClass;
typedef struct _PermissionButtonPrivate PermissionButtonPrivate;
typedef enum  {
	PERMISSIONS_TYPE_USER,
	PERMISSIONS_TYPE_GROUP,
	PERMISSIONS_TYPE_OTHER
} PermissionsType;

#define PERMISSIONS_TYPE_TYPE (permissions_type_get_type ())
enum  {
	PERMISSION_BUTTON_0_PROPERTY,
	PERMISSION_BUTTON_BTN_READ_PROPERTY,
	PERMISSION_BUTTON_BTN_WRITE_PROPERTY,
	PERMISSION_BUTTON_BTN_EXE_PROPERTY,
	PERMISSION_BUTTON_PERMISSION_TYPE_PROPERTY,
	PERMISSION_BUTTON_NUM_PROPERTIES
};
static GParamSpec* permission_button_properties[PERMISSION_BUTTON_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))
typedef enum  {
	PERMISSIONS_VALUE_READ,
	PERMISSIONS_VALUE_WRITE,
	PERMISSIONS_VALUE_EXE
} PermissionsValue;

#define PERMISSIONS_TYPE_VALUE (permissions_value_get_type ())

struct _PermissionButton {
	GtkListBoxRow parent_instance;
	PermissionButtonPrivate * priv;
};

struct _PermissionButtonClass {
	GtkListBoxRowClass parent_class;
};

struct _PermissionButtonPrivate {
	GtkToggleButton* _btn_read;
	GtkToggleButton* _btn_write;
	GtkToggleButton* _btn_exe;
	PermissionsType _permission_type;
	mode_t* vfs_perms;
	gint vfs_perms_length1;
	gint vfs_perms_length2;
};

static gint PermissionButton_private_offset;
static gpointer permission_button_parent_class = NULL;
static GtkSizeGroup* permission_button_label_sizegroup;
static GtkSizeGroup* permission_button_label_sizegroup = NULL;

VALA_EXTERN GType permission_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PermissionButton, g_object_unref)
VALA_EXTERN GType permissions_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PermissionButton* permission_button_new (PermissionsType permission_type);
VALA_EXTERN PermissionButton* permission_button_construct (GType object_type,
                                               PermissionsType permission_type);
VALA_EXTERN void permission_button_update_buttons (PermissionButton* self,
                                       guint32 permissions);
VALA_EXTERN PermissionsType permission_button_get_permission_type (PermissionButton* self);
VALA_EXTERN GtkToggleButton* permission_button_get_btn_read (PermissionButton* self);
VALA_EXTERN GtkToggleButton* permission_button_get_btn_write (PermissionButton* self);
VALA_EXTERN GtkToggleButton* permission_button_get_btn_exe (PermissionButton* self);
static void permission_button_set_btn_read (PermissionButton* self,
                                     GtkToggleButton* value);
static void permission_button_set_btn_write (PermissionButton* self,
                                      GtkToggleButton* value);
static void permission_button_set_btn_exe (PermissionButton* self,
                                    GtkToggleButton* value);
static void permission_button_set_permission_type (PermissionButton* self,
                                            PermissionsType value);
static GObject * permission_button_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties);
VALA_EXTERN gchar* permissions_type_to_string (PermissionsType self);
VALA_EXTERN GType permissions_value_get_type (void) G_GNUC_CONST ;
static void permission_button_finalize (GObject * obj);
static GType permission_button_get_type_once (void);
static void _vala_permission_button_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);
static void _vala_permission_button_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec);

static inline gpointer
permission_button_get_instance_private (PermissionButton* self)
{
	return G_STRUCT_MEMBER_P (self, PermissionButton_private_offset);
}

PermissionButton*
permission_button_construct (GType object_type,
                             PermissionsType permission_type)
{
	PermissionButton * self = NULL;
	self = (PermissionButton*) g_object_new (object_type, "permission-type", permission_type, NULL);
	return self;
}

PermissionButton*
permission_button_new (PermissionsType permission_type)
{
	return permission_button_construct (TYPE_PERMISSION_BUTTON, permission_type);
}

void
permission_button_update_buttons (PermissionButton* self,
                                  guint32 permissions)
{
	mode_t* _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	PermissionsType _tmp1_;
	mode_t _tmp2_;
	mode_t* _tmp11_;
	gint _tmp11__length1;
	gint _tmp11__length2;
	PermissionsType _tmp12_;
	mode_t _tmp13_;
	mode_t* _tmp22_;
	gint _tmp22__length1;
	gint _tmp22__length2;
	PermissionsType _tmp23_;
	mode_t _tmp24_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->vfs_perms;
	_tmp0__length1 = self->priv->vfs_perms_length1;
	_tmp0__length2 = self->priv->vfs_perms_length2;
	_tmp1_ = self->priv->_permission_type;
	_tmp2_ = _tmp0_[(_tmp1_ * _tmp0__length2) + 0];
	if ((permissions & _tmp2_) != ((guint32) 0)) {
		GtkToggleButton* _tmp3_;
		GtkToggleButton* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		_tmp3_ = self->priv->_btn_read;
		gtk_toggle_button_set_active (_tmp3_, TRUE);
		_tmp4_ = self->priv->_btn_read;
		_tmp5_ = gtk_button_get_image ((GtkButton*) _tmp4_);
		_tmp6_ = _tmp5_;
		g_object_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_image_get_type (), GtkImage), "icon-name", "permission-read-symbolic", NULL);
	} else {
		GtkToggleButton* _tmp7_;
		GtkToggleButton* _tmp8_;
		GtkWidget* _tmp9_;
		GtkWidget* _tmp10_;
		_tmp7_ = self->priv->_btn_read;
		gtk_toggle_button_set_active (_tmp7_, FALSE);
		_tmp8_ = self->priv->_btn_read;
		_tmp9_ = gtk_button_get_image ((GtkButton*) _tmp8_);
		_tmp10_ = _tmp9_;
		g_object_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, gtk_image_get_type (), GtkImage), "icon-name", "permission-read-prevent-symbolic", NULL);
	}
	_tmp11_ = self->priv->vfs_perms;
	_tmp11__length1 = self->priv->vfs_perms_length1;
	_tmp11__length2 = self->priv->vfs_perms_length2;
	_tmp12_ = self->priv->_permission_type;
	_tmp13_ = _tmp11_[(_tmp12_ * _tmp11__length2) + 1];
	if ((permissions & _tmp13_) != ((guint32) 0)) {
		GtkToggleButton* _tmp14_;
		GtkToggleButton* _tmp15_;
		GtkWidget* _tmp16_;
		GtkWidget* _tmp17_;
		_tmp14_ = self->priv->_btn_write;
		gtk_toggle_button_set_active (_tmp14_, TRUE);
		_tmp15_ = self->priv->_btn_write;
		_tmp16_ = gtk_button_get_image ((GtkButton*) _tmp15_);
		_tmp17_ = _tmp16_;
		g_object_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, gtk_image_get_type (), GtkImage), "icon-name", "permission-write-symbolic", NULL);
	} else {
		GtkToggleButton* _tmp18_;
		GtkToggleButton* _tmp19_;
		GtkWidget* _tmp20_;
		GtkWidget* _tmp21_;
		_tmp18_ = self->priv->_btn_write;
		gtk_toggle_button_set_active (_tmp18_, FALSE);
		_tmp19_ = self->priv->_btn_write;
		_tmp20_ = gtk_button_get_image ((GtkButton*) _tmp19_);
		_tmp21_ = _tmp20_;
		g_object_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, gtk_image_get_type (), GtkImage), "icon-name", "permission-write-prevent-symbolic", NULL);
	}
	_tmp22_ = self->priv->vfs_perms;
	_tmp22__length1 = self->priv->vfs_perms_length1;
	_tmp22__length2 = self->priv->vfs_perms_length2;
	_tmp23_ = self->priv->_permission_type;
	_tmp24_ = _tmp22_[(_tmp23_ * _tmp22__length2) + 2];
	if ((permissions & _tmp24_) != ((guint32) 0)) {
		GtkToggleButton* _tmp25_;
		GtkToggleButton* _tmp26_;
		GtkWidget* _tmp27_;
		GtkWidget* _tmp28_;
		_tmp25_ = self->priv->_btn_exe;
		gtk_toggle_button_set_active (_tmp25_, TRUE);
		_tmp26_ = self->priv->_btn_exe;
		_tmp27_ = gtk_button_get_image ((GtkButton*) _tmp26_);
		_tmp28_ = _tmp27_;
		g_object_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, gtk_image_get_type (), GtkImage), "icon-name", "permission-execute-symbolic", NULL);
	} else {
		GtkToggleButton* _tmp29_;
		GtkToggleButton* _tmp30_;
		GtkWidget* _tmp31_;
		GtkWidget* _tmp32_;
		_tmp29_ = self->priv->_btn_exe;
		gtk_toggle_button_set_active (_tmp29_, FALSE);
		_tmp30_ = self->priv->_btn_exe;
		_tmp31_ = gtk_button_get_image ((GtkButton*) _tmp30_);
		_tmp32_ = _tmp31_;
		g_object_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp32_, gtk_image_get_type (), GtkImage), "icon-name", "permission-execute-prevent-symbolic", NULL);
	}
}

GtkToggleButton*
permission_button_get_btn_read (PermissionButton* self)
{
	GtkToggleButton* result;
	GtkToggleButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_btn_read;
	result = _tmp0_;
	return result;
}

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

static void
permission_button_set_btn_read (PermissionButton* self,
                                GtkToggleButton* value)
{
	GtkToggleButton* old_value;
	g_return_if_fail (self != NULL);
	old_value = permission_button_get_btn_read (self);
	if (old_value != value) {
		GtkToggleButton* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_btn_read);
		self->priv->_btn_read = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, permission_button_properties[PERMISSION_BUTTON_BTN_READ_PROPERTY]);
	}
}

GtkToggleButton*
permission_button_get_btn_write (PermissionButton* self)
{
	GtkToggleButton* result;
	GtkToggleButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_btn_write;
	result = _tmp0_;
	return result;
}

static void
permission_button_set_btn_write (PermissionButton* self,
                                 GtkToggleButton* value)
{
	GtkToggleButton* old_value;
	g_return_if_fail (self != NULL);
	old_value = permission_button_get_btn_write (self);
	if (old_value != value) {
		GtkToggleButton* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_btn_write);
		self->priv->_btn_write = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, permission_button_properties[PERMISSION_BUTTON_BTN_WRITE_PROPERTY]);
	}
}

GtkToggleButton*
permission_button_get_btn_exe (PermissionButton* self)
{
	GtkToggleButton* result;
	GtkToggleButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_btn_exe;
	result = _tmp0_;
	return result;
}

static void
permission_button_set_btn_exe (PermissionButton* self,
                               GtkToggleButton* value)
{
	GtkToggleButton* old_value;
	g_return_if_fail (self != NULL);
	old_value = permission_button_get_btn_exe (self);
	if (old_value != value) {
		GtkToggleButton* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_btn_exe);
		self->priv->_btn_exe = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, permission_button_properties[PERMISSION_BUTTON_BTN_EXE_PROPERTY]);
	}
}

PermissionsType
permission_button_get_permission_type (PermissionButton* self)
{
	PermissionsType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_permission_type;
	return result;
}

static void
permission_button_set_permission_type (PermissionButton* self,
                                       PermissionsType value)
{
	PermissionsType old_value;
	g_return_if_fail (self != NULL);
	old_value = permission_button_get_permission_type (self);
	if (old_value != value) {
		self->priv->_permission_type = value;
		g_object_notify_by_pspec ((GObject *) self, permission_button_properties[PERMISSION_BUTTON_PERMISSION_TYPE_PROPERTY]);
	}
}

static GObject *
permission_button_constructor (GType type,
                               guint n_construct_properties,
                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	PermissionButton * self;
	GtkLabel* label = NULL;
	PermissionsType _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GtkLabel* _tmp3_ = NULL;
	GtkLabel* _tmp4_;
	GtkSizeGroup* _tmp5_;
	GtkLabel* _tmp6_;
	GtkImage* _tmp7_;
	gchar* _tmp8_;
	GtkToggleButton* _tmp9_ = NULL;
	GtkToggleButton* _tmp10_;
	GtkToggleButton* _tmp11_;
	PermissionsType _tmp12_;
	GtkToggleButton* _tmp13_;
	GtkImage* _tmp14_;
	gchar* _tmp15_;
	GtkToggleButton* _tmp16_ = NULL;
	GtkToggleButton* _tmp17_;
	GtkToggleButton* _tmp18_;
	PermissionsType _tmp19_;
	GtkToggleButton* _tmp20_;
	GtkImage* _tmp21_;
	gchar* _tmp22_;
	GtkToggleButton* _tmp23_ = NULL;
	GtkToggleButton* _tmp24_;
	GtkToggleButton* _tmp25_;
	PermissionsType _tmp26_;
	GtkToggleButton* _tmp27_;
	GtkBox* box = NULL;
	GtkBox* _tmp28_;
	GtkBox* _tmp29_;
	GtkLabel* _tmp30_;
	GtkBox* _tmp31_;
	GtkToggleButton* _tmp32_;
	GtkBox* _tmp33_;
	GtkToggleButton* _tmp34_;
	GtkBox* _tmp35_;
	GtkToggleButton* _tmp36_;
	GtkBox* _tmp37_;
	parent_class = G_OBJECT_CLASS (permission_button_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PERMISSION_BUTTON, PermissionButton);
	_tmp0_ = self->priv->_permission_type;
	_tmp1_ = permissions_type_to_string (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = (GtkLabel*) gtk_label_new (_tmp2_);
	gtk_label_set_xalign (_tmp3_, (gfloat) 0);
	g_object_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp2_);
	label = _tmp4_;
	_tmp5_ = permission_button_label_sizegroup;
	_tmp6_ = label;
	gtk_size_group_add_widget (_tmp5_, (GtkWidget*) _tmp6_);
	_tmp7_ = (GtkImage*) gtk_image_new_from_icon_name ("permission-read-symbolic", (GtkIconSize) GTK_ICON_SIZE_BUTTON);
	g_object_ref_sink (_tmp7_);
	_tmp8_ = g_strdup (_ ("Read"));
	_tmp9_ = (GtkToggleButton*) gtk_toggle_button_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp9_, TRUE);
	gtk_button_set_image ((GtkButton*) _tmp9_, (GtkWidget*) _tmp7_);
	_g_object_unref0 (_tmp7_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp9_, _tmp8_);
	_g_free0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	_tmp10_ = _tmp9_;
	permission_button_set_btn_read (self, _tmp10_);
	_g_object_unref0 (_tmp10_);
	_tmp11_ = self->priv->_btn_read;
	_tmp12_ = self->priv->_permission_type;
	g_object_set_data_full ((GObject*) _tmp11_, "permissiontype", (gpointer) ((gintptr) _tmp12_), NULL);
	_tmp13_ = self->priv->_btn_read;
	g_object_set_data_full ((GObject*) _tmp13_, "permissionvalue", (gpointer) ((gintptr) PERMISSIONS_VALUE_READ), NULL);
	_tmp14_ = (GtkImage*) gtk_image_new_from_icon_name ("permission-write-symbolic", (GtkIconSize) GTK_ICON_SIZE_BUTTON);
	g_object_ref_sink (_tmp14_);
	_tmp15_ = g_strdup (_ ("Write"));
	_tmp16_ = (GtkToggleButton*) gtk_toggle_button_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp16_, TRUE);
	gtk_button_set_image ((GtkButton*) _tmp16_, (GtkWidget*) _tmp14_);
	_g_object_unref0 (_tmp14_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp16_, _tmp15_);
	_g_free0 (_tmp15_);
	g_object_ref_sink (_tmp16_);
	_tmp17_ = _tmp16_;
	permission_button_set_btn_write (self, _tmp17_);
	_g_object_unref0 (_tmp17_);
	_tmp18_ = self->priv->_btn_write;
	_tmp19_ = self->priv->_permission_type;
	g_object_set_data_full ((GObject*) _tmp18_, "permissiontype", (gpointer) ((gintptr) _tmp19_), NULL);
	_tmp20_ = self->priv->_btn_write;
	g_object_set_data_full ((GObject*) _tmp20_, "permissionvalue", (gpointer) ((gintptr) PERMISSIONS_VALUE_WRITE), NULL);
	_tmp21_ = (GtkImage*) gtk_image_new_from_icon_name ("permission-execute-symbolic", (GtkIconSize) GTK_ICON_SIZE_BUTTON);
	g_object_ref_sink (_tmp21_);
	_tmp22_ = g_strdup (_ ("Execute"));
	_tmp23_ = (GtkToggleButton*) gtk_toggle_button_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp23_, TRUE);
	gtk_button_set_image ((GtkButton*) _tmp23_, (GtkWidget*) _tmp21_);
	_g_object_unref0 (_tmp21_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp23_, _tmp22_);
	_g_free0 (_tmp22_);
	g_object_ref_sink (_tmp23_);
	_tmp24_ = _tmp23_;
	permission_button_set_btn_exe (self, _tmp24_);
	_g_object_unref0 (_tmp24_);
	_tmp25_ = self->priv->_btn_exe;
	_tmp26_ = self->priv->_permission_type;
	g_object_set_data_full ((GObject*) _tmp25_, "permissiontype", (gpointer) ((gintptr) _tmp26_), NULL);
	_tmp27_ = self->priv->_btn_exe;
	g_object_set_data_full ((GObject*) _tmp27_, "permissionvalue", (gpointer) ((gintptr) PERMISSIONS_VALUE_EXE), NULL);
	_tmp28_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp28_);
	box = _tmp28_;
	_tmp29_ = box;
	_tmp30_ = label;
	gtk_container_add ((GtkContainer*) _tmp29_, (GtkWidget*) _tmp30_);
	_tmp31_ = box;
	_tmp32_ = self->priv->_btn_read;
	gtk_container_add ((GtkContainer*) _tmp31_, (GtkWidget*) _tmp32_);
	_tmp33_ = box;
	_tmp34_ = self->priv->_btn_write;
	gtk_container_add ((GtkContainer*) _tmp33_, (GtkWidget*) _tmp34_);
	_tmp35_ = box;
	_tmp36_ = self->priv->_btn_exe;
	gtk_container_add ((GtkContainer*) _tmp35_, (GtkWidget*) _tmp36_);
	_tmp37_ = box;
	g_object_set ((GtkContainer*) self, "child", (GtkWidget*) _tmp37_, NULL);
	gtk_list_box_row_set_selectable ((GtkListBoxRow*) self, FALSE);
	gtk_list_box_row_set_activatable ((GtkListBoxRow*) self, FALSE);
	_g_object_unref0 (box);
	_g_object_unref0 (label);
	return obj;
}

static void
permission_button_class_init (PermissionButtonClass * klass,
                              gpointer klass_data)
{
	GtkSizeGroup* _tmp0_;
	permission_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PermissionButton_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_permission_button_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_permission_button_set_property;
	G_OBJECT_CLASS (klass)->constructor = permission_button_constructor;
	G_OBJECT_CLASS (klass)->finalize = permission_button_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PERMISSION_BUTTON_BTN_READ_PROPERTY, permission_button_properties[PERMISSION_BUTTON_BTN_READ_PROPERTY] = g_param_spec_object ("btn-read", "btn-read", "btn-read", gtk_toggle_button_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PERMISSION_BUTTON_BTN_WRITE_PROPERTY, permission_button_properties[PERMISSION_BUTTON_BTN_WRITE_PROPERTY] = g_param_spec_object ("btn-write", "btn-write", "btn-write", gtk_toggle_button_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PERMISSION_BUTTON_BTN_EXE_PROPERTY, permission_button_properties[PERMISSION_BUTTON_BTN_EXE_PROPERTY] = g_param_spec_object ("btn-exe", "btn-exe", "btn-exe", gtk_toggle_button_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PERMISSION_BUTTON_PERMISSION_TYPE_PROPERTY, permission_button_properties[PERMISSION_BUTTON_PERMISSION_TYPE_PROPERTY] = g_param_spec_enum ("permission-type", "permission-type", "permission-type", PERMISSIONS_TYPE_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	_tmp0_ = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
	_g_object_unref0 (permission_button_label_sizegroup);
	permission_button_label_sizegroup = _tmp0_;
}

static void
permission_button_instance_init (PermissionButton * self,
                                 gpointer klass)
{
	mode_t* _tmp0_;
	self->priv = permission_button_get_instance_private (self);
	_tmp0_ = g_new0 (mode_t, 3 * 3);
	_tmp0_[0] = S_IRUSR;
	_tmp0_[1] = S_IWUSR;
	_tmp0_[2] = S_IXUSR;
	_tmp0_[3] = S_IRGRP;
	_tmp0_[4] = S_IWGRP;
	_tmp0_[5] = S_IXGRP;
	_tmp0_[6] = S_IROTH;
	_tmp0_[7] = S_IWOTH;
	_tmp0_[8] = S_IXOTH;
	self->priv->vfs_perms = _tmp0_;
	self->priv->vfs_perms_length1 = 3;
	self->priv->vfs_perms_length2 = 3;
}

static void
permission_button_finalize (GObject * obj)
{
	PermissionButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_PERMISSION_BUTTON, PermissionButton);
	_g_object_unref0 (self->priv->_btn_read);
	_g_object_unref0 (self->priv->_btn_write);
	_g_object_unref0 (self->priv->_btn_exe);
	self->priv->vfs_perms = (g_free (self->priv->vfs_perms), NULL);
	G_OBJECT_CLASS (permission_button_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
permission_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PermissionButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) permission_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PermissionButton), 0, (GInstanceInitFunc) permission_button_instance_init, NULL };
	GType permission_button_type_id;
	permission_button_type_id = g_type_register_static (gtk_list_box_row_get_type (), "PermissionButton", &g_define_type_info, 0);
	PermissionButton_private_offset = g_type_add_instance_private (permission_button_type_id, sizeof (PermissionButtonPrivate));
	return permission_button_type_id;
}

GType
permission_button_get_type (void)
{
	static volatile gsize permission_button_type_id__once = 0;
	if (g_once_init_enter (&permission_button_type_id__once)) {
		GType permission_button_type_id;
		permission_button_type_id = permission_button_get_type_once ();
		g_once_init_leave (&permission_button_type_id__once, permission_button_type_id);
	}
	return permission_button_type_id__once;
}

static void
_vala_permission_button_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	PermissionButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_PERMISSION_BUTTON, PermissionButton);
	switch (property_id) {
		case PERMISSION_BUTTON_BTN_READ_PROPERTY:
		g_value_set_object (value, permission_button_get_btn_read (self));
		break;
		case PERMISSION_BUTTON_BTN_WRITE_PROPERTY:
		g_value_set_object (value, permission_button_get_btn_write (self));
		break;
		case PERMISSION_BUTTON_BTN_EXE_PROPERTY:
		g_value_set_object (value, permission_button_get_btn_exe (self));
		break;
		case PERMISSION_BUTTON_PERMISSION_TYPE_PROPERTY:
		g_value_set_enum (value, permission_button_get_permission_type (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_permission_button_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec)
{
	PermissionButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_PERMISSION_BUTTON, PermissionButton);
	switch (property_id) {
		case PERMISSION_BUTTON_BTN_READ_PROPERTY:
		permission_button_set_btn_read (self, g_value_get_object (value));
		break;
		case PERMISSION_BUTTON_BTN_WRITE_PROPERTY:
		permission_button_set_btn_write (self, g_value_get_object (value));
		break;
		case PERMISSION_BUTTON_BTN_EXE_PROPERTY:
		permission_button_set_btn_exe (self, g_value_get_object (value));
		break;
		case PERMISSION_BUTTON_PERMISSION_TYPE_PROPERTY:
		permission_button_set_permission_type (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

