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

/*
 *  pamac-vala
 *
 *  Copyright (C) 2022 Guillaume Benoit <guillaume@manjaro.org>
 *
 *  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 get of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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 PAMAC_TYPE_SIMPLE_ROW (pamac_simple_row_get_type ())
#define PAMAC_SIMPLE_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PAMAC_TYPE_SIMPLE_ROW, PamacSimpleRow))
#define PAMAC_SIMPLE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PAMAC_TYPE_SIMPLE_ROW, PamacSimpleRowClass))
#define PAMAC_IS_SIMPLE_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PAMAC_TYPE_SIMPLE_ROW))
#define PAMAC_IS_SIMPLE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PAMAC_TYPE_SIMPLE_ROW))
#define PAMAC_SIMPLE_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAMAC_TYPE_SIMPLE_ROW, PamacSimpleRowClass))

typedef struct _PamacSimpleRow PamacSimpleRow;
typedef struct _PamacSimpleRowClass PamacSimpleRowClass;
typedef struct _PamacSimpleRowPrivate PamacSimpleRowPrivate;
enum  {
	PAMAC_SIMPLE_ROW_0_PROPERTY,
	PAMAC_SIMPLE_ROW_TITLE_PROPERTY,
	PAMAC_SIMPLE_ROW_NUM_PROPERTIES
};
static GParamSpec* pamac_simple_row_properties[PAMAC_SIMPLE_ROW_NUM_PROPERTIES];

struct _PamacSimpleRow {
	GtkListBoxRow parent_instance;
	PamacSimpleRowPrivate * priv;
	GtkLabel* label;
};

struct _PamacSimpleRowClass {
	GtkListBoxRowClass parent_class;
};

static gpointer pamac_simple_row_parent_class = NULL;

VALA_EXTERN GType pamac_simple_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PamacSimpleRow, g_object_unref)
VALA_EXTERN PamacSimpleRow* pamac_simple_row_new (const gchar* title);
VALA_EXTERN PamacSimpleRow* pamac_simple_row_construct (GType object_type,
                                            const gchar* title);
VALA_EXTERN const gchar* pamac_simple_row_get_title (PamacSimpleRow* self);
static void pamac_simple_row_finalize (GObject * obj);
static GType pamac_simple_row_get_type_once (void);
static void _vala_pamac_simple_row_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec);

PamacSimpleRow*
pamac_simple_row_construct (GType object_type,
                            const gchar* title)
{
	PamacSimpleRow * self = NULL;
	GtkLabel* _tmp0_;
	self = (PamacSimpleRow*) g_object_new (object_type, NULL);
	_tmp0_ = self->label;
	gtk_label_set_label (_tmp0_, title);
	return self;
}

PamacSimpleRow*
pamac_simple_row_new (const gchar* title)
{
	return pamac_simple_row_construct (PAMAC_TYPE_SIMPLE_ROW, title);
}

const gchar*
pamac_simple_row_get_title (PamacSimpleRow* self)
{
	const gchar* result;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->label;
	_tmp1_ = gtk_label_get_label (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static void
pamac_simple_row_class_init (PamacSimpleRowClass * klass,
                             gpointer klass_data)
{
	pamac_simple_row_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_pamac_simple_row_get_property;
	G_OBJECT_CLASS (klass)->finalize = pamac_simple_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PAMAC_SIMPLE_ROW_TITLE_PROPERTY, pamac_simple_row_properties[PAMAC_SIMPLE_ROW_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/manjaro/pamac/manager/simple_row.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "label", FALSE, G_STRUCT_OFFSET (PamacSimpleRow, label));
}

static void
pamac_simple_row_instance_init (PamacSimpleRow * self,
                                gpointer klass)
{
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
pamac_simple_row_finalize (GObject * obj)
{
	PamacSimpleRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PAMAC_TYPE_SIMPLE_ROW, PamacSimpleRow);
	G_OBJECT_CLASS (pamac_simple_row_parent_class)->finalize (obj);
}

static GType
pamac_simple_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PamacSimpleRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pamac_simple_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PamacSimpleRow), 0, (GInstanceInitFunc) pamac_simple_row_instance_init, NULL };
	GType pamac_simple_row_type_id;
	pamac_simple_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "PamacSimpleRow", &g_define_type_info, 0);
	return pamac_simple_row_type_id;
}

GType
pamac_simple_row_get_type (void)
{
	static volatile gsize pamac_simple_row_type_id__once = 0;
	if (g_once_init_enter (&pamac_simple_row_type_id__once)) {
		GType pamac_simple_row_type_id;
		pamac_simple_row_type_id = pamac_simple_row_get_type_once ();
		g_once_init_leave (&pamac_simple_row_type_id__once, pamac_simple_row_type_id);
	}
	return pamac_simple_row_type_id__once;
}

static void
_vala_pamac_simple_row_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec)
{
	PamacSimpleRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PAMAC_TYPE_SIMPLE_ROW, PamacSimpleRow);
	switch (property_id) {
		case PAMAC_SIMPLE_ROW_TITLE_PROPERTY:
		g_value_set_string (value, pamac_simple_row_get_title (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

