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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <handy.h>

#define TOOTLE_VIEWS_TYPE_BASE (tootle_views_base_get_type ())
#define TOOTLE_VIEWS_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_VIEWS_TYPE_BASE, TootleViewsBase))
#define TOOTLE_VIEWS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_VIEWS_TYPE_BASE, TootleViewsBaseClass))
#define TOOTLE_VIEWS_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_VIEWS_TYPE_BASE))
#define TOOTLE_VIEWS_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_VIEWS_TYPE_BASE))
#define TOOTLE_VIEWS_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_VIEWS_TYPE_BASE, TootleViewsBaseClass))

typedef struct _TootleViewsBase TootleViewsBase;
typedef struct _TootleViewsBaseClass TootleViewsBaseClass;
typedef struct _TootleViewsBasePrivate TootleViewsBasePrivate;

#define TOOTLE_VIEWS_TYPE_TABBED_BASE (tootle_views_tabbed_base_get_type ())
#define TOOTLE_VIEWS_TABBED_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_VIEWS_TYPE_TABBED_BASE, TootleViewsTabbedBase))
#define TOOTLE_VIEWS_TABBED_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_VIEWS_TYPE_TABBED_BASE, TootleViewsTabbedBaseClass))
#define TOOTLE_VIEWS_IS_TABBED_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_VIEWS_TYPE_TABBED_BASE))
#define TOOTLE_VIEWS_IS_TABBED_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_VIEWS_TYPE_TABBED_BASE))
#define TOOTLE_VIEWS_TABBED_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_VIEWS_TYPE_TABBED_BASE, TootleViewsTabbedBaseClass))

typedef struct _TootleViewsTabbedBase TootleViewsTabbedBase;
typedef struct _TootleViewsTabbedBaseClass TootleViewsTabbedBaseClass;
typedef struct _TootleViewsTabbedBasePrivate TootleViewsTabbedBasePrivate;
enum  {
	TOOTLE_VIEWS_TABBED_BASE_0_PROPERTY,
	TOOTLE_VIEWS_TABBED_BASE_NUM_PROPERTIES
};
static GParamSpec* tootle_views_tabbed_base_properties[TOOTLE_VIEWS_TABBED_BASE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block34Data Block34Data;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef void (*TootleViewsTabbedBaseTabCB) (TootleViewsBase* tab, gpointer user_data);
typedef struct _Block35Data Block35Data;
typedef struct _Block36Data Block36Data;

struct _TootleViewsBase {
	GtkBox parent_instance;
	TootleViewsBasePrivate * priv;
	HdyHeaderBar* header;
	GtkButton* back_button;
	GtkScrolledWindow* scrolled;
	GtkBox* view;
	HdyClamp* clamp;
	GtkBox* column_view;
	GtkStack* states;
	GtkBox* content_box;
	GtkListBox* content_list;
	GtkButton* status_button;
};

struct _TootleViewsBaseClass {
	GtkBoxClass parent_class;
	void (*build_header) (TootleViewsBase* self);
	void (*clear) (TootleViewsBase* self);
	void (*on_bottom_reached) (TootleViewsBase* self);
	void (*on_shown) (TootleViewsBase* self);
	void (*on_hidden) (TootleViewsBase* self);
	void (*on_content_changed) (TootleViewsBase* self);
	void (*on_error) (TootleViewsBase* self, gint32 code, const gchar* reason);
	void (*on_content_item_activated) (TootleViewsBase* self, GtkListBoxRow* row);
};

struct _TootleViewsTabbedBase {
	TootleViewsBase parent_instance;
	TootleViewsTabbedBasePrivate * priv;
	HdyViewSwitcherTitle* switcher_title;
	HdyViewSwitcherBar* switcher_bar;
	GtkStack* stack;
};

struct _TootleViewsTabbedBaseClass {
	TootleViewsBaseClass parent_class;
};

struct _TootleViewsTabbedBasePrivate {
	TootleViewsBase* last_view;
};

struct _Block34Data {
	int _ref_count_;
	TootleViewsTabbedBase* self;
	TootleViewsBase* view;
};

struct _Block35Data {
	int _ref_count_;
	TootleViewsTabbedBase* self;
	TootleViewsTabbedBaseTabCB cb;
	gpointer cb_target;
};

struct _Block36Data {
	int _ref_count_;
	TootleViewsTabbedBase* self;
	gboolean empty;
};

static gint TootleViewsTabbedBase_private_offset;
static gpointer tootle_views_tabbed_base_parent_class = NULL;
static gint tootle_views_tabbed_base_ID_COUNTER;
static gint tootle_views_tabbed_base_ID_COUNTER = 0;
extern gchar* tootle_views_base_STATUS_EMPTY;

GType tootle_views_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleViewsBase, g_object_unref)
GType tootle_views_tabbed_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleViewsTabbedBase, g_object_unref)
void tootle_views_base_build_header (TootleViewsBase* self);
void tootle_views_base_clear (TootleViewsBase* self);
void tootle_views_base_on_content_changed (TootleViewsBase* self);
static void tootle_views_tabbed_base_real_build_header (TootleViewsBase* base);
void tootle_views_tabbed_base_add_tab (TootleViewsTabbedBase* self,
                                       TootleViewsBase* view);
