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

/*
 *  Copyright (C) 2019 elementary, Inc. (https://elementary.io)
 *                2011-2013 Tom Beckmann <tom@elementaryos.org>
 *
 *  This program or library is free software; you can redistribute it
 *  and/or modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 3 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General
 *  Public License along with this library; if not, write to the
 *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301 USA.
 */

#include "granite.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <pango/pango.h>
#include <glib/gi18n-lib.h>
#include <gee.h>

#define GRANITE_WIDGETS_MODIFIER_MASK (((GDK_SHIFT_MASK | GDK_SUPER_MASK) | GDK_CONTROL_MASK) | GDK_MOD1_MASK)
#define GRANITE_GETTEXT_PACKAGE "granite"
#define GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MIN_TAB_WIDTH 80
#define GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MAX_TAB_WIDTH 220
#define GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_WIDTH_PINNED 18
#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

#define GRANITE_WIDGETS_TYPE_TAB_PAGE_CONTAINER (granite_widgets_tab_page_container_get_type ())
#define GRANITE_WIDGETS_TAB_PAGE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRANITE_WIDGETS_TYPE_TAB_PAGE_CONTAINER, GraniteWidgetsTabPageContainer))
#define GRANITE_WIDGETS_TAB_PAGE_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRANITE_WIDGETS_TYPE_TAB_PAGE_CONTAINER, GraniteWidgetsTabPageContainerClass))
#define GRANITE_WIDGETS_IS_TAB_PAGE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRANITE_WIDGETS_TYPE_TAB_PAGE_CONTAINER))
#define GRANITE_WIDGETS_IS_TAB_PAGE_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRANITE_WIDGETS_TYPE_TAB_PAGE_CONTAINER))
#define GRANITE_WIDGETS_TAB_PAGE_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRANITE_WIDGETS_TYPE_TAB_PAGE_CONTAINER, GraniteWidgetsTabPageContainerClass))

typedef struct _GraniteWidgetsTabPageContainer GraniteWidgetsTabPageContainer;
typedef struct _GraniteWidgetsTabPageContainerClass GraniteWidgetsTabPageContainerClass;
typedef struct _GraniteWidgetsTabPageContainerPrivate GraniteWidgetsTabPageContainerPrivate;
enum  {
	GRANITE_WIDGETS_TAB_PAGE_CONTAINER_0_PROPERTY,
	GRANITE_WIDGETS_TAB_PAGE_CONTAINER_TAB_PROPERTY,
	GRANITE_WIDGETS_TAB_PAGE_CONTAINER_NUM_PROPERTIES
};
static GParamSpec* granite_widgets_tab_page_container_properties[GRANITE_WIDGETS_TAB_PAGE_CONTAINER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	GRANITE_WIDGETS_TAB_0_PROPERTY,
	GRANITE_WIDGETS_TAB_LABEL_PROPERTY,
	GRANITE_WIDGETS_TAB_TOOLTIP_PROPERTY,
	GRANITE_WIDGETS_TAB_PINNED_PROPERTY,
	GRANITE_WIDGETS_TAB_PINNABLE_PROPERTY,
	GRANITE_WIDGETS_TAB_RESTORE_DATA_PROPERTY,
	GRANITE_WIDGETS_TAB_CLOSE_TAB_LABEL_PROPERTY,
	GRANITE_WIDGETS_TAB_DUPLICATE_TAB_LABEL_PROPERTY,
	GRANITE_WIDGETS_TAB_NEW_WINDOW_LABEL_PROPERTY,
	GRANITE_WIDGETS_TAB_PAGE_PROPERTY,
	GRANITE_WIDGETS_TAB_ICON_PROPERTY,
	GRANITE_WIDGETS_TAB_WORKING_PROPERTY,
	GRANITE_WIDGETS_TAB_ELLIPSIZE_MODE_PROPERTY,
	GRANITE_WIDGETS_TAB_MENU_PROPERTY,
	GRANITE_WIDGETS_TAB_CLOSABLE_PROPERTY,
	GRANITE_WIDGETS_TAB_IS_CURRENT_TAB_PROPERTY,
	GRANITE_WIDGETS_TAB_NUM_PROPERTIES
};
static GParamSpec* granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block3Data Block3Data;
enum  {
	GRANITE_WIDGETS_TAB_CLOSED_SIGNAL,
	GRANITE_WIDGETS_TAB_CLOSE_OTHERS_SIGNAL,
	GRANITE_WIDGETS_TAB_CLOSE_OTHERS_RIGHT_SIGNAL,
	GRANITE_WIDGETS_TAB_NEW_WINDOW_SIGNAL,
	GRANITE_WIDGETS_TAB_DUPLICATE_SIGNAL,
	GRANITE_WIDGETS_TAB_PIN_SWITCH_SIGNAL,
	GRANITE_WIDGETS_TAB_NUM_SIGNALS
};
static guint granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_NUM_SIGNALS] = {0};

#define GRANITE_WIDGETS_TYPE_CLOSED_TABS (granite_widgets_closed_tabs_get_type ())
#define GRANITE_WIDGETS_CLOSED_TABS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRANITE_WIDGETS_TYPE_CLOSED_TABS, GraniteWidgetsClosedTabs))
#define GRANITE_WIDGETS_CLOSED_TABS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRANITE_WIDGETS_TYPE_CLOSED_TABS, GraniteWidgetsClosedTabsClass))
#define GRANITE_WIDGETS_IS_CLOSED_TABS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRANITE_WIDGETS_TYPE_CLOSED_TABS))
#define GRANITE_WIDGETS_IS_CLOSED_TABS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRANITE_WIDGETS_TYPE_CLOSED_TABS))
#define GRANITE_WIDGETS_CLOSED_TABS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRANITE_WIDGETS_TYPE_CLOSED_TABS, GraniteWidgetsClosedTabsClass))

typedef struct _GraniteWidgetsClosedTabs GraniteWidgetsClosedTabs;
typedef struct _GraniteWidgetsClosedTabsClass GraniteWidgetsClosedTabsClass;
typedef struct _GraniteWidgetsClosedTabsPrivate GraniteWidgetsClosedTabsPrivate;

#define GRANITE_WIDGETS_CLOSED_TABS_TYPE_ENTRY (granite_widgets_closed_tabs_entry_get_type ())
typedef struct _GraniteWidgetsClosedTabsEntry GraniteWidgetsClosedTabsEntry;
enum  {
	GRANITE_WIDGETS_CLOSED_TABS_0_PROPERTY,
	GRANITE_WIDGETS_CLOSED_TABS_MAX_RESTORABLE_TABS_PROPERTY,
	GRANITE_WIDGETS_CLOSED_TABS_EMPTY_PROPERTY,
	GRANITE_WIDGETS_CLOSED_TABS_MENU_PROPERTY,
	GRANITE_WIDGETS_CLOSED_TABS_NUM_PROPERTIES
};
static GParamSpec* granite_widgets_closed_tabs_properties[GRANITE_WIDGETS_CLOSED_TABS_NUM_PROPERTIES];
#define _granite_widgets_closed_tabs_entry_free0(var) ((var == NULL) ? NULL : (var = (granite_widgets_closed_tabs_entry_free (var), NULL)))
typedef struct _Block4Data Block4Data;
enum  {
	GRANITE_WIDGETS_CLOSED_TABS_RESTORED_SIGNAL,
	GRANITE_WIDGETS_CLOSED_TABS_CLEARED_SIGNAL,
	GRANITE_WIDGETS_CLOSED_TABS_NUM_SIGNALS
};
static guint granite_widgets_closed_tabs_signals[GRANITE_WIDGETS_CLOSED_TABS_NUM_SIGNALS] = {0};
enum  {
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_0_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_N_TABS_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_SHOW_TABS_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TABS_CLOSABLE_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DRAG_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_NEW_WINDOW_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DUPLICATION_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_RESTORING_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MAX_RESTORABLE_TABS_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_VISIBLE_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_PINNING_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_FORCE_LEFT_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_TOOLTIP_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_LABEL_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_RESTORE_TAB_LABEL_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_CURRENT_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TABS_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_GROUP_NAME_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MENU_PROPERTY,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NUM_PROPERTIES
};
static GParamSpec* granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NUM_PROPERTIES];
typedef struct _Block5Data Block5Data;
typedef struct _Block6Data Block6Data;
typedef struct _Block7Data Block7Data;
typedef struct _Block8Data Block8Data;
typedef struct _Block9Data Block9Data;
enum  {
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_ADDED_SIGNAL,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_REMOVED_SIGNAL,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_SWITCHED_SIGNAL,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_REORDERED_SIGNAL,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_MOVED_SIGNAL,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_DUPLICATED_SIGNAL,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_RESTORED_SIGNAL,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_REQUESTED_SIGNAL,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_CLOSE_TAB_REQUESTED_SIGNAL,
	GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NUM_SIGNALS
};
static guint granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _GraniteWidgetsTabPageContainer {
	GtkEventBox parent_instance;
	GraniteWidgetsTabPageContainerPrivate * priv;
};

struct _GraniteWidgetsTabPageContainerClass {
	GtkEventBoxClass parent_class;
};

struct _GraniteWidgetsTabPageContainerPrivate {
	GraniteWidgetsTab* _tab;
};

struct _GraniteWidgetsTabPrivate {
	GtkLabel* _label;
	gboolean _pinned;
	gboolean _pinnable;
	gchar* _restore_data;
	GraniteAccelLabel* _close_tab_label;
	GraniteAccelLabel* _duplicate_tab_label;
	GraniteAccelLabel* _new_window_label;
	GtkSpinner* _working;
	gboolean __working;
	GtkMenu* _menu;
	gboolean _closable;
	gboolean _is_current_tab;
	gboolean cursor_over_tab;
	gboolean cursor_over_close_button;
	GtkRevealer* close_button_revealer;
};

struct _Block3Data {
	int _ref_count_;
	GraniteWidgetsTab* self;
	GtkMenuItem* close_other_m;
	GtkMenuItem* close_other_right_m;
};

struct _GraniteWidgetsClosedTabs {
	GObject parent_instance;
	GraniteWidgetsClosedTabsPrivate * priv;
};

struct _GraniteWidgetsClosedTabsClass {
	GObjectClass parent_class;
};

struct _GraniteWidgetsClosedTabsEntry {
	gchar* label;
	gchar* restore_data;
	GIcon* icon;
	GraniteWidgetsDroppedDelegate dropped_callback;
	gpointer dropped_callback_target;
};

struct _GraniteWidgetsClosedTabsPrivate {
	gint _max_restorable_tabs;
	GeeLinkedList* closed_tabs;
};

struct _Block4Data {
	int _ref_count_;
	GraniteWidgetsClosedTabs* self;
	GraniteWidgetsClosedTabsEntry* entry;
};

struct _GraniteWidgetsDynamicNotebookPrivate {
	gboolean _tabs_closable;
	gboolean _allow_drag;
	gboolean _allow_new_window;
	gboolean _allow_duplication;
	gboolean _allow_restoring;
	gboolean _add_button_visible;
	gboolean _allow_pinning;
	gboolean _force_left;
	gchar* _add_button_tooltip;
	GraniteAccelLabel* _new_tab_label;
	GraniteAccelLabel* _restore_tab_label;
	GList* _tabs;
	GraniteWidgetsDynamicNotebookTabBarBehavior _tab_bar_behavior;
	GtkMenu* _menu;
	GraniteWidgetsClosedTabs* closed_tabs;
	GtkNotebook* notebook;
	gint tab_width;
	gboolean wait_to_recalc_size;
	GraniteWidgetsTab* old_tab;
	GtkMenuItem* new_tab_m;
	GtkMenuItem* restore_tab_m;
	GtkButton* add_button;
	GtkButton* restore_button;
};

struct _Block5Data {
	int _ref_count_;
	GraniteWidgetsDynamicNotebook* self;
	gboolean value;
};

struct _Block6Data {
	int _ref_count_;
	GraniteWidgetsDynamicNotebook* self;
	gboolean value;
};

struct _Block7Data {
	int _ref_count_;
	GraniteWidgetsDynamicNotebook* self;
	gboolean value;
};

struct _Block8Data {
	int _ref_count_;
	GraniteWidgetsDynamicNotebook* self;
	GraniteWidgetsTab* clicked_tab;
};

struct _Block9Data {
	int _ref_count_;
	GraniteWidgetsDynamicNotebook* self;
	gboolean is_to_the_right;
	GraniteWidgetsTab* clicked_tab;
};

static gint GraniteWidgetsTabPageContainer_private_offset;
static gpointer granite_widgets_tab_page_container_parent_class = NULL;
static gint GraniteWidgetsTab_private_offset;
static gpointer granite_widgets_tab_parent_class = NULL;
static gint GraniteWidgetsClosedTabs_private_offset;
static gpointer granite_widgets_closed_tabs_parent_class = NULL;
static gint GraniteWidgetsDynamicNotebook_private_offset;
static gpointer granite_widgets_dynamic_notebook_parent_class = NULL;

 G_GNUC_INTERNAL GType granite_widgets_tab_page_container_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
 G_GNUC_INTERNAL GraniteWidgetsTab* granite_widgets_tab_page_container_get_tab (GraniteWidgetsTabPageContainer* self);
 G_GNUC_INTERNAL void granite_widgets_tab_page_container_set_tab (GraniteWidgetsTabPageContainer* self,
                                                 GraniteWidgetsTab* value);
static GraniteWidgetsDynamicNotebook* granite_widgets_tab_page_container_get_dynamic_notebook (GraniteWidgetsTabPageContainer* self);
 G_GNUC_INTERNAL GraniteWidgetsTabPageContainer* granite_widgets_tab_page_container_new (GraniteWidgetsTab* tab);
 G_GNUC_INTERNAL GraniteWidgetsTabPageContainer* granite_widgets_tab_page_container_construct (GType object_type,
                                                                              GraniteWidgetsTab* tab);
static GObject * granite_widgets_tab_page_container_constructor (GType type,
                                                          guint n_construct_properties,
                                                          GObjectConstructParam * construct_properties);
static gboolean _granite_widgets_tab_page_container___lambda57_ (GraniteWidgetsTabPageContainer* self,
                                                          GdkEventCrossing* e);
 G_GNUC_INTERNAL void granite_widgets_dynamic_notebook_check_to_recalc_size (GraniteWidgetsDynamicNotebook* self);
static gboolean __granite_widgets_tab_page_container___lambda57__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                                                                         GdkEventCrossing* event,
                                                                                         gpointer self);
static void granite_widgets_tab_page_container_finalize (GObject * obj);
static GType granite_widgets_tab_page_container_get_type_once (void);
static void _vala_granite_widgets_tab_page_container_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);
static void _vala_granite_widgets_tab_page_container_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec);
static void granite_widgets_tab_update_close_button_visibility (GraniteWidgetsTab* self);
static GraniteWidgetsDynamicNotebook* granite_widgets_tab_get_dynamic_notebook (GraniteWidgetsTab* self);
 G_GNUC_INTERNAL void granite_widgets_tab_set_closable (GraniteWidgetsTab* self,
                                       gboolean value);
 G_GNUC_INTERNAL void granite_widgets_tab_set_is_current_tab (GraniteWidgetsTab* self,
                                             gboolean value);
static GObject * granite_widgets_tab_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static void _granite_widgets_tab___lambda42_ (GraniteWidgetsTab* self);
static void __granite_widgets_tab___lambda42__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                               gpointer self);
static void _granite_widgets_tab___lambda43_ (GraniteWidgetsTab* self);
static void __granite_widgets_tab___lambda43__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                               gpointer self);
static void _granite_widgets_tab___lambda44_ (GraniteWidgetsTab* self);
static void __granite_widgets_tab___lambda44__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                               gpointer self);
static void _granite_widgets_tab___lambda45_ (GraniteWidgetsTab* self);
static void __granite_widgets_tab___lambda45__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                               gpointer self);
static void _granite_widgets_tab___lambda46_ (GraniteWidgetsTab* self);
static void __granite_widgets_tab___lambda46__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                               gpointer self);
static void _granite_widgets_tab___lambda47_ (GraniteWidgetsTab* self);
static void __granite_widgets_tab___lambda47__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                               gpointer self);
static gboolean _granite_widgets_tab___lambda48_ (GraniteWidgetsTab* self,
                                           GdkEventScroll* e);
static gboolean __granite_widgets_tab___lambda48__gtk_widget_scroll_event (GtkWidget* _sender,
                                                                    GdkEventScroll* event,
                                                                    gpointer self);
static gboolean _granite_widgets_tab___lambda49_ (Block3Data* _data3_,
                                           GdkEventButton* e);
static gboolean __granite_widgets_tab___lambda49__gtk_widget_button_press_event (GtkWidget* _sender,
                                                                          GdkEventButton* event,
                                                                          gpointer self);
static gboolean _granite_widgets_tab___lambda50_ (GraniteWidgetsTab* self,
                                           GdkEventButton* e);
 G_GNUC_INTERNAL void granite_widgets_dynamic_notebook_close_tab_and_keep_width (GraniteWidgetsDynamicNotebook* self,
                                                                GraniteWidgetsTab* clicked_tab);
static gboolean __granite_widgets_tab___lambda50__gtk_widget_button_release_event (GtkWidget* _sender,
                                                                            GdkEventButton* event,
                                                                            gpointer self);
static gboolean _granite_widgets_tab___lambda51_ (GraniteWidgetsTab* self,
                                           GdkEventCrossing* e);
static gboolean __granite_widgets_tab___lambda51__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                                                          GdkEventCrossing* event,
                                                                          gpointer self);
static gboolean _granite_widgets_tab___lambda52_ (GraniteWidgetsTab* self,
                                           GdkEventCrossing* e);
static gboolean __granite_widgets_tab___lambda52__gtk_widget_leave_notify_event (GtkWidget* _sender,
                                                                          GdkEventCrossing* event,
                                                                          gpointer self);
static gboolean _granite_widgets_tab___lambda53_ (GraniteWidgetsTab* self,
                                           GdkEventCrossing* e);
static gboolean __granite_widgets_tab___lambda53__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                                                          GdkEventCrossing* event,
                                                                          gpointer self);
static gboolean _granite_widgets_tab___lambda54_ (GraniteWidgetsTab* self,
                                           GdkEventCrossing* e);
static gboolean __granite_widgets_tab___lambda54__gtk_widget_leave_notify_event (GtkWidget* _sender,
                                                                          GdkEventCrossing* event,
                                                                          gpointer self);
static gboolean _granite_widgets_tab___lambda55_ (GraniteWidgetsTab* self);
static gboolean __granite_widgets_tab___lambda55__gtk_widget_button_press_event (GtkWidget* _sender,
                                                                          GdkEventButton* event,
                                                                          gpointer self);
static void _granite_widgets_tab___lambda56_ (GraniteWidgetsTab* self);
static void __granite_widgets_tab___lambda56__gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self);
 G_GNUC_INTERNAL void granite_init (void);
static void granite_widgets_tab_finalize (GObject * obj);
static GType granite_widgets_tab_get_type_once (void);
static void _vala_granite_widgets_tab_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_granite_widgets_tab_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
 G_GNUC_INTERNAL GType granite_widgets_closed_tabs_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
 G_GNUC_INTERNAL GType granite_widgets_closed_tabs_entry_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
 G_GNUC_INTERNAL GraniteWidgetsClosedTabsEntry* granite_widgets_closed_tabs_entry_dup (const GraniteWidgetsClosedTabsEntry* self);
 G_GNUC_INTERNAL void granite_widgets_closed_tabs_entry_free (GraniteWidgetsClosedTabsEntry* self);
 G_GNUC_INTERNAL void granite_widgets_closed_tabs_entry_copy (const GraniteWidgetsClosedTabsEntry* self,
                                             GraniteWidgetsClosedTabsEntry* dest);
 G_GNUC_INTERNAL void granite_widgets_closed_tabs_entry_destroy (GraniteWidgetsClosedTabsEntry* self);
static void g_cclosure_user_marshal_VOID__STRING_STRING_OBJECT (GClosure * closure,
                                                         GValue * return_value,
                                                         guint n_param_values,
                                                         const GValue * param_values,
                                                         gpointer invocation_hint,
                                                         gpointer marshal_data);
 G_GNUC_INTERNAL gint granite_widgets_closed_tabs_get_max_restorable_tabs (GraniteWidgetsClosedTabs* self);
 G_GNUC_INTERNAL void granite_widgets_closed_tabs_set_max_restorable_tabs (GraniteWidgetsClosedTabs* self,
                                                          gint value);
 G_GNUC_INTERNAL GraniteWidgetsClosedTabs* granite_widgets_closed_tabs_new (void);
 G_GNUC_INTERNAL GraniteWidgetsClosedTabs* granite_widgets_closed_tabs_construct (GType object_type);
 G_GNUC_INTERNAL gboolean granite_widgets_closed_tabs_get_empty (GraniteWidgetsClosedTabs* self);
 G_GNUC_INTERNAL void granite_widgets_closed_tabs_push (GraniteWidgetsClosedTabs* self,
                                       GraniteWidgetsTab* tab);
 G_GNUC_INTERNAL void granite_widgets_closed_tabs_pop (GraniteWidgetsClosedTabs* self,
                                      GraniteWidgetsClosedTabsEntry* result);
 G_GNUC_INTERNAL void granite_widgets_closed_tabs_pick (GraniteWidgetsClosedTabs* self,
                                       const gchar* search,
                                       GraniteWidgetsClosedTabsEntry* result);
 G_GNUC_INTERNAL GtkMenu* granite_widgets_closed_tabs_get_menu (GraniteWidgetsClosedTabs* self);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static void _granite_widgets_closed_tabs_menu_____lambda22_ (Block4Data* _data4_);
static void __granite_widgets_closed_tabs_menu_____lambda22__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                                              gpointer self);
static void _granite_widgets_closed_tabs_menu____lambda23_ (GraniteWidgetsClosedTabs* self);
static void __granite_widgets_closed_tabs_menu____lambda23__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                                             gpointer self);
static GObject * granite_widgets_closed_tabs_constructor (GType type,
                                                   guint n_construct_properties,
                                                   GObjectConstructParam * construct_properties);
static void granite_widgets_closed_tabs_finalize (GObject * obj);
static GType granite_widgets_closed_tabs_get_type_once (void);
static void _vala_granite_widgets_closed_tabs_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec);
static void _vala_granite_widgets_closed_tabs_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
static void _granite_widgets_dynamic_notebook_tabs_closable____lambda28_ (Block5Data* _data5_,
                                                                   GraniteWidgetsTab* t);
static void __granite_widgets_dynamic_notebook_tabs_closable____lambda28__gfunc (gconstpointer data,
                                                                          gpointer self);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static void _granite_widgets_dynamic_notebook_allow_drag___lambda26_ (Block6Data* _data6_,
                                                               GraniteWidgetsTab* t);
static void __granite_widgets_dynamic_notebook_allow_drag___lambda26__gfunc (gconstpointer data,
                                                                      gpointer self);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static void _granite_widgets_dynamic_notebook_allow_new_window___lambda27_ (Block7Data* _data7_,
                                                                     GraniteWidgetsTab* t);
static void __granite_widgets_dynamic_notebook_allow_new_window___lambda27__gfunc (gconstpointer data,
                                                                            gpointer self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void granite_widgets_dynamic_notebook_update_tabs_visibility (GraniteWidgetsDynamicNotebook* self);
static void granite_widgets_dynamic_notebook_set_menu (GraniteWidgetsDynamicNotebook* self,
                                                GtkMenu* value);
static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_INT (GClosure * closure,
                                               GValue * return_value,
                                               guint n_param_values,
                                               const GValue * param_values,
                                               gpointer invocation_hint,
                                               gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_INT_INT (GClosure * closure,
                                                   GValue * return_value,
                                                   guint n_param_values,
                                                   const GValue * param_values,
                                                   gpointer invocation_hint,
                                                   gpointer marshal_data);
static void g_cclosure_user_marshal_BOOLEAN__OBJECT (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data);
static void granite_widgets_dynamic_notebook_on_switch_page (GraniteWidgetsDynamicNotebook* self,
                                                      GtkWidget* page,
                                                      guint pagenum);
static void granite_widgets_dynamic_notebook_on_page_added (GraniteWidgetsDynamicNotebook* self,
                                                     GtkWidget* page,
                                                     guint pagenum);
static void granite_widgets_dynamic_notebook_insert_callbacks (GraniteWidgetsDynamicNotebook* self,
                                                        GraniteWidgetsTab* tab);
static void granite_widgets_dynamic_notebook_on_page_removed (GraniteWidgetsDynamicNotebook* self,
                                                       GtkWidget* page,
                                                       guint pagenum);
static void granite_widgets_dynamic_notebook_remove_callbacks (GraniteWidgetsDynamicNotebook* self,
                                                        GraniteWidgetsTab* tab);
static void granite_widgets_dynamic_notebook_on_page_reordered (GraniteWidgetsDynamicNotebook* self,
                                                         GtkWidget* page,
                                                         guint pagenum);
static void granite_widgets_dynamic_notebook_recalc_order (GraniteWidgetsDynamicNotebook* self);
static GtkNotebook* granite_widgets_dynamic_notebook_on_create_window (GraniteWidgetsDynamicNotebook* self,
                                                                GtkWidget* page,
                                                                gint x,
                                                                gint y);
static void granite_widgets_dynamic_notebook_recalc_size (GraniteWidgetsDynamicNotebook* self);
static void granite_widgets_dynamic_notebook_restore_last_tab (GraniteWidgetsDynamicNotebook* self);
static void granite_widgets_dynamic_notebook_switch_pin_tab (GraniteWidgetsDynamicNotebook* self,
                                                      GraniteWidgetsTab* tab);
static void granite_widgets_dynamic_notebook_real_show (GtkWidget* base);
static void granite_widgets_dynamic_notebook_on_tab_closed (GraniteWidgetsDynamicNotebook* self,
                                                     GraniteWidgetsTab* tab);
static void _granite_widgets_dynamic_notebook_on_tab_closed_granite_widgets_tab_closed (GraniteWidgetsTab* _sender,
                                                                                 gpointer self);
static void granite_widgets_dynamic_notebook_on_close_others (GraniteWidgetsDynamicNotebook* self,
                                                       GraniteWidgetsTab* clicked_tab);
static void _granite_widgets_dynamic_notebook_on_close_others_granite_widgets_tab_close_others (GraniteWidgetsTab* _sender,
                                                                                         gpointer self);
static void granite_widgets_dynamic_notebook_on_close_others_right (GraniteWidgetsDynamicNotebook* self,
                                                             GraniteWidgetsTab* clicked_tab);
static void _granite_widgets_dynamic_notebook_on_close_others_right_granite_widgets_tab_close_others_right (GraniteWidgetsTab* _sender,
                                                                                                     gpointer self);
static void granite_widgets_dynamic_notebook_on_new_window (GraniteWidgetsDynamicNotebook* self,
                                                     GraniteWidgetsTab* tab);
static void _granite_widgets_dynamic_notebook_on_new_window_granite_widgets_tab_new_window (GraniteWidgetsTab* _sender,
                                                                                     gpointer self);
static void granite_widgets_dynamic_notebook_on_duplicate (GraniteWidgetsDynamicNotebook* self,
                                                    GraniteWidgetsTab* tab);
static void _granite_widgets_dynamic_notebook_on_duplicate_granite_widgets_tab_duplicate (GraniteWidgetsTab* _sender,
                                                                                   gpointer self);
static void granite_widgets_dynamic_notebook_on_pin_switch (GraniteWidgetsDynamicNotebook* self,
                                                     GraniteWidgetsTab* tab);
static void _granite_widgets_dynamic_notebook_on_pin_switch_granite_widgets_tab_pin_switch (GraniteWidgetsTab* _sender,
                                                                                     gpointer self);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
static void __lambda24_ (Block8Data* _data8_,
                  GraniteWidgetsTab* tab);
static void ___lambda24__gfunc (gconstpointer data,
                         gpointer self);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static void __lambda25_ (Block9Data* _data9_,
                  GraniteWidgetsTab* tab);
static void ___lambda25__gfunc (gconstpointer data,
                         gpointer self);
static GObject * granite_widgets_dynamic_notebook_constructor (GType type,
                                                        guint n_construct_properties,
                                                        GObjectConstructParam * construct_properties);
static void _granite_widgets_dynamic_notebook___lambda29_ (GraniteWidgetsDynamicNotebook* self);
static void __granite_widgets_dynamic_notebook___lambda29__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                                            gpointer self);
static void _granite_widgets_dynamic_notebook___lambda30_ (GraniteWidgetsDynamicNotebook* self);
static void __granite_widgets_dynamic_notebook___lambda30__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                                            gpointer self);
static void _granite_widgets_dynamic_notebook___lambda31_ (GraniteWidgetsDynamicNotebook* self,
                                                    const gchar* label,
                                                    const gchar* restore_data,
                                                    GIcon* icon);
