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

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

#include <glib.h>
#include <glib-object.h>
#include <clutter-gtk/clutter-gtk.h>
#include <gtk/gtk.h>
#include <float.h>
#include <math.h>
#include <clutter/clutter.h>
#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libcommon.h>
#include <stdlib.h>
#include <string.h>


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

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

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

#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_MACHINE (boxes_machine_get_type ())
#define BOXES_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_MACHINE, BoxesMachine))
#define BOXES_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_MACHINE, BoxesMachineClass))
#define BOXES_IS_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_MACHINE))
#define BOXES_IS_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_MACHINE))
#define BOXES_MACHINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_MACHINE, BoxesMachineClass))

typedef struct _BoxesMachine BoxesMachine;
typedef struct _BoxesMachineClass BoxesMachineClass;
typedef struct _BoxesUIPrivate BoxesUIPrivate;

#define BOXES_TYPE_UI_STATE (boxes_ui_state_get_type ())
typedef struct _BoxesCollectionItemPrivate BoxesCollectionItemPrivate;

#define BOXES_TYPE_IPROPERTIES_PROVIDER (boxes_iproperties_provider_get_type ())
#define BOXES_IPROPERTIES_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_IPROPERTIES_PROVIDER, BoxesIPropertiesProvider))
#define BOXES_IS_IPROPERTIES_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_IPROPERTIES_PROVIDER))
#define BOXES_IPROPERTIES_PROVIDER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BOXES_TYPE_IPROPERTIES_PROVIDER, BoxesIPropertiesProviderIface))

typedef struct _BoxesIPropertiesProvider BoxesIPropertiesProvider;
typedef struct _BoxesIPropertiesProviderIface BoxesIPropertiesProviderIface;

#define BOXES_TYPE_PROPERTIES_PAGE (boxes_properties_page_get_type ())

#define BOXES_TYPE_PROPERTY (boxes_property_get_type ())
#define BOXES_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_PROPERTY, BoxesProperty))
#define BOXES_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_PROPERTY, BoxesPropertyClass))
#define BOXES_IS_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_PROPERTY))
#define BOXES_IS_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_PROPERTY))
#define BOXES_PROPERTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_PROPERTY, BoxesPropertyClass))

typedef struct _BoxesProperty BoxesProperty;
typedef struct _BoxesPropertyClass BoxesPropertyClass;
typedef struct _BoxesMachinePrivate BoxesMachinePrivate;

#define BOXES_TYPE_MACHINE_ACTOR (boxes_machine_actor_get_type ())
#define BOXES_MACHINE_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_MACHINE_ACTOR, BoxesMachineActor))
#define BOXES_MACHINE_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_MACHINE_ACTOR, BoxesMachineActorClass))
#define BOXES_IS_MACHINE_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_MACHINE_ACTOR))
#define BOXES_IS_MACHINE_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_MACHINE_ACTOR))
#define BOXES_MACHINE_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_MACHINE_ACTOR, BoxesMachineActorClass))

typedef struct _BoxesMachineActor BoxesMachineActor;
typedef struct _BoxesMachineActorClass BoxesMachineActorClass;
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))

struct _BoxesSelectionbar {
	GObject parent_instance;
	BoxesSelectionbarPrivate * priv;
};

struct _BoxesSelectionbarClass {
	GObjectClass parent_class;
};

struct _BoxesSelectionbarPrivate {
	GtkClutterActor* gtk_actor;
	GtkToolbar* toolbar;
	GtkToggleToolButton* favorite_btn;
	GtkToggleToolButton* remove_btn;
};

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 _BoxesCollectionItem {
	BoxesUI parent_instance;
	BoxesCollectionItemPrivate * priv;
};

struct _BoxesCollectionItemClass {
	BoxesUIClass parent_class;
};

typedef enum  {
	BOXES_PROPERTIES_PAGE_LOGIN,
	BOXES_PROPERTIES_PAGE_SYSTEM,
	BOXES_PROPERTIES_PAGE_DISPLAY,
	BOXES_PROPERTIES_PAGE_DEVICES,
	BOXES_PROPERTIES_PAGE_LAST
} BoxesPropertiesPage;

