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


#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixdata.h>


#define DOCK_MANAGER_TYPE_TILE (dock_manager_tile_get_type ())
#define DOCK_MANAGER_TILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DOCK_MANAGER_TYPE_TILE, DockManagerTile))
#define DOCK_MANAGER_TILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DOCK_MANAGER_TYPE_TILE, DockManagerTileClass))
#define DOCK_MANAGER_IS_TILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DOCK_MANAGER_TYPE_TILE))
#define DOCK_MANAGER_IS_TILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DOCK_MANAGER_TYPE_TILE))
#define DOCK_MANAGER_TILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DOCK_MANAGER_TYPE_TILE, DockManagerTileClass))

typedef struct _DockManagerTile DockManagerTile;
typedef struct _DockManagerTileClass DockManagerTileClass;
typedef struct _DockManagerTilePrivate DockManagerTilePrivate;

#define DOCK_MANAGER_TYPE_WRAP_LABEL (dock_manager_wrap_label_get_type ())
#define DOCK_MANAGER_WRAP_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DOCK_MANAGER_TYPE_WRAP_LABEL, DockManagerWrapLabel))
#define DOCK_MANAGER_WRAP_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DOCK_MANAGER_TYPE_WRAP_LABEL, DockManagerWrapLabelClass))
#define DOCK_MANAGER_IS_WRAP_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DOCK_MANAGER_TYPE_WRAP_LABEL))
#define DOCK_MANAGER_IS_WRAP_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DOCK_MANAGER_TYPE_WRAP_LABEL))
#define DOCK_MANAGER_WRAP_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DOCK_MANAGER_TYPE_WRAP_LABEL, DockManagerWrapLabelClass))

typedef struct _DockManagerWrapLabel DockManagerWrapLabel;
typedef struct _DockManagerWrapLabelClass DockManagerWrapLabelClass;

#define DOCK_MANAGER_TYPE_TILE_VIEW (dock_manager_tile_view_get_type ())
#define DOCK_MANAGER_TILE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DOCK_MANAGER_TYPE_TILE_VIEW, DockManagerTileView))
#define DOCK_MANAGER_TILE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DOCK_MANAGER_TYPE_TILE_VIEW, DockManagerTileViewClass))
#define DOCK_MANAGER_IS_TILE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DOCK_MANAGER_TYPE_TILE_VIEW))
#define DOCK_MANAGER_IS_TILE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DOCK_MANAGER_TYPE_TILE_VIEW))
#define DOCK_MANAGER_TILE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DOCK_MANAGER_TYPE_TILE_VIEW, DockManagerTileViewClass))

typedef struct _DockManagerTileView DockManagerTileView;
typedef struct _DockManagerTileViewClass DockManagerTileViewClass;

#define DOCK_MANAGER_TYPE_ABSTRACT_TILE_OBJECT (dock_manager_abstract_tile_object_get_type ())
#define DOCK_MANAGER_ABSTRACT_TILE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DOCK_MANAGER_TYPE_ABSTRACT_TILE_OBJECT, DockManagerAbstractTileObject))
#define DOCK_MANAGER_ABSTRACT_TILE_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DOCK_MANAGER_TYPE_ABSTRACT_TILE_OBJECT, DockManagerAbstractTileObjectClass))
#define DOCK_MANAGER_IS_ABSTRACT_TILE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DOCK_MANAGER_TYPE_ABSTRACT_TILE_OBJECT))
#define DOCK_MANAGER_IS_ABSTRACT_TILE_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DOCK_MANAGER_TYPE_ABSTRACT_TILE_OBJECT))
#define DOCK_MANAGER_ABSTRACT_TILE_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DOCK_MANAGER_TYPE_ABSTRACT_TILE_OBJECT, DockManagerAbstractTileObjectClass))

typedef struct _DockManagerAbstractTileObject DockManagerAbstractTileObject;
typedef struct _DockManagerAbstractTileObjectClass DockManagerAbstractTileObjectClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))

struct _DockManagerTile {
	GtkTable parent_instance;
	DockManagerTilePrivate * priv;
};

struct _DockManagerTileClass {
	GtkTableClass parent_class;
};

struct _DockManagerTilePrivate {
	GtkButton* add_remove_button;
	GtkBox* button_box;
	GtkLabel* title;
	GtkImage* tile_image;
	DockManagerWrapLabel* description;
	GtkLabel* sub_description;
	GtkImage* add_image;
	GtkImage* remove_image;
	gint icon_size;
	DockManagerTileView* _owner;
	DockManagerAbstractTileObject* _owned_object;
	gboolean _last;
};


