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

/*
* 2019-2020 elementary, Inc. (https://elementary.io)
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

#include "keyboard.h"
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.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  {
	KEYBOARD_INPUT_METHOD_PAGE_LANGUAGES_ROW_0_PROPERTY,
	KEYBOARD_INPUT_METHOD_PAGE_LANGUAGES_ROW_LANGUAGE_PROPERTY,
	KEYBOARD_INPUT_METHOD_PAGE_LANGUAGES_ROW_NUM_PROPERTIES
};
static GParamSpec* keyboard_input_method_page_languages_row_properties[KEYBOARD_INPUT_METHOD_PAGE_LANGUAGES_ROW_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _KeyboardInputMethodPageLanguagesRowPrivate {
	KeyboardInputMethodPageInstallList _language;
};

static gint KeyboardInputMethodPageLanguagesRow_private_offset;
static gpointer keyboard_input_method_page_languages_row_parent_class = NULL;

static GObject * keyboard_input_method_page_languages_row_constructor (GType type,
                                                                guint n_construct_properties,
                                                                GObjectConstructParam * construct_properties);
static void keyboard_input_method_page_languages_row_finalize (GObject * obj);
static GType keyboard_input_method_page_languages_row_get_type_once (void);
static void _vala_keyboard_input_method_page_languages_row_get_property (GObject * object,
                                                                  guint property_id,
                                                                  GValue * value,
                                                                  GParamSpec * pspec);
static void _vala_keyboard_input_method_page_languages_row_set_property (GObject * object,
                                                                  guint property_id,
                                                                  const GValue * value,
                                                                  GParamSpec * pspec);

static inline gpointer
keyboard_input_method_page_languages_row_get_instance_private (KeyboardInputMethodPageLanguagesRow* self)
{
	return G_STRUCT_MEMBER_P (self, KeyboardInputMethodPageLanguagesRow_private_offset);
}

KeyboardInputMethodPageLanguagesRow*
keyboard_input_method_page_languages_row_construct (GType object_type,
                                                    KeyboardInputMethodPageInstallList language)
{
	KeyboardInputMethodPageLanguagesRow * self = NULL;
	self = (KeyboardInputMethodPageLanguagesRow*) g_object_new (object_type, "language", language, NULL);
	return self;
}

KeyboardInputMethodPageLanguagesRow*
keyboard_input_method_page_languages_row_new (KeyboardInputMethodPageInstallList language)
{
	return keyboard_input_method_page_languages_row_construct (KEYBOARD_INPUT_METHOD_PAGE_TYPE_LANGUAGES_ROW, language);
}

KeyboardInputMethodPageInstallList
keyboard_input_method_page_languages_row_get_language (KeyboardInputMethodPageLanguagesRow* self)
{
	KeyboardInputMethodPageInstallList result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_language;
	return result;
}

static void
keyboard_input_method_page_languages_row_set_language (KeyboardInputMethodPageLanguagesRow* self,
                                                       KeyboardInputMethodPageInstallList value)
{
	KeyboardInputMethodPageInstallList old_value;
	g_return_if_fail (self != NULL);
	old_value = keyboard_input_method_page_languages_row_get_language (self);
	if (old_value != value) {
		self->priv->_language = value;
		g_object_notify_by_pspec ((GObject *) self, keyboard_input_method_page_languages_row_properties[KEYBOARD_INPUT_METHOD_PAGE_LANGUAGES_ROW_LANGUAGE_PROPERTY]);
	}
}

static GObject *
keyboard_input_method_page_languages_row_constructor (GType type,
                                                      guint n_construct_properties,
                                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	KeyboardInputMethodPageLanguagesRow * self;
	GtkLabel* label = NULL;
	KeyboardInputMethodPageInstallList _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GtkLabel* _tmp3_ = NULL;
	GtkLabel* _tmp4_;
	GtkImage* caret = NULL;
	GtkImage* _tmp5_;
	GtkBox* box = NULL;
	GtkBox* _tmp6_ = NULL;
	GtkBox* _tmp7_;
	GtkLabel* _tmp8_;
	GtkBox* _tmp9_;
	GtkImage* _tmp10_;
	GtkBox* _tmp11_;
	parent_class = G_OBJECT_CLASS (keyboard_input_method_page_languages_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, KEYBOARD_INPUT_METHOD_PAGE_TYPE_LANGUAGES_ROW, KeyboardInputMethodPageLanguagesRow);
	_tmp0_ = self->priv->_language;
	_tmp1_ = keyboard_input_method_page_install_list_get_name (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = (GtkLabel*) gtk_label_new (_tmp2_);
	gtk_widget_set_halign ((GtkWidget*) _tmp3_, GTK_ALIGN_START);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp3_, TRUE);
	g_object_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp2_);
	label = _tmp4_;
	_tmp5_ = (GtkImage*) gtk_image_new_from_icon_name ("pan-end-symbolic");
	g_object_ref_sink (_tmp5_);
	caret = _tmp5_;
	_tmp6_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp6_, 3);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp6_, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp6_, 3);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp6_, 6);
	g_object_ref_sink (_tmp6_);
	box = _tmp6_;
	_tmp7_ = box;
	_tmp8_ = label;
	gtk_box_append (_tmp7_, (GtkWidget*) _tmp8_);
	_tmp9_ = box;
	_tmp10_ = caret;
	gtk_box_append (_tmp9_, (GtkWidget*) _tmp10_);
	_tmp11_ = box;
	gtk_list_box_row_set_child ((GtkListBoxRow*) self, (GtkWidget*) _tmp11_);
	_g_object_unref0 (box);
	_g_object_unref0 (caret);
	_g_object_unref0 (label);
	return obj;
}

static void
keyboard_input_method_page_languages_row_class_init (KeyboardInputMethodPageLanguagesRowClass * klass,
                                                     gpointer klass_data)
{
	keyboard_input_method_page_languages_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &KeyboardInputMethodPageLanguagesRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_keyboard_input_method_page_languages_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_keyboard_input_method_page_languages_row_set_property;
	G_OBJECT_CLASS (klass)->constructor = keyboard_input_method_page_languages_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = keyboard_input_method_page_languages_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), KEYBOARD_INPUT_METHOD_PAGE_LANGUAGES_ROW_LANGUAGE_PROPERTY, keyboard_input_method_page_languages_row_properties[KEYBOARD_INPUT_METHOD_PAGE_LANGUAGES_ROW_LANGUAGE_PROPERTY] = g_param_spec_enum ("language", "language", "language", KEYBOARD_INPUT_METHOD_PAGE_TYPE_INSTALL_LIST, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
keyboard_input_method_page_languages_row_instance_init (KeyboardInputMethodPageLanguagesRow * self,
                                                        gpointer klass)
{
	self->priv = keyboard_input_method_page_languages_row_get_instance_private (self);
}

static void
keyboard_input_method_page_languages_row_finalize (GObject * obj)
{
	KeyboardInputMethodPageLanguagesRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, KEYBOARD_INPUT_METHOD_PAGE_TYPE_LANGUAGES_ROW, KeyboardInputMethodPageLanguagesRow);
	G_OBJECT_CLASS (keyboard_input_method_page_languages_row_parent_class)->finalize (obj);
}

static GType
keyboard_input_method_page_languages_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (KeyboardInputMethodPageLanguagesRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) keyboard_input_method_page_languages_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (KeyboardInputMethodPageLanguagesRow), 0, (GInstanceInitFunc) keyboard_input_method_page_languages_row_instance_init, NULL };
	GType keyboard_input_method_page_languages_row_type_id;
	keyboard_input_method_page_languages_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "KeyboardInputMethodPageLanguagesRow", &g_define_type_info, 0);
	KeyboardInputMethodPageLanguagesRow_private_offset = g_type_add_instance_private (keyboard_input_method_page_languages_row_type_id, sizeof (KeyboardInputMethodPageLanguagesRowPrivate));
	return keyboard_input_method_page_languages_row_type_id;
}

GType
keyboard_input_method_page_languages_row_get_type (void)
{
	static volatile gsize keyboard_input_method_page_languages_row_type_id__once = 0;
	if (g_once_init_enter (&keyboard_input_method_page_languages_row_type_id__once)) {
		GType keyboard_input_method_page_languages_row_type_id;
		keyboard_input_method_page_languages_row_type_id = keyboard_input_method_page_languages_row_get_type_once ();
		g_once_init_leave (&keyboard_input_method_page_languages_row_type_id__once, keyboard_input_method_page_languages_row_type_id);
	}
	return keyboard_input_method_page_languages_row_type_id__once;
}

static void
_vala_keyboard_input_method_page_languages_row_get_property (GObject * object,
                                                             guint property_id,
                                                             GValue * value,
                                                             GParamSpec * pspec)
{
	KeyboardInputMethodPageLanguagesRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, KEYBOARD_INPUT_METHOD_PAGE_TYPE_LANGUAGES_ROW, KeyboardInputMethodPageLanguagesRow);
	switch (property_id) {
		case KEYBOARD_INPUT_METHOD_PAGE_LANGUAGES_ROW_LANGUAGE_PROPERTY:
		g_value_set_enum (value, keyboard_input_method_page_languages_row_get_language (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_keyboard_input_method_page_languages_row_set_property (GObject * object,
                                                             guint property_id,
                                                             const GValue * value,
                                                             GParamSpec * pspec)
{
	KeyboardInputMethodPageLanguagesRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, KEYBOARD_INPUT_METHOD_PAGE_TYPE_LANGUAGES_ROW, KeyboardInputMethodPageLanguagesRow);
	switch (property_id) {
		case KEYBOARD_INPUT_METHOD_PAGE_LANGUAGES_ROW_LANGUAGE_PROPERTY:
		keyboard_input_method_page_languages_row_set_language (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