static void __granite_widgets_dynamic_notebook___lambda31__granite_widgets_closed_tabs_restored (GraniteWidgetsClosedTabs* _sender,
                                                                                          const gchar* label,
                                                                                          const gchar* restore_data,
                                                                                          GIcon* icon,
                                                                                          gpointer self);
static void _granite_widgets_dynamic_notebook___lambda32_ (GraniteWidgetsDynamicNotebook* self);
static void __granite_widgets_dynamic_notebook___lambda32__granite_widgets_closed_tabs_cleared (GraniteWidgetsClosedTabs* _sender,
                                                                                         gpointer self);
static gboolean _granite_widgets_dynamic_notebook___lambda33_ (GraniteWidgetsDynamicNotebook* self,
                                                        GdkEventCrossing* e);
static gboolean __granite_widgets_dynamic_notebook___lambda33__gtk_widget_leave_notify_event (GtkWidget* _sender,
                                                                                       GdkEventCrossing* event,
                                                                                       gpointer self);
static gboolean _granite_widgets_dynamic_notebook___lambda34_ (GraniteWidgetsDynamicNotebook* self);
static gboolean __granite_widgets_dynamic_notebook___lambda34__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                                                                       GdkEventCrossing* event,
                                                                                       gpointer self);
static void _granite_widgets_dynamic_notebook___lambda35_ (GraniteWidgetsDynamicNotebook* self);
static void __granite_widgets_dynamic_notebook___lambda35__gtk_button_clicked (GtkButton* _sender,
                                                                        gpointer self);
static gboolean _granite_widgets_dynamic_notebook___lambda36_ (GraniteWidgetsDynamicNotebook* self,
                                                        GdkEventButton* e);
static gboolean __granite_widgets_dynamic_notebook___lambda36__gtk_widget_button_press_event (GtkWidget* _sender,
                                                                                       GdkEventButton* event,
                                                                                       gpointer self);
static void _granite_widgets_dynamic_notebook___lambda37_ (GraniteWidgetsDynamicNotebook* self);
static void __granite_widgets_dynamic_notebook___lambda37__gtk_button_clicked (GtkButton* _sender,
                                                                        gpointer self);
static void _granite_widgets_dynamic_notebook___lambda38_ (GraniteWidgetsDynamicNotebook* self);
static void __granite_widgets_dynamic_notebook___lambda38__gtk_widget_size_allocate (GtkWidget* _sender,
                                                                              GtkAllocation* allocation,
                                                                              gpointer self);
static gboolean _granite_widgets_dynamic_notebook___lambda39_ (GraniteWidgetsDynamicNotebook* self,
                                                        GdkEventButton* e);
static gboolean __granite_widgets_dynamic_notebook___lambda39__gtk_widget_button_press_event (GtkWidget* _sender,
                                                                                       GdkEventButton* event,
                                                                                       gpointer self);
static gboolean _granite_widgets_dynamic_notebook___lambda40_ (GraniteWidgetsDynamicNotebook* self,
                                                        GdkEventKey* e);
static gboolean __granite_widgets_dynamic_notebook___lambda40__gtk_widget_key_press_event (GtkWidget* _sender,
                                                                                    GdkEventKey* event,
                                                                                    gpointer self);
static void _granite_widgets_dynamic_notebook___lambda41_ (GraniteWidgetsDynamicNotebook* self);
static void _granite_widgets_dynamic_notebook_on_switch_page_gtk_notebook_switch_page (GtkNotebook* _sender,
                                                                                GtkWidget* page,
                                                                                guint page_num,
                                                                                gpointer self);
static void _granite_widgets_dynamic_notebook_on_page_added_gtk_notebook_page_added (GtkNotebook* _sender,
                                                                              GtkWidget* child,
                                                                              guint page_num,
                                                                              gpointer self);
static void _granite_widgets_dynamic_notebook_on_page_removed_gtk_notebook_page_removed (GtkNotebook* _sender,
                                                                                  GtkWidget* child,
                                                                                  guint page_num,
                                                                                  gpointer self);
static void _granite_widgets_dynamic_notebook_on_page_reordered_gtk_notebook_page_reordered (GtkNotebook* _sender,
                                                                                      GtkWidget* child,
                                                                                      guint page_num,
                                                                                      gpointer self);
static GtkNotebook* _granite_widgets_dynamic_notebook_on_create_window_gtk_notebook_create_window (GtkNotebook* _sender,
                                                                                            GtkWidget* page,
                                                                                            gint x,
                                                                                            gint y,
                                                                                            gpointer self);
static void __granite_widgets_dynamic_notebook___lambda41__gtk_widget_destroy (GtkWidget* _sender,
                                                                        gpointer self);
static void granite_widgets_dynamic_notebook_finalize (GObject * obj);
static GType granite_widgets_dynamic_notebook_get_type_once (void);
static void _vala_granite_widgets_dynamic_notebook_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec);
static void _vala_granite_widgets_dynamic_notebook_set_property (GObject * object,
                                                          guint property_id,
                                                          const GValue * value,
                                                          GParamSpec * pspec);

static inline gpointer
granite_widgets_tab_page_container_get_instance_private (GraniteWidgetsTabPageContainer* self)
{
	return G_STRUCT_MEMBER_P (self, GraniteWidgetsTabPageContainer_private_offset);
}

 G_GNUC_INTERNAL GraniteWidgetsTab*
granite_widgets_tab_page_container_get_tab (GraniteWidgetsTabPageContainer* self)
{
	GraniteWidgetsTab* result;
	GraniteWidgetsTab* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_tab;
	result = _tmp0_;
	return result;
}

 G_GNUC_INTERNAL void
granite_widgets_tab_page_container_set_tab (GraniteWidgetsTabPageContainer* self,
                                            GraniteWidgetsTab* value)
{
	g_return_if_fail (self != NULL);
	self->priv->_tab = value;
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_page_container_properties[GRANITE_WIDGETS_TAB_PAGE_CONTAINER_TAB_PROPERTY]);
}

static GraniteWidgetsDynamicNotebook*
granite_widgets_tab_page_container_get_dynamic_notebook (GraniteWidgetsTabPageContainer* self)
{
	GraniteWidgetsDynamicNotebook* result;
	GtkContainer* _tmp0_;
	GtkContainer* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_widget_get_parent ((GtkWidget*) self);
	_tmp1_ = gtk_widget_get_parent ((GtkWidget*) (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_notebook_get_type ()) ? ((GtkNotebook*) _tmp0_) : NULL));
	result = GRANITE_WIDGETS_IS_DYNAMIC_NOTEBOOK (_tmp1_) ? ((GraniteWidgetsDynamicNotebook*) _tmp1_) : NULL;
	return result;
}

 G_GNUC_INTERNAL GraniteWidgetsTabPageContainer*
granite_widgets_tab_page_container_construct (GType object_type,
                                              GraniteWidgetsTab* tab)
{
	GraniteWidgetsTabPageContainer * self = NULL;
	g_return_val_if_fail (tab != NULL, NULL);
	self = (GraniteWidgetsTabPageContainer*) g_object_new (object_type, "tab", tab, NULL);
	return self;
}

 G_GNUC_INTERNAL GraniteWidgetsTabPageContainer*
granite_widgets_tab_page_container_new (GraniteWidgetsTab* tab)
{
	return granite_widgets_tab_page_container_construct (GRANITE_WIDGETS_TYPE_TAB_PAGE_CONTAINER, tab);
}

static gboolean
_granite_widgets_tab_page_container___lambda57_ (GraniteWidgetsTabPageContainer* self,
                                                 GdkEventCrossing* e)
{
	GraniteWidgetsDynamicNotebook* _tmp0_;
	GraniteWidgetsDynamicNotebook* _tmp1_;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = granite_widgets_tab_page_container_get_dynamic_notebook (self);
	_tmp1_ = _tmp0_;
	granite_widgets_dynamic_notebook_check_to_recalc_size (_tmp1_);
	result = FALSE;
	return result;
}

static gboolean
__granite_widgets_tab_page_container___lambda57__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                                                                GdkEventCrossing* event,
                                                                                gpointer self)
{
	gboolean result;
	result = _granite_widgets_tab_page_container___lambda57_ ((GraniteWidgetsTabPageContainer*) self, event);
	return result;
}

static GObject *
granite_widgets_tab_page_container_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GraniteWidgetsTabPageContainer * self;
	GtkGrid* _tmp0_;
	GtkGrid* _tmp1_;
	parent_class = G_OBJECT_CLASS (granite_widgets_tab_page_container_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_WIDGETS_TYPE_TAB_PAGE_CONTAINER, GraniteWidgetsTabPageContainer);
	_tmp0_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp1_);
	_g_object_unref0 (_tmp1_);
	g_signal_connect_object ((GtkWidget*) self, "enter-notify-event", (GCallback) __granite_widgets_tab_page_container___lambda57__gtk_widget_enter_notify_event, self, 0);
	return obj;
}

static void
granite_widgets_tab_page_container_class_init (GraniteWidgetsTabPageContainerClass * klass,
                                               gpointer klass_data)
{
	granite_widgets_tab_page_container_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraniteWidgetsTabPageContainer_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_granite_widgets_tab_page_container_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_granite_widgets_tab_page_container_set_property;
	G_OBJECT_CLASS (klass)->constructor = granite_widgets_tab_page_container_constructor;
	G_OBJECT_CLASS (klass)->finalize = granite_widgets_tab_page_container_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_PAGE_CONTAINER_TAB_PROPERTY, granite_widgets_tab_page_container_properties[GRANITE_WIDGETS_TAB_PAGE_CONTAINER_TAB_PROPERTY] = g_param_spec_object ("tab", "tab", "tab", GRANITE_WIDGETS_TYPE_TAB, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
granite_widgets_tab_page_container_instance_init (GraniteWidgetsTabPageContainer * self,
                                                  gpointer klass)
{
	self->priv = granite_widgets_tab_page_container_get_instance_private (self);
	self->priv->_tab = NULL;
}

static void
granite_widgets_tab_page_container_finalize (GObject * obj)
{
	GraniteWidgetsTabPageContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_WIDGETS_TYPE_TAB_PAGE_CONTAINER, GraniteWidgetsTabPageContainer);
	G_OBJECT_CLASS (granite_widgets_tab_page_container_parent_class)->finalize (obj);
}

static GType
granite_widgets_tab_page_container_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraniteWidgetsTabPageContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) granite_widgets_tab_page_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraniteWidgetsTabPageContainer), 0, (GInstanceInitFunc) granite_widgets_tab_page_container_instance_init, NULL };
	GType granite_widgets_tab_page_container_type_id;
	granite_widgets_tab_page_container_type_id = g_type_register_static (gtk_event_box_get_type (), "GraniteWidgetsTabPageContainer", &g_define_type_info, 0);
	GraniteWidgetsTabPageContainer_private_offset = g_type_add_instance_private (granite_widgets_tab_page_container_type_id, sizeof (GraniteWidgetsTabPageContainerPrivate));
	return granite_widgets_tab_page_container_type_id;
}

 G_GNUC_INTERNAL GType
granite_widgets_tab_page_container_get_type (void)
{
	static volatile gsize granite_widgets_tab_page_container_type_id__once = 0;
	if (g_once_init_enter (&granite_widgets_tab_page_container_type_id__once)) {
		GType granite_widgets_tab_page_container_type_id;
		granite_widgets_tab_page_container_type_id = granite_widgets_tab_page_container_get_type_once ();
		g_once_init_leave (&granite_widgets_tab_page_container_type_id__once, granite_widgets_tab_page_container_type_id);
	}
	return granite_widgets_tab_page_container_type_id__once;
}

static void
_vala_granite_widgets_tab_page_container_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	GraniteWidgetsTabPageContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRANITE_WIDGETS_TYPE_TAB_PAGE_CONTAINER, GraniteWidgetsTabPageContainer);
	switch (property_id) {
		case GRANITE_WIDGETS_TAB_PAGE_CONTAINER_TAB_PROPERTY:
		g_value_set_object (value, granite_widgets_tab_page_container_get_tab (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_granite_widgets_tab_page_container_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec)
{
	GraniteWidgetsTabPageContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRANITE_WIDGETS_TYPE_TAB_PAGE_CONTAINER, GraniteWidgetsTabPageContainer);
	switch (property_id) {
		case GRANITE_WIDGETS_TAB_PAGE_CONTAINER_TAB_PROPERTY:
		granite_widgets_tab_page_container_set_tab (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
granite_widgets_tab_get_instance_private (GraniteWidgetsTab* self)
{
	return G_STRUCT_MEMBER_P (self, GraniteWidgetsTab_private_offset);
}

const gchar*
granite_widgets_tab_get_label (GraniteWidgetsTab* self)
{
	const gchar* result;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_label;
	_tmp1_ = gtk_label_get_label (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
granite_widgets_tab_set_label (GraniteWidgetsTab* self,
                               const gchar* value)
{
	GtkLabel* _tmp0_;
	GtkLabel* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_label;
	gtk_label_set_label (_tmp0_, value);
	_tmp1_ = self->priv->_label;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp1_, value);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_LABEL_PROPERTY]);
}

void
granite_widgets_tab_set_tooltip (GraniteWidgetsTab* self,
                                 const gchar* value)
{
	GtkLabel* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_label;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_TOOLTIP_PROPERTY]);
}

gboolean
granite_widgets_tab_get_pinned (GraniteWidgetsTab* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_pinned;
	return result;
}

void
granite_widgets_tab_set_pinned (GraniteWidgetsTab* self,
                                gboolean value)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = granite_widgets_tab_get_pinnable (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		if (value != self->priv->_pinned) {
			if (value) {
				GtkLabel* _tmp2_;
				GtkImage* _tmp3_;
				GtkSpinner* _tmp4_;
				_tmp2_ = self->priv->_label;
				gtk_widget_set_visible ((GtkWidget*) _tmp2_, FALSE);
				_tmp3_ = self->_icon;
				gtk_widget_set_margin_start ((GtkWidget*) _tmp3_, 1);
				_tmp4_ = self->priv->_working;
				gtk_widget_set_margin_start ((GtkWidget*) _tmp4_, 1);
			} else {
				GtkLabel* _tmp5_;
				GtkImage* _tmp6_;
				GtkSpinner* _tmp7_;
				_tmp5_ = self->priv->_label;
				gtk_widget_set_visible ((GtkWidget*) _tmp5_, TRUE);
				_tmp6_ = self->_icon;
				gtk_widget_set_margin_start ((GtkWidget*) _tmp6_, 0);
				_tmp7_ = self->priv->_working;
				gtk_widget_set_margin_start ((GtkWidget*) _tmp7_, 0);
			}
			self->priv->_pinned = value;
			granite_widgets_tab_update_close_button_visibility (self);
			g_signal_emit (self, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_PIN_SWITCH_SIGNAL], 0);
		}
	}
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_PINNED_PROPERTY]);
}

gboolean
granite_widgets_tab_get_pinnable (GraniteWidgetsTab* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_pinnable;
	return result;
}

void
granite_widgets_tab_set_pinnable (GraniteWidgetsTab* self,
                                  gboolean value)
{
	g_return_if_fail (self != NULL);
	if (!value) {
		granite_widgets_tab_set_pinned (self, FALSE);
	}
	self->priv->_pinnable = value;
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_PINNABLE_PROPERTY]);
}

const gchar*
granite_widgets_tab_get_restore_data (GraniteWidgetsTab* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_restore_data;
	result = _tmp0_;
	return result;
}

void
granite_widgets_tab_set_restore_data (GraniteWidgetsTab* self,
                                      const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_widgets_tab_get_restore_data (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_restore_data);
		self->priv->_restore_data = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_RESTORE_DATA_PROPERTY]);
	}
}

GraniteAccelLabel*
granite_widgets_tab_get_close_tab_label (GraniteWidgetsTab* self)
{
	GraniteAccelLabel* result;
	GraniteAccelLabel* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_close_tab_label;
	result = _tmp0_;
	return result;
}

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

static void
granite_widgets_tab_set_close_tab_label (GraniteWidgetsTab* self,
                                         GraniteAccelLabel* value)
{
	GraniteAccelLabel* old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_widgets_tab_get_close_tab_label (self);
	if (old_value != value) {
		GraniteAccelLabel* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_close_tab_label);
		self->priv->_close_tab_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_CLOSE_TAB_LABEL_PROPERTY]);
	}
}

GraniteAccelLabel*
granite_widgets_tab_get_duplicate_tab_label (GraniteWidgetsTab* self)
{
	GraniteAccelLabel* result;
	GraniteAccelLabel* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_duplicate_tab_label;
	result = _tmp0_;
	return result;
}

static void
granite_widgets_tab_set_duplicate_tab_label (GraniteWidgetsTab* self,
                                             GraniteAccelLabel* value)
{
	GraniteAccelLabel* old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_widgets_tab_get_duplicate_tab_label (self);
	if (old_value != value) {
		GraniteAccelLabel* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_duplicate_tab_label);
		self->priv->_duplicate_tab_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_DUPLICATE_TAB_LABEL_PROPERTY]);
	}
}

GraniteAccelLabel*
granite_widgets_tab_get_new_window_label (GraniteWidgetsTab* self)
{
	GraniteAccelLabel* result;
	GraniteAccelLabel* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_new_window_label;
	result = _tmp0_;
	return result;
}

static void
granite_widgets_tab_set_new_window_label (GraniteWidgetsTab* self,
                                          GraniteAccelLabel* value)
{
	GraniteAccelLabel* old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_widgets_tab_get_new_window_label (self);
	if (old_value != value) {
		GraniteAccelLabel* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_new_window_label);
		self->priv->_new_window_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_NEW_WINDOW_LABEL_PROPERTY]);
	}
}

GtkWidget*
granite_widgets_tab_get_page (GraniteWidgetsTab* self)
{
	GtkWidget* result;
	GraniteWidgetsTabPageContainer* _tmp0_;
	GtkWidget* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->page_container;
	_tmp1_ = gtk_bin_get_child ((GtkBin*) _tmp0_);
	result = _tmp1_;
	return result;
}

void
granite_widgets_tab_set_page (GraniteWidgetsTab* self,
                              GtkWidget* value)
{
	GtkWidget* container_child = NULL;
	GraniteWidgetsTabPageContainer* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkContainer* value_parent = NULL;
	GtkContainer* _tmp5_;
	GtkContainer* _tmp6_;
	GraniteWidgetsTabPageContainer* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->page_container;
	_tmp1_ = gtk_bin_get_child ((GtkBin*) _tmp0_);
	container_child = _tmp1_;
	_tmp2_ = container_child;
	if (_tmp2_ != NULL) {
		GraniteWidgetsTabPageContainer* _tmp3_;
		GtkWidget* _tmp4_;
		_tmp3_ = self->page_container;
		_tmp4_ = container_child;
		gtk_container_remove ((GtkContainer*) _tmp3_, _tmp4_);
	}
	_tmp5_ = gtk_widget_get_parent (value);
	value_parent = _tmp5_;
	_tmp6_ = value_parent;
	if (_tmp6_ != NULL) {
		GtkContainer* _tmp7_;
		GraniteWidgetsTabPageContainer* _tmp8_;
		_tmp7_ = value_parent;
		gtk_container_remove (_tmp7_, value);
		_tmp8_ = self->page_container;
		gtk_container_add ((GtkContainer*) _tmp8_, value);
	} else {
		GraniteWidgetsTabPageContainer* _tmp9_;
		_tmp9_ = self->page_container;
		gtk_container_add ((GtkContainer*) _tmp9_, value);
	}
	_tmp10_ = self->page_container;
	gtk_widget_show_all ((GtkWidget*) _tmp10_);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_PAGE_PROPERTY]);
}

static GraniteWidgetsDynamicNotebook*
granite_widgets_tab_get_dynamic_notebook (GraniteWidgetsTab* self)
{
	GraniteWidgetsDynamicNotebook* result;
	GtkContainer* _tmp0_;
	GtkContainer* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_widget_get_parent ((GtkWidget*) self);
	_tmp1_ = gtk_widget_get_parent ((GtkWidget*) (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_notebook_get_type ()) ? ((GtkNotebook*) _tmp0_) : NULL));
	result = GRANITE_WIDGETS_IS_DYNAMIC_NOTEBOOK (_tmp1_) ? ((GraniteWidgetsDynamicNotebook*) _tmp1_) : NULL;
	return result;
}

GIcon*
granite_widgets_tab_get_icon (GraniteWidgetsTab* self)
{
	GIcon* result;
	GtkImage* _tmp0_;
	GIcon* _tmp1_;
	GIcon* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->_icon;
	g_object_get (_tmp0_, "gicon", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
granite_widgets_tab_set_icon (GraniteWidgetsTab* self,
                              GIcon* value)
{
	GtkImage* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->_icon;
	g_object_set (_tmp0_, "gicon", value, NULL);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_ICON_PROPERTY]);
}

gboolean
granite_widgets_tab_get_working (GraniteWidgetsTab* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->__working;
	return result;
}

void
granite_widgets_tab_set_working (GraniteWidgetsTab* self,
                                 gboolean value)
{
	GtkSpinner* _tmp0_;
	GtkImage* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_working;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, value);
	self->priv->__working = value;
	_tmp1_ = self->_icon;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, !value);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_WORKING_PROPERTY]);
}

PangoEllipsizeMode
granite_widgets_tab_get_ellipsize_mode (GraniteWidgetsTab* self)
{
	PangoEllipsizeMode result;
	GtkLabel* _tmp0_;
	PangoEllipsizeMode _tmp1_;
	PangoEllipsizeMode _tmp2_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_label;
	_tmp1_ = gtk_label_get_ellipsize (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
granite_widgets_tab_set_ellipsize_mode (GraniteWidgetsTab* self,
                                        PangoEllipsizeMode value)
{
	GtkLabel* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_label;
	gtk_label_set_ellipsize (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_ELLIPSIZE_MODE_PROPERTY]);
}

GtkMenu*
granite_widgets_tab_get_menu (GraniteWidgetsTab* self)
{
	GtkMenu* result;
	GtkMenu* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_menu;
	result = _tmp0_;
	return result;
}

void
granite_widgets_tab_set_menu (GraniteWidgetsTab* self,
                              GtkMenu* value)
{
	GtkMenu* old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_widgets_tab_get_menu (self);
	if (old_value != value) {
		GtkMenu* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_menu);
		self->priv->_menu = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_MENU_PROPERTY]);
	}
}

 G_GNUC_INTERNAL void
granite_widgets_tab_set_closable (GraniteWidgetsTab* self,
                                  gboolean value)
{
	g_return_if_fail (self != NULL);
	if (value == self->priv->_closable) {
		return;
	}
	self->priv->_closable = value;
	granite_widgets_tab_update_close_button_visibility (self);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_CLOSABLE_PROPERTY]);
}

 G_GNUC_INTERNAL void
granite_widgets_tab_set_is_current_tab (GraniteWidgetsTab* self,
                                        gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_is_current_tab = value;
	granite_widgets_tab_update_close_button_visibility (self);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_IS_CURRENT_TAB_PROPERTY]);
}

/**
         * With this you can construct a Tab. It is linked to the page that is shown on focus.
         * A Tab can have a icon on the right side. You can pass null on the constructor to
         * create a tab without a icon.
         **/
GraniteWidgetsTab*
granite_widgets_tab_construct (GType object_type,
                               const gchar* label,
                               GIcon* icon,
                               GtkWidget* page)
{
	GraniteWidgetsTab * self = NULL;
	self = (GraniteWidgetsTab*) granite_widgets_tab_construct_with_accellabels (object_type, label, icon, page, NULL, NULL, NULL);
	return self;
}

GraniteWidgetsTab*
granite_widgets_tab_new (const gchar* label,
                         GIcon* icon,
                         GtkWidget* page)
{
	return granite_widgets_tab_construct (GRANITE_WIDGETS_TYPE_TAB, label, icon, page);
}

/**
         * Create a tab with accellabels.
         */
GraniteWidgetsTab*
granite_widgets_tab_construct_with_accellabels (GType object_type,
                                                const gchar* label,
                                                GIcon* icon,
                                                GtkWidget* page,
                                                GraniteAccelLabel* _close_tab_label,
                                                GraniteAccelLabel* _duplicate_tab_label,
                                                GraniteAccelLabel* _new_window_label)
{
	GraniteWidgetsTab * self = NULL;
	self = (GraniteWidgetsTab*) g_object_new (object_type, "label", label, "icon", icon, "close-tab-label", _close_tab_label, "duplicate-tab-label", _duplicate_tab_label, "new-window-label", _new_window_label, NULL);
	if (page != NULL) {
		granite_widgets_tab_set_page (self, page);
	}
	return self;
}

GraniteWidgetsTab*
granite_widgets_tab_new_with_accellabels (const gchar* label,
                                          GIcon* icon,
                                          GtkWidget* page,
                                          GraniteAccelLabel* _close_tab_label,
                                          GraniteAccelLabel* _duplicate_tab_label,
                                          GraniteAccelLabel* _new_window_label)
{
	return granite_widgets_tab_construct_with_accellabels (GRANITE_WIDGETS_TYPE_TAB, label, icon, page, _close_tab_label, _duplicate_tab_label, _new_window_label);
}

void
granite_widgets_tab_close (GraniteWidgetsTab* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_CLOSED_SIGNAL], 0);
}

static void
granite_widgets_tab_update_close_button_visibility (GraniteWidgetsTab* self)
{
	GtkRevealer* _tmp0_;
	GtkRevealer* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	GtkRevealer* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->close_button_revealer;
	gtk_widget_set_no_show_all ((GtkWidget*) _tmp0_, self->priv->_pinned);
	_tmp1_ = self->priv->close_button_revealer;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, !self->priv->_pinned);
	if (self->priv->_closable) {
		_tmp3_ = !self->priv->_pinned;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		gboolean _tmp4_ = FALSE;
		gboolean _tmp5_ = FALSE;
		if (self->priv->cursor_over_tab) {
			_tmp5_ = TRUE;
		} else {
			_tmp5_ = self->priv->cursor_over_close_button;
		}
		if (_tmp5_) {
			_tmp4_ = TRUE;
		} else {
			_tmp4_ = self->priv->_is_current_tab;
		}
		_tmp2_ = _tmp4_;
	} else {
		_tmp2_ = FALSE;
	}
	_tmp6_ = self->priv->close_button_revealer;
	gtk_revealer_set_reveal_child (_tmp6_, _tmp2_);
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		GraniteWidgetsTab* self;
		self = _data3_->self;
		_g_object_unref0 (_data3_->close_other_right_m);
		_g_object_unref0 (_data3_->close_other_m);
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static void
_granite_widgets_tab___lambda42_ (GraniteWidgetsTab* self)
{
	g_signal_emit (self, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_CLOSED_SIGNAL], 0);
}

static void
__granite_widgets_tab___lambda42__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                          gpointer self)
{
	_granite_widgets_tab___lambda42_ ((GraniteWidgetsTab*) self);
}

static void
_granite_widgets_tab___lambda43_ (GraniteWidgetsTab* self)
{
	g_signal_emit (self, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_CLOSE_OTHERS_SIGNAL], 0);
}

static void
__granite_widgets_tab___lambda43__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                          gpointer self)
{
	_granite_widgets_tab___lambda43_ ((GraniteWidgetsTab*) self);
}

static void
_granite_widgets_tab___lambda44_ (GraniteWidgetsTab* self)
{
	g_signal_emit (self, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_CLOSE_OTHERS_RIGHT_SIGNAL], 0);
}

static void
__granite_widgets_tab___lambda44__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                          gpointer self)
{
	_granite_widgets_tab___lambda44_ ((GraniteWidgetsTab*) self);
}

static void
_granite_widgets_tab___lambda45_ (GraniteWidgetsTab* self)
{
	g_signal_emit (self, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_NEW_WINDOW_SIGNAL], 0);
}

static void
__granite_widgets_tab___lambda45__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                          gpointer self)
{
	_granite_widgets_tab___lambda45_ ((GraniteWidgetsTab*) self);
}

static void
_granite_widgets_tab___lambda46_ (GraniteWidgetsTab* self)
{
	g_signal_emit (self, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_DUPLICATE_SIGNAL], 0);
}

static void
__granite_widgets_tab___lambda46__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                          gpointer self)
{
	_granite_widgets_tab___lambda46_ ((GraniteWidgetsTab*) self);
}

static void
_granite_widgets_tab___lambda47_ (GraniteWidgetsTab* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	_tmp0_ = granite_widgets_tab_get_pinned (self);
	_tmp1_ = _tmp0_;
	granite_widgets_tab_set_pinned (self, !_tmp1_);
}