static gpointer dock_manager_tile_parent_class = NULL;

GType dock_manager_tile_get_type (void) G_GNUC_CONST;
GType dock_manager_wrap_label_get_type (void) G_GNUC_CONST;
GType dock_manager_tile_view_get_type (void) G_GNUC_CONST;
GType dock_manager_abstract_tile_object_get_type (void) G_GNUC_CONST;
#define DOCK_MANAGER_TILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DOCK_MANAGER_TYPE_TILE, DockManagerTilePrivate))
enum  {
	DOCK_MANAGER_TILE_DUMMY_PROPERTY,
	DOCK_MANAGER_TILE_OWNER,
	DOCK_MANAGER_TILE_OWNED_OBJECT,
	DOCK_MANAGER_TILE_LAST
};
DockManagerTile* dock_manager_tile_new (DockManagerAbstractTileObject* obj, gint icon_size);
DockManagerTile* dock_manager_tile_construct (GType object_type, DockManagerAbstractTileObject* obj, gint icon_size);
const gchar* dock_manager_abstract_tile_object_get_add_button_stock (DockManagerAbstractTileObject* self);
const gchar* dock_manager_abstract_tile_object_get_remove_button_stock (DockManagerAbstractTileObject* self);
static void dock_manager_tile_set_owned_object (DockManagerTile* self, DockManagerAbstractTileObject* value);
DockManagerAbstractTileObject* dock_manager_tile_get_owned_object (DockManagerTile* self);
static void dock_manager_tile_set_image (DockManagerTile* self);
static void _dock_manager_tile_set_image_dock_manager_abstract_tile_object_icon_updated (DockManagerAbstractTileObject* _sender, gpointer self);
static void dock_manager_tile_set_text (DockManagerTile* self);
static void _dock_manager_tile_set_text_dock_manager_abstract_tile_object_text_updated (DockManagerAbstractTileObject* _sender, gpointer self);
static void dock_manager_tile_update_buttons (DockManagerTile* self);
static void _dock_manager_tile_update_buttons_dock_manager_abstract_tile_object_buttons_updated (DockManagerAbstractTileObject* _sender, gpointer self);
void dock_manager_tile_update_state (DockManagerTile* self);
static void _dock_manager_tile_update_state_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void dock_manager_tile_build_tile (DockManagerTile* self);
DockManagerWrapLabel* dock_manager_wrap_label_new (void);
DockManagerWrapLabel* dock_manager_wrap_label_construct (GType object_type);
static void _lambda1_ (DockManagerTile* self);
static void __lambda1__gtk_button_clicked (GtkButton* _sender, gpointer self);
static void dock_manager_tile_real_realize (GtkWidget* base);
static gboolean dock_manager_tile_real_expose_event (GtkWidget* base, GdkEventExpose* event);
gboolean dock_manager_tile_get_last (DockManagerTile* self);
gboolean dock_manager_abstract_tile_object_get_enabled (DockManagerAbstractTileObject* self);
void dock_manager_wrap_label_set_wrap (DockManagerWrapLabel* self, gboolean value);
const gchar* dock_manager_abstract_tile_object_get_remove_button_tooltip (DockManagerAbstractTileObject* self);
const gchar* dock_manager_abstract_tile_object_get_add_button_tooltip (DockManagerAbstractTileObject* self);
void dock_manager_tile_set_selected (DockManagerTile* self, gboolean selected);
GdkPixbuf* dock_manager_abstract_tile_object_get_force_pixbuf (DockManagerAbstractTileObject* self);
const gchar* dock_manager_abstract_tile_object_get_icon (DockManagerAbstractTileObject* self);
const gchar* dock_manager_abstract_tile_object_get_name (DockManagerAbstractTileObject* self);
const gchar* dock_manager_abstract_tile_object_get_description (DockManagerAbstractTileObject* self);
const gchar* dock_manager_abstract_tile_object_get_sub_description_title (DockManagerAbstractTileObject* self);
const gchar* dock_manager_abstract_tile_object_get_sub_description_text (DockManagerAbstractTileObject* self);
GList* dock_manager_abstract_tile_object_get_extra_buttons (DockManagerAbstractTileObject* self);
gboolean dock_manager_abstract_tile_object_get_show_action_button (DockManagerAbstractTileObject* self);
DockManagerTileView* dock_manager_tile_get_owner (DockManagerTile* self);
void dock_manager_tile_set_owner (DockManagerTile* self, DockManagerTileView* value);
static void dock_manager_tile_set_last (DockManagerTile* self, gboolean value);
static void dock_manager_tile_finalize (GObject* obj);
static void _vala_dock_manager_tile_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_dock_manager_tile_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static void _dock_manager_tile_set_image_dock_manager_abstract_tile_object_icon_updated (DockManagerAbstractTileObject* _sender, gpointer self) {
	dock_manager_tile_set_image (self);
}


