/* topbar.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from topbar.vala, do not modify */

/* This file is part of GNOME Boxes. License: LGPLv2+*/

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

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

typedef enum  {
	BOXES_TOPBAR_PAGE_COLLECTION,
	BOXES_TOPBAR_PAGE_DISPLAY
} BoxesTopbarPage;

#define BOXES_TYPE_TOPBAR_PAGE (boxes_topbar_page_get_type ())

#define BOXES_TYPE_UI (boxes_ui_get_type ())
#define BOXES_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_UI, BoxesUI))
#define BOXES_IS_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_UI))
#define BOXES_UI_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BOXES_TYPE_UI, BoxesUIIface))

typedef struct _BoxesUI BoxesUI;
typedef struct _BoxesUIIface BoxesUIIface;
typedef enum  {
	BOXES_UI_STATE_NONE,
	BOXES_UI_STATE_COLLECTION,
	BOXES_UI_STATE_CREDS,
	BOXES_UI_STATE_DISPLAY,
	BOXES_UI_STATE_WIZARD,
	BOXES_UI_STATE_PROPERTIES,
	BOXES_UI_STATE_TROUBLESHOOT
} BoxesUIState;

#define BOXES_TYPE_UI_STATE (boxes_ui_state_get_type ())

#define BOXES_TYPE_TOPBAR (boxes_topbar_get_type ())
#define BOXES_TOPBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_TOPBAR, BoxesTopbar))
#define BOXES_TOPBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_TOPBAR, BoxesTopbarClass))
#define BOXES_IS_TOPBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_TOPBAR))
#define BOXES_IS_TOPBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_TOPBAR))
#define BOXES_TOPBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_TOPBAR, BoxesTopbarClass))

typedef struct _BoxesTopbar BoxesTopbar;
typedef struct _BoxesTopbarClass BoxesTopbarClass;
typedef struct _BoxesTopbarPrivate BoxesTopbarPrivate;

#define BOXES_TYPE_DISPLAY_TOOLBAR (boxes_display_toolbar_get_type ())
#define BOXES_DISPLAY_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DISPLAY_TOOLBAR, BoxesDisplayToolbar))
#define BOXES_DISPLAY_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DISPLAY_TOOLBAR, BoxesDisplayToolbarClass))
#define BOXES_IS_DISPLAY_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DISPLAY_TOOLBAR))
#define BOXES_IS_DISPLAY_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DISPLAY_TOOLBAR))
#define BOXES_DISPLAY_TOOLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DISPLAY_TOOLBAR, BoxesDisplayToolbarClass))

typedef struct _BoxesDisplayToolbar BoxesDisplayToolbar;
typedef struct _BoxesDisplayToolbarClass BoxesDisplayToolbarClass;

#define BOXES_TYPE_COLLECTION_TOOLBAR (boxes_collection_toolbar_get_type ())
#define BOXES_COLLECTION_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_COLLECTION_TOOLBAR, BoxesCollectionToolbar))
#define BOXES_COLLECTION_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_COLLECTION_TOOLBAR, BoxesCollectionToolbarClass))
#define BOXES_IS_COLLECTION_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_COLLECTION_TOOLBAR))
#define BOXES_IS_COLLECTION_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_COLLECTION_TOOLBAR))
#define BOXES_COLLECTION_TOOLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_COLLECTION_TOOLBAR, BoxesCollectionToolbarClass))

typedef struct _BoxesCollectionToolbar BoxesCollectionToolbar;
typedef struct _BoxesCollectionToolbarClass BoxesCollectionToolbarClass;

#define BOXES_TYPE_APP_WINDOW (boxes_app_window_get_type ())
#define BOXES_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_APP_WINDOW, BoxesAppWindow))
#define BOXES_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_APP_WINDOW, BoxesAppWindowClass))
#define BOXES_IS_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_APP_WINDOW))
#define BOXES_IS_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_APP_WINDOW))
#define BOXES_APP_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_APP_WINDOW, BoxesAppWindowClass))