static void
__granite_widgets_tab___lambda47__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                          gpointer self)
{
	_granite_widgets_tab___lambda47_ ((GraniteWidgetsTab*) self);
}

static gboolean
_granite_widgets_tab___lambda48_ (GraniteWidgetsTab* self,
                                  GdkEventScroll* e)
{
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	switch (e->direction) {
		case GDK_SCROLL_UP:
		case GDK_SCROLL_LEFT:
		{
			GraniteWidgetsDynamicNotebook* _tmp0_;
			GraniteWidgetsDynamicNotebook* _tmp1_;
			_tmp0_ = granite_widgets_tab_get_dynamic_notebook (self);
			_tmp1_ = _tmp0_;
			granite_widgets_dynamic_notebook_previous_page (_tmp1_);
			result = TRUE;
			return result;
		}
		case GDK_SCROLL_DOWN:
		case GDK_SCROLL_RIGHT:
		{
			GraniteWidgetsDynamicNotebook* _tmp2_;
			GraniteWidgetsDynamicNotebook* _tmp3_;
			_tmp2_ = granite_widgets_tab_get_dynamic_notebook (self);
			_tmp3_ = _tmp2_;
			granite_widgets_dynamic_notebook_next_page (_tmp3_);
			result = TRUE;
			return result;
		}
		default:
		break;
	}
	result = FALSE;
	return result;
}

static gboolean
__granite_widgets_tab___lambda48__gtk_widget_scroll_event (GtkWidget* _sender,
                                                           GdkEventScroll* event,
                                                           gpointer self)
{
	gboolean result;
	result = _granite_widgets_tab___lambda48_ ((GraniteWidgetsTab*) self, event);
	return result;
}

static gboolean
_granite_widgets_tab___lambda49_ (Block3Data* _data3_,
                                  GdkEventButton* e)
{
	GraniteWidgetsTab* self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean result;
	self = _data3_->self;
	g_return_val_if_fail (e != NULL, FALSE);
	if (e->button == ((guint) 1)) {
		_tmp1_ = e->type == GDK_2BUTTON_PRESS;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GtkMenuItem* _tmp2_;
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp2_ = self->duplicate_m;
		_tmp3_ = gtk_widget_get_visible ((GtkWidget*) _tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		g_signal_emit (self, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_DUPLICATE_SIGNAL], 0);
	} else {
		if (e->button == ((guint) 2)) {
			result = TRUE;
			return result;
		} else {
			if (e->button == ((guint) 3)) {
				GtkMenu* _tmp5_;
				guint num_tabs = 0U;
				GraniteWidgetsDynamicNotebook* _tmp6_;
				GraniteWidgetsDynamicNotebook* _tmp7_;
				gint _tmp8_;
				gint _tmp9_;
				guint tab_position = 0U;
				GraniteWidgetsDynamicNotebook* _tmp10_;
				GraniteWidgetsDynamicNotebook* _tmp11_;
				GtkMenuItem* _tmp12_;
				GtkMenuItem* _tmp13_;
				GtkMenuItem* _tmp14_;
				GtkMenuItem* _tmp15_;
				GtkMenuItem* _tmp16_;
				GtkMenuItem* _tmp17_;
				gboolean _tmp18_;
				gboolean _tmp19_;
				_tmp5_ = self->priv->_menu;
				gtk_menu_popup_at_pointer (_tmp5_, (GdkEvent*) e);
				_tmp6_ = granite_widgets_tab_get_dynamic_notebook (self);
				_tmp7_ = _tmp6_;
				_tmp8_ = granite_widgets_dynamic_notebook_get_n_tabs (_tmp7_);
				_tmp9_ = _tmp8_;
				num_tabs = (guint) _tmp9_;
				_tmp10_ = granite_widgets_tab_get_dynamic_notebook (self);
				_tmp11_ = _tmp10_;
				tab_position = (guint) granite_widgets_dynamic_notebook_get_tab_position (_tmp11_, self);
				_tmp12_ = _data3_->close_other_m;
				gtk_menu_item_set_label (_tmp12_, g_dngettext (GRANITE_GETTEXT_PACKAGE, _ ("Close Other Tab"), _ ("Close Other Tabs"), (gulong) (num_tabs - 1)));
				_tmp13_ = _data3_->close_other_m;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp13_, num_tabs != ((guint) 1));
				_tmp14_ = _data3_->close_other_right_m;
				gtk_menu_item_set_label (_tmp14_, g_dngettext (GRANITE_GETTEXT_PACKAGE, _ ("Close Tab to the Right"), _ ("Close Tabs to the Right"), (gulong) ((num_tabs - 1) - tab_position)));
				_tmp15_ = _data3_->close_other_right_m;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp15_, tab_position < (num_tabs - 1));
				_tmp16_ = self->new_window_m;
				gtk_widget_set_sensitive ((GtkWidget*) _tmp16_, num_tabs != ((guint) 1));
				_tmp17_ = self->pin_m;
				gtk_menu_item_set_label (_tmp17_, _ ("Pin"));
				_tmp18_ = granite_widgets_tab_get_pinned (self);
				_tmp19_ = _tmp18_;
				if (_tmp19_) {
					GtkMenuItem* _tmp20_;
					_tmp20_ = self->pin_m;
					gtk_menu_item_set_label (_tmp20_, _ ("Unpin"));
				}
			} else {
				result = FALSE;
				return result;
			}
		}
	}
	result = TRUE;
	return result;
}

static gboolean
__granite_widgets_tab___lambda49__gtk_widget_button_press_event (GtkWidget* _sender,
                                                                 GdkEventButton* event,
                                                                 gpointer self)
{
	gboolean result;
	result = _granite_widgets_tab___lambda49_ (self, event);
	return result;
}

static gboolean
_granite_widgets_tab___lambda50_ (GraniteWidgetsTab* self,
                                  GdkEventButton* e)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	if (e->button == ((guint) 2)) {
		_tmp0_ = self->priv->cursor_over_tab;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		e->state = e->state & GRANITE_WIDGETS_MODIFIER_MASK;
		if (e->state == 0) {
			GraniteWidgetsDynamicNotebook* _tmp1_;
			GraniteWidgetsDynamicNotebook* _tmp2_;
			_tmp1_ = granite_widgets_tab_get_dynamic_notebook (self);
			_tmp2_ = _tmp1_;
			granite_widgets_dynamic_notebook_close_tab_and_keep_width (_tmp2_, self);
		} else {
			if (e->state == GDK_SHIFT_MASK) {
				g_signal_emit (self, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_CLOSE_OTHERS_SIGNAL], 0);
			}
		}
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
__granite_widgets_tab___lambda50__gtk_widget_button_release_event (GtkWidget* _sender,
                                                                   GdkEventButton* event,
                                                                   gpointer self)
{
	gboolean result;
	result = _granite_widgets_tab___lambda50_ ((GraniteWidgetsTab*) self, event);
	return result;
}

static gboolean
_granite_widgets_tab___lambda51_ (GraniteWidgetsTab* self,
                                  GdkEventCrossing* e)
{
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	self->priv->cursor_over_tab = TRUE;
	granite_widgets_tab_update_close_button_visibility (self);
	result = FALSE;
	return result;
}

static gboolean
__granite_widgets_tab___lambda51__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                                                 GdkEventCrossing* event,
                                                                 gpointer self)
{
	gboolean result;
	result = _granite_widgets_tab___lambda51_ ((GraniteWidgetsTab*) self, event);
	return result;
}

static gboolean
_granite_widgets_tab___lambda52_ (GraniteWidgetsTab* self,
                                  GdkEventCrossing* e)
{
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	if (!self->priv->cursor_over_tab) {
		result = FALSE;
		return result;
	}
	self->priv->cursor_over_tab = FALSE;
	granite_widgets_tab_update_close_button_visibility (self);
	result = FALSE;
	return result;
}

static gboolean
__granite_widgets_tab___lambda52__gtk_widget_leave_notify_event (GtkWidget* _sender,
                                                                 GdkEventCrossing* event,
                                                                 gpointer self)
{
	gboolean result;
	result = _granite_widgets_tab___lambda52_ ((GraniteWidgetsTab*) self, event);
	return result;
}

static gboolean
_granite_widgets_tab___lambda53_ (GraniteWidgetsTab* self,
                                  GdkEventCrossing* e)
{
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	self->priv->cursor_over_close_button = TRUE;
	granite_widgets_tab_update_close_button_visibility (self);
	result = FALSE;
	return result;
}

static gboolean
__granite_widgets_tab___lambda53__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                                                 GdkEventCrossing* event,
                                                                 gpointer self)
{
	gboolean result;
	result = _granite_widgets_tab___lambda53_ ((GraniteWidgetsTab*) self, event);
	return result;
}

static gboolean
_granite_widgets_tab___lambda54_ (GraniteWidgetsTab* self,
                                  GdkEventCrossing* e)
{
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	if (!self->priv->cursor_over_close_button) {
		result = FALSE;
		return result;
	}
	self->priv->cursor_over_close_button = FALSE;
	granite_widgets_tab_update_close_button_visibility (self);
	result = FALSE;
	return result;
}

static gboolean
__granite_widgets_tab___lambda54__gtk_widget_leave_notify_event (GtkWidget* _sender,
                                                                 GdkEventCrossing* event,
                                                                 gpointer self)
{
	gboolean result;
	result = _granite_widgets_tab___lambda54_ ((GraniteWidgetsTab*) self, event);
	return result;
}

static gboolean
_granite_widgets_tab___lambda55_ (GraniteWidgetsTab* self)
{
	gboolean result;
	result = TRUE;
	return result;
}

static gboolean
__granite_widgets_tab___lambda55__gtk_widget_button_press_event (GtkWidget* _sender,
                                                                 GdkEventButton* event,
                                                                 gpointer self)
{
	gboolean result;
	result = _granite_widgets_tab___lambda55_ ((GraniteWidgetsTab*) self);
	return result;
}

static void
_granite_widgets_tab___lambda56_ (GraniteWidgetsTab* self)
{
	GraniteWidgetsDynamicNotebook* _tmp0_;
	GraniteWidgetsDynamicNotebook* _tmp1_;
	_tmp0_ = granite_widgets_tab_get_dynamic_notebook (self);
	_tmp1_ = _tmp0_;
	granite_widgets_dynamic_notebook_close_tab_and_keep_width (_tmp1_, self);
}

static void
__granite_widgets_tab___lambda56__gtk_button_clicked (GtkButton* _sender,
                                                      gpointer self)
{
	_granite_widgets_tab___lambda56_ ((GraniteWidgetsTab*) self);
}

static GObject *
granite_widgets_tab_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GraniteWidgetsTab * self;
	Block3Data* _data3_;
	GraniteAccelLabel* _tmp0_;
	GraniteAccelLabel* _tmp3_;
	GraniteAccelLabel* _tmp6_;
	GtkLabel* _tmp9_;
	GtkLabel* _tmp10_;
	GtkLabel* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	GtkLabel* _tmp14_;
	GtkImage* _tmp15_;
	GtkImage* _tmp16_;
	GtkImage* _tmp17_;
	GtkImage* _tmp18_;
	GtkSpinner* _tmp19_;
	GtkSpinner* _tmp20_;
	GtkSpinner* _tmp21_;
	GtkButton* close_button = NULL;
	GtkButton* _tmp22_;
	GtkButton* _tmp23_;
	GtkButton* _tmp24_;
	GtkButton* _tmp25_;
	GtkRevealer* _tmp26_ = NULL;
	GtkRevealer* _tmp27_;
	GtkButton* _tmp28_;
	GtkGrid* tab_layout = NULL;
	GtkGrid* _tmp29_;
	GtkGrid* _tmp30_;
	GtkGrid* _tmp31_;
	GtkGrid* _tmp32_;
	GtkRevealer* _tmp33_;
	GtkGrid* _tmp34_;
	GtkLabel* _tmp35_;
	GtkGrid* _tmp36_;
	GtkImage* _tmp37_;
	GtkGrid* _tmp38_;
	GtkSpinner* _tmp39_;
	GtkGrid* _tmp40_;
	GraniteWidgetsTabPageContainer* _tmp41_;
	GtkMenu* _tmp42_;
	GtkMenu* _tmp43_;
	GtkMenuItem* close_m = NULL;
	GraniteAccelLabel* _tmp44_;
	GtkWidget* _tmp45_;
	GtkMenuItem* _tmp46_ = NULL;
	GtkMenuItem* _tmp47_;
	GtkMenuItem* _tmp48_;
	GtkMenuItem* _tmp49_;
	GraniteAccelLabel* _tmp50_;
	GtkWidget* _tmp51_;
	GtkMenuItem* _tmp52_ = NULL;
	GraniteAccelLabel* _tmp53_;
	GtkWidget* _tmp54_;
	GtkMenuItem* _tmp55_ = NULL;
	GtkMenu* _tmp56_;
	GtkMenuItem* _tmp57_;
	GtkMenu* _tmp58_;
	GtkMenuItem* _tmp59_;
	GtkMenu* _tmp60_;
	GtkMenuItem* _tmp61_;
	GtkMenu* _tmp62_;
	GtkMenuItem* _tmp63_;
	GtkMenu* _tmp64_;
	GtkMenuItem* _tmp65_;
	GtkMenu* _tmp66_;
	GtkMenuItem* _tmp67_;
	GtkMenu* _tmp68_;
	GtkMenuItem* _tmp69_;
	GtkMenuItem* _tmp70_;
	GtkMenuItem* _tmp71_;
	GtkMenuItem* _tmp72_;
	GtkMenuItem* _tmp73_;
	GtkMenuItem* _tmp74_;
	GtkButton* _tmp75_;
	GtkButton* _tmp76_;
	GraniteWidgetsTabPageContainer* _tmp77_;
	GtkButton* _tmp78_;
	parent_class = G_OBJECT_CLASS (granite_widgets_tab_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_WIDGETS_TYPE_TAB, GraniteWidgetsTab);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_data3_->self = g_object_ref (self);
	_tmp0_ = self->priv->_close_tab_label;
	if (_tmp0_ == NULL) {
		GraniteAccelLabel* _tmp1_;
		GraniteAccelLabel* _tmp2_;
		_tmp1_ = granite_accel_label_new (_ ("Close Tab"), NULL);
		g_object_ref_sink (_tmp1_);
		_tmp2_ = _tmp1_;
		granite_widgets_tab_set_close_tab_label (self, _tmp2_);
		_g_object_unref0 (_tmp2_);
	}
	_tmp3_ = self->priv->_new_window_label;
	if (_tmp3_ == NULL) {
		GraniteAccelLabel* _tmp4_;
		GraniteAccelLabel* _tmp5_;
		_tmp4_ = granite_accel_label_new (_ ("Open in a New Window"), NULL);
		g_object_ref_sink (_tmp4_);
		_tmp5_ = _tmp4_;
		granite_widgets_tab_set_new_window_label (self, _tmp5_);
		_g_object_unref0 (_tmp5_);
	}
	_tmp6_ = self->priv->_duplicate_tab_label;
	if (_tmp6_ == NULL) {
		GraniteAccelLabel* _tmp7_;
		GraniteAccelLabel* _tmp8_;
		_tmp7_ = granite_accel_label_new (_ ("Duplicate"), NULL);
		g_object_ref_sink (_tmp7_);
		_tmp8_ = _tmp7_;
		granite_widgets_tab_set_duplicate_tab_label (self, _tmp8_);
		_g_object_unref0 (_tmp8_);
	}
	_tmp9_ = (GtkLabel*) gtk_label_new (NULL);
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->_label);
	self->priv->_label = _tmp9_;
	_tmp10_ = self->priv->_label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp10_, TRUE);
	_tmp11_ = self->priv->_label;
	_tmp12_ = granite_widgets_tab_get_label (self);
	_tmp13_ = _tmp12_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp11_, _tmp13_);
	_tmp14_ = self->priv->_label;
	gtk_label_set_ellipsize (_tmp14_, PANGO_ELLIPSIZE_END);
	_tmp15_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp15_);
	_g_object_unref0 (self->_icon);
	self->_icon = _tmp15_;
	_tmp16_ = self->_icon;
	g_object_set (_tmp16_, "icon-size", (gint) GTK_ICON_SIZE_MENU, NULL);
	_tmp17_ = self->_icon;
	gtk_widget_set_visible ((GtkWidget*) _tmp17_, TRUE);
	_tmp18_ = self->_icon;
	gtk_widget_set_size_request ((GtkWidget*) _tmp18_, 16, 16);
	_tmp19_ = (GtkSpinner*) gtk_spinner_new ();
	g_object_ref_sink (_tmp19_);
	_g_object_unref0 (self->priv->_working);
	self->priv->_working = _tmp19_;
	_tmp20_ = self->priv->_working;
	gtk_widget_set_size_request ((GtkWidget*) _tmp20_, 16, 16);
	_tmp21_ = self->priv->_working;
	gtk_spinner_start (_tmp21_);
	_tmp22_ = (GtkButton*) gtk_button_new_from_icon_name ("window-close-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp22_);
	close_button = _tmp22_;
	_tmp23_ = close_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp23_, _ ("Close Tab"));
	_tmp24_ = close_button;
	gtk_widget_set_valign ((GtkWidget*) _tmp24_, GTK_ALIGN_CENTER);
	_tmp25_ = close_button;
	gtk_button_set_relief (_tmp25_, GTK_RELIEF_NONE);
	_tmp26_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_duration (_tmp26_, (guint) GRANITE_TRANSITION_DURATION_IN_PLACE);
	gtk_revealer_set_transition_type (_tmp26_, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
	g_object_ref_sink (_tmp26_);
	_g_object_unref0 (self->priv->close_button_revealer);
	self->priv->close_button_revealer = _tmp26_;
	_tmp27_ = self->priv->close_button_revealer;
	_tmp28_ = close_button;
	gtk_container_add ((GtkContainer*) _tmp27_, (GtkWidget*) _tmp28_);
	_tmp29_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp29_);
	tab_layout = _tmp29_;
	_tmp30_ = tab_layout;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp30_, FALSE);
	_tmp31_ = tab_layout;
	gtk_orientable_set_orientation ((GtkOrientable*) _tmp31_, GTK_ORIENTATION_HORIZONTAL);
	_tmp32_ = tab_layout;
	_tmp33_ = self->priv->close_button_revealer;
	gtk_container_add ((GtkContainer*) _tmp32_, (GtkWidget*) _tmp33_);
	_tmp34_ = tab_layout;
	_tmp35_ = self->priv->_label;
	gtk_container_add ((GtkContainer*) _tmp34_, (GtkWidget*) _tmp35_);
	_tmp36_ = tab_layout;
	_tmp37_ = self->_icon;
	gtk_container_add ((GtkContainer*) _tmp36_, (GtkWidget*) _tmp37_);
	_tmp38_ = tab_layout;
	_tmp39_ = self->priv->_working;
	gtk_container_add ((GtkContainer*) _tmp38_, (GtkWidget*) _tmp39_);
	gtk_event_box_set_visible_window ((GtkEventBox*) self, TRUE);
	_tmp40_ = tab_layout;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp40_);
	gtk_widget_show_all ((GtkWidget*) self);
	_tmp41_ = granite_widgets_tab_page_container_new (self);
	g_object_ref_sink (_tmp41_);
	_g_object_unref0 (self->page_container);
	self->page_container = _tmp41_;
	_tmp42_ = (GtkMenu*) gtk_menu_new ();
	g_object_ref_sink (_tmp42_);
	_tmp43_ = _tmp42_;
	granite_widgets_tab_set_menu (self, _tmp43_);
	_g_object_unref0 (_tmp43_);
	_tmp44_ = self->priv->_close_tab_label;
	_tmp45_ = _g_object_ref0 ((GtkWidget*) _tmp44_);
	_tmp46_ = (GtkMenuItem*) gtk_menu_item_new ();
	g_object_set ((GtkContainer*) _tmp46_, "child", _tmp45_, NULL);
	_g_object_unref0 (_tmp45_);
	g_object_ref_sink (_tmp46_);
	close_m = _tmp46_;
	_tmp47_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("");
	g_object_ref_sink (_tmp47_);
	_data3_->close_other_m = _tmp47_;
	_tmp48_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("");
	g_object_ref_sink (_tmp48_);
	_data3_->close_other_right_m = _tmp48_;
	_tmp49_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("");
	g_object_ref_sink (_tmp49_);
	_g_object_unref0 (self->pin_m);
	self->pin_m = _tmp49_;
	_tmp50_ = self->priv->_new_window_label;
	_tmp51_ = _g_object_ref0 ((GtkWidget*) _tmp50_);
	_tmp52_ = (GtkMenuItem*) gtk_menu_item_new ();
	g_object_set ((GtkContainer*) _tmp52_, "child", _tmp51_, NULL);
	_g_object_unref0 (_tmp51_);
	g_object_ref_sink (_tmp52_);
	_g_object_unref0 (self->new_window_m);
	self->new_window_m = _tmp52_;
	_tmp53_ = self->priv->_duplicate_tab_label;
	_tmp54_ = _g_object_ref0 ((GtkWidget*) _tmp53_);
	_tmp55_ = (GtkMenuItem*) gtk_menu_item_new ();
	g_object_set ((GtkContainer*) _tmp55_, "child", _tmp54_, NULL);
	_g_object_unref0 (_tmp54_);
	g_object_ref_sink (_tmp55_);
	_g_object_unref0 (self->duplicate_m);
	self->duplicate_m = _tmp55_;
	_tmp56_ = self->priv->_menu;
	_tmp57_ = _data3_->close_other_m;
	gtk_menu_shell_append ((GtkMenuShell*) _tmp56_, _tmp57_);
	_tmp58_ = self->priv->_menu;
	_tmp59_ = _data3_->close_other_right_m;
	gtk_menu_shell_append ((GtkMenuShell*) _tmp58_, _tmp59_);
	_tmp60_ = self->priv->_menu;
	_tmp61_ = close_m;
	gtk_menu_shell_append ((GtkMenuShell*) _tmp60_, _tmp61_);
	_tmp62_ = self->priv->_menu;
	_tmp63_ = self->new_window_m;
	gtk_menu_shell_append ((GtkMenuShell*) _tmp62_, _tmp63_);
	_tmp64_ = self->priv->_menu;
	_tmp65_ = self->duplicate_m;
	gtk_menu_shell_append ((GtkMenuShell*) _tmp64_, _tmp65_);
	_tmp66_ = self->priv->_menu;
	_tmp67_ = self->pin_m;
	gtk_menu_shell_append ((GtkMenuShell*) _tmp66_, _tmp67_);
	_tmp68_ = self->priv->_menu;
	gtk_widget_show_all ((GtkWidget*) _tmp68_);
	_tmp69_ = close_m;
	g_signal_connect_object (_tmp69_, "activate", (GCallback) __granite_widgets_tab___lambda42__gtk_menu_item_activate, self, 0);
	_tmp70_ = _data3_->close_other_m;
	g_signal_connect_object (_tmp70_, "activate", (GCallback) __granite_widgets_tab___lambda43__gtk_menu_item_activate, self, 0);
	_tmp71_ = _data3_->close_other_right_m;
	g_signal_connect_object (_tmp71_, "activate", (GCallback) __granite_widgets_tab___lambda44__gtk_menu_item_activate, self, 0);
	_tmp72_ = self->new_window_m;
	g_signal_connect_object (_tmp72_, "activate", (GCallback) __granite_widgets_tab___lambda45__gtk_menu_item_activate, self, 0);
	_tmp73_ = self->duplicate_m;
	g_signal_connect_object (_tmp73_, "activate", (GCallback) __granite_widgets_tab___lambda46__gtk_menu_item_activate, self, 0);
	_tmp74_ = self->pin_m;
	g_signal_connect_object (_tmp74_, "activate", (GCallback) __granite_widgets_tab___lambda47__gtk_menu_item_activate, self, 0);
	gtk_widget_add_events ((GtkWidget*) self, (gint) GDK_SCROLL_MASK);
	g_signal_connect_object ((GtkWidget*) self, "scroll-event", (GCallback) __granite_widgets_tab___lambda48__gtk_widget_scroll_event, self, 0);
	g_signal_connect_data ((GtkWidget*) self, "button-press-event", (GCallback) __granite_widgets_tab___lambda49__gtk_widget_button_press_event, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0);
	g_signal_connect_object ((GtkWidget*) self, "button-release-event", (GCallback) __granite_widgets_tab___lambda50__gtk_widget_button_release_event, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "enter-notify-event", (GCallback) __granite_widgets_tab___lambda51__gtk_widget_enter_notify_event, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "leave-notify-event", (GCallback) __granite_widgets_tab___lambda52__gtk_widget_leave_notify_event, self, 0);
	_tmp75_ = close_button;
	g_signal_connect_object ((GtkWidget*) _tmp75_, "enter-notify-event", (GCallback) __granite_widgets_tab___lambda53__gtk_widget_enter_notify_event, self, 0);
	_tmp76_ = close_button;
	g_signal_connect_object ((GtkWidget*) _tmp76_, "leave-notify-event", (GCallback) __granite_widgets_tab___lambda54__gtk_widget_leave_notify_event, self, 0);
	_tmp77_ = self->page_container;
	g_signal_connect_object ((GtkWidget*) _tmp77_, "button-press-event", (GCallback) __granite_widgets_tab___lambda55__gtk_widget_button_press_event, self, 0);
	_tmp78_ = close_button;
	g_signal_connect_object (_tmp78_, "clicked", (GCallback) __granite_widgets_tab___lambda56__gtk_button_clicked, self, 0);
	granite_widgets_tab_set_working (self, FALSE);
	granite_widgets_tab_update_close_button_visibility (self);
	_g_object_unref0 (close_m);
	_g_object_unref0 (tab_layout);
	_g_object_unref0 (close_button);
	block3_data_unref (_data3_);
	_data3_ = NULL;
	return obj;
}