static void _dock_manager_tile_set_text_dock_manager_abstract_tile_object_text_updated (DockManagerAbstractTileObject* _sender, gpointer self) {
	dock_manager_tile_set_text (self);
}


static void _dock_manager_tile_update_buttons_dock_manager_abstract_tile_object_buttons_updated (DockManagerAbstractTileObject* _sender, gpointer self) {
	dock_manager_tile_update_buttons (self);
}


static void _dock_manager_tile_update_state_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	dock_manager_tile_update_state (self);
}


DockManagerTile* dock_manager_tile_construct (GType object_type, DockManagerAbstractTileObject* obj, gint icon_size) {
	DockManagerTile * self = NULL;
	GtkIconSize isz;
	const gchar* _tmp0_ = NULL;
	GtkImage* _tmp1_ = NULL;
	GtkImage* _tmp2_;
	const gchar* _tmp3_ = NULL;
	GtkImage* _tmp4_ = NULL;
	GtkImage* _tmp5_;
	g_return_val_if_fail (obj != NULL, NULL);
	self = (DockManagerTile*) g_object_new (object_type, "n-rows", 3, "n-columns", 3, "homogeneous", FALSE, NULL);
	isz = GTK_ICON_SIZE_SMALL_TOOLBAR;
	_tmp0_ = dock_manager_abstract_tile_object_get_add_button_stock (obj);
	_tmp1_ = (GtkImage*) gtk_image_new_from_stock (_tmp0_, isz);
	_tmp2_ = g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->add_image);
	self->priv->add_image = _tmp2_;
	_tmp3_ = dock_manager_abstract_tile_object_get_remove_button_stock (obj);
	_tmp4_ = (GtkImage*) gtk_image_new_from_stock (_tmp3_, isz);
	_tmp5_ = g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->remove_image);
	self->priv->remove_image = _tmp5_;
	dock_manager_tile_set_owned_object (self, obj);
	g_signal_connect_object (self->priv->_owned_object, "icon-updated", (GCallback) _dock_manager_tile_set_image_dock_manager_abstract_tile_object_icon_updated, self, 0);
	g_signal_connect_object (self->priv->_owned_object, "text-updated", (GCallback) _dock_manager_tile_set_text_dock_manager_abstract_tile_object_text_updated, self, 0);
	g_signal_connect_object (self->priv->_owned_object, "buttons-updated", (GCallback) _dock_manager_tile_update_buttons_dock_manager_abstract_tile_object_buttons_updated, self, 0);
	g_signal_connect_object ((GObject*) self->priv->_owned_object, "notify::enabled", (GCallback) _dock_manager_tile_update_state_g_object_notify, self, 0);
	self->priv->icon_size = icon_size;
	dock_manager_tile_build_tile (self);
	return self;
}


DockManagerTile* dock_manager_tile_new (DockManagerAbstractTileObject* obj, gint icon_size) {
	return dock_manager_tile_construct (DOCK_MANAGER_TYPE_TILE, obj, icon_size);
}


static void _lambda1_ (DockManagerTile* self) {
	g_signal_emit_by_name (self, "active-changed");
}


static void __lambda1__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	_lambda1_ (self);
}


