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

/*
 * Copyright (C) 2008-2012 Robert Ancell
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
 */

#include <adwaita.h>
#include <glib-object.h>
#include "calculator.h"
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_ADVANCED_BUTTON_PANEL (advanced_button_panel_get_type ())
#define ADVANCED_BUTTON_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ADVANCED_BUTTON_PANEL, AdvancedButtonPanel))
#define ADVANCED_BUTTON_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ADVANCED_BUTTON_PANEL, AdvancedButtonPanelClass))
#define IS_ADVANCED_BUTTON_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ADVANCED_BUTTON_PANEL))
#define IS_ADVANCED_BUTTON_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ADVANCED_BUTTON_PANEL))
#define ADVANCED_BUTTON_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ADVANCED_BUTTON_PANEL, AdvancedButtonPanelClass))

typedef struct _AdvancedButtonPanel AdvancedButtonPanel;
typedef struct _AdvancedButtonPanelClass AdvancedButtonPanelClass;
typedef struct _AdvancedButtonPanelPrivate AdvancedButtonPanelPrivate;
enum  {
	ADVANCED_BUTTON_PANEL_0_PROPERTY,
	ADVANCED_BUTTON_PANEL_NUM_PROPERTIES
};
static GParamSpec* advanced_button_panel_properties[ADVANCED_BUTTON_PANEL_NUM_PROPERTIES];
typedef void (*GSimpleActionActivateCallback) (GSimpleAction* action, GVariant* parameter, gpointer user_data);
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_MATH_BUTTONS (math_buttons_get_type ())
#define MATH_BUTTONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MATH_BUTTONS, MathButtons))
#define MATH_BUTTONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MATH_BUTTONS, MathButtonsClass))
#define IS_MATH_BUTTONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MATH_BUTTONS))
#define IS_MATH_BUTTONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MATH_BUTTONS))
#define MATH_BUTTONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MATH_BUTTONS, MathButtonsClass))

typedef struct _MathButtons MathButtons;
typedef struct _MathButtonsClass MathButtonsClass;
typedef struct _Block1Data Block1Data;
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_MATH_POPOVER (math_popover_get_type ())
#define MATH_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MATH_POPOVER, MathPopover))
#define MATH_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MATH_POPOVER, MathPopoverClass))
#define IS_MATH_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MATH_POPOVER))
#define IS_MATH_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MATH_POPOVER))
#define MATH_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MATH_POPOVER, MathPopoverClass))

typedef struct _MathPopover MathPopover;
typedef struct _MathPopoverClass MathPopoverClass;

#define TYPE_MATH_VARIABLE_POPOVER (math_variable_popover_get_type ())
#define MATH_VARIABLE_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MATH_VARIABLE_POPOVER, MathVariablePopover))
#define MATH_VARIABLE_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MATH_VARIABLE_POPOVER, MathVariablePopoverClass))
#define IS_MATH_VARIABLE_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MATH_VARIABLE_POPOVER))
#define IS_MATH_VARIABLE_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MATH_VARIABLE_POPOVER))
#define MATH_VARIABLE_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MATH_VARIABLE_POPOVER, MathVariablePopoverClass))

typedef struct _MathVariablePopover MathVariablePopover;
typedef struct _MathVariablePopoverClass MathVariablePopoverClass;

#define TYPE_MATH_FUNCTION_POPOVER (math_function_popover_get_type ())
#define MATH_FUNCTION_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MATH_FUNCTION_POPOVER, MathFunctionPopover))
#define MATH_FUNCTION_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MATH_FUNCTION_POPOVER, MathFunctionPopoverClass))
#define IS_MATH_FUNCTION_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MATH_FUNCTION_POPOVER))
#define IS_MATH_FUNCTION_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MATH_FUNCTION_POPOVER))
#define MATH_FUNCTION_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MATH_FUNCTION_POPOVER, MathFunctionPopoverClass))

typedef struct _MathFunctionPopover MathFunctionPopover;
typedef struct _MathFunctionPopoverClass MathFunctionPopoverClass;

struct _AdvancedButtonPanel {
	AdwBreakpointBin parent_instance;
	AdvancedButtonPanelPrivate * priv;
};

struct _AdvancedButtonPanelClass {
	AdwBreakpointBinClass parent_class;
};