static void
granite_widgets_tab_class_init (GraniteWidgetsTabClass * klass,
                                gpointer klass_data)
{
	granite_widgets_tab_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraniteWidgetsTab_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_granite_widgets_tab_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_granite_widgets_tab_set_property;
	G_OBJECT_CLASS (klass)->constructor = granite_widgets_tab_constructor;
	G_OBJECT_CLASS (klass)->finalize = granite_widgets_tab_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_LABEL_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	         * The (plain) text that will be shown in a tooltip when the tab is hovered.
	         **/
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_TOOLTIP_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_TOOLTIP_PROPERTY] = g_param_spec_string ("tooltip", "tooltip", "tooltip", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_PINNED_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_PINNED_PROPERTY] = g_param_spec_boolean ("pinned", "pinned", "pinned", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_PINNABLE_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_PINNABLE_PROPERTY] = g_param_spec_boolean ("pinnable", "pinnable", "pinnable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	         * Data which will be kept once the tab is deleted, and which will be used by
	         * the application to restore the data into the restored tab. Let it empty if
	         * the tab should not be restored.
	         **/
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_RESTORE_DATA_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_RESTORE_DATA_PROPERTY] = g_param_spec_string ("restore-data", "restore-data", "restore-data", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	         * Accelerator label of the "Close Tab" menu item in the tab context menu.
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_CLOSE_TAB_LABEL_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_CLOSE_TAB_LABEL_PROPERTY] = g_param_spec_object ("close-tab-label", "close-tab-label", "close-tab-label", GRANITE_TYPE_ACCEL_LABEL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	/**
	         * Accelerator label of the "Duplicate Tab" menu item in the tab context menu.
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_DUPLICATE_TAB_LABEL_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_DUPLICATE_TAB_LABEL_PROPERTY] = g_param_spec_object ("duplicate-tab-label", "duplicate-tab-label", "duplicate-tab-label", GRANITE_TYPE_ACCEL_LABEL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	/**
	         * Accelerator label of "Open tab in New Window" menu item in the tab context menu.
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_NEW_WINDOW_LABEL_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_NEW_WINDOW_LABEL_PROPERTY] = g_param_spec_object ("new-window-label", "new-window-label", "new-window-label", GRANITE_TYPE_ACCEL_LABEL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_PAGE_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_PAGE_PROPERTY] = g_param_spec_object ("page", "page", "page", gtk_widget_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_ICON_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_ICON_PROPERTY] = g_param_spec_object ("icon", "icon", "icon", g_icon_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_WORKING_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_WORKING_PROPERTY] = g_param_spec_boolean ("working", "working", "working", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_ELLIPSIZE_MODE_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_ELLIPSIZE_MODE_PROPERTY] = g_param_spec_enum ("ellipsize-mode", "ellipsize-mode", "ellipsize-mode", pango_ellipsize_mode_get_type (), 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_MENU_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_MENU_PROPERTY] = g_param_spec_object ("menu", "menu", "menu", gtk_menu_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_CLOSABLE_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_CLOSABLE_PROPERTY] = g_param_spec_boolean ("closable", "closable", "closable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_TAB_IS_CURRENT_TAB_PROPERTY, granite_widgets_tab_properties[GRANITE_WIDGETS_TAB_IS_CURRENT_TAB_PROPERTY] = g_param_spec_boolean ("is-current-tab", "is-current-tab", "is-current-tab", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_CLOSED_SIGNAL] = g_signal_new ("closed", GRANITE_WIDGETS_TYPE_TAB, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_CLOSE_OTHERS_SIGNAL] = g_signal_new ("close-others", GRANITE_WIDGETS_TYPE_TAB, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_CLOSE_OTHERS_RIGHT_SIGNAL] = g_signal_new ("close-others-right", GRANITE_WIDGETS_TYPE_TAB, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_NEW_WINDOW_SIGNAL] = g_signal_new ("new-window", GRANITE_WIDGETS_TYPE_TAB, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_DUPLICATE_SIGNAL] = g_signal_new ("duplicate", GRANITE_WIDGETS_TYPE_TAB, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_PIN_SWITCH_SIGNAL] = g_signal_new ("pin-switch", GRANITE_WIDGETS_TYPE_TAB, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	granite_init ();
}

static void
granite_widgets_tab_instance_init (GraniteWidgetsTab * self,
                                   gpointer klass)
{
	gchar* _tmp0_;
	self->priv = granite_widgets_tab_get_instance_private (self);
	self->priv->_pinned = FALSE;
	self->priv->_pinnable = TRUE;
	_tmp0_ = g_strdup ("");
	self->priv->_restore_data = _tmp0_;
	self->dropped_callback = NULL;
	self->dropped_callback_target = NULL;
	self->dropped_callback_target_destroy_notify = NULL;
	self->priv->_closable = TRUE;
	self->priv->_is_current_tab = FALSE;
	self->priv->cursor_over_tab = FALSE;
	self->priv->cursor_over_close_button = FALSE;
}

static void
granite_widgets_tab_finalize (GObject * obj)
{
	GraniteWidgetsTab * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_WIDGETS_TYPE_TAB, GraniteWidgetsTab);
	_g_object_unref0 (self->priv->_label);
	_g_free0 (self->priv->_restore_data);
	(self->dropped_callback_target_destroy_notify == NULL) ? NULL : (self->dropped_callback_target_destroy_notify (self->dropped_callback_target), NULL);
	self->dropped_callback = NULL;
	self->dropped_callback_target = NULL;
	self->dropped_callback_target_destroy_notify = NULL;
	_g_object_unref0 (self->priv->_close_tab_label);
	_g_object_unref0 (self->priv->_duplicate_tab_label);
	_g_object_unref0 (self->priv->_new_window_label);
	_g_object_unref0 (self->page_container);
	_g_object_unref0 (self->_icon);
	_g_object_unref0 (self->priv->_working);
	_g_object_unref0 (self->priv->_menu);
	_g_object_unref0 (self->new_window_m);
	_g_object_unref0 (self->duplicate_m);
	_g_object_unref0 (self->pin_m);
	_g_object_unref0 (self->priv->close_button_revealer);
	G_OBJECT_CLASS (granite_widgets_tab_parent_class)->finalize (obj);
}

/**
     * This is a standard tab which can be used in a notebook to form a tabbed UI.
     */
static GType
granite_widgets_tab_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraniteWidgetsTabClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) granite_widgets_tab_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraniteWidgetsTab), 0, (GInstanceInitFunc) granite_widgets_tab_instance_init, NULL };
	GType granite_widgets_tab_type_id;
	granite_widgets_tab_type_id = g_type_register_static (gtk_event_box_get_type (), "GraniteWidgetsTab", &g_define_type_info, 0);
	GraniteWidgetsTab_private_offset = g_type_add_instance_private (granite_widgets_tab_type_id, sizeof (GraniteWidgetsTabPrivate));
	return granite_widgets_tab_type_id;
}

GType
granite_widgets_tab_get_type (void)
{
	static volatile gsize granite_widgets_tab_type_id__once = 0;
	if (g_once_init_enter (&granite_widgets_tab_type_id__once)) {
		GType granite_widgets_tab_type_id;
		granite_widgets_tab_type_id = granite_widgets_tab_get_type_once ();
		g_once_init_leave (&granite_widgets_tab_type_id__once, granite_widgets_tab_type_id);
	}
	return granite_widgets_tab_type_id__once;
}

static void
_vala_granite_widgets_tab_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	GraniteWidgetsTab * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRANITE_WIDGETS_TYPE_TAB, GraniteWidgetsTab);
	switch (property_id) {
		case GRANITE_WIDGETS_TAB_LABEL_PROPERTY:
		g_value_set_string (value, granite_widgets_tab_get_label (self));
		break;
		case GRANITE_WIDGETS_TAB_PINNED_PROPERTY:
		g_value_set_boolean (value, granite_widgets_tab_get_pinned (self));
		break;
		case GRANITE_WIDGETS_TAB_PINNABLE_PROPERTY:
		g_value_set_boolean (value, granite_widgets_tab_get_pinnable (self));
		break;
		case GRANITE_WIDGETS_TAB_RESTORE_DATA_PROPERTY:
		g_value_set_string (value, granite_widgets_tab_get_restore_data (self));
		break;
		case GRANITE_WIDGETS_TAB_CLOSE_TAB_LABEL_PROPERTY:
		g_value_set_object (value, granite_widgets_tab_get_close_tab_label (self));
		break;
		case GRANITE_WIDGETS_TAB_DUPLICATE_TAB_LABEL_PROPERTY:
		g_value_set_object (value, granite_widgets_tab_get_duplicate_tab_label (self));
		break;
		case GRANITE_WIDGETS_TAB_NEW_WINDOW_LABEL_PROPERTY:
		g_value_set_object (value, granite_widgets_tab_get_new_window_label (self));
		break;
		case GRANITE_WIDGETS_TAB_PAGE_PROPERTY:
		g_value_set_object (value, granite_widgets_tab_get_page (self));
		break;
		case GRANITE_WIDGETS_TAB_ICON_PROPERTY:
		g_value_take_object (value, granite_widgets_tab_get_icon (self));
		break;
		case GRANITE_WIDGETS_TAB_WORKING_PROPERTY:
		g_value_set_boolean (value, granite_widgets_tab_get_working (self));
		break;
		case GRANITE_WIDGETS_TAB_ELLIPSIZE_MODE_PROPERTY:
		g_value_set_enum (value, granite_widgets_tab_get_ellipsize_mode (self));
		break;
		case GRANITE_WIDGETS_TAB_MENU_PROPERTY:
		g_value_set_object (value, granite_widgets_tab_get_menu (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_granite_widgets_tab_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	GraniteWidgetsTab * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRANITE_WIDGETS_TYPE_TAB, GraniteWidgetsTab);
	switch (property_id) {
		case GRANITE_WIDGETS_TAB_LABEL_PROPERTY:
		granite_widgets_tab_set_label (self, g_value_get_string (value));
		break;
		case GRANITE_WIDGETS_TAB_TOOLTIP_PROPERTY:
		granite_widgets_tab_set_tooltip (self, g_value_get_string (value));
		break;
		case GRANITE_WIDGETS_TAB_PINNED_PROPERTY:
		granite_widgets_tab_set_pinned (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_TAB_PINNABLE_PROPERTY:
		granite_widgets_tab_set_pinnable (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_TAB_RESTORE_DATA_PROPERTY:
		granite_widgets_tab_set_restore_data (self, g_value_get_string (value));
		break;
		case GRANITE_WIDGETS_TAB_CLOSE_TAB_LABEL_PROPERTY:
		granite_widgets_tab_set_close_tab_label (self, g_value_get_object (value));
		break;
		case GRANITE_WIDGETS_TAB_DUPLICATE_TAB_LABEL_PROPERTY:
		granite_widgets_tab_set_duplicate_tab_label (self, g_value_get_object (value));
		break;
		case GRANITE_WIDGETS_TAB_NEW_WINDOW_LABEL_PROPERTY:
		granite_widgets_tab_set_new_window_label (self, g_value_get_object (value));
		break;
		case GRANITE_WIDGETS_TAB_PAGE_PROPERTY:
		granite_widgets_tab_set_page (self, g_value_get_object (value));
		break;
		case GRANITE_WIDGETS_TAB_ICON_PROPERTY:
		granite_widgets_tab_set_icon (self, g_value_get_object (value));
		break;
		case GRANITE_WIDGETS_TAB_WORKING_PROPERTY:
		granite_widgets_tab_set_working (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_TAB_ELLIPSIZE_MODE_PROPERTY:
		granite_widgets_tab_set_ellipsize_mode (self, g_value_get_enum (value));
		break;
		case GRANITE_WIDGETS_TAB_MENU_PROPERTY:
		granite_widgets_tab_set_menu (self, g_value_get_object (value));
		break;
		case GRANITE_WIDGETS_TAB_CLOSABLE_PROPERTY:
		granite_widgets_tab_set_closable (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_TAB_IS_CURRENT_TAB_PROPERTY:
		granite_widgets_tab_set_is_current_tab (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
granite_widgets_closed_tabs_get_instance_private (GraniteWidgetsClosedTabs* self)
{
	return G_STRUCT_MEMBER_P (self, GraniteWidgetsClosedTabs_private_offset);
}

static void
g_cclosure_user_marshal_VOID__STRING_STRING_OBJECT (GClosure * closure,
                                                    GValue * return_value,
                                                    guint n_param_values,
                                                    const GValue * param_values,
                                                    gpointer invocation_hint,
                                                    gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_STRING_OBJECT) (gpointer data1, const char* arg_1, const char* arg_2, gpointer arg_3, gpointer data2);
	register GMarshalFunc_VOID__STRING_STRING_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_STRING_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), g_value_get_object (param_values + 3), data2);
}

 G_GNUC_INTERNAL gint
granite_widgets_closed_tabs_get_max_restorable_tabs (GraniteWidgetsClosedTabs* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_max_restorable_tabs;
	return result;
}

 G_GNUC_INTERNAL void
granite_widgets_closed_tabs_set_max_restorable_tabs (GraniteWidgetsClosedTabs* self,
                                                     gint value)
{
	g_return_if_fail (self != NULL);
	_vala_assert (value > 0, "value > 0");
	self->priv->_max_restorable_tabs = value;
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_closed_tabs_properties[GRANITE_WIDGETS_CLOSED_TABS_MAX_RESTORABLE_TABS_PROPERTY]);
}

 G_GNUC_INTERNAL GraniteWidgetsClosedTabs*
granite_widgets_closed_tabs_construct (GType object_type)
{
	GraniteWidgetsClosedTabs * self = NULL;
	self = (GraniteWidgetsClosedTabs*) g_object_new (object_type, NULL);
	return self;
}

 G_GNUC_INTERNAL GraniteWidgetsClosedTabs*
granite_widgets_closed_tabs_new (void)
{
	return granite_widgets_closed_tabs_construct (GRANITE_WIDGETS_TYPE_CLOSED_TABS);
}

 G_GNUC_INTERNAL gboolean
granite_widgets_closed_tabs_get_empty (GraniteWidgetsClosedTabs* self)
{
	gboolean result;
	GeeLinkedList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->closed_tabs;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ == 0;
	return result;
}

 G_GNUC_INTERNAL void
granite_widgets_closed_tabs_push (GraniteWidgetsClosedTabs* self,
                                  GraniteWidgetsTab* tab)
{
	GraniteWidgetsClosedTabsEntry e = {0};
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	GIcon* _tmp18_;
	GIcon* _tmp19_;
	GraniteWidgetsDroppedDelegate _tmp20_;
	gpointer _tmp20__target;
	GraniteWidgetsClosedTabsEntry _tmp21_ = {0};
	GeeLinkedList* _tmp22_;
	GraniteWidgetsClosedTabsEntry _tmp23_;
	GeeLinkedList* _tmp24_;
	gint _tmp25_;
	gint _tmp26_;
	gint _tmp27_;
	gint _tmp28_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tab != NULL);
	{
		GeeLinkedList* _entry_list = NULL;
		GeeLinkedList* _tmp0_;
		gint _entry_size = 0;
		GeeLinkedList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _entry_index = 0;
		_tmp0_ = self->priv->closed_tabs;
		_entry_list = _tmp0_;
		_tmp1_ = _entry_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_entry_size = _tmp3_;
		_entry_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			GraniteWidgetsClosedTabsEntry* entry = NULL;
			GeeLinkedList* _tmp6_;
			gpointer _tmp7_;
			const gchar* _tmp8_;
			const gchar* _tmp9_;
			GraniteWidgetsClosedTabsEntry* _tmp10_;
			const gchar* _tmp11_;
			_entry_index = _entry_index + 1;
			_tmp4_ = _entry_index;
			_tmp5_ = _entry_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _entry_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _entry_index);
			entry = (GraniteWidgetsClosedTabsEntry*) _tmp7_;
			_tmp8_ = granite_widgets_tab_get_restore_data (tab);
			_tmp9_ = _tmp8_;
			_tmp10_ = entry;
			_tmp11_ = (*_tmp10_).restore_data;
			if (g_strcmp0 (_tmp9_, _tmp11_) == 0) {
				_granite_widgets_closed_tabs_entry_free0 (entry);
				return;
			}
			_granite_widgets_closed_tabs_entry_free0 (entry);
		}
	}
	_tmp12_ = granite_widgets_tab_get_label (tab);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strdup (_tmp13_);
	_tmp15_ = granite_widgets_tab_get_restore_data (tab);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_strdup (_tmp16_);
	_tmp18_ = granite_widgets_tab_get_icon (tab);
	_tmp19_ = _tmp18_;
	_tmp20_ = tab->dropped_callback;
	_tmp20__target = tab->dropped_callback_target;
	_g_free0 (_tmp21_.label);
	_tmp21_.label = _tmp14_;
	_g_free0 (_tmp21_.restore_data);
	_tmp21_.restore_data = _tmp17_;
	_g_object_unref0 (_tmp21_.icon);
	_tmp21_.icon = _tmp19_;
	_tmp21_.dropped_callback = _tmp20_;
	_tmp21_.dropped_callback_target = _tmp20__target;
	e = _tmp21_;
	_tmp22_ = self->priv->closed_tabs;
	_tmp23_ = e;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, &_tmp23_);
	_tmp24_ = self->priv->closed_tabs;
	_tmp25_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = granite_widgets_closed_tabs_get_max_restorable_tabs (self);
	_tmp28_ = _tmp27_;
	if (_tmp26_ > _tmp28_) {
		GraniteWidgetsClosedTabsEntry* elem = NULL;
		GeeLinkedList* _tmp29_;
		gpointer _tmp30_;
		GraniteWidgetsDroppedDelegate dropped_callback = NULL;
		GraniteWidgetsClosedTabsEntry* _tmp31_;
		GraniteWidgetsDroppedDelegate _tmp32_;
		gpointer _tmp32__target;
		gpointer dropped_callback_target;
		GraniteWidgetsDroppedDelegate _tmp33_;
		gpointer _tmp33__target;
		_tmp29_ = self->priv->closed_tabs;
		_tmp30_ = gee_deque_poll_head ((GeeDeque*) _tmp29_);
		elem = (GraniteWidgetsClosedTabsEntry*) _tmp30_;
		_tmp31_ = elem;
		_tmp32_ = (*_tmp31_).dropped_callback;
		_tmp32__target = (*_tmp31_).dropped_callback_target;
		dropped_callback = _tmp32_;
		dropped_callback_target = _tmp32__target;
		_tmp33_ = dropped_callback;
		_tmp33__target = dropped_callback_target;
		if (_tmp33_ != NULL) {
			GraniteWidgetsDroppedDelegate _tmp34_;
			gpointer _tmp34__target;
			_tmp34_ = dropped_callback;
			_tmp34__target = dropped_callback_target;
			_tmp34_ (_tmp34__target);
		}
		_granite_widgets_closed_tabs_entry_free0 (elem);
	}
	granite_widgets_closed_tabs_entry_destroy (&e);
}

 G_GNUC_INTERNAL void
granite_widgets_closed_tabs_pop (GraniteWidgetsClosedTabs* self,
                                 GraniteWidgetsClosedTabsEntry* result)
{
	GeeLinkedList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GeeLinkedList* _tmp3_;
	gpointer _tmp4_;
	GraniteWidgetsClosedTabsEntry* _tmp5_;
	GraniteWidgetsClosedTabsEntry _tmp6_;
	GraniteWidgetsClosedTabsEntry _tmp7_ = {0};
	GraniteWidgetsClosedTabsEntry _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->closed_tabs;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	_vala_assert (_tmp2_ > 0, "closed_tabs.size > 0");
	_tmp3_ = self->priv->closed_tabs;
	_tmp4_ = gee_deque_poll_tail ((GeeDeque*) _tmp3_);
	_tmp5_ = (GraniteWidgetsClosedTabsEntry*) _tmp4_;
	_tmp6_ = *_tmp5_;
	granite_widgets_closed_tabs_entry_copy (&_tmp6_, &_tmp7_);
	_tmp8_ = _tmp7_;
	_granite_widgets_closed_tabs_entry_free0 (_tmp5_);
	*result = _tmp8_;
	return;
}

 G_GNUC_INTERNAL void
granite_widgets_closed_tabs_pick (GraniteWidgetsClosedTabs* self,
                                  const gchar* search,
                                  GraniteWidgetsClosedTabsEntry* result)
{
	GraniteWidgetsClosedTabsEntry picked = {0};
	GraniteWidgetsClosedTabsEntry _tmp0_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (search != NULL);
	_g_free0 (_tmp0_.label);
	_tmp0_.label = NULL;
	_g_free0 (_tmp0_.restore_data);
	_tmp0_.restore_data = NULL;
	_g_object_unref0 (_tmp0_.icon);
	_tmp0_.icon = NULL;
	picked = _tmp0_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				GeeLinkedList* _tmp3_;
				gint _tmp4_;
				gint _tmp5_;
				GraniteWidgetsClosedTabsEntry* entry = NULL;
				GeeLinkedList* _tmp6_;
				gpointer _tmp7_;
				GraniteWidgetsClosedTabsEntry* _tmp8_;
				const gchar* _tmp9_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp3_ = self->priv->closed_tabs;
				_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
				_tmp5_ = _tmp4_;
				if (!(i < _tmp5_)) {
					break;
				}
				_tmp6_ = self->priv->closed_tabs;
				_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, i);
				entry = (GraniteWidgetsClosedTabsEntry*) _tmp7_;
				_tmp8_ = entry;
				_tmp9_ = (*_tmp8_).restore_data;
				if (g_strcmp0 (_tmp9_, search) == 0) {
					GeeLinkedList* _tmp10_;
					gpointer _tmp11_;
					GraniteWidgetsClosedTabsEntry* _tmp12_;
					GraniteWidgetsClosedTabsEntry _tmp13_;
					GraniteWidgetsClosedTabsEntry _tmp14_ = {0};
					_tmp10_ = self->priv->closed_tabs;
					_tmp11_ = gee_abstract_list_remove_at ((GeeAbstractList*) _tmp10_, i);
					_tmp12_ = (GraniteWidgetsClosedTabsEntry*) _tmp11_;
					_tmp13_ = *_tmp12_;
					granite_widgets_closed_tabs_entry_copy (&_tmp13_, &_tmp14_);
					granite_widgets_closed_tabs_entry_destroy (&picked);
					picked = _tmp14_;
					_granite_widgets_closed_tabs_entry_free0 (_tmp12_);
					_granite_widgets_closed_tabs_entry_free0 (entry);
					break;
				}
				_granite_widgets_closed_tabs_entry_free0 (entry);
			}
		}
	}
	*result = picked;
	return;
}

static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		GraniteWidgetsClosedTabs* self;
		self = _data4_->self;
		_granite_widgets_closed_tabs_entry_free0 (_data4_->entry);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static void
_granite_widgets_closed_tabs_menu_____lambda22_ (Block4Data* _data4_)
{
	GraniteWidgetsClosedTabs* self;
	GraniteWidgetsClosedTabsEntry e = {0};
	GraniteWidgetsClosedTabsEntry* _tmp0_;
	const gchar* _tmp1_;
	GraniteWidgetsClosedTabsEntry _tmp2_ = {0};
	GraniteWidgetsClosedTabsEntry _tmp3_;
	const gchar* _tmp4_;
	GraniteWidgetsClosedTabsEntry _tmp5_;
	const gchar* _tmp6_;
	GraniteWidgetsClosedTabsEntry _tmp7_;
	GIcon* _tmp8_;
	self = _data4_->self;
	_tmp0_ = _data4_->entry;
	_tmp1_ = (*_tmp0_).restore_data;
	granite_widgets_closed_tabs_pick (self, _tmp1_, &_tmp2_);
	e = _tmp2_;
	_tmp3_ = e;
	_tmp4_ = _tmp3_.label;
	_tmp5_ = e;
	_tmp6_ = _tmp5_.restore_data;
	_tmp7_ = e;
	_tmp8_ = _tmp7_.icon;
	g_signal_emit (self, granite_widgets_closed_tabs_signals[GRANITE_WIDGETS_CLOSED_TABS_RESTORED_SIGNAL], 0, _tmp4_, _tmp6_, _tmp8_);
	granite_widgets_closed_tabs_entry_destroy (&e);
}

static void
__granite_widgets_closed_tabs_menu_____lambda22__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                                         gpointer self)
{
	_granite_widgets_closed_tabs_menu_____lambda22_ (self);
}

static void
_granite_widgets_closed_tabs_menu____lambda23_ (GraniteWidgetsClosedTabs* self)
{
	GeeLinkedList* _tmp12_;
	{
		GeeLinkedList* _entry_list = NULL;
		GeeLinkedList* _tmp0_;
		gint _entry_size = 0;
		GeeLinkedList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _entry_index = 0;
		_tmp0_ = self->priv->closed_tabs;
		_entry_list = _tmp0_;
		_tmp1_ = _entry_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_entry_size = _tmp3_;
		_entry_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			GraniteWidgetsClosedTabsEntry* entry = NULL;
			GeeLinkedList* _tmp6_;
			gpointer _tmp7_;
			GraniteWidgetsClosedTabsEntry* _tmp8_;
			GraniteWidgetsDroppedDelegate _tmp9_;
			gpointer _tmp9__target;
			_entry_index = _entry_index + 1;
			_tmp4_ = _entry_index;
			_tmp5_ = _entry_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _entry_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _entry_index);
			entry = (GraniteWidgetsClosedTabsEntry*) _tmp7_;
			_tmp8_ = entry;
			_tmp9_ = (*_tmp8_).dropped_callback;
			_tmp9__target = (*_tmp8_).dropped_callback_target;
			if (_tmp9_ != NULL) {
				GraniteWidgetsClosedTabsEntry* _tmp10_;
				GraniteWidgetsDroppedDelegate _tmp11_;
				gpointer _tmp11__target;
				_tmp10_ = entry;
				_tmp11_ = (*_tmp10_).dropped_callback;
				_tmp11__target = (*_tmp10_).dropped_callback_target;
				_tmp11_ (_tmp11__target);
			}
			_granite_widgets_closed_tabs_entry_free0 (entry);
		}
	}
	_tmp12_ = self->priv->closed_tabs;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp12_);
	g_signal_emit (self, granite_widgets_closed_tabs_signals[GRANITE_WIDGETS_CLOSED_TABS_CLEARED_SIGNAL], 0);
}

static void
__granite_widgets_closed_tabs_menu____lambda23__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                                        gpointer self)
{
	_granite_widgets_closed_tabs_menu____lambda23_ ((GraniteWidgetsClosedTabs*) self);
}

 G_GNUC_INTERNAL GtkMenu*
granite_widgets_closed_tabs_get_menu (GraniteWidgetsClosedTabs* self)
{
	GtkMenu* result;
	GtkMenu* _menu = NULL;
	GtkMenu* _tmp0_;
	gboolean _tmp15_;
	gboolean _tmp16_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkMenu*) gtk_menu_new ();
	g_object_ref_sink (_tmp0_);
	_menu = _tmp0_;
	{
		GeeLinkedList* _entry_list = NULL;
		GeeLinkedList* _tmp1_;
		gint _entry_size = 0;
		GeeLinkedList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _entry_index = 0;
		_tmp1_ = self->priv->closed_tabs;
		_entry_list = _tmp1_;
		_tmp2_ = _entry_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_entry_size = _tmp4_;
		_entry_index = -1;
		while (TRUE) {
			Block4Data* _data4_;
			gint _tmp5_;
			gint _tmp6_;
			GeeLinkedList* _tmp7_;
			gpointer _tmp8_;
			GtkMenuItem* item = NULL;
			GraniteWidgetsClosedTabsEntry* _tmp9_;
			const gchar* _tmp10_;
			GtkMenuItem* _tmp11_;
			GtkMenu* _tmp12_;
			GtkMenuItem* _tmp13_;
			GtkMenuItem* _tmp14_;
			_data4_ = g_slice_new0 (Block4Data);
			_data4_->_ref_count_ = 1;
			_data4_->self = g_object_ref (self);
			_entry_index = _entry_index + 1;
			_tmp5_ = _entry_index;
			_tmp6_ = _entry_size;
			if (!(_tmp5_ < _tmp6_)) {
				block4_data_unref (_data4_);
				_data4_ = NULL;
				break;
			}
			_tmp7_ = _entry_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _entry_index);
			_data4_->entry = (GraniteWidgetsClosedTabsEntry*) _tmp8_;
			_tmp9_ = _data4_->entry;
			_tmp10_ = (*_tmp9_).label;
			_tmp11_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_tmp10_);
			g_object_ref_sink (_tmp11_);
			item = _tmp11_;
			_tmp12_ = _menu;
			_tmp13_ = item;
			gtk_menu_shell_prepend ((GtkMenuShell*) _tmp12_, (GtkWidget*) _tmp13_);
			_tmp14_ = item;
			g_signal_connect_data (_tmp14_, "activate", (GCallback) __granite_widgets_closed_tabs_menu_____lambda22__gtk_menu_item_activate, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
			_g_object_unref0 (item);
			block4_data_unref (_data4_);
			_data4_ = NULL;
		}
	}
	_tmp15_ = granite_widgets_closed_tabs_get_empty (self);
	_tmp16_ = _tmp15_;
	if (!_tmp16_) {
		GtkSeparatorMenuItem* separator = NULL;
		GtkSeparatorMenuItem* _tmp17_;
		GtkMenuItem* item = NULL;
		GtkMenuItem* _tmp18_;
		GtkMenu* _tmp19_;
		GtkSeparatorMenuItem* _tmp20_;
		GtkMenu* _tmp21_;
		GtkMenuItem* _tmp22_;
		GtkMenuItem* _tmp23_;
		_tmp17_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp17_);
		separator = _tmp17_;
		_tmp18_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("Clear All"));
		g_object_ref_sink (_tmp18_);
		item = _tmp18_;
		_tmp19_ = _menu;
		_tmp20_ = separator;
		gtk_menu_shell_append ((GtkMenuShell*) _tmp19_, (GtkMenuItem*) _tmp20_);
		_tmp21_ = _menu;
		_tmp22_ = item;
		gtk_menu_shell_append ((GtkMenuShell*) _tmp21_, _tmp22_);
		_tmp23_ = item;
		g_signal_connect_object (_tmp23_, "activate", (GCallback) __granite_widgets_closed_tabs_menu____lambda23__gtk_menu_item_activate, self, 0);
		_g_object_unref0 (item);
		_g_object_unref0 (separator);
	}
	result = _menu;
	return result;
}

 G_GNUC_INTERNAL void
granite_widgets_closed_tabs_entry_copy (const GraniteWidgetsClosedTabsEntry* self,
                                        GraniteWidgetsClosedTabsEntry* dest)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	GIcon* _tmp4_;
	GIcon* _tmp5_;
	GraniteWidgetsDroppedDelegate _tmp6_;
	gpointer _tmp6__target;
	_tmp0_ = (*self).label;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).label);
	(*dest).label = _tmp1_;
	_tmp2_ = (*self).restore_data;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 ((*dest).restore_data);
	(*dest).restore_data = _tmp3_;
	_tmp4_ = (*self).icon;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_g_object_unref0 ((*dest).icon);
	(*dest).icon = _tmp5_;
	_tmp6_ = (*self).dropped_callback;
	_tmp6__target = (*self).dropped_callback_target;
	(*dest).dropped_callback = _tmp6_;
	(*dest).dropped_callback_target = _tmp6__target;
}

 G_GNUC_INTERNAL void