static void dock_manager_tile_build_tile (DockManagerTile* self) {
	GtkImage* _tmp0_ = NULL;
	GtkImage* _tmp1_;
	GtkLabel* _tmp2_ = NULL;
	GtkLabel* _tmp3_;
	DockManagerWrapLabel* _tmp4_ = NULL;
	DockManagerWrapLabel* _tmp5_;
	GtkLabel* _tmp6_ = NULL;
	GtkLabel* _tmp7_;
	GtkHBox* _tmp8_ = NULL;
	GtkBox* _tmp9_;
	GtkButton* _tmp10_ = NULL;
	GtkButton* _tmp11_;
	g_return_if_fail (self != NULL);
	gtk_container_set_border_width ((GtkContainer*) self, (guint) 5);
	g_object_set ((GtkTable*) self, "row-spacing", (guint) 1, NULL);
	g_object_set ((GtkTable*) self, "column-spacing", (guint) 5, NULL);
	_tmp0_ = (GtkImage*) gtk_image_new ();
	_tmp1_ = g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->tile_image);
	self->priv->tile_image = _tmp1_;
	g_object_set ((GtkMisc*) self->priv->tile_image, "yalign", 0.0f, NULL);
	gtk_table_attach ((GtkTable*) self, (GtkWidget*) self->priv->tile_image, (guint) 0, (guint) 1, (guint) 0, (guint) 3, GTK_SHRINK, GTK_FILL | GTK_EXPAND, (guint) 0, (guint) 0);
	_tmp2_ = (GtkLabel*) gtk_label_new ("");
	_tmp3_ = g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->title);
	self->priv->title = _tmp3_;
	g_object_set ((GtkMisc*) self->priv->title, "xalign", 0.0f, NULL);
	gtk_table_attach ((GtkTable*) self, (GtkWidget*) self->priv->title, (guint) 1, (guint) 3, (guint) 0, (guint) 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, (guint) 0, (guint) 0);
	gtk_widget_show ((GtkWidget*) self->priv->title);
	_tmp4_ = dock_manager_wrap_label_new ();
	_tmp5_ = g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->description);
	self->priv->description = _tmp5_;
	gtk_table_attach ((GtkTable*) self, (GtkWidget*) self->priv->description, (guint) 1, (guint) 3, (guint) 1, (guint) 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, (guint) 0, (guint) 0);
	gtk_widget_show ((GtkWidget*) self->priv->description);
	_tmp6_ = (GtkLabel*) gtk_label_new ("");
	_tmp7_ = g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->sub_description);
	self->priv->sub_description = _tmp7_;
	g_object_set ((GtkMisc*) self->priv->sub_description, "xalign", 0.0f, NULL);
	gtk_table_attach ((GtkTable*) self, (GtkWidget*) self->priv->sub_description, (guint) 1, (guint) 2, (guint) 2, (guint) 3, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, (guint) 0, (guint) 4);
	gtk_widget_show ((GtkWidget*) self->priv->sub_description);
	dock_manager_tile_set_text (self);
	_tmp8_ = (GtkHBox*) gtk_hbox_new (FALSE, 3);
	_tmp9_ = (GtkBox*) g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->priv->button_box);
	self->priv->button_box = _tmp9_;
	_tmp10_ = (GtkButton*) gtk_button_new ();
	_tmp11_ = g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->add_remove_button);
	self->priv->add_remove_button = _tmp11_;
	g_signal_connect_object (self->priv->add_remove_button, "clicked", (GCallback) __lambda1__gtk_button_clicked, self, 0);
	dock_manager_tile_update_buttons (self);
	gtk_table_attach ((GtkTable*) self, (GtkWidget*) self->priv->button_box, (guint) 2, (guint) 3, (guint) 2, (guint) 3, GTK_SHRINK, GTK_FILL | GTK_EXPAND, (guint) 0, (guint) 0);
	gtk_widget_show ((GtkWidget*) self);
	dock_manager_tile_update_state (self);
}


static void dock_manager_tile_real_realize (GtkWidget* base) {
	DockManagerTile * self;
	GtkContainer* _tmp0_ = NULL;
	GdkWindow* _tmp1_ = NULL;
	self = (DockManagerTile*) base;
	GTK_WIDGET_SET_FLAGS ((GtkWidget*) self, GTK_NO_WINDOW);
	_tmp0_ = gtk_widget_get_parent ((GtkWidget*) self);
	_tmp1_ = gtk_widget_get_window ((GtkWidget*) _tmp0_);
	gtk_widget_set_window ((GtkWidget*) self, _tmp1_);
	GTK_WIDGET_CLASS (dock_manager_tile_parent_class)->realize ((GtkWidget*) GTK_TABLE (self));
}


