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

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

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

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

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

typedef struct _TootleViewsTabbedBase TootleViewsTabbedBase;
typedef struct _TootleViewsTabbedBaseClass TootleViewsTabbedBaseClass;
typedef struct _TootleViewsTabbedBasePrivate TootleViewsTabbedBasePrivate;

#define TOOTLE_VIEWS_TYPE_SEARCH (tootle_views_search_get_type ())
#define TOOTLE_VIEWS_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_VIEWS_TYPE_SEARCH, TootleViewsSearch))
#define TOOTLE_VIEWS_SEARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_VIEWS_TYPE_SEARCH, TootleViewsSearchClass))
#define TOOTLE_VIEWS_IS_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_VIEWS_TYPE_SEARCH))
#define TOOTLE_VIEWS_IS_SEARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_VIEWS_TYPE_SEARCH))
#define TOOTLE_VIEWS_SEARCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_VIEWS_TYPE_SEARCH, TootleViewsSearchClass))

typedef struct _TootleViewsSearch TootleViewsSearch;
typedef struct _TootleViewsSearchClass TootleViewsSearchClass;
typedef struct _TootleViewsSearchPrivate TootleViewsSearchPrivate;
enum  {
	TOOTLE_VIEWS_SEARCH_0_PROPERTY,
	TOOTLE_VIEWS_SEARCH_QUERY_PROPERTY,
	TOOTLE_VIEWS_SEARCH_NUM_PROPERTIES
};
static GParamSpec* tootle_views_search_properties[TOOTLE_VIEWS_SEARCH_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TOOTLE_TYPE_ENTITY (tootle_entity_get_type ())
#define TOOTLE_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_ENTITY, TootleEntity))
#define TOOTLE_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_ENTITY, TootleEntityClass))
#define TOOTLE_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_ENTITY))
#define TOOTLE_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_ENTITY))
#define TOOTLE_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_ENTITY, TootleEntityClass))

typedef struct _TootleEntity TootleEntity;
typedef struct _TootleEntityClass TootleEntityClass;

#define TOOTLE_TYPE_WIDGETIZABLE (tootle_widgetizable_get_type ())
#define TOOTLE_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_WIDGETIZABLE, TootleWidgetizable))
#define TOOTLE_IS_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_WIDGETIZABLE))
#define TOOTLE_WIDGETIZABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TOOTLE_TYPE_WIDGETIZABLE, TootleWidgetizableIface))

typedef struct _TootleWidgetizable TootleWidgetizable;
typedef struct _TootleWidgetizableIface TootleWidgetizableIface;

#define TOOTLE_API_TYPE_ACCOUNT (tootle_api_account_get_type ())
#define TOOTLE_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccount))
#define TOOTLE_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccountClass))
#define TOOTLE_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_ACCOUNT))
#define TOOTLE_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_ACCOUNT))
#define TOOTLE_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccountClass))

typedef struct _TootleAPIAccount TootleAPIAccount;
typedef struct _TootleAPIAccountClass TootleAPIAccountClass;

#define TOOTLE_TYPE_INSTANCE_ACCOUNT (tootle_instance_account_get_type ())
#define TOOTLE_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccount))
#define TOOTLE_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccountClass))
#define TOOTLE_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT))
#define TOOTLE_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_INSTANCE_ACCOUNT))
#define TOOTLE_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_INSTANCE_ACCOUNT, TootleInstanceAccountClass))

typedef struct _TootleInstanceAccount TootleInstanceAccount;
typedef struct _TootleInstanceAccountClass TootleInstanceAccountClass;

#define TOOTLE_API_TYPE_SEARCH_RESULTS (tootle_api_search_results_get_type ())
#define TOOTLE_API_SEARCH_RESULTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_SEARCH_RESULTS, TootleAPISearchResults))
#define TOOTLE_API_SEARCH_RESULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_SEARCH_RESULTS, TootleAPISearchResultsClass))
#define TOOTLE_API_IS_SEARCH_RESULTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_SEARCH_RESULTS))
#define TOOTLE_API_IS_SEARCH_RESULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_SEARCH_RESULTS))
#define TOOTLE_API_SEARCH_RESULTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_SEARCH_RESULTS, TootleAPISearchResultsClass))

typedef struct _TootleAPISearchResults TootleAPISearchResults;
typedef struct _TootleAPISearchResultsClass TootleAPISearchResultsClass;

#define TOOTLE_TYPE_ACCOUNTS (tootle_accounts_get_type ())
#define TOOTLE_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_ACCOUNTS, TootleAccounts))
#define TOOTLE_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_ACCOUNTS, TootleAccountsClass))
#define TOOTLE_IS_ACCOUNTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_ACCOUNTS))
#define TOOTLE_IS_ACCOUNTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_ACCOUNTS))
#define TOOTLE_ACCOUNTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_ACCOUNTS, TootleAccountsClass))

typedef struct _TootleAccounts TootleAccounts;
typedef struct _TootleAccountsClass TootleAccountsClass;

#define TOOTLE_API_TYPE_STATUS (tootle_api_status_get_type ())
#define TOOTLE_API_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_STATUS, TootleAPIStatus))
#define TOOTLE_API_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_STATUS, TootleAPIStatusClass))
#define TOOTLE_API_IS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_STATUS))
#define TOOTLE_API_IS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_STATUS))
#define TOOTLE_API_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_STATUS, TootleAPIStatusClass))

typedef struct _TootleAPIStatus TootleAPIStatus;
typedef struct _TootleAPIStatusClass TootleAPIStatusClass;

#define TOOTLE_API_TYPE_TAG (tootle_api_tag_get_type ())
#define TOOTLE_API_TAG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_TAG, TootleAPITag))
#define TOOTLE_API_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_TAG, TootleAPITagClass))
#define TOOTLE_API_IS_TAG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_TAG))
#define TOOTLE_API_IS_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_TAG))
#define TOOTLE_API_TAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_TAG, TootleAPITagClass))

typedef struct _TootleAPITag TootleAPITag;
typedef struct _TootleAPITagClass TootleAPITagClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

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

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

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

struct _TootleViewsTabbedBaseClass {
	TootleViewsBaseClass parent_class;
};

struct _TootleViewsSearch {
	TootleViewsTabbedBase parent_instance;
	TootleViewsSearchPrivate * priv;
};

struct _TootleViewsSearchClass {
	TootleViewsTabbedBaseClass parent_class;
};

struct _TootleViewsSearchPrivate {
	gchar* _query;
	HdySearchBar* bar;
	HdyClamp* bar_clamp;
	GtkSearchEntry* entry;
	TootleViewsBase* accounts_tab;
	TootleViewsBase* statuses_tab;
	TootleViewsBase* hashtags_tab;
};

typedef enum  {
	TOOTLE_OOPSIE_USER,
	TOOTLE_OOPSIE_PARSING,
	TOOTLE_OOPSIE_INSTANCE,
	TOOTLE_OOPSIE_INTERNAL
} TootleOopsie;
#define TOOTLE_OOPSIE tootle_oopsie_quark ()
struct _TootleWidgetizableIface {
	GTypeInterface parent_iface;
	GtkWidget* (*to_widget) (TootleWidgetizable* self, GError** error);
	void (*open) (TootleWidgetizable* self);
	void (*resolve_open) (TootleWidgetizable* self, TootleInstanceAccount* account);
};

static gint TootleViewsSearch_private_offset;
static gpointer tootle_views_search_parent_class = NULL;
extern gchar* tootle_views_base_STATUS_LOADING;
extern TootleAccounts* tootle_accounts;

GType tootle_views_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleViewsBase, g_object_unref)
GType tootle_views_tabbed_base_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleViewsTabbedBase, g_object_unref)
GType tootle_views_search_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleViewsSearch, g_object_unref)
TootleViewsSearch* tootle_views_search_new (void);
TootleViewsSearch* tootle_views_search_construct (GType object_type);
const gchar* tootle_views_search_get_query (TootleViewsSearch* self);
static void __lambda130_ (TootleViewsSearch* self);
static void tootle_views_search_request (TootleViewsSearch* self);
static void ___lambda130__gtk_entry_activate (GtkEntry* _sender,
                                       gpointer self);