struct _BoxesIPropertiesProviderIface {
	GTypeInterface parent_iface;
	GList* (*get_properties) (BoxesIPropertiesProvider* self, BoxesPropertiesPage page);
};

struct _BoxesMachine {
	BoxesCollectionItem parent_instance;
	BoxesMachinePrivate * priv;
	BoxesMachineActor* machine_actor;
	BoxesCollectionSource* source;
	BoxesDisplayConfig* config;
	gboolean stay_on_display;
	gboolean deleted;
};

struct _BoxesMachineClass {
	BoxesCollectionItemClass parent_class;
	void (*take_screenshot) (BoxesMachine* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	GdkPixbuf* (*take_screenshot_finish) (BoxesMachine* self, GAsyncResult* _res_, GError** error);
	GList* (*get_properties) (BoxesMachine* self, BoxesPropertiesPage page);
	void (*connect_display) (BoxesMachine* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*connect_display_finish) (BoxesMachine* self, GAsyncResult* _res_);
	void (*disconnect_display) (BoxesMachine* self);
	void (*delete) (BoxesMachine* self, gboolean by_user);
};


static gpointer boxes_selectionbar_parent_class = NULL;
extern BoxesApp* boxes_app_app;

GType boxes_selectionbar_get_type (void) G_GNUC_CONST;
#define BOXES_SELECTIONBAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BOXES_TYPE_SELECTIONBAR, BoxesSelectionbarPrivate))
enum  {
	BOXES_SELECTIONBAR_DUMMY_PROPERTY,
	BOXES_SELECTIONBAR_ACTOR
};
#define BOXES_SELECTIONBAR_spacing 60.0f
BoxesSelectionbar* boxes_selectionbar_new (void);
BoxesSelectionbar* boxes_selectionbar_construct (GType object_type);
void boxes_draw_as_css_box (GtkWidget* widget);
static void __lambda109_ (BoxesSelectionbar* self);
GType boxes_ui_get_type (void) G_GNUC_CONST;
GType boxes_app_get_type (void) G_GNUC_CONST;
GType boxes_collection_item_get_type (void) G_GNUC_CONST;
GList* boxes_app_get_selected_items (BoxesApp* self);
GType boxes_machine_get_type (void) G_GNUC_CONST;
GType boxes_ui_state_get_type (void) G_GNUC_CONST;
GType boxes_properties_page_get_type (void) G_GNUC_CONST;
GType boxes_property_get_type (void) G_GNUC_CONST;
GType boxes_iproperties_provider_get_type (void) G_GNUC_CONST;
GType boxes_machine_actor_get_type (void) G_GNUC_CONST;
static void _g_object_unref0_ (gpointer var);
static void _g_list_free__g_object_unref0_ (GList* self);
static void ___lambda109__gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self);
static void __lambda110_ (BoxesSelectionbar* self);
void boxes_app_remove_selected_items (BoxesApp* self);
static void ___lambda110__gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self);
ClutterActor* boxes_selectionbar_get_actor (BoxesSelectionbar* self);
static void __lambda113_ (BoxesSelectionbar* self);
static void boxes_selectionbar_update_visible (BoxesSelectionbar* self);
static void ___lambda113__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void __lambda114_ (BoxesSelectionbar* self);
static void boxes_selectionbar_update_favorite_btn (BoxesSelectionbar* self);
static void ___lambda114__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
gboolean boxes_app_get_selection_mode (BoxesApp* self);
static void boxes_selectionbar_set_visible (BoxesSelectionbar* self, gboolean value);
static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle);
void boxes_fade_actor (ClutterActor* actor, guint opacity);
static void boxes_selectionbar_finalize (GObject* obj);
static void _vala_boxes_selectionbar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_boxes_selectionbar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


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


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


static void _g_list_free__g_object_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
	g_list_free (self);
}


