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

/*
 * Copyright 2025 elementary, Inc. <https://elementary.io>
 * SPDX-License-Identifier: GPL-3.0-or-later
*
* Authored by: Jeremy Wootten <jeremywootten@gmail.com>
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <libgit2-glib/ggit.h>
#include <glib.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
#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 SCRATCH_DIALOGS_TYPE_BRANCH_NAME_ROW (scratch_dialogs_branch_name_row_get_type ())
#define SCRATCH_DIALOGS_BRANCH_NAME_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCRATCH_DIALOGS_TYPE_BRANCH_NAME_ROW, ScratchDialogsBranchNameRow))
#define SCRATCH_DIALOGS_BRANCH_NAME_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCRATCH_DIALOGS_TYPE_BRANCH_NAME_ROW, ScratchDialogsBranchNameRowClass))
#define SCRATCH_DIALOGS_IS_BRANCH_NAME_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCRATCH_DIALOGS_TYPE_BRANCH_NAME_ROW))
#define SCRATCH_DIALOGS_IS_BRANCH_NAME_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCRATCH_DIALOGS_TYPE_BRANCH_NAME_ROW))
#define SCRATCH_DIALOGS_BRANCH_NAME_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCRATCH_DIALOGS_TYPE_BRANCH_NAME_ROW, ScratchDialogsBranchNameRowClass))

typedef struct _ScratchDialogsBranchNameRow ScratchDialogsBranchNameRow;
typedef struct _ScratchDialogsBranchNameRowClass ScratchDialogsBranchNameRowClass;
typedef struct _ScratchDialogsBranchNameRowPrivate ScratchDialogsBranchNameRowPrivate;
enum  {
	SCRATCH_DIALOGS_BRANCH_NAME_ROW_0_PROPERTY,
	SCRATCH_DIALOGS_BRANCH_NAME_ROW_BREF_PROPERTY,
	SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_REMOTE_PROPERTY,
	SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_RECENT_PROPERTY,
	SCRATCH_DIALOGS_BRANCH_NAME_ROW_BRANCH_NAME_PROPERTY,
	SCRATCH_DIALOGS_BRANCH_NAME_ROW_NUM_PROPERTIES
};
static GParamSpec* scratch_dialogs_branch_name_row_properties[SCRATCH_DIALOGS_BRANCH_NAME_ROW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ScratchDialogsBranchNameRow {
	GtkListBoxRow parent_instance;
	ScratchDialogsBranchNameRowPrivate * priv;
};

struct _ScratchDialogsBranchNameRowClass {
	GtkListBoxRowClass parent_class;
};

struct _ScratchDialogsBranchNameRowPrivate {
	GgitRef* _bref;
	gboolean _is_remote;
	gboolean _is_recent;
	GtkLabel* label;
};

static gint ScratchDialogsBranchNameRow_private_offset;
static gpointer scratch_dialogs_branch_name_row_parent_class = NULL;

VALA_EXTERN GType scratch_dialogs_branch_name_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScratchDialogsBranchNameRow, g_object_unref)
VALA_EXTERN ScratchDialogsBranchNameRow* scratch_dialogs_branch_name_row_new (GgitRef* bref);
VALA_EXTERN ScratchDialogsBranchNameRow* scratch_dialogs_branch_name_row_construct (GType object_type,
                                                                        GgitRef* bref);
VALA_EXTERN GgitRef* scratch_dialogs_branch_name_row_get_bref (ScratchDialogsBranchNameRow* self);
static void scratch_dialogs_branch_name_row_set_bref (ScratchDialogsBranchNameRow* self,
                                               GgitRef* value);
VALA_EXTERN gboolean scratch_dialogs_branch_name_row_get_is_remote (ScratchDialogsBranchNameRow* self);
static void scratch_dialogs_branch_name_row_set_is_remote (ScratchDialogsBranchNameRow* self,
                                                    gboolean value);
VALA_EXTERN gboolean scratch_dialogs_branch_name_row_get_is_recent (ScratchDialogsBranchNameRow* self);
VALA_EXTERN void scratch_dialogs_branch_name_row_set_is_recent (ScratchDialogsBranchNameRow* self,
                                                    gboolean value);
VALA_EXTERN const gchar* scratch_dialogs_branch_name_row_get_branch_name (ScratchDialogsBranchNameRow* self);
static GObject * scratch_dialogs_branch_name_row_constructor (GType type,
                                                       guint n_construct_properties,
                                                       GObjectConstructParam * construct_properties);
static void scratch_dialogs_branch_name_row_finalize (GObject * obj);
static GType scratch_dialogs_branch_name_row_get_type_once (void);
static void _vala_scratch_dialogs_branch_name_row_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec);
static void _vala_scratch_dialogs_branch_name_row_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec);

static inline gpointer
scratch_dialogs_branch_name_row_get_instance_private (ScratchDialogsBranchNameRow* self)
{
	return G_STRUCT_MEMBER_P (self, ScratchDialogsBranchNameRow_private_offset);
}

ScratchDialogsBranchNameRow*
scratch_dialogs_branch_name_row_construct (GType object_type,
                                           GgitRef* bref)
{
	ScratchDialogsBranchNameRow * self = NULL;
	g_return_val_if_fail (bref != NULL, NULL);
	self = (ScratchDialogsBranchNameRow*) g_object_new (object_type, "bref", bref, NULL);
	return self;
}

ScratchDialogsBranchNameRow*
scratch_dialogs_branch_name_row_new (GgitRef* bref)
{
	return scratch_dialogs_branch_name_row_construct (SCRATCH_DIALOGS_TYPE_BRANCH_NAME_ROW, bref);
}

GgitRef*
scratch_dialogs_branch_name_row_get_bref (ScratchDialogsBranchNameRow* self)
{
	GgitRef* result;
	GgitRef* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_bref;
	result = _tmp0_;
	return result;
}

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

static void
scratch_dialogs_branch_name_row_set_bref (ScratchDialogsBranchNameRow* self,
                                          GgitRef* value)
{
	GgitRef* old_value;
	g_return_if_fail (self != NULL);
	old_value = scratch_dialogs_branch_name_row_get_bref (self);
	if (old_value != value) {
		GgitRef* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_bref);
		self->priv->_bref = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, scratch_dialogs_branch_name_row_properties[SCRATCH_DIALOGS_BRANCH_NAME_ROW_BREF_PROPERTY]);
	}
}

gboolean
scratch_dialogs_branch_name_row_get_is_remote (ScratchDialogsBranchNameRow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_remote;
	return result;
}

static void
scratch_dialogs_branch_name_row_set_is_remote (ScratchDialogsBranchNameRow* self,
                                               gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = scratch_dialogs_branch_name_row_get_is_remote (self);
	if (old_value != value) {
		self->priv->_is_remote = value;
		g_object_notify_by_pspec ((GObject *) self, scratch_dialogs_branch_name_row_properties[SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_REMOTE_PROPERTY]);
	}
}

gboolean
scratch_dialogs_branch_name_row_get_is_recent (ScratchDialogsBranchNameRow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_recent;
	return result;
}

void
scratch_dialogs_branch_name_row_set_is_recent (ScratchDialogsBranchNameRow* self,
                                               gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = scratch_dialogs_branch_name_row_get_is_recent (self);
	if (old_value != value) {
		self->priv->_is_recent = value;
		g_object_notify_by_pspec ((GObject *) self, scratch_dialogs_branch_name_row_properties[SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_RECENT_PROPERTY]);
	}
}

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

static GObject *
scratch_dialogs_branch_name_row_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ScratchDialogsBranchNameRow * self;
	GgitRef* _tmp0_;
	GgitRef* _tmp1_;
	const gchar* _tmp2_;
	GtkLabel* _tmp3_ = NULL;
	GtkLabel* _tmp4_;
	parent_class = G_OBJECT_CLASS (scratch_dialogs_branch_name_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SCRATCH_DIALOGS_TYPE_BRANCH_NAME_ROW, ScratchDialogsBranchNameRow);
	_tmp0_ = self->priv->_bref;
	scratch_dialogs_branch_name_row_set_is_remote (self, !ggit_ref_is_branch (_tmp0_));
	_tmp1_ = self->priv->_bref;
	_tmp2_ = ggit_ref_get_shorthand (_tmp1_);
	_tmp3_ = (GtkLabel*) gtk_label_new (_tmp2_);
	gtk_widget_set_halign ((GtkWidget*) _tmp3_, GTK_ALIGN_START);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp3_, 24);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->label);
	self->priv->label = _tmp3_;
	_tmp4_ = self->priv->label;
	g_object_set ((GtkContainer*) self, "child", (GtkWidget*) _tmp4_, NULL);
	return obj;
}

static void
scratch_dialogs_branch_name_row_class_init (ScratchDialogsBranchNameRowClass * klass,
                                            gpointer klass_data)
{
	scratch_dialogs_branch_name_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ScratchDialogsBranchNameRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_scratch_dialogs_branch_name_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_scratch_dialogs_branch_name_row_set_property;
	G_OBJECT_CLASS (klass)->constructor = scratch_dialogs_branch_name_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = scratch_dialogs_branch_name_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCRATCH_DIALOGS_BRANCH_NAME_ROW_BREF_PROPERTY, scratch_dialogs_branch_name_row_properties[SCRATCH_DIALOGS_BRANCH_NAME_ROW_BREF_PROPERTY] = g_param_spec_object ("bref", "bref", "bref", ggit_ref_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_REMOTE_PROPERTY, scratch_dialogs_branch_name_row_properties[SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_REMOTE_PROPERTY] = g_param_spec_boolean ("is-remote", "is-remote", "is-remote", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_RECENT_PROPERTY, scratch_dialogs_branch_name_row_properties[SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_RECENT_PROPERTY] = g_param_spec_boolean ("is-recent", "is-recent", "is-recent", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCRATCH_DIALOGS_BRANCH_NAME_ROW_BRANCH_NAME_PROPERTY, scratch_dialogs_branch_name_row_properties[SCRATCH_DIALOGS_BRANCH_NAME_ROW_BRANCH_NAME_PROPERTY] = g_param_spec_string ("branch-name", "branch-name", "branch-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
scratch_dialogs_branch_name_row_instance_init (ScratchDialogsBranchNameRow * self,
                                               gpointer klass)
{
	self->priv = scratch_dialogs_branch_name_row_get_instance_private (self);
	self->priv->_is_recent = FALSE;
}

static void
scratch_dialogs_branch_name_row_finalize (GObject * obj)
{
	ScratchDialogsBranchNameRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SCRATCH_DIALOGS_TYPE_BRANCH_NAME_ROW, ScratchDialogsBranchNameRow);
	_g_object_unref0 (self->priv->_bref);
	_g_object_unref0 (self->priv->label);
	G_OBJECT_CLASS (scratch_dialogs_branch_name_row_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
scratch_dialogs_branch_name_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ScratchDialogsBranchNameRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) scratch_dialogs_branch_name_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ScratchDialogsBranchNameRow), 0, (GInstanceInitFunc) scratch_dialogs_branch_name_row_instance_init, NULL };
	GType scratch_dialogs_branch_name_row_type_id;
	scratch_dialogs_branch_name_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "ScratchDialogsBranchNameRow", &g_define_type_info, G_TYPE_FLAG_NONE);
	ScratchDialogsBranchNameRow_private_offset = g_type_add_instance_private (scratch_dialogs_branch_name_row_type_id, sizeof (ScratchDialogsBranchNameRowPrivate));
	return scratch_dialogs_branch_name_row_type_id;
}

GType
scratch_dialogs_branch_name_row_get_type (void)
{
	static gsize scratch_dialogs_branch_name_row_type_id__once = 0;
	if (g_once_init_enter (&scratch_dialogs_branch_name_row_type_id__once)) {
		GType scratch_dialogs_branch_name_row_type_id;
		scratch_dialogs_branch_name_row_type_id = scratch_dialogs_branch_name_row_get_type_once ();
		g_once_init_leave (&scratch_dialogs_branch_name_row_type_id__once, scratch_dialogs_branch_name_row_type_id);
	}
	return scratch_dialogs_branch_name_row_type_id__once;
}

static void
_vala_scratch_dialogs_branch_name_row_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec)
{
	ScratchDialogsBranchNameRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SCRATCH_DIALOGS_TYPE_BRANCH_NAME_ROW, ScratchDialogsBranchNameRow);
	switch (property_id) {
		case SCRATCH_DIALOGS_BRANCH_NAME_ROW_BREF_PROPERTY:
		g_value_set_object (value, scratch_dialogs_branch_name_row_get_bref (self));
		break;
		case SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_REMOTE_PROPERTY:
		g_value_set_boolean (value, scratch_dialogs_branch_name_row_get_is_remote (self));
		break;
		case SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_RECENT_PROPERTY:
		g_value_set_boolean (value, scratch_dialogs_branch_name_row_get_is_recent (self));
		break;
		case SCRATCH_DIALOGS_BRANCH_NAME_ROW_BRANCH_NAME_PROPERTY:
		g_value_set_string (value, scratch_dialogs_branch_name_row_get_branch_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_scratch_dialogs_branch_name_row_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec)
{
	ScratchDialogsBranchNameRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SCRATCH_DIALOGS_TYPE_BRANCH_NAME_ROW, ScratchDialogsBranchNameRow);
	switch (property_id) {
		case SCRATCH_DIALOGS_BRANCH_NAME_ROW_BREF_PROPERTY:
		scratch_dialogs_branch_name_row_set_bref (self, g_value_get_object (value));
		break;
		case SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_REMOTE_PROPERTY:
		scratch_dialogs_branch_name_row_set_is_remote (self, g_value_get_boolean (value));
		break;
		case SCRATCH_DIALOGS_BRANCH_NAME_ROW_IS_RECENT_PROPERTY:
		scratch_dialogs_branch_name_row_set_is_recent (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

