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

/*  This file is part of corebird, a Gtk+ linux Twitter client.
 *  Copyright (C) 2013 Timm Bäder
 *
 *  corebird 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 3 of the License, or
 *  (at your option) any later version.
 *
 *  corebird 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 corebird.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <pango/pango.h>
#include <float.h>
#include <math.h>


#define TYPE_SNIPPET_LIST_ENTRY (snippet_list_entry_get_type ())
#define SNIPPET_LIST_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SNIPPET_LIST_ENTRY, SnippetListEntry))
#define SNIPPET_LIST_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SNIPPET_LIST_ENTRY, SnippetListEntryClass))
#define IS_SNIPPET_LIST_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SNIPPET_LIST_ENTRY))
#define IS_SNIPPET_LIST_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SNIPPET_LIST_ENTRY))
#define SNIPPET_LIST_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SNIPPET_LIST_ENTRY, SnippetListEntryClass))

typedef struct _SnippetListEntry SnippetListEntry;
typedef struct _SnippetListEntryClass SnippetListEntryClass;
typedef struct _SnippetListEntryPrivate SnippetListEntryPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _SnippetListEntry {
	GtkListBoxRow parent_instance;
	SnippetListEntryPrivate * priv;
};

struct _SnippetListEntryClass {
	GtkListBoxRowClass parent_class;
};

struct _SnippetListEntryPrivate {
	GtkLabel* key_label;
	GtkLabel* value_label;
	GtkRevealer* revealer;
};


static gpointer snippet_list_entry_parent_class = NULL;

GType snippet_list_entry_get_type (void) G_GNUC_CONST;
#define SNIPPET_LIST_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_SNIPPET_LIST_ENTRY, SnippetListEntryPrivate))
enum  {
	SNIPPET_LIST_ENTRY_DUMMY_PROPERTY,
	SNIPPET_LIST_ENTRY_KEY,
	SNIPPET_LIST_ENTRY_VALUE
};
SnippetListEntry* snippet_list_entry_new (const gchar* key, const gchar* value);
SnippetListEntry* snippet_list_entry_construct (GType object_type, const gchar* key, const gchar* value);
void snippet_list_entry_reveal (SnippetListEntry* self);
static void __lambda199_ (SnippetListEntry* self);
static void ___lambda199__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
const gchar* snippet_list_entry_get_key (SnippetListEntry* self);
void snippet_list_entry_set_key (SnippetListEntry* self, const gchar* value);
const gchar* snippet_list_entry_get_value (SnippetListEntry* self);
void snippet_list_entry_set_value (SnippetListEntry* self, const gchar* value);
static void snippet_list_entry_finalize (GObject* obj);
static void _vala_snippet_list_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_snippet_list_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


SnippetListEntry* snippet_list_entry_construct (GType object_type, const gchar* key, const gchar* value) {
	SnippetListEntry * self = NULL;
	GtkRevealer* _tmp0_ = NULL;
	GtkRevealer* _tmp1_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	GtkLabel* _tmp4_ = NULL;
	GtkLabel* _tmp5_ = NULL;
	GtkLabel* _tmp6_ = NULL;
	GtkLabel* _tmp7_ = NULL;
	GtkLabel* _tmp8_ = NULL;
	const gchar* _tmp9_ = NULL;
	GtkLabel* _tmp10_ = NULL;
	GtkLabel* _tmp11_ = NULL;
	GtkLabel* _tmp12_ = NULL;
	GtkLabel* _tmp13_ = NULL;
	GtkLabel* _tmp14_ = NULL;
	GtkLabel* _tmp15_ = NULL;
	GtkRevealer* _tmp16_ = NULL;
	GtkRevealer* _tmp17_ = NULL;
	GtkStyleContext* _tmp18_ = NULL;
	g_return_val_if_fail (key != NULL, NULL);
	g_return_val_if_fail (value != NULL, NULL);
	self = (SnippetListEntry*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkRevealer*) gtk_revealer_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->revealer);
	self->priv->revealer = _tmp0_;
	_tmp1_ = self->priv->revealer;
	gtk_revealer_set_reveal_child (_tmp1_, TRUE);
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
	g_object_ref_sink (_tmp2_);
	box = _tmp2_;
	g_object_set (G_TYPE_CHECK_INSTANCE_CAST (box, gtk_widget_get_type (), GtkWidget), "margin", 6, NULL);
	gtk_box_set_homogeneous (box, TRUE);
	_tmp3_ = key;
	_tmp4_ = (GtkLabel*) gtk_label_new (_tmp3_);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->key_label);
	self->priv->key_label = _tmp4_;
	_tmp5_ = self->priv->key_label;
	gtk_widget_set_halign (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, gtk_widget_get_type (), GtkWidget), GTK_ALIGN_START);
	_tmp6_ = self->priv->key_label;
	gtk_widget_set_hexpand (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_widget_get_type (), GtkWidget), TRUE);
	_tmp7_ = self->priv->key_label;
	gtk_label_set_ellipsize (_tmp7_, PANGO_ELLIPSIZE_END);
	_tmp8_ = self->priv->key_label;
	gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (box, gtk_container_get_type (), GtkContainer), G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, gtk_widget_get_type (), GtkWidget));
	_tmp9_ = value;
	_tmp10_ = (GtkLabel*) gtk_label_new (_tmp9_);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->value_label);
	self->priv->value_label = _tmp10_;
	_tmp11_ = self->priv->value_label;
	gtk_widget_set_halign (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, gtk_widget_get_type (), GtkWidget), GTK_ALIGN_START);
	_tmp12_ = self->priv->value_label;
	gtk_widget_set_hexpand (G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, gtk_widget_get_type (), GtkWidget), TRUE);
	_tmp13_ = self->priv->value_label;
	gtk_label_set_xalign (_tmp13_, (gfloat) 0);
	_tmp14_ = self->priv->value_label;
	gtk_label_set_ellipsize (_tmp14_, PANGO_ELLIPSIZE_END);
	_tmp15_ = self->priv->value_label;
	gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (box, gtk_container_get_type (), GtkContainer), G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, gtk_widget_get_type (), GtkWidget));
	_tmp16_ = self->priv->revealer;
	gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, gtk_container_get_type (), GtkContainer), G_TYPE_CHECK_INSTANCE_CAST (box, gtk_widget_get_type (), GtkWidget));
	_tmp17_ = self->priv->revealer;
	gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_container_get_type (), GtkContainer), G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, gtk_widget_get_type (), GtkWidget));
	_tmp18_ = gtk_widget_get_style_context (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
	gtk_style_context_add_class (_tmp18_, "tweet");
	_g_object_unref0 (box);
	return self;
}


SnippetListEntry* snippet_list_entry_new (const gchar* key, const gchar* value) {
	return snippet_list_entry_construct (TYPE_SNIPPET_LIST_ENTRY, key, value);
}


static void __lambda199_ (SnippetListEntry* self) {
	GtkRevealer* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	_tmp0_ = self->priv->revealer;
	_tmp1_ = gtk_revealer_get_child_revealed (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		GtkContainer* _tmp3_ = NULL;
		_tmp3_ = (GtkContainer*) gtk_widget_get_parent (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
		gtk_container_remove (_tmp3_, G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
	}
}


static void ___lambda199__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	__lambda199_ ((SnippetListEntry*) self);
}


void snippet_list_entry_reveal (SnippetListEntry* self) {
	GtkRevealer* _tmp0_ = NULL;
	GtkRevealer* _tmp1_ = NULL;
	g_return_if_fail (IS_SNIPPET_LIST_ENTRY (self));
	_tmp0_ = self->priv->revealer;
	g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, G_TYPE_OBJECT, GObject), "notify::child-revealed", (GCallback) ___lambda199__g_object_notify, self, 0);
	_tmp1_ = self->priv->revealer;
	gtk_revealer_set_reveal_child (_tmp1_, FALSE);
}


const gchar* snippet_list_entry_get_key (SnippetListEntry* self) {
	const gchar* result;
	GtkLabel* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	g_return_val_if_fail (IS_SNIPPET_LIST_ENTRY (self), NULL);
	_tmp0_ = self->priv->key_label;
	_tmp1_ = gtk_label_get_label (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}


void snippet_list_entry_set_key (SnippetListEntry* self, const gchar* value) {
	GtkLabel* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_if_fail (IS_SNIPPET_LIST_ENTRY (self));
	_tmp0_ = self->priv->key_label;
	_tmp1_ = value;
	gtk_label_set_label (_tmp0_, _tmp1_);
	g_object_notify ((GObject *) self, "key");
}


const gchar* snippet_list_entry_get_value (SnippetListEntry* self) {
	const gchar* result;
	GtkLabel* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	g_return_val_if_fail (IS_SNIPPET_LIST_ENTRY (self), NULL);
	_tmp0_ = self->priv->value_label;
	_tmp1_ = gtk_label_get_label (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}


void snippet_list_entry_set_value (SnippetListEntry* self, const gchar* value) {
	GtkLabel* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_if_fail (IS_SNIPPET_LIST_ENTRY (self));
	_tmp0_ = self->priv->value_label;
	_tmp1_ = value;
	gtk_label_set_label (_tmp0_, _tmp1_);
	g_object_notify ((GObject *) self, "value");
}


static void snippet_list_entry_class_init (SnippetListEntryClass * klass) {
	snippet_list_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (SnippetListEntryPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_snippet_list_entry_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_snippet_list_entry_set_property;
	G_OBJECT_CLASS (klass)->finalize = snippet_list_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNIPPET_LIST_ENTRY_KEY, g_param_spec_string ("key", "key", "key", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SNIPPET_LIST_ENTRY_VALUE, g_param_spec_string ("value", "value", "value", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void snippet_list_entry_instance_init (SnippetListEntry * self) {
	self->priv = SNIPPET_LIST_ENTRY_GET_PRIVATE (self);
}


static void snippet_list_entry_finalize (GObject* obj) {
	SnippetListEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SNIPPET_LIST_ENTRY, SnippetListEntry);
	_g_object_unref0 (self->priv->key_label);
	_g_object_unref0 (self->priv->value_label);
	_g_object_unref0 (self->priv->revealer);
	G_OBJECT_CLASS (snippet_list_entry_parent_class)->finalize (obj);
}


GType snippet_list_entry_get_type (void) {
	static volatile gsize snippet_list_entry_type_id__volatile = 0;
	if (g_once_init_enter (&snippet_list_entry_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SnippetListEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) snippet_list_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SnippetListEntry), 0, (GInstanceInitFunc) snippet_list_entry_instance_init, NULL };
		GType snippet_list_entry_type_id;
		snippet_list_entry_type_id = g_type_register_static (gtk_list_box_row_get_type (), "SnippetListEntry", &g_define_type_info, 0);
		g_once_init_leave (&snippet_list_entry_type_id__volatile, snippet_list_entry_type_id);
	}
	return snippet_list_entry_type_id__volatile;
}


static void _vala_snippet_list_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	SnippetListEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SNIPPET_LIST_ENTRY, SnippetListEntry);
	switch (property_id) {
		case SNIPPET_LIST_ENTRY_KEY:
		g_value_set_string (value, snippet_list_entry_get_key (self));
		break;
		case SNIPPET_LIST_ENTRY_VALUE:
		g_value_set_string (value, snippet_list_entry_get_value (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_snippet_list_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	SnippetListEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SNIPPET_LIST_ENTRY, SnippetListEntry);
	switch (property_id) {
		case SNIPPET_LIST_ENTRY_KEY:
		snippet_list_entry_set_key (self, g_value_get_string (value));
		break;
		case SNIPPET_LIST_ENTRY_VALUE:
		snippet_list_entry_set_value (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



