/* key-manager-item-row.c generated by valac 0.56.3, the Vala compiler
 * generated from key-manager-item-row.vala, do not modify */

/*
 * Seahorse
 *
 * Copyright (C) 2008 Stefan Walter
 * Copyright (C) 2011 Collabora Ltd.
 * Copyright (C) 2017 Niels De Graef
 *
 * 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, see
 * <http://www.gnu.org/licenses/>.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <pango/pango.h>

#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 SEAHORSE_TYPE_KEY_MANAGER_ITEM_ROW (seahorse_key_manager_item_row_get_type ())
#define SEAHORSE_KEY_MANAGER_ITEM_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_KEY_MANAGER_ITEM_ROW, SeahorseKeyManagerItemRow))
#define SEAHORSE_KEY_MANAGER_ITEM_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_KEY_MANAGER_ITEM_ROW, SeahorseKeyManagerItemRowClass))
#define SEAHORSE_IS_KEY_MANAGER_ITEM_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_KEY_MANAGER_ITEM_ROW))
#define SEAHORSE_IS_KEY_MANAGER_ITEM_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_KEY_MANAGER_ITEM_ROW))
#define SEAHORSE_KEY_MANAGER_ITEM_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_KEY_MANAGER_ITEM_ROW, SeahorseKeyManagerItemRowClass))

typedef struct _SeahorseKeyManagerItemRow SeahorseKeyManagerItemRow;
typedef struct _SeahorseKeyManagerItemRowClass SeahorseKeyManagerItemRowClass;
typedef struct _SeahorseKeyManagerItemRowPrivate SeahorseKeyManagerItemRowPrivate;
enum  {
	SEAHORSE_KEY_MANAGER_ITEM_ROW_0_PROPERTY,
	SEAHORSE_KEY_MANAGER_ITEM_ROW_OBJECT_PROPERTY,
	SEAHORSE_KEY_MANAGER_ITEM_ROW_NUM_PROPERTIES
};
static GParamSpec* seahorse_key_manager_item_row_properties[SEAHORSE_KEY_MANAGER_ITEM_ROW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _SeahorseKeyManagerItemRow {
	GtkListBoxRow parent_instance;
	SeahorseKeyManagerItemRowPrivate * priv;
};

struct _SeahorseKeyManagerItemRowClass {
	GtkListBoxRowClass parent_class;
};

struct _SeahorseKeyManagerItemRowPrivate {
	GObject* _object;
};

static gint SeahorseKeyManagerItemRow_private_offset;
static gpointer seahorse_key_manager_item_row_parent_class = NULL;

VALA_EXTERN GType seahorse_key_manager_item_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SeahorseKeyManagerItemRow, g_object_unref)
VALA_EXTERN SeahorseKeyManagerItemRow* seahorse_key_manager_item_row_new (GObject* object);
VALA_EXTERN SeahorseKeyManagerItemRow* seahorse_key_manager_item_row_construct (GType object_type,
                                                                    GObject* object);
VALA_EXTERN GObject* seahorse_key_manager_item_row_get_object (SeahorseKeyManagerItemRow* self);
VALA_EXTERN void seahorse_key_manager_item_row_set_object (SeahorseKeyManagerItemRow* self,
                                               GObject* value);
static GObject * seahorse_key_manager_item_row_constructor (GType type,
                                                     guint n_construct_properties,
                                                     GObjectConstructParam * construct_properties);
static void seahorse_key_manager_item_row_finalize (GObject * obj);
static GType seahorse_key_manager_item_row_get_type_once (void);
static void _vala_seahorse_key_manager_item_row_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec);
static void _vala_seahorse_key_manager_item_row_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec);

static inline gpointer
seahorse_key_manager_item_row_get_instance_private (SeahorseKeyManagerItemRow* self)
{
	return G_STRUCT_MEMBER_P (self, SeahorseKeyManagerItemRow_private_offset);
}

SeahorseKeyManagerItemRow*
seahorse_key_manager_item_row_construct (GType object_type,
                                         GObject* object)
{
	SeahorseKeyManagerItemRow * self = NULL;
	g_return_val_if_fail (object != NULL, NULL);
	self = (SeahorseKeyManagerItemRow*) g_object_new (object_type, "object", object, NULL);
	return self;
}

SeahorseKeyManagerItemRow*
seahorse_key_manager_item_row_new (GObject* object)
{
	return seahorse_key_manager_item_row_construct (SEAHORSE_TYPE_KEY_MANAGER_ITEM_ROW, object);
}

GObject*
seahorse_key_manager_item_row_get_object (SeahorseKeyManagerItemRow* self)
{
	GObject* result;
	GObject* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_object;
	result = _tmp0_;
	return result;
}

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

void
seahorse_key_manager_item_row_set_object (SeahorseKeyManagerItemRow* self,
                                          GObject* value)
{
	GObject* old_value;
	g_return_if_fail (self != NULL);
	old_value = seahorse_key_manager_item_row_get_object (self);
	if (old_value != value) {
		GObject* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_object);
		self->priv->_object = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, seahorse_key_manager_item_row_properties[SEAHORSE_KEY_MANAGER_ITEM_ROW_OBJECT_PROPERTY]);
	}
}

static GObject *
seahorse_key_manager_item_row_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SeahorseKeyManagerItemRow * self;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp0_;
	GtkGrid* _tmp1_;
	GtkStyleContext* _tmp2_;
	GtkGrid* _tmp3_;
	GIcon* icon = NULL;
	GObject* _tmp4_;
	GIcon* _tmp5_ = NULL;
	GIcon* _tmp6_;
	GtkLabel* markup_label = NULL;
	GtkLabel* _tmp13_;
	GObject* _tmp14_;
	GtkLabel* _tmp15_;
	GtkLabel* _tmp16_;
	GtkLabel* _tmp17_;
	GtkLabel* _tmp18_;
	GtkLabel* _tmp19_;
	GtkLabel* _tmp20_;
	GtkGrid* _tmp21_;
	GtkLabel* _tmp22_;
	GtkLabel* description_label = NULL;
	GtkLabel* _tmp23_;
	GObject* _tmp24_;
	GtkLabel* _tmp25_;
	GtkLabel* _tmp26_;
	GtkLabel* _tmp27_;
	GtkLabel* _tmp28_;
	GtkStyleContext* _tmp29_;
	GtkGrid* _tmp30_;
	GtkLabel* _tmp31_;
	parent_class = G_OBJECT_CLASS (seahorse_key_manager_item_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEAHORSE_TYPE_KEY_MANAGER_ITEM_ROW, SeahorseKeyManagerItemRow);
	_tmp0_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp0_);
	grid = _tmp0_;
	_tmp1_ = grid;
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) _tmp1_);
	gtk_style_context_add_class (_tmp2_, "seahorse-item-listbox-row");
	_tmp3_ = grid;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp3_);
	icon = NULL;
	_tmp4_ = self->priv->_object;
	g_object_get (_tmp4_, "icon", &_tmp5_, NULL);
	_g_object_unref0 (icon);
	icon = _tmp5_;
	_tmp6_ = icon;
	if (_tmp6_ != NULL) {
		GtkImage* img = NULL;
		GIcon* _tmp7_;
		GtkImage* _tmp8_;
		GtkImage* _tmp9_;
		GtkImage* _tmp10_;
		GtkGrid* _tmp11_;
		GtkImage* _tmp12_;
		_tmp7_ = icon;
		_tmp8_ = (GtkImage*) gtk_image_new_from_gicon (_tmp7_, (GtkIconSize) GTK_ICON_SIZE_DND);
		g_object_ref_sink (_tmp8_);
		img = _tmp8_;
		_tmp9_ = img;
		gtk_widget_set_margin_end ((GtkWidget*) _tmp9_, 12);
		_tmp10_ = img;
		gtk_image_set_pixel_size (_tmp10_, 32);
		_tmp11_ = grid;
		_tmp12_ = img;
		gtk_grid_attach (_tmp11_, (GtkWidget*) _tmp12_, 0, 0, 1, 2);
		_g_object_unref0 (img);
	}
	_tmp13_ = (GtkLabel*) gtk_label_new (NULL);
	g_object_ref_sink (_tmp13_);
	markup_label = _tmp13_;
	_tmp14_ = self->priv->_object;
	_tmp15_ = markup_label;
	g_object_bind_property_with_closures (_tmp14_, "markup", (GObject*) _tmp15_, "label", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp16_ = markup_label;
	gtk_label_set_use_markup (_tmp16_, TRUE);
	_tmp17_ = markup_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp17_, GTK_ALIGN_START);
	_tmp18_ = markup_label;
	gtk_label_set_xalign (_tmp18_, 0.0f);
	_tmp19_ = markup_label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp19_, TRUE);
	_tmp20_ = markup_label;
	gtk_label_set_ellipsize (_tmp20_, PANGO_ELLIPSIZE_END);
	_tmp21_ = grid;
	_tmp22_ = markup_label;
	gtk_grid_attach (_tmp21_, (GtkWidget*) _tmp22_, 1, 0, 1, 1);
	_tmp23_ = (GtkLabel*) gtk_label_new (NULL);
	g_object_ref_sink (_tmp23_);
	description_label = _tmp23_;
	_tmp24_ = self->priv->_object;
	_tmp25_ = description_label;
	g_object_bind_property_with_closures (_tmp24_, "description", (GObject*) _tmp25_, "label", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp26_ = description_label;
	gtk_label_set_xalign (_tmp26_, 1.0f);
	_tmp27_ = description_label;
	gtk_widget_set_valign ((GtkWidget*) _tmp27_, GTK_ALIGN_START);
	_tmp28_ = description_label;
	_tmp29_ = gtk_widget_get_style_context ((GtkWidget*) _tmp28_);
	gtk_style_context_add_class (_tmp29_, "seahorse-item-listbox-row-description");
	_tmp30_ = grid;
	_tmp31_ = description_label;
	gtk_grid_attach (_tmp30_, (GtkWidget*) _tmp31_, 2, 0, 1, 1);
	gtk_widget_show_all ((GtkWidget*) self);
	_g_object_unref0 (description_label);
	_g_object_unref0 (markup_label);
	_g_object_unref0 (icon);
	_g_object_unref0 (grid);
	return obj;
}

static void
seahorse_key_manager_item_row_class_init (SeahorseKeyManagerItemRowClass * klass,
                                          gpointer klass_data)
{
	seahorse_key_manager_item_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SeahorseKeyManagerItemRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_seahorse_key_manager_item_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_seahorse_key_manager_item_row_set_property;
	G_OBJECT_CLASS (klass)->constructor = seahorse_key_manager_item_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = seahorse_key_manager_item_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_KEY_MANAGER_ITEM_ROW_OBJECT_PROPERTY, seahorse_key_manager_item_row_properties[SEAHORSE_KEY_MANAGER_ITEM_ROW_OBJECT_PROPERTY] = g_param_spec_object ("object", "object", "object", G_TYPE_OBJECT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
seahorse_key_manager_item_row_instance_init (SeahorseKeyManagerItemRow * self,
                                             gpointer klass)
{
	self->priv = seahorse_key_manager_item_row_get_instance_private (self);
}

static void
seahorse_key_manager_item_row_finalize (GObject * obj)
{
	SeahorseKeyManagerItemRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEAHORSE_TYPE_KEY_MANAGER_ITEM_ROW, SeahorseKeyManagerItemRow);
	_g_object_unref0 (self->priv->_object);
	G_OBJECT_CLASS (seahorse_key_manager_item_row_parent_class)->finalize (obj);
}

/**
 * Represents an item in the KeyManager's (i.e. the main window) list of items.
 */
 G_GNUC_NO_INLINE static GType