typedef struct _BoxesAppWindow BoxesAppWindow;
typedef struct _BoxesAppWindowClass BoxesAppWindowClass;
enum  {
	BOXES_TOPBAR_0_PROPERTY,
	BOXES_TOPBAR_PREVIOUS_UI_STATE_PROPERTY,
	BOXES_TOPBAR_UI_STATE_PROPERTY,
	BOXES_TOPBAR_STATUS_PROPERTY,
	BOXES_TOPBAR_PAGE_PROPERTY,
	BOXES_TOPBAR_NUM_PROPERTIES
};
static GParamSpec* boxes_topbar_properties[BOXES_TOPBAR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _BoxesCollectionToolbarPrivate BoxesCollectionToolbarPrivate;
typedef struct _BoxesAppWindowPrivate BoxesAppWindowPrivate;

#define BOXES_TYPE_SEARCHBAR (boxes_searchbar_get_type ())
#define BOXES_SEARCHBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_SEARCHBAR, BoxesSearchbar))
#define BOXES_SEARCHBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_SEARCHBAR, BoxesSearchbarClass))
#define BOXES_IS_SEARCHBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_SEARCHBAR))
#define BOXES_IS_SEARCHBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_SEARCHBAR))
#define BOXES_SEARCHBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_SEARCHBAR, BoxesSearchbarClass))

typedef struct _BoxesSearchbar BoxesSearchbar;
typedef struct _BoxesSearchbarClass BoxesSearchbarClass;

#define BOXES_TYPE_TOAST_OVERLAY (boxes_toast_overlay_get_type ())
#define BOXES_TOAST_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_TOAST_OVERLAY, BoxesToastOverlay))
#define BOXES_TOAST_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_TOAST_OVERLAY, BoxesToastOverlayClass))
#define BOXES_IS_TOAST_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_TOAST_OVERLAY))
#define BOXES_IS_TOAST_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_TOAST_OVERLAY))
#define BOXES_TOAST_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_TOAST_OVERLAY, BoxesToastOverlayClass))

typedef struct _BoxesToastOverlay BoxesToastOverlay;
typedef struct _BoxesToastOverlayClass BoxesToastOverlayClass;

#define BOXES_TYPE_DISPLAY_PAGE (boxes_display_page_get_type ())
#define BOXES_DISPLAY_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DISPLAY_PAGE, BoxesDisplayPage))
#define BOXES_DISPLAY_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DISPLAY_PAGE, BoxesDisplayPageClass))
#define BOXES_IS_DISPLAY_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DISPLAY_PAGE))
#define BOXES_IS_DISPLAY_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DISPLAY_PAGE))
#define BOXES_DISPLAY_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DISPLAY_PAGE, BoxesDisplayPageClass))

typedef struct _BoxesDisplayPage BoxesDisplayPage;
typedef struct _BoxesDisplayPageClass BoxesDisplayPageClass;

#define BOXES_TYPE_TROUBLESHOOT_VIEW (boxes_troubleshoot_view_get_type ())
#define BOXES_TROUBLESHOOT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_TROUBLESHOOT_VIEW, BoxesTroubleshootView))
#define BOXES_TROUBLESHOOT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_TROUBLESHOOT_VIEW, BoxesTroubleshootViewClass))
#define BOXES_IS_TROUBLESHOOT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_TROUBLESHOOT_VIEW))
#define BOXES_IS_TROUBLESHOOT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_TROUBLESHOOT_VIEW))
#define BOXES_TROUBLESHOOT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_TROUBLESHOOT_VIEW, BoxesTroubleshootViewClass))

typedef struct _BoxesTroubleshootView BoxesTroubleshootView;
typedef struct _BoxesTroubleshootViewClass BoxesTroubleshootViewClass;
typedef struct _BoxesDisplayPagePrivate BoxesDisplayPagePrivate;

#define BOXES_TYPE_TRANSFER_POPOVER (boxes_transfer_popover_get_type ())
#define BOXES_TRANSFER_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_TRANSFER_POPOVER, BoxesTransferPopover))
#define BOXES_TRANSFER_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_TRANSFER_POPOVER, BoxesTransferPopoverClass))
#define BOXES_IS_TRANSFER_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_TRANSFER_POPOVER))
#define BOXES_IS_TRANSFER_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_TRANSFER_POPOVER))
#define BOXES_TRANSFER_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_TRANSFER_POPOVER, BoxesTransferPopoverClass))

typedef struct _BoxesTransferPopover BoxesTransferPopover;
typedef struct _BoxesTransferPopoverClass BoxesTransferPopoverClass;

struct _BoxesUIIface {
	GTypeInterface parent_iface;
	BoxesUIState (*get_previous_ui_state) (BoxesUI* self);
	void (*set_previous_ui_state) (BoxesUI* self, BoxesUIState value);
	BoxesUIState (*get_ui_state) (BoxesUI* self);
	void (*set_ui_state) (BoxesUI* self, BoxesUIState value);
};

struct _BoxesTopbar {
	GtkStack parent_instance;
	BoxesTopbarPrivate * priv;
	BoxesDisplayToolbar* display_toolbar;
	gchar* _status;
};

struct _BoxesTopbarClass {
	GtkStackClass parent_class;
};

struct _BoxesTopbarPrivate {
	BoxesUIState _previous_ui_state;
	BoxesUIState _ui_state;
	BoxesCollectionToolbar* collection_toolbar;
	BoxesAppWindow* window;
	BoxesTopbarPage _page;
};

struct _BoxesCollectionToolbar {
	HdyHeaderBar parent_instance;
	BoxesCollectionToolbarPrivate * priv;
	GtkMenuButton* hamburger_btn;
};

struct _BoxesCollectionToolbarClass {
	HdyHeaderBarClass parent_class;
};

struct _BoxesAppWindow {
	HdyApplicationWindow parent_instance;
	BoxesAppWindowPrivate * priv;
	BoxesSearchbar* searchbar;
	BoxesTopbar* topbar;
	BoxesToastOverlay* toast_overlay;
	BoxesDisplayPage* display_page;
	HdyStatusPage* empty_boxes;
	BoxesTroubleshootView* troubleshoot_view;
	GtkStack* below_bin;
	GSettings* settings;
};

struct _BoxesAppWindowClass {
	HdyApplicationWindowClass parent_class;
};

struct _BoxesDisplayPage {
	GtkBox parent_instance;
	BoxesDisplayPagePrivate * priv;
	BoxesDisplayToolbar* toolbar;
	GtkLabel* size_label;
	GtkBox* transfer_message_box;
	BoxesTransferPopover* transfer_popover;
};

struct _BoxesDisplayPageClass {
	GtkBoxClass parent_class;
};

static gint BoxesTopbar_private_offset;
static gpointer boxes_topbar_parent_class = NULL;
static BoxesUIIface * boxes_topbar_boxes_ui_parent_iface = NULL;

VALA_EXTERN GType boxes_topbar_page_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType boxes_ui_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType boxes_ui_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesUI, g_object_unref)
VALA_EXTERN GType boxes_topbar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesTopbar, g_object_unref)
VALA_EXTERN GType boxes_display_toolbar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesDisplayToolbar, g_object_unref)
VALA_EXTERN GType boxes_collection_toolbar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesCollectionToolbar, g_object_unref)
VALA_EXTERN GType boxes_app_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesAppWindow, g_object_unref)
VALA_EXTERN void boxes_topbar_click_back_button (BoxesTopbar* self);
VALA_EXTERN void boxes_collection_toolbar_click_back_button (BoxesCollectionToolbar* self);
VALA_EXTERN void boxes_topbar_click_search_button (BoxesTopbar* self);
VALA_EXTERN BoxesUIState boxes_ui_get_ui_state (BoxesUI* self);
VALA_EXTERN void boxes_collection_toolbar_click_search_button (BoxesCollectionToolbar* self);
VALA_EXTERN void boxes_topbar_pop_main_menu (BoxesTopbar* self);
VALA_EXTERN void boxes_topbar_setup_ui (BoxesTopbar* self,
                            BoxesAppWindow* window);