static void __lambda135_ (TootleViewsSearch* self);
static void ___lambda135__gtk_entry_icon_press (GtkEntry* _sender,
                                         GtkEntryIconPosition icon_pos,
                                         GdkEvent* event,
                                         gpointer self);
static void _tootle_views_search_request_gtk_button_clicked (GtkButton* _sender,
                                                      gpointer self);
TootleViewsBase* tootle_views_tabbed_base_add_list_tab (TootleViewsTabbedBase* self,
                                                        const gchar* label,
                                                        const gchar* icon);
GType tootle_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleEntity, g_object_unref)
static gboolean tootle_views_search_append (TootleViewsSearch* self,
                                     TootleViewsBase* tab,
                                     TootleEntity* entity);
GQuark tootle_oopsie_quark (void);
GType tootle_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIAccount, g_object_unref)
GType tootle_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleInstanceAccount, g_object_unref)
GType tootle_widgetizable_get_type (void) G_GNUC_CONST ;
GtkWidget* tootle_widgetizable_to_widget (TootleWidgetizable* self,
                                          GError** error);
void tootle_views_search_set_query (TootleViewsSearch* self,
                                    const gchar* value);
void tootle_views_base_clear (TootleViewsBase* self);
void tootle_views_base_set_state (TootleViewsBase* self,
                                  const gchar* value);