static void __lambda109_ (BoxesSelectionbar* self) {
	BoxesApp* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	_tmp0_ = boxes_app_app;
	_tmp1_ = boxes_app_get_selected_items (_tmp0_);
	_tmp2_ = _tmp1_;
	{
		GList* item_collection = NULL;
		GList* item_it = NULL;
		item_collection = _tmp2_;
		for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
			BoxesCollectionItem* _tmp3_;
			BoxesCollectionItem* item = NULL;
			_tmp3_ = _g_object_ref0 ((BoxesCollectionItem*) item_it->data);
			item = _tmp3_;
			{
				BoxesCollectionItem* _tmp4_;
				BoxesMachine* _tmp5_;
				BoxesMachine* machine;
				BoxesMachine* _tmp6_;
				BoxesMachine* _tmp7_;
				BoxesDisplayConfig* _tmp8_;
				GtkToggleToolButton* _tmp9_;
				gboolean _tmp10_;
				gboolean _tmp11_;
				_tmp4_ = item;
				_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, BOXES_TYPE_MACHINE) ? ((BoxesMachine*) _tmp4_) : NULL);
				machine = _tmp5_;
				_tmp6_ = machine;
				if (_tmp6_ == NULL) {
					_g_object_unref0 (machine);
					_g_object_unref0 (item);
					continue;
				}
				_tmp7_ = machine;
				_tmp8_ = _tmp7_->config;
				_tmp9_ = self->priv->favorite_btn;
				_tmp10_ = gtk_toggle_tool_button_get_active (_tmp9_);
				_tmp11_ = _tmp10_;
				boxes_display_config_set_category (_tmp8_, "favorite", _tmp11_);
				_g_object_unref0 (machine);
				_g_object_unref0 (item);
			}
		}
		__g_list_free__g_object_unref0_0 (item_collection);
	}
}


static void ___lambda109__gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
	__lambda109_ (self);
}


static void __lambda110_ (BoxesSelectionbar* self) {
	BoxesApp* _tmp0_;
	_tmp0_ = boxes_app_app;
	boxes_app_remove_selected_items (_tmp0_);
}


static void ___lambda110__gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
	__lambda110_ (self);
}


static void __lambda113_ (BoxesSelectionbar* self) {
	boxes_selectionbar_update_visible (self);
}


static void ___lambda113__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	__lambda113_ (self);
}


static void __lambda114_ (BoxesSelectionbar* self) {
	boxes_selectionbar_update_visible (self);
	boxes_selectionbar_update_favorite_btn (self);
}


static void ___lambda114__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	__lambda114_ (self);
}