granite_widgets_closed_tabs_entry_destroy (GraniteWidgetsClosedTabsEntry* self)
{
	_g_free0 ((*self).label);
	_g_free0 ((*self).restore_data);
	_g_object_unref0 ((*self).icon);
}

GraniteWidgetsClosedTabsEntry*
granite_widgets_closed_tabs_entry_dup (const GraniteWidgetsClosedTabsEntry* self)
{
	GraniteWidgetsClosedTabsEntry* dup;
	dup = g_new0 (GraniteWidgetsClosedTabsEntry, 1);
	granite_widgets_closed_tabs_entry_copy (self, dup);
	return dup;
}

 G_GNUC_INTERNAL void
granite_widgets_closed_tabs_entry_free (GraniteWidgetsClosedTabsEntry* self)
{
	granite_widgets_closed_tabs_entry_destroy (self);
	g_free (self);
}

static GType
granite_widgets_closed_tabs_entry_get_type_once (void)
{
	GType granite_widgets_closed_tabs_entry_type_id;
	granite_widgets_closed_tabs_entry_type_id = g_boxed_type_register_static ("GraniteWidgetsClosedTabsEntry", (GBoxedCopyFunc) granite_widgets_closed_tabs_entry_dup, (GBoxedFreeFunc) granite_widgets_closed_tabs_entry_free);
	return granite_widgets_closed_tabs_entry_type_id;
}

 G_GNUC_INTERNAL GType
granite_widgets_closed_tabs_entry_get_type (void)
{
	static volatile gsize granite_widgets_closed_tabs_entry_type_id__once = 0;
	if (g_once_init_enter (&granite_widgets_closed_tabs_entry_type_id__once)) {
		GType granite_widgets_closed_tabs_entry_type_id;
		granite_widgets_closed_tabs_entry_type_id = granite_widgets_closed_tabs_entry_get_type_once ();
		g_once_init_leave (&granite_widgets_closed_tabs_entry_type_id__once, granite_widgets_closed_tabs_entry_type_id);
	}
	return granite_widgets_closed_tabs_entry_type_id__once;
}

static GObject *
granite_widgets_closed_tabs_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GraniteWidgetsClosedTabs * self;
	GeeLinkedList* _tmp0_;
	parent_class = G_OBJECT_CLASS (granite_widgets_closed_tabs_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_WIDGETS_TYPE_CLOSED_TABS, GraniteWidgetsClosedTabs);
	_tmp0_ = gee_linked_list_new (GRANITE_WIDGETS_CLOSED_TABS_TYPE_ENTRY, (GBoxedCopyFunc) granite_widgets_closed_tabs_entry_dup, (GDestroyNotify) granite_widgets_closed_tabs_entry_free, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->closed_tabs);
	self->priv->closed_tabs = _tmp0_;
	return obj;
}

static void
granite_widgets_closed_tabs_class_init (GraniteWidgetsClosedTabsClass * klass,
                                        gpointer klass_data)
{
	granite_widgets_closed_tabs_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraniteWidgetsClosedTabs_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_granite_widgets_closed_tabs_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_granite_widgets_closed_tabs_set_property;
	G_OBJECT_CLASS (klass)->constructor = granite_widgets_closed_tabs_constructor;
	G_OBJECT_CLASS (klass)->finalize = granite_widgets_closed_tabs_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_CLOSED_TABS_MAX_RESTORABLE_TABS_PROPERTY, granite_widgets_closed_tabs_properties[GRANITE_WIDGETS_CLOSED_TABS_MAX_RESTORABLE_TABS_PROPERTY] = g_param_spec_int ("max-restorable-tabs", "max-restorable-tabs", "max-restorable-tabs", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_CLOSED_TABS_EMPTY_PROPERTY, granite_widgets_closed_tabs_properties[GRANITE_WIDGETS_CLOSED_TABS_EMPTY_PROPERTY] = g_param_spec_boolean ("empty", "empty", "empty", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_CLOSED_TABS_MENU_PROPERTY, granite_widgets_closed_tabs_properties[GRANITE_WIDGETS_CLOSED_TABS_MENU_PROPERTY] = g_param_spec_object ("menu", "menu", "menu", gtk_menu_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	granite_widgets_closed_tabs_signals[GRANITE_WIDGETS_CLOSED_TABS_RESTORED_SIGNAL] = g_signal_new ("restored", GRANITE_WIDGETS_TYPE_CLOSED_TABS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_OBJECT, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, g_icon_get_type ());
	granite_widgets_closed_tabs_signals[GRANITE_WIDGETS_CLOSED_TABS_CLEARED_SIGNAL] = g_signal_new ("cleared", GRANITE_WIDGETS_TYPE_CLOSED_TABS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
granite_widgets_closed_tabs_instance_init (GraniteWidgetsClosedTabs * self,
                                           gpointer klass)
{
	self->priv = granite_widgets_closed_tabs_get_instance_private (self);
	self->priv->_max_restorable_tabs = 10;
}

static void
granite_widgets_closed_tabs_finalize (GObject * obj)
{
	GraniteWidgetsClosedTabs * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_WIDGETS_TYPE_CLOSED_TABS, GraniteWidgetsClosedTabs);
	_g_object_unref0 (self->priv->closed_tabs);
	G_OBJECT_CLASS (granite_widgets_closed_tabs_parent_class)->finalize (obj);
}

static GType
granite_widgets_closed_tabs_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraniteWidgetsClosedTabsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) granite_widgets_closed_tabs_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraniteWidgetsClosedTabs), 0, (GInstanceInitFunc) granite_widgets_closed_tabs_instance_init, NULL };
	GType granite_widgets_closed_tabs_type_id;
	granite_widgets_closed_tabs_type_id = g_type_register_static (G_TYPE_OBJECT, "GraniteWidgetsClosedTabs", &g_define_type_info, 0);
	GraniteWidgetsClosedTabs_private_offset = g_type_add_instance_private (granite_widgets_closed_tabs_type_id, sizeof (GraniteWidgetsClosedTabsPrivate));
	return granite_widgets_closed_tabs_type_id;
}

 G_GNUC_INTERNAL GType
granite_widgets_closed_tabs_get_type (void)
{
	static volatile gsize granite_widgets_closed_tabs_type_id__once = 0;
	if (g_once_init_enter (&granite_widgets_closed_tabs_type_id__once)) {
		GType granite_widgets_closed_tabs_type_id;
		granite_widgets_closed_tabs_type_id = granite_widgets_closed_tabs_get_type_once ();
		g_once_init_leave (&granite_widgets_closed_tabs_type_id__once, granite_widgets_closed_tabs_type_id);
	}
	return granite_widgets_closed_tabs_type_id__once;
}

static void
_vala_granite_widgets_closed_tabs_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec)
{
	GraniteWidgetsClosedTabs * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRANITE_WIDGETS_TYPE_CLOSED_TABS, GraniteWidgetsClosedTabs);
	switch (property_id) {
		case GRANITE_WIDGETS_CLOSED_TABS_MAX_RESTORABLE_TABS_PROPERTY:
		g_value_set_int (value, granite_widgets_closed_tabs_get_max_restorable_tabs (self));
		break;
		case GRANITE_WIDGETS_CLOSED_TABS_EMPTY_PROPERTY:
		g_value_set_boolean (value, granite_widgets_closed_tabs_get_empty (self));
		break;
		case GRANITE_WIDGETS_CLOSED_TABS_MENU_PROPERTY:
		g_value_take_object (value, granite_widgets_closed_tabs_get_menu (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_granite_widgets_closed_tabs_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec)
{
	GraniteWidgetsClosedTabs * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRANITE_WIDGETS_TYPE_CLOSED_TABS, GraniteWidgetsClosedTabs);
	switch (property_id) {
		case GRANITE_WIDGETS_CLOSED_TABS_MAX_RESTORABLE_TABS_PROPERTY:
		granite_widgets_closed_tabs_set_max_restorable_tabs (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
granite_widgets_dynamic_notebook_get_instance_private (GraniteWidgetsDynamicNotebook* self)
{
	return G_STRUCT_MEMBER_P (self, GraniteWidgetsDynamicNotebook_private_offset);
}

static GType
granite_widgets_dynamic_notebook_tab_bar_behavior_get_type_once (void)
{
	static const GEnumValue values[] = {{GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_ALWAYS, "GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_ALWAYS", "always"}, {GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_SINGLE, "GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_SINGLE", "single"}, {GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_NEVER, "GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_NEVER", "never"}, {0, NULL, NULL}};
	GType granite_widgets_dynamic_notebook_tab_bar_behavior_type_id;
	granite_widgets_dynamic_notebook_tab_bar_behavior_type_id = g_enum_register_static ("GraniteWidgetsDynamicNotebookTabBarBehavior", values);
	return granite_widgets_dynamic_notebook_tab_bar_behavior_type_id;
}

GType
granite_widgets_dynamic_notebook_tab_bar_behavior_get_type (void)
{
	static volatile gsize granite_widgets_dynamic_notebook_tab_bar_behavior_type_id__once = 0;
	if (g_once_init_enter (&granite_widgets_dynamic_notebook_tab_bar_behavior_type_id__once)) {
		GType granite_widgets_dynamic_notebook_tab_bar_behavior_type_id;
		granite_widgets_dynamic_notebook_tab_bar_behavior_type_id = granite_widgets_dynamic_notebook_tab_bar_behavior_get_type_once ();
		g_once_init_leave (&granite_widgets_dynamic_notebook_tab_bar_behavior_type_id__once, granite_widgets_dynamic_notebook_tab_bar_behavior_type_id);
	}
	return granite_widgets_dynamic_notebook_tab_bar_behavior_type_id__once;
}

gint
granite_widgets_dynamic_notebook_get_n_tabs (GraniteWidgetsDynamicNotebook* self)
{
	gint result;
	GtkNotebook* _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->notebook;
	result = gtk_notebook_get_n_pages (_tmp0_);
	return result;
}

gboolean
granite_widgets_dynamic_notebook_get_show_tabs (GraniteWidgetsDynamicNotebook* self)
{
	gboolean result;
	GtkNotebook* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = gtk_notebook_get_show_tabs (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
granite_widgets_dynamic_notebook_set_show_tabs (GraniteWidgetsDynamicNotebook* self,
                                                gboolean value)
{
	GtkNotebook* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->notebook;
	gtk_notebook_set_show_tabs (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_SHOW_TABS_PROPERTY]);
}

gboolean
granite_widgets_dynamic_notebook_get_tabs_closable (GraniteWidgetsDynamicNotebook* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_tabs_closable;
	return result;
}

static Block5Data*
block5_data_ref (Block5Data* _data5_)
{
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		GraniteWidgetsDynamicNotebook* self;
		self = _data5_->self;
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}

static void
_granite_widgets_dynamic_notebook_tabs_closable____lambda28_ (Block5Data* _data5_,
                                                              GraniteWidgetsTab* t)
{
	GraniteWidgetsDynamicNotebook* self;
	self = _data5_->self;
	g_return_if_fail (t != NULL);
	granite_widgets_tab_set_closable (t, _data5_->value);
}

static void
__granite_widgets_dynamic_notebook_tabs_closable____lambda28__gfunc (gconstpointer data,
                                                                     gpointer self)
{
	_granite_widgets_dynamic_notebook_tabs_closable____lambda28_ (self, (GraniteWidgetsTab*) data);
}

void
granite_widgets_dynamic_notebook_set_tabs_closable (GraniteWidgetsDynamicNotebook* self,
                                                    gboolean value)
{
	Block5Data* _data5_;
	g_return_if_fail (self != NULL);
	_data5_ = g_slice_new0 (Block5Data);
	_data5_->_ref_count_ = 1;
	_data5_->self = g_object_ref (self);
	_data5_->value = value;
	if (_data5_->value != self->priv->_tabs_closable) {
		GList* _tmp0_;
		GList* _tmp1_;
		_tmp0_ = granite_widgets_dynamic_notebook_get_tabs (self);
		_tmp1_ = _tmp0_;
		g_list_foreach (_tmp1_, __granite_widgets_dynamic_notebook_tabs_closable____lambda28__gfunc, _data5_);
	}
	self->priv->_tabs_closable = _data5_->value;
	block5_data_unref (_data5_);
	_data5_ = NULL;
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TABS_CLOSABLE_PROPERTY]);
}

gboolean
granite_widgets_dynamic_notebook_get_allow_drag (GraniteWidgetsDynamicNotebook* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_allow_drag;
	return result;
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		GraniteWidgetsDynamicNotebook* self;
		self = _data6_->self;
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static void
_granite_widgets_dynamic_notebook_allow_drag___lambda26_ (Block6Data* _data6_,
                                                          GraniteWidgetsTab* t)
{
	GraniteWidgetsDynamicNotebook* self;
	GtkNotebook* _tmp0_;
	GraniteWidgetsTabPageContainer* _tmp1_;
	self = _data6_->self;
	g_return_if_fail (t != NULL);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = t->page_container;
	gtk_notebook_set_tab_reorderable (_tmp0_, (GtkWidget*) _tmp1_, _data6_->value);
}

static void
__granite_widgets_dynamic_notebook_allow_drag___lambda26__gfunc (gconstpointer data,
                                                                 gpointer self)
{
	_granite_widgets_dynamic_notebook_allow_drag___lambda26_ (self, (GraniteWidgetsTab*) data);
}

void
granite_widgets_dynamic_notebook_set_allow_drag (GraniteWidgetsDynamicNotebook* self,
                                                 gboolean value)
{
	Block6Data* _data6_;
	GList* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (self != NULL);
	_data6_ = g_slice_new0 (Block6Data);
	_data6_->_ref_count_ = 1;
	_data6_->self = g_object_ref (self);
	_data6_->value = value;
	self->priv->_allow_drag = _data6_->value;
	_tmp0_ = granite_widgets_dynamic_notebook_get_tabs (self);
	_tmp1_ = _tmp0_;
	g_list_foreach (_tmp1_, __granite_widgets_dynamic_notebook_allow_drag___lambda26__gfunc, _data6_);
	block6_data_unref (_data6_);
	_data6_ = NULL;
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DRAG_PROPERTY]);
}

gboolean
granite_widgets_dynamic_notebook_get_allow_new_window (GraniteWidgetsDynamicNotebook* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_allow_new_window;
	return result;
}

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		GraniteWidgetsDynamicNotebook* self;
		self = _data7_->self;
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}

static void
_granite_widgets_dynamic_notebook_allow_new_window___lambda27_ (Block7Data* _data7_,
                                                                GraniteWidgetsTab* t)
{
	GraniteWidgetsDynamicNotebook* self;
	GtkNotebook* _tmp0_;
	GraniteWidgetsTabPageContainer* _tmp1_;
	self = _data7_->self;
	g_return_if_fail (t != NULL);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = t->page_container;
	gtk_notebook_set_tab_detachable (_tmp0_, (GtkWidget*) _tmp1_, _data7_->value);
}

static void
__granite_widgets_dynamic_notebook_allow_new_window___lambda27__gfunc (gconstpointer data,
                                                                       gpointer self)
{
	_granite_widgets_dynamic_notebook_allow_new_window___lambda27_ (self, (GraniteWidgetsTab*) data);
}

void
granite_widgets_dynamic_notebook_set_allow_new_window (GraniteWidgetsDynamicNotebook* self,
                                                       gboolean value)
{
	Block7Data* _data7_;
	GList* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (self != NULL);
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->self = g_object_ref (self);
	_data7_->value = value;
	self->priv->_allow_new_window = _data7_->value;
	_tmp0_ = granite_widgets_dynamic_notebook_get_tabs (self);
	_tmp1_ = _tmp0_;
	g_list_foreach (_tmp1_, __granite_widgets_dynamic_notebook_allow_new_window___lambda27__gfunc, _data7_);
	block7_data_unref (_data7_);
	_data7_ = NULL;
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_NEW_WINDOW_PROPERTY]);
}

gboolean
granite_widgets_dynamic_notebook_get_allow_duplication (GraniteWidgetsDynamicNotebook* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_allow_duplication;
	return result;
}

void
granite_widgets_dynamic_notebook_set_allow_duplication (GraniteWidgetsDynamicNotebook* self,
                                                        gboolean value)
{
	GList* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->_allow_duplication = value;
	_tmp0_ = granite_widgets_dynamic_notebook_get_tabs (self);
	_tmp1_ = _tmp0_;
	{
		GList* tab_collection = NULL;
		GList* tab_it = NULL;
		tab_collection = _tmp1_;
		for (tab_it = tab_collection; tab_it != NULL; tab_it = tab_it->next) {
			GraniteWidgetsTab* _tmp2_;
			GraniteWidgetsTab* tab = NULL;
			_tmp2_ = _g_object_ref0 ((GraniteWidgetsTab*) tab_it->data);
			tab = _tmp2_;
			{
				GraniteWidgetsTab* _tmp3_;
				GtkMenuItem* _tmp4_;
				_tmp3_ = tab;
				_tmp4_ = _tmp3_->duplicate_m;
				gtk_widget_set_visible ((GtkWidget*) _tmp4_, value);
				_g_object_unref0 (tab);
			}
		}
	}
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DUPLICATION_PROPERTY]);
}

gboolean
granite_widgets_dynamic_notebook_get_allow_restoring (GraniteWidgetsDynamicNotebook* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_allow_restoring;
	return result;
}

void
granite_widgets_dynamic_notebook_set_allow_restoring (GraniteWidgetsDynamicNotebook* self,
                                                      gboolean value)
{
	GtkMenuItem* _tmp0_;
	GtkButton* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->_allow_restoring = value;
	_tmp0_ = self->priv->restore_tab_m;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, value);
	_tmp1_ = self->priv->restore_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp1_, value);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_RESTORING_PROPERTY]);
}

gint
granite_widgets_dynamic_notebook_get_max_restorable_tabs (GraniteWidgetsDynamicNotebook* self)
{
	gint result;
	GraniteWidgetsClosedTabs* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->closed_tabs;
	_tmp1_ = granite_widgets_closed_tabs_get_max_restorable_tabs (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
granite_widgets_dynamic_notebook_set_max_restorable_tabs (GraniteWidgetsDynamicNotebook* self,
                                                          gint value)
{
	GraniteWidgetsClosedTabs* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->closed_tabs;
	granite_widgets_closed_tabs_set_max_restorable_tabs (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MAX_RESTORABLE_TABS_PROPERTY]);
}

gboolean
granite_widgets_dynamic_notebook_get_add_button_visible (GraniteWidgetsDynamicNotebook* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_add_button_visible;
	return result;
}

void
granite_widgets_dynamic_notebook_set_add_button_visible (GraniteWidgetsDynamicNotebook* self,
                                                         gboolean value)
{
	g_return_if_fail (self != NULL);
	if (value != self->priv->_add_button_visible) {
		if (self->priv->_add_button_visible) {
			GtkNotebook* _tmp0_;
			GtkButton* _tmp1_;
			_tmp0_ = self->priv->notebook;
			_tmp1_ = self->priv->add_button;
			gtk_container_remove ((GtkContainer*) _tmp0_, (GtkWidget*) _tmp1_);
		} else {
			GtkNotebook* _tmp2_;
			GtkButton* _tmp3_;
			_tmp2_ = self->priv->notebook;
			_tmp3_ = self->priv->add_button;
			gtk_notebook_set_action_widget (_tmp2_, (GtkWidget*) _tmp3_, GTK_PACK_START);
		}
		self->priv->_add_button_visible = value;
	}
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_VISIBLE_PROPERTY]);
}

gboolean
granite_widgets_dynamic_notebook_get_allow_pinning (GraniteWidgetsDynamicNotebook* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_allow_pinning;
	return result;
}

void
granite_widgets_dynamic_notebook_set_allow_pinning (GraniteWidgetsDynamicNotebook* self,
                                                    gboolean value)
{
	GList* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->_allow_pinning = value;
	_tmp0_ = granite_widgets_dynamic_notebook_get_tabs (self);
	_tmp1_ = _tmp0_;
	{
		GList* tab_collection = NULL;
		GList* tab_it = NULL;
		tab_collection = _tmp1_;
		for (tab_it = tab_collection; tab_it != NULL; tab_it = tab_it->next) {
			GraniteWidgetsTab* _tmp2_;
			GraniteWidgetsTab* tab = NULL;
			_tmp2_ = _g_object_ref0 ((GraniteWidgetsTab*) tab_it->data);
			tab = _tmp2_;
			{
				GraniteWidgetsTab* _tmp3_;
				_tmp3_ = tab;
				granite_widgets_tab_set_pinnable (_tmp3_, value);
				_g_object_unref0 (tab);
			}
		}
	}
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_PINNING_PROPERTY]);
}

gboolean
granite_widgets_dynamic_notebook_get_force_left (GraniteWidgetsDynamicNotebook* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_force_left;
	return result;
}

void
granite_widgets_dynamic_notebook_set_force_left (GraniteWidgetsDynamicNotebook* self,
                                                 gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_force_left = value;
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_FORCE_LEFT_PROPERTY]);
}

const gchar*
granite_widgets_dynamic_notebook_get_add_button_tooltip (GraniteWidgetsDynamicNotebook* self)
{
	const gchar* result;
	GtkButton* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->add_button;
	_tmp1_ = gtk_widget_get_tooltip_text ((GtkWidget*) _tmp0_);
	_tmp2_ = _tmp1_;
	_g_free0 (self->priv->_add_button_tooltip);
	self->priv->_add_button_tooltip = _tmp2_;
	_tmp3_ = self->priv->_add_button_tooltip;
	result = _tmp3_;
	return result;
}

void
granite_widgets_dynamic_notebook_set_add_button_tooltip (GraniteWidgetsDynamicNotebook* self,
                                                         const gchar* value)
{
	GtkButton* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->add_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_TOOLTIP_PROPERTY]);
}

GraniteAccelLabel*
granite_widgets_dynamic_notebook_get_new_tab_label (GraniteWidgetsDynamicNotebook* self)
{
	GraniteAccelLabel* result;
	GraniteAccelLabel* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_new_tab_label;
	result = _tmp0_;
	return result;
}

static void
granite_widgets_dynamic_notebook_set_new_tab_label (GraniteWidgetsDynamicNotebook* self,
                                                    GraniteAccelLabel* value)
{
	GraniteAccelLabel* old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_widgets_dynamic_notebook_get_new_tab_label (self);
	if (old_value != value) {
		GraniteAccelLabel* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_new_tab_label);
		self->priv->_new_tab_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_LABEL_PROPERTY]);
	}
}

GraniteAccelLabel*
granite_widgets_dynamic_notebook_get_restore_tab_label (GraniteWidgetsDynamicNotebook* self)
{
	GraniteAccelLabel* result;
	GraniteAccelLabel* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_restore_tab_label;
	result = _tmp0_;
	return result;
}

static void
granite_widgets_dynamic_notebook_set_restore_tab_label (GraniteWidgetsDynamicNotebook* self,
                                                        GraniteAccelLabel* value)
{
	GraniteAccelLabel* old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_widgets_dynamic_notebook_get_restore_tab_label (self);
	if (old_value != value) {
		GraniteAccelLabel* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_restore_tab_label);
		self->priv->_restore_tab_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_RESTORE_TAB_LABEL_PROPERTY]);
	}
}

GraniteWidgetsTab*
granite_widgets_dynamic_notebook_get_current (GraniteWidgetsDynamicNotebook* self)
{
	GraniteWidgetsTab* result;
	GList* _tmp0_;
	GList* _tmp1_;
	GtkNotebook* _tmp2_;
	gconstpointer _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = granite_widgets_dynamic_notebook_get_tabs (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->notebook;
	_tmp3_ = g_list_nth_data (_tmp1_, (guint) gtk_notebook_get_current_page (_tmp2_));
	result = (GraniteWidgetsTab*) _tmp3_;
	return result;
}

void
granite_widgets_dynamic_notebook_set_current (GraniteWidgetsDynamicNotebook* self,
                                              GraniteWidgetsTab* value)
{
	GtkNotebook* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = granite_widgets_dynamic_notebook_get_tabs (self);
	_tmp2_ = _tmp1_;
	gtk_notebook_set_current_page (_tmp0_, g_list_index (_tmp2_, value));
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_CURRENT_PROPERTY]);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

GList*
granite_widgets_dynamic_notebook_get_tabs (GraniteWidgetsDynamicNotebook* self)
{
	GList* result;
	GList* _tmp9_;
	g_return_val_if_fail (self != NULL, NULL);
	(self->priv->_tabs == NULL) ? NULL : (self->priv->_tabs = (_g_list_free__g_object_unref0_ (self->priv->_tabs), NULL));
	self->priv->_tabs = NULL;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gint _tmp2_;
				gint _tmp3_;
				GtkNotebook* _tmp4_;
				GtkNotebook* _tmp5_;
				GtkWidget* _tmp6_;
				GtkWidget* _tmp7_;
				GraniteWidgetsTab* _tmp8_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = granite_widgets_dynamic_notebook_get_n_tabs (self);
				_tmp3_ = _tmp2_;
				if (!(i < _tmp3_)) {
					break;
				}
				_tmp4_ = self->priv->notebook;
				_tmp5_ = self->priv->notebook;
				_tmp6_ = gtk_notebook_get_nth_page (_tmp5_, i);
				_tmp7_ = gtk_notebook_get_tab_label (_tmp4_, _tmp6_);
				_tmp8_ = _g_object_ref0 (GRANITE_WIDGETS_IS_TAB (_tmp7_) ? ((GraniteWidgetsTab*) _tmp7_) : NULL);
				self->priv->_tabs = g_list_append (self->priv->_tabs, _tmp8_);
			}
		}
	}
	_tmp9_ = self->priv->_tabs;
	result = _tmp9_;
	return result;
}

const gchar*
granite_widgets_dynamic_notebook_get_group_name (GraniteWidgetsDynamicNotebook* self)
{
	const gchar* result;
	GtkNotebook* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = gtk_notebook_get_group_name (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
granite_widgets_dynamic_notebook_set_group_name (GraniteWidgetsDynamicNotebook* self,
                                                 const gchar* value)
{
	GtkNotebook* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->notebook;
	gtk_notebook_set_group_name (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_GROUP_NAME_PROPERTY]);
}

GraniteWidgetsDynamicNotebookTabBarBehavior
granite_widgets_dynamic_notebook_get_tab_bar_behavior (GraniteWidgetsDynamicNotebook* self)
{
	GraniteWidgetsDynamicNotebookTabBarBehavior result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_tab_bar_behavior;
	return result;
}

void
granite_widgets_dynamic_notebook_set_tab_bar_behavior (GraniteWidgetsDynamicNotebook* self,
                                                       GraniteWidgetsDynamicNotebookTabBarBehavior value)
{
	g_return_if_fail (self != NULL);
	self->priv->_tab_bar_behavior = value;
	granite_widgets_dynamic_notebook_update_tabs_visibility (self);
	g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_PROPERTY]);
}

GtkMenu*
granite_widgets_dynamic_notebook_get_menu (GraniteWidgetsDynamicNotebook* self)
{
	GtkMenu* result;
	GtkMenu* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_menu;
	result = _tmp0_;
	return result;
}