void tootle_views_base_set_status_message (TootleViewsBase* self,
                                           const gchar* value);
void tootle_api_search_results_request (const gchar* q,
                                        TootleInstanceAccount* account,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
GType tootle_api_search_results_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPISearchResults, g_object_unref)
TootleAPISearchResults* tootle_api_search_results_request_finish (GAsyncResult* _res_,
                                                                  GError** error);
GType tootle_accounts_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAccounts, g_object_unref)
TootleInstanceAccount* tootle_accounts_get_active (TootleAccounts* self);
static void __lambda131_ (TootleViewsSearch* self,
                   GObject* obj,
                   GAsyncResult* res);
GeeArrayList* tootle_api_search_results_get_accounts (TootleAPISearchResults* self);
static gboolean ____lambda132_ (TootleViewsSearch* self,
                         TootleAPIAccount* e);
static gboolean _____lambda132__gee_forall_func (gpointer g,
                                          gpointer self);
GType tootle_api_status_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIStatus, g_object_unref)
GeeArrayList* tootle_api_search_results_get_statuses (TootleAPISearchResults* self);
static gboolean ____lambda133_ (TootleViewsSearch* self,
                         TootleAPIStatus* e);
static gboolean _____lambda133__gee_forall_func (gpointer g,
                                          gpointer self);
GType tootle_api_tag_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPITag, g_object_unref)
GeeArrayList* tootle_api_search_results_get_hashtags (TootleAPISearchResults* self);
static gboolean ____lambda134_ (TootleViewsSearch* self,
                         TootleAPITag* e);
static gboolean _____lambda134__gee_forall_func (gpointer g,
                                          gpointer self);
void tootle_views_base_on_content_changed (TootleViewsBase* self);
void tootle_views_base_on_error (TootleViewsBase* self,
                                 gint32 code,
                                 const gchar* reason);
static void ___lambda131__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void tootle_views_search_finalize (GObject * obj);
static GType tootle_views_search_get_type_once (void);
static void _vala_tootle_views_search_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_tootle_views_search_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
tootle_views_search_get_instance_private (TootleViewsSearch* self)
{
	return G_STRUCT_MEMBER_P (self, TootleViewsSearch_private_offset);
}

static void
__lambda130_ (TootleViewsSearch* self)
{
	tootle_views_search_request (self);
}

static void
___lambda130__gtk_entry_activate (GtkEntry* _sender,
                                  gpointer self)
{
	__lambda130_ ((TootleViewsSearch*) self);
}

static void
__lambda135_ (TootleViewsSearch* self)
{
	GtkSearchEntry* _tmp0_;
	_tmp0_ = self->priv->entry;
	gtk_entry_set_text ((GtkEntry*) _tmp0_, "");
	tootle_views_search_request (self);
}

