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

/*-
 * Copyright (c) 2015 Wingpanel Developers (http://launchpad.net/wingpanel)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Library General Public License as published by
 * the Free Software Foundation, either version 2.1 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 Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
/* Cannot subclass Gtk.ModelButton so put it in a Bin*/

#include "keyboard.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.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_WIDGETS_LAYOUT_BUTTON_0_PROPERTY,
	KEYBOARD_WIDGETS_LAYOUT_BUTTON_INDEX_PROPERTY,
	KEYBOARD_WIDGETS_LAYOUT_BUTTON_LANGUAGE_CODE_PROPERTY,
	KEYBOARD_WIDGETS_LAYOUT_BUTTON_LAYOUT_VARIANT_PROPERTY,
	KEYBOARD_WIDGETS_LAYOUT_BUTTON_MANAGER_TYPE_PROPERTY,
	KEYBOARD_WIDGETS_LAYOUT_BUTTON_SOURCE_PROPERTY,
	KEYBOARD_WIDGETS_LAYOUT_BUTTON_DESCRIPTION_PROPERTY,
	KEYBOARD_WIDGETS_LAYOUT_BUTTON_ACTIVE_PROPERTY,
	KEYBOARD_WIDGETS_LAYOUT_BUTTON_NUM_PROPERTIES
};
static GParamSpec* keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_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)))

struct _KeyboardWidgetsLayoutButtonPrivate {
	GtkModelButton* button;
	guint32 _index;
	gchar* _language_code;
	gchar* _layout_variant;
	gchar* _manager_type;
	gchar* _source;
};

static gint KeyboardWidgetsLayoutButton_private_offset;
static gpointer keyboard_widgets_layout_button_parent_class = NULL;

static void keyboard_widgets_layout_button_finalize (GObject * obj);
static GType keyboard_widgets_layout_button_get_type_once (void);
static void _vala_keyboard_widgets_layout_button_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec);
static void _vala_keyboard_widgets_layout_button_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec);

static inline gpointer
keyboard_widgets_layout_button_get_instance_private (KeyboardWidgetsLayoutButton* self)
{
	return G_STRUCT_MEMBER_P (self, KeyboardWidgetsLayoutButton_private_offset);
}

static gpointer
_g_variant_ref0 (gpointer self)
{
	return self ? g_variant_ref (self) : NULL;
}

KeyboardWidgetsLayoutButton*
keyboard_widgets_layout_button_construct (GType object_type,
                                          const gchar* caption,
                                          const gchar* manager_type,
                                          const gchar* source,
                                          const gchar* code,
                                          const gchar* variant,
                                          guint32 id,
                                          const gchar* _action_name,
                                          GVariant* _action_target)
{
	KeyboardWidgetsLayoutButton * self = NULL;
	gchar* _tmp0_;
	GVariant* _tmp1_;
	gchar* _tmp2_;
	GtkModelButton* _tmp3_ = NULL;
	GtkModelButton* _tmp4_;
	g_return_val_if_fail (caption != NULL, NULL);
	g_return_val_if_fail (manager_type != NULL, NULL);
	g_return_val_if_fail (source != NULL, NULL);
	g_return_val_if_fail (code != NULL, NULL);
	g_return_val_if_fail (_action_name != NULL, NULL);
	g_return_val_if_fail (_action_target != NULL, NULL);
	self = (KeyboardWidgetsLayoutButton*) g_object_new (object_type, "index", id, "language-code", code, "layout-variant", variant, "manager-type", manager_type, "source", source, NULL);
	_tmp0_ = g_strdup (_action_name);
	_tmp1_ = _g_variant_ref0 (_action_target);
	_tmp2_ = g_strdup (caption);
	_tmp3_ = (GtkModelButton*) gtk_model_button_new ();
	gtk_actionable_set_action_name ((GtkActionable*) _tmp3_, _tmp0_);
	_g_free0 (_tmp0_);
	g_object_set ((GtkActionable*) _tmp3_, "action-target", _tmp1_, NULL);
	_g_variant_unref0 (_tmp1_);
	g_object_set (_tmp3_, "text", _tmp2_, NULL);
	_g_free0 (_tmp2_);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->button);
	self->priv->button = _tmp3_;
	gtk_widget_set_hexpand ((GtkWidget*) self, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) self, TRUE);
	_tmp4_ = self->priv->button;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp4_);
	gtk_widget_show_all ((GtkWidget*) self);
	return self;
}

KeyboardWidgetsLayoutButton*
keyboard_widgets_layout_button_new (const gchar* caption,
                                    const gchar* manager_type,
                                    const gchar* source,
                                    const gchar* code,
                                    const gchar* variant,
                                    guint32 id,
                                    const gchar* _action_name,
                                    GVariant* _action_target)
{
	return keyboard_widgets_layout_button_construct (KEYBOARD_WIDGETS_TYPE_LAYOUT_BUTTON, caption, manager_type, source, code, variant, id, _action_name, _action_target);
}

