/* controller-hint-bar.c generated by valac 0.56.19, the Vala compiler
 * generated from controller-hint-bar.vala, do not modify */

#include "protonplus_core.h"
#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <adwaita.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	PROTON_PLUS_WIDGETS_CONTROLLER_HINT_BAR_0_PROPERTY,
	PROTON_PLUS_WIDGETS_CONTROLLER_HINT_BAR_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_controller_hint_bar_properties[PROTON_PLUS_WIDGETS_CONTROLLER_HINT_BAR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))

struct _ProtonPlusWidgetsControllerHintBarPrivate {
	GtkRevealer* revealer;
	GtkBox* essential_box;
	GtkBox* secondary_box;
};

static gint ProtonPlusWidgetsControllerHintBar_private_offset;
static gpointer proton_plus_widgets_controller_hint_bar_parent_class = NULL;

static void __lambda335_ (ProtonPlusWidgetsControllerHintBar* self);
static void ___lambda335__adw_breakpoint_apply (AdwBreakpoint* _sender,
                                         gpointer self);
static void __lambda336_ (ProtonPlusWidgetsControllerHintBar* self);
static void ___lambda336__adw_breakpoint_unapply (AdwBreakpoint* _sender,
                                           gpointer self);
static void proton_plus_widgets_controller_hint_bar_clear_box (ProtonPlusWidgetsControllerHintBar* self,
                                                        GtkBox* box);
static gboolean proton_plus_widgets_controller_hint_bar_is_essential (ProtonPlusWidgetsControllerHintBar* self,
                                                               ProtonPlusUtilsControllerHintKind hint);
static GtkWidget* proton_plus_widgets_controller_hint_bar_create_hint (ProtonPlusWidgetsControllerHintBar* self,
                                                                ProtonPlusUtilsControllerHintKind hint,
                                                                ProtonPlusUtilsControllerPresentationState* state);
static ProtonPlusUtilsControllerPhysicalButtonLabel* _proton_plus_utils_controller_physical_button_label_dup (ProtonPlusUtilsControllerPhysicalButtonLabel* self);
static GtkWidget* proton_plus_widgets_controller_hint_bar_create_hint_row (ProtonPlusWidgetsControllerHintBar* self,
                                                                    const gchar* capsule_text,
                                                                    const gchar* capsule_accessible,
                                                                    const gchar* action);
static void proton_plus_widgets_controller_hint_bar_physical_label (ProtonPlusWidgetsControllerHintBar* self,
                                                             ProtonPlusUtilsControllerPhysicalButtonLabel label,
                                                             gchar** text,
                                                             gchar** accessible);
static void proton_plus_widgets_controller_hint_bar_finalize (GObject * obj);
static GType proton_plus_widgets_controller_hint_bar_get_type_once (void);

static inline gpointer
proton_plus_widgets_controller_hint_bar_get_instance_private (ProtonPlusWidgetsControllerHintBar* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusWidgetsControllerHintBar_private_offset);
}

static void
__lambda335_ (ProtonPlusWidgetsControllerHintBar* self)
{
	GtkBox* _tmp0_;
	_tmp0_ = self->priv->secondary_box;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, FALSE);
}

static void
___lambda335__adw_breakpoint_apply (AdwBreakpoint* _sender,
                                    gpointer self)
{
	__lambda335_ ((ProtonPlusWidgetsControllerHintBar*) self);
}

static void
__lambda336_ (ProtonPlusWidgetsControllerHintBar* self)
{
	GtkBox* _tmp0_;
	_tmp0_ = self->priv->secondary_box;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, TRUE);
}

static void
___lambda336__adw_breakpoint_unapply (AdwBreakpoint* _sender,
                                      gpointer self)
{
	__lambda336_ ((ProtonPlusWidgetsControllerHintBar*) self);
}

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