static Block34Data* block34_data_ref (Block34Data* _data34_);
static void block34_data_unref (void * _userdata_);
const gchar* tootle_views_base_get_label (TootleViewsBase* self);
const gchar* tootle_views_base_get_icon (TootleViewsBase* self);
static void __lambda11_ (Block34Data* _data34_);
gboolean tootle_views_base_get_needs_attention (TootleViewsBase* self);
static void ___lambda11__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
TootleViewsBase* tootle_views_tabbed_base_add_list_tab (TootleViewsTabbedBase* self,
                                                        const gchar* label,
                                                        const gchar* icon);
TootleViewsBase* tootle_views_base_new (void);
TootleViewsBase* tootle_views_base_construct (GType object_type);
void tootle_views_base_set_label (TootleViewsBase* self,
                                  const gchar* value);
void tootle_views_base_set_icon (TootleViewsBase* self,
                                 const gchar* value);
void tootle_views_tabbed_base_foreach_tab (TootleViewsTabbedBase* self,
                                           TootleViewsTabbedBaseTabCB cb,
                                           gpointer cb_target);
static Block35Data* block35_data_ref (Block35Data* _data35_);
static void block35_data_unref (void * _userdata_);
static void __lambda12_ (Block35Data* _data35_,
                  GtkWidget* child);
static void ___lambda12__gtk_callback (GtkWidget* widget,
                                gpointer self);
static void tootle_views_tabbed_base_real_clear (TootleViewsBase* base);
static void __lambda13_ (TootleViewsTabbedBase* self,
                  TootleViewsBase* tab);
static void ___lambda13__tootle_views_tabbed_base_tab_cb (TootleViewsBase* tab,
                                                   gpointer self);
static void tootle_views_tabbed_base_real_on_content_changed (TootleViewsBase* base);
static Block36Data* block36_data_ref (Block36Data* _data36_);
static void block36_data_unref (void * _userdata_);
static void __lambda14_ (Block36Data* _data36_,
                  TootleViewsBase* tab);
gboolean tootle_views_base_get_empty (TootleViewsBase* self);
static void ___lambda14__tootle_views_tabbed_base_tab_cb (TootleViewsBase* tab,
                                                   gpointer self);
void tootle_views_base_set_state (TootleViewsBase* self,
                                  const gchar* value);
void tootle_views_base_set_status_message (TootleViewsBase* self,
                                           const gchar* value);
static void tootle_views_tabbed_base_on_view_switched (TootleViewsTabbedBase* self);
void tootle_views_base_set_current (TootleViewsBase* self,
                                    gboolean value);
void tootle_views_base_on_hidden (TootleViewsBase* self);
void tootle_views_base_on_shown (TootleViewsBase* self);
TootleViewsTabbedBase* tootle_views_tabbed_base_new (void);
TootleViewsTabbedBase* tootle_views_tabbed_base_construct (GType object_type);
static GObject * tootle_views_tabbed_base_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
void tootle_views_base_set_content (TootleViewsBase* self,
                                    GtkContainer* value);
static void _tootle_views_tabbed_base_on_view_switched_g_object_notify (GObject* _sender,
                                                                 GParamSpec* pspec,
                                                                 gpointer self);