guint32
keyboard_widgets_layout_button_get_index (KeyboardWidgetsLayoutButton* self)
{
	guint32 result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_index;
	return result;
}

void
keyboard_widgets_layout_button_set_index (KeyboardWidgetsLayoutButton* self,
                                          guint32 value)
{
	guint32 old_value;
	g_return_if_fail (self != NULL);
	old_value = keyboard_widgets_layout_button_get_index (self);
	if (old_value != value) {
		self->priv->_index = value;
		g_object_notify_by_pspec ((GObject *) self, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_INDEX_PROPERTY]);
	}
}

const gchar*
keyboard_widgets_layout_button_get_language_code (KeyboardWidgetsLayoutButton* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_language_code;
	result = _tmp0_;
	return result;
}

void
keyboard_widgets_layout_button_set_language_code (KeyboardWidgetsLayoutButton* self,
                                                  const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = keyboard_widgets_layout_button_get_language_code (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_language_code);
		self->priv->_language_code = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_LANGUAGE_CODE_PROPERTY]);
	}
}

const gchar*
keyboard_widgets_layout_button_get_layout_variant (KeyboardWidgetsLayoutButton* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_layout_variant;
	result = _tmp0_;
	return result;
}

void
keyboard_widgets_layout_button_set_layout_variant (KeyboardWidgetsLayoutButton* self,
                                                   const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = keyboard_widgets_layout_button_get_layout_variant (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_layout_variant);
		self->priv->_layout_variant = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_LAYOUT_VARIANT_PROPERTY]);
	}
}

const gchar*
keyboard_widgets_layout_button_get_manager_type (KeyboardWidgetsLayoutButton* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_manager_type;
	result = _tmp0_;
	return result;
}

void
keyboard_widgets_layout_button_set_manager_type (KeyboardWidgetsLayoutButton* self,
                                                 const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = keyboard_widgets_layout_button_get_manager_type (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_manager_type);
		self->priv->_manager_type = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_MANAGER_TYPE_PROPERTY]);
	}
}

const gchar*
keyboard_widgets_layout_button_get_source (KeyboardWidgetsLayoutButton* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_source;
	result = _tmp0_;
	return result;
}

void
keyboard_widgets_layout_button_set_source (KeyboardWidgetsLayoutButton* self,
                                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = keyboard_widgets_layout_button_get_source (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_source);
		self->priv->_source = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_SOURCE_PROPERTY]);
	}
}

gchar*
keyboard_widgets_layout_button_get_description (KeyboardWidgetsLayoutButton* self)
{
	gchar* result;
	GtkModelButton* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->button;
	g_object_get (_tmp0_, "text", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

gboolean
keyboard_widgets_layout_button_get_active (KeyboardWidgetsLayoutButton* self)
{
	gboolean result;
	GtkModelButton* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->button;
	g_object_get (_tmp0_, "active", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
keyboard_widgets_layout_button_set_active (KeyboardWidgetsLayoutButton* self,
                                           gboolean value)
{
	GtkModelButton* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->button;
	g_object_set (_tmp0_, "active", value, NULL);
	g_object_notify_by_pspec ((GObject *) self, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_ACTIVE_PROPERTY]);
}

static void
keyboard_widgets_layout_button_class_init (KeyboardWidgetsLayoutButtonClass * klass,
                                           gpointer klass_data)
{
	keyboard_widgets_layout_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &KeyboardWidgetsLayoutButton_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_keyboard_widgets_layout_button_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_keyboard_widgets_layout_button_set_property;
	G_OBJECT_CLASS (klass)->finalize = keyboard_widgets_layout_button_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), KEYBOARD_WIDGETS_LAYOUT_BUTTON_INDEX_PROPERTY, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_INDEX_PROPERTY] = g_param_spec_uint ("index", "index", "index", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), KEYBOARD_WIDGETS_LAYOUT_BUTTON_LANGUAGE_CODE_PROPERTY, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_LANGUAGE_CODE_PROPERTY] = g_param_spec_string ("language-code", "language-code", "language-code", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), KEYBOARD_WIDGETS_LAYOUT_BUTTON_LAYOUT_VARIANT_PROPERTY, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_LAYOUT_VARIANT_PROPERTY] = g_param_spec_string ("layout-variant", "layout-variant", "layout-variant", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), KEYBOARD_WIDGETS_LAYOUT_BUTTON_MANAGER_TYPE_PROPERTY, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_MANAGER_TYPE_PROPERTY] = g_param_spec_string ("manager-type", "manager-type", "manager-type", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), KEYBOARD_WIDGETS_LAYOUT_BUTTON_SOURCE_PROPERTY, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_SOURCE_PROPERTY] = g_param_spec_string ("source", "source", "source", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), KEYBOARD_WIDGETS_LAYOUT_BUTTON_DESCRIPTION_PROPERTY, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_DESCRIPTION_PROPERTY] = g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), KEYBOARD_WIDGETS_LAYOUT_BUTTON_ACTIVE_PROPERTY, keyboard_widgets_layout_button_properties[KEYBOARD_WIDGETS_LAYOUT_BUTTON_ACTIVE_PROPERTY] = g_param_spec_boolean ("active", "active", "active", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
keyboard_widgets_layout_button_instance_init (KeyboardWidgetsLayoutButton * self,
                                              gpointer klass)
{
	self->priv = keyboard_widgets_layout_button_get_instance_private (self);
}

static void
keyboard_widgets_layout_button_finalize (GObject * obj)
{
	KeyboardWidgetsLayoutButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, KEYBOARD_WIDGETS_TYPE_LAYOUT_BUTTON, KeyboardWidgetsLayoutButton);
	_g_object_unref0 (self->priv->button);
	_g_free0 (self->priv->_language_code);
	_g_free0 (self->priv->_layout_variant);
	_g_free0 (self->priv->_manager_type);
	_g_free0 (self->priv->_source);
	G_OBJECT_CLASS (keyboard_widgets_layout_button_parent_class)->finalize (obj);
}

