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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <json-glib/json-glib.h>
#include <pango/pango.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 SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET (sway_notification_center_widgets_base_widget_get_type ())
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BASE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BASE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidgetClass))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_BASE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_BASE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BASE_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidgetClass))

typedef struct _SwayNotificationCenterWidgetsBaseWidget SwayNotificationCenterWidgetsBaseWidget;
typedef struct _SwayNotificationCenterWidgetsBaseWidgetClass SwayNotificationCenterWidgetsBaseWidgetClass;
typedef struct _SwayNotificationCenterWidgetsBaseWidgetPrivate SwayNotificationCenterWidgetsBaseWidgetPrivate;

#define SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_LABEL (sway_notification_center_widgets_label_get_type ())
#define SWAY_NOTIFICATION_CENTER_WIDGETS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_LABEL, SwayNotificationCenterWidgetsLabel))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_LABEL, SwayNotificationCenterWidgetsLabelClass))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_LABEL))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_LABEL))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_LABEL, SwayNotificationCenterWidgetsLabelClass))

typedef struct _SwayNotificationCenterWidgetsLabel SwayNotificationCenterWidgetsLabel;
typedef struct _SwayNotificationCenterWidgetsLabelClass SwayNotificationCenterWidgetsLabelClass;
typedef struct _SwayNotificationCenterWidgetsLabelPrivate SwayNotificationCenterWidgetsLabelPrivate;
enum  {
	SWAY_NOTIFICATION_CENTER_WIDGETS_LABEL_0_PROPERTY,
	SWAY_NOTIFICATION_CENTER_WIDGETS_LABEL_WIDGET_NAME_PROPERTY,
	SWAY_NOTIFICATION_CENTER_WIDGETS_LABEL_NUM_PROPERTIES
};
static GParamSpec* sway_notification_center_widgets_label_properties[SWAY_NOTIFICATION_CENTER_WIDGETS_LABEL_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 _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))

struct _SwayNotificationCenterWidgetsBaseWidget {
	GtkBox parent_instance;
	SwayNotificationCenterWidgetsBaseWidgetPrivate * priv;
};

struct _SwayNotificationCenterWidgetsBaseWidgetClass {
	GtkBoxClass parent_class;
	void (*on_cc_visibility_change) (SwayNotificationCenterWidgetsBaseWidget* self, gboolean value);
	const gchar* (*get_widget_name) (SwayNotificationCenterWidgetsBaseWidget* self);
};

struct _SwayNotificationCenterWidgetsLabel {
	SwayNotificationCenterWidgetsBaseWidget parent_instance;
	SwayNotificationCenterWidgetsLabelPrivate * priv;
};

struct _SwayNotificationCenterWidgetsLabelClass {
	SwayNotificationCenterWidgetsBaseWidgetClass parent_class;
};

struct _SwayNotificationCenterWidgetsLabelPrivate {
	GtkLabel* label_widget;
	gchar* text;
	gint max_lines;
};

static gint SwayNotificationCenterWidgetsLabel_private_offset;
static gpointer sway_notification_center_widgets_label_parent_class = NULL;

VALA_EXTERN GType sway_notification_center_widgets_base_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SwayNotificationCenterWidgetsBaseWidget, g_object_unref)
VALA_EXTERN GType sway_notification_center_widgets_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SwayNotificationCenterWidgetsLabel, g_object_unref)
VALA_EXTERN const gchar* sway_notification_center_widgets_base_widget_get_widget_name (SwayNotificationCenterWidgetsBaseWidget* self);
VALA_EXTERN SwayNotificationCenterWidgetsLabel* sway_notification_center_widgets_label_new (const gchar* suffix);
VALA_EXTERN SwayNotificationCenterWidgetsLabel* sway_notification_center_widgets_label_construct (GType object_type,
                                                                                      const gchar* suffix);
VALA_EXTERN SwayNotificationCenterWidgetsBaseWidget* sway_notification_center_widgets_base_widget_construct (GType object_type,
                                                                                                 const gchar* suffix);
VALA_EXTERN JsonObject* sway_notification_center_widgets_base_widget_get_config (SwayNotificationCenterWidgetsBaseWidget* self,
                                                                     GtkWidget* widget);
VALA_EXTERN gpointer sway_notification_center_widgets_base_widget_get_prop (SwayNotificationCenterWidgetsBaseWidget* self,
                                                                GType t_type,
                                                                GBoxedCopyFunc t_dup_func,
                                                                GDestroyNotify t_destroy_func,
                                                                JsonObject* config,
                                                                const gchar* value_key,
                                                                gboolean* found);
static gint* _int_dup (gint* self);
static void sway_notification_center_widgets_label_finalize (GObject * obj);
static GType sway_notification_center_widgets_label_get_type_once (void);
static void _vala_sway_notification_center_widgets_label_get_property (GObject * object,
                                                                guint property_id,
                                                                GValue * value,
                                                                GParamSpec * pspec);