static void tootle_views_tabbed_base_finalize (GObject * obj);
static GType tootle_views_tabbed_base_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
tootle_views_tabbed_base_get_instance_private (TootleViewsTabbedBase* self)
{
	return G_STRUCT_MEMBER_P (self, TootleViewsTabbedBase_private_offset);
}

static void
tootle_views_tabbed_base_real_build_header (TootleViewsBase* base)
{
	TootleViewsTabbedBase * self;
	HdyViewSwitcherTitle* _tmp0_;
	HdyViewSwitcherTitle* _tmp1_;
	HdyHeaderBar* _tmp2_;
	HdyViewSwitcherTitle* _tmp3_;
	HdyHeaderBar* _tmp4_;
	HdyViewSwitcherTitle* _tmp5_;
	HdyHeaderBar* _tmp6_;
	HdyViewSwitcherTitle* _tmp7_;
	HdyViewSwitcherBar* _tmp8_;
	HdyViewSwitcherBar* _tmp9_;
	HdyViewSwitcherTitle* _tmp10_;
	HdyViewSwitcherBar* _tmp11_;
	HdyViewSwitcherBar* _tmp12_;
	self = (TootleViewsTabbedBase*) base;
	_tmp0_ = hdy_view_switcher_title_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->switcher_title);
	self->switcher_title = _tmp0_;
	_tmp1_ = self->switcher_title;
	gtk_widget_show ((GtkWidget*) _tmp1_);
	_tmp2_ = ((TootleViewsBase*) self)->header;
	_tmp3_ = self->switcher_title;
	g_object_bind_property_with_closures ((GObject*) _tmp2_, "title", (GObject*) _tmp3_, "title", 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)));
	_tmp4_ = ((TootleViewsBase*) self)->header;
	_tmp5_ = self->switcher_title;
	g_object_bind_property_with_closures ((GObject*) _tmp4_, "subtitle", (GObject*) _tmp5_, "subtitle", 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)));
	_tmp6_ = ((TootleViewsBase*) self)->header;
	_tmp7_ = self->switcher_title;
	hdy_header_bar_set_custom_title (_tmp6_, (GtkWidget*) _tmp7_);
	_tmp8_ = (HdyViewSwitcherBar*) hdy_view_switcher_bar_new ();
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->switcher_bar);
	self->switcher_bar = _tmp8_;
	_tmp9_ = self->switcher_bar;
	gtk_widget_show ((GtkWidget*) _tmp9_);
	_tmp10_ = self->switcher_title;
	_tmp11_ = self->switcher_bar;
	g_object_bind_property_with_closures ((GObject*) _tmp10_, "title-visible", (GObject*) _tmp11_, "reveal", 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)));
	_tmp12_ = self->switcher_bar;
	gtk_box_pack_end ((GtkBox*) self, (GtkWidget*) _tmp12_, FALSE, FALSE, (guint) 0);
}

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

static Block34Data*
block34_data_ref (Block34Data* _data34_)
{
	g_atomic_int_inc (&_data34_->_ref_count_);
	return _data34_;
}

static void
block34_data_unref (void * _userdata_)
{
	Block34Data* _data34_;
	_data34_ = (Block34Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data34_->_ref_count_)) {
		TootleViewsTabbedBase* self;
		self = _data34_->self;
		_g_object_unref0 (_data34_->view);
		_g_object_unref0 (self);
		g_slice_free (Block34Data, _data34_);
	}
}

static void
__lambda11_ (Block34Data* _data34_)
{
	TootleViewsTabbedBase* self;
	GtkStack* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GValue _tmp3_ = {0};
	self = _data34_->self;
	_tmp0_ = self->stack;
	_tmp1_ = tootle_views_base_get_needs_attention (_data34_->view);
	_tmp2_ = _tmp1_;
	g_value_init (&_tmp3_, G_TYPE_BOOLEAN);
	g_value_set_boolean (&_tmp3_, _tmp2_);
	gtk_container_child_set_property ((GtkContainer*) _tmp0_, (GtkWidget*) _data34_->view, "needs-attention", &_tmp3_);
	G_IS_VALUE (&_tmp3_) ? (g_value_unset (&_tmp3_), NULL) : NULL;
}

static void
___lambda11__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda11_ (self);
}