seahorse_key_manager_item_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SeahorseKeyManagerItemRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_key_manager_item_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorseKeyManagerItemRow), 0, (GInstanceInitFunc) seahorse_key_manager_item_row_instance_init, NULL };
	GType seahorse_key_manager_item_row_type_id;
	seahorse_key_manager_item_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "SeahorseKeyManagerItemRow", &g_define_type_info, 0);
	SeahorseKeyManagerItemRow_private_offset = g_type_add_instance_private (seahorse_key_manager_item_row_type_id, sizeof (SeahorseKeyManagerItemRowPrivate));
	return seahorse_key_manager_item_row_type_id;
}

GType
seahorse_key_manager_item_row_get_type (void)
{
	static volatile gsize seahorse_key_manager_item_row_type_id__once = 0;
	if (g_once_init_enter (&seahorse_key_manager_item_row_type_id__once)) {
		GType seahorse_key_manager_item_row_type_id;
		seahorse_key_manager_item_row_type_id = seahorse_key_manager_item_row_get_type_once ();
		g_once_init_leave (&seahorse_key_manager_item_row_type_id__once, seahorse_key_manager_item_row_type_id);
	}
	return seahorse_key_manager_item_row_type_id__once;
}

static void
_vala_seahorse_key_manager_item_row_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec)
{
	SeahorseKeyManagerItemRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SEAHORSE_TYPE_KEY_MANAGER_ITEM_ROW, SeahorseKeyManagerItemRow);
	switch (property_id) {
		case SEAHORSE_KEY_MANAGER_ITEM_ROW_OBJECT_PROPERTY:
		g_value_set_object (value, seahorse_key_manager_item_row_get_object (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_seahorse_key_manager_item_row_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec)
{
	SeahorseKeyManagerItemRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SEAHORSE_TYPE_KEY_MANAGER_ITEM_ROW, SeahorseKeyManagerItemRow);
	switch (property_id) {
		case SEAHORSE_KEY_MANAGER_ITEM_ROW_OBJECT_PROPERTY:
		seahorse_key_manager_item_row_set_object (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