static inline gpointer
sway_notification_center_widgets_label_get_instance_private (SwayNotificationCenterWidgetsLabel* self)
{
	return G_STRUCT_MEMBER_P (self, SwayNotificationCenterWidgetsLabel_private_offset);
}

static gint*
_int_dup (gint* self)
{
	gint* dup;
	dup = g_new0 (gint, 1);
	memcpy (dup, self, sizeof (gint));
	return dup;
}

static gpointer
__int_dup0 (gpointer self)
{
	return self ? _int_dup (self) : NULL;
}

SwayNotificationCenterWidgetsLabel*
sway_notification_center_widgets_label_construct (GType object_type,
                                                  const gchar* suffix)
{
	SwayNotificationCenterWidgetsLabel * self = NULL;
	JsonObject* config = NULL;
	JsonObject* _tmp0_;
	JsonObject* _tmp1_;
	GtkLabel* _tmp13_;
	GtkLabel* _tmp14_;
	const gchar* _tmp15_;
	GtkLabel* _tmp16_;
	GtkLabel* _tmp17_;
	GtkLabel* _tmp18_;
	GtkLabel* _tmp19_;
	GtkLabel* _tmp20_;
	GtkLabel* _tmp21_;
	GtkLabel* _tmp22_;
	GtkLabel* _tmp23_;
	GtkLabel* _tmp24_;
	GtkLabel* _tmp25_;
	GtkLabel* _tmp26_;
	g_return_val_if_fail (suffix != NULL, NULL);
	self = (SwayNotificationCenterWidgetsLabel*) sway_notification_center_widgets_base_widget_construct (object_type, suffix);
	_tmp0_ = sway_notification_center_widgets_base_widget_get_config (G_TYPE_CHECK_INSTANCE_CAST (self, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget), G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
	config = _tmp0_;
	_tmp1_ = config;
	if (_tmp1_ != NULL) {
		gchar* text = NULL;
		JsonObject* _tmp2_;
		gpointer _tmp3_;
		const gchar* _tmp4_;
		gint* max_lines = NULL;
		JsonObject* _tmp7_;
		gpointer _tmp8_;
		gint _tmp9_;
		gint* _tmp10_;
		gint* _tmp11_;
		_tmp2_ = config;
		_tmp3_ = sway_notification_center_widgets_base_widget_get_prop (G_TYPE_CHECK_INSTANCE_CAST (self, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget), G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp2_, "text", NULL);
		text = (gchar*) _tmp3_;
		_tmp4_ = text;
		if (_tmp4_ != NULL) {
			const gchar* _tmp5_;
			gchar* _tmp6_;
			_tmp5_ = text;
			_tmp6_ = g_strdup (_tmp5_);
			_g_free0 (self->priv->text);
			self->priv->text = _tmp6_;
		}
		_tmp7_ = config;
		_tmp8_ = sway_notification_center_widgets_base_widget_get_prop (G_TYPE_CHECK_INSTANCE_CAST (self, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget), G_TYPE_INT, NULL, NULL, _tmp7_, "max-lines", NULL);
		_tmp9_ = (gint) ((gintptr) _tmp8_);
		_tmp10_ = __int_dup0 (&_tmp9_);
		max_lines = _tmp10_;
		_tmp11_ = max_lines;
		if (_tmp11_ != NULL) {
			gint* _tmp12_;
			_tmp12_ = max_lines;
			self->priv->max_lines = *_tmp12_;
		}
		_g_free0 (max_lines);
		_g_free0 (text);
	}
	_tmp13_ = (GtkLabel*) gtk_label_new (NULL);
	if (_tmp13_) {
		g_object_set_data ((GObject *) _tmp13_, "vala-creation-function", "SwayNotificationCenter.Widgets.Label.new");
	}
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->label_widget);
	self->priv->label_widget = _tmp13_;
	_tmp14_ = self->priv->label_widget;
	_tmp15_ = self->priv->text;
	gtk_label_set_text (_tmp14_, _tmp15_);
	_tmp16_ = self->priv->label_widget;
	gtk_label_set_ellipsize (_tmp16_, PANGO_ELLIPSIZE_END);
	_tmp17_ = self->priv->label_widget;
	gtk_label_set_wrap (_tmp17_, TRUE);
	_tmp18_ = self->priv->label_widget;
	gtk_label_set_lines (_tmp18_, self->priv->max_lines);
	_tmp19_ = self->priv->label_widget;
	gtk_label_set_max_width_chars (_tmp19_, 0);
	_tmp20_ = self->priv->label_widget;
	gtk_label_set_wrap_mode (_tmp20_, PANGO_WRAP_WORD_CHAR);
	_tmp21_ = self->priv->label_widget;
	gtk_label_set_justify (_tmp21_, GTK_JUSTIFY_LEFT);
	_tmp22_ = self->priv->label_widget;
	gtk_label_set_xalign (_tmp22_, 0.0f);
	_tmp23_ = self->priv->label_widget;
	gtk_label_set_yalign (_tmp23_, 0.0f);
	_tmp24_ = self->priv->label_widget;
	gtk_widget_set_halign (G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, gtk_widget_get_type (), GtkWidget), GTK_ALIGN_FILL);
	_tmp25_ = self->priv->label_widget;
	gtk_widget_set_hexpand (G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, gtk_widget_get_type (), GtkWidget), TRUE);
	_tmp26_ = self->priv->label_widget;
	gtk_box_append (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox), G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, gtk_widget_get_type (), GtkWidget));
	_json_object_unref0 (config);
	return self;
}