void
tootle_views_tabbed_base_add_tab (TootleViewsTabbedBase* self,
                                  TootleViewsBase* view)
{
	Block34Data* _data34_;
	TootleViewsBase* _tmp0_;
	gint _tmp1_;
	GtkStack* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	GtkStack* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	GValue _tmp10_ = {0};
	HdyHeaderBar* _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (view != NULL);
	_data34_ = g_slice_new0 (Block34Data);
	_data34_->_ref_count_ = 1;
	_data34_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (view);
	_g_object_unref0 (_data34_->view);
	_data34_->view = _tmp0_;
	_tmp1_ = tootle_views_tabbed_base_ID_COUNTER;
	tootle_views_tabbed_base_ID_COUNTER = _tmp1_ + 1;
	_tmp2_ = self->stack;
	_tmp3_ = g_strdup_printf ("%i", tootle_views_tabbed_base_ID_COUNTER);
	_tmp4_ = _tmp3_;
	_tmp5_ = tootle_views_base_get_label (_data34_->view);
	_tmp6_ = _tmp5_;
	gtk_stack_add_titled (_tmp2_, (GtkWidget*) _data34_->view, _tmp4_, _tmp6_);
	_g_free0 (_tmp4_);
	_tmp7_ = self->stack;
	_tmp8_ = tootle_views_base_get_icon (_data34_->view);
	_tmp9_ = _tmp8_;
	g_value_init (&_tmp10_, G_TYPE_STRING);
	g_value_set_string (&_tmp10_, _tmp9_);
	gtk_container_child_set_property ((GtkContainer*) _tmp7_, (GtkWidget*) _data34_->view, "icon-name", &_tmp10_);
	G_IS_VALUE (&_tmp10_) ? (g_value_unset (&_tmp10_), NULL) : NULL;
	g_signal_connect_data ((GObject*) _data34_->view, "notify::needs-attention", (GCallback) ___lambda11__g_object_notify, block34_data_ref (_data34_), (GClosureNotify) block34_data_unref, 0);
	_tmp11_ = _data34_->view->header;
	gtk_widget_hide ((GtkWidget*) _tmp11_);
	block34_data_unref (_data34_);
	_data34_ = NULL;
}

TootleViewsBase*
tootle_views_tabbed_base_add_list_tab (TootleViewsTabbedBase* self,
                                       const gchar* label,
                                       const gchar* icon)
{
	TootleViewsBase* tab = NULL;
	TootleViewsBase* _tmp0_;
	TootleViewsBase* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	g_return_val_if_fail (icon != NULL, NULL);
	_tmp0_ = tootle_views_base_new ();
	g_object_ref_sink (_tmp0_);
	tab = _tmp0_;
	tootle_views_base_set_label (tab, label);
	tootle_views_base_set_icon (tab, icon);
	tootle_views_tabbed_base_add_tab (self, tab);
	result = tab;
	return result;
}

static Block35Data*
block35_data_ref (Block35Data* _data35_)
{
	g_atomic_int_inc (&_data35_->_ref_count_);
	return _data35_;
}

static void
block35_data_unref (void * _userdata_)
{
	Block35Data* _data35_;
	_data35_ = (Block35Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data35_->_ref_count_)) {
		TootleViewsTabbedBase* self;
		self = _data35_->self;
		_g_object_unref0 (self);
		g_slice_free (Block35Data, _data35_);
	}
}

static void
__lambda12_ (Block35Data* _data35_,
             GtkWidget* child)
{
	TootleViewsTabbedBase* self;
	TootleViewsBase* tab = NULL;
	TootleViewsBase* _tmp0_;
	TootleViewsBase* _tmp1_;
	self = _data35_->self;
	g_return_if_fail (child != NULL);
	_tmp0_ = _g_object_ref0 (TOOTLE_VIEWS_IS_BASE (child) ? ((TootleViewsBase*) child) : NULL);
	tab = _tmp0_;
	_tmp1_ = tab;
	if (_tmp1_ != NULL) {
		TootleViewsBase* _tmp2_;
		_tmp2_ = tab;
		_data35_->cb (_tmp2_, _data35_->cb_target);
	}
	_g_object_unref0 (tab);
}

static void
___lambda12__gtk_callback (GtkWidget* widget,
                           gpointer self)
{
	__lambda12_ (self, widget);
}

