/* searchbar.c generated by valac 0.17.5.2-8558, the Vala compiler
 * generated from searchbar.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <clutter/clutter.h>
#include <clutter-gtk/clutter-gtk.h>
#include <libgd/gd.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>


#define BOXES_TYPE_UI (boxes_ui_get_type ())
#define BOXES_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_UI, BoxesUI))
#define BOXES_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_UI, BoxesUIClass))
#define BOXES_IS_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_UI))
#define BOXES_IS_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_UI))
#define BOXES_UI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_UI, BoxesUIClass))

typedef struct _BoxesUI BoxesUI;
typedef struct _BoxesUIClass BoxesUIClass;
typedef struct _BoxesUIPrivate BoxesUIPrivate;

#define BOXES_TYPE_UI_STATE (boxes_ui_state_get_type ())

#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;
typedef struct _BoxesSearchbarPrivate BoxesSearchbarPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define BOXES_TYPE_APP (boxes_app_get_type ())
#define BOXES_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_APP, BoxesApp))
#define BOXES_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_APP, BoxesAppClass))
#define BOXES_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_APP))
#define BOXES_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_APP))
#define BOXES_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_APP, BoxesAppClass))

typedef struct _BoxesApp BoxesApp;
typedef struct _BoxesAppClass BoxesAppClass;
typedef struct _BoxesAppPrivate BoxesAppPrivate;

#define BOXES_TYPE_COLLECTION_ITEM (boxes_collection_item_get_type ())
#define BOXES_COLLECTION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItem))
#define BOXES_COLLECTION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItemClass))
#define BOXES_IS_COLLECTION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_COLLECTION_ITEM))
#define BOXES_IS_COLLECTION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_COLLECTION_ITEM))
#define BOXES_COLLECTION_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItemClass))

typedef struct _BoxesCollectionItem BoxesCollectionItem;
typedef struct _BoxesCollectionItemClass BoxesCollectionItemClass;

#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;

#define BOXES_TYPE_NOTIFICATIONBAR (boxes_notificationbar_get_type ())
#define BOXES_NOTIFICATIONBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_NOTIFICATIONBAR, BoxesNotificationbar))
#define BOXES_NOTIFICATIONBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_NOTIFICATIONBAR, BoxesNotificationbarClass))
#define BOXES_IS_NOTIFICATIONBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_NOTIFICATIONBAR))
#define BOXES_IS_NOTIFICATIONBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_NOTIFICATIONBAR))
#define BOXES_NOTIFICATIONBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_NOTIFICATIONBAR, BoxesNotificationbarClass))

typedef struct _BoxesNotificationbar BoxesNotificationbar;
typedef struct _BoxesNotificationbarClass BoxesNotificationbarClass;

#define BOXES_TYPE_REVEALER (boxes_revealer_get_type ())
#define BOXES_REVEALER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_REVEALER, BoxesRevealer))
#define BOXES_REVEALER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_REVEALER, BoxesRevealerClass))
#define BOXES_IS_REVEALER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_REVEALER))
#define BOXES_IS_REVEALER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_REVEALER))
#define BOXES_REVEALER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_REVEALER, BoxesRevealerClass))

typedef struct _BoxesRevealer BoxesRevealer;
typedef struct _BoxesRevealerClass BoxesRevealerClass;

#define BOXES_TYPE_SIDEBAR (boxes_sidebar_get_type ())
#define BOXES_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_SIDEBAR, BoxesSidebar))
#define BOXES_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_SIDEBAR, BoxesSidebarClass))
#define BOXES_IS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_SIDEBAR))
#define BOXES_IS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_SIDEBAR))
#define BOXES_SIDEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_SIDEBAR, BoxesSidebarClass))

typedef struct _BoxesSidebar BoxesSidebar;
typedef struct _BoxesSidebarClass BoxesSidebarClass;

#define BOXES_TYPE_SELECTIONBAR (boxes_selectionbar_get_type ())
#define BOXES_SELECTIONBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_SELECTIONBAR, BoxesSelectionbar))
#define BOXES_SELECTIONBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_SELECTIONBAR, BoxesSelectionbarClass))
#define BOXES_IS_SELECTIONBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_SELECTIONBAR))
#define BOXES_IS_SELECTIONBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_SELECTIONBAR))
#define BOXES_SELECTIONBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_SELECTIONBAR, BoxesSelectionbarClass))

typedef struct _BoxesSelectionbar BoxesSelectionbar;
typedef struct _BoxesSelectionbarClass BoxesSelectionbarClass;

#define BOXES_TYPE_WIZARD (boxes_wizard_get_type ())
#define BOXES_WIZARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_WIZARD, BoxesWizard))
#define BOXES_WIZARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_WIZARD, BoxesWizardClass))
#define BOXES_IS_WIZARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_WIZARD))
#define BOXES_IS_WIZARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_WIZARD))
#define BOXES_WIZARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_WIZARD, BoxesWizardClass))

typedef struct _BoxesWizard BoxesWizard;
typedef struct _BoxesWizardClass BoxesWizardClass;

#define BOXES_TYPE_PROPERTIES (boxes_properties_get_type ())
#define BOXES_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_PROPERTIES, BoxesProperties))
#define BOXES_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_PROPERTIES, BoxesPropertiesClass))
#define BOXES_IS_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_PROPERTIES))
#define BOXES_IS_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_PROPERTIES))
#define BOXES_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_PROPERTIES, BoxesPropertiesClass))

typedef struct _BoxesProperties BoxesProperties;
typedef struct _BoxesPropertiesClass BoxesPropertiesClass;

#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_COLLECTION (boxes_collection_get_type ())
#define BOXES_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_COLLECTION, BoxesCollection))
#define BOXES_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_COLLECTION, BoxesCollectionClass))
#define BOXES_IS_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_COLLECTION))
#define BOXES_IS_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_COLLECTION))
#define BOXES_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_COLLECTION, BoxesCollectionClass))

typedef struct _BoxesCollection BoxesCollection;
typedef struct _BoxesCollectionClass BoxesCollectionClass;

#define BOXES_TYPE_COLLECTION_FILTER (boxes_collection_filter_get_type ())
#define BOXES_COLLECTION_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_COLLECTION_FILTER, BoxesCollectionFilter))
#define BOXES_COLLECTION_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_COLLECTION_FILTER, BoxesCollectionFilterClass))
#define BOXES_IS_COLLECTION_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_COLLECTION_FILTER))
#define BOXES_IS_COLLECTION_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_COLLECTION_FILTER))
#define BOXES_COLLECTION_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_COLLECTION_FILTER, BoxesCollectionFilterClass))

typedef struct _BoxesCollectionFilter BoxesCollectionFilter;
typedef struct _BoxesCollectionFilterClass BoxesCollectionFilterClass;

#define BOXES_TYPE_COLLECTION_VIEW (boxes_collection_view_get_type ())
#define BOXES_COLLECTION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_COLLECTION_VIEW, BoxesCollectionView))
#define BOXES_COLLECTION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_COLLECTION_VIEW, BoxesCollectionViewClass))
#define BOXES_IS_COLLECTION_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_COLLECTION_VIEW))
#define BOXES_IS_COLLECTION_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_COLLECTION_VIEW))
#define BOXES_COLLECTION_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_COLLECTION_VIEW, BoxesCollectionViewClass))

typedef struct _BoxesCollectionView BoxesCollectionView;
typedef struct _BoxesCollectionViewClass BoxesCollectionViewClass;
typedef struct _BoxesCollectionFilterPrivate BoxesCollectionFilterPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block32Data Block32Data;

typedef enum  {
	BOXES_UI_STATE_NONE,
	BOXES_UI_STATE_COLLECTION,
	BOXES_UI_STATE_CREDS,
	BOXES_UI_STATE_DISPLAY,
	BOXES_UI_STATE_SETTINGS,
	BOXES_UI_STATE_WIZARD,
	BOXES_UI_STATE_PROPERTIES
} BoxesUIState;

struct _BoxesUI {
	GObject parent_instance;
	BoxesUIPrivate * priv;
	BoxesUIState previous_ui_state;
};

struct _BoxesUIClass {
	GObjectClass parent_class;
	void (*ui_state_changed) (BoxesUI* self);
	ClutterActor* (*get_actor) (BoxesUI* self);
};

struct _BoxesSearchbar {
	BoxesUI parent_instance;
	BoxesSearchbarPrivate * priv;
};

struct _BoxesSearchbarClass {
	BoxesUIClass parent_class;
};

struct _BoxesSearchbarPrivate {
	GtkClutterActor* gtk_actor;
	GdTaggedEntry* entry;
	guint refilter_delay_id;
	gboolean _visible;
};

struct _BoxesApp {
	BoxesUI parent_instance;
	BoxesAppPrivate * priv;
	GtkApplicationWindow* window;
	GtkNotebook* notebook;
	GtkClutterEmbed* embed;
	ClutterStage* stage;
	ClutterBinLayout* stage_bin;
	ClutterActor* overlay_bin_actor;
	ClutterBinLayout* overlay_bin;
	BoxesCollectionItem* current_item;
	BoxesSearchbar* searchbar;
	BoxesTopbar* topbar;
	BoxesNotificationbar* notificationbar;
	BoxesRevealer* sidebar_revealer;
	BoxesRevealer* searchbar_revealer;
	BoxesSidebar* sidebar;
	BoxesSelectionbar* selectionbar;
	guint duration;
	GSettings* settings;
	BoxesWizard* wizard;
	BoxesProperties* properties;
	BoxesDisplayPage* display_page;
	BoxesCollection* collection;
	BoxesCollectionFilter* filter;
	GSimpleAction* action_properties;
	GSimpleAction* action_fullscreen;
	GSimpleAction* action_shutdown;
	BoxesCollectionView* view;
};

struct _BoxesAppClass {
	BoxesUIClass parent_class;
};

struct _BoxesCollectionFilter {
	GObject parent_instance;
	BoxesCollectionFilterPrivate * priv;
	gchar* text;
};

struct _BoxesCollectionFilterClass {
	GObjectClass parent_class;
};

struct _Block32Data {
	int _ref_count_;
	BoxesSearchbar * self;
	gboolean preedit_changed;
};


static gpointer boxes_searchbar_parent_class = NULL;
extern BoxesApp* boxes_app_app;

GType boxes_ui_get_type (void) G_GNUC_CONST;
GType boxes_ui_state_get_type (void) G_GNUC_CONST;
GType boxes_searchbar_get_type (void) G_GNUC_CONST;
#define BOXES_SEARCHBAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BOXES_TYPE_SEARCHBAR, BoxesSearchbarPrivate))
enum  {
	BOXES_SEARCHBAR_DUMMY_PROPERTY,
	BOXES_SEARCHBAR_ACTOR,
	BOXES_SEARCHBAR_VISIBLE,
	BOXES_SEARCHBAR_TEXT
};
#define BOXES_SEARCHBAR_refilter_delay ((guint) 200)
BoxesSearchbar* boxes_searchbar_new (void);
BoxesSearchbar* boxes_searchbar_construct (GType object_type);
BoxesUI* boxes_ui_construct (GType object_type);
static void boxes_searchbar_setup_searchbar (BoxesSearchbar* self);
GType boxes_app_get_type (void) G_GNUC_CONST;
GType boxes_collection_item_get_type (void) G_GNUC_CONST;
GType boxes_topbar_get_type (void) G_GNUC_CONST;
GType boxes_notificationbar_get_type (void) G_GNUC_CONST;
GType boxes_revealer_get_type (void) G_GNUC_CONST;
GType boxes_sidebar_get_type (void) G_GNUC_CONST;
GType boxes_selectionbar_get_type (void) G_GNUC_CONST;
GType boxes_wizard_get_type (void) G_GNUC_CONST;
GType boxes_properties_get_type (void) G_GNUC_CONST;
GType boxes_display_page_get_type (void) G_GNUC_CONST;
GType boxes_collection_get_type (void) G_GNUC_CONST;
GType boxes_collection_filter_get_type (void) G_GNUC_CONST;
GType boxes_collection_view_get_type (void) G_GNUC_CONST;
static gboolean boxes_searchbar_on_app_key_pressed (BoxesSearchbar* self, GtkWidget* widget, GdkEventKey* event);
static gboolean _boxes_searchbar_on_app_key_pressed_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self);
static void __lambda6_ (BoxesSearchbar* self);
const gchar* boxes_searchbar_get_text (BoxesSearchbar* self);
static gboolean boxes_searchbar_refilter (BoxesSearchbar* self);
static gboolean _boxes_searchbar_refilter_gsource_func (gpointer self);
static void ___lambda6__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void __lambda107_ (BoxesSearchbar* self);
void boxes_collection_view_activate (BoxesCollectionView* self);
static void ___lambda107__gtk_entry_activate (GtkEntry* _sender, gpointer self);
void boxes_collection_view_refilter (BoxesCollectionView* self);
void boxes_searchbar_grab_focus (BoxesSearchbar* self);
static Block32Data* block32_data_ref (Block32Data* _data32_);
static void block32_data_unref (void * _userdata_);
BoxesUIState boxes_ui_get_ui_state (BoxesUI* self);
ClutterActor* boxes_ui_get_actor (BoxesUI* self);
static void __lambda2_ (Block32Data* _data32_);
static void ___lambda2__gtk_entry_preedit_changed (GtkEntry* _sender, const gchar* p0, gpointer self);
gboolean boxes_searchbar_get_visible (BoxesSearchbar* self);
void boxes_searchbar_set_text (BoxesSearchbar* self, const gchar* value);
void boxes_searchbar_set_visible (BoxesSearchbar* self, gboolean value);
static void boxes_searchbar_real_ui_state_changed (BoxesUI* base);
void boxes_revealer_set_revealed (BoxesRevealer* self, gboolean value);
static void boxes_searchbar_finalize (GObject* obj);
static void _vala_boxes_searchbar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_boxes_searchbar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static gboolean _boxes_searchbar_on_app_key_pressed_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
	gboolean result;
	result = boxes_searchbar_on_app_key_pressed (self, _sender, event);
	return result;
}


static gboolean _boxes_searchbar_refilter_gsource_func (gpointer self) {
	gboolean result;
	result = boxes_searchbar_refilter (self);
	return result;
}


static void __lambda6_ (BoxesSearchbar* self) {
	guint _tmp0_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	_tmp0_ = self->priv->refilter_delay_id;
	if (_tmp0_ != ((guint) 0)) {
		guint _tmp1_;
		_tmp1_ = self->priv->refilter_delay_id;
		g_source_remove (_tmp1_);
	}
	_tmp2_ = boxes_searchbar_get_text (self);
	_tmp3_ = _tmp2_;
	if (g_strcmp0 (_tmp3_, "") == 0) {
		boxes_searchbar_refilter (self);
	} else {
		guint _tmp4_ = 0U;
		_tmp4_ = g_timeout_add_full (G_PRIORITY_DEFAULT, BOXES_SEARCHBAR_refilter_delay, _boxes_searchbar_refilter_gsource_func, g_object_ref (self), g_object_unref);
		self->priv->refilter_delay_id = _tmp4_;
	}
}


static void ___lambda6__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	__lambda6_ (self);
}


static void __lambda107_ (BoxesSearchbar* self) {
	BoxesApp* _tmp0_;
	BoxesCollectionView* _tmp1_;
	_tmp0_ = boxes_app_app;
	_tmp1_ = _tmp0_->view;
	boxes_collection_view_activate (_tmp1_);
}


static void ___lambda107__gtk_entry_activate (GtkEntry* _sender, gpointer self) {
	__lambda107_ (self);
}


BoxesSearchbar* boxes_searchbar_construct (GType object_type) {
	BoxesSearchbar * self = NULL;
	BoxesApp* _tmp0_;
	GtkApplicationWindow* _tmp1_;
	GdTaggedEntry* _tmp2_;
	GdTaggedEntry* _tmp3_;
	self = (BoxesSearchbar*) boxes_ui_construct (object_type);
	boxes_searchbar_setup_searchbar (self);
	_tmp0_ = boxes_app_app;
	_tmp1_ = _tmp0_->window;
	g_signal_connect_object ((GtkWidget*) _tmp1_, "key-press-event", (GCallback) _boxes_searchbar_on_app_key_pressed_gtk_widget_key_press_event, self, 0);
	_tmp2_ = self->priv->entry;
	g_signal_connect_object ((GObject*) _tmp2_, "notify::text", (GCallback) ___lambda6__g_object_notify, self, 0);
	_tmp3_ = self->priv->entry;
	g_signal_connect_object ((GtkEntry*) _tmp3_, "activate", (GCallback) ___lambda107__gtk_entry_activate, self, 0);
	return self;
}


BoxesSearchbar* boxes_searchbar_new (void) {
	return boxes_searchbar_construct (BOXES_TYPE_SEARCHBAR);
}


static gboolean boxes_searchbar_refilter (BoxesSearchbar* self) {
	gboolean result = FALSE;
	BoxesApp* _tmp0_;
	BoxesCollectionFilter* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	BoxesApp* _tmp5_;
	BoxesCollectionView* _tmp6_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = boxes_app_app;
	_tmp1_ = _tmp0_->filter;
	_tmp2_ = boxes_searchbar_get_text (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup (_tmp3_);
	_g_free0 (_tmp1_->text);
	_tmp1_->text = _tmp4_;
	_tmp5_ = boxes_app_app;
	_tmp6_ = _tmp5_->view;
	boxes_collection_view_refilter (_tmp6_);
	self->priv->refilter_delay_id = (guint) 0;
	result = FALSE;
	return result;
}


void boxes_searchbar_grab_focus (BoxesSearchbar* self) {
	GdTaggedEntry* _tmp0_;
	GdkDevice* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entry;
	_tmp1_ = gtk_get_current_event_device ();
	gd_entry_focus_hack ((GtkWidget*) _tmp0_, _tmp1_);
}


static Block32Data* block32_data_ref (Block32Data* _data32_) {
	g_atomic_int_inc (&_data32_->_ref_count_);
	return _data32_;
}


static void block32_data_unref (void * _userdata_) {
	Block32Data* _data32_;
	_data32_ = (Block32Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data32_->_ref_count_)) {
		BoxesSearchbar * self;
		self = _data32_->self;
		_g_object_unref0 (self);
		g_slice_free (Block32Data, _data32_);
	}
}


static void __lambda2_ (Block32Data* _data32_) {
	BoxesSearchbar * self;
	self = _data32_->self;
	_data32_->preedit_changed = TRUE;
}


static void ___lambda2__gtk_entry_preedit_changed (GtkEntry* _sender, const gchar* p0, gpointer self) {
	__lambda2_ (self);
}


static gboolean boxes_searchbar_on_app_key_pressed (BoxesSearchbar* self, GtkWidget* widget, GdkEventKey* event) {
	gboolean result = FALSE;
	Block32Data* _data32_;
	gboolean handled;
	BoxesUIState _tmp0_;
	BoxesUIState _tmp1_;
	GdTaggedEntry* _tmp2_;
	gboolean _tmp3_ = FALSE;
	GdTaggedEntry* _tmp8_;
	gulong _tmp9_ = 0UL;
	gulong preedit_changed_id;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* old_text;
	gboolean _tmp13_;
	gboolean _tmp14_;
	gboolean _tmp15_ = FALSE;
	gboolean _tmp16_;
	gboolean _tmp17_;
	gboolean _tmp20_;
	GdTaggedEntry* _tmp21_;
	gboolean _tmp22_ = FALSE;
	gboolean res;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* new_text;
	GdTaggedEntry* _tmp26_;
	gulong _tmp27_;
	gboolean _tmp28_ = FALSE;
	gboolean _tmp29_ = FALSE;
	gboolean _tmp30_;
	gboolean _tmp33_;
	gboolean _tmp35_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (widget != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_data32_ = g_slice_new0 (Block32Data);
	_data32_->_ref_count_ = 1;
	_data32_->self = g_object_ref (self);
	handled = FALSE;
	_tmp0_ = boxes_ui_get_ui_state ((BoxesUI*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != BOXES_UI_STATE_COLLECTION) {
		result = handled;
		block32_data_unref (_data32_);
		_data32_ = NULL;
		return result;
	}
	_tmp2_ = self->priv->entry;
	_tmp3_ = gtk_widget_get_realized ((GtkWidget*) _tmp2_);
	if (!_tmp3_) {
		ClutterActor* _tmp4_;
		ClutterActor* _tmp5_;
		ClutterActor* _tmp6_;
		ClutterActor* _tmp7_;
		_tmp4_ = boxes_ui_get_actor ((BoxesUI*) self);
		_tmp5_ = _tmp4_;
		clutter_actor_show (_tmp5_);
		_tmp6_ = boxes_ui_get_actor ((BoxesUI*) self);
		_tmp7_ = _tmp6_;
		clutter_actor_hide (_tmp7_);
	}
	_data32_->preedit_changed = FALSE;
	_tmp8_ = self->priv->entry;
	_tmp9_ = g_signal_connect_data ((GtkEntry*) _tmp8_, "preedit-changed", (GCallback) ___lambda2__gtk_entry_preedit_changed, block32_data_ref (_data32_), (GClosureNotify) block32_data_unref, 0);
	preedit_changed_id = _tmp9_;
	_tmp10_ = boxes_searchbar_get_text (self);
	_tmp11_ = _tmp10_;
	_tmp12_ = g_strdup (_tmp11_);
	old_text = _tmp12_;
	_tmp13_ = boxes_searchbar_get_visible (self);
	_tmp14_ = _tmp13_;
	if (!_tmp14_) {
		boxes_searchbar_set_text (self, "");
	}
	_tmp16_ = boxes_searchbar_get_visible (self);
	_tmp17_ = _tmp16_;
	if (_tmp17_) {
		GdkEventKey _tmp18_;
		guint _tmp19_;
		_tmp18_ = *event;
		_tmp19_ = _tmp18_.keyval;
		_tmp15_ = _tmp19_ == ((guint) GDK_KEY_Escape);
	} else {
		_tmp15_ = FALSE;
	}
	_tmp20_ = _tmp15_;
	if (_tmp20_) {
		boxes_searchbar_set_text (self, "");
		boxes_searchbar_set_visible (self, FALSE);
		result = TRUE;
		_g_free0 (old_text);
		block32_data_unref (_data32_);
		_data32_ = NULL;
		return result;
	}
	_tmp21_ = self->priv->entry;
	_tmp22_ = gtk_widget_event ((GtkWidget*) _tmp21_, (GdkEvent*) (event));
	res = _tmp22_;
	_tmp23_ = boxes_searchbar_get_text (self);
	_tmp24_ = _tmp23_;
	_tmp25_ = g_strdup (_tmp24_);
	new_text = _tmp25_;
	_tmp26_ = self->priv->entry;
	_tmp27_ = preedit_changed_id;
	g_signal_handler_disconnect ((GObject*) _tmp26_, _tmp27_);
	_tmp30_ = res;
	if (_tmp30_) {
		const gchar* _tmp31_;
		const gchar* _tmp32_;
		_tmp31_ = new_text;
		_tmp32_ = old_text;
		_tmp29_ = g_strcmp0 (_tmp31_, _tmp32_) != 0;
	} else {
		_tmp29_ = FALSE;
	}
	_tmp33_ = _tmp29_;
	if (_tmp33_) {
		_tmp28_ = TRUE;
	} else {
		gboolean _tmp34_;
		_tmp34_ = _data32_->preedit_changed;
		_tmp28_ = _tmp34_;
	}
	_tmp35_ = _tmp28_;
	if (_tmp35_) {
		gboolean _tmp36_;
		gboolean _tmp37_;
		handled = TRUE;
		_tmp36_ = boxes_searchbar_get_visible (self);
		_tmp37_ = _tmp36_;
		if (!_tmp37_) {
			boxes_searchbar_set_visible (self, TRUE);
		} else {
			boxes_searchbar_grab_focus (self);
		}
	}
	result = handled;
	_g_free0 (new_text);
	_g_free0 (old_text);
	block32_data_unref (_data32_);
	_data32_ = NULL;
	return result;
}


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


static void boxes_searchbar_setup_searchbar (BoxesSearchbar* self) {
	GtkToolbar* _tmp0_;
	GtkToolbar* toolbar;
	GtkToolbar* _tmp1_;
	GtkToolbar* widget;
	GtkStyleContext* _tmp2_ = NULL;
	GtkToolItem* _tmp3_;
	GtkToolItem* item;
	GdMarginContainer* _tmp4_;
	GdMarginContainer* margin;
	GtkBox* _tmp5_;
	GtkBox* box;
	GdTaggedEntry* _tmp6_;
	GdTaggedEntry* _tmp7_;
	GdTaggedEntry* _tmp8_;
	GdTaggedEntry* _tmp9_;
	GtkClutterActor* _tmp10_;
	GtkClutterActor* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkToolbar*) gtk_toolbar_new ();
	g_object_ref_sink (_tmp0_);
	toolbar = _tmp0_;
	_tmp1_ = _g_object_ref0 (toolbar);
	widget = _tmp1_;
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) toolbar);
	gtk_style_context_add_class (_tmp2_, GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
	_tmp3_ = gtk_tool_item_new ();
	g_object_ref_sink (_tmp3_);
	item = _tmp3_;
	gtk_toolbar_insert (toolbar, item, 0);
	gtk_tool_item_set_expand (item, TRUE);
	_tmp4_ = gd_margin_container_new ();
	g_object_ref_sink (_tmp4_);
	margin = _tmp4_;
	gtk_container_add ((GtkContainer*) item, (GtkWidget*) margin);
	g_object_set (margin, "min-margin", 6, NULL);
	g_object_set (margin, "max-margin", 64, NULL);
	_tmp5_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp5_);
	box = _tmp5_;
	gtk_container_add ((GtkContainer*) margin, (GtkWidget*) box);
	_tmp6_ = gd_tagged_entry_new ();
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->entry);
	self->priv->entry = _tmp6_;
	_tmp7_ = self->priv->entry;
	g_object_set ((GtkWidget*) _tmp7_, "width-request", 260, NULL);
	_tmp8_ = self->priv->entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp8_, TRUE);
	_tmp9_ = self->priv->entry;
	gtk_container_add ((GtkContainer*) box, (GtkWidget*) _tmp9_);
	gtk_widget_show_all ((GtkWidget*) widget);
	_tmp10_ = (GtkClutterActor*) gtk_clutter_actor_new_with_contents ((GtkWidget*) widget);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->gtk_actor);
	self->priv->gtk_actor = _tmp10_;
	_tmp11_ = self->priv->gtk_actor;
	clutter_actor_set_name ((ClutterActor*) _tmp11_, "searchbar");
	_g_object_unref0 (box);
	_g_object_unref0 (margin);
	_g_object_unref0 (item);
	_g_object_unref0 (widget);
	_g_object_unref0 (toolbar);
}


static void boxes_searchbar_real_ui_state_changed (BoxesUI* base) {
	BoxesSearchbar * self;
	BoxesUIState _tmp0_;
	BoxesUIState _tmp1_;
	self = (BoxesSearchbar*) base;
	_tmp0_ = boxes_ui_get_ui_state ((BoxesUI*) self);
	_tmp1_ = _tmp0_;
	switch (_tmp1_) {
		case BOXES_UI_STATE_COLLECTION:
		{
			break;
		}
		default:
		{
			break;
		}
	}
}


static ClutterActor* boxes_searchbar_real_get_actor (BoxesUI* base) {
	ClutterActor* result;
	BoxesSearchbar* self;
	GtkClutterActor* _tmp0_;
	self = (BoxesSearchbar*) base;
	_tmp0_ = self->priv->gtk_actor;
	result = (ClutterActor*) _tmp0_;
	return result;
}


gboolean boxes_searchbar_get_visible (BoxesSearchbar* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_visible;
	result = _tmp0_;
	return result;
}


void boxes_searchbar_set_visible (BoxesSearchbar* self, gboolean value) {
	gboolean _tmp0_;
	gboolean _tmp1_;
	BoxesApp* _tmp2_;
	BoxesRevealer* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_visible;
	_tmp1_ = value;
	if (_tmp0_ == _tmp1_) {
		return;
	}
	_tmp2_ = boxes_app_app;
	_tmp3_ = _tmp2_->searchbar_revealer;
	_tmp4_ = value;
	boxes_revealer_set_revealed (_tmp3_, _tmp4_);
	_tmp5_ = value;
	if (_tmp5_) {
		boxes_searchbar_grab_focus (self);
	}
	_tmp6_ = value;
	self->priv->_visible = _tmp6_;
	g_object_notify ((GObject *) self, "visible");
}


const gchar* boxes_searchbar_get_text (BoxesSearchbar* self) {
	const gchar* result;
	GdTaggedEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->entry;
	_tmp1_ = gtk_entry_get_text ((GtkEntry*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}


void boxes_searchbar_set_text (BoxesSearchbar* self, const gchar* value) {
	GdTaggedEntry* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entry;
	_tmp1_ = value;
	gtk_entry_set_text ((GtkEntry*) _tmp0_, _tmp1_);
	g_object_notify ((GObject *) self, "text");
}


static void boxes_searchbar_class_init (BoxesSearchbarClass * klass) {
	boxes_searchbar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (BoxesSearchbarPrivate));
	BOXES_UI_CLASS (klass)->ui_state_changed = boxes_searchbar_real_ui_state_changed;
	BOXES_UI_CLASS (klass)->get_actor = boxes_searchbar_real_get_actor;
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_searchbar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_searchbar_set_property;
	G_OBJECT_CLASS (klass)->finalize = boxes_searchbar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_SEARCHBAR_ACTOR, g_param_spec_object ("actor", "actor", "actor", clutter_actor_get_type (), G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_SEARCHBAR_VISIBLE, g_param_spec_boolean ("visible", "visible", "visible", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_SEARCHBAR_TEXT, g_param_spec_string ("text", "text", "text", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void boxes_searchbar_instance_init (BoxesSearchbar * self) {
	self->priv = BOXES_SEARCHBAR_GET_PRIVATE (self);
}


static void boxes_searchbar_finalize (GObject* obj) {
	BoxesSearchbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_SEARCHBAR, BoxesSearchbar);
	_g_object_unref0 (self->priv->gtk_actor);
	_g_object_unref0 (self->priv->entry);
	G_OBJECT_CLASS (boxes_searchbar_parent_class)->finalize (obj);
}


GType boxes_searchbar_get_type (void) {
	static volatile gsize boxes_searchbar_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_searchbar_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesSearchbarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_searchbar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesSearchbar), 0, (GInstanceInitFunc) boxes_searchbar_instance_init, NULL };
		GType boxes_searchbar_type_id;
		boxes_searchbar_type_id = g_type_register_static (BOXES_TYPE_UI, "BoxesSearchbar", &g_define_type_info, 0);
		g_once_init_leave (&boxes_searchbar_type_id__volatile, boxes_searchbar_type_id);
	}
	return boxes_searchbar_type_id__volatile;
}


static void _vala_boxes_searchbar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	BoxesSearchbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_SEARCHBAR, BoxesSearchbar);
	switch (property_id) {
		case BOXES_SEARCHBAR_ACTOR:
		g_value_set_object (value, boxes_ui_get_actor ((BoxesUI*) self));
		break;
		case BOXES_SEARCHBAR_VISIBLE:
		g_value_set_boolean (value, boxes_searchbar_get_visible (self));
		break;
		case BOXES_SEARCHBAR_TEXT:
		g_value_set_string (value, boxes_searchbar_get_text (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_boxes_searchbar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	BoxesSearchbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_SEARCHBAR, BoxesSearchbar);
	switch (property_id) {
		case BOXES_SEARCHBAR_VISIBLE:
		boxes_searchbar_set_visible (self, g_value_get_boolean (value));
		break;
		case BOXES_SEARCHBAR_TEXT:
		boxes_searchbar_set_text (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