BoxesSelectionbar* boxes_selectionbar_construct (GType object_type) {
	BoxesSelectionbar * self = NULL;
	GtkToolbar* _tmp0_;
	GtkToolbar* _tmp1_;
	GtkToolbar* _tmp2_;
	GtkAlignment* _tmp3_;
	GtkAlignment* bin;
	GtkToolbar* _tmp4_;
	GtkStyleContext* _tmp5_ = NULL;
	GtkClutterActor* _tmp6_;
	GtkClutterActor* _tmp7_;
	GtkWidget* _tmp8_ = NULL;
	GtkStyleContext* _tmp9_ = NULL;
	GtkClutterActor* _tmp10_;
	GtkToggleToolButton* _tmp11_;
	GtkToolbar* _tmp12_;
	GtkToggleToolButton* _tmp13_;
	GtkToggleToolButton* _tmp14_;
	GtkToggleToolButton* _tmp15_;
	GtkSeparatorToolItem* _tmp16_;
	GtkSeparatorToolItem* separator;
	GtkToolbar* _tmp17_;
	GtkToggleToolButton* _tmp18_;
	GtkToolbar* _tmp19_;
	GtkToggleToolButton* _tmp20_;
	GtkToggleToolButton* _tmp21_;
	GtkToggleToolButton* _tmp22_;
	GtkToolbar* _tmp23_;
	ClutterActor* _tmp24_;
	ClutterActor* _tmp25_;
	BoxesApp* _tmp26_;
	BoxesApp* _tmp27_;
	self = (BoxesSelectionbar*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkToolbar*) gtk_toolbar_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->toolbar);
	self->priv->toolbar = _tmp0_;
	_tmp1_ = self->priv->toolbar;
	gtk_toolbar_set_show_arrow (_tmp1_, FALSE);
	_tmp2_ = self->priv->toolbar;
	gtk_toolbar_set_icon_size (_tmp2_, (gint) GTK_ICON_SIZE_LARGE_TOOLBAR);
	_tmp3_ = (GtkAlignment*) gtk_alignment_new ((gfloat) 0, (gfloat) 0, (gfloat) 1, (gfloat) 1);
	g_object_ref_sink (_tmp3_);
	bin = _tmp3_;
	boxes_draw_as_css_box ((GtkWidget*) bin);
	_tmp4_ = self->priv->toolbar;
	gtk_container_add ((GtkContainer*) bin, (GtkWidget*) _tmp4_);
	_tmp5_ = gtk_widget_get_style_context ((GtkWidget*) bin);
	gtk_style_context_add_class (_tmp5_, "selectionbar");
	_tmp6_ = (GtkClutterActor*) gtk_clutter_actor_new_with_contents ((GtkWidget*) bin);
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->gtk_actor);
	self->priv->gtk_actor = _tmp6_;
	_tmp7_ = self->priv->gtk_actor;
	_tmp8_ = gtk_clutter_actor_get_widget (_tmp7_);
	_tmp9_ = gtk_widget_get_style_context (_tmp8_);
	gtk_style_context_add_class (_tmp9_, "boxes-bg");
	_tmp10_ = self->priv->gtk_actor;
	clutter_actor_set_opacity ((ClutterActor*) _tmp10_, (guint) 0);
	_tmp11_ = (GtkToggleToolButton*) gtk_toggle_tool_button_new ();
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->favorite_btn);
	self->priv->favorite_btn = _tmp11_;
	_tmp12_ = self->priv->toolbar;
	_tmp13_ = self->priv->favorite_btn;
	gtk_toolbar_insert (_tmp12_, (GtkToolItem*) _tmp13_, 0);
	_tmp14_ = self->priv->favorite_btn;
	gtk_tool_button_set_icon_name ((GtkToolButton*) _tmp14_, "emblem-favorite-symbolic");
	_tmp15_ = self->priv->favorite_btn;
	g_signal_connect_object ((GtkToolButton*) _tmp15_, "clicked", (GCallback) ___lambda109__gtk_tool_button_clicked, self, 0);
	_tmp16_ = (GtkSeparatorToolItem*) gtk_separator_tool_item_new ();
	g_object_ref_sink (_tmp16_);
	separator = _tmp16_;
	_tmp17_ = self->priv->toolbar;
	gtk_toolbar_insert (_tmp17_, (GtkToolItem*) separator, 1);
	_tmp18_ = (GtkToggleToolButton*) gtk_toggle_tool_button_new ();
	g_object_ref_sink (_tmp18_);
	_g_object_unref0 (self->priv->remove_btn);
	self->priv->remove_btn = _tmp18_;
	_tmp19_ = self->priv->toolbar;
	_tmp20_ = self->priv->remove_btn;
	gtk_toolbar_insert (_tmp19_, (GtkToolItem*) _tmp20_, 2);
	_tmp21_ = self->priv->remove_btn;
	gtk_tool_button_set_icon_name ((GtkToolButton*) _tmp21_, "edit-delete-symbolic");
	_tmp22_ = self->priv->remove_btn;
	g_signal_connect_object ((GtkToolButton*) _tmp22_, "clicked", (GCallback) ___lambda110__gtk_tool_button_clicked, self, 0);
	_tmp23_ = self->priv->toolbar;
	gtk_widget_show_all ((GtkWidget*) _tmp23_);
	_tmp24_ = boxes_selectionbar_get_actor (self);
	_tmp25_ = _tmp24_;
	clutter_actor_set_reactive (_tmp25_, TRUE);
	_tmp26_ = boxes_app_app;
	g_signal_connect_object ((GObject*) _tmp26_, "notify::selection-mode", (GCallback) ___lambda113__g_object_notify, self, 0);
	_tmp27_ = boxes_app_app;
	g_signal_connect_object ((GObject*) _tmp27_, "notify::selected-items", (GCallback) ___lambda114__g_object_notify, self, 0);
	_g_object_unref0 (separator);
	_g_object_unref0 (bin);
	return self;
}


