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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "config.h"
#include "protonplus_core.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

#define PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_BASE (proton_plus_widgets_introduction_base_get_type ())
#define PROTON_PLUS_WIDGETS_INTRODUCTION_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_BASE, ProtonPlusWidgetsIntroductionBase))
#define PROTON_PLUS_WIDGETS_INTRODUCTION_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_BASE, ProtonPlusWidgetsIntroductionBaseClass))
#define PROTON_PLUS_WIDGETS_INTRODUCTION_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_BASE))
#define PROTON_PLUS_WIDGETS_INTRODUCTION_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_BASE))
#define PROTON_PLUS_WIDGETS_INTRODUCTION_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_BASE, ProtonPlusWidgetsIntroductionBaseClass))

typedef struct _ProtonPlusWidgetsIntroductionBase ProtonPlusWidgetsIntroductionBase;
typedef struct _ProtonPlusWidgetsIntroductionBaseClass ProtonPlusWidgetsIntroductionBaseClass;
typedef struct _ProtonPlusWidgetsIntroductionBasePrivate ProtonPlusWidgetsIntroductionBasePrivate;
enum  {
	PROTON_PLUS_WIDGETS_INTRODUCTION_BASE_0_PROPERTY,
	PROTON_PLUS_WIDGETS_INTRODUCTION_BASE_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_introduction_base_properties[PROTON_PLUS_WIDGETS_INTRODUCTION_BASE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ProtonPlusWidgetsIntroductionBase {
	GtkBox parent_instance;
	ProtonPlusWidgetsIntroductionBasePrivate * priv;
};

struct _ProtonPlusWidgetsIntroductionBaseClass {
	GtkBoxClass parent_class;
};

static gpointer proton_plus_widgets_introduction_base_parent_class = NULL;

VALA_EXTERN GType proton_plus_widgets_introduction_base_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ProtonPlusWidgetsIntroductionBase* proton_plus_widgets_introduction_base_new (const gchar* title_text,
                                                                              const gchar* description_text,
                                                                              const gchar* image_source);
VALA_EXTERN ProtonPlusWidgetsIntroductionBase* proton_plus_widgets_introduction_base_construct (GType object_type,
                                                                                    const gchar* title_text,
                                                                                    const gchar* description_text,
                                                                                    const gchar* image_source);
static GType proton_plus_widgets_introduction_base_get_type_once (void);

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

ProtonPlusWidgetsIntroductionBase*
proton_plus_widgets_introduction_base_construct (GType object_type,
                                                 const gchar* title_text,
                                                 const gchar* description_text,
                                                 const gchar* image_source)
{
	ProtonPlusWidgetsIntroductionBase * self = NULL;
	GtkLabel* title_label = NULL;
	GtkLabel* _tmp5_;
	GtkLabel* desc_label = NULL;
	GtkLabel* _tmp6_;
	g_return_val_if_fail (title_text != NULL, NULL);
	g_return_val_if_fail (description_text != NULL, NULL);
	self = (ProtonPlusWidgetsIntroductionBase*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 18, NULL);
	gtk_widget_set_hexpand ((GtkWidget*) self, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) self, TRUE);
	gtk_widget_set_valign ((GtkWidget*) self, GTK_ALIGN_CENTER);
	gtk_widget_set_halign ((GtkWidget*) self, GTK_ALIGN_CENTER);
	gtk_widget_set_margin_top ((GtkWidget*) self, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) self, 24);
	gtk_widget_set_margin_start ((GtkWidget*) self, 24);
	gtk_widget_set_margin_end ((GtkWidget*) self, 24);
	if (image_source != NULL) {
		GtkImage* image = NULL;
		gboolean _tmp0_ = FALSE;
		GtkImage* _tmp3_;
		GtkImage* _tmp4_;
		if (g_str_has_prefix (image_source, "/")) {
			_tmp0_ = TRUE;
		} else {
			_tmp0_ = string_contains (image_source, RESOURCE_BASE);
		}
		if (_tmp0_) {
			GtkImage* _tmp1_;
			_tmp1_ = (GtkImage*) gtk_image_new_from_resource (image_source);
			g_object_ref_sink (_tmp1_);
			_g_object_unref0 (image);
			image = _tmp1_;
		} else {
			GtkImage* _tmp2_;
			_tmp2_ = (GtkImage*) gtk_image_new_from_icon_name (image_source);
			g_object_ref_sink (_tmp2_);
			_g_object_unref0 (image);
			image = _tmp2_;
		}
		_tmp3_ = image;
		gtk_image_set_pixel_size (_tmp3_, 96);
		_tmp4_ = image;
		gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp4_);
		_g_object_unref0 (image);
	}
	_tmp5_ = (GtkLabel*) gtk_label_new (title_text);
	g_object_ref_sink (_tmp5_);
	title_label = _tmp5_;
	gtk_widget_add_css_class ((GtkWidget*) title_label, "title-1");
	gtk_label_set_wrap (title_label, TRUE);
	gtk_label_set_justify (title_label, GTK_JUSTIFY_CENTER);
	gtk_label_set_max_width_chars (title_label, 25);
	gtk_box_append ((GtkBox*) self, (GtkWidget*) title_label);
	_tmp6_ = (GtkLabel*) gtk_label_new (description_text);
	g_object_ref_sink (_tmp6_);
	desc_label = _tmp6_;
	gtk_widget_add_css_class ((GtkWidget*) desc_label, "body");
	gtk_label_set_wrap (desc_label, TRUE);
	gtk_label_set_justify (desc_label, GTK_JUSTIFY_CENTER);
	gtk_label_set_max_width_chars (desc_label, 50);
	gtk_box_append ((GtkBox*) self, (GtkWidget*) desc_label);
	_g_object_unref0 (desc_label);
	_g_object_unref0 (title_label);
	return self;
}

ProtonPlusWidgetsIntroductionBase*
proton_plus_widgets_introduction_base_new (const gchar* title_text,
                                           const gchar* description_text,
                                           const gchar* image_source)
{
	return proton_plus_widgets_introduction_base_construct (PROTON_PLUS_WIDGETS_INTRODUCTION_TYPE_BASE, title_text, description_text, image_source);
}

static void
proton_plus_widgets_introduction_base_class_init (ProtonPlusWidgetsIntroductionBaseClass * klass,
                                                  gpointer klass_data)
{
	proton_plus_widgets_introduction_base_parent_class = g_type_class_peek_parent (klass);
}

static void
proton_plus_widgets_introduction_base_instance_init (ProtonPlusWidgetsIntroductionBase * self,
                                                     gpointer klass)
{
}

static GType
proton_plus_widgets_introduction_base_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsIntroductionBaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_introduction_base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsIntroductionBase), 0, (GInstanceInitFunc) proton_plus_widgets_introduction_base_instance_init, NULL };
	GType proton_plus_widgets_introduction_base_type_id;
	proton_plus_widgets_introduction_base_type_id = g_type_register_static (gtk_box_get_type (), "ProtonPlusWidgetsIntroductionBase", &g_define_type_info, 0);
	return proton_plus_widgets_introduction_base_type_id;
}

GType
proton_plus_widgets_introduction_base_get_type (void)
{
	static volatile gsize proton_plus_widgets_introduction_base_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_introduction_base_type_id__once)) {
		GType proton_plus_widgets_introduction_base_type_id;
		proton_plus_widgets_introduction_base_type_id = proton_plus_widgets_introduction_base_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_introduction_base_type_id__once, proton_plus_widgets_introduction_base_type_id);
	}
	return proton_plus_widgets_introduction_base_type_id__once;
}

