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

/*
 *  pamac-vala
 *
 *  Copyright (C) 2019-2023 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 <pamac.h>

#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_PACKAGE_ROW (pamac_package_row_get_type ())
#define PAMAC_PACKAGE_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PAMAC_TYPE_PACKAGE_ROW, PamacPackageRow))
#define PAMAC_PACKAGE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PAMAC_TYPE_PACKAGE_ROW, PamacPackageRowClass))
#define PAMAC_IS_PACKAGE_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PAMAC_TYPE_PACKAGE_ROW))
#define PAMAC_IS_PACKAGE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PAMAC_TYPE_PACKAGE_ROW))
#define PAMAC_PACKAGE_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAMAC_TYPE_PACKAGE_ROW, PamacPackageRowClass))

typedef struct _PamacPackageRow PamacPackageRow;
typedef struct _PamacPackageRowClass PamacPackageRowClass;
typedef struct _PamacPackageRowPrivate PamacPackageRowPrivate;
enum  {
	PAMAC_PACKAGE_ROW_0_PROPERTY,
	PAMAC_PACKAGE_ROW_NUM_PROPERTIES
};
static GParamSpec* pamac_package_row_properties[PAMAC_PACKAGE_ROW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _PamacPackageRow {
	GtkListBoxRow parent_instance;
	PamacPackageRowPrivate * priv;
	GtkImage* app_icon;
	GtkLabel* name_label;
	GtkLabel* desc_label;
	GtkLabel* version_label;
	GtkLabel* repo_label;
	GtkLabel* size_label;
	GtkToggleButton* action_togglebutton;
	GtkImage* action_icon;
	PamacPackage* pkg;
};

struct _PamacPackageRowClass {
	GtkListBoxRowClass parent_class;
};

static gpointer pamac_package_row_parent_class = NULL;

VALA_EXTERN GType pamac_package_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PamacPackageRow, g_object_unref)
VALA_EXTERN PamacPackageRow* pamac_package_row_new (PamacPackage* pkg);
VALA_EXTERN PamacPackageRow* pamac_package_row_construct (GType object_type,
                                              PamacPackage* pkg);
static void pamac_package_row_finalize (GObject * obj);
static GType pamac_package_row_get_type_once (void);

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

PamacPackageRow*
pamac_package_row_construct (GType object_type,
                             PamacPackage* pkg)
{
	PamacPackageRow * self = NULL;
	PamacPackage* _tmp0_;
	self = (PamacPackageRow*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (pkg);
	_g_object_unref0 (self->pkg);
	self->pkg = _tmp0_;
	return self;
}

PamacPackageRow*
pamac_package_row_new (PamacPackage* pkg)
{
	return pamac_package_row_construct (PAMAC_TYPE_PACKAGE_ROW, pkg);
}

static void
pamac_package_row_class_init (PamacPackageRowClass * klass,
                              gpointer klass_data)
{
	pamac_package_row_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = pamac_package_row_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/manjaro/pamac/manager/package_row.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "app_icon", FALSE, G_STRUCT_OFFSET (PamacPackageRow, app_icon));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "name_label", FALSE, G_STRUCT_OFFSET (PamacPackageRow, name_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "desc_label", FALSE, G_STRUCT_OFFSET (PamacPackageRow, desc_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "version_label", FALSE, G_STRUCT_OFFSET (PamacPackageRow, version_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "repo_label", FALSE, G_STRUCT_OFFSET (PamacPackageRow, repo_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "size_label", FALSE, G_STRUCT_OFFSET (PamacPackageRow, size_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "action_togglebutton", FALSE, G_STRUCT_OFFSET (PamacPackageRow, action_togglebutton));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "action_icon", FALSE, G_STRUCT_OFFSET (PamacPackageRow, action_icon));
}

static void
pamac_package_row_instance_init (PamacPackageRow * self,
                                 gpointer klass)
{
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
pamac_package_row_finalize (GObject * obj)
{
	PamacPackageRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PAMAC_TYPE_PACKAGE_ROW, PamacPackageRow);
	_g_object_unref0 (self->pkg);
	G_OBJECT_CLASS (pamac_package_row_parent_class)->finalize (obj);
}

static GType
pamac_package_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PamacPackageRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pamac_package_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PamacPackageRow), 0, (GInstanceInitFunc) pamac_package_row_instance_init, NULL };
	GType pamac_package_row_type_id;
	pamac_package_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "PamacPackageRow", &g_define_type_info, 0);
	return pamac_package_row_type_id;
}

GType
pamac_package_row_get_type (void)
{
	static volatile gsize pamac_package_row_type_id__once = 0;
	if (g_once_init_enter (&pamac_package_row_type_id__once)) {
		GType pamac_package_row_type_id;
		pamac_package_row_type_id = pamac_package_row_get_type_once ();
		g_once_init_leave (&pamac_package_row_type_id__once, pamac_package_row_type_id);
	}
	return pamac_package_row_type_id__once;
}