static void
___lambda135__gtk_entry_icon_press (GtkEntry* _sender,
                                    GtkEntryIconPosition icon_pos,
                                    GdkEvent* event,
                                    gpointer self)
{
	__lambda135_ ((TootleViewsSearch*) self);
}

static void
_tootle_views_search_request_gtk_button_clicked (GtkButton* _sender,
                                                 gpointer self)
{
	tootle_views_search_request ((TootleViewsSearch*) self);
}

TootleViewsSearch*
tootle_views_search_construct (GType object_type)
{
	TootleViewsSearch * self = NULL;
	HdySearchBar* _tmp0_;
	HdySearchBar* _tmp1_;
	HdySearchBar* _tmp2_;
	HdySearchBar* _tmp3_;
	HdySearchBar* _tmp4_;
	GtkSearchEntry* _tmp5_;
	GtkSearchEntry* _tmp6_;
	GtkSearchEntry* _tmp7_;
	const gchar* _tmp8_;
	GtkSearchEntry* _tmp9_;
	HdyClamp* _tmp10_;
	HdyClamp* _tmp11_;
	HdyClamp* _tmp12_;
	GtkSearchEntry* _tmp13_;
	HdySearchBar* _tmp14_;
	HdyClamp* _tmp15_;
	HdySearchBar* _tmp16_;
	GtkSearchEntry* _tmp17_;
	GtkSearchEntry* _tmp18_;
	GtkSearchEntry* _tmp19_;
	GtkSearchEntry* _tmp20_;
	GtkButton* _tmp21_;
	TootleViewsBase* _tmp22_;
	TootleViewsBase* _tmp23_;
	TootleViewsBase* _tmp24_;
	self = (TootleViewsSearch*) g_object_new (object_type, "label", _ ("Search"), NULL);
	_tmp0_ = (HdySearchBar*) hdy_search_bar_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->bar);
	self->priv->bar = _tmp0_;
	_tmp1_ = self->priv->bar;
	g_object_set (_tmp1_, "search-mode-enabled", TRUE, NULL);
	_tmp2_ = self->priv->bar;
	gtk_widget_show ((GtkWidget*) _tmp2_);
	_tmp3_ = self->priv->bar;
	gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) _tmp3_, FALSE, FALSE, (guint) 0);
	_tmp4_ = self->priv->bar;
	gtk_box_reorder_child ((GtkBox*) self, (GtkWidget*) _tmp4_, 2);
	_tmp5_ = (GtkSearchEntry*) gtk_search_entry_new ();
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->entry);
	self->priv->entry = _tmp5_;
	_tmp6_ = self->priv->entry;
	gtk_entry_set_width_chars ((GtkEntry*) _tmp6_, 25);
	_tmp7_ = self->priv->entry;
	_tmp8_ = self->priv->_query;
	gtk_entry_set_text ((GtkEntry*) _tmp7_, _tmp8_);
	_tmp9_ = self->priv->entry;
	gtk_widget_show ((GtkWidget*) _tmp9_);
	_tmp10_ = (HdyClamp*) hdy_clamp_new ();
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->bar_clamp);
	self->priv->bar_clamp = _tmp10_;
	_tmp11_ = self->priv->bar_clamp;
	gtk_widget_show ((GtkWidget*) _tmp11_);
	_tmp12_ = self->priv->bar_clamp;
	_tmp13_ = self->priv->entry;
	gtk_container_add ((GtkContainer*) _tmp12_, (GtkWidget*) _tmp13_);
	_tmp14_ = self->priv->bar;
	_tmp15_ = self->priv->bar_clamp;
	gtk_container_add ((GtkContainer*) _tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = self->priv->bar;
	_tmp17_ = self->priv->entry;
	hdy_search_bar_connect_entry (_tmp16_, (GtkEntry*) _tmp17_);
	_tmp18_ = self->priv->entry;
	g_signal_connect_object ((GtkEntry*) _tmp18_, "activate", (GCallback) ___lambda130__gtk_entry_activate, self, 0);
	_tmp19_ = self->priv->entry;
	g_signal_connect_object ((GtkEntry*) _tmp19_, "icon-press", (GCallback) ___lambda135__gtk_entry_icon_press, self, 0);
	_tmp20_ = self->priv->entry;
	gtk_entry_grab_focus_without_selecting ((GtkEntry*) _tmp20_);
	_tmp21_ = ((TootleViewsBase*) self)->status_button;
	g_signal_connect_object (_tmp21_, "clicked", (GCallback) _tootle_views_search_request_gtk_button_clicked, self, 0);
	_tmp22_ = tootle_views_tabbed_base_add_list_tab ((TootleViewsTabbedBase*) self, _ ("Accounts"), "system-users-symbolic");
	_g_object_unref0 (self->priv->accounts_tab);
	self->priv->accounts_tab = _tmp22_;
	_tmp23_ = tootle_views_tabbed_base_add_list_tab ((TootleViewsTabbedBase*) self, _ ("Statuses"), "user-available-symbolic");
	_g_object_unref0 (self->priv->statuses_tab);
	self->priv->statuses_tab = _tmp23_;
	_tmp24_ = tootle_views_tabbed_base_add_list_tab ((TootleViewsTabbedBase*) self, _ ("Hashtags"), "emoji-flags-symbolic");
	_g_object_unref0 (self->priv->hashtags_tab);
	self->priv->hashtags_tab = _tmp24_;
	tootle_views_search_request (self);
	return self;
}