ProtonPlusWidgetsControllerHintBar*
proton_plus_widgets_controller_hint_bar_construct (GType object_type)
{
	ProtonPlusWidgetsControllerHintBar * self = NULL;
	GtkRevealer* _tmp0_ = NULL;
	GtkBox* _tmp1_;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkBox* content = NULL;
	GtkBox* _tmp6_;
	GtkBox* _tmp7_;
	GtkBox* _tmp8_;
	AdwBreakpointBin* responsive = NULL;
	AdwBreakpointBin* _tmp9_;
	AdwBreakpoint* narrow = NULL;
	AdwBreakpointCondition* _tmp10_;
	AdwBreakpoint* _tmp11_;
	AdwBreakpoint* _tmp12_;
	GtkRevealer* _tmp13_;
	GtkRevealer* _tmp14_;
	self = (ProtonPlusWidgetsControllerHintBar*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "hexpand", TRUE, "can-target", FALSE, "focusable", FALSE, NULL);
	_tmp0_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_transition_type (_tmp0_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP);
	gtk_revealer_set_transition_duration (_tmp0_, (guint) 160);
	gtk_widget_set_can_target ((GtkWidget*) _tmp0_, FALSE);
	gtk_widget_set_focusable ((GtkWidget*) _tmp0_, FALSE);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->revealer);
	self->priv->revealer = _tmp0_;
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->essential_box);
	self->priv->essential_box = _tmp1_;
	_tmp2_ = self->priv->essential_box;
	gtk_widget_set_halign ((GtkWidget*) _tmp2_, GTK_ALIGN_CENTER);
	_tmp3_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->secondary_box);
	self->priv->secondary_box = _tmp3_;
	_tmp4_ = self->priv->secondary_box;
	gtk_widget_set_halign ((GtkWidget*) _tmp4_, GTK_ALIGN_CENTER);
	_tmp5_ = self->priv->secondary_box;
	gtk_widget_add_css_class ((GtkWidget*) _tmp5_, "controller-hint-secondary");
	_tmp6_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
	g_object_ref_sink (_tmp6_);
	content = _tmp6_;
	gtk_widget_set_halign ((GtkWidget*) content, GTK_ALIGN_CENTER);
	gtk_widget_set_hexpand ((GtkWidget*) content, TRUE);
	_tmp7_ = self->priv->essential_box;
	gtk_box_append (content, (GtkWidget*) _tmp7_);
	_tmp8_ = self->priv->secondary_box;
	gtk_box_append (content, (GtkWidget*) _tmp8_);
	_tmp9_ = (AdwBreakpointBin*) adw_breakpoint_bin_new ();
	g_object_ref_sink (_tmp9_);
	responsive = _tmp9_;
	gtk_widget_set_size_request ((GtkWidget*) responsive, 360, 42);
	adw_breakpoint_bin_set_child (responsive, (GtkWidget*) content);
	gtk_widget_add_css_class ((GtkWidget*) responsive, "controller-hint-bar");
	_tmp10_ = adw_breakpoint_condition_new_length (ADW_BREAKPOINT_CONDITION_MAX_WIDTH, (gdouble) 520, ADW_LENGTH_UNIT_PX);
	_tmp11_ = adw_breakpoint_new (_tmp10_);
	narrow = _tmp11_;
	g_signal_connect_object (narrow, "apply", (GCallback) ___lambda335__adw_breakpoint_apply, self, 0);
	g_signal_connect_object (narrow, "unapply", (GCallback) ___lambda336__adw_breakpoint_unapply, self, 0);
	_tmp12_ = _g_object_ref0 (narrow);
	adw_breakpoint_bin_add_breakpoint (responsive, _tmp12_);
	_tmp13_ = self->priv->revealer;
	gtk_revealer_set_child (_tmp13_, (GtkWidget*) responsive);
	_tmp14_ = self->priv->revealer;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp14_);
	_g_object_unref0 (narrow);
	_g_object_unref0 (responsive);
	_g_object_unref0 (content);
	return self;
}

ProtonPlusWidgetsControllerHintBar*
proton_plus_widgets_controller_hint_bar_new (void)
{
	return proton_plus_widgets_controller_hint_bar_construct (PROTON_PLUS_WIDGETS_TYPE_CONTROLLER_HINT_BAR);
}