static gboolean dock_manager_tile_real_expose_event (GtkWidget* base, GdkEventExpose* event) {
	DockManagerTile * self;
	gboolean result = FALSE;
	GtkStateType _tmp0_;
	gboolean _tmp6_;
	self = (DockManagerTile*) base;
	_tmp0_ = gtk_widget_get_state ((GtkWidget*) self);
	if (_tmp0_ == GTK_STATE_SELECTED) {
		GtkWidgetFlags _tmp1_;
		gboolean had_focus;
		gint _tmp2_ = 0;
		GtkStyle* _tmp3_ = NULL;
		GtkStateType _tmp4_;
		_tmp1_ = GTK_WIDGET_FLAGS ((GtkWidget*) self);
		had_focus = (_tmp1_ & GTK_HAS_FOCUS) == GTK_HAS_FOCUS;
		if (!had_focus) {
			GTK_WIDGET_SET_FLAGS ((GtkWidget*) self, GTK_HAS_FOCUS);
		}
		if (self->priv->_last) {
			_tmp2_ = 0;
		} else {
			_tmp2_ = 1;
		}
		_tmp3_ = gtk_widget_get_style ((GtkWidget*) self);
		_tmp4_ = gtk_widget_get_state ((GtkWidget*) self);
		gtk_paint_flat_box (_tmp3_, (*event).window, _tmp4_, GTK_SHADOW_NONE, &(*event).area, (GtkWidget*) self, "cell_odd", ((GtkWidget*) self)->allocation.x, ((GtkWidget*) self)->allocation.y, ((GtkWidget*) self)->allocation.width, ((GtkWidget*) self)->allocation.height - _tmp2_);
		if (!had_focus) {
			GTK_WIDGET_UNSET_FLAGS ((GtkWidget*) self, GTK_HAS_FOCUS);
		}
	}
	if (!self->priv->_last) {
		GtkStyle* _tmp5_ = NULL;
		_tmp5_ = gtk_widget_get_style ((GtkWidget*) self);
		gtk_paint_hline (_tmp5_, (*event).window, GTK_STATE_NORMAL, &(*event).area, (GtkWidget*) self, NULL, ((GtkWidget*) self)->allocation.x, ((GtkWidget*) self)->allocation.x + ((GtkWidget*) self)->allocation.width, (((GtkWidget*) self)->allocation.y + ((GtkWidget*) self)->allocation.height) - 1);
	}
	_tmp6_ = GTK_WIDGET_CLASS (dock_manager_tile_parent_class)->expose_event ((GtkWidget*) GTK_TABLE (self), event);
	result = _tmp6_;
	return result;
}


void dock_manager_tile_update_state (DockManagerTile* self) {
	gboolean _tmp0_;
	gboolean enabled;
	GtkStateType _tmp1_;
	gboolean is_selected;
	gboolean _tmp2_ = FALSE;
	gboolean sensitive;
	GtkImage* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = dock_manager_abstract_tile_object_get_enabled (self->priv->_owned_object);
	enabled = _tmp0_;
	_tmp1_ = gtk_widget_get_state ((GtkWidget*) self);
	is_selected = _tmp1_ == GTK_STATE_SELECTED;
	if (enabled) {
		_tmp2_ = TRUE;
	} else {
		gboolean _tmp3_ = FALSE;
		if (!enabled) {
			_tmp3_ = is_selected;
		} else {
			_tmp3_ = FALSE;
		}
		_tmp2_ = _tmp3_;
	}
	sensitive = _tmp2_;
	dock_manager_tile_set_image (self);
	gtk_widget_set_sensitive ((GtkWidget*) self->priv->title, sensitive);
	gtk_widget_set_sensitive ((GtkWidget*) self->priv->description, sensitive);
	dock_manager_wrap_label_set_wrap (self->priv->description, is_selected);
	gtk_widget_set_visible ((GtkWidget*) self->priv->sub_description, is_selected);
	if (enabled) {
		_tmp4_ = self->priv->remove_image;
	} else {
		_tmp4_ = self->priv->add_image;
	}
	gtk_button_set_image (self->priv->add_remove_button, (GtkWidget*) _tmp4_);
	if (enabled) {
		const gchar* _tmp6_ = NULL;
		_tmp6_ = dock_manager_abstract_tile_object_get_remove_button_tooltip (self->priv->_owned_object);
		_tmp5_ = _tmp6_;
	} else {
		const gchar* _tmp7_ = NULL;
		_tmp7_ = dock_manager_abstract_tile_object_get_add_button_tooltip (self->priv->_owned_object);
		_tmp5_ = _tmp7_;
	}
	gtk_widget_set_tooltip_markup ((GtkWidget*) self->priv->add_remove_button, _tmp5_);
}


