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

/*
 * Copyright 2017-2021 elementary, Inc. (https://elementary.io)
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#include "granite-7.h"
#include <glib-object.h>
#include <gtk/gtk.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 TYPE_DEMO_PAGE (demo_page_get_type ())
#define DEMO_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DEMO_PAGE, DemoPage))
#define DEMO_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DEMO_PAGE, DemoPageClass))
#define IS_DEMO_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DEMO_PAGE))
#define IS_DEMO_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DEMO_PAGE))
#define DEMO_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DEMO_PAGE, DemoPageClass))

typedef struct _DemoPage DemoPage;
typedef struct _DemoPageClass DemoPageClass;
typedef struct _DemoPagePrivate DemoPagePrivate;

#define TYPE_OVERLAY_BAR_VIEW (overlay_bar_view_get_type ())
#define OVERLAY_BAR_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_OVERLAY_BAR_VIEW, OverlayBarView))
#define OVERLAY_BAR_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_OVERLAY_BAR_VIEW, OverlayBarViewClass))
#define IS_OVERLAY_BAR_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_OVERLAY_BAR_VIEW))
#define IS_OVERLAY_BAR_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_OVERLAY_BAR_VIEW))
#define OVERLAY_BAR_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_OVERLAY_BAR_VIEW, OverlayBarViewClass))

typedef struct _OverlayBarView OverlayBarView;
typedef struct _OverlayBarViewClass OverlayBarViewClass;
typedef struct _OverlayBarViewPrivate OverlayBarViewPrivate;
enum  {
	OVERLAY_BAR_VIEW_0_PROPERTY,
	OVERLAY_BAR_VIEW_NUM_PROPERTIES
};
static GParamSpec* overlay_bar_view_properties[OVERLAY_BAR_VIEW_NUM_PROPERTIES];
typedef struct _Block6Data Block6Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _DemoPage {
	GraniteToolBox parent_instance;
	DemoPagePrivate * priv;
};

struct _DemoPageClass {
	GraniteToolBoxClass parent_class;
};

struct _OverlayBarView {
	DemoPage parent_instance;
	OverlayBarViewPrivate * priv;
};

struct _OverlayBarViewClass {
	DemoPageClass parent_class;
};

struct _Block6Data {
	int _ref_count_;
	OverlayBarView* self;
	GtkToggleButton* button;
	GraniteOverlayBar* overlaybar;
};

static gpointer overlay_bar_view_parent_class = NULL;

VALA_EXTERN GType demo_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DemoPage, g_object_unref)
VALA_EXTERN GType overlay_bar_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OverlayBarView, g_object_unref)
VALA_EXTERN OverlayBarView* overlay_bar_view_new (void);
VALA_EXTERN OverlayBarView* overlay_bar_view_construct (GType object_type);
VALA_EXTERN DemoPage* demo_page_new (void);
VALA_EXTERN DemoPage* demo_page_construct (GType object_type);
static GObject * overlay_bar_view_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
VALA_EXTERN void demo_page_set_child (DemoPage* self,
                          GtkWidget* value);
static void _overlay_bar_view___lambda10_ (Block6Data* _data6_);
static void __overlay_bar_view___lambda10__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                               gpointer self);
static GType overlay_bar_view_get_type_once (void);

OverlayBarView*
overlay_bar_view_construct (GType object_type)
{
	OverlayBarView * self = NULL;
	self = (OverlayBarView*) demo_page_construct (object_type);
	return self;
}

OverlayBarView*
overlay_bar_view_new (void)
{
	return overlay_bar_view_construct (TYPE_OVERLAY_BAR_VIEW);
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		OverlayBarView* self;
		self = _data6_->self;
		_g_object_unref0 (_data6_->overlaybar);
		_g_object_unref0 (_data6_->button);
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

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

static void
_overlay_bar_view___lambda10_ (Block6Data* _data6_)
{
	OverlayBarView* self;
	GraniteOverlayBar* _tmp0_;
	GtkToggleButton* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	self = _data6_->self;
	_tmp0_ = _data6_->overlaybar;
	_tmp1_ = _data6_->button;
	_tmp2_ = gtk_toggle_button_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	granite_overlay_bar_set_active (_tmp0_, _tmp3_);
}

static void
__overlay_bar_view___lambda10__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                          gpointer self)
{
	_overlay_bar_view___lambda10_ (self);
}

static GObject *
overlay_bar_view_constructor (GType type,
                              guint n_construct_properties,
                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	OverlayBarView * self;
	Block6Data* _data6_;
	GtkToggleButton* _tmp0_;
	GtkBox* box = NULL;
	GtkBox* _tmp1_ = NULL;
	GtkBox* _tmp2_;
	GtkToggleButton* _tmp3_;
	GtkOverlay* overlay = NULL;
	GtkBox* _tmp4_;
	GtkWidget* _tmp5_;
	GtkOverlay* _tmp6_ = NULL;
	GtkOverlay* _tmp7_;
	gchar* _tmp8_;
	GraniteOverlayBar* _tmp9_ = NULL;
	GtkOverlay* _tmp10_;
	GtkToggleButton* _tmp11_;
	parent_class = G_OBJECT_CLASS (overlay_bar_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_OVERLAY_BAR_VIEW, OverlayBarView);
	_data6_ = g_slice_new0 (Block6Data);
	_data6_->_ref_count_ = 1;
	_data6_->self = g_object_ref (self);
	_tmp0_ = (GtkToggleButton*) gtk_toggle_button_new_with_label ("Show Spinner");
	g_object_ref_sink (_tmp0_);
	_data6_->button = _tmp0_;
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	gtk_widget_set_halign ((GtkWidget*) _tmp1_, GTK_ALIGN_CENTER);
	gtk_widget_set_valign ((GtkWidget*) _tmp1_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp1_);
	box = _tmp1_;
	_tmp2_ = box;
	_tmp3_ = _data6_->button;
	gtk_box_append (_tmp2_, (GtkWidget*) _tmp3_);
	_tmp4_ = box;
	_tmp5_ = _g_object_ref0 ((GtkWidget*) _tmp4_);
	_tmp6_ = (GtkOverlay*) gtk_overlay_new ();
	gtk_overlay_set_child (_tmp6_, _tmp5_);
	_g_object_unref0 (_tmp5_);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp6_, TRUE);
	g_object_ref_sink (_tmp6_);
	overlay = _tmp6_;
	_tmp7_ = overlay;
	_tmp8_ = g_strdup ("Hover the OverlayBar to change its position");
	_tmp9_ = granite_overlay_bar_new (_tmp7_);
	granite_overlay_bar_set_label (_tmp9_, _tmp8_);
	_g_free0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	_data6_->overlaybar = _tmp9_;
	_tmp10_ = overlay;
	demo_page_set_child ((DemoPage*) self, (GtkWidget*) _tmp10_);
	_tmp11_ = _data6_->button;
	g_signal_connect_data (_tmp11_, "toggled", (GCallback) __overlay_bar_view___lambda10__gtk_toggle_button_toggled, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_g_object_unref0 (overlay);
	_g_object_unref0 (box);
	block6_data_unref (_data6_);
	_data6_ = NULL;
	return obj;
}

static void
overlay_bar_view_class_init (OverlayBarViewClass * klass,
                             gpointer klass_data)
{
	overlay_bar_view_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = overlay_bar_view_constructor;
}

static void
overlay_bar_view_instance_init (OverlayBarView * self,
                                gpointer klass)
{
}

static GType
overlay_bar_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (OverlayBarViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) overlay_bar_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (OverlayBarView), 0, (GInstanceInitFunc) overlay_bar_view_instance_init, NULL };
	GType overlay_bar_view_type_id;
	overlay_bar_view_type_id = g_type_register_static (TYPE_DEMO_PAGE, "OverlayBarView", &g_define_type_info, 0);
	return overlay_bar_view_type_id;
}

GType
overlay_bar_view_get_type (void)
{
	static volatile gsize overlay_bar_view_type_id__once = 0;
	if (g_once_init_enter (&overlay_bar_view_type_id__once)) {
		GType overlay_bar_view_type_id;
		overlay_bar_view_type_id = overlay_bar_view_get_type_once ();
		g_once_init_leave (&overlay_bar_view_type_id__once, overlay_bar_view_type_id);
	}
	return overlay_bar_view_type_id__once;
}