TootleViewsSearch*
tootle_views_search_new (void)
{
	return tootle_views_search_construct (TOOTLE_VIEWS_TYPE_SEARCH);
}

static gboolean
tootle_views_search_append (TootleViewsSearch* self,
                            TootleViewsBase* tab,
                            TootleEntity* entity)
{
	GtkWidget* w = NULL;
	GtkWidget* _tmp0_;
	GtkListBox* _tmp2_;
	GError* _inner_error0_ = NULL;
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (tab != NULL, FALSE);
	g_return_val_if_fail (entity != NULL, FALSE);
	_tmp0_ = tootle_widgetizable_to_widget ((TootleWidgetizable*) entity, &_inner_error0_);
	w = _tmp0_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp1_ = FALSE;
		_g_object_unref0 (entity);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp1_;
	}
	_tmp2_ = tab->content_list;
	gtk_list_box_insert (_tmp2_, w, -1);
	result = TRUE;
	_g_object_unref0 (w);
	_g_object_unref0 (entity);
	return result;
}

static gchar*
string_chug (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strchug (_result_);
	result = _result_;
	return result;
}

static gchar*
string_chomp (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strchomp (_result_);
	result = _result_;
	return result;
}

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

static gboolean
____lambda132_ (TootleViewsSearch* self,
                TootleAPIAccount* e)
{
	TootleViewsBase* _tmp0_;
	TootleEntity* _tmp1_;
	gboolean result = FALSE;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = self->priv->accounts_tab;
	_tmp1_ = _g_object_ref0 ((TootleEntity*) e);
	result = tootle_views_search_append (self, _tmp0_, _tmp1_);
	_g_object_unref0 (e);
	return result;
}

static gboolean
_____lambda132__gee_forall_func (gpointer g,
                                 gpointer self)
{
	gboolean result;
	result = ____lambda132_ ((TootleViewsSearch*) self, (TootleAPIAccount*) g);
	return result;
}

static gboolean
____lambda133_ (TootleViewsSearch* self,
                TootleAPIStatus* e)
{
	TootleViewsBase* _tmp0_;
	TootleEntity* _tmp1_;
	gboolean result = FALSE;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = self->priv->statuses_tab;
	_tmp1_ = _g_object_ref0 ((TootleEntity*) e);
	result = tootle_views_search_append (self, _tmp0_, _tmp1_);
	_g_object_unref0 (e);
	return result;
}

static gboolean
_____lambda133__gee_forall_func (gpointer g,
                                 gpointer self)
{
	gboolean result;
	result = ____lambda133_ ((TootleViewsSearch*) self, (TootleAPIStatus*) g);
	return result;
}