VALA_EXTERN GType boxes_searchbar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesSearchbar, g_object_unref)
VALA_EXTERN GType boxes_toast_overlay_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesToastOverlay, g_object_unref)
VALA_EXTERN GType boxes_display_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesDisplayPage, g_object_unref)
VALA_EXTERN GType boxes_troubleshoot_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesTroubleshootView, g_object_unref)
VALA_EXTERN GType boxes_transfer_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesTransferPopover, g_object_unref)
VALA_EXTERN void boxes_collection_toolbar_setup_ui (BoxesCollectionToolbar* self,
                                        BoxesAppWindow* window);
VALA_EXTERN void boxes_display_toolbar_setup_ui (BoxesDisplayToolbar* self,
                                     BoxesAppWindow* window);
VALA_EXTERN void boxes_topbar_set_status (BoxesTopbar* self,
                              const gchar* value);
static void boxes_topbar_ui_state_changed (BoxesTopbar* self);
VALA_EXTERN void boxes_topbar_set_page (BoxesTopbar* self,
                            BoxesTopbarPage value);
VALA_EXTERN BoxesTopbar* boxes_topbar_new (void);
VALA_EXTERN BoxesTopbar* boxes_topbar_construct (GType object_type);
VALA_EXTERN const gchar* boxes_topbar_get_status (BoxesTopbar* self);
VALA_EXTERN BoxesTopbarPage boxes_topbar_get_page (BoxesTopbar* self);
static GObject * boxes_topbar_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties);
static void _boxes_topbar_ui_state_changed_g_object_notify (GObject* _sender,
                                                     GParamSpec* pspec,
                                                     gpointer self);