SwayNotificationCenterWidgetsLabel*
sway_notification_center_widgets_label_new (const gchar* suffix)
{
	return sway_notification_center_widgets_label_construct (SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_LABEL, suffix);
}

static const gchar*
sway_notification_center_widgets_label_real_get_widget_name (SwayNotificationCenterWidgetsBaseWidget* base)
{
	const gchar* result;
	SwayNotificationCenterWidgetsLabel* self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_LABEL, SwayNotificationCenterWidgetsLabel);
	result = "label";
	return result;
}

static void
sway_notification_center_widgets_label_class_init (SwayNotificationCenterWidgetsLabelClass * klass,
                                                   gpointer klass_data)
{
	sway_notification_center_widgets_label_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SwayNotificationCenterWidgetsLabel_private_offset);
	SWAY_NOTIFICATION_CENTER_WIDGETS_BASE_WIDGET_CLASS (klass)->get_widget_name = (const gchar* (*) (SwayNotificationCenterWidgetsBaseWidget*)) sway_notification_center_widgets_label_real_get_widget_name;
	G_OBJECT_CLASS (klass)->get_property = _vala_sway_notification_center_widgets_label_get_property;
	G_OBJECT_CLASS (klass)->finalize = sway_notification_center_widgets_label_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SWAY_NOTIFICATION_CENTER_WIDGETS_LABEL_WIDGET_NAME_PROPERTY, sway_notification_center_widgets_label_properties[SWAY_NOTIFICATION_CENTER_WIDGETS_LABEL_WIDGET_NAME_PROPERTY] = g_param_spec_string ("widget-name", "widget-name", "widget-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
sway_notification_center_widgets_label_instance_init (SwayNotificationCenterWidgetsLabel * self,
                                                      gpointer klass)
{
	gchar* _tmp0_;
	self->priv = sway_notification_center_widgets_label_get_instance_private (self);
	_tmp0_ = g_strdup ("Label Text");
	self->priv->text = _tmp0_;
	self->priv->max_lines = 5;
}

static void
sway_notification_center_widgets_label_finalize (GObject * obj)
{
	SwayNotificationCenterWidgetsLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_LABEL, SwayNotificationCenterWidgetsLabel);
	_g_object_unref0 (self->priv->label_widget);
	_g_free0 (self->priv->text);
	G_OBJECT_CLASS (sway_notification_center_widgets_label_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
sway_notification_center_widgets_label_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SwayNotificationCenterWidgetsLabelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sway_notification_center_widgets_label_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SwayNotificationCenterWidgetsLabel), 0, (GInstanceInitFunc) sway_notification_center_widgets_label_instance_init, NULL };
	GType sway_notification_center_widgets_label_type_id;
	sway_notification_center_widgets_label_type_id = g_type_register_static (SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, "SwayNotificationCenterWidgetsLabel", &g_define_type_info, 0);
	SwayNotificationCenterWidgetsLabel_private_offset = g_type_add_instance_private (sway_notification_center_widgets_label_type_id, sizeof (SwayNotificationCenterWidgetsLabelPrivate));
	return sway_notification_center_widgets_label_type_id;
}

GType
sway_notification_center_widgets_label_get_type (void)
{
	static gsize sway_notification_center_widgets_label_type_id__once = 0;
	if (g_once_init_enter (&sway_notification_center_widgets_label_type_id__once)) {
		GType sway_notification_center_widgets_label_type_id;
		sway_notification_center_widgets_label_type_id = sway_notification_center_widgets_label_get_type_once ();
		g_once_init_leave (&sway_notification_center_widgets_label_type_id__once, sway_notification_center_widgets_label_type_id);
	}
	return sway_notification_center_widgets_label_type_id__once;
}

static void
_vala_sway_notification_center_widgets_label_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec)
{
	SwayNotificationCenterWidgetsLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_LABEL, SwayNotificationCenterWidgetsLabel);
	switch (property_id) {
		case SWAY_NOTIFICATION_CENTER_WIDGETS_LABEL_WIDGET_NAME_PROPERTY:
		g_value_set_string (value, sway_notification_center_widgets_base_widget_get_widget_name (G_TYPE_CHECK_INSTANCE_CAST (self, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget)));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