static gboolean
____lambda134_ (TootleViewsSearch* self,
                TootleAPITag* e)
{
	TootleViewsBase* _tmp0_;
	TootleEntity* _tmp1_;
	gboolean result = FALSE;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = self->priv->hashtags_tab;
	_tmp1_ = _g_object_ref0 ((TootleEntity*) e);
	result = tootle_views_search_append (self, _tmp0_, _tmp1_);
	_g_object_unref0 (e);
	return result;
}

static gboolean
_____lambda134__gee_forall_func (gpointer g,
                                 gpointer self)
{
	gboolean result;
	result = ____lambda134_ ((TootleViewsSearch*) self, (TootleAPITag*) g);
	return result;
}

static void
__lambda131_ (TootleViewsSearch* self,
              GObject* obj,
              GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		TootleAPISearchResults* results = NULL;
		TootleAPISearchResults* _tmp0_;
		GeeArrayList* _tmp1_;
		GeeArrayList* _tmp2_;
		gboolean _tmp3_;
		gboolean _tmp4_;
		GeeArrayList* _tmp7_;
		GeeArrayList* _tmp8_;
		gboolean _tmp9_;
		gboolean _tmp10_;
		GeeArrayList* _tmp13_;
		GeeArrayList* _tmp14_;
		gboolean _tmp15_;
		gboolean _tmp16_;
		_tmp0_ = tootle_api_search_results_request_finish (res, &_inner_error0_);
		results = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = tootle_api_search_results_get_accounts (results);
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_collection_get_is_empty ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		if (!_tmp4_) {
			GeeArrayList* _tmp5_;
			GeeArrayList* _tmp6_;
			_tmp5_ = tootle_api_search_results_get_accounts (results);
			_tmp6_ = _tmp5_;
			gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp6_, _____lambda132__gee_forall_func, self);
		}
		_tmp7_ = tootle_api_search_results_get_statuses (results);
		_tmp8_ = _tmp7_;
		_tmp9_ = gee_collection_get_is_empty ((GeeCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		if (!_tmp10_) {
			GeeArrayList* _tmp11_;
			GeeArrayList* _tmp12_;
			_tmp11_ = tootle_api_search_results_get_statuses (results);
			_tmp12_ = _tmp11_;
			gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp12_, _____lambda133__gee_forall_func, self);
		}
		_tmp13_ = tootle_api_search_results_get_hashtags (results);
		_tmp14_ = _tmp13_;
		_tmp15_ = gee_collection_get_is_empty ((GeeCollection*) _tmp14_);
		_tmp16_ = _tmp15_;
		if (!_tmp16_) {
			GeeArrayList* _tmp17_;
			GeeArrayList* _tmp18_;
			_tmp17_ = tootle_api_search_results_get_hashtags (results);
			_tmp18_ = _tmp17_;
			gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp18_, _____lambda134__gee_forall_func, self);
		}
		tootle_views_base_on_content_changed ((TootleViewsBase*) self);
		_g_object_unref0 (results);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp19_;
		const gchar* _tmp20_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp19_ = e;
		_tmp20_ = _tmp19_->message;
		tootle_views_base_on_error ((TootleViewsBase*) self, (gint32) -1, _tmp20_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda131__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	__lambda131_ ((TootleViewsSearch*) self, source_object, res);
	g_object_unref (self);
}