struct _AdvancedButtonPanelPrivate {
	MathEquation* equation;
	AdwCarousel* carousel;
	GtkWidget* carousel_dots;
	GtkWidget* math_box;
	GtkWidget* basic;
	GtkWidget* advanced;
	GtkButton* calc_numeric_point_button;
	GtkMenuButton* calc_memory_button;
	GtkMenuButton* calc_function_button;
	GtkButton* calc_inverse_modifier_button;
	GtkButton* calc_angle_units_button;
	GSimpleActionGroup* action_group;
};

struct _Block1Data {
	int _ref_count_;
	AdvancedButtonPanel* self;
	gulong carousel_mapped;
};

static gint AdvancedButtonPanel_private_offset;
static gpointer advanced_button_panel_parent_class = NULL;

VALA_EXTERN GType advanced_button_panel_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AdvancedButtonPanel, g_object_unref)
static void advanced_button_panel_on_factorize (AdvancedButtonPanel* self);
static void _advanced_button_panel_on_factorize_gsimple_action_activate_callback (GSimpleAction* action,
                                                                           GVariant* parameter,
                                                                           gpointer self);
static void advanced_button_panel_on_set_angle_units (AdvancedButtonPanel* self);
static void _advanced_button_panel_on_set_angle_units_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                 GVariant* parameter,
                                                                                 gpointer self);
VALA_EXTERN GType math_buttons_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MathButtons, g_object_unref)
VALA_EXTERN AdvancedButtonPanel* advanced_button_panel_new (MathButtons* buttons);
VALA_EXTERN AdvancedButtonPanel* advanced_button_panel_construct (GType object_type,
                                                      MathButtons* buttons);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
VALA_EXTERN MathEquation* math_buttons_get_equation (MathButtons* self);
static void advanced_button_panel_correct_text_direction (AdvancedButtonPanel* self);
VALA_EXTERN MathVariablePopover* math_variable_popover_new (MathEquation* equation);
VALA_EXTERN MathVariablePopover* math_variable_popover_construct (GType object_type,
                                                      MathEquation* equation);
VALA_EXTERN GType math_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MathPopover, g_object_unref)
VALA_EXTERN GType math_variable_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MathVariablePopover, g_object_unref)
VALA_EXTERN MathFunctionPopover* math_function_popover_new (MathEquation* equation);
VALA_EXTERN MathFunctionPopover* math_function_popover_construct (GType object_type,
                                                      MathEquation* equation);
VALA_EXTERN GType math_function_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MathFunctionPopover, g_object_unref)
static void __lambda49_ (AdvancedButtonPanel* self);
static void ___lambda49__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static void __lambda50_ (Block1Data* _data1_);
static void ___lambda50__gtk_widget_map (GtkWidget* _sender,
                                  gpointer self);
static void advanced_button_panel_update_angle_units_button (AdvancedButtonPanel* self);
static void _advanced_button_panel_update_angle_units_button_g_object_notify (GObject* _sender,
                                                                       GParamSpec* pspec,
                                                                       gpointer self);
static void advanced_button_panel_finalize (GObject * obj);
static GType advanced_button_panel_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static const GActionEntry ADVANCED_BUTTON_PANEL_action_entries[2] = {{"factorize", _advanced_button_panel_on_factorize_gsimple_action_activate_callback}, {"set-angle-units", _advanced_button_panel_on_set_angle_units_gsimple_action_activate_callback}};

static inline gpointer
advanced_button_panel_get_instance_private (AdvancedButtonPanel* self)
{
	return G_STRUCT_MEMBER_P (self, AdvancedButtonPanel_private_offset);
}

static void
_advanced_button_panel_on_factorize_gsimple_action_activate_callback (GSimpleAction* action,
                                                                      GVariant* parameter,
                                                                      gpointer self)
{
	advanced_button_panel_on_factorize ((AdvancedButtonPanel*) self);
}

static void
_advanced_button_panel_on_set_angle_units_gsimple_action_activate_callback (GSimpleAction* action,
                                                                            GVariant* parameter,
                                                                            gpointer self)
{
	advanced_button_panel_on_set_angle_units ((AdvancedButtonPanel*) self);
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		AdvancedButtonPanel* self;
		self = _data1_->self;
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}

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

static gchar*
g_unichar_to_string (gunichar self)
{
	gchar* str = NULL;
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = g_new0 (gchar, 7);
	str = (gchar*) _tmp0_;
	g_unichar_to_utf8 (self, str);
	result = str;
	return result;
}

static void
__lambda49_ (AdvancedButtonPanel* self)
{
	AdwCarousel* _tmp0_;
	AdwCarousel* _tmp1_;
	GtkWidget* _tmp2_;
	_tmp0_ = self->priv->carousel;
	_tmp1_ = self->priv->carousel;
	_tmp2_ = adw_carousel_get_nth_page (_tmp1_, (guint) 1);
	adw_carousel_scroll_to (_tmp0_, _tmp2_, FALSE);
}