void
proton_plus_widgets_controller_hint_bar_update_state (ProtonPlusWidgetsControllerHintBar* self,
                                                      ProtonPlusUtilsControllerPresentationState* state)
{
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	ProtonPlusUtilsControllerHintKind* hints = NULL;
	gint _tmp2_ = 0;
	ProtonPlusUtilsControllerHintKind* _tmp3_;
	gint hints_length1;
	gint _hints_size_;
	gint essential_count = 0;
	ProtonPlusUtilsControllerHintKind* _tmp4_;
	gint _tmp4__length1;
	ProtonPlusUtilsControllerHintKind* _tmp9_;
	gint _tmp9__length1;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_;
	gboolean _tmp18_;
	GtkRevealer* _tmp20_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (state != NULL);
	_tmp0_ = self->priv->essential_box;
	proton_plus_widgets_controller_hint_bar_clear_box (self, _tmp0_);
	_tmp1_ = self->priv->secondary_box;
	proton_plus_widgets_controller_hint_bar_clear_box (self, _tmp1_);
	_tmp3_ = proton_plus_utils_controller_presentation_state_get_hints (state, &_tmp2_);
	hints = _tmp3_;
	hints_length1 = _tmp2_;
	_hints_size_ = hints_length1;
	essential_count = 0;
	_tmp4_ = hints;
	_tmp4__length1 = hints_length1;
	{
		ProtonPlusUtilsControllerHintKind* hint_collection = NULL;
		gint hint_collection_length1 = 0;
		gint _hint_collection_size_ = 0;
		gint hint_it = 0;
		hint_collection = _tmp4_;
		hint_collection_length1 = _tmp4__length1;
		for (hint_it = 0; hint_it < hint_collection_length1; hint_it = hint_it + 1) {
			ProtonPlusUtilsControllerHintKind hint = 0;
			hint = hint_collection[hint_it];
			{
				if (proton_plus_widgets_controller_hint_bar_is_essential (self, hint)) {
					GtkBox* _tmp5_;
					GtkWidget* _tmp6_;
					GtkWidget* _tmp7_;
					gint _tmp8_;
					_tmp5_ = self->priv->essential_box;
					_tmp6_ = proton_plus_widgets_controller_hint_bar_create_hint (self, hint, state);
					_tmp7_ = _tmp6_;
					gtk_box_append (_tmp5_, _tmp7_);
					_g_object_unref0 (_tmp7_);
					_tmp8_ = essential_count;
					essential_count = _tmp8_ + 1;
				}
			}
		}
	}
	_tmp9_ = hints;
	_tmp9__length1 = hints_length1;
	{
		ProtonPlusUtilsControllerHintKind* hint_collection = NULL;
		gint hint_collection_length1 = 0;
		gint _hint_collection_size_ = 0;
		gint hint_it = 0;
		hint_collection = _tmp9_;
		hint_collection_length1 = _tmp9__length1;
		for (hint_it = 0; hint_it < hint_collection_length1; hint_it = hint_it + 1) {
			ProtonPlusUtilsControllerHintKind hint = 0;
			hint = hint_collection[hint_it];
			{
				GtkWidget* row = NULL;
				GtkWidget* _tmp10_;
				if (proton_plus_widgets_controller_hint_bar_is_essential (self, hint)) {
					continue;
				}
				_tmp10_ = proton_plus_widgets_controller_hint_bar_create_hint (self, hint, state);
				row = _tmp10_;
				if (essential_count == 0) {
					GtkBox* _tmp11_;
					GtkWidget* _tmp12_;
					gint _tmp13_;
					_tmp11_ = self->priv->essential_box;
					_tmp12_ = row;
					gtk_box_append (_tmp11_, _tmp12_);
					_tmp13_ = essential_count;
					essential_count = _tmp13_ + 1;
				} else {
					GtkBox* _tmp14_;
					GtkWidget* _tmp15_;
					_tmp14_ = self->priv->secondary_box;
					_tmp15_ = row;
					gtk_box_append (_tmp14_, _tmp15_);
				}
				_g_object_unref0 (row);
			}
		}
	}
	_tmp17_ = proton_plus_utils_controller_presentation_state_get_controller_mode_active (state);
	_tmp18_ = _tmp17_;
	if (_tmp18_) {
		ProtonPlusUtilsControllerHintKind* _tmp19_;
		gint _tmp19__length1;
		_tmp19_ = hints;
		_tmp19__length1 = hints_length1;
		_tmp16_ = _tmp19__length1 > 0;
	} else {
		_tmp16_ = FALSE;
	}
	_tmp20_ = self->priv->revealer;
	gtk_revealer_set_reveal_child (_tmp20_, _tmp16_);
}

static gboolean
proton_plus_widgets_controller_hint_bar_is_essential (ProtonPlusWidgetsControllerHintBar* self,
                                                      ProtonPlusUtilsControllerHintKind hint)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	switch (hint) {
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_SELECT:
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_TOGGLE:
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_OPEN:
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_BACK:
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_EXIT:
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_CLOSE:
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_TEXT_INPUT:
		{
			result = TRUE;
			return result;
		}
		default:
		{
			result = FALSE;
			return result;
		}
	}
}

static ProtonPlusUtilsControllerPhysicalButtonLabel*
_proton_plus_utils_controller_physical_button_label_dup (ProtonPlusUtilsControllerPhysicalButtonLabel* self)
{
	ProtonPlusUtilsControllerPhysicalButtonLabel* dup;
	dup = g_new0 (ProtonPlusUtilsControllerPhysicalButtonLabel, 1);
	memcpy (dup, self, sizeof (ProtonPlusUtilsControllerPhysicalButtonLabel));
	return dup;
}