static void
granite_widgets_dynamic_notebook_set_menu (GraniteWidgetsDynamicNotebook* self,
                                           GtkMenu* value)
{
	GtkMenu* old_value;
	g_return_if_fail (self != NULL);
	old_value = granite_widgets_dynamic_notebook_get_menu (self);
	if (old_value != value) {
		GtkMenu* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_menu);
		self->priv->_menu = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MENU_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_INT (GClosure * closure,
                                          GValue * return_value,
                                          guint n_param_values,
                                          const GValue * param_values,
                                          gpointer invocation_hint,
                                          gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_INT) (gpointer data1, gpointer arg_1, gint arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_int (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_INT_INT (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_INT_INT) (gpointer data1, gpointer arg_1, gint arg_2, gint arg_3, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_INT_INT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_INT_INT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_int (param_values + 2), g_value_get_int (param_values + 3), data2);
}

static void
g_cclosure_user_marshal_BOOLEAN__OBJECT (GClosure * closure,
                                         GValue * return_value,
                                         guint n_param_values,
                                         const GValue * param_values,
                                         gpointer invocation_hint,
                                         gpointer marshal_data)
{
	typedef gboolean (*GMarshalFunc_BOOLEAN__OBJECT) (gpointer data1, gpointer arg_1, gpointer data2);
	register GMarshalFunc_BOOLEAN__OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	gboolean v_return;
	cc = (GCClosure *) closure;
	g_return_if_fail (return_value != NULL);
	g_return_if_fail (n_param_values == 2);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_BOOLEAN__OBJECT) (marshal_data ? marshal_data : cc->callback);
	v_return = callback (data1, g_value_get_object (param_values + 1), data2);
	g_value_set_boolean (return_value, v_return);
}

/**
         * Create a new dynamic notebook
         */
GraniteWidgetsDynamicNotebook*
granite_widgets_dynamic_notebook_construct (GType object_type)
{
	GraniteWidgetsDynamicNotebook * self = NULL;
	GraniteAccelLabel* _tmp0_;
	GraniteAccelLabel* _tmp1_;
	GraniteAccelLabel* _tmp2_;
	GraniteAccelLabel* _tmp3_;
	_tmp0_ = granite_accel_label_new (_ ("New Tab"), NULL);
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	_tmp2_ = granite_accel_label_new (_ ("Undo Close Tab"), NULL);
	g_object_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	self = (GraniteWidgetsDynamicNotebook*) granite_widgets_dynamic_notebook_construct_with_accellabels (object_type, _tmp1_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	_g_object_unref0 (_tmp1_);
	return self;
}

GraniteWidgetsDynamicNotebook*
granite_widgets_dynamic_notebook_new (void)
{
	return granite_widgets_dynamic_notebook_construct (GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK);
}

/**
         * Create a new dynamic notebook with accellabels
         */
GraniteWidgetsDynamicNotebook*
granite_widgets_dynamic_notebook_construct_with_accellabels (GType object_type,
                                                             GraniteAccelLabel* new_tab_label,
                                                             GraniteAccelLabel* restore_tab_label)
{
	GraniteWidgetsDynamicNotebook * self = NULL;
	g_return_val_if_fail (new_tab_label != NULL, NULL);
	g_return_val_if_fail (restore_tab_label != NULL, NULL);
	self = (GraniteWidgetsDynamicNotebook*) g_object_new (object_type, "new-tab-label", new_tab_label, "restore-tab-label", restore_tab_label, NULL);
	return self;
}

GraniteWidgetsDynamicNotebook*
granite_widgets_dynamic_notebook_new_with_accellabels (GraniteAccelLabel* new_tab_label,
                                                       GraniteAccelLabel* restore_tab_label)
{
	return granite_widgets_dynamic_notebook_construct_with_accellabels (GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, new_tab_label, restore_tab_label);
}

static void
granite_widgets_dynamic_notebook_on_switch_page (GraniteWidgetsDynamicNotebook* self,
                                                 GtkWidget* page,
                                                 guint pagenum)
{
	GraniteWidgetsTab* new_tab = NULL;
	GraniteWidgetsTab* _tmp0_;
	GraniteWidgetsTab* _tmp1_;
	GraniteWidgetsTab* _tmp2_;
	GraniteWidgetsTab* _tmp3_;
	GraniteWidgetsTab* _tmp5_;
	GraniteWidgetsTab* _tmp6_;
	GraniteWidgetsTab* _tmp7_;
	GraniteWidgetsTab* _tmp8_;
	GraniteWidgetsTab* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (page != NULL);
	_tmp0_ = granite_widgets_tab_page_container_get_tab (GRANITE_WIDGETS_IS_TAB_PAGE_CONTAINER (page) ? ((GraniteWidgetsTabPageContainer*) page) : NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	new_tab = _tmp2_;
	_tmp3_ = self->priv->old_tab;
	if (_tmp3_ != NULL) {
		GraniteWidgetsTab* _tmp4_;
		_tmp4_ = self->priv->old_tab;
		granite_widgets_tab_set_is_current_tab (_tmp4_, FALSE);
	}
	_tmp5_ = new_tab;
	granite_widgets_tab_set_is_current_tab (_tmp5_, TRUE);
	_tmp6_ = self->priv->old_tab;
	_tmp7_ = new_tab;
	g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_SWITCHED_SIGNAL], 0, _tmp6_, _tmp7_);
	_tmp8_ = new_tab;
	_tmp9_ = _g_object_ref0 (_tmp8_);
	_g_object_unref0 (self->priv->old_tab);
	self->priv->old_tab = _tmp9_;
	_g_object_unref0 (new_tab);
}

static void
granite_widgets_dynamic_notebook_on_page_added (GraniteWidgetsDynamicNotebook* self,
                                                GtkWidget* page,
                                                guint pagenum)
{
	GraniteWidgetsTab* t = NULL;
	GraniteWidgetsTab* _tmp0_;
	GraniteWidgetsTab* _tmp1_;
	GraniteWidgetsTab* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (page != NULL);
	_tmp0_ = granite_widgets_tab_page_container_get_tab (GRANITE_WIDGETS_IS_TAB_PAGE_CONTAINER (page) ? ((GraniteWidgetsTabPageContainer*) page) : NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	t = _tmp2_;
	granite_widgets_dynamic_notebook_insert_callbacks (self, t);
	g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_ADDED_SIGNAL], 0, t);
	granite_widgets_dynamic_notebook_update_tabs_visibility (self);
	_g_object_unref0 (t);
}

static void
granite_widgets_dynamic_notebook_on_page_removed (GraniteWidgetsDynamicNotebook* self,
                                                  GtkWidget* page,
                                                  guint pagenum)
{
	GraniteWidgetsTab* t = NULL;
	GraniteWidgetsTab* _tmp0_;
	GraniteWidgetsTab* _tmp1_;
	GraniteWidgetsTab* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (page != NULL);
	_tmp0_ = granite_widgets_tab_page_container_get_tab (GRANITE_WIDGETS_IS_TAB_PAGE_CONTAINER (page) ? ((GraniteWidgetsTabPageContainer*) page) : NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	t = _tmp2_;
	granite_widgets_dynamic_notebook_remove_callbacks (self, t);
	g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_REMOVED_SIGNAL], 0, t);
	granite_widgets_dynamic_notebook_update_tabs_visibility (self);
	_g_object_unref0 (t);
}

static void
granite_widgets_dynamic_notebook_on_page_reordered (GraniteWidgetsDynamicNotebook* self,
                                                    GtkWidget* page,
                                                    guint pagenum)
{
	GraniteWidgetsTab* _tmp0_;
	GraniteWidgetsTab* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (page != NULL);
	_tmp0_ = granite_widgets_tab_page_container_get_tab (GRANITE_WIDGETS_IS_TAB_PAGE_CONTAINER (page) ? ((GraniteWidgetsTabPageContainer*) page) : NULL);
	_tmp1_ = _tmp0_;
	g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_REORDERED_SIGNAL], 0, _tmp1_, (gint) pagenum);
	granite_widgets_dynamic_notebook_recalc_order (self);
}

static GtkNotebook*
granite_widgets_dynamic_notebook_on_create_window (GraniteWidgetsDynamicNotebook* self,
                                                   GtkWidget* page,
                                                   gint x,
                                                   gint y)
{
	GraniteWidgetsTab* tab = NULL;
	GtkNotebook* _tmp0_;
	GtkWidget* _tmp1_;
	GraniteWidgetsTab* _tmp2_;
	GtkNotebook* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (page != NULL, NULL);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = gtk_notebook_get_tab_label (_tmp0_, page);
	_tmp2_ = _g_object_ref0 (GRANITE_WIDGETS_IS_TAB (_tmp1_) ? ((GraniteWidgetsTab*) _tmp1_) : NULL);
	tab = _tmp2_;
	g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_MOVED_SIGNAL], 0, tab, x, y);
	granite_widgets_dynamic_notebook_recalc_order (self);
	result = G_TYPE_CHECK_INSTANCE_CAST (NULL, gtk_notebook_get_type (), GtkNotebook);
	_g_object_unref0 (tab);
	return result;
}

static void
granite_widgets_dynamic_notebook_recalc_order (GraniteWidgetsDynamicNotebook* self)
{
	gboolean _tmp0_ = FALSE;
	gint _tmp1_;
	gint _tmp2_;
	gint pinned_tabs = 0;
	g_return_if_fail (self != NULL);
	_tmp1_ = granite_widgets_dynamic_notebook_get_n_tabs (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == 0) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp3_ = granite_widgets_dynamic_notebook_get_force_left (self);
		_tmp4_ = _tmp3_;
		_tmp0_ = !_tmp4_;
	}
	if (_tmp0_) {
		return;
	}
	pinned_tabs = 0;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				GtkNotebook* _tmp7_;
				GtkNotebook* _tmp8_;
				GtkNotebook* _tmp9_;
				GtkWidget* _tmp10_;
				GtkWidget* _tmp11_;
				gboolean _tmp12_;
				gboolean _tmp13_;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				_tmp7_ = self->priv->notebook;
				if (!(i < gtk_notebook_get_n_pages (_tmp7_))) {
					break;
				}
				_tmp8_ = self->priv->notebook;
				_tmp9_ = self->priv->notebook;
				_tmp10_ = gtk_notebook_get_nth_page (_tmp9_, i);
				_tmp11_ = gtk_notebook_get_tab_label (_tmp8_, _tmp10_);
				_tmp12_ = granite_widgets_tab_get_pinned (GRANITE_WIDGETS_IS_TAB (_tmp11_) ? ((GraniteWidgetsTab*) _tmp11_) : NULL);
				_tmp13_ = _tmp12_;
				if (_tmp13_) {
					gint _tmp14_;
					_tmp14_ = pinned_tabs;
					pinned_tabs = _tmp14_ + 1;
				}
			}
		}
	}
	{
		gint p = 0;
		p = 0;
		{
			gboolean _tmp15_ = FALSE;
			_tmp15_ = TRUE;
			while (TRUE) {
				gint sel = 0;
				if (!_tmp15_) {
					gint _tmp16_;
					_tmp16_ = p;
					p = _tmp16_ + 1;
				}
				_tmp15_ = FALSE;
				if (!(p < pinned_tabs)) {
					break;
				}
				sel = p;
				{
					gint i = 0;
					i = p;
					{
						gboolean _tmp17_ = FALSE;
						_tmp17_ = TRUE;
						while (TRUE) {
							GtkNotebook* _tmp19_;
							GtkNotebook* _tmp20_;
							GtkNotebook* _tmp21_;
							GtkWidget* _tmp22_;
							GtkWidget* _tmp23_;
							gboolean _tmp24_;
							gboolean _tmp25_;
							if (!_tmp17_) {
								gint _tmp18_;
								_tmp18_ = i;
								i = _tmp18_ + 1;
							}
							_tmp17_ = FALSE;
							_tmp19_ = self->priv->notebook;
							if (!(i < gtk_notebook_get_n_pages (_tmp19_))) {
								break;
							}
							_tmp20_ = self->priv->notebook;
							_tmp21_ = self->priv->notebook;
							_tmp22_ = gtk_notebook_get_nth_page (_tmp21_, i);
							_tmp23_ = gtk_notebook_get_tab_label (_tmp20_, _tmp22_);
							_tmp24_ = granite_widgets_tab_get_pinned (GRANITE_WIDGETS_IS_TAB (_tmp23_) ? ((GraniteWidgetsTab*) _tmp23_) : NULL);
							_tmp25_ = _tmp24_;
							if (_tmp25_) {
								sel = i;
								break;
							}
						}
					}
				}
				if (sel != p) {
					GtkNotebook* _tmp26_;
					GtkNotebook* _tmp27_;
					GtkWidget* _tmp28_;
					_tmp26_ = self->priv->notebook;
					_tmp27_ = self->priv->notebook;
					_tmp28_ = gtk_notebook_get_nth_page (_tmp27_, sel);
					gtk_notebook_reorder_child (_tmp26_, _tmp28_, p);
				}
			}
		}
	}
}

static void
granite_widgets_dynamic_notebook_recalc_size (GraniteWidgetsDynamicNotebook* self)
{
	gint _tmp0_;
	gint _tmp1_;
	gint pinned_tabs = 0;
	gint unpinned_tabs = 0;
	GList* _tmp14_;
	GList* _tmp15_;
	GList* _tmp16_;
	GtkNotebook* _tmp22_;
	g_return_if_fail (self != NULL);
	_tmp0_ = granite_widgets_dynamic_notebook_get_n_tabs (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == 0) {
		return;
	}
	pinned_tabs = 0;
	unpinned_tabs = 0;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				gint _tmp4_;
				gint _tmp5_;
				GtkNotebook* _tmp6_;
				GtkNotebook* _tmp7_;
				GtkWidget* _tmp8_;
				GtkWidget* _tmp9_;
				gboolean _tmp10_;
				gboolean _tmp11_;
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = i;
					i = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				_tmp4_ = granite_widgets_dynamic_notebook_get_n_tabs (self);
				_tmp5_ = _tmp4_;
				if (!(i < _tmp5_)) {
					break;
				}
				_tmp6_ = self->priv->notebook;
				_tmp7_ = self->priv->notebook;
				_tmp8_ = gtk_notebook_get_nth_page (_tmp7_, i);
				_tmp9_ = gtk_notebook_get_tab_label (_tmp6_, _tmp8_);
				_tmp10_ = granite_widgets_tab_get_pinned (GRANITE_WIDGETS_IS_TAB (_tmp9_) ? ((GraniteWidgetsTab*) _tmp9_) : NULL);
				_tmp11_ = _tmp10_;
				if (_tmp11_) {
					gint _tmp12_;
					_tmp12_ = pinned_tabs;
					pinned_tabs = _tmp12_ + 1;
				} else {
					gint _tmp13_;
					_tmp13_ = unpinned_tabs;
					unpinned_tabs = _tmp13_ + 1;
				}
			}
		}
	}
	if (unpinned_tabs != 0) {
		gint offset = 0;
		offset = 130;
		self->priv->tab_width = ((gtk_widget_get_allocated_width ((GtkWidget*) self) - offset) - (pinned_tabs * GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_WIDTH_PINNED)) / unpinned_tabs;
		if (self->priv->tab_width > GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MAX_TAB_WIDTH) {
			self->priv->tab_width = GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MAX_TAB_WIDTH;
		} else {
			if (self->priv->tab_width < GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MIN_TAB_WIDTH) {
				self->priv->tab_width = GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MIN_TAB_WIDTH;
			}
		}
	}
	_tmp14_ = granite_widgets_dynamic_notebook_get_tabs (self);
	_tmp15_ = _tmp14_;
	_tmp16_ = g_list_copy (_tmp15_);
	{
		GList* tab_collection = NULL;
		GList* tab_it = NULL;
		tab_collection = _tmp16_;
		for (tab_it = tab_collection; tab_it != NULL; tab_it = tab_it->next) {
			GraniteWidgetsTab* tab = NULL;
			tab = (GraniteWidgetsTab*) tab_it->data;
			{
				gint _tmp17_ = 0;
				GraniteWidgetsTab* _tmp18_;
				gboolean _tmp19_;
				gboolean _tmp20_;
				GraniteWidgetsTab* _tmp21_;
				_tmp18_ = tab;
				_tmp19_ = granite_widgets_tab_get_pinned (_tmp18_);
				_tmp20_ = _tmp19_;
				if (_tmp20_) {
					_tmp17_ = GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_WIDTH_PINNED;
				} else {
					_tmp17_ = self->priv->tab_width;
				}
				_tmp21_ = tab;
				g_object_set ((GtkWidget*) _tmp21_, "width-request", _tmp17_, NULL);
			}
		}
		(tab_collection == NULL) ? NULL : (tab_collection = (g_list_free (tab_collection), NULL));
	}
	_tmp22_ = self->priv->notebook;
	gtk_container_resize_children ((GtkContainer*) _tmp22_);
}

static void
granite_widgets_dynamic_notebook_restore_last_tab (GraniteWidgetsDynamicNotebook* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GraniteWidgetsClosedTabsEntry restored = {0};
	GraniteWidgetsClosedTabs* _tmp6_;
	GraniteWidgetsClosedTabsEntry _tmp7_ = {0};
	GtkButton* _tmp8_;
	GraniteWidgetsClosedTabs* _tmp9_;
	gboolean _tmp10_;
	gboolean _tmp11_;
	GtkMenuItem* _tmp12_;
	GraniteWidgetsClosedTabs* _tmp13_;
	gboolean _tmp14_;
	gboolean _tmp15_;
	GraniteWidgetsClosedTabsEntry _tmp16_;
	const gchar* _tmp17_;
	GraniteWidgetsClosedTabsEntry _tmp18_;
	const gchar* _tmp19_;
	GraniteWidgetsClosedTabsEntry _tmp20_;
	GIcon* _tmp21_;
	g_return_if_fail (self != NULL);
	_tmp1_ = granite_widgets_dynamic_notebook_get_allow_restoring (self);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		_tmp0_ = TRUE;
	} else {
		GraniteWidgetsClosedTabs* _tmp3_;
		gboolean _tmp4_;
		gboolean _tmp5_;
		_tmp3_ = self->priv->closed_tabs;
		_tmp4_ = granite_widgets_closed_tabs_get_empty (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp0_ = _tmp5_;
	}
	if (_tmp0_) {
		return;
	}
	_tmp6_ = self->priv->closed_tabs;
	granite_widgets_closed_tabs_pop (_tmp6_, &_tmp7_);
	restored = _tmp7_;
	_tmp8_ = self->priv->restore_button;
	_tmp9_ = self->priv->closed_tabs;
	_tmp10_ = granite_widgets_closed_tabs_get_empty (_tmp9_);
	_tmp11_ = _tmp10_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp8_, !_tmp11_);
	_tmp12_ = self->priv->restore_tab_m;
	_tmp13_ = self->priv->closed_tabs;
	_tmp14_ = granite_widgets_closed_tabs_get_empty (_tmp13_);
	_tmp15_ = _tmp14_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp12_, !_tmp15_);
	_tmp16_ = restored;
	_tmp17_ = _tmp16_.label;
	_tmp18_ = restored;
	_tmp19_ = _tmp18_.restore_data;
	_tmp20_ = restored;
	_tmp21_ = _tmp20_.icon;
	g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_RESTORED_SIGNAL], 0, _tmp17_, _tmp19_, _tmp21_);
	granite_widgets_closed_tabs_entry_destroy (&restored);
}

static void
granite_widgets_dynamic_notebook_switch_pin_tab (GraniteWidgetsDynamicNotebook* self,
                                                 GraniteWidgetsTab* tab)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tab != NULL);
	_tmp0_ = granite_widgets_dynamic_notebook_get_allow_pinning (self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		return;
	}
	granite_widgets_dynamic_notebook_recalc_order (self);
	granite_widgets_dynamic_notebook_recalc_size (self);
}

void
granite_widgets_dynamic_notebook_remove_tab (GraniteWidgetsDynamicNotebook* self,
                                             GraniteWidgetsTab* tab)
{
	gint pos = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tab != NULL);
	pos = granite_widgets_dynamic_notebook_get_tab_position (self, tab);
	if (pos != -1) {
		GtkNotebook* _tmp0_;
		_tmp0_ = self->priv->notebook;
		gtk_notebook_remove_page (_tmp0_, pos);
	}
}

void
granite_widgets_dynamic_notebook_next_page (GraniteWidgetsDynamicNotebook* self)
{
	GtkNotebook* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GtkNotebook* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->notebook;
	g_object_get (_tmp0_, "page", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->notebook;
	if ((_tmp2_ + 1) >= gtk_notebook_get_n_pages (_tmp3_)) {
		GtkNotebook* _tmp4_;
		_tmp4_ = self->priv->notebook;
		g_object_set (_tmp4_, "page", 0, NULL);
	} else {
		GtkNotebook* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		_tmp5_ = self->priv->notebook;
		g_object_get (_tmp5_, "page", &_tmp6_, NULL);
		_tmp7_ = _tmp6_;
		g_object_set (_tmp5_, "page", _tmp7_ + 1, NULL);
	}
}

void
granite_widgets_dynamic_notebook_previous_page (GraniteWidgetsDynamicNotebook* self)
{
	gint _tmp0_ = 0;
	GtkNotebook* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	GtkNotebook* _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->notebook;
	g_object_get (_tmp1_, "page", &_tmp2_, NULL);
	_tmp3_ = _tmp2_;
	if ((_tmp3_ - 1) < 0) {
		GtkNotebook* _tmp4_;
		GtkNotebook* _tmp5_;
		_tmp4_ = self->priv->notebook;
		_tmp5_ = self->priv->notebook;
		g_object_set (_tmp4_, "page", gtk_notebook_get_n_pages (_tmp5_) - 1, NULL);
		_tmp0_ = gtk_notebook_get_n_pages (_tmp5_) - 1;
	} else {
		GtkNotebook* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		_tmp6_ = self->priv->notebook;
		g_object_get (_tmp6_, "page", &_tmp7_, NULL);
		_tmp8_ = _tmp7_;
		_tmp0_ = _tmp8_ - 1;
	}
	_tmp9_ = self->priv->notebook;
	g_object_set (_tmp9_, "page", _tmp0_, NULL);
}

static void
granite_widgets_dynamic_notebook_real_show (GtkWidget* base)
{
	GraniteWidgetsDynamicNotebook * self;
	GtkNotebook* _tmp0_;
	self = (GraniteWidgetsDynamicNotebook*) base;
	GTK_WIDGET_CLASS (granite_widgets_dynamic_notebook_parent_class)->show ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_event_box_get_type (), GtkEventBox));
	_tmp0_ = self->priv->notebook;
	gtk_widget_show ((GtkWidget*) _tmp0_);
}

GList*
granite_widgets_dynamic_notebook_get_children (GraniteWidgetsDynamicNotebook* self)
{
	GList* list = NULL;
	GtkNotebook* _tmp0_;
	GList* _tmp1_;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	list = NULL;
	_tmp0_ = self->priv->notebook;
	_tmp1_ = gtk_container_get_children ((GtkContainer*) _tmp0_);
	{
		GList* child_collection = NULL;
		GList* child_it = NULL;
		child_collection = _tmp1_;
		for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
			GtkWidget* child = NULL;
			child = (GtkWidget*) child_it->data;
			{
				GtkWidget* _tmp2_;
				GList* _tmp3_;
				GList* _tmp4_;
				gconstpointer _tmp5_;
				GtkWidget* _tmp6_;
				_tmp2_ = child;
				_tmp3_ = gtk_container_get_children (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, gtk_container_get_type ()) ? ((GtkContainer*) _tmp2_) : NULL);
				_tmp4_ = _tmp3_;
				_tmp5_ = g_list_nth_data (_tmp4_, (guint) 0);
				_tmp6_ = _g_object_ref0 ((GtkWidget*) _tmp5_);
				list = g_list_append (list, _tmp6_);
				(_tmp4_ == NULL) ? NULL : (_tmp4_ = (g_list_free (_tmp4_), NULL));
			}
		}
		(child_collection == NULL) ? NULL : (child_collection = (g_list_free (child_collection), NULL));
	}
	result = list;
	return result;
}

gint
granite_widgets_dynamic_notebook_get_tab_position (GraniteWidgetsDynamicNotebook* self,
                                                   GraniteWidgetsTab* tab)
{
	GtkNotebook* _tmp0_;
	GraniteWidgetsTabPageContainer* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (tab != NULL, 0);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = tab->page_container;
	result = gtk_notebook_page_num (_tmp0_, (GtkWidget*) _tmp1_);
	return result;
}

void
granite_widgets_dynamic_notebook_set_tab_position (GraniteWidgetsDynamicNotebook* self,
                                                   GraniteWidgetsTab* tab,
                                                   gint position)
{
	GtkNotebook* _tmp0_;
	GraniteWidgetsTabPageContainer* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tab != NULL);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = tab->page_container;
	gtk_notebook_reorder_child (_tmp0_, (GtkWidget*) _tmp1_, position);
	g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_REORDERED_SIGNAL], 0, tab, position);
	granite_widgets_dynamic_notebook_recalc_order (self);
}

GraniteWidgetsTab*
granite_widgets_dynamic_notebook_get_tab_by_index (GraniteWidgetsDynamicNotebook* self,
                                                   gint index)
{
	GtkNotebook* _tmp0_;
	GtkNotebook* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	GraniteWidgetsTab* _tmp4_;
	GraniteWidgetsTab* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = self->priv->notebook;
	_tmp2_ = gtk_notebook_get_nth_page (_tmp1_, index);
	_tmp3_ = gtk_notebook_get_tab_label (_tmp0_, _tmp2_);
	_tmp4_ = _g_object_ref0 (GRANITE_WIDGETS_IS_TAB (_tmp3_) ? ((GraniteWidgetsTab*) _tmp3_) : NULL);
	result = _tmp4_;
	return result;
}

GraniteWidgetsTab*
granite_widgets_dynamic_notebook_get_tab_by_widget (GraniteWidgetsDynamicNotebook* self,
                                                    GtkWidget* widget)
{
	GtkNotebook* _tmp0_;
	GtkContainer* _tmp1_;
	GtkWidget* _tmp2_;
	GraniteWidgetsTab* _tmp3_;
	GraniteWidgetsTab* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (widget != NULL, NULL);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = gtk_widget_get_parent (widget);
	_tmp2_ = gtk_notebook_get_tab_label (_tmp0_, (GtkWidget*) _tmp1_);
	_tmp3_ = _g_object_ref0 (GRANITE_WIDGETS_IS_TAB (_tmp2_) ? ((GraniteWidgetsTab*) _tmp2_) : NULL);
	result = _tmp3_;
	return result;
}

GtkWidget*
granite_widgets_dynamic_notebook_get_nth_page (GraniteWidgetsDynamicNotebook* self,
                                               gint index)
{
	GtkNotebook* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = gtk_notebook_get_nth_page (_tmp0_, index);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

guint
granite_widgets_dynamic_notebook_insert_tab (GraniteWidgetsDynamicNotebook* self,
                                             GraniteWidgetsTab* tab,
                                             gint index)
{
	GList* _tmp0_;
	GList* _tmp1_;
	gint _tmp2_ = 0;
	GtkNotebook* _tmp5_;
	GraniteWidgetsTabPageContainer* _tmp6_;
	GtkNotebook* _tmp7_;
	GraniteWidgetsTabPageContainer* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	GtkNotebook* _tmp11_;
	GraniteWidgetsTabPageContainer* _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp14_;
	GtkMenuItem* _tmp15_;
	gboolean _tmp16_;
	gboolean _tmp17_;
	GtkMenuItem* _tmp18_;
	gboolean _tmp19_;
	gboolean _tmp20_;
	GtkMenuItem* _tmp21_;
	gboolean _tmp22_;
	gboolean _tmp23_;
	gboolean _tmp24_;
	gboolean _tmp25_;
	gboolean _tmp26_;
	gboolean _tmp27_;
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	g_return_val_if_fail (tab != NULL, 0U);
	_tmp0_ = granite_widgets_dynamic_notebook_get_tabs (self);
	_tmp1_ = _tmp0_;
	g_return_val_if_fail (g_list_index (_tmp1_, tab) < 0, 0);
	if (index <= -1) {
		gint _tmp3_;
		gint _tmp4_;
		_tmp3_ = granite_widgets_dynamic_notebook_get_n_tabs (self);
		_tmp4_ = _tmp3_;
		_tmp2_ = _tmp4_;
	} else {
		_tmp2_ = index;
	}
	_tmp5_ = self->priv->notebook;
	_tmp6_ = tab->page_container;
	index = gtk_notebook_insert_page (_tmp5_, (GtkWidget*) _tmp6_, (GtkWidget*) tab, _tmp2_);
	_tmp7_ = self->priv->notebook;
	_tmp8_ = tab->page_container;
	_tmp9_ = granite_widgets_dynamic_notebook_get_allow_drag (self);
	_tmp10_ = _tmp9_;
	gtk_notebook_set_tab_reorderable (_tmp7_, (GtkWidget*) _tmp8_, _tmp10_);
	_tmp11_ = self->priv->notebook;
	_tmp12_ = tab->page_container;
	_tmp13_ = granite_widgets_dynamic_notebook_get_allow_new_window (self);
	_tmp14_ = _tmp13_;
	gtk_notebook_set_tab_detachable (_tmp11_, (GtkWidget*) _tmp12_, _tmp14_);
	_tmp15_ = tab->duplicate_m;
	_tmp16_ = granite_widgets_dynamic_notebook_get_allow_duplication (self);
	_tmp17_ = _tmp16_;
	gtk_widget_set_visible ((GtkWidget*) _tmp15_, _tmp17_);
	_tmp18_ = tab->new_window_m;
	_tmp19_ = granite_widgets_dynamic_notebook_get_allow_new_window (self);
	_tmp20_ = _tmp19_;
	gtk_widget_set_visible ((GtkWidget*) _tmp18_, _tmp20_);
	_tmp21_ = tab->pin_m;
	_tmp22_ = granite_widgets_dynamic_notebook_get_allow_pinning (self);
	_tmp23_ = _tmp22_;
	gtk_widget_set_visible ((GtkWidget*) _tmp21_, _tmp23_);
	_tmp24_ = granite_widgets_dynamic_notebook_get_allow_pinning (self);
	_tmp25_ = _tmp24_;
	granite_widgets_tab_set_pinnable (tab, _tmp25_);
	granite_widgets_tab_set_pinned (tab, FALSE);
	g_object_set ((GtkWidget*) tab, "width-request", self->priv->tab_width, NULL);
	granite_widgets_dynamic_notebook_recalc_size (self);
	granite_widgets_dynamic_notebook_recalc_order (self);
	_tmp26_ = granite_widgets_dynamic_notebook_get_tabs_closable (self);
	_tmp27_ = _tmp26_;
	if (!_tmp27_) {
		granite_widgets_tab_set_closable (tab, FALSE);
	}
	result = (guint) index;
	return result;
}

 G_GNUC_INTERNAL void
granite_widgets_dynamic_notebook_close_tab_and_keep_width (GraniteWidgetsDynamicNotebook* self,
                                                           GraniteWidgetsTab* clicked_tab)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (clicked_tab != NULL);
	self->priv->wait_to_recalc_size = TRUE;
	g_signal_emit (clicked_tab, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_CLOSED_SIGNAL], 0);
}

 G_GNUC_INTERNAL void
