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

/* This file is part of GNOME Games. License: GPL-3.0+.*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "gnome-games.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 GAMES_TYPE_ERROR_INFO_BAR (games_error_info_bar_get_type ())
#define GAMES_ERROR_INFO_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_ERROR_INFO_BAR, GamesErrorInfoBar))
#define GAMES_ERROR_INFO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_ERROR_INFO_BAR, GamesErrorInfoBarClass))
#define GAMES_IS_ERROR_INFO_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_ERROR_INFO_BAR))
#define GAMES_IS_ERROR_INFO_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_ERROR_INFO_BAR))
#define GAMES_ERROR_INFO_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_ERROR_INFO_BAR, GamesErrorInfoBarClass))

typedef struct _GamesErrorInfoBar GamesErrorInfoBar;
typedef struct _GamesErrorInfoBarClass GamesErrorInfoBarClass;
typedef struct _GamesErrorInfoBarPrivate GamesErrorInfoBarPrivate;
enum  {
	GAMES_ERROR_INFO_BAR_0_PROPERTY,
	GAMES_ERROR_INFO_BAR_NUM_PROPERTIES
};
static GParamSpec* games_error_info_bar_properties[GAMES_ERROR_INFO_BAR_NUM_PROPERTIES];

struct _GamesErrorInfoBar {
	GtkBin parent_instance;
	GamesErrorInfoBarPrivate * priv;
};

struct _GamesErrorInfoBarClass {
	GtkBinClass parent_class;
};

struct _GamesErrorInfoBarPrivate {
	GtkInfoBar* info_bar;
	GtkLabel* label;
};

static gint GamesErrorInfoBar_private_offset;
static gpointer games_error_info_bar_parent_class = NULL;

VALA_EXTERN GType games_error_info_bar_get_type (void) G_GNUC_CONST ;
static void games_error_info_bar_on_response (GamesErrorInfoBar* self);
static void _games_error_info_bar_on_response_gtk_info_bar_response (GtkInfoBar* _sender,
                                                              gint response_id,
                                                              gpointer self);
VALA_EXTERN void games_error_info_bar_show_error (GamesErrorInfoBar* self,
                                      const gchar* message);
VALA_EXTERN GamesErrorInfoBar* games_error_info_bar_new (void);
VALA_EXTERN GamesErrorInfoBar* games_error_info_bar_construct (GType object_type);
static void games_error_info_bar_finalize (GObject * obj);
static GType games_error_info_bar_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
games_error_info_bar_get_instance_private (GamesErrorInfoBar* self)
{
	return G_STRUCT_MEMBER_P (self, GamesErrorInfoBar_private_offset);
}

static void
games_error_info_bar_on_response (GamesErrorInfoBar* self)
{
	GtkInfoBar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->info_bar;
	gtk_info_bar_set_revealed (_tmp0_, FALSE);
}

static void
_games_error_info_bar_on_response_gtk_info_bar_response (GtkInfoBar* _sender,
                                                         gint response_id,
                                                         gpointer self)
{
	games_error_info_bar_on_response ((GamesErrorInfoBar*) self);
}

void
games_error_info_bar_show_error (GamesErrorInfoBar* self,
                                 const gchar* message)
{
	GtkLabel* _tmp0_;
	GtkInfoBar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = self->priv->label;
	gtk_label_set_label (_tmp0_, message);
	_tmp1_ = self->priv->info_bar;
	gtk_info_bar_set_revealed (_tmp1_, TRUE);
}

GamesErrorInfoBar*
games_error_info_bar_construct (GType object_type)
{
	GamesErrorInfoBar * self = NULL;
	self = (GamesErrorInfoBar*) g_object_new (object_type, NULL);
	return self;
}

GamesErrorInfoBar*
games_error_info_bar_new (void)
{
	return games_error_info_bar_construct (GAMES_TYPE_ERROR_INFO_BAR);
}

static void
games_error_info_bar_class_init (GamesErrorInfoBarClass * klass,
                                 gpointer klass_data)
{
	games_error_info_bar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesErrorInfoBar_private_offset);
	G_OBJECT_CLASS (klass)->finalize = games_error_info_bar_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Games/ui/error-info-bar.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "info_bar", FALSE, GamesErrorInfoBar_private_offset + G_STRUCT_OFFSET (GamesErrorInfoBarPrivate, info_bar));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "label", FALSE, GamesErrorInfoBar_private_offset + G_STRUCT_OFFSET (GamesErrorInfoBarPrivate, label));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_response", G_CALLBACK(_games_error_info_bar_on_response_gtk_info_bar_response));
}

static void
games_error_info_bar_instance_init (GamesErrorInfoBar * self,
                                    gpointer klass)
{
	self->priv = games_error_info_bar_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
games_error_info_bar_finalize (GObject * obj)
{
	GamesErrorInfoBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_ERROR_INFO_BAR, GamesErrorInfoBar);
	G_OBJECT_CLASS (games_error_info_bar_parent_class)->finalize (obj);
}

static GType
games_error_info_bar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesErrorInfoBarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_error_info_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesErrorInfoBar), 0, (GInstanceInitFunc) games_error_info_bar_instance_init, NULL };
	GType games_error_info_bar_type_id;
	games_error_info_bar_type_id = g_type_register_static (gtk_bin_get_type (), "GamesErrorInfoBar", &g_define_type_info, 0);
	GamesErrorInfoBar_private_offset = g_type_add_instance_private (games_error_info_bar_type_id, sizeof (GamesErrorInfoBarPrivate));
	return games_error_info_bar_type_id;
}

GType
games_error_info_bar_get_type (void)
{
	static volatile gsize games_error_info_bar_type_id__once = 0;
	if (g_once_init_enter (&games_error_info_bar_type_id__once)) {
		GType games_error_info_bar_type_id;
		games_error_info_bar_type_id = games_error_info_bar_get_type_once ();
		g_once_init_leave (&games_error_info_bar_type_id__once, games_error_info_bar_type_id);
	}
	return games_error_info_bar_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