static gpointer
__proton_plus_utils_controller_physical_button_label_dup0 (gpointer self)
{
	return self ? _proton_plus_utils_controller_physical_button_label_dup (self) : NULL;
}

static GtkWidget*
proton_plus_widgets_controller_hint_bar_create_hint (ProtonPlusWidgetsControllerHintBar* self,
                                                     ProtonPlusUtilsControllerHintKind hint,
                                                     ProtonPlusUtilsControllerPresentationState* state)
{
	ProtonPlusUtilsControllerPhysicalButtonLabel* physical = NULL;
	gchar* capsule_text = NULL;
	gchar* capsule_accessible = NULL;
	gchar* action = NULL;
	ProtonPlusUtilsControllerPhysicalButtonLabel* _tmp76_;
	gchar* _tmp77_ = NULL;
	gchar* _tmp78_ = NULL;
	const gchar* _tmp79_;
	const gchar* _tmp80_;
	const gchar* _tmp81_;
	GtkWidget* _tmp82_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (state != NULL, NULL);
	physical = NULL;
	switch (hint) {
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_SELECT:
		{
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp0_;
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp1_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp2_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp3_;
			ProtonPlusUtilsControllerPhysicalButtonLabel* _tmp4_;
			gchar* _tmp5_;
			_tmp0_ = proton_plus_utils_controller_presentation_state_get_prompt_labels (state);
			_tmp1_ = _tmp0_;
			_tmp2_ = proton_plus_utils_controller_prompt_button_labels_get_confirm (_tmp1_);
			_tmp3_ = _tmp2_;
			_tmp4_ = __proton_plus_utils_controller_physical_button_label_dup0 (&_tmp3_);
			_g_free0 (physical);
			physical = _tmp4_;
			_tmp5_ = g_strdup (_ ("Select"));
			_g_free0 (action);
			action = _tmp5_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_TOGGLE:
		{
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp6_;
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp7_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp8_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp9_;
			ProtonPlusUtilsControllerPhysicalButtonLabel* _tmp10_;
			gchar* _tmp11_;
			_tmp6_ = proton_plus_utils_controller_presentation_state_get_prompt_labels (state);
			_tmp7_ = _tmp6_;
			_tmp8_ = proton_plus_utils_controller_prompt_button_labels_get_confirm (_tmp7_);
			_tmp9_ = _tmp8_;
			_tmp10_ = __proton_plus_utils_controller_physical_button_label_dup0 (&_tmp9_);
			_g_free0 (physical);
			physical = _tmp10_;
			_tmp11_ = g_strdup (_ ("Toggle"));
			_g_free0 (action);
			action = _tmp11_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_OPEN:
		{
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp12_;
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp13_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp14_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp15_;
			ProtonPlusUtilsControllerPhysicalButtonLabel* _tmp16_;
			gchar* _tmp17_;
			_tmp12_ = proton_plus_utils_controller_presentation_state_get_prompt_labels (state);
			_tmp13_ = _tmp12_;
			_tmp14_ = proton_plus_utils_controller_prompt_button_labels_get_confirm (_tmp13_);
			_tmp15_ = _tmp14_;
			_tmp16_ = __proton_plus_utils_controller_physical_button_label_dup0 (&_tmp15_);
			_g_free0 (physical);
			physical = _tmp16_;
			_tmp17_ = g_strdup (_ ("Open"));
			_g_free0 (action);
			action = _tmp17_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_BACK:
		{
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp18_;
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp19_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp20_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp21_;
			ProtonPlusUtilsControllerPhysicalButtonLabel* _tmp22_;
			gchar* _tmp23_;
			_tmp18_ = proton_plus_utils_controller_presentation_state_get_prompt_labels (state);
			_tmp19_ = _tmp18_;
			_tmp20_ = proton_plus_utils_controller_prompt_button_labels_get_back (_tmp19_);
			_tmp21_ = _tmp20_;
			_tmp22_ = __proton_plus_utils_controller_physical_button_label_dup0 (&_tmp21_);
			_g_free0 (physical);
			physical = _tmp22_;
			_tmp23_ = g_strdup (_ ("Back"));
			_g_free0 (action);
			action = _tmp23_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_EXIT:
		{
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp24_;
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp25_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp26_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp27_;
			ProtonPlusUtilsControllerPhysicalButtonLabel* _tmp28_;
			gchar* _tmp29_;
			_tmp24_ = proton_plus_utils_controller_presentation_state_get_prompt_labels (state);
			_tmp25_ = _tmp24_;
			_tmp26_ = proton_plus_utils_controller_prompt_button_labels_get_back (_tmp25_);
			_tmp27_ = _tmp26_;
			_tmp28_ = __proton_plus_utils_controller_physical_button_label_dup0 (&_tmp27_);
			_g_free0 (physical);
			physical = _tmp28_;
			_tmp29_ = g_strdup (_ ("Exit"));
			_g_free0 (action);
			action = _tmp29_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_CLOSE:
		{
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp30_;
			ProtonPlusUtilsControllerPromptButtonLabels* _tmp31_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp32_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp33_;
			ProtonPlusUtilsControllerPhysicalButtonLabel* _tmp34_;
			gchar* _tmp35_;
			_tmp30_ = proton_plus_utils_controller_presentation_state_get_prompt_labels (state);
			_tmp31_ = _tmp30_;
			_tmp32_ = proton_plus_utils_controller_prompt_button_labels_get_back (_tmp31_);
			_tmp33_ = _tmp32_;
			_tmp34_ = __proton_plus_utils_controller_physical_button_label_dup0 (&_tmp33_);
			_g_free0 (physical);
			physical = _tmp34_;
			_tmp35_ = g_strdup (_ ("Close"));
			_g_free0 (action);
			action = _tmp35_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_ADJUST_HORIZONTAL:
		{
			gchar* _tmp36_;
			gchar* _tmp37_;
			gchar* _tmp38_;
			const gchar* _tmp39_;
			const gchar* _tmp40_;
			const gchar* _tmp41_;
			GtkWidget* _tmp42_;
			_tmp36_ = g_strdup ("←/→");
			_g_free0 (capsule_text);
			capsule_text = _tmp36_;
			_tmp37_ = g_strdup (_ ("Left and right"));
			_g_free0 (capsule_accessible);
			capsule_accessible = _tmp37_;
			_tmp38_ = g_strdup (_ ("Adjust"));
			_g_free0 (action);
			action = _tmp38_;
			_tmp39_ = capsule_text;
			_tmp40_ = capsule_accessible;
			_tmp41_ = action;
			_tmp42_ = proton_plus_widgets_controller_hint_bar_create_hint_row (self, _tmp39_, _tmp40_, _tmp41_);
			result = _tmp42_;
			_g_free0 (action);
			_g_free0 (capsule_accessible);
			_g_free0 (capsule_text);
			_g_free0 (physical);
			return result;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_ADJUST_VERTICAL:
		{
			gchar* _tmp43_;
			gchar* _tmp44_;
			gchar* _tmp45_;
			const gchar* _tmp46_;
			const gchar* _tmp47_;
			const gchar* _tmp48_;
			GtkWidget* _tmp49_;
			_tmp43_ = g_strdup ("↑/↓");
			_g_free0 (capsule_text);
			capsule_text = _tmp43_;
			_tmp44_ = g_strdup (_ ("Up and down"));
			_g_free0 (capsule_accessible);
			capsule_accessible = _tmp44_;
			_tmp45_ = g_strdup (_ ("Adjust"));
			_g_free0 (action);
			action = _tmp45_;
			_tmp46_ = capsule_text;
			_tmp47_ = capsule_accessible;
			_tmp48_ = action;
			_tmp49_ = proton_plus_widgets_controller_hint_bar_create_hint_row (self, _tmp46_, _tmp47_, _tmp48_);
			result = _tmp49_;
			_g_free0 (action);
			_g_free0 (capsule_accessible);
			_g_free0 (capsule_text);
			_g_free0 (physical);
			return result;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_TEXT_INPUT:
		{
			gchar* _tmp50_;
			gchar* _tmp51_;
			gchar* _tmp52_;
			const gchar* _tmp53_;
			const gchar* _tmp54_;
			const gchar* _tmp55_;
			GtkWidget* _tmp56_;
			_tmp50_ = g_strdup ("⌨");
			_g_free0 (capsule_text);
			capsule_text = _tmp50_;
			_tmp51_ = g_strdup (_ ("Keyboard"));
			_g_free0 (capsule_accessible);
			capsule_accessible = _tmp51_;
			_tmp52_ = g_strdup (_ ("Enter text"));
			_g_free0 (action);
			action = _tmp52_;
			_tmp53_ = capsule_text;
			_tmp54_ = capsule_accessible;
			_tmp55_ = action;
			_tmp56_ = proton_plus_widgets_controller_hint_bar_create_hint_row (self, _tmp53_, _tmp54_, _tmp55_);
			result = _tmp56_;
			_g_free0 (action);
			_g_free0 (capsule_accessible);
			_g_free0 (capsule_text);
			_g_free0 (physical);
			return result;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_SWITCH_SECTION:
		{
			gchar* _tmp57_;
			gchar* _tmp58_;
			gchar* _tmp59_;
			const gchar* _tmp60_;
			const gchar* _tmp61_;
			const gchar* _tmp62_;
			GtkWidget* _tmp63_;
			_tmp57_ = g_strdup (_ ("Shoulders"));
			_g_free0 (capsule_text);
			capsule_text = _tmp57_;
			_tmp58_ = g_strdup (_ ("Shoulder buttons"));
			_g_free0 (capsule_accessible);
			capsule_accessible = _tmp58_;
			_tmp59_ = g_strdup (_ ("Switch section or page"));
			_g_free0 (action);
			action = _tmp59_;
			_tmp60_ = capsule_text;
			_tmp61_ = capsule_accessible;
			_tmp62_ = action;
			_tmp63_ = proton_plus_widgets_controller_hint_bar_create_hint_row (self, _tmp60_, _tmp61_, _tmp62_);
			result = _tmp63_;
			_g_free0 (action);
			_g_free0 (capsule_accessible);
			_g_free0 (capsule_text);
			_g_free0 (physical);
			return result;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_SEARCH:
		{
			ProtonPlusUtilsControllerFaceButtonLabelFacts* _tmp64_;
			ProtonPlusUtilsControllerFaceButtonLabelFacts* _tmp65_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp66_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp67_;
			ProtonPlusUtilsControllerPhysicalButtonLabel* _tmp68_;
			gchar* _tmp69_;
			_tmp64_ = proton_plus_utils_controller_presentation_state_get_face_labels (state);
			_tmp65_ = _tmp64_;
			_tmp66_ = proton_plus_utils_controller_face_button_label_facts_get_west (_tmp65_);
			_tmp67_ = _tmp66_;
			_tmp68_ = __proton_plus_utils_controller_physical_button_label_dup0 (&_tmp67_);
			_g_free0 (physical);
			physical = _tmp68_;
			_tmp69_ = g_strdup (_ ("Search"));
			_g_free0 (action);
			action = _tmp69_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HINT_KIND_FILTER:
		{
			ProtonPlusUtilsControllerFaceButtonLabelFacts* _tmp70_;
			ProtonPlusUtilsControllerFaceButtonLabelFacts* _tmp71_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp72_;
			ProtonPlusUtilsControllerPhysicalButtonLabel _tmp73_;
			ProtonPlusUtilsControllerPhysicalButtonLabel* _tmp74_;
			gchar* _tmp75_;
			_tmp70_ = proton_plus_utils_controller_presentation_state_get_face_labels (state);
			_tmp71_ = _tmp70_;
			_tmp72_ = proton_plus_utils_controller_face_button_label_facts_get_north (_tmp71_);
			_tmp73_ = _tmp72_;
			_tmp74_ = __proton_plus_utils_controller_physical_button_label_dup0 (&_tmp73_);
			_g_free0 (physical);
			physical = _tmp74_;
			_tmp75_ = g_strdup (_ ("Filter"));
			_g_free0 (action);
			action = _tmp75_;
			break;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
	_tmp76_ = physical;
	proton_plus_widgets_controller_hint_bar_physical_label (self, (ProtonPlusUtilsControllerPhysicalButtonLabel) (*_tmp76_), &_tmp77_, &_tmp78_);
	_g_free0 (capsule_text);
	capsule_text = _tmp77_;
	_g_free0 (capsule_accessible);
	capsule_accessible = _tmp78_;
	_tmp79_ = capsule_text;
	_tmp80_ = capsule_accessible;
	_tmp81_ = action;
	_tmp82_ = proton_plus_widgets_controller_hint_bar_create_hint_row (self, _tmp79_, _tmp80_, _tmp81_);
	result = _tmp82_;
	_g_free0 (action);
	_g_free0 (capsule_accessible);
	_g_free0 (capsule_text);
	_g_free0 (physical);
	return result;
}

static GtkWidget*
proton_plus_widgets_controller_hint_bar_create_hint_row (ProtonPlusWidgetsControllerHintBar* self,
                                                         const gchar* capsule_text,
                                                         const gchar* capsule_accessible,
                                                         const gchar* action)
{
	GtkLabel* capsule = NULL;
	GtkLabel* _tmp0_;
	GtkLabel* action_label = NULL;
	GtkLabel* _tmp1_;
	GtkBox* row = NULL;
	GtkBox* _tmp2_;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (capsule_text != NULL, NULL);
	g_return_val_if_fail (capsule_accessible != NULL, NULL);
	g_return_val_if_fail (action != NULL, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (capsule_text);
	g_object_ref_sink (_tmp0_);
	capsule = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) capsule, "controller-hint-button");
	gtk_widget_set_tooltip_text ((GtkWidget*) capsule, capsule_accessible);
	gtk_accessible_update_property ((GtkAccessible*) capsule, GTK_ACCESSIBLE_PROPERTY_LABEL, capsule_accessible, -1, -1);
	_tmp1_ = (GtkLabel*) gtk_label_new (action);
	g_object_ref_sink (_tmp1_);
	action_label = _tmp1_;
	gtk_widget_add_css_class ((GtkWidget*) action_label, "controller-hint-action");
	gtk_label_set_wrap (action_label, FALSE);
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp2_);
	row = _tmp2_;
	gtk_widget_set_can_target ((GtkWidget*) row, FALSE);
	gtk_widget_set_focusable ((GtkWidget*) row, FALSE);
	gtk_box_append (row, (GtkWidget*) capsule);
	gtk_box_append (row, (GtkWidget*) action_label);
	result = (GtkWidget*) row;
	_g_object_unref0 (action_label);
	_g_object_unref0 (capsule);
	return result;
}

static void
proton_plus_widgets_controller_hint_bar_physical_label (ProtonPlusWidgetsControllerHintBar* self,
                                                        ProtonPlusUtilsControllerPhysicalButtonLabel label,
                                                        gchar** text,
                                                        gchar** accessible)
{
	gchar* _vala_text = NULL;
	gchar* _vala_accessible = NULL;
	g_return_if_fail (self != NULL);
	switch (label) {
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_A:
		{
			gchar* _tmp0_;
			gchar* _tmp1_;
			_tmp0_ = g_strdup ("A");
			_g_free0 (_vala_text);
			_vala_text = _tmp0_;
			_tmp1_ = g_strdup (_ ("A button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp1_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_B:
		{
			gchar* _tmp2_;
			gchar* _tmp3_;
			_tmp2_ = g_strdup ("B");
			_g_free0 (_vala_text);
			_vala_text = _tmp2_;
			_tmp3_ = g_strdup (_ ("B button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp3_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_X:
		{
			gchar* _tmp4_;
			gchar* _tmp5_;
			_tmp4_ = g_strdup ("X");
			_g_free0 (_vala_text);
			_vala_text = _tmp4_;
			_tmp5_ = g_strdup (_ ("X button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp5_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_Y:
		{
			gchar* _tmp6_;
			gchar* _tmp7_;
			_tmp6_ = g_strdup ("Y");
			_g_free0 (_vala_text);
			_vala_text = _tmp6_;
			_tmp7_ = g_strdup (_ ("Y button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp7_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_CROSS:
		{
			gchar* _tmp8_;
			gchar* _tmp9_;
			_tmp8_ = g_strdup ("×");
			_g_free0 (_vala_text);
			_vala_text = _tmp8_;
			_tmp9_ = g_strdup (_ ("Cross button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp9_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_CIRCLE:
		{
			gchar* _tmp10_;
			gchar* _tmp11_;
			_tmp10_ = g_strdup ("○");
			_g_free0 (_vala_text);
			_vala_text = _tmp10_;
			_tmp11_ = g_strdup (_ ("Circle button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp11_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_SQUARE:
		{
			gchar* _tmp12_;
			gchar* _tmp13_;
			_tmp12_ = g_strdup ("□");
			_g_free0 (_vala_text);
			_vala_text = _tmp12_;
			_tmp13_ = g_strdup (_ ("Square button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp13_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_TRIANGLE:
		{
			gchar* _tmp14_;
			gchar* _tmp15_;
			_tmp14_ = g_strdup ("△");
			_g_free0 (_vala_text);
			_vala_text = _tmp14_;
			_tmp15_ = g_strdup (_ ("Triangle button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp15_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_BOTTOM:
		{
			gchar* _tmp16_;
			gchar* _tmp17_;
			_tmp16_ = g_strdup (_ ("Bottom"));
			_g_free0 (_vala_text);
			_vala_text = _tmp16_;
			_tmp17_ = g_strdup (_ ("Bottom face button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp17_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_RIGHT:
		{
			gchar* _tmp18_;
			gchar* _tmp19_;
			_tmp18_ = g_strdup (_ ("Right"));
			_g_free0 (_vala_text);
			_vala_text = _tmp18_;
			_tmp19_ = g_strdup (_ ("Right face button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp19_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_LEFT:
		{
			gchar* _tmp20_;
			gchar* _tmp21_;
			_tmp20_ = g_strdup (_ ("Left"));
			_g_free0 (_vala_text);
			_vala_text = _tmp20_;
			_tmp21_ = g_strdup (_ ("Left face button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp21_;
			break;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_PHYSICAL_BUTTON_LABEL_TOP:
		{
			gchar* _tmp22_;
			gchar* _tmp23_;
			_tmp22_ = g_strdup (_ ("Top"));
			_g_free0 (_vala_text);
			_vala_text = _tmp22_;
			_tmp23_ = g_strdup (_ ("Top face button"));
			_g_free0 (_vala_accessible);
			_vala_accessible = _tmp23_;
			break;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
	if (text) {
		*text = _vala_text;
	} else {
		_g_free0 (_vala_text);
	}
	if (accessible) {
		*accessible = _vala_accessible;
	} else {
		_g_free0 (_vala_accessible);
	}
}

static void
proton_plus_widgets_controller_hint_bar_clear_box (ProtonPlusWidgetsControllerHintBar* self,
                                                   GtkBox* box)
{
	GtkWidget* child = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (box != NULL);
	while (TRUE) {
		GtkWidget* _tmp0_;
		GtkWidget* _tmp1_;
		GtkWidget* _tmp2_;
		GtkWidget* _tmp3_;
		_tmp0_ = gtk_widget_get_first_child ((GtkWidget*) box);
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_g_object_unref0 (child);
		child = _tmp1_;
		_tmp2_ = child;
		if (!(_tmp2_ != NULL)) {
			break;
		}
		_tmp3_ = child;
		gtk_box_remove (box, G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_widget_get_type (), GtkWidget));
	}
	_g_object_unref0 (child);
}

static void
proton_plus_widgets_controller_hint_bar_class_init (ProtonPlusWidgetsControllerHintBarClass * klass,
                                                    gpointer klass_data)
{
	proton_plus_widgets_controller_hint_bar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusWidgetsControllerHintBar_private_offset);
	G_OBJECT_CLASS (klass)->finalize = proton_plus_widgets_controller_hint_bar_finalize;
}

static void
proton_plus_widgets_controller_hint_bar_instance_init (ProtonPlusWidgetsControllerHintBar * self,
                                                       gpointer klass)
{
	self->priv = proton_plus_widgets_controller_hint_bar_get_instance_private (self);
}

static void
proton_plus_widgets_controller_hint_bar_finalize (GObject * obj)
{
	ProtonPlusWidgetsControllerHintBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_TYPE_CONTROLLER_HINT_BAR, ProtonPlusWidgetsControllerHintBar);
	_g_object_unref0 (self->priv->revealer);
	_g_object_unref0 (self->priv->essential_box);
	_g_object_unref0 (self->priv->secondary_box);
	G_OBJECT_CLASS (proton_plus_widgets_controller_hint_bar_parent_class)->finalize (obj);
}

static GType
proton_plus_widgets_controller_hint_bar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsControllerHintBarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_controller_hint_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsControllerHintBar), 0, (GInstanceInitFunc) proton_plus_widgets_controller_hint_bar_instance_init, NULL };
	GType proton_plus_widgets_controller_hint_bar_type_id;
	proton_plus_widgets_controller_hint_bar_type_id = g_type_register_static (gtk_box_get_type (), "ProtonPlusWidgetsControllerHintBar", &g_define_type_info, 0);
	ProtonPlusWidgetsControllerHintBar_private_offset = g_type_add_instance_private (proton_plus_widgets_controller_hint_bar_type_id, sizeof (ProtonPlusWidgetsControllerHintBarPrivate));
	return proton_plus_widgets_controller_hint_bar_type_id;
}

GType
proton_plus_widgets_controller_hint_bar_get_type (void)
{
	static volatile gsize proton_plus_widgets_controller_hint_bar_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_controller_hint_bar_type_id__once)) {
		GType proton_plus_widgets_controller_hint_bar_type_id;
		proton_plus_widgets_controller_hint_bar_type_id = proton_plus_widgets_controller_hint_bar_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_controller_hint_bar_type_id__once, proton_plus_widgets_controller_hint_bar_type_id);
	}
	return proton_plus_widgets_controller_hint_bar_type_id__once;
}

