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

/*
 * SPDX-License-Identifier: GPL-2.0-or-later
 * SPDX-FileCopyrightText: 2011-2024 elementary, Inc. (https://elementary.io)
 */

#include "mouse-touchpad.h"
#include <glib-object.h>
#include <gio/gio.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <switchboard.h>
#include <gtk/gtk.h>
#include <granite-7.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.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  {
	MOUSE_TOUCHPAD_POINTING_VIEW_0_PROPERTY,
	MOUSE_TOUCHPAD_POINTING_VIEW_NUM_PROPERTIES
};
static GParamSpec* mouse_touchpad_pointing_view_properties[MOUSE_TOUCHPAD_POINTING_VIEW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

static gpointer mouse_touchpad_pointing_view_parent_class = NULL;

static GObject * mouse_touchpad_pointing_view_constructor (GType type,
                                                    guint n_construct_properties,
                                                    GObjectConstructParam * construct_properties);
static GType mouse_touchpad_pointing_view_get_type_once (void);

MouseTouchpadPointingView*
mouse_touchpad_pointing_view_construct (GType object_type)
{
	MouseTouchpadPointingView * self = NULL;
	GThemedIcon* _tmp0_;
	GThemedIcon* _tmp1_;
	_tmp0_ = (GThemedIcon*) g_themed_icon_new ("mouse-touchpad-pointing");
	_tmp1_ = _tmp0_;
	self = (MouseTouchpadPointingView*) g_object_new (object_type, "icon", _tmp1_, "title", _ ("Pointing"), NULL);
	_g_object_unref0 (_tmp1_);
	return self;
}

MouseTouchpadPointingView*
mouse_touchpad_pointing_view_new (void)
{
	return mouse_touchpad_pointing_view_construct (MOUSE_TOUCHPAD_TYPE_POINTING_VIEW);
}

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

static GObject *
mouse_touchpad_pointing_view_constructor (GType type,
                                          guint n_construct_properties,
                                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	MouseTouchpadPointingView * self;
	GtkSwitch* keypad_pointer_switch = NULL;
	GtkSwitch* _tmp0_ = NULL;
	GraniteHeaderLabel* keypad_pointer_header = NULL;
	gchar* _tmp1_;
	GtkSwitch* _tmp2_;
	GtkWidget* _tmp3_;
	GraniteHeaderLabel* _tmp4_ = NULL;
	GtkAdjustment* keypad_pointer_adjustment = NULL;
	GtkAdjustment* _tmp5_;
	GtkScale* pointer_speed_scale = NULL;
	GtkAdjustment* _tmp6_;
	GtkScale* _tmp7_ = NULL;
	GtkScale* _tmp8_;
	GtkScale* _tmp9_;
	GtkScale* _tmp10_;
	GtkCheckButton* cursor_size_24 = NULL;
	gchar* _tmp11_;
	GVariant* _tmp12_;
	GtkImage* _tmp13_ = NULL;
	gchar* _tmp14_;
	GtkCheckButton* _tmp15_ = NULL;
	GtkCheckButton* _tmp16_;
	GtkCheckButton* cursor_size_32 = NULL;
	gchar* _tmp17_;
	GVariant* _tmp18_;
	GtkImage* _tmp19_ = NULL;
	gchar* _tmp20_;
	GtkCheckButton* _tmp21_ = NULL;
	GtkCheckButton* _tmp22_;
	GtkCheckButton* cursor_size_48 = NULL;
	gchar* _tmp23_;
	GVariant* _tmp24_;
	GtkImage* _tmp25_ = NULL;
	gchar* _tmp26_;
	GtkCheckButton* _tmp27_ = NULL;
	GtkCheckButton* _tmp28_;
	GraniteBox* cursor_size_box = NULL;
	GraniteBox* _tmp29_;
	GraniteBox* _tmp30_;
	GtkCheckButton* _tmp31_;
	GraniteBox* _tmp32_;
	GtkCheckButton* _tmp33_;
	GraniteBox* _tmp34_;
	GtkCheckButton* _tmp35_;
	GraniteHeaderLabel* cursor_size_header = NULL;
	GraniteBox* _tmp36_;
	GtkWidget* _tmp37_;
	GraniteHeaderLabel* _tmp38_ = NULL;
	GtkSwitch* reveal_pointer_switch = NULL;
	GtkSwitch* _tmp39_ = NULL;
	GraniteHeaderLabel* reveal_pointer_label = NULL;
	GtkSwitch* _tmp40_;
	GtkWidget* _tmp41_;
	gchar* _tmp42_;
	GraniteHeaderLabel* _tmp43_ = NULL;
	GtkGrid* content_area = NULL;
	GtkGrid* _tmp44_ = NULL;
	GtkGrid* _tmp45_;
	GraniteHeaderLabel* _tmp46_;
	GtkGrid* _tmp47_;
	GraniteBox* _tmp48_;
	GtkGrid* _tmp49_;
	GraniteHeaderLabel* _tmp50_;
	GtkGrid* _tmp51_;
	GtkSwitch* _tmp52_;
	GtkGrid* _tmp53_;
	GraniteHeaderLabel* _tmp54_;
	GtkGrid* _tmp55_;
	GtkSwitch* _tmp56_;
	GtkGrid* _tmp57_;
	GtkScale* _tmp58_;
	GtkGrid* _tmp59_;
	GSettings* a11y_keyboard_settings = NULL;
	GSettings* _tmp60_;
	GSettings* _tmp61_;
	GtkSwitch* _tmp62_;
	GSettings* _tmp63_;
	GtkAdjustment* _tmp64_;
	GSettings* _tmp65_;
	GtkScale* _tmp66_;
	GSettings* interface_settings = NULL;
	GSettings* _tmp67_;
	GSettings* _tmp68_;
	GtkSwitch* _tmp69_;
	GSimpleActionGroup* action_group = NULL;
	GSimpleActionGroup* _tmp70_;
	GSimpleActionGroup* _tmp71_;
	GSettings* _tmp72_;
	GAction* _tmp73_;
	GAction* _tmp74_;
	GSimpleActionGroup* _tmp75_;
	parent_class = G_OBJECT_CLASS (mouse_touchpad_pointing_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MOUSE_TOUCHPAD_TYPE_POINTING_VIEW, MouseTouchpadPointingView);
	switchboard_settings_page_set_show_end_title_buttons ((SwitchboardSettingsPage*) self, TRUE);
	_tmp0_ = (GtkSwitch*) gtk_switch_new ();
	gtk_widget_set_halign ((GtkWidget*) _tmp0_, GTK_ALIGN_END);
	gtk_widget_set_valign ((GtkWidget*) _tmp0_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp0_);
	keypad_pointer_switch = _tmp0_;
	_tmp1_ = g_strdup (_ ("This disables both levels of keys on the numeric keypad"));
	_tmp2_ = keypad_pointer_switch;
	_tmp3_ = _g_object_ref0 ((GtkWidget*) _tmp2_);
	_tmp4_ = granite_header_label_new (_ ("Control Pointer Using Keypad"));
	granite_header_label_set_secondary_text (_tmp4_, _tmp1_);
	_g_free0 (_tmp1_);
	granite_header_label_set_mnemonic_widget (_tmp4_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	g_object_ref_sink (_tmp4_);
	keypad_pointer_header = _tmp4_;
	_tmp5_ = gtk_adjustment_new ((gdouble) 0, (gdouble) 0, (gdouble) 1000, (gdouble) 10, (gdouble) 10, (gdouble) 10);
	g_object_ref_sink (_tmp5_);
	keypad_pointer_adjustment = _tmp5_;
	_tmp6_ = keypad_pointer_adjustment;
	_tmp7_ = (GtkScale*) gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, _tmp6_);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp7_, TRUE);
	g_object_ref_sink (_tmp7_);
	pointer_speed_scale = _tmp7_;
	_tmp8_ = pointer_speed_scale;
	gtk_scale_add_mark (_tmp8_, (gdouble) 0, GTK_POS_BOTTOM, _ ("Slower"));
	_tmp9_ = pointer_speed_scale;
	gtk_scale_add_mark (_tmp9_, (gdouble) 100, GTK_POS_BOTTOM, NULL);
	_tmp10_ = pointer_speed_scale;
	gtk_scale_add_mark (_tmp10_, (gdouble) 990, GTK_POS_BOTTOM, _ ("Faster"));
	_tmp11_ = g_strdup ("pointing.cursor-size");
	_tmp12_ = g_variant_new_int32 ((gint32) 24);
	g_variant_ref_sink (_tmp12_);
	_tmp13_ = (GtkImage*) gtk_image_new_from_icon_name ("mouse-touchpad-pointing-symbolic");
	gtk_image_set_pixel_size (_tmp13_, 24);
	g_object_ref_sink (_tmp13_);
	_tmp14_ = g_strdup (_ ("Small"));
	_tmp15_ = (GtkCheckButton*) gtk_check_button_new ();
	gtk_actionable_set_action_name ((GtkActionable*) _tmp15_, _tmp11_);
	_g_free0 (_tmp11_);
	g_object_set ((GtkActionable*) _tmp15_, "action-target", _tmp12_, NULL);
	_g_variant_unref0 (_tmp12_);
	gtk_check_button_set_child (_tmp15_, (GtkWidget*) _tmp13_);
	_g_object_unref0 (_tmp13_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp15_, _tmp14_);
	_g_free0 (_tmp14_);
	g_object_ref_sink (_tmp15_);
	cursor_size_24 = _tmp15_;
	_tmp16_ = cursor_size_24;
	gtk_widget_add_css_class ((GtkWidget*) _tmp16_, "image-button");
	_tmp17_ = g_strdup ("pointing.cursor-size");
	_tmp18_ = g_variant_new_int32 ((gint32) 32);
	g_variant_ref_sink (_tmp18_);
	_tmp19_ = (GtkImage*) gtk_image_new_from_icon_name ("mouse-touchpad-pointing-symbolic");
	gtk_image_set_pixel_size (_tmp19_, 32);
	g_object_ref_sink (_tmp19_);
	_tmp20_ = g_strdup (_ ("Medium"));
	_tmp21_ = (GtkCheckButton*) gtk_check_button_new ();
	gtk_actionable_set_action_name ((GtkActionable*) _tmp21_, _tmp17_);
	_g_free0 (_tmp17_);
	g_object_set ((GtkActionable*) _tmp21_, "action-target", _tmp18_, NULL);
	_g_variant_unref0 (_tmp18_);
	gtk_check_button_set_child (_tmp21_, (GtkWidget*) _tmp19_);
	_g_object_unref0 (_tmp19_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp21_, _tmp20_);
	_g_free0 (_tmp20_);
	g_object_ref_sink (_tmp21_);
	cursor_size_32 = _tmp21_;
	_tmp22_ = cursor_size_32;
	gtk_widget_add_css_class ((GtkWidget*) _tmp22_, "image-button");
	_tmp23_ = g_strdup ("pointing.cursor-size");
	_tmp24_ = g_variant_new_int32 ((gint32) 48);
	g_variant_ref_sink (_tmp24_);
	_tmp25_ = (GtkImage*) gtk_image_new_from_icon_name ("mouse-touchpad-pointing-symbolic");
	gtk_image_set_pixel_size (_tmp25_, 48);
	g_object_ref_sink (_tmp25_);
	_tmp26_ = g_strdup (_ ("Large"));
	_tmp27_ = (GtkCheckButton*) gtk_check_button_new ();
	gtk_actionable_set_action_name ((GtkActionable*) _tmp27_, _tmp23_);
	_g_free0 (_tmp23_);
	g_object_set ((GtkActionable*) _tmp27_, "action-target", _tmp24_, NULL);
	_g_variant_unref0 (_tmp24_);
	gtk_check_button_set_child (_tmp27_, (GtkWidget*) _tmp25_);
	_g_object_unref0 (_tmp25_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp27_, _tmp26_);
	_g_free0 (_tmp26_);
	g_object_ref_sink (_tmp27_);
	cursor_size_48 = _tmp27_;
	_tmp28_ = cursor_size_48;
	gtk_widget_add_css_class ((GtkWidget*) _tmp28_, "image-button");
	_tmp29_ = granite_box_new (GTK_ORIENTATION_HORIZONTAL, GRANITE_BOX_SPACING_DOUBLE);
	g_object_ref_sink (_tmp29_);
	cursor_size_box = _tmp29_;
	_tmp30_ = cursor_size_box;
	_tmp31_ = cursor_size_24;
	gtk_box_append ((GtkBox*) _tmp30_, (GtkWidget*) _tmp31_);
	_tmp32_ = cursor_size_box;
	_tmp33_ = cursor_size_32;
	gtk_box_append ((GtkBox*) _tmp32_, (GtkWidget*) _tmp33_);
	_tmp34_ = cursor_size_box;
	_tmp35_ = cursor_size_48;
	gtk_box_append ((GtkBox*) _tmp34_, (GtkWidget*) _tmp35_);
	_tmp36_ = cursor_size_box;
	_tmp37_ = _g_object_ref0 ((GtkWidget*) _tmp36_);
	_tmp38_ = granite_header_label_new (_ ("Pointer Size"));
	granite_header_label_set_mnemonic_widget (_tmp38_, _tmp37_);
	_g_object_unref0 (_tmp37_);
	g_object_ref_sink (_tmp38_);
	cursor_size_header = _tmp38_;
	_tmp39_ = (GtkSwitch*) gtk_switch_new ();
	gtk_widget_set_halign ((GtkWidget*) _tmp39_, GTK_ALIGN_END);
	gtk_widget_set_valign ((GtkWidget*) _tmp39_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp39_);
	reveal_pointer_switch = _tmp39_;
	_tmp40_ = reveal_pointer_switch;
	_tmp41_ = _g_object_ref0 ((GtkWidget*) _tmp40_);
	_tmp42_ = g_strdup (_ ("Pressing the control key will highlight the position of the pointer"));
	_tmp43_ = granite_header_label_new (_ ("Reveal Pointer"));
	granite_header_label_set_mnemonic_widget (_tmp43_, _tmp41_);
	_g_object_unref0 (_tmp41_);
	granite_header_label_set_secondary_text (_tmp43_, _tmp42_);
	_g_free0 (_tmp42_);
	g_object_ref_sink (_tmp43_);
	reveal_pointer_label = _tmp43_;
	_tmp44_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_row_spacing (_tmp44_, 6);
	g_object_ref_sink (_tmp44_);
	content_area = _tmp44_;
	_tmp45_ = content_area;
	_tmp46_ = cursor_size_header;
	gtk_grid_attach (_tmp45_, (GtkWidget*) _tmp46_, 0, 0, 1, 1);
	_tmp47_ = content_area;
	_tmp48_ = cursor_size_box;
	gtk_grid_attach (_tmp47_, (GtkWidget*) _tmp48_, 0, 1, 1, 1);
	_tmp49_ = content_area;
	_tmp50_ = reveal_pointer_label;
	gtk_grid_attach (_tmp49_, (GtkWidget*) _tmp50_, 0, 2, 1, 1);
	_tmp51_ = content_area;
	_tmp52_ = reveal_pointer_switch;
	gtk_grid_attach (_tmp51_, (GtkWidget*) _tmp52_, 1, 2, 1, 1);
	_tmp53_ = content_area;
	_tmp54_ = keypad_pointer_header;
	gtk_grid_attach (_tmp53_, (GtkWidget*) _tmp54_, 0, 3, 1, 1);
	_tmp55_ = content_area;
	_tmp56_ = keypad_pointer_switch;
	gtk_grid_attach (_tmp55_, (GtkWidget*) _tmp56_, 1, 3, 1, 1);
	_tmp57_ = content_area;
	_tmp58_ = pointer_speed_scale;
	gtk_grid_attach (_tmp57_, (GtkWidget*) _tmp58_, 0, 4, 2, 1);
	_tmp59_ = content_area;
	switchboard_settings_page_set_child ((SwitchboardSettingsPage*) self, (GtkWidget*) _tmp59_);
	_tmp60_ = g_settings_new ("org.gnome.desktop.a11y.keyboard");
	a11y_keyboard_settings = _tmp60_;
	_tmp61_ = a11y_keyboard_settings;
	_tmp62_ = keypad_pointer_switch;
	g_settings_bind (_tmp61_, "mousekeys-enable", (GObject*) _tmp62_, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp63_ = a11y_keyboard_settings;
	_tmp64_ = keypad_pointer_adjustment;
	g_settings_bind (_tmp63_, "mousekeys-max-speed", (GObject*) _tmp64_, "value", G_SETTINGS_BIND_DEFAULT);
	_tmp65_ = a11y_keyboard_settings;
	_tmp66_ = pointer_speed_scale;
	g_settings_bind (_tmp65_, "mousekeys-enable", (GObject*) _tmp66_, "sensitive", G_SETTINGS_BIND_GET);
	_tmp67_ = g_settings_new ("org.gnome.desktop.interface");
	interface_settings = _tmp67_;
	_tmp68_ = interface_settings;
	_tmp69_ = reveal_pointer_switch;
	g_settings_bind (_tmp68_, "locate-pointer", (GObject*) _tmp69_, "active", G_SETTINGS_BIND_DEFAULT);
	_tmp70_ = g_simple_action_group_new ();
	action_group = _tmp70_;
	_tmp71_ = action_group;
	_tmp72_ = interface_settings;
	_tmp73_ = g_settings_create_action (_tmp72_, "cursor-size");
	_tmp74_ = _tmp73_;
	g_action_map_add_action ((GActionMap*) _tmp71_, _tmp74_);
	_g_object_unref0 (_tmp74_);
	_tmp75_ = action_group;
	gtk_widget_insert_action_group ((GtkWidget*) self, "pointing", (GActionGroup*) _tmp75_);
	_g_object_unref0 (action_group);
	_g_object_unref0 (interface_settings);
	_g_object_unref0 (a11y_keyboard_settings);
	_g_object_unref0 (content_area);
	_g_object_unref0 (reveal_pointer_label);
	_g_object_unref0 (reveal_pointer_switch);
	_g_object_unref0 (cursor_size_header);
	_g_object_unref0 (cursor_size_box);
	_g_object_unref0 (cursor_size_48);
	_g_object_unref0 (cursor_size_32);
	_g_object_unref0 (cursor_size_24);
	_g_object_unref0 (pointer_speed_scale);
	_g_object_unref0 (keypad_pointer_adjustment);
	_g_object_unref0 (keypad_pointer_header);
	_g_object_unref0 (keypad_pointer_switch);
	return obj;
}

static void
mouse_touchpad_pointing_view_class_init (MouseTouchpadPointingViewClass * klass,
                                         gpointer klass_data)
{
	mouse_touchpad_pointing_view_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = mouse_touchpad_pointing_view_constructor;
}

static void
mouse_touchpad_pointing_view_instance_init (MouseTouchpadPointingView * self,
                                            gpointer klass)
{
}

static GType
mouse_touchpad_pointing_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MouseTouchpadPointingViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) mouse_touchpad_pointing_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MouseTouchpadPointingView), 0, (GInstanceInitFunc) mouse_touchpad_pointing_view_instance_init, NULL };
	GType mouse_touchpad_pointing_view_type_id;
	mouse_touchpad_pointing_view_type_id = g_type_register_static (SWITCHBOARD_TYPE_SETTINGS_PAGE, "MouseTouchpadPointingView", &g_define_type_info, 0);
	return mouse_touchpad_pointing_view_type_id;
}

GType
mouse_touchpad_pointing_view_get_type (void)
{
	static volatile gsize mouse_touchpad_pointing_view_type_id__once = 0;
	if (g_once_init_enter (&mouse_touchpad_pointing_view_type_id__once)) {
		GType mouse_touchpad_pointing_view_type_id;
		mouse_touchpad_pointing_view_type_id = mouse_touchpad_pointing_view_get_type_once ();
		g_once_init_leave (&mouse_touchpad_pointing_view_type_id__once, mouse_touchpad_pointing_view_type_id);
	}
	return mouse_touchpad_pointing_view_type_id__once;
}