granite_widgets_dynamic_notebook_check_to_recalc_size (GraniteWidgetsDynamicNotebook* self)
{
	g_return_if_fail (self != NULL);
	if (!self->priv->wait_to_recalc_size) {
		return;
	}
	granite_widgets_dynamic_notebook_recalc_size (self);
	self->priv->wait_to_recalc_size = FALSE;
}

static void
_granite_widgets_dynamic_notebook_on_tab_closed_granite_widgets_tab_closed (GraniteWidgetsTab* _sender,
                                                                            gpointer self)
{
	granite_widgets_dynamic_notebook_on_tab_closed ((GraniteWidgetsDynamicNotebook*) self, _sender);
}

static void
_granite_widgets_dynamic_notebook_on_close_others_granite_widgets_tab_close_others (GraniteWidgetsTab* _sender,
                                                                                    gpointer self)
{
	granite_widgets_dynamic_notebook_on_close_others ((GraniteWidgetsDynamicNotebook*) self, _sender);
}

static void
_granite_widgets_dynamic_notebook_on_close_others_right_granite_widgets_tab_close_others_right (GraniteWidgetsTab* _sender,
                                                                                                gpointer self)
{
	granite_widgets_dynamic_notebook_on_close_others_right ((GraniteWidgetsDynamicNotebook*) self, _sender);
}

static void
_granite_widgets_dynamic_notebook_on_new_window_granite_widgets_tab_new_window (GraniteWidgetsTab* _sender,
                                                                                gpointer self)
{
	granite_widgets_dynamic_notebook_on_new_window ((GraniteWidgetsDynamicNotebook*) self, _sender);
}

static void
_granite_widgets_dynamic_notebook_on_duplicate_granite_widgets_tab_duplicate (GraniteWidgetsTab* _sender,
                                                                              gpointer self)
{
	granite_widgets_dynamic_notebook_on_duplicate ((GraniteWidgetsDynamicNotebook*) self, _sender);
}

static void
_granite_widgets_dynamic_notebook_on_pin_switch_granite_widgets_tab_pin_switch (GraniteWidgetsTab* _sender,
                                                                                gpointer self)
{
	granite_widgets_dynamic_notebook_on_pin_switch ((GraniteWidgetsDynamicNotebook*) self, _sender);
}

static void
granite_widgets_dynamic_notebook_insert_callbacks (GraniteWidgetsDynamicNotebook* self,
                                                   GraniteWidgetsTab* tab)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (tab != NULL);
	g_signal_connect_object (tab, "closed", (GCallback) _granite_widgets_dynamic_notebook_on_tab_closed_granite_widgets_tab_closed, self, 0);
	g_signal_connect_object (tab, "close-others", (GCallback) _granite_widgets_dynamic_notebook_on_close_others_granite_widgets_tab_close_others, self, 0);
	g_signal_connect_object (tab, "close-others-right", (GCallback) _granite_widgets_dynamic_notebook_on_close_others_right_granite_widgets_tab_close_others_right, self, 0);
	g_signal_connect_object (tab, "new-window", (GCallback) _granite_widgets_dynamic_notebook_on_new_window_granite_widgets_tab_new_window, self, 0);
	g_signal_connect_object (tab, "duplicate", (GCallback) _granite_widgets_dynamic_notebook_on_duplicate_granite_widgets_tab_duplicate, self, 0);
	g_signal_connect_object (tab, "pin-switch", (GCallback) _granite_widgets_dynamic_notebook_on_pin_switch_granite_widgets_tab_pin_switch, self, 0);
}

static void
granite_widgets_dynamic_notebook_remove_callbacks (GraniteWidgetsDynamicNotebook* self,
                                                   GraniteWidgetsTab* tab)
{
	guint _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	guint _tmp3_;
	guint _tmp4_;
	guint _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tab != NULL);
	g_signal_parse_name ("closed", GRANITE_WIDGETS_TYPE_TAB, &_tmp0_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (tab, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _granite_widgets_dynamic_notebook_on_tab_closed_granite_widgets_tab_closed, self);
	g_signal_parse_name ("close-others", GRANITE_WIDGETS_TYPE_TAB, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (tab, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _granite_widgets_dynamic_notebook_on_close_others_granite_widgets_tab_close_others, self);
	g_signal_parse_name ("close-others-right", GRANITE_WIDGETS_TYPE_TAB, &_tmp2_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (tab, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _granite_widgets_dynamic_notebook_on_close_others_right_granite_widgets_tab_close_others_right, self);
	g_signal_parse_name ("new-window", GRANITE_WIDGETS_TYPE_TAB, &_tmp3_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (tab, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _granite_widgets_dynamic_notebook_on_new_window_granite_widgets_tab_new_window, self);
	g_signal_parse_name ("duplicate", GRANITE_WIDGETS_TYPE_TAB, &_tmp4_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (tab, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _granite_widgets_dynamic_notebook_on_duplicate_granite_widgets_tab_duplicate, self);
	g_signal_parse_name ("pin-switch", GRANITE_WIDGETS_TYPE_TAB, &_tmp5_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (tab, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _granite_widgets_dynamic_notebook_on_pin_switch_granite_widgets_tab_pin_switch, self);
}

static void
granite_widgets_dynamic_notebook_on_tab_closed (GraniteWidgetsDynamicNotebook* self,
                                                GraniteWidgetsTab* tab)
{
	gint pos = 0;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp7_ = FALSE;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tab != NULL);
	if (g_signal_has_handler_pending (self, g_signal_lookup ("close-tab-requested", GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK), (GQuark) 0, TRUE)) {
		gboolean sure = FALSE;
		gboolean _tmp0_ = FALSE;
		g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_CLOSE_TAB_REQUESTED_SIGNAL], 0, tab, &_tmp0_);
		sure = _tmp0_;
		if (!sure) {
			return;
		}
	}
	pos = granite_widgets_dynamic_notebook_get_tab_position (self, tab);
	granite_widgets_dynamic_notebook_remove_tab (self, tab);
	if (pos != -1) {
		GtkWidget* _tmp2_;
		GtkWidget* _tmp3_;
		GtkContainer* _tmp4_;
		_tmp2_ = granite_widgets_tab_get_page (tab);
		_tmp3_ = _tmp2_;
		_tmp4_ = gtk_widget_get_parent (_tmp3_);
		_tmp1_ = _tmp4_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		_tmp5_ = granite_widgets_tab_get_page (tab);
		_tmp6_ = _tmp5_;
		gtk_widget_unparent (_tmp6_);
	}
	_tmp8_ = granite_widgets_tab_get_label (tab);
	_tmp9_ = _tmp8_;
	if (g_strcmp0 (_tmp9_, "") != 0) {
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp10_ = granite_widgets_tab_get_restore_data (tab);
		_tmp11_ = _tmp10_;
		_tmp7_ = g_strcmp0 (_tmp11_, "") != 0;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		GraniteWidgetsClosedTabs* _tmp12_;
		GtkButton* _tmp13_;
		GraniteWidgetsClosedTabs* _tmp14_;
		gboolean _tmp15_;
		gboolean _tmp16_;
		GtkMenuItem* _tmp17_;
		GraniteWidgetsClosedTabs* _tmp18_;
		gboolean _tmp19_;
		gboolean _tmp20_;
		_tmp12_ = self->priv->closed_tabs;
		granite_widgets_closed_tabs_push (_tmp12_, tab);
		_tmp13_ = self->priv->restore_button;
		_tmp14_ = self->priv->closed_tabs;
		_tmp15_ = granite_widgets_closed_tabs_get_empty (_tmp14_);
		_tmp16_ = _tmp15_;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp13_, !_tmp16_);
		_tmp17_ = self->priv->restore_tab_m;
		_tmp18_ = self->priv->closed_tabs;
		_tmp19_ = granite_widgets_closed_tabs_get_empty (_tmp18_);
		_tmp20_ = _tmp19_;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp17_, !_tmp20_);
	}
}

static Block8Data*
block8_data_ref (Block8Data* _data8_)
{
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		GraniteWidgetsDynamicNotebook* self;
		self = _data8_->self;
		_g_object_unref0 (_data8_->clicked_tab);
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

static void
__lambda24_ (Block8Data* _data8_,
             GraniteWidgetsTab* tab)
{
	GraniteWidgetsDynamicNotebook* self;
	self = _data8_->self;
	g_return_if_fail (tab != NULL);
	if (tab != _data8_->clicked_tab) {
		g_signal_emit (tab, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_CLOSED_SIGNAL], 0);
	}
}

static void
___lambda24__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda24_ (self, (GraniteWidgetsTab*) data);
}

static void
granite_widgets_dynamic_notebook_on_close_others (GraniteWidgetsDynamicNotebook* self,
                                                  GraniteWidgetsTab* clicked_tab)
{
	Block8Data* _data8_;
	GraniteWidgetsTab* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	GList* _tmp3_;
	GList* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (clicked_tab != NULL);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (clicked_tab);
	_g_object_unref0 (_data8_->clicked_tab);
	_data8_->clicked_tab = _tmp0_;
	_tmp1_ = granite_widgets_dynamic_notebook_get_tabs (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_list_copy (_tmp2_);
	_tmp4_ = _tmp3_;
	g_list_foreach (_tmp4_, ___lambda24__gfunc, _data8_);
	(_tmp4_ == NULL) ? NULL : (_tmp4_ = (g_list_free (_tmp4_), NULL));
	block8_data_unref (_data8_);
	_data8_ = NULL;
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		GraniteWidgetsDynamicNotebook* self;
		self = _data9_->self;
		_g_object_unref0 (_data9_->clicked_tab);
		_g_object_unref0 (self);
		g_slice_free (Block9Data, _data9_);
	}
}

static void
__lambda25_ (Block9Data* _data9_,
             GraniteWidgetsTab* tab)
{
	GraniteWidgetsDynamicNotebook* self;
	self = _data9_->self;
	g_return_if_fail (tab != NULL);
	if (_data9_->is_to_the_right) {
		g_signal_emit (tab, granite_widgets_tab_signals[GRANITE_WIDGETS_TAB_CLOSED_SIGNAL], 0);
	}
	if (tab == _data9_->clicked_tab) {
		_data9_->is_to_the_right = TRUE;
	}
}

static void
___lambda25__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda25_ (self, (GraniteWidgetsTab*) data);
}

static void
granite_widgets_dynamic_notebook_on_close_others_right (GraniteWidgetsDynamicNotebook* self,
                                                        GraniteWidgetsTab* clicked_tab)
{
	Block9Data* _data9_;
	GraniteWidgetsTab* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	GList* _tmp3_;
	GList* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (clicked_tab != NULL);
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_data9_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (clicked_tab);
	_g_object_unref0 (_data9_->clicked_tab);
	_data9_->clicked_tab = _tmp0_;
	_data9_->is_to_the_right = FALSE;
	_tmp1_ = granite_widgets_dynamic_notebook_get_tabs (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_list_copy (_tmp2_);
	_tmp4_ = _tmp3_;
	g_list_foreach (_tmp4_, ___lambda25__gfunc, _data9_);
	(_tmp4_ == NULL) ? NULL : (_tmp4_ = (g_list_free (_tmp4_), NULL));
	block9_data_unref (_data9_);
	_data9_ = NULL;
}

static void
granite_widgets_dynamic_notebook_on_new_window (GraniteWidgetsDynamicNotebook* self,
                                                GraniteWidgetsTab* tab)
{
	GtkNotebook* _tmp0_;
	GraniteWidgetsTabPageContainer* _tmp1_;
	GtkNotebook* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tab != NULL);
	_tmp0_ = self->priv->notebook;
	_tmp1_ = tab->page_container;
	g_signal_emit_by_name (_tmp0_, "create-window", (GtkWidget*) _tmp1_, 0, 0, &_tmp2_);
}

static void
granite_widgets_dynamic_notebook_on_duplicate (GraniteWidgetsDynamicNotebook* self,
                                               GraniteWidgetsTab* tab)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (tab != NULL);
	g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_DUPLICATED_SIGNAL], 0, tab);
}

static void
granite_widgets_dynamic_notebook_on_pin_switch (GraniteWidgetsDynamicNotebook* self,
                                                GraniteWidgetsTab* tab)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (tab != NULL);
	granite_widgets_dynamic_notebook_switch_pin_tab (self, tab);
}

static void
granite_widgets_dynamic_notebook_update_tabs_visibility (GraniteWidgetsDynamicNotebook* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_tab_bar_behavior == GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_SINGLE) {
		GtkNotebook* _tmp0_;
		gint _tmp1_;
		gint _tmp2_;
		_tmp0_ = self->priv->notebook;
		_tmp1_ = granite_widgets_dynamic_notebook_get_n_tabs (self);
		_tmp2_ = _tmp1_;
		gtk_notebook_set_show_tabs (_tmp0_, _tmp2_ > 1);
	} else {
		if (self->priv->_tab_bar_behavior == GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_NEVER) {
			GtkNotebook* _tmp3_;
			_tmp3_ = self->priv->notebook;
			gtk_notebook_set_show_tabs (_tmp3_, FALSE);
		} else {
			if (self->priv->_tab_bar_behavior == GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_ALWAYS) {
				GtkNotebook* _tmp4_;
				_tmp4_ = self->priv->notebook;
				gtk_notebook_set_show_tabs (_tmp4_, TRUE);
			}
		}
	}
}

static void
_granite_widgets_dynamic_notebook___lambda29_ (GraniteWidgetsDynamicNotebook* self)
{
	g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_REQUESTED_SIGNAL], 0);
}

static void
__granite_widgets_dynamic_notebook___lambda29__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                                       gpointer self)
{
	_granite_widgets_dynamic_notebook___lambda29_ ((GraniteWidgetsDynamicNotebook*) self);
}

static void
_granite_widgets_dynamic_notebook___lambda30_ (GraniteWidgetsDynamicNotebook* self)
{
	granite_widgets_dynamic_notebook_restore_last_tab (self);
}

static void
__granite_widgets_dynamic_notebook___lambda30__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                                       gpointer self)
{
	_granite_widgets_dynamic_notebook___lambda30_ ((GraniteWidgetsDynamicNotebook*) self);
}

static void
_granite_widgets_dynamic_notebook___lambda31_ (GraniteWidgetsDynamicNotebook* self,
                                               const gchar* label,
                                               const gchar* restore_data,
                                               GIcon* icon)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	GtkButton* _tmp2_;
	GraniteWidgetsClosedTabs* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	GtkMenuItem* _tmp6_;
	GraniteWidgetsClosedTabs* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	g_return_if_fail (label != NULL);
	g_return_if_fail (restore_data != NULL);
	_tmp0_ = granite_widgets_dynamic_notebook_get_allow_restoring (self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		return;
	}
	_tmp2_ = self->priv->restore_button;
	_tmp3_ = self->priv->closed_tabs;
	_tmp4_ = granite_widgets_closed_tabs_get_empty (_tmp3_);
	_tmp5_ = _tmp4_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp2_, !_tmp5_);
	_tmp6_ = self->priv->restore_tab_m;
	_tmp7_ = self->priv->closed_tabs;
	_tmp8_ = granite_widgets_closed_tabs_get_empty (_tmp7_);
	_tmp9_ = _tmp8_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp6_, !_tmp9_);
	g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_RESTORED_SIGNAL], 0, label, restore_data, icon);
}

static void
__granite_widgets_dynamic_notebook___lambda31__granite_widgets_closed_tabs_restored (GraniteWidgetsClosedTabs* _sender,
                                                                                     const gchar* label,
                                                                                     const gchar* restore_data,
                                                                                     GIcon* icon,
                                                                                     gpointer self)
{
	_granite_widgets_dynamic_notebook___lambda31_ ((GraniteWidgetsDynamicNotebook*) self, label, restore_data, icon);
}

static void
_granite_widgets_dynamic_notebook___lambda32_ (GraniteWidgetsDynamicNotebook* self)
{
	GtkButton* _tmp0_;
	GtkMenuItem* _tmp1_;
	_tmp0_ = self->priv->restore_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, FALSE);
	_tmp1_ = self->priv->restore_tab_m;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp1_, FALSE);
}

static void
__granite_widgets_dynamic_notebook___lambda32__granite_widgets_closed_tabs_cleared (GraniteWidgetsClosedTabs* _sender,
                                                                                    gpointer self)
{
	_granite_widgets_dynamic_notebook___lambda32_ ((GraniteWidgetsDynamicNotebook*) self);
}

static gboolean
_granite_widgets_dynamic_notebook___lambda33_ (GraniteWidgetsDynamicNotebook* self,
                                               GdkEventCrossing* e)
{
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	granite_widgets_dynamic_notebook_check_to_recalc_size (self);
	result = FALSE;
	return result;
}

static gboolean
__granite_widgets_dynamic_notebook___lambda33__gtk_widget_leave_notify_event (GtkWidget* _sender,
                                                                              GdkEventCrossing* event,
                                                                              gpointer self)
{
	gboolean result;
	result = _granite_widgets_dynamic_notebook___lambda33_ ((GraniteWidgetsDynamicNotebook*) self, event);
	return result;
}

static gboolean
_granite_widgets_dynamic_notebook___lambda34_ (GraniteWidgetsDynamicNotebook* self)
{
	gboolean result;
	granite_widgets_dynamic_notebook_check_to_recalc_size (self);
	result = FALSE;
	return result;
}

static gboolean
__granite_widgets_dynamic_notebook___lambda34__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                                                              GdkEventCrossing* event,
                                                                              gpointer self)
{
	gboolean result;
	result = _granite_widgets_dynamic_notebook___lambda34_ ((GraniteWidgetsDynamicNotebook*) self);
	return result;
}

static void
_granite_widgets_dynamic_notebook___lambda35_ (GraniteWidgetsDynamicNotebook* self)
{
	g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_REQUESTED_SIGNAL], 0);
}

static void
__granite_widgets_dynamic_notebook___lambda35__gtk_button_clicked (GtkButton* _sender,
                                                                   gpointer self)
{
	_granite_widgets_dynamic_notebook___lambda35_ ((GraniteWidgetsDynamicNotebook*) self);
}

static gboolean
_granite_widgets_dynamic_notebook___lambda36_ (GraniteWidgetsDynamicNotebook* self,
                                               GdkEventButton* e)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	if (e->type == GDK_2BUTTON_PRESS) {
		_tmp0_ = e->button == ((guint) 1);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gboolean
__granite_widgets_dynamic_notebook___lambda36__gtk_widget_button_press_event (GtkWidget* _sender,
                                                                              GdkEventButton* event,
                                                                              gpointer self)
{
	gboolean result;
	result = _granite_widgets_dynamic_notebook___lambda36_ ((GraniteWidgetsDynamicNotebook*) self, event);
	return result;
}

static void
_granite_widgets_dynamic_notebook___lambda37_ (GraniteWidgetsDynamicNotebook* self)
{
	GtkMenu* menu = NULL;
	GraniteWidgetsClosedTabs* _tmp0_;
	GtkMenu* _tmp1_;
	GtkMenu* _tmp2_;
	GtkMenu* _tmp3_;
	GtkButton* _tmp4_;
	GtkMenu* _tmp5_;
	GtkMenu* _tmp6_;
	GtkButton* _tmp7_;
	_tmp0_ = self->priv->closed_tabs;
	_tmp1_ = granite_widgets_closed_tabs_get_menu (_tmp0_);
	_tmp2_ = _tmp1_;
	menu = _tmp2_;
	_tmp3_ = menu;
	_tmp4_ = self->priv->restore_button;
	g_object_set (_tmp3_, "attach-widget", (GtkWidget*) _tmp4_, NULL);
	_tmp5_ = menu;
	gtk_widget_show_all ((GtkWidget*) _tmp5_);
	_tmp6_ = menu;
	_tmp7_ = self->priv->restore_button;
	gtk_menu_popup_at_widget (_tmp6_, (GtkWidget*) _tmp7_, GDK_GRAVITY_SOUTH_EAST, GDK_GRAVITY_NORTH_EAST, NULL);
	_g_object_unref0 (menu);
}

static void
__granite_widgets_dynamic_notebook___lambda37__gtk_button_clicked (GtkButton* _sender,
                                                                   gpointer self)
{
	_granite_widgets_dynamic_notebook___lambda37_ ((GraniteWidgetsDynamicNotebook*) self);
}

static void
_granite_widgets_dynamic_notebook___lambda38_ (GraniteWidgetsDynamicNotebook* self)
{
	if (!self->priv->wait_to_recalc_size) {
		granite_widgets_dynamic_notebook_recalc_size (self);
	}
}

static void
__granite_widgets_dynamic_notebook___lambda38__gtk_widget_size_allocate (GtkWidget* _sender,
                                                                         GtkAllocation* allocation,
                                                                         gpointer self)
{
	_granite_widgets_dynamic_notebook___lambda38_ ((GraniteWidgetsDynamicNotebook*) self);
}

static gboolean
_granite_widgets_dynamic_notebook___lambda39_ (GraniteWidgetsDynamicNotebook* self,
                                               GdkEventButton* e)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	if (e->type == GDK_2BUTTON_PRESS) {
		_tmp0_ = e->button == ((guint) 1);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_REQUESTED_SIGNAL], 0);
	} else {
		gboolean _tmp1_ = FALSE;
		if (e->button == ((guint) 2)) {
			gboolean _tmp2_;
			gboolean _tmp3_;
			_tmp2_ = granite_widgets_dynamic_notebook_get_allow_restoring (self);
			_tmp3_ = _tmp2_;
			_tmp1_ = _tmp3_;
		} else {
			_tmp1_ = FALSE;
		}
		if (_tmp1_) {
			granite_widgets_dynamic_notebook_restore_last_tab (self);
			result = TRUE;
			return result;
		} else {
			if (e->button == ((guint) 3)) {
				GtkMenu* _tmp4_;
				_tmp4_ = self->priv->_menu;
				gtk_menu_popup_at_pointer (_tmp4_, (GdkEvent*) e);
			}
		}
	}
	result = FALSE;
	return result;
}

static gboolean
__granite_widgets_dynamic_notebook___lambda39__gtk_widget_button_press_event (GtkWidget* _sender,
                                                                              GdkEventButton* event,
                                                                              gpointer self)
{
	gboolean result;
	result = _granite_widgets_dynamic_notebook___lambda39_ ((GraniteWidgetsDynamicNotebook*) self, event);
	return result;
}

static gboolean
_granite_widgets_dynamic_notebook___lambda40_ (GraniteWidgetsDynamicNotebook* self,
                                               GdkEventKey* e)
{
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	e->state = e->state & GRANITE_WIDGETS_MODIFIER_MASK;
	switch (e->keyval) {
		case GDK_KEY_w:
		case GDK_KEY_W:
		{
			if (e->state == GDK_CONTROL_MASK) {
				gboolean _tmp0_;
				gboolean _tmp1_;
				GraniteWidgetsTab* _tmp2_;
				GraniteWidgetsTab* _tmp3_;
				_tmp0_ = granite_widgets_dynamic_notebook_get_tabs_closable (self);
				_tmp1_ = _tmp0_;
				if (!_tmp1_) {
					break;
				}
				_tmp2_ = granite_widgets_dynamic_notebook_get_current (self);
				_tmp3_ = _tmp2_;
				granite_widgets_tab_close (_tmp3_);
				result = TRUE;
				return result;
			}
			break;
		}
		case GDK_KEY_t:
		case GDK_KEY_T:
		{
			if (e->state == GDK_CONTROL_MASK) {
				g_signal_emit (self, granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_REQUESTED_SIGNAL], 0);
				result = TRUE;
				return result;
			} else {
				gboolean _tmp4_ = FALSE;
				if (e->state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) {
					gboolean _tmp5_;
					gboolean _tmp6_;
					_tmp5_ = granite_widgets_dynamic_notebook_get_allow_restoring (self);
					_tmp6_ = _tmp5_;
					_tmp4_ = _tmp6_;
				} else {
					_tmp4_ = FALSE;
				}
				if (_tmp4_) {
					granite_widgets_dynamic_notebook_restore_last_tab (self);
					result = TRUE;
					return result;
				}
			}
			break;
		}
		case GDK_KEY_Page_Up:
		{
			if (e->state == GDK_CONTROL_MASK) {
				granite_widgets_dynamic_notebook_next_page (self);
				result = TRUE;
				return result;
			}
			break;
		}
		case GDK_KEY_Page_Down:
		{
			if (e->state == GDK_CONTROL_MASK) {
				granite_widgets_dynamic_notebook_previous_page (self);
				result = TRUE;
				return result;
			}
			break;
		}
		case GDK_KEY_1:
		case GDK_KEY_2:
		case GDK_KEY_3:
		case GDK_KEY_4:
		case GDK_KEY_5:
		case GDK_KEY_6:
		case GDK_KEY_7:
		case GDK_KEY_8:
		{
			if ((e->state & GDK_MOD1_MASK) == GDK_MOD1_MASK) {
				guint i = 0U;
				gint n_pages = 0;
				GtkNotebook* _tmp7_;
				guint _tmp8_ = 0U;
				GtkNotebook* _tmp9_;
				i = e->keyval - 49;
				_tmp7_ = self->priv->notebook;
				n_pages = gtk_notebook_get_n_pages (_tmp7_);
				if (i >= ((guint) n_pages)) {
					_tmp8_ = (guint) (n_pages - 1);
				} else {
					_tmp8_ = i;
				}
				_tmp9_ = self->priv->notebook;
				g_object_set (_tmp9_, "page", (gint) _tmp8_, NULL);
				result = TRUE;
				return result;
			}
			break;
		}
		case GDK_KEY_9:
		{
			if ((e->state & GDK_MOD1_MASK) == GDK_MOD1_MASK) {
				GtkNotebook* _tmp10_;
				GtkNotebook* _tmp11_;
				_tmp10_ = self->priv->notebook;
				_tmp11_ = self->priv->notebook;
				g_object_set (_tmp10_, "page", gtk_notebook_get_n_pages (_tmp11_) - 1, NULL);
				result = TRUE;
				return result;
			}
			break;
		}
		default:
		break;
	}
	result = FALSE;
	return result;
}

static gboolean
__granite_widgets_dynamic_notebook___lambda40__gtk_widget_key_press_event (GtkWidget* _sender,
                                                                           GdkEventKey* event,
                                                                           gpointer self)
{
	gboolean result;
	result = _granite_widgets_dynamic_notebook___lambda40_ ((GraniteWidgetsDynamicNotebook*) self, event);
	return result;
}

static void
_granite_widgets_dynamic_notebook_on_switch_page_gtk_notebook_switch_page (GtkNotebook* _sender,
                                                                           GtkWidget* page,
                                                                           guint page_num,
                                                                           gpointer self)
{
	granite_widgets_dynamic_notebook_on_switch_page ((GraniteWidgetsDynamicNotebook*) self, page, page_num);
}

static void
_granite_widgets_dynamic_notebook_on_page_added_gtk_notebook_page_added (GtkNotebook* _sender,
                                                                         GtkWidget* child,
                                                                         guint page_num,
                                                                         gpointer self)
{
	granite_widgets_dynamic_notebook_on_page_added ((GraniteWidgetsDynamicNotebook*) self, child, page_num);
}

static void
_granite_widgets_dynamic_notebook_on_page_removed_gtk_notebook_page_removed (GtkNotebook* _sender,
                                                                             GtkWidget* child,
                                                                             guint page_num,
                                                                             gpointer self)
{
	granite_widgets_dynamic_notebook_on_page_removed ((GraniteWidgetsDynamicNotebook*) self, child, page_num);
}

