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

/* -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-*/
/*-
 * Copyright (c) 2011-2015 Maya Developers (http://launchpad.net/maya)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Library 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 Library General Public License for more details.
 * 
 * You should have received a copy of the GNU Library General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by: Christian Dywan <christian@twotoasts.de>
 *              Corentin Noël <corentin@elementaryos.org>
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include "elementary-calendar.h"
#include <libecal/libecal.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>
#include <cairo-gobject.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.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 MAYA_VIEW_TYPE_VAUTO_HIDER (maya_view_vauto_hider_get_type ())
#define MAYA_VIEW_VAUTO_HIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAYA_VIEW_TYPE_VAUTO_HIDER, MayaViewVAutoHider))
#define MAYA_VIEW_VAUTO_HIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAYA_VIEW_TYPE_VAUTO_HIDER, MayaViewVAutoHiderClass))
#define MAYA_VIEW_IS_VAUTO_HIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAYA_VIEW_TYPE_VAUTO_HIDER))
#define MAYA_VIEW_IS_VAUTO_HIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAYA_VIEW_TYPE_VAUTO_HIDER))
#define MAYA_VIEW_VAUTO_HIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAYA_VIEW_TYPE_VAUTO_HIDER, MayaViewVAutoHiderClass))

typedef struct _MayaViewVAutoHider MayaViewVAutoHider;
typedef struct _MayaViewVAutoHiderClass MayaViewVAutoHiderClass;
typedef struct _MayaViewVAutoHiderPrivate MayaViewVAutoHiderPrivate;
enum  {
	MAYA_VIEW_VAUTO_HIDER_0_PROPERTY,
	MAYA_VIEW_VAUTO_HIDER_NUM_PROPERTIES
};
static GParamSpec* maya_view_vauto_hider_properties[MAYA_VIEW_VAUTO_HIDER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define MAYA_VIEW_TYPE_EVENT_BUTTON (maya_view_event_button_get_type ())
#define MAYA_VIEW_EVENT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAYA_VIEW_TYPE_EVENT_BUTTON, MayaViewEventButton))
#define MAYA_VIEW_EVENT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAYA_VIEW_TYPE_EVENT_BUTTON, MayaViewEventButtonClass))
#define MAYA_VIEW_IS_EVENT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAYA_VIEW_TYPE_EVENT_BUTTON))
#define MAYA_VIEW_IS_EVENT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAYA_VIEW_TYPE_EVENT_BUTTON))
#define MAYA_VIEW_EVENT_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAYA_VIEW_TYPE_EVENT_BUTTON, MayaViewEventButtonClass))

typedef struct _MayaViewEventButton MayaViewEventButton;
typedef struct _MayaViewEventButtonClass MayaViewEventButtonClass;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _MayaViewVAutoHider {
	GtkEventBox parent_instance;
	MayaViewVAutoHiderPrivate * priv;
};

struct _MayaViewVAutoHiderClass {
	GtkEventBoxClass parent_class;
};

struct _MayaViewVAutoHiderPrivate {
	GtkLabel* more_label;
	GtkBox* main_box;
};

static gint MayaViewVAutoHider_private_offset;
static gpointer maya_view_vauto_hider_parent_class = NULL;
VALA_EXTERN GCompareFunc maya_view_vauto_hider_compare_children;
GCompareFunc maya_view_vauto_hider_compare_children = NULL;

VALA_EXTERN GType maya_view_vauto_hider_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MayaViewVAutoHider, g_object_unref)
static gint _maya_view_vauto_hider_compare_children_lambda11_ (GtkWidget* a,
                                                        GtkWidget* b);
VALA_EXTERN GType maya_view_event_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MayaViewEventButton, g_object_unref)
VALA_EXTERN ECalComponent* maya_view_event_button_get_comp (MayaViewEventButton* self);
static gint __maya_view_vauto_hider_compare_children_lambda11__gcompare_func (gconstpointer a,
                                                                       gconstpointer b);
VALA_EXTERN MayaViewVAutoHider* maya_view_vauto_hider_new (void);
VALA_EXTERN MayaViewVAutoHider* maya_view_vauto_hider_construct (GType object_type);
static gboolean __lambda124_ (MayaViewVAutoHider* self,
                       GdkEventScroll* event);
static gboolean ___lambda124__gtk_widget_scroll_event (GtkWidget* _sender,
                                                GdkEventScroll* event,
                                                gpointer self);
static void maya_view_vauto_hider_real_add (GtkContainer* base,
                                     GtkWidget* widget);
static void __lambda125_ (MayaViewVAutoHider* self);
static void ___lambda125__gtk_widget_destroy (GtkWidget* _sender,
                                       gpointer self);
static void maya_view_vauto_hider_real_size_allocate (GtkWidget* base,
                                               GtkAllocation* allocation);
static void maya_view_vauto_hider_hide_revealer_now (MayaViewVAutoHider* self,
                                              GtkRevealer* revealer);
static void maya_view_vauto_hider_show_revealer_now (MayaViewVAutoHider* self,
                                              GtkRevealer* revealer);
static void maya_view_vauto_hider_real_get_preferred_width (GtkWidget* base,
                                                     gint* minimum_width,
                                                     gint* natural_width);
static void maya_view_vauto_hider_real_get_preferred_height (GtkWidget* base,
                                                      gint* minimum_height,
                                                      gint* natural_height);
VALA_EXTERN void maya_view_vauto_hider_update (MayaViewVAutoHider* self,
                                   GtkWidget* widget);
static void maya_view_vauto_hider_finalize (GObject * obj);
static GType maya_view_vauto_hider_get_type_once (void);

static inline gpointer
maya_view_vauto_hider_get_instance_private (MayaViewVAutoHider* self)
{
	return G_STRUCT_MEMBER_P (self, MayaViewVAutoHider_private_offset);
}

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

static gint
_maya_view_vauto_hider_compare_children_lambda11_ (GtkWidget* a,
                                                   GtkWidget* b)
{
	MayaViewEventButton* a2 = NULL;
	MayaViewEventButton* _tmp0_;
	MayaViewEventButton* b2 = NULL;
	MayaViewEventButton* _tmp1_;
	MayaViewEventButton* _tmp2_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp0_ = _g_object_ref0 (MAYA_VIEW_IS_EVENT_BUTTON (a) ? ((MayaViewEventButton*) a) : NULL);
	a2 = _tmp0_;
	_tmp1_ = _g_object_ref0 (MAYA_VIEW_IS_EVENT_BUTTON (b) ? ((MayaViewEventButton*) b) : NULL);
	b2 = _tmp1_;
	_tmp2_ = a2;
	if (_tmp2_ == NULL) {
		result = 1;
		_g_object_unref0 (b2);
		_g_object_unref0 (a2);
		return result;
	} else {
		MayaViewEventButton* _tmp3_;
		_tmp3_ = b2;
		if (_tmp3_ == NULL) {
			result = 0;
			_g_object_unref0 (b2);
			_g_object_unref0 (a2);
			return result;
		} else {
			MayaViewEventButton* _tmp4_;
			ECalComponent* _tmp5_;
			ECalComponent* _tmp6_;
			MayaViewEventButton* _tmp7_;
			ECalComponent* _tmp8_;
			ECalComponent* _tmp9_;
			_tmp4_ = a2;
			_tmp5_ = maya_view_event_button_get_comp (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp7_ = b2;
			_tmp8_ = maya_view_event_button_get_comp (_tmp7_);
			_tmp9_ = _tmp8_;
			result = maya_util_compare_events (_tmp6_, _tmp9_);
			_g_object_unref0 (b2);
			_g_object_unref0 (a2);
			return result;
		}
	}
	_g_object_unref0 (b2);
	_g_object_unref0 (a2);
}

static gint
__maya_view_vauto_hider_compare_children_lambda11__gcompare_func (gconstpointer a,
                                                                  gconstpointer b)
{
	gint result;
	result = _maya_view_vauto_hider_compare_children_lambda11_ ((GtkWidget*) a, (GtkWidget*) b);
	return result;
}

static gboolean
__lambda124_ (MayaViewVAutoHider* self,
              GdkEventScroll* event)
{
	gboolean result;
	g_return_val_if_fail (event != NULL, FALSE);
	result = maya_gestures_utils_on_scroll_event (event);
	return result;
}

static gboolean
___lambda124__gtk_widget_scroll_event (GtkWidget* _sender,
                                       GdkEventScroll* event,
                                       gpointer self)
{
	gboolean result;
	result = __lambda124_ ((MayaViewVAutoHider*) self, event);
	return result;
}

MayaViewVAutoHider*
maya_view_vauto_hider_construct (GType object_type)
{
	MayaViewVAutoHider * self = NULL;
	GtkLabel* _tmp0_;
	GtkLabel* _tmp1_;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkLabel* _tmp4_;
	GtkBox* _tmp5_;
	GdkEventMask _tmp6_;
	GdkEventMask _tmp7_;
	GdkEventMask _tmp8_;
	GdkEventMask _tmp9_;
	self = (MayaViewVAutoHider*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->more_label);
	self->priv->more_label = _tmp0_;
	_tmp1_ = self->priv->more_label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp1_, 0.5f, (gfloat) 1);
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->main_box);
	self->priv->main_box = _tmp2_;
	_tmp3_ = self->priv->main_box;
	_tmp4_ = self->priv->more_label;
	gtk_box_pack_end (_tmp3_, (GtkWidget*) _tmp4_, TRUE, TRUE, (guint) 0);
	_tmp5_ = self->priv->main_box;
	GTK_CONTAINER_CLASS (maya_view_vauto_hider_parent_class)->add ((GtkContainer*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_event_box_get_type (), GtkEventBox), (GtkWidget*) _tmp5_);
	_tmp6_ = gtk_widget_get_events ((GtkWidget*) self);
	_tmp7_ = _tmp6_;
	gtk_widget_set_events ((GtkWidget*) self, _tmp7_ | GDK_SCROLL_MASK);
	_tmp8_ = gtk_widget_get_events ((GtkWidget*) self);
	_tmp9_ = _tmp8_;
	gtk_widget_set_events ((GtkWidget*) self, _tmp9_ | GDK_SMOOTH_SCROLL_MASK);
	g_signal_connect_object ((GtkWidget*) self, "scroll-event", (GCallback) ___lambda124__gtk_widget_scroll_event, self, 0);
	return self;
}

MayaViewVAutoHider*
maya_view_vauto_hider_new (void)
{
	return maya_view_vauto_hider_construct (MAYA_VIEW_TYPE_VAUTO_HIDER);
}

static void
__lambda125_ (MayaViewVAutoHider* self)
{
	gtk_widget_queue_resize ((GtkWidget*) self);
}

static void
___lambda125__gtk_widget_destroy (GtkWidget* _sender,
                                  gpointer self)
{
	__lambda125_ ((MayaViewVAutoHider*) self);
}

static void
maya_view_vauto_hider_real_add (GtkContainer* base,
                                GtkWidget* widget)
{
	MayaViewVAutoHider * self;
	GList* children = NULL;
	GtkBox* _tmp0_;
	GList* _tmp1_;
	GCompareFunc _tmp2_;
	gint index = 0;
	GtkBox* _tmp3_;
	GtkBox* _tmp4_;
	self = (MayaViewVAutoHider*) base;
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->main_box;
	_tmp1_ = gtk_container_get_children ((GtkContainer*) _tmp0_);
	children = _tmp1_;
	children = g_list_append (children, widget);
	_tmp2_ = maya_view_vauto_hider_compare_children;
	children = g_list_sort (children, _tmp2_);
	index = g_list_index (children, widget);
	_tmp3_ = self->priv->main_box;
	gtk_container_add ((GtkContainer*) _tmp3_, widget);
	_tmp4_ = self->priv->main_box;
	gtk_box_reorder_child (_tmp4_, widget, index);
	g_signal_connect_object (widget, "destroy", (GCallback) ___lambda125__gtk_widget_destroy, self, 0);
	gtk_widget_queue_resize ((GtkWidget*) self);
	(children == NULL) ? NULL : (children = (g_list_free (children), NULL));
}

static void
maya_view_vauto_hider_real_size_allocate (GtkWidget* base,
                                          GtkAllocation* allocation)
{
	MayaViewVAutoHider * self;
	GtkAllocation _tmp0_;
	gint global_height = 0;
	GtkAllocation _tmp1_;
	gint children_length = 0;
	GtkBox* _tmp2_;
	GList* _tmp3_;
	GList* _tmp4_;
	gint _tmp5_;
	gint height = 0;
	gint more_label_height = 0;
	gint shown_children = 0;
	GtkLabel* _tmp7_;
	GtkLabel* _tmp8_;
	GtkLabel* _tmp9_;
	gint _tmp10_ = 0;
	GtkLabel* _tmp11_;
	GtkLabel* _tmp12_;
	GtkBox* _tmp13_;
	GList* _tmp14_;
	gint more = 0;
	gboolean _tmp27_ = FALSE;
	self = (MayaViewVAutoHider*) base;
	g_return_if_fail (allocation != NULL);
	_tmp0_ = *allocation;
	GTK_WIDGET_CLASS (maya_view_vauto_hider_parent_class)->size_allocate ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_event_box_get_type (), GtkEventBox), &_tmp0_);
	_tmp1_ = *allocation;
	global_height = _tmp1_.height;
	_tmp2_ = self->priv->main_box;
	_tmp3_ = gtk_container_get_children ((GtkContainer*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = ((gint) g_list_length (_tmp4_)) - 1;
	(_tmp4_ == NULL) ? NULL : (_tmp4_ = (g_list_free (_tmp4_), NULL));
	children_length = _tmp5_;
	if (children_length == 0) {
		GtkLabel* _tmp6_;
		_tmp6_ = self->priv->more_label;
		gtk_widget_hide ((GtkWidget*) _tmp6_);
		return;
	}
	height = 0;
	shown_children = 0;
	_tmp7_ = self->priv->more_label;
	gtk_widget_show ((GtkWidget*) _tmp7_);
	_tmp8_ = self->priv->more_label;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp8_, FALSE);
	_tmp9_ = self->priv->more_label;
	gtk_widget_get_preferred_height ((GtkWidget*) _tmp9_, &_tmp10_, NULL);
	more_label_height = _tmp10_;
	_tmp11_ = self->priv->more_label;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp11_, TRUE);
	_tmp12_ = self->priv->more_label;
	gtk_widget_hide ((GtkWidget*) _tmp12_);
	_tmp13_ = self->priv->main_box;
	_tmp14_ = gtk_container_get_children ((GtkContainer*) _tmp13_);
	{
		GList* child_collection = NULL;
		GList* child_it = NULL;
		child_collection = _tmp14_;
		for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
			GtkWidget* child = NULL;
			child = (GtkWidget*) child_it->data;
			{
				GtkWidget* _tmp15_;
				GtkLabel* _tmp16_;
				gboolean last = FALSE;
				gint child_height = 0;
				GtkWidget* _tmp17_;
				GtkWidget* _tmp18_;
				gint _tmp19_ = 0;
				GtkWidget* _tmp20_;
				gboolean should_hide = FALSE;
				_tmp15_ = child;
				_tmp16_ = self->priv->more_label;
				if (_tmp15_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, gtk_widget_get_type (), GtkWidget)) {
					continue;
				}
				last = shown_children == (children_length - 1);
				_tmp17_ = child;
				gtk_widget_show (_tmp17_);
				_tmp18_ = child;
				gtk_widget_get_preferred_height (_tmp18_, &_tmp19_, NULL);
				child_height = _tmp19_;
				_tmp20_ = child;
				gtk_widget_hide (_tmp20_);
				if ((global_height - more_label_height) < (child_height + height)) {
					gboolean _tmp21_ = FALSE;
					should_hide = TRUE;
					if (last) {
						_tmp21_ = global_height >= (child_height + height);
					} else {
						_tmp21_ = FALSE;
					}
					if (_tmp21_) {
						should_hide = FALSE;
					}
				} else {
					should_hide = FALSE;
					height += child_height;
				}
				if (should_hide) {
					GtkWidget* _tmp22_;
					GtkWidget* _tmp23_;
					_tmp22_ = child;
					maya_view_vauto_hider_hide_revealer_now (self, G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, gtk_revealer_get_type (), GtkRevealer));
					_tmp23_ = child;
					gtk_widget_hide (_tmp23_);
				} else {
					GtkWidget* _tmp24_;
					GtkWidget* _tmp25_;
					gint _tmp26_;
					_tmp24_ = child;
					maya_view_vauto_hider_show_revealer_now (self, G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, gtk_revealer_get_type (), GtkRevealer));
					_tmp25_ = child;
					gtk_widget_show (_tmp25_);
					_tmp26_ = shown_children;
					shown_children = _tmp26_ + 1;
				}
			}
		}
		(child_collection == NULL) ? NULL : (child_collection = (g_list_free (child_collection), NULL));
	}
	more = children_length - shown_children;
	if (shown_children != children_length) {
		_tmp27_ = more > 0;
	} else {
		_tmp27_ = FALSE;
	}
	if (_tmp27_) {
		GtkLabel* _tmp28_;
		GtkLabel* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		_tmp28_ = self->priv->more_label;
		gtk_widget_show ((GtkWidget*) _tmp28_);
		_tmp29_ = self->priv->more_label;
		_tmp30_ = g_strdup_printf (_ ("%u more…"), (guint) more);
		_tmp31_ = _tmp30_;
		gtk_label_set_label (_tmp29_, _tmp31_);
		_g_free0 (_tmp31_);
	} else {
		GtkLabel* _tmp32_;
		_tmp32_ = self->priv->more_label;
		gtk_widget_hide ((GtkWidget*) _tmp32_);
	}
}

static void
maya_view_vauto_hider_hide_revealer_now (MayaViewVAutoHider* self,
                                         GtkRevealer* revealer)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	guint reveal_duration = 0U;
	guint _tmp2_;
	guint _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (revealer != NULL);
	_tmp0_ = gtk_revealer_get_child_revealed (revealer);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == FALSE) {
		return;
	}
	_tmp2_ = gtk_revealer_get_transition_duration (revealer);
	_tmp3_ = _tmp2_;
	reveal_duration = _tmp3_;
	gtk_revealer_set_transition_duration (revealer, (guint) 0);
	gtk_revealer_set_reveal_child (revealer, FALSE);
	gtk_revealer_set_transition_duration (revealer, reveal_duration);
	gtk_widget_hide ((GtkWidget*) revealer);
}

static void
maya_view_vauto_hider_show_revealer_now (MayaViewVAutoHider* self,
                                         GtkRevealer* revealer)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	guint reveal_duration = 0U;
	guint _tmp2_;
	guint _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (revealer != NULL);
	_tmp0_ = gtk_revealer_get_child_revealed (revealer);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == TRUE) {
		return;
	}
	_tmp2_ = gtk_revealer_get_transition_duration (revealer);
	_tmp3_ = _tmp2_;
	reveal_duration = _tmp3_;
	gtk_revealer_set_transition_duration (revealer, (guint) 0);
	gtk_revealer_set_reveal_child (revealer, TRUE);
	gtk_revealer_set_transition_duration (revealer, reveal_duration);
	gtk_widget_show ((GtkWidget*) revealer);
}

static void
maya_view_vauto_hider_real_get_preferred_width (GtkWidget* base,
                                                gint* minimum_width,
                                                gint* natural_width)
{
	MayaViewVAutoHider * self;
	gint _vala_minimum_width = 0;
	gint _vala_natural_width = 0;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	GtkLabel* _tmp2_;
	gint _tmp3_ = 0;
	self = (MayaViewVAutoHider*) base;
	GTK_WIDGET_CLASS (maya_view_vauto_hider_parent_class)->get_preferred_width ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_event_box_get_type (), GtkEventBox), &_tmp0_, &_tmp1_);
	_vala_minimum_width = _tmp0_;
	_vala_natural_width = _tmp1_;
	_tmp2_ = self->priv->more_label;
	gtk_widget_get_preferred_width ((GtkWidget*) _tmp2_, &_tmp3_, NULL);
	_vala_minimum_width = _tmp3_;
	if (_vala_minimum_width > _vala_natural_width) {
		_vala_natural_width = _vala_minimum_width;
	}
	if (minimum_width) {
		*minimum_width = _vala_minimum_width;
	}
	if (natural_width) {
		*natural_width = _vala_natural_width;
	}
}

static void
maya_view_vauto_hider_real_get_preferred_height (GtkWidget* base,
                                                 gint* minimum_height,
                                                 gint* natural_height)
{
	MayaViewVAutoHider * self;
	gint _vala_minimum_height = 0;
	gint _vala_natural_height = 0;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	GtkLabel* _tmp2_;
	gint _tmp3_ = 0;
	self = (MayaViewVAutoHider*) base;
	GTK_WIDGET_CLASS (maya_view_vauto_hider_parent_class)->get_preferred_height ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_event_box_get_type (), GtkEventBox), &_tmp0_, &_tmp1_);
	_vala_minimum_height = _tmp0_;
	_vala_natural_height = _tmp1_;
	_tmp2_ = self->priv->more_label;
	gtk_widget_get_preferred_height ((GtkWidget*) _tmp2_, &_tmp3_, NULL);
	_vala_minimum_height = _tmp3_;
	if (_vala_minimum_height > _vala_natural_height) {
		_vala_natural_height = _vala_minimum_height;
	}
	if (minimum_height) {
		*minimum_height = _vala_minimum_height;
	}
	if (natural_height) {
		*natural_height = _vala_natural_height;
	}
}

void
maya_view_vauto_hider_update (MayaViewVAutoHider* self,
                              GtkWidget* widget)
{
	GList* children = NULL;
	GtkBox* _tmp0_;
	GList* _tmp1_;
	GCompareFunc _tmp2_;
	gint index = 0;
	GtkBox* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->main_box;
	_tmp1_ = gtk_container_get_children ((GtkContainer*) _tmp0_);
	children = _tmp1_;
	_tmp2_ = maya_view_vauto_hider_compare_children;
	children = g_list_sort (children, _tmp2_);
	index = g_list_index (children, widget);
	_tmp3_ = self->priv->main_box;
	gtk_box_reorder_child (_tmp3_, widget, index);
	(children == NULL) ? NULL : (children = (g_list_free (children), NULL));
}

static void
maya_view_vauto_hider_class_init (MayaViewVAutoHiderClass * klass,
                                  gpointer klass_data)
{
	maya_view_vauto_hider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MayaViewVAutoHider_private_offset);
	((GtkContainerClass *) klass)->add = (void (*) (GtkContainer*, GtkWidget*)) maya_view_vauto_hider_real_add;
	((GtkWidgetClass *) klass)->size_allocate = (void (*) (GtkWidget*, GtkAllocation*)) maya_view_vauto_hider_real_size_allocate;
	((GtkWidgetClass *) klass)->get_preferred_width = (void (*) (GtkWidget*, gint*, gint*)) maya_view_vauto_hider_real_get_preferred_width;
	((GtkWidgetClass *) klass)->get_preferred_height = (void (*) (GtkWidget*, gint*, gint*)) maya_view_vauto_hider_real_get_preferred_height;
	G_OBJECT_CLASS (klass)->finalize = maya_view_vauto_hider_finalize;
	maya_view_vauto_hider_compare_children = __maya_view_vauto_hider_compare_children_lambda11__gcompare_func;
}

static void
maya_view_vauto_hider_instance_init (MayaViewVAutoHider * self,
                                     gpointer klass)
{
	self->priv = maya_view_vauto_hider_get_instance_private (self);
}

static void
maya_view_vauto_hider_finalize (GObject * obj)
{
	MayaViewVAutoHider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAYA_VIEW_TYPE_VAUTO_HIDER, MayaViewVAutoHider);
	_g_object_unref0 (self->priv->more_label);
	_g_object_unref0 (self->priv->main_box);
	G_OBJECT_CLASS (maya_view_vauto_hider_parent_class)->finalize (obj);
}

static GType
maya_view_vauto_hider_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MayaViewVAutoHiderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) maya_view_vauto_hider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MayaViewVAutoHider), 0, (GInstanceInitFunc) maya_view_vauto_hider_instance_init, NULL };
	GType maya_view_vauto_hider_type_id;
	maya_view_vauto_hider_type_id = g_type_register_static (gtk_event_box_get_type (), "MayaViewVAutoHider", &g_define_type_info, 0);
	MayaViewVAutoHider_private_offset = g_type_add_instance_private (maya_view_vauto_hider_type_id, sizeof (MayaViewVAutoHiderPrivate));
	return maya_view_vauto_hider_type_id;
}

GType
maya_view_vauto_hider_get_type (void)
{
	static volatile gsize maya_view_vauto_hider_type_id__once = 0;
	if (g_once_init_enter (&maya_view_vauto_hider_type_id__once)) {
		GType maya_view_vauto_hider_type_id;
		maya_view_vauto_hider_type_id = maya_view_vauto_hider_get_type_once ();
		g_once_init_leave (&maya_view_vauto_hider_type_id__once, maya_view_vauto_hider_type_id);
	}
	return maya_view_vauto_hider_type_id__once;
}