void
tootle_views_tabbed_base_foreach_tab (TootleViewsTabbedBase* self,
                                      TootleViewsTabbedBaseTabCB cb,
                                      gpointer cb_target)
{
	Block35Data* _data35_;
	GtkStack* _tmp0_;
	g_return_if_fail (self != NULL);
	_data35_ = g_slice_new0 (Block35Data);
	_data35_->_ref_count_ = 1;
	_data35_->self = g_object_ref (self);
	_data35_->cb = cb;
	_data35_->cb_target = cb_target;
	_tmp0_ = self->stack;
	gtk_container_foreach ((GtkContainer*) _tmp0_, ___lambda12__gtk_callback, _data35_);
	block35_data_unref (_data35_);
	_data35_ = NULL;
}

static void
__lambda13_ (TootleViewsTabbedBase* self,
             TootleViewsBase* tab)
{
	g_return_if_fail (tab != NULL);
	tootle_views_base_clear (tab);
}

static void
___lambda13__tootle_views_tabbed_base_tab_cb (TootleViewsBase* tab,
                                              gpointer self)
{
	__lambda13_ ((TootleViewsTabbedBase*) self, tab);
}

static void
tootle_views_tabbed_base_real_clear (TootleViewsBase* base)
{
	TootleViewsTabbedBase * self;
	self = (TootleViewsTabbedBase*) base;
	tootle_views_tabbed_base_foreach_tab (self, ___lambda13__tootle_views_tabbed_base_tab_cb, self);
	tootle_views_base_on_content_changed ((TootleViewsBase*) self);
}

static Block36Data*
block36_data_ref (Block36Data* _data36_)
{
	g_atomic_int_inc (&_data36_->_ref_count_);
	return _data36_;
}

static void
block36_data_unref (void * _userdata_)
{
	Block36Data* _data36_;
	_data36_ = (Block36Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data36_->_ref_count_)) {
		TootleViewsTabbedBase* self;
		self = _data36_->self;
		_g_object_unref0 (self);
		g_slice_free (Block36Data, _data36_);
	}
}

static void
__lambda14_ (Block36Data* _data36_,
             TootleViewsBase* tab)
{
	TootleViewsTabbedBase* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data36_->self;
	g_return_if_fail (tab != NULL);
	_tmp0_ = tootle_views_base_get_empty (tab);
	_tmp1_ = _tmp0_;
	gtk_widget_set_visible ((GtkWidget*) tab, !_tmp1_);
	_tmp2_ = gtk_widget_get_visible ((GtkWidget*) tab);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		_data36_->empty = FALSE;
	}
	tootle_views_base_on_content_changed (tab);
}

static void
___lambda14__tootle_views_tabbed_base_tab_cb (TootleViewsBase* tab,
                                              gpointer self)
{
	__lambda14_ (self, tab);
}

static void
tootle_views_tabbed_base_real_on_content_changed (TootleViewsBase* base)
{
	TootleViewsTabbedBase * self;
	Block36Data* _data36_;
	self = (TootleViewsTabbedBase*) base;
	_data36_ = g_slice_new0 (Block36Data);
	_data36_->_ref_count_ = 1;
	_data36_->self = g_object_ref (self);
	_data36_->empty = TRUE;
	tootle_views_tabbed_base_foreach_tab (self, ___lambda14__tootle_views_tabbed_base_tab_cb, _data36_);
	if (_data36_->empty) {
		const gchar* _tmp0_;
		tootle_views_base_set_state ((TootleViewsBase*) self, "status");
		_tmp0_ = tootle_views_base_STATUS_EMPTY;
		tootle_views_base_set_status_message ((TootleViewsBase*) self, _tmp0_);
	} else {
		tootle_views_base_set_state ((TootleViewsBase*) self, "content");
	}
	block36_data_unref (_data36_);
	_data36_ = NULL;
}