static void
_granite_widgets_dynamic_notebook_on_page_reordered_gtk_notebook_page_reordered (GtkNotebook* _sender,
                                                                                 GtkWidget* child,
                                                                                 guint page_num,
                                                                                 gpointer self)
{
	granite_widgets_dynamic_notebook_on_page_reordered ((GraniteWidgetsDynamicNotebook*) self, child, page_num);
}

static GtkNotebook*
_granite_widgets_dynamic_notebook_on_create_window_gtk_notebook_create_window (GtkNotebook* _sender,
                                                                               GtkWidget* page,
                                                                               gint x,
                                                                               gint y,
                                                                               gpointer self)
{
	GtkNotebook* result;
	result = granite_widgets_dynamic_notebook_on_create_window ((GraniteWidgetsDynamicNotebook*) self, page, x, y);
	return result;
}

static void
_granite_widgets_dynamic_notebook___lambda41_ (GraniteWidgetsDynamicNotebook* self)
{
	GtkNotebook* _tmp0_;
	guint _tmp1_;
	GtkNotebook* _tmp2_;
	guint _tmp3_;
	GtkNotebook* _tmp4_;
	guint _tmp5_;
	GtkNotebook* _tmp6_;
	guint _tmp7_;
	GtkNotebook* _tmp8_;
	guint _tmp9_;
	_tmp0_ = self->priv->notebook;
	g_signal_parse_name ("switch-page", gtk_notebook_get_type (), &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _granite_widgets_dynamic_notebook_on_switch_page_gtk_notebook_switch_page, self);
	_tmp2_ = self->priv->notebook;
	g_signal_parse_name ("page-added", gtk_notebook_get_type (), &_tmp3_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _granite_widgets_dynamic_notebook_on_page_added_gtk_notebook_page_added, self);
	_tmp4_ = self->priv->notebook;
	g_signal_parse_name ("page-removed", gtk_notebook_get_type (), &_tmp5_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _granite_widgets_dynamic_notebook_on_page_removed_gtk_notebook_page_removed, self);
	_tmp6_ = self->priv->notebook;
	g_signal_parse_name ("page-reordered", gtk_notebook_get_type (), &_tmp7_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp6_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, 0, NULL, (GCallback) _granite_widgets_dynamic_notebook_on_page_reordered_gtk_notebook_page_reordered, self);
	_tmp8_ = self->priv->notebook;
	g_signal_parse_name ("create-window", gtk_notebook_get_type (), &_tmp9_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _granite_widgets_dynamic_notebook_on_create_window_gtk_notebook_create_window, self);
}

static void
__granite_widgets_dynamic_notebook___lambda41__gtk_widget_destroy (GtkWidget* _sender,
                                                                   gpointer self)
{
	_granite_widgets_dynamic_notebook___lambda41_ ((GraniteWidgetsDynamicNotebook*) self);
}

static GObject *
granite_widgets_dynamic_notebook_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GraniteWidgetsDynamicNotebook * self;
	GtkNotebook* _tmp0_;
	GtkNotebook* _tmp1_;
	GtkStyleContext* _tmp2_;
	GtkNotebook* _tmp3_;
	GtkNotebook* _tmp4_;
	GtkNotebook* _tmp5_;
	GtkMenu* _tmp6_;
	GtkMenu* _tmp7_;
	GraniteAccelLabel* _tmp8_;
	GtkWidget* _tmp9_;
	GtkMenuItem* _tmp10_ = NULL;
	GraniteAccelLabel* _tmp11_;
	GtkWidget* _tmp12_;
	GtkMenuItem* _tmp13_ = NULL;
	GtkMenu* _tmp14_;
	GtkMenuItem* _tmp15_;
	GtkMenu* _tmp16_;
	GtkMenuItem* _tmp17_;
	GtkMenu* _tmp18_;
	GtkMenuItem* _tmp19_;
	GtkMenuItem* _tmp20_;
	GraniteWidgetsClosedTabs* _tmp21_;
	GraniteWidgetsClosedTabs* _tmp22_;
	GraniteWidgetsClosedTabs* _tmp23_;
	GtkButton* _tmp24_;
	GtkButton* _tmp25_;
	GtkButton* _tmp26_;
	GtkButton* _tmp27_;
	GtkButton* _tmp28_;
	GtkBox* add_button_box = NULL;
	GtkBox* _tmp29_;
	GtkBox* _tmp30_;
	GtkButton* _tmp31_;
	GtkBox* _tmp32_;
	GtkButton* _tmp33_;
	GtkButton* _tmp34_;
	GtkButton* _tmp35_;
	GtkButton* _tmp36_;
	GtkButton* _tmp37_;
	GtkButton* _tmp38_;
	GtkNotebook* _tmp39_;
	GtkBox* _tmp40_;
	GtkNotebook* _tmp41_;
	GtkButton* _tmp42_;
	GtkButton* _tmp43_;
	GtkButton* _tmp44_;
	GtkButton* _tmp45_;
	GtkButton* _tmp46_;
	GtkMenuItem* _tmp47_;
	gboolean _tmp48_;
	gboolean _tmp49_;
	GtkButton* _tmp50_;
	gboolean _tmp51_;
	gboolean _tmp52_;
	GtkNotebook* _tmp53_;
	GtkNotebook* _tmp54_;
	GtkNotebook* _tmp55_;
	GtkNotebook* _tmp56_;
	GtkNotebook* _tmp57_;
	parent_class = G_OBJECT_CLASS (granite_widgets_dynamic_notebook_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, GraniteWidgetsDynamicNotebook);
	_tmp0_ = (GtkNotebook*) gtk_notebook_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->notebook);
	self->priv->notebook = _tmp0_;
	_tmp1_ = self->priv->notebook;
	gtk_widget_set_can_focus ((GtkWidget*) _tmp1_, FALSE);
	gtk_event_box_set_visible_window ((GtkEventBox*) self, TRUE);
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) self);
	gtk_style_context_add_class (_tmp2_, "dynamic-notebook");
	_tmp3_ = self->priv->notebook;
	gtk_notebook_set_scrollable (_tmp3_, TRUE);
	_tmp4_ = self->priv->notebook;
	gtk_notebook_set_show_border (_tmp4_, FALSE);
	self->priv->_tab_bar_behavior = GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_ALWAYS;
	_tmp5_ = self->priv->notebook;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp5_);
	_tmp6_ = (GtkMenu*) gtk_menu_new ();
	g_object_ref_sink (_tmp6_);
	_tmp7_ = _tmp6_;
	granite_widgets_dynamic_notebook_set_menu (self, _tmp7_);
	_g_object_unref0 (_tmp7_);
	_tmp8_ = self->priv->_new_tab_label;
	_tmp9_ = _g_object_ref0 ((GtkWidget*) _tmp8_);
	_tmp10_ = (GtkMenuItem*) gtk_menu_item_new ();
	g_object_set ((GtkContainer*) _tmp10_, "child", _tmp9_, NULL);
	_g_object_unref0 (_tmp9_);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->new_tab_m);
	self->priv->new_tab_m = _tmp10_;
	_tmp11_ = self->priv->_restore_tab_label;
	_tmp12_ = _g_object_ref0 ((GtkWidget*) _tmp11_);
	_tmp13_ = (GtkMenuItem*) gtk_menu_item_new ();
	g_object_set ((GtkContainer*) _tmp13_, "child", _tmp12_, NULL);
	_g_object_unref0 (_tmp12_);
	gtk_widget_set_sensitive ((GtkWidget*) _tmp13_, FALSE);
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->restore_tab_m);
	self->priv->restore_tab_m = _tmp13_;
	_tmp14_ = self->priv->_menu;
	_tmp15_ = self->priv->new_tab_m;
	gtk_menu_shell_append ((GtkMenuShell*) _tmp14_, _tmp15_);
	_tmp16_ = self->priv->_menu;
	_tmp17_ = self->priv->restore_tab_m;
	gtk_menu_shell_append ((GtkMenuShell*) _tmp16_, _tmp17_);
	_tmp18_ = self->priv->_menu;
	gtk_widget_show_all ((GtkWidget*) _tmp18_);
	_tmp19_ = self->priv->new_tab_m;
	g_signal_connect_object (_tmp19_, "activate", (GCallback) __granite_widgets_dynamic_notebook___lambda29__gtk_menu_item_activate, self, 0);
	_tmp20_ = self->priv->restore_tab_m;
	g_signal_connect_object (_tmp20_, "activate", (GCallback) __granite_widgets_dynamic_notebook___lambda30__gtk_menu_item_activate, self, 0);
	_tmp21_ = granite_widgets_closed_tabs_new ();
	_g_object_unref0 (self->priv->closed_tabs);
	self->priv->closed_tabs = _tmp21_;
	_tmp22_ = self->priv->closed_tabs;
	g_signal_connect_object (_tmp22_, "restored", (GCallback) __granite_widgets_dynamic_notebook___lambda31__granite_widgets_closed_tabs_restored, self, 0);
	_tmp23_ = self->priv->closed_tabs;
	g_signal_connect_object (_tmp23_, "cleared", (GCallback) __granite_widgets_dynamic_notebook___lambda32__granite_widgets_closed_tabs_cleared, self, 0);
	_tmp24_ = (GtkButton*) gtk_button_new_from_icon_name ("list-add-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp24_);
	_g_object_unref0 (self->priv->add_button);
	self->priv->add_button = _tmp24_;
	_tmp25_ = self->priv->add_button;
	gtk_button_set_relief (_tmp25_, GTK_RELIEF_NONE);
	_tmp26_ = self->priv->add_button;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp26_, 6);
	_tmp27_ = self->priv->add_button;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp27_, 6);
	_tmp28_ = self->priv->add_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp28_, _ ("New Tab"));
	_tmp29_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp29_);
	add_button_box = _tmp29_;
	_tmp30_ = add_button_box;
	_tmp31_ = self->priv->add_button;
	gtk_container_add ((GtkContainer*) _tmp30_, (GtkWidget*) _tmp31_);
	_tmp32_ = add_button_box;
	gtk_widget_show_all ((GtkWidget*) _tmp32_);
	_tmp33_ = (GtkButton*) gtk_button_new_from_icon_name ("document-open-recent-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp33_);
	_g_object_unref0 (self->priv->restore_button);
	self->priv->restore_button = _tmp33_;
	_tmp34_ = self->priv->restore_button;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp34_, 3);
	_tmp35_ = self->priv->restore_button;
	gtk_button_set_relief (_tmp35_, GTK_RELIEF_NONE);
	_tmp36_ = self->priv->restore_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp36_, _ ("Closed Tabs"));
	_tmp37_ = self->priv->restore_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp37_, FALSE);
	_tmp38_ = self->priv->restore_button;
	gtk_widget_show ((GtkWidget*) _tmp38_);
	_tmp39_ = self->priv->notebook;
	_tmp40_ = add_button_box;
	gtk_notebook_set_action_widget (_tmp39_, (GtkWidget*) _tmp40_, GTK_PACK_START);
	_tmp41_ = self->priv->notebook;
	_tmp42_ = self->priv->restore_button;
	gtk_notebook_set_action_widget (_tmp41_, (GtkWidget*) _tmp42_, GTK_PACK_END);
	g_signal_connect_object ((GtkWidget*) self, "leave-notify-event", (GCallback) __granite_widgets_dynamic_notebook___lambda33__gtk_widget_leave_notify_event, self, 0);
	_tmp43_ = self->priv->add_button;
	g_signal_connect_object ((GtkWidget*) _tmp43_, "enter-notify-event", (GCallback) __granite_widgets_dynamic_notebook___lambda34__gtk_widget_enter_notify_event, self, 0);
	_tmp44_ = self->priv->add_button;
	g_signal_connect_object (_tmp44_, "clicked", (GCallback) __granite_widgets_dynamic_notebook___lambda35__gtk_button_clicked, self, 0);
	_tmp45_ = self->priv->add_button;
	g_signal_connect_object ((GtkWidget*) _tmp45_, "button-press-event", (GCallback) __granite_widgets_dynamic_notebook___lambda36__gtk_widget_button_press_event, self, 0);
	_tmp46_ = self->priv->restore_button;
	g_signal_connect_object (_tmp46_, "clicked", (GCallback) __granite_widgets_dynamic_notebook___lambda37__gtk_button_clicked, self, 0);
	_tmp47_ = self->priv->restore_tab_m;
	_tmp48_ = granite_widgets_dynamic_notebook_get_allow_restoring (self);
	_tmp49_ = _tmp48_;
	gtk_widget_set_visible ((GtkWidget*) _tmp47_, _tmp49_);
	_tmp50_ = self->priv->restore_button;
	_tmp51_ = granite_widgets_dynamic_notebook_get_allow_restoring (self);
	_tmp52_ = _tmp51_;
	gtk_widget_set_visible ((GtkWidget*) _tmp50_, _tmp52_);
	g_signal_connect_object ((GtkWidget*) self, "size-allocate", (GCallback) __granite_widgets_dynamic_notebook___lambda38__gtk_widget_size_allocate, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "button-press-event", (GCallback) __granite_widgets_dynamic_notebook___lambda39__gtk_widget_button_press_event, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "key-press-event", (GCallback) __granite_widgets_dynamic_notebook___lambda40__gtk_widget_key_press_event, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "destroy", (GCallback) __granite_widgets_dynamic_notebook___lambda41__gtk_widget_destroy, self, 0);
	_tmp53_ = self->priv->notebook;
	g_signal_connect_object (_tmp53_, "switch-page", (GCallback) _granite_widgets_dynamic_notebook_on_switch_page_gtk_notebook_switch_page, self, 0);
	_tmp54_ = self->priv->notebook;
	g_signal_connect_object (_tmp54_, "page-added", (GCallback) _granite_widgets_dynamic_notebook_on_page_added_gtk_notebook_page_added, self, 0);
	_tmp55_ = self->priv->notebook;
	g_signal_connect_object (_tmp55_, "page-removed", (GCallback) _granite_widgets_dynamic_notebook_on_page_removed_gtk_notebook_page_removed, self, 0);
	_tmp56_ = self->priv->notebook;
	g_signal_connect_object (_tmp56_, "page-reordered", (GCallback) _granite_widgets_dynamic_notebook_on_page_reordered_gtk_notebook_page_reordered, self, 0);
	_tmp57_ = self->priv->notebook;
	g_signal_connect_object (_tmp57_, "create-window", (GCallback) _granite_widgets_dynamic_notebook_on_create_window_gtk_notebook_create_window, self, 0);
	_g_object_unref0 (add_button_box);
	return obj;
}

static void
granite_widgets_dynamic_notebook_class_init (GraniteWidgetsDynamicNotebookClass * klass,
                                             gpointer klass_data)
{
	granite_widgets_dynamic_notebook_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraniteWidgetsDynamicNotebook_private_offset);
	((GtkWidgetClass *) klass)->show = (void (*) (GtkWidget*)) granite_widgets_dynamic_notebook_real_show;
	G_OBJECT_CLASS (klass)->get_property = _vala_granite_widgets_dynamic_notebook_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_granite_widgets_dynamic_notebook_set_property;
	G_OBJECT_CLASS (klass)->constructor = granite_widgets_dynamic_notebook_constructor;
	G_OBJECT_CLASS (klass)->finalize = granite_widgets_dynamic_notebook_finalize;
	/**
	         * number of pages
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_N_TABS_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_N_TABS_PROPERTY] = g_param_spec_int ("n-tabs", "n-tabs", "n-tabs", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	         * Hide the tab bar and only show the pages
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_SHOW_TABS_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_SHOW_TABS_PROPERTY] = g_param_spec_boolean ("show-tabs", "show-tabs", "show-tabs", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TABS_CLOSABLE_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TABS_CLOSABLE_PROPERTY] = g_param_spec_boolean ("tabs-closable", "tabs-closable", "tabs-closable", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DRAG_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DRAG_PROPERTY] = g_param_spec_boolean ("allow-drag", "allow-drag", "allow-drag", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_NEW_WINDOW_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_NEW_WINDOW_PROPERTY] = g_param_spec_boolean ("allow-new-window", "allow-new-window", "allow-new-window", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DUPLICATION_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DUPLICATION_PROPERTY] = g_param_spec_boolean ("allow-duplication", "allow-duplication", "allow-duplication", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_RESTORING_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_RESTORING_PROPERTY] = g_param_spec_boolean ("allow-restoring", "allow-restoring", "allow-restoring", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	         * Set or get the upper limit of the size of the set
	         * of restorable tabs.
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MAX_RESTORABLE_TABS_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MAX_RESTORABLE_TABS_PROPERTY] = g_param_spec_int ("max-restorable-tabs", "max-restorable-tabs", "max-restorable-tabs", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_VISIBLE_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_VISIBLE_PROPERTY] = g_param_spec_boolean ("add-button-visible", "add-button-visible", "add-button-visible", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_PINNING_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_PINNING_PROPERTY] = g_param_spec_boolean ("allow-pinning", "allow-pinning", "allow-pinning", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_FORCE_LEFT_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_FORCE_LEFT_PROPERTY] = g_param_spec_boolean ("force-left", "force-left", "force-left", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	        * The text shown in the add button tooltip
	        */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_TOOLTIP_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_TOOLTIP_PROPERTY] = g_param_spec_string ("add-button-tooltip", "add-button-tooltip", "add-button-tooltip", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	         * Accelerator label of the "New Tab" menu item in the tab context menu.
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_LABEL_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_LABEL_PROPERTY] = g_param_spec_object ("new-tab-label", "new-tab-label", "new-tab-label", GRANITE_TYPE_ACCEL_LABEL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	/**
	         * Accelerator label of the "Restore Tab" menu item in the tab context menu.
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_RESTORE_TAB_LABEL_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_RESTORE_TAB_LABEL_PROPERTY] = g_param_spec_object ("restore-tab-label", "restore-tab-label", "restore-tab-label", GRANITE_TYPE_ACCEL_LABEL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_CURRENT_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_CURRENT_PROPERTY] = g_param_spec_object ("current", "current", "current", GRANITE_WIDGETS_TYPE_TAB, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TABS_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TABS_PROPERTY] = g_param_spec_pointer ("tabs", "tabs", "tabs", G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_GROUP_NAME_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_GROUP_NAME_PROPERTY] = g_param_spec_string ("group-name", "group-name", "group-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	         * The behavior of the tab bar and its visibility
	        */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_PROPERTY] = g_param_spec_enum ("tab-bar-behavior", "tab-bar-behavior", "tab-bar-behavior", GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TYPE_TAB_BAR_BEHAVIOR, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	         * The menu appearing when the notebook is clicked on a blank space
	         */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MENU_PROPERTY, granite_widgets_dynamic_notebook_properties[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MENU_PROPERTY] = g_param_spec_object ("menu", "menu", "menu", gtk_menu_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_ADDED_SIGNAL] = g_signal_new ("tab-added", GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GRANITE_WIDGETS_TYPE_TAB);
	granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_REMOVED_SIGNAL] = g_signal_new ("tab-removed", GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GRANITE_WIDGETS_TYPE_TAB);
	granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_SWITCHED_SIGNAL] = g_signal_new ("tab-switched", GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, GRANITE_WIDGETS_TYPE_TAB, GRANITE_WIDGETS_TYPE_TAB);
	granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_REORDERED_SIGNAL] = g_signal_new ("tab-reordered", GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2, GRANITE_WIDGETS_TYPE_TAB, G_TYPE_INT);
	granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_MOVED_SIGNAL] = g_signal_new ("tab-moved", GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_INT_INT, G_TYPE_NONE, 3, GRANITE_WIDGETS_TYPE_TAB, G_TYPE_INT, G_TYPE_INT);
	granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_DUPLICATED_SIGNAL] = g_signal_new ("tab-duplicated", GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GRANITE_WIDGETS_TYPE_TAB);
	granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_RESTORED_SIGNAL] = g_signal_new ("tab-restored", GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_OBJECT, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, g_icon_get_type ());
	granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_REQUESTED_SIGNAL] = g_signal_new ("new-tab-requested", GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	granite_widgets_dynamic_notebook_signals[GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_CLOSE_TAB_REQUESTED_SIGNAL] = g_signal_new ("close-tab-requested", GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, GRANITE_WIDGETS_TYPE_TAB);
	granite_init ();
}

static void
granite_widgets_dynamic_notebook_instance_init (GraniteWidgetsDynamicNotebook * self,
                                                gpointer klass)
{
	self->priv = granite_widgets_dynamic_notebook_get_instance_private (self);
	self->priv->_tabs_closable = TRUE;
	self->priv->_allow_drag = TRUE;
	self->priv->_allow_new_window = FALSE;
	self->priv->_allow_duplication = FALSE;
	self->priv->_allow_restoring = FALSE;
	self->priv->_add_button_visible = TRUE;
	self->priv->_allow_pinning = FALSE;
	self->priv->_force_left = TRUE;
	self->priv->tab_width = GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MAX_TAB_WIDTH;
	self->priv->wait_to_recalc_size = FALSE;
}

static void
granite_widgets_dynamic_notebook_finalize (GObject * obj)
{
	GraniteWidgetsDynamicNotebook * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, GraniteWidgetsDynamicNotebook);
	_g_free0 (self->priv->_add_button_tooltip);
	_g_object_unref0 (self->priv->_new_tab_label);
	_g_object_unref0 (self->priv->_restore_tab_label);
	(self->priv->_tabs == NULL) ? NULL : (self->priv->_tabs = (_g_list_free__g_object_unref0_ (self->priv->_tabs), NULL));
	_g_object_unref0 (self->priv->_menu);
	_g_object_unref0 (self->priv->closed_tabs);
	_g_object_unref0 (self->priv->notebook);
	_g_object_unref0 (self->priv->old_tab);
	_g_object_unref0 (self->priv->new_tab_m);
	_g_object_unref0 (self->priv->restore_tab_m);
	_g_object_unref0 (self->priv->add_button);
	_g_object_unref0 (self->priv->restore_button);
	G_OBJECT_CLASS (granite_widgets_dynamic_notebook_parent_class)->finalize (obj);
}

/**
    * Tab bar widget designed for a variable number of tabs.
    * Supports showing a "New tab" button, restoring closed tabs, "pinning" tabs, and more.
    *
    * {{../doc/images/DynamicNotebook.png}}
    */
static GType
granite_widgets_dynamic_notebook_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraniteWidgetsDynamicNotebookClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) granite_widgets_dynamic_notebook_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraniteWidgetsDynamicNotebook), 0, (GInstanceInitFunc) granite_widgets_dynamic_notebook_instance_init, NULL };
	GType granite_widgets_dynamic_notebook_type_id;
	granite_widgets_dynamic_notebook_type_id = g_type_register_static (gtk_event_box_get_type (), "GraniteWidgetsDynamicNotebook", &g_define_type_info, 0);
	GraniteWidgetsDynamicNotebook_private_offset = g_type_add_instance_private (granite_widgets_dynamic_notebook_type_id, sizeof (GraniteWidgetsDynamicNotebookPrivate));
	return granite_widgets_dynamic_notebook_type_id;
}

GType
granite_widgets_dynamic_notebook_get_type (void)
{
	static volatile gsize granite_widgets_dynamic_notebook_type_id__once = 0;
	if (g_once_init_enter (&granite_widgets_dynamic_notebook_type_id__once)) {
		GType granite_widgets_dynamic_notebook_type_id;
		granite_widgets_dynamic_notebook_type_id = granite_widgets_dynamic_notebook_get_type_once ();
		g_once_init_leave (&granite_widgets_dynamic_notebook_type_id__once, granite_widgets_dynamic_notebook_type_id);
	}
	return granite_widgets_dynamic_notebook_type_id__once;
}

static void
_vala_granite_widgets_dynamic_notebook_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec)
{
	GraniteWidgetsDynamicNotebook * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, GraniteWidgetsDynamicNotebook);
	switch (property_id) {
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_N_TABS_PROPERTY:
		g_value_set_int (value, granite_widgets_dynamic_notebook_get_n_tabs (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_SHOW_TABS_PROPERTY:
		g_value_set_boolean (value, granite_widgets_dynamic_notebook_get_show_tabs (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TABS_CLOSABLE_PROPERTY:
		g_value_set_boolean (value, granite_widgets_dynamic_notebook_get_tabs_closable (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DRAG_PROPERTY:
		g_value_set_boolean (value, granite_widgets_dynamic_notebook_get_allow_drag (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_NEW_WINDOW_PROPERTY:
		g_value_set_boolean (value, granite_widgets_dynamic_notebook_get_allow_new_window (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DUPLICATION_PROPERTY:
		g_value_set_boolean (value, granite_widgets_dynamic_notebook_get_allow_duplication (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_RESTORING_PROPERTY:
		g_value_set_boolean (value, granite_widgets_dynamic_notebook_get_allow_restoring (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MAX_RESTORABLE_TABS_PROPERTY:
		g_value_set_int (value, granite_widgets_dynamic_notebook_get_max_restorable_tabs (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_VISIBLE_PROPERTY:
		g_value_set_boolean (value, granite_widgets_dynamic_notebook_get_add_button_visible (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_PINNING_PROPERTY:
		g_value_set_boolean (value, granite_widgets_dynamic_notebook_get_allow_pinning (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_FORCE_LEFT_PROPERTY:
		g_value_set_boolean (value, granite_widgets_dynamic_notebook_get_force_left (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_TOOLTIP_PROPERTY:
		g_value_set_string (value, granite_widgets_dynamic_notebook_get_add_button_tooltip (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_LABEL_PROPERTY:
		g_value_set_object (value, granite_widgets_dynamic_notebook_get_new_tab_label (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_RESTORE_TAB_LABEL_PROPERTY:
		g_value_set_object (value, granite_widgets_dynamic_notebook_get_restore_tab_label (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_CURRENT_PROPERTY:
		g_value_set_object (value, granite_widgets_dynamic_notebook_get_current (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TABS_PROPERTY:
		g_value_set_pointer (value, granite_widgets_dynamic_notebook_get_tabs (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_GROUP_NAME_PROPERTY:
		g_value_set_string (value, granite_widgets_dynamic_notebook_get_group_name (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_PROPERTY:
		g_value_set_enum (value, granite_widgets_dynamic_notebook_get_tab_bar_behavior (self));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MENU_PROPERTY:
		g_value_set_object (value, granite_widgets_dynamic_notebook_get_menu (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_granite_widgets_dynamic_notebook_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec)
{
	GraniteWidgetsDynamicNotebook * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRANITE_WIDGETS_TYPE_DYNAMIC_NOTEBOOK, GraniteWidgetsDynamicNotebook);
	switch (property_id) {
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_SHOW_TABS_PROPERTY:
		granite_widgets_dynamic_notebook_set_show_tabs (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TABS_CLOSABLE_PROPERTY:
		granite_widgets_dynamic_notebook_set_tabs_closable (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DRAG_PROPERTY:
		granite_widgets_dynamic_notebook_set_allow_drag (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_NEW_WINDOW_PROPERTY:
		granite_widgets_dynamic_notebook_set_allow_new_window (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_DUPLICATION_PROPERTY:
		granite_widgets_dynamic_notebook_set_allow_duplication (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_RESTORING_PROPERTY:
		granite_widgets_dynamic_notebook_set_allow_restoring (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MAX_RESTORABLE_TABS_PROPERTY:
		granite_widgets_dynamic_notebook_set_max_restorable_tabs (self, g_value_get_int (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_VISIBLE_PROPERTY:
		granite_widgets_dynamic_notebook_set_add_button_visible (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ALLOW_PINNING_PROPERTY:
		granite_widgets_dynamic_notebook_set_allow_pinning (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_FORCE_LEFT_PROPERTY:
		granite_widgets_dynamic_notebook_set_force_left (self, g_value_get_boolean (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_ADD_BUTTON_TOOLTIP_PROPERTY:
		granite_widgets_dynamic_notebook_set_add_button_tooltip (self, g_value_get_string (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_NEW_TAB_LABEL_PROPERTY:
		granite_widgets_dynamic_notebook_set_new_tab_label (self, g_value_get_object (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_RESTORE_TAB_LABEL_PROPERTY:
		granite_widgets_dynamic_notebook_set_restore_tab_label (self, g_value_get_object (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_CURRENT_PROPERTY:
		granite_widgets_dynamic_notebook_set_current (self, g_value_get_object (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_GROUP_NAME_PROPERTY:
		granite_widgets_dynamic_notebook_set_group_name (self, g_value_get_string (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_TAB_BAR_BEHAVIOR_PROPERTY:
		granite_widgets_dynamic_notebook_set_tab_bar_behavior (self, g_value_get_enum (value));
		break;
		case GRANITE_WIDGETS_DYNAMIC_NOTEBOOK_MENU_PROPERTY:
		granite_widgets_dynamic_notebook_set_menu (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