static GType
keyboard_widgets_layout_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (KeyboardWidgetsLayoutButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) keyboard_widgets_layout_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (KeyboardWidgetsLayoutButton), 0, (GInstanceInitFunc) keyboard_widgets_layout_button_instance_init, NULL };
	GType keyboard_widgets_layout_button_type_id;
	keyboard_widgets_layout_button_type_id = g_type_register_static (gtk_bin_get_type (), "KeyboardWidgetsLayoutButton", &g_define_type_info, 0);
	KeyboardWidgetsLayoutButton_private_offset = g_type_add_instance_private (keyboard_widgets_layout_button_type_id, sizeof (KeyboardWidgetsLayoutButtonPrivate));
	return keyboard_widgets_layout_button_type_id;
}

GType
keyboard_widgets_layout_button_get_type (void)
{
	static volatile gsize keyboard_widgets_layout_button_type_id__once = 0;
	if (g_once_init_enter (&keyboard_widgets_layout_button_type_id__once)) {
		GType keyboard_widgets_layout_button_type_id;
		keyboard_widgets_layout_button_type_id = keyboard_widgets_layout_button_get_type_once ();
		g_once_init_leave (&keyboard_widgets_layout_button_type_id__once, keyboard_widgets_layout_button_type_id);
	}
	return keyboard_widgets_layout_button_type_id__once;
}

static void
_vala_keyboard_widgets_layout_button_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec)
{
	KeyboardWidgetsLayoutButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, KEYBOARD_WIDGETS_TYPE_LAYOUT_BUTTON, KeyboardWidgetsLayoutButton);
	switch (property_id) {
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_INDEX_PROPERTY:
		g_value_set_uint (value, keyboard_widgets_layout_button_get_index (self));
		break;
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_LANGUAGE_CODE_PROPERTY:
		g_value_set_string (value, keyboard_widgets_layout_button_get_language_code (self));
		break;
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_LAYOUT_VARIANT_PROPERTY:
		g_value_set_string (value, keyboard_widgets_layout_button_get_layout_variant (self));
		break;
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_MANAGER_TYPE_PROPERTY:
		g_value_set_string (value, keyboard_widgets_layout_button_get_manager_type (self));
		break;
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_SOURCE_PROPERTY:
		g_value_set_string (value, keyboard_widgets_layout_button_get_source (self));
		break;
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_DESCRIPTION_PROPERTY:
		g_value_take_string (value, keyboard_widgets_layout_button_get_description (self));
		break;
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_ACTIVE_PROPERTY:
		g_value_set_boolean (value, keyboard_widgets_layout_button_get_active (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_keyboard_widgets_layout_button_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec)
{
	KeyboardWidgetsLayoutButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, KEYBOARD_WIDGETS_TYPE_LAYOUT_BUTTON, KeyboardWidgetsLayoutButton);
	switch (property_id) {
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_INDEX_PROPERTY:
		keyboard_widgets_layout_button_set_index (self, g_value_get_uint (value));
		break;
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_LANGUAGE_CODE_PROPERTY:
		keyboard_widgets_layout_button_set_language_code (self, g_value_get_string (value));
		break;
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_LAYOUT_VARIANT_PROPERTY:
		keyboard_widgets_layout_button_set_layout_variant (self, g_value_get_string (value));
		break;
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_MANAGER_TYPE_PROPERTY:
		keyboard_widgets_layout_button_set_manager_type (self, g_value_get_string (value));
		break;
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_SOURCE_PROPERTY:
		keyboard_widgets_layout_button_set_source (self, g_value_get_string (value));
		break;
		case KEYBOARD_WIDGETS_LAYOUT_BUTTON_ACTIVE_PROPERTY:
		keyboard_widgets_layout_button_set_active (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