static void
___lambda49__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda49_ ((AdvancedButtonPanel*) self);
}

static void
__lambda50_ (Block1Data* _data1_)
{
	AdvancedButtonPanel* self;
	AdwCarousel* _tmp0_;
	AdwCarousel* _tmp1_;
	GtkWidget* _tmp2_;
	AdwCarousel* _tmp3_;
	self = _data1_->self;
	_tmp0_ = self->priv->carousel;
	_tmp1_ = self->priv->carousel;
	_tmp2_ = adw_carousel_get_nth_page (_tmp1_, (guint) 1);
	adw_carousel_scroll_to (_tmp0_, _tmp2_, FALSE);
	_tmp3_ = self->priv->carousel;
	g_signal_handler_disconnect ((GObject*) _tmp3_, _data1_->carousel_mapped);
}

static void
___lambda50__gtk_widget_map (GtkWidget* _sender,
                             gpointer self)
{
	__lambda50_ (self);
}

static void
_advanced_button_panel_update_angle_units_button_g_object_notify (GObject* _sender,
                                                                  GParamSpec* pspec,
                                                                  gpointer self)
{
	advanced_button_panel_update_angle_units_button ((AdvancedButtonPanel*) self);
}

AdvancedButtonPanel*
advanced_button_panel_construct (GType object_type,
                                 MathButtons* buttons)
{
	AdvancedButtonPanel * self = NULL;
	Block1Data* _data1_;
	MathEquation* _tmp0_;
	MathEquation* _tmp1_;
	MathEquation* _tmp2_;
	GSimpleActionGroup* _tmp3_;
	GSimpleActionGroup* _tmp4_;
	GtkButton* _tmp5_;
	MathEquation* _tmp6_;
	Serializer* _tmp7_;
	Serializer* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GtkMenuButton* _tmp11_;
	MathEquation* _tmp12_;
	MathVariablePopover* _tmp13_;
	MathVariablePopover* _tmp14_;
	GtkMenuButton* _tmp15_;
	MathEquation* _tmp16_;
	MathFunctionPopover* _tmp17_;
	MathFunctionPopover* _tmp18_;
	AdwCarousel* _tmp19_;
	gulong _tmp20_;
	GtkButton* _tmp21_;
	MathEquation* _tmp22_;
	g_return_val_if_fail (buttons != NULL, NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	self = (AdvancedButtonPanel*) g_object_new (object_type, NULL);
	_data1_->self = g_object_ref (self);
	_tmp0_ = math_buttons_get_equation (buttons);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->priv->equation);
	self->priv->equation = _tmp2_;
	_tmp3_ = self->priv->action_group;
	g_action_map_add_action_entries ((GActionMap*) _tmp3_, ADVANCED_BUTTON_PANEL_action_entries, (gint) G_N_ELEMENTS (ADVANCED_BUTTON_PANEL_action_entries), self);
	_tmp4_ = self->priv->action_group;
	gtk_widget_insert_action_group ((GtkWidget*) self, "cal", (GActionGroup*) _tmp4_);
	advanced_button_panel_correct_text_direction (self);
	_tmp5_ = self->priv->calc_numeric_point_button;
	_tmp6_ = self->priv->equation;
	_tmp7_ = math_equation_get_serializer (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_unichar_to_string (serializer_get_radix (_tmp8_));
	_tmp10_ = _tmp9_;
	gtk_button_set_label (_tmp5_, _tmp10_);
	_g_free0 (_tmp10_);
	_tmp11_ = self->priv->calc_memory_button;
	_tmp12_ = self->priv->equation;
	_tmp13_ = math_variable_popover_new (_tmp12_);
	g_object_ref_sink (_tmp13_);
	_tmp14_ = _tmp13_;
	gtk_menu_button_set_popover (_tmp11_, (GtkPopover*) _tmp14_);
	_g_object_unref0 (_tmp14_);
	_tmp15_ = self->priv->calc_function_button;
	_tmp16_ = self->priv->equation;
	_tmp17_ = math_function_popover_new (_tmp16_);
	g_object_ref_sink (_tmp17_);
	_tmp18_ = _tmp17_;
	gtk_menu_button_set_popover (_tmp15_, (GtkPopover*) _tmp18_);
	_g_object_unref0 (_tmp18_);
	g_signal_connect_object ((GObject*) buttons, "notify::mode", (GCallback) ___lambda49__g_object_notify, self, 0);
	_data1_->carousel_mapped = (gulong) 0;
	_tmp19_ = self->priv->carousel;
	_tmp20_ = g_signal_connect_data ((GtkWidget*) _tmp19_, "map", (GCallback) ___lambda50__gtk_widget_map, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	_data1_->carousel_mapped = _tmp20_;
	_tmp21_ = self->priv->calc_inverse_modifier_button;
	g_object_bind_property_with_closures ((GObject*) buttons, "inverse", (GObject*) _tmp21_, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp22_ = self->priv->equation;
	g_signal_connect_object ((GObject*) _tmp22_, "notify::angle-units", (GCallback) _advanced_button_panel_update_angle_units_button_g_object_notify, self, 0);
	advanced_button_panel_update_angle_units_button (self);
	block1_data_unref (_data1_);
	_data1_ = NULL;
	return self;
}

AdvancedButtonPanel*
advanced_button_panel_new (MathButtons* buttons)
{
	return advanced_button_panel_construct (TYPE_ADVANCED_BUTTON_PANEL, buttons);
}

static void
advanced_button_panel_correct_text_direction (AdvancedButtonPanel* self)
{
	AdwCarousel* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	GtkWidget* _tmp3_;
	GtkWidget* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->carousel;
	gtk_widget_set_direction ((GtkWidget*) _tmp0_, GTK_TEXT_DIR_LTR);
	_tmp1_ = self->priv->carousel_dots;
	gtk_widget_set_direction (_tmp1_, GTK_TEXT_DIR_LTR);
	_tmp2_ = self->priv->math_box;
	gtk_widget_set_direction (_tmp2_, GTK_TEXT_DIR_LTR);
	_tmp3_ = self->priv->basic;
	gtk_widget_set_direction (_tmp3_, GTK_TEXT_DIR_LTR);
	_tmp4_ = self->priv->advanced;
	gtk_widget_set_direction (_tmp4_, GTK_TEXT_DIR_LTR);
}

static void
advanced_button_panel_on_factorize (AdvancedButtonPanel* self)
{
	MathEquation* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->equation;
	math_equation_factorize (_tmp0_);
}

static void
advanced_button_panel_on_set_angle_units (AdvancedButtonPanel* self)
{
	MathEquation* _tmp0_;
	MathEquation* _tmp1_;
	AngleUnit _tmp2_;
	AngleUnit _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->equation;
	_tmp1_ = self->priv->equation;
	_tmp2_ = math_equation_get_angle_units (_tmp1_);
	_tmp3_ = _tmp2_;
	math_equation_set_angle_units (_tmp0_, (_tmp3_ + 2) % 3);
}

static void
advanced_button_panel_update_angle_units_button (AdvancedButtonPanel* self)
{
	gchar** unit_symbols = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar** _tmp3_;
	gint unit_symbols_length1;
	gint _unit_symbols_size_;
	gchar** unit_names = NULL;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar** _tmp7_;
	gint unit_names_length1;
	gint _unit_names_size_;
	GtkButton* _tmp8_;
	MathEquation* _tmp9_;
	AngleUnit _tmp10_;
	AngleUnit _tmp11_;
	const gchar* _tmp12_;
	GtkButton* _tmp13_;
	MathEquation* _tmp14_;
	AngleUnit _tmp15_;
	AngleUnit _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("Rad");
	_tmp1_ = g_strdup ("Deg");
	_tmp2_ = g_strdup ("Grad");
	_tmp3_ = g_new0 (gchar*, 3 + 1);
	_tmp3_[0] = _tmp0_;
	_tmp3_[1] = _tmp1_;
	_tmp3_[2] = _tmp2_;
	unit_symbols = _tmp3_;
	unit_symbols_length1 = 3;
	_unit_symbols_size_ = unit_symbols_length1;
	_tmp4_ = g_strdup (_ ("Radians"));
	_tmp5_ = g_strdup (_ ("Degrees"));
	_tmp6_ = g_strdup (_ ("Gradians"));
	_tmp7_ = g_new0 (gchar*, 3 + 1);
	_tmp7_[0] = _tmp4_;
	_tmp7_[1] = _tmp5_;
	_tmp7_[2] = _tmp6_;
	unit_names = _tmp7_;
	unit_names_length1 = 3;
	_unit_names_size_ = unit_names_length1;
	_tmp8_ = self->priv->calc_angle_units_button;
	_tmp9_ = self->priv->equation;
	_tmp10_ = math_equation_get_angle_units (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = unit_symbols[_tmp11_];
	gtk_button_set_label (_tmp8_, _tmp12_);
	_tmp13_ = self->priv->calc_angle_units_button;
	_tmp14_ = self->priv->equation;
	_tmp15_ = math_equation_get_angle_units (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = unit_names[_tmp16_];
	_tmp18_ = g_strdup_printf (_ ("Angle Unit: %s"), _tmp17_);
	_tmp19_ = _tmp18_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp13_, _tmp19_);
	_g_free0 (_tmp19_);
	unit_names = (_vala_array_free (unit_names, unit_names_length1, (GDestroyNotify) g_free), NULL);
	unit_symbols = (_vala_array_free (unit_symbols, unit_symbols_length1, (GDestroyNotify) g_free), NULL);
}

static void
advanced_button_panel_class_init (AdvancedButtonPanelClass * klass,
                                  gpointer klass_data)
{
	advanced_button_panel_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &AdvancedButtonPanel_private_offset);
	G_OBJECT_CLASS (klass)->finalize = advanced_button_panel_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calculator/buttons-advanced.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "carousel", FALSE, AdvancedButtonPanel_private_offset + G_STRUCT_OFFSET (AdvancedButtonPanelPrivate, carousel));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "carousel_dots", FALSE, AdvancedButtonPanel_private_offset + G_STRUCT_OFFSET (AdvancedButtonPanelPrivate, carousel_dots));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "math_box", FALSE, AdvancedButtonPanel_private_offset + G_STRUCT_OFFSET (AdvancedButtonPanelPrivate, math_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "basic", FALSE, AdvancedButtonPanel_private_offset + G_STRUCT_OFFSET (AdvancedButtonPanelPrivate, basic));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "advanced", FALSE, AdvancedButtonPanel_private_offset + G_STRUCT_OFFSET (AdvancedButtonPanelPrivate, advanced));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "calc_numeric_point_button", FALSE, AdvancedButtonPanel_private_offset + G_STRUCT_OFFSET (AdvancedButtonPanelPrivate, calc_numeric_point_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "calc_memory_button", FALSE, AdvancedButtonPanel_private_offset + G_STRUCT_OFFSET (AdvancedButtonPanelPrivate, calc_memory_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "calc_function_button", FALSE, AdvancedButtonPanel_private_offset + G_STRUCT_OFFSET (AdvancedButtonPanelPrivate, calc_function_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "calc_inverse_modifier_button", FALSE, AdvancedButtonPanel_private_offset + G_STRUCT_OFFSET (AdvancedButtonPanelPrivate, calc_inverse_modifier_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "calc_angle_units_button", FALSE, AdvancedButtonPanel_private_offset + G_STRUCT_OFFSET (AdvancedButtonPanelPrivate, calc_angle_units_button));
}

static void
advanced_button_panel_instance_init (AdvancedButtonPanel * self,
                                     gpointer klass)
{
	GSimpleActionGroup* _tmp0_;
	self->priv = advanced_button_panel_get_instance_private (self);
	_tmp0_ = g_simple_action_group_new ();
	self->priv->action_group = _tmp0_;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
advanced_button_panel_finalize (GObject * obj)
{
	AdvancedButtonPanel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ADVANCED_BUTTON_PANEL, AdvancedButtonPanel);
	_g_object_unref0 (self->priv->equation);
	_g_object_unref0 (self->priv->action_group);
	G_OBJECT_CLASS (advanced_button_panel_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
advanced_button_panel_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (AdvancedButtonPanelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) advanced_button_panel_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AdvancedButtonPanel), 0, (GInstanceInitFunc) advanced_button_panel_instance_init, NULL };
	GType advanced_button_panel_type_id;
	advanced_button_panel_type_id = g_type_register_static (adw_breakpoint_bin_get_type (), "AdvancedButtonPanel", &g_define_type_info, 0);
	AdvancedButtonPanel_private_offset = g_type_add_instance_private (advanced_button_panel_type_id, sizeof (AdvancedButtonPanelPrivate));
	return advanced_button_panel_type_id;
}

GType
advanced_button_panel_get_type (void)
{
	static gsize advanced_button_panel_type_id__once = 0;
	if (g_once_init_enter (&advanced_button_panel_type_id__once)) {
		GType advanced_button_panel_type_id;
		advanced_button_panel_type_id = advanced_button_panel_get_type_once ();
		g_once_init_leave (&advanced_button_panel_type_id__once, advanced_button_panel_type_id);
	}
	return advanced_button_panel_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize 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,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