VALA_EXTERN BoxesUIState boxes_ui_get_previous_ui_state (BoxesUI* self);
VALA_EXTERN void boxes_ui_set_previous_ui_state (BoxesUI* self,
                                     BoxesUIState value);
VALA_EXTERN void boxes_ui_set_ui_state (BoxesUI* self,
                            BoxesUIState value);
static void boxes_topbar_finalize (GObject * obj);
static GType boxes_topbar_get_type_once (void);
static void _vala_boxes_topbar_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static void _vala_boxes_topbar_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec);

static const gchar* BOXES_TOPBAR_page_names[2] = {"collection", "display"};

static GType
boxes_topbar_page_get_type_once (void)
{
	static const GEnumValue values[] = {{BOXES_TOPBAR_PAGE_COLLECTION, "BOXES_TOPBAR_PAGE_COLLECTION", "collection"}, {BOXES_TOPBAR_PAGE_DISPLAY, "BOXES_TOPBAR_PAGE_DISPLAY", "display"}, {0, NULL, NULL}};
	GType boxes_topbar_page_type_id;
	boxes_topbar_page_type_id = g_enum_register_static ("BoxesTopbarPage", values);
	return boxes_topbar_page_type_id;
}

GType
boxes_topbar_page_get_type (void)
{
	static volatile gsize boxes_topbar_page_type_id__once = 0;
	if (g_once_init_enter (&boxes_topbar_page_type_id__once)) {
		GType boxes_topbar_page_type_id;
		boxes_topbar_page_type_id = boxes_topbar_page_get_type_once ();
		g_once_init_leave (&boxes_topbar_page_type_id__once, boxes_topbar_page_type_id);
	}
	return boxes_topbar_page_type_id__once;
}

static inline gpointer
boxes_topbar_get_instance_private (BoxesTopbar* self)
{
	return G_STRUCT_MEMBER_P (self, BoxesTopbar_private_offset);
}

void
boxes_topbar_click_back_button (BoxesTopbar* self)
{
	BoxesCollectionToolbar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->collection_toolbar;
	boxes_collection_toolbar_click_back_button (_tmp0_);
}