static void
tootle_views_tabbed_base_on_view_switched (TootleViewsTabbedBase* self)
{
	TootleViewsBase* view = NULL;
	GtkStack* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	TootleViewsBase* _tmp3_;
	TootleViewsBase* _tmp4_;
	TootleViewsBase* _tmp7_;
	TootleViewsBase* _tmp14_;
	TootleViewsBase* _tmp15_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->stack;
	_tmp1_ = gtk_stack_get_visible_child (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _g_object_ref0 (TOOTLE_VIEWS_IS_BASE (_tmp2_) ? ((TootleViewsBase*) _tmp2_) : NULL);
	view = _tmp3_;
	_tmp4_ = self->priv->last_view;
	if (_tmp4_ != NULL) {
		TootleViewsBase* _tmp5_;
		TootleViewsBase* _tmp6_;
		_tmp5_ = self->priv->last_view;
		tootle_views_base_set_current (_tmp5_, FALSE);
		_tmp6_ = self->priv->last_view;
		tootle_views_base_on_hidden (_tmp6_);
	}
	_tmp7_ = view;
	if (_tmp7_ != NULL) {
		HdyHeaderBar* _tmp8_;
		TootleViewsBase* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		TootleViewsBase* _tmp12_;
		TootleViewsBase* _tmp13_;
		_tmp8_ = ((TootleViewsBase*) self)->header;
		_tmp9_ = view;
		_tmp10_ = tootle_views_base_get_label (_tmp9_);
		_tmp11_ = _tmp10_;
		hdy_header_bar_set_title (_tmp8_, _tmp11_);
		_tmp12_ = view;
		tootle_views_base_set_current (_tmp12_, TRUE);
		_tmp13_ = view;
		tootle_views_base_on_shown (_tmp13_);
	}
	_tmp14_ = view;
	_tmp15_ = _g_object_ref0 (_tmp14_);
	_g_object_unref0 (self->priv->last_view);
	self->priv->last_view = _tmp15_;
	_g_object_unref0 (view);
}

TootleViewsTabbedBase*
tootle_views_tabbed_base_construct (GType object_type)
{
	TootleViewsTabbedBase * self = NULL;
	self = (TootleViewsTabbedBase*) tootle_views_base_construct (object_type);
	return self;
}

TootleViewsTabbedBase*
tootle_views_tabbed_base_new (void)
{
	return tootle_views_tabbed_base_construct (TOOTLE_VIEWS_TYPE_TABBED_BASE);
}

static void
_tootle_views_tabbed_base_on_view_switched_g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self)
{
	tootle_views_tabbed_base_on_view_switched ((TootleViewsTabbedBase*) self);
}

static GObject *
tootle_views_tabbed_base_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TootleViewsTabbedBase * self;
	GtkBox* _tmp0_;
	GtkListBox* _tmp1_;
	GtkStack* _tmp2_;
	GtkContainer* _tmp3_;
	GtkStack* _tmp4_;
	GtkBox* _tmp5_;
	GtkStyleContext* _tmp6_;
	GtkScrolledWindow* _tmp7_;
	GtkStack* _tmp8_;
	GtkStack* _tmp9_;
	GtkStack* _tmp10_;
	GtkStack* _tmp11_;
	GtkStack* _tmp12_;
	GtkStack* _tmp13_;
	GtkBox* _tmp14_;
	GtkStack* _tmp15_;
	HdyViewSwitcherBar* _tmp16_;
	HdyViewSwitcherTitle* _tmp17_;
	GtkStack* _tmp18_;
	parent_class = G_OBJECT_CLASS (tootle_views_tabbed_base_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_VIEWS_TYPE_TABBED_BASE, TootleViewsTabbedBase);
	_tmp0_ = ((TootleViewsBase*) self)->content_box;
	tootle_views_base_set_content ((TootleViewsBase*) self, (GtkContainer*) _tmp0_);
	_tmp1_ = ((TootleViewsBase*) self)->content_list;
	gtk_widget_destroy ((GtkWidget*) _tmp1_);
	tootle_views_base_set_state ((TootleViewsBase*) self, "content");
	_tmp2_ = ((TootleViewsBase*) self)->states;
	_tmp3_ = gtk_widget_get_parent ((GtkWidget*) _tmp2_);
	_tmp4_ = ((TootleViewsBase*) self)->states;
	gtk_container_remove (_tmp3_, (GtkWidget*) _tmp4_);
	_tmp5_ = ((TootleViewsBase*) self)->view;
	_tmp6_ = gtk_widget_get_style_context ((GtkWidget*) _tmp5_);
	gtk_style_context_remove_class (_tmp6_, "ttl-view");
	_tmp7_ = ((TootleViewsBase*) self)->scrolled;
	gtk_widget_destroy ((GtkWidget*) _tmp7_);
	_tmp8_ = ((TootleViewsBase*) self)->states;
	gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) _tmp8_, TRUE, TRUE, (guint) 0);
	_tmp9_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->stack);
	self->stack = _tmp9_;
	_tmp10_ = self->stack;
	gtk_stack_set_transition_duration (_tmp10_, (guint) 100);
	_tmp11_ = self->stack;
	gtk_stack_set_transition_type (_tmp11_, GTK_STACK_TRANSITION_TYPE_CROSSFADE);
	_tmp12_ = self->stack;
	g_signal_connect_object ((GObject*) _tmp12_, "notify::visible-child", (GCallback) _tootle_views_tabbed_base_on_view_switched_g_object_notify, self, 0);
	_tmp13_ = self->stack;
	gtk_widget_show ((GtkWidget*) _tmp13_);
	_tmp14_ = ((TootleViewsBase*) self)->content_box;
	_tmp15_ = self->stack;
	gtk_box_pack_start (_tmp14_, (GtkWidget*) _tmp15_, TRUE, TRUE, (guint) 0);
	_tmp16_ = self->switcher_bar;
	_tmp17_ = self->switcher_title;
	_tmp18_ = self->stack;
	hdy_view_switcher_title_set_stack (_tmp17_, _tmp18_);
	hdy_view_switcher_bar_set_stack (_tmp16_, _tmp18_);
	return obj;
}