void dock_manager_tile_set_selected (DockManagerTile* self, gboolean selected) {
	GtkStateType _tmp0_ = 0;
	g_return_if_fail (self != NULL);
	if (selected) {
		_tmp0_ = GTK_STATE_SELECTED;
	} else {
		_tmp0_ = GTK_STATE_NORMAL;
	}
	gtk_widget_set_state ((GtkWidget*) self, _tmp0_);
	if (selected) {
		gtk_widget_show_all ((GtkWidget*) self->priv->button_box);
	} else {
		gtk_widget_hide ((GtkWidget*) self->priv->button_box);
	}
	gtk_widget_set_state ((GtkWidget*) self->priv->button_box, GTK_STATE_NORMAL);
	dock_manager_tile_update_state (self);
	gtk_widget_queue_resize ((GtkWidget*) self);
}


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


static void dock_manager_tile_set_image (DockManagerTile* self) {
	GdkPixbuf* pixbuf;
	GdkPixbuf* _tmp0_ = NULL;
	gboolean _tmp19_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	pixbuf = NULL;
	_tmp0_ = dock_manager_abstract_tile_object_get_force_pixbuf (self->priv->_owned_object);
	if (_tmp0_ != NULL) {
		GdkPixbuf* _tmp1_ = NULL;
		GdkPixbuf* _tmp2_;
		GdkPixbuf* _tmp3_;
		gboolean _tmp4_ = FALSE;
		gint _tmp5_;
		_tmp1_ = dock_manager_abstract_tile_object_get_force_pixbuf (self->priv->_owned_object);
		_tmp2_ = _g_object_ref0 (_tmp1_);
		_tmp3_ = _tmp2_;
		_g_object_unref0 (pixbuf);
		pixbuf = _tmp3_;
		_tmp5_ = gdk_pixbuf_get_width (pixbuf);
		if (_tmp5_ != self->priv->icon_size) {
			_tmp4_ = TRUE;
		} else {
			gint _tmp6_;
			_tmp6_ = gdk_pixbuf_get_height (pixbuf);
			_tmp4_ = _tmp6_ != self->priv->icon_size;
		}
		if (_tmp4_) {
			GdkPixbuf* _tmp7_ = NULL;
			GdkPixbuf* _tmp8_;
			_tmp7_ = gdk_pixbuf_scale_simple (pixbuf, self->priv->icon_size, self->priv->icon_size, GDK_INTERP_BILINEAR);
			_tmp8_ = _tmp7_;
			_g_object_unref0 (pixbuf);
			pixbuf = _tmp8_;
		}
	} else {
		GdkPixbuf* temp_pb = NULL;
		GtkIconTheme* _tmp9_ = NULL;
		GtkIconTheme* it;
		const gchar* _tmp10_ = NULL;
		GdkPixbuf* _tmp11_ = NULL;
		GdkPixbuf* _tmp12_;
		GdkPixbuf* _tmp13_;
		GdkPixbuf* _tmp17_ = NULL;
		GdkPixbuf* _tmp18_;
		_tmp9_ = gtk_icon_theme_get_default ();
		it = _tmp9_;
		_tmp10_ = dock_manager_abstract_tile_object_get_icon (self->priv->_owned_object);
		_tmp11_ = gtk_icon_theme_load_icon (it, _tmp10_, self->priv->icon_size, GTK_ICON_LOOKUP_FORCE_SIZE, &_inner_error_);
		_tmp12_ = _tmp11_;
		if (_inner_error_ != NULL) {
			goto __catch3_g_error;
		}
		_tmp13_ = _tmp12_;
		_g_object_unref0 (temp_pb);
		temp_pb = _tmp13_;
		goto __finally3;
		__catch3_g_error:
		{
			GError * err;
			GdkPixbuf* _tmp14_ = NULL;
			GdkPixbuf* _tmp15_;
			GdkPixbuf* _tmp16_;
			err = _inner_error_;
			_inner_error_ = NULL;
			_tmp14_ = gtk_icon_theme_load_icon (it, GTK_STOCK_FILE, self->priv->icon_size, GTK_ICON_LOOKUP_FORCE_SIZE, &_inner_error_);
			_tmp15_ = _tmp14_;
			if (_inner_error_ != NULL) {
				_g_error_free0 (err);
				goto __finally3;
			}
			_tmp16_ = _tmp15_;
			_g_object_unref0 (temp_pb);
			temp_pb = _tmp16_;
			_g_error_free0 (err);
		}
		__finally3:
		if (_inner_error_ != NULL) {
			_g_object_unref0 (temp_pb);
			goto __catch2_g_error;
		}
		_tmp17_ = gdk_pixbuf_copy (temp_pb);
		_tmp18_ = _tmp17_;
		_g_object_unref0 (pixbuf);
		pixbuf = _tmp18_;
		_g_object_unref0 (temp_pb);
		goto __finally2;
		__catch2_g_error:
		{
			GError * err;
			err = _inner_error_;
			_inner_error_ = NULL;
			g_warning ("tile.vala:214: %s", err->message);
			_g_error_free0 (err);
		}
		__finally2:
		if (_inner_error_ != NULL) {
			_g_object_unref0 (pixbuf);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp19_ = dock_manager_abstract_tile_object_get_enabled (self->priv->_owned_object);
	gtk_widget_set_sensitive ((GtkWidget*) self->priv->tile_image, _tmp19_);
	gtk_image_set_from_pixbuf (self->priv->tile_image, pixbuf);
	gtk_widget_show ((GtkWidget*) self->priv->tile_image);
	_g_object_unref0 (pixbuf);
}


static void dock_manager_tile_set_text (DockManagerTile* self) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_;
	const gchar* _tmp3_ = NULL;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = dock_manager_abstract_tile_object_get_name (self->priv->_owned_object);
	_tmp1_ = g_markup_printf_escaped ("<b>%s</b>", _tmp0_);
	_tmp2_ = _tmp1_;
	gtk_label_set_markup (self->priv->title, _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = dock_manager_abstract_tile_object_get_description (self->priv->_owned_object);
	gtk_label_set_text ((GtkLabel*) self->priv->description, _tmp3_);
	_tmp5_ = dock_manager_abstract_tile_object_get_sub_description_title (self->priv->_owned_object);
	if (g_strcmp0 (_tmp5_, "") != 0) {
		const gchar* _tmp6_ = NULL;
		_tmp6_ = dock_manager_abstract_tile_object_get_sub_description_text (self->priv->_owned_object);
		_tmp4_ = g_strcmp0 (_tmp6_, "") != 0;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		const gchar* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		gchar* _tmp9_ = NULL;
		gchar* _tmp10_;
		_tmp7_ = dock_manager_abstract_tile_object_get_sub_description_title (self->priv->_owned_object);
		_tmp8_ = dock_manager_abstract_tile_object_get_sub_description_text (self->priv->_owned_object);
		_tmp9_ = g_markup_printf_escaped ("<small><b>%s</b> <i>%s</i></small>", _tmp7_, _tmp8_);
		_tmp10_ = _tmp9_;
		gtk_label_set_markup (self->priv->sub_description, _tmp10_);
		_g_free0 (_tmp10_);
	}
}


static void dock_manager_tile_update_buttons (DockManagerTile* self) {
	GList* _tmp0_ = NULL;
	GList* children;
	GList* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_container_get_children ((GtkContainer*) self->priv->button_box);
	children = _tmp0_;
	{
		GList* w_collection;
		GList* w_it;
		w_collection = children;
		for (w_it = w_collection; w_it != NULL; w_it = w_it->next) {
			GtkWidget* w;
			w = (GtkWidget*) w_it->data;
			{
				gtk_container_remove ((GtkContainer*) self->priv->button_box, w);
			}
		}
	}
	_tmp1_ = dock_manager_abstract_tile_object_get_extra_buttons (self->priv->_owned_object);
	{
		GList* w_collection;
		GList* w_it;
		w_collection = _tmp1_;
		for (w_it = w_collection; w_it != NULL; w_it = w_it->next) {
			GtkWidget* w;
			w = (GtkWidget*) ((GtkButton*) w_it->data);
			{
				gtk_box_pack_start (self->priv->button_box, w, FALSE, FALSE, (guint) 0);
				gtk_widget_show (w);
			}
		}
		_g_list_free0 (w_collection);
	}
	_tmp3_ = dock_manager_abstract_tile_object_get_show_action_button (self->priv->_owned_object);
	if (_tmp3_) {
		_tmp2_ = self->priv->add_remove_button != NULL;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		gtk_box_pack_start (self->priv->button_box, (GtkWidget*) self->priv->add_remove_button, FALSE, FALSE, (guint) 0);
	}
	_g_list_free0 (children);
}


DockManagerTileView* dock_manager_tile_get_owner (DockManagerTile* self) {
	DockManagerTileView* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_owner;
	return result;
}


void dock_manager_tile_set_owner (DockManagerTile* self, DockManagerTileView* value) {
	g_return_if_fail (self != NULL);
	self->priv->_owner = value;
	g_object_notify ((GObject *) self, "owner");
}


DockManagerAbstractTileObject* dock_manager_tile_get_owned_object (DockManagerTile* self) {
	DockManagerAbstractTileObject* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_owned_object;
	return result;
}


static void dock_manager_tile_set_owned_object (DockManagerTile* self, DockManagerAbstractTileObject* value) {
	DockManagerAbstractTileObject* _tmp0_;
	DockManagerAbstractTileObject* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_tmp1_ = _tmp0_;
	_g_object_unref0 (self->priv->_owned_object);
	self->priv->_owned_object = _tmp1_;
	g_object_notify ((GObject *) self, "owned-object");
}


gboolean dock_manager_tile_get_last (DockManagerTile* self) {
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_last;
	return result;
}


static void dock_manager_tile_set_last (DockManagerTile* self, gboolean value) {
	g_return_if_fail (self != NULL);
	self->priv->_last = value;
	g_object_notify ((GObject *) self, "last");
}


static void dock_manager_tile_class_init (DockManagerTileClass * klass) {
	dock_manager_tile_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (DockManagerTilePrivate));
	GTK_WIDGET_CLASS (klass)->realize = dock_manager_tile_real_realize;
	GTK_WIDGET_CLASS (klass)->expose_event = dock_manager_tile_real_expose_event;
	G_OBJECT_CLASS (klass)->get_property = _vala_dock_manager_tile_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dock_manager_tile_set_property;
	G_OBJECT_CLASS (klass)->finalize = dock_manager_tile_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DOCK_MANAGER_TILE_OWNER, g_param_spec_object ("owner", "owner", "owner", DOCK_MANAGER_TYPE_TILE_VIEW, 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), DOCK_MANAGER_TILE_OWNED_OBJECT, g_param_spec_object ("owned-object", "owned-object", "owned-object", DOCK_MANAGER_TYPE_ABSTRACT_TILE_OBJECT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DOCK_MANAGER_TILE_LAST, g_param_spec_boolean ("last", "last", "last", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_signal_new ("active_changed", DOCK_MANAGER_TYPE_TILE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}


static void dock_manager_tile_instance_init (DockManagerTile * self) {
	self->priv = DOCK_MANAGER_TILE_GET_PRIVATE (self);
}


static void dock_manager_tile_finalize (GObject* obj) {
	DockManagerTile * self;
	self = DOCK_MANAGER_TILE (obj);
	_g_object_unref0 (self->priv->add_remove_button);
	_g_object_unref0 (self->priv->button_box);
	_g_object_unref0 (self->priv->title);
	_g_object_unref0 (self->priv->tile_image);
	_g_object_unref0 (self->priv->description);
	_g_object_unref0 (self->priv->sub_description);
	_g_object_unref0 (self->priv->add_image);
	_g_object_unref0 (self->priv->remove_image);
	_g_object_unref0 (self->priv->_owned_object);
	G_OBJECT_CLASS (dock_manager_tile_parent_class)->finalize (obj);
}


GType dock_manager_tile_get_type (void) {
	static volatile gsize dock_manager_tile_type_id__volatile = 0;
	if (g_once_init_enter (&dock_manager_tile_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DockManagerTileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dock_manager_tile_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DockManagerTile), 0, (GInstanceInitFunc) dock_manager_tile_instance_init, NULL };
		GType dock_manager_tile_type_id;
		dock_manager_tile_type_id = g_type_register_static (GTK_TYPE_TABLE, "DockManagerTile", &g_define_type_info, 0);
		g_once_init_leave (&dock_manager_tile_type_id__volatile, dock_manager_tile_type_id);
	}
	return dock_manager_tile_type_id__volatile;
}


static void _vala_dock_manager_tile_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	DockManagerTile * self;
	self = DOCK_MANAGER_TILE (object);
	switch (property_id) {
		case DOCK_MANAGER_TILE_OWNER:
		g_value_set_object (value, dock_manager_tile_get_owner (self));
		break;
		case DOCK_MANAGER_TILE_OWNED_OBJECT:
		g_value_set_object (value, dock_manager_tile_get_owned_object (self));
		break;
		case DOCK_MANAGER_TILE_LAST:
		g_value_set_boolean (value, dock_manager_tile_get_last (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_dock_manager_tile_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	DockManagerTile * self;
	self = DOCK_MANAGER_TILE (object);
	switch (property_id) {
		case DOCK_MANAGER_TILE_OWNER:
		dock_manager_tile_set_owner (self, g_value_get_object (value));
		break;
		case DOCK_MANAGER_TILE_OWNED_OBJECT:
		dock_manager_tile_set_owned_object (self, g_value_get_object (value));
		break;
		case DOCK_MANAGER_TILE_LAST:
		dock_manager_tile_set_last (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