static void
tootle_views_search_request (TootleViewsSearch* self)
{
	GtkSearchEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	TootleAccounts* _tmp10_;
	TootleInstanceAccount* _tmp11_;
	TootleInstanceAccount* _tmp12_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entry;
	_tmp1_ = gtk_entry_get_text ((GtkEntry*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_chug (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = string_chomp (_tmp4_);
	_tmp6_ = _tmp5_;
	tootle_views_search_set_query (self, _tmp6_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp4_);
	_tmp7_ = self->priv->_query;
	if (g_strcmp0 (_tmp7_, "") == 0) {
		tootle_views_base_clear ((TootleViewsBase*) self);
		tootle_views_base_set_state ((TootleViewsBase*) self, "status");
		tootle_views_base_set_status_message ((TootleViewsBase*) self, _ ("Enter query"));
		return;
	}
	tootle_views_base_clear ((TootleViewsBase*) self);
	tootle_views_base_set_state ((TootleViewsBase*) self, "status");
	_tmp8_ = tootle_views_base_STATUS_LOADING;
	tootle_views_base_set_status_message ((TootleViewsBase*) self, _tmp8_);
	_tmp9_ = self->priv->_query;
	_tmp10_ = tootle_accounts;
	_tmp11_ = tootle_accounts_get_active (_tmp10_);
	_tmp12_ = _tmp11_;
	tootle_api_search_results_request (_tmp9_, _tmp12_, ___lambda131__gasync_ready_callback, g_object_ref (self));
}

const gchar*
tootle_views_search_get_query (TootleViewsSearch* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_query;
	result = _tmp0_;
	return result;
}

void
tootle_views_search_set_query (TootleViewsSearch* self,
                               const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tootle_views_search_get_query (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_query);
		self->priv->_query = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tootle_views_search_properties[TOOTLE_VIEWS_SEARCH_QUERY_PROPERTY]);
	}
}

static void
tootle_views_search_class_init (TootleViewsSearchClass * klass,
                                gpointer klass_data)
{
	tootle_views_search_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TootleViewsSearch_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tootle_views_search_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tootle_views_search_set_property;
	G_OBJECT_CLASS (klass)->finalize = tootle_views_search_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TOOTLE_VIEWS_SEARCH_QUERY_PROPERTY, tootle_views_search_properties[TOOTLE_VIEWS_SEARCH_QUERY_PROPERTY] = g_param_spec_string ("query", "query", "query", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
tootle_views_search_instance_init (TootleViewsSearch * self,
                                   gpointer klass)
{
	gchar* _tmp0_;
	self->priv = tootle_views_search_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_query = _tmp0_;
}

static void
tootle_views_search_finalize (GObject * obj)
{
	TootleViewsSearch * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TOOTLE_VIEWS_TYPE_SEARCH, TootleViewsSearch);
	_g_free0 (self->priv->_query);
	_g_object_unref0 (self->priv->bar);
	_g_object_unref0 (self->priv->bar_clamp);
	_g_object_unref0 (self->priv->entry);
	_g_object_unref0 (self->priv->accounts_tab);
	_g_object_unref0 (self->priv->statuses_tab);
	_g_object_unref0 (self->priv->hashtags_tab);
	G_OBJECT_CLASS (tootle_views_search_parent_class)->finalize (obj);
}

static GType
tootle_views_search_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TootleViewsSearchClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tootle_views_search_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TootleViewsSearch), 0, (GInstanceInitFunc) tootle_views_search_instance_init, NULL };
	GType tootle_views_search_type_id;
	tootle_views_search_type_id = g_type_register_static (TOOTLE_VIEWS_TYPE_TABBED_BASE, "TootleViewsSearch", &g_define_type_info, 0);
	TootleViewsSearch_private_offset = g_type_add_instance_private (tootle_views_search_type_id, sizeof (TootleViewsSearchPrivate));
	return tootle_views_search_type_id;
}

GType
tootle_views_search_get_type (void)
{
	static volatile gsize tootle_views_search_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_views_search_type_id__volatile)) {
		GType tootle_views_search_type_id;
		tootle_views_search_type_id = tootle_views_search_get_type_once ();
		g_once_init_leave (&tootle_views_search_type_id__volatile, tootle_views_search_type_id);
	}
	return tootle_views_search_type_id__volatile;
}

static void
_vala_tootle_views_search_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	TootleViewsSearch * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_VIEWS_TYPE_SEARCH, TootleViewsSearch);
	switch (property_id) {
		case TOOTLE_VIEWS_SEARCH_QUERY_PROPERTY:
		g_value_set_string (value, tootle_views_search_get_query (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tootle_views_search_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	TootleViewsSearch * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TOOTLE_VIEWS_TYPE_SEARCH, TootleViewsSearch);
	switch (property_id) {
		case TOOTLE_VIEWS_SEARCH_QUERY_PROPERTY:
		tootle_views_search_set_query (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