BoxesSelectionbar* boxes_selectionbar_new (void) {
	return boxes_selectionbar_construct (BOXES_TYPE_SELECTIONBAR);
}


static void boxes_selectionbar_update_visible (BoxesSelectionbar* self) {
	BoxesApp* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = boxes_app_app;
	_tmp1_ = boxes_app_get_selection_mode (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		boxes_selectionbar_set_visible (self, FALSE);
	} else {
		BoxesApp* _tmp3_;
		GList* _tmp4_;
		GList* _tmp5_;
		GList* _tmp6_;
		guint _tmp7_ = 0U;
		_tmp3_ = boxes_app_app;
		_tmp4_ = boxes_app_get_selected_items (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_;
		_tmp7_ = g_list_length (_tmp6_);
		boxes_selectionbar_set_visible (self, _tmp7_ > ((guint) 0));
		__g_list_free__g_object_unref0_0 (_tmp6_);
	}
}


static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle) {
	int i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}


static void boxes_selectionbar_update_favorite_btn (BoxesSelectionbar* self) {
	gboolean active;
	BoxesApp* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	GList* _tmp3_;
	guint _tmp4_ = 0U;
	gboolean _tmp5_;
	gboolean sensitive;
	BoxesApp* _tmp6_;
	GList* _tmp7_;
	GList* _tmp8_;
	GtkToggleToolButton* _tmp22_;
	gboolean _tmp23_;
	GtkToggleToolButton* _tmp24_;
	gboolean _tmp25_;
	g_return_if_fail (self != NULL);
	active = FALSE;
	_tmp0_ = boxes_app_app;
	_tmp1_ = boxes_app_get_selected_items (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = g_list_length (_tmp3_);
	_tmp5_ = _tmp4_ > ((guint) 0);
	__g_list_free__g_object_unref0_0 (_tmp3_);
	sensitive = _tmp5_;
	_tmp6_ = boxes_app_app;
	_tmp7_ = boxes_app_get_selected_items (_tmp6_);
	_tmp8_ = _tmp7_;
	{
		GList* item_collection = NULL;
		GList* item_it = NULL;
		item_collection = _tmp8_;
		for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
			BoxesCollectionItem* _tmp9_;
			BoxesCollectionItem* item = NULL;
			_tmp9_ = _g_object_ref0 ((BoxesCollectionItem*) item_it->data);
			item = _tmp9_;
			{
				BoxesCollectionItem* _tmp10_;
				BoxesMachine* _tmp11_;
				BoxesMachine* machine;
				BoxesMachine* _tmp12_;
				BoxesMachine* _tmp13_;
				BoxesDisplayConfig* _tmp14_;
				gchar** _tmp15_;
				gint _tmp15__length1;
				gchar** _tmp16_;
				gint _tmp16__length1;
				gchar** _tmp17_;
				gint _tmp17__length1;
				gboolean _tmp18_;
				gboolean is_favorite;
				gboolean _tmp19_;
				_tmp10_ = item;
				_tmp11_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, BOXES_TYPE_MACHINE) ? ((BoxesMachine*) _tmp10_) : NULL);
				machine = _tmp11_;
				_tmp12_ = machine;
				if (_tmp12_ == NULL) {
					_g_object_unref0 (machine);
					_g_object_unref0 (item);
					continue;
				}
				_tmp13_ = machine;
				_tmp14_ = _tmp13_->config;
				_tmp15_ = boxes_display_config_get_categories (_tmp14_, &_tmp15__length1);
				_tmp16_ = _tmp15_;
				_tmp16__length1 = _tmp15__length1;
				_tmp17_ = _tmp16_;
				_tmp17__length1 = _tmp16__length1;
				_tmp18_ = _vala_string_array_contains (_tmp17_, _tmp16__length1, "favorite");
				_tmp17_ = (_vala_array_free (_tmp17_, _tmp17__length1, (GDestroyNotify) g_free), NULL);
				is_favorite = _tmp18_;
				_tmp19_ = active;
				if (!_tmp19_) {
					gboolean _tmp20_;
					_tmp20_ = is_favorite;
					active = _tmp20_;
				} else {
					gboolean _tmp21_;
					_tmp21_ = is_favorite;
					if (!_tmp21_) {
						sensitive = FALSE;
						_g_object_unref0 (machine);
						_g_object_unref0 (item);
						break;
					}
				}
				_g_object_unref0 (machine);
				_g_object_unref0 (item);
			}
		}
		__g_list_free__g_object_unref0_0 (item_collection);
	}
	_tmp22_ = self->priv->favorite_btn;
	_tmp23_ = active;
	gtk_toggle_tool_button_set_active (_tmp22_, _tmp23_);
	_tmp24_ = self->priv->favorite_btn;
	_tmp25_ = sensitive;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp24_, _tmp25_);
}