static void
tootle_views_tabbed_base_class_init (TootleViewsTabbedBaseClass * klass,
                                     gpointer klass_data)
{
	tootle_views_tabbed_base_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TootleViewsTabbedBase_private_offset);
	((TootleViewsBaseClass *) klass)->build_header = (void (*) (TootleViewsBase*)) tootle_views_tabbed_base_real_build_header;
	((TootleViewsBaseClass *) klass)->clear = (void (*) (TootleViewsBase*)) tootle_views_tabbed_base_real_clear;
	((TootleViewsBaseClass *) klass)->on_content_changed = (void (*) (TootleViewsBase*)) tootle_views_tabbed_base_real_on_content_changed;
	G_OBJECT_CLASS (klass)->constructor = tootle_views_tabbed_base_constructor;
	G_OBJECT_CLASS (klass)->finalize = tootle_views_tabbed_base_finalize;
}

static void
tootle_views_tabbed_base_instance_init (TootleViewsTabbedBase * self,
                                        gpointer klass)
{
	self->priv = tootle_views_tabbed_base_get_instance_private (self);
	self->priv->last_view = NULL;
}

static void
tootle_views_tabbed_base_finalize (GObject * obj)
{
	TootleViewsTabbedBase * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_VIEWS_TYPE_TABBED_BASE, TootleViewsTabbedBase);
	_g_object_unref0 (self->switcher_title);
	_g_object_unref0 (self->switcher_bar);
	_g_object_unref0 (self->stack);
	_g_object_unref0 (self->priv->last_view);
	G_OBJECT_CLASS (tootle_views_tabbed_base_parent_class)->finalize (obj);
}

static GType
tootle_views_tabbed_base_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleViewsTabbedBaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_views_tabbed_base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TootleViewsTabbedBase), 0, (GInstanceInitFunc) tootle_views_tabbed_base_instance_init, NULL };
	GType tootle_views_tabbed_base_type_id;
	tootle_views_tabbed_base_type_id = g_type_register_static (TOOTLE_VIEWS_TYPE_BASE, "TootleViewsTabbedBase", &g_define_type_info, 0);
	TootleViewsTabbedBase_private_offset = g_type_add_instance_private (tootle_views_tabbed_base_type_id, sizeof (TootleViewsTabbedBasePrivate));
	return tootle_views_tabbed_base_type_id;
}

GType
tootle_views_tabbed_base_get_type (void)
{
	static volatile gsize tootle_views_tabbed_base_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_views_tabbed_base_type_id__volatile)) {
		GType tootle_views_tabbed_base_type_id;
		tootle_views_tabbed_base_type_id = tootle_views_tabbed_base_get_type_once ();
		g_once_init_leave (&tootle_views_tabbed_base_type_id__volatile, tootle_views_tabbed_base_type_id);
	}
	return tootle_views_tabbed_base_type_id__volatile;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