void
boxes_topbar_click_search_button (BoxesTopbar* self)
{
	BoxesAppWindow* _tmp0_;
	BoxesUIState _tmp1_;
	BoxesUIState _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->window;
	_tmp1_ = boxes_ui_get_ui_state ((BoxesUI*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == BOXES_UI_STATE_COLLECTION) {
		BoxesCollectionToolbar* _tmp3_;
		_tmp3_ = self->priv->collection_toolbar;
		boxes_collection_toolbar_click_search_button (_tmp3_);
	}
}

void
boxes_topbar_pop_main_menu (BoxesTopbar* self)
{
	BoxesCollectionToolbar* _tmp0_;
	GtkMenuButton* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->collection_toolbar;
	_tmp1_ = _tmp0_->hamburger_btn;
	gtk_button_clicked ((GtkButton*) _tmp1_);
}

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

void
boxes_topbar_setup_ui (BoxesTopbar* self,
                       BoxesAppWindow* window)
{
	BoxesAppWindow* _tmp0_;
	BoxesDisplayToolbar* toolbar = NULL;
	BoxesDisplayPage* _tmp1_;
	BoxesDisplayToolbar* _tmp2_;
	BoxesDisplayToolbar* _tmp3_;
	BoxesDisplayToolbar* _tmp4_;
	BoxesDisplayToolbar* _tmp5_;
	BoxesCollectionToolbar* _tmp6_;
	BoxesDisplayToolbar* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	_tmp0_ = _g_object_ref0 (window);
	_g_object_unref0 (self->priv->window);
	self->priv->window = _tmp0_;
	_tmp1_ = window->display_page;
	_tmp2_ = _tmp1_->toolbar;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	toolbar = _tmp3_;
	_tmp4_ = self->display_toolbar;
	g_object_bind_property_with_closures ((GObject*) toolbar, "title", (GObject*) _tmp4_, "title", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp5_ = self->display_toolbar;
	g_object_bind_property_with_closures ((GObject*) toolbar, "subtitle", (GObject*) _tmp5_, "subtitle", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp6_ = self->priv->collection_toolbar;
	boxes_collection_toolbar_setup_ui (_tmp6_, window);
	_tmp7_ = self->display_toolbar;
	boxes_display_toolbar_setup_ui (_tmp7_, window);
	boxes_topbar_set_status (self, _ ("Boxes"));
	_g_object_unref0 (toolbar);
}

static void
boxes_topbar_ui_state_changed (BoxesTopbar* self)
{
	BoxesUIState _tmp0_;
	BoxesUIState _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = boxes_ui_get_ui_state ((BoxesUI*) self);
	_tmp1_ = _tmp0_;
	switch (_tmp1_) {
		case BOXES_UI_STATE_COLLECTION:
		{
			boxes_topbar_set_page (self, BOXES_TOPBAR_PAGE_COLLECTION);
			break;
		}
		case BOXES_UI_STATE_CREDS:
		{
			boxes_topbar_set_page (self, BOXES_TOPBAR_PAGE_COLLECTION);
			break;
		}
		case BOXES_UI_STATE_DISPLAY:
		{
			boxes_topbar_set_page (self, BOXES_TOPBAR_PAGE_DISPLAY);
			break;
		}
		default:
		{
			break;
		}
	}
}

BoxesTopbar*
boxes_topbar_construct (GType object_type)
{
	BoxesTopbar * self = NULL;
	self = (BoxesTopbar*) g_object_new (object_type, NULL);
	return self;
}

BoxesTopbar*
boxes_topbar_new (void)
{
	return boxes_topbar_construct (BOXES_TYPE_TOPBAR);
}

static BoxesUIState
boxes_topbar_real_get_previous_ui_state (BoxesUI* base)
{
	BoxesUIState result;
	BoxesTopbar* self;
	self = (BoxesTopbar*) base;
	result = self->priv->_previous_ui_state;
	return result;
}

static void
boxes_topbar_real_set_previous_ui_state (BoxesUI* base,
                                         BoxesUIState value)
{
	BoxesTopbar* self;
	BoxesUIState old_value;
	self = (BoxesTopbar*) base;
	old_value = boxes_topbar_real_get_previous_ui_state (base);
	if (old_value != value) {
		self->priv->_previous_ui_state = value;
		g_object_notify_by_pspec ((GObject *) self, boxes_topbar_properties[BOXES_TOPBAR_PREVIOUS_UI_STATE_PROPERTY]);
	}
}

static BoxesUIState
boxes_topbar_real_get_ui_state (BoxesUI* base)
{
	BoxesUIState result;
	BoxesTopbar* self;
	self = (BoxesTopbar*) base;
	result = self->priv->_ui_state;
	return result;
}

static void
boxes_topbar_real_set_ui_state (BoxesUI* base,
                                BoxesUIState value)
{
	BoxesTopbar* self;
	BoxesUIState old_value;
	self = (BoxesTopbar*) base;
	old_value = boxes_topbar_real_get_ui_state (base);
	if (old_value != value) {
		self->priv->_ui_state = value;
		g_object_notify_by_pspec ((GObject *) self, boxes_topbar_properties[BOXES_TOPBAR_UI_STATE_PROPERTY]);
	}
}

const gchar*
boxes_topbar_get_status (BoxesTopbar* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->_status;
	result = _tmp0_;
	return result;
}

void
boxes_topbar_set_status (BoxesTopbar* self,
                         const gchar* value)
{
	gchar* _tmp0_;
	BoxesDisplayToolbar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->_status);
	self->_status = _tmp0_;
	_tmp1_ = self->display_toolbar;
	_tmp2_ = self->_status;
	hdy_header_bar_set_title ((HdyHeaderBar*) _tmp1_, _tmp2_);
	g_object_notify_by_pspec ((GObject *) self, boxes_topbar_properties[BOXES_TOPBAR_STATUS_PROPERTY]);
}

BoxesTopbarPage
boxes_topbar_get_page (BoxesTopbar* self)
{
	BoxesTopbarPage result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_page;
	return result;
}

void
boxes_topbar_set_page (BoxesTopbar* self,
                       BoxesTopbarPage value)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	self->priv->_page = value;
	_tmp0_ = BOXES_TOPBAR_page_names[value];
	gtk_stack_set_visible_child_name ((GtkStack*) self, _tmp0_);
	g_object_notify_by_pspec ((GObject *) self, boxes_topbar_properties[BOXES_TOPBAR_PAGE_PROPERTY]);
}

static void
_boxes_topbar_ui_state_changed_g_object_notify (GObject* _sender,
                                                GParamSpec* pspec,
                                                gpointer self)
{
	boxes_topbar_ui_state_changed ((BoxesTopbar*) self);
}

static GObject *
boxes_topbar_constructor (GType type,
                          guint n_construct_properties,
                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	BoxesTopbar * self;
	parent_class = G_OBJECT_CLASS (boxes_topbar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_TOPBAR, BoxesTopbar);
	g_signal_connect_object ((GObject*) self, "notify::ui-state", (GCallback) _boxes_topbar_ui_state_changed_g_object_notify, self, 0);
	gtk_stack_set_transition_type ((GtkStack*) self, GTK_STACK_TRANSITION_TYPE_CROSSFADE);
	return obj;
}

static void
boxes_topbar_class_init (BoxesTopbarClass * klass,
                         gpointer klass_data)
{
	boxes_topbar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoxesTopbar_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_topbar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_topbar_set_property;
	G_OBJECT_CLASS (klass)->constructor = boxes_topbar_constructor;
	G_OBJECT_CLASS (klass)->finalize = boxes_topbar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_TOPBAR_PREVIOUS_UI_STATE_PROPERTY, boxes_topbar_properties[BOXES_TOPBAR_PREVIOUS_UI_STATE_PROPERTY] = g_param_spec_enum ("previous-ui-state", "previous-ui-state", "previous-ui-state", BOXES_TYPE_UI_STATE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_TOPBAR_UI_STATE_PROPERTY, boxes_topbar_properties[BOXES_TOPBAR_UI_STATE_PROPERTY] = g_param_spec_enum ("ui-state", "ui-state", "ui-state", BOXES_TYPE_UI_STATE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_TOPBAR_STATUS_PROPERTY, boxes_topbar_properties[BOXES_TOPBAR_STATUS_PROPERTY] = g_param_spec_string ("status", "status", "status", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_TOPBAR_PAGE_PROPERTY, boxes_topbar_properties[BOXES_TOPBAR_PAGE_PROPERTY] = g_param_spec_enum ("page", "page", "page", BOXES_TYPE_TOPBAR_PAGE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Boxes/ui/topbar.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "collection_toolbar", FALSE, BoxesTopbar_private_offset + G_STRUCT_OFFSET (BoxesTopbarPrivate, collection_toolbar));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "display_toolbar", FALSE, G_STRUCT_OFFSET (BoxesTopbar, display_toolbar));
}

static void
boxes_topbar_boxes_ui_interface_init (BoxesUIIface * iface,
                                      gpointer iface_data)
{
	boxes_topbar_boxes_ui_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_previous_ui_state = boxes_topbar_real_get_previous_ui_state;
	iface->set_previous_ui_state = boxes_topbar_real_set_previous_ui_state;
	iface->get_ui_state = boxes_topbar_real_get_ui_state;
	iface->set_ui_state = boxes_topbar_real_set_ui_state;
}

static void
boxes_topbar_instance_init (BoxesTopbar * self,
                            gpointer klass)
{
	self->priv = boxes_topbar_get_instance_private (self);
	g_type_ensure (BOXES_TYPE_COLLECTION_TOOLBAR);
	g_type_ensure (BOXES_TYPE_DISPLAY_TOOLBAR);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
boxes_topbar_finalize (GObject * obj)
{
	BoxesTopbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_TOPBAR, BoxesTopbar);
	_g_object_unref0 (self->priv->window);
	_g_free0 (self->_status);
	G_OBJECT_CLASS (boxes_topbar_parent_class)->finalize (obj);
}

static GType
boxes_topbar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoxesTopbarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_topbar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesTopbar), 0, (GInstanceInitFunc) boxes_topbar_instance_init, NULL };
	static const GInterfaceInfo boxes_ui_info = { (GInterfaceInitFunc) boxes_topbar_boxes_ui_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType boxes_topbar_type_id;
	boxes_topbar_type_id = g_type_register_static (gtk_stack_get_type (), "BoxesTopbar", &g_define_type_info, 0);
	g_type_add_interface_static (boxes_topbar_type_id, BOXES_TYPE_UI, &boxes_ui_info);
	BoxesTopbar_private_offset = g_type_add_instance_private (boxes_topbar_type_id, sizeof (BoxesTopbarPrivate));
	return boxes_topbar_type_id;
}

GType
boxes_topbar_get_type (void)
{
	static volatile gsize boxes_topbar_type_id__once = 0;
	if (g_once_init_enter (&boxes_topbar_type_id__once)) {
		GType boxes_topbar_type_id;
		boxes_topbar_type_id = boxes_topbar_get_type_once ();
		g_once_init_leave (&boxes_topbar_type_id__once, boxes_topbar_type_id);
	}
	return boxes_topbar_type_id__once;
}

static void
_vala_boxes_topbar_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	BoxesTopbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_TOPBAR, BoxesTopbar);
	switch (property_id) {
		case BOXES_TOPBAR_PREVIOUS_UI_STATE_PROPERTY:
		g_value_set_enum (value, boxes_ui_get_previous_ui_state ((BoxesUI*) self));
		break;
		case BOXES_TOPBAR_UI_STATE_PROPERTY:
		g_value_set_enum (value, boxes_ui_get_ui_state ((BoxesUI*) self));
		break;
		case BOXES_TOPBAR_STATUS_PROPERTY:
		g_value_set_string (value, boxes_topbar_get_status (self));
		break;
		case BOXES_TOPBAR_PAGE_PROPERTY:
		g_value_set_enum (value, boxes_topbar_get_page (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_boxes_topbar_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec)
{
	BoxesTopbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_TOPBAR, BoxesTopbar);
	switch (property_id) {
		case BOXES_TOPBAR_PREVIOUS_UI_STATE_PROPERTY:
		boxes_ui_set_previous_ui_state ((BoxesUI*) self, g_value_get_enum (value));
		break;
		case BOXES_TOPBAR_UI_STATE_PROPERTY:
		boxes_ui_set_ui_state ((BoxesUI*) self, g_value_get_enum (value));
		break;
		case BOXES_TOPBAR_STATUS_PROPERTY:
		boxes_topbar_set_status (self, g_value_get_string (value));
		break;
		case BOXES_TOPBAR_PAGE_PROPERTY:
		boxes_topbar_set_page (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