ClutterActor* boxes_selectionbar_get_actor (BoxesSelectionbar* self) {
	ClutterActor* result;
	GtkClutterActor* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->gtk_actor;
	result = (ClutterActor*) _tmp0_;
	return result;
}


static void boxes_selectionbar_set_visible (BoxesSelectionbar* self, gboolean value) {
	gint _tmp0_ = 0;
	gboolean _tmp1_;
	ClutterActor* _tmp2_;
	ClutterActor* _tmp3_;
	gint _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp1_ = value;
	if (_tmp1_) {
		_tmp0_ = 255;
	} else {
		_tmp0_ = 0;
	}
	_tmp2_ = boxes_selectionbar_get_actor (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp0_;
	boxes_fade_actor (_tmp3_, (guint) _tmp4_);
}


static void boxes_selectionbar_class_init (BoxesSelectionbarClass * klass) {
	boxes_selectionbar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (BoxesSelectionbarPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_selectionbar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_selectionbar_set_property;
	G_OBJECT_CLASS (klass)->finalize = boxes_selectionbar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_SELECTIONBAR_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));
}


static void boxes_selectionbar_instance_init (BoxesSelectionbar * self) {
	self->priv = BOXES_SELECTIONBAR_GET_PRIVATE (self);
}


static void boxes_selectionbar_finalize (GObject* obj) {
	BoxesSelectionbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_SELECTIONBAR, BoxesSelectionbar);
	_g_object_unref0 (self->priv->gtk_actor);
	_g_object_unref0 (self->priv->toolbar);
	_g_object_unref0 (self->priv->favorite_btn);
	_g_object_unref0 (self->priv->remove_btn);
	G_OBJECT_CLASS (boxes_selectionbar_parent_class)->finalize (obj);
}


GType boxes_selectionbar_get_type (void) {
	static volatile gsize boxes_selectionbar_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_selectionbar_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesSelectionbarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_selectionbar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesSelectionbar), 0, (GInstanceInitFunc) boxes_selectionbar_instance_init, NULL };
		GType boxes_selectionbar_type_id;
		boxes_selectionbar_type_id = g_type_register_static (G_TYPE_OBJECT, "BoxesSelectionbar", &g_define_type_info, 0);
		g_once_init_leave (&boxes_selectionbar_type_id__volatile, boxes_selectionbar_type_id);
	}
	return boxes_selectionbar_type_id__volatile;
}


static void _vala_boxes_selectionbar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	BoxesSelectionbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_SELECTIONBAR, BoxesSelectionbar);
	switch (property_id) {
		case BOXES_SELECTIONBAR_ACTOR:
		g_value_set_object (value, boxes_selectionbar_get_actor (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_boxes_selectionbar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	BoxesSelectionbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_SELECTIONBAR, BoxesSelectionbar);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



