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

/*
 * Copyright 2011-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 <glib/gi18n-lib.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_TOAST_VIEW (toast_view_get_type ())
#define TOAST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TOAST_VIEW, ToastView))
#define TOAST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TOAST_VIEW, ToastViewClass))
#define IS_TOAST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TOAST_VIEW))
#define IS_TOAST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TOAST_VIEW))
#define TOAST_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TOAST_VIEW, ToastViewClass))

typedef struct _ToastView ToastView;
typedef struct _ToastViewClass ToastViewClass;
typedef struct _ToastViewPrivate ToastViewPrivate;
enum  {
	TOAST_VIEW_0_PROPERTY,
	TOAST_VIEW_NUM_PROPERTIES
};
static GParamSpec* toast_view_properties[TOAST_VIEW_NUM_PROPERTIES];
typedef struct _Block7Data Block7Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

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

struct _DemoPageClass {
	GraniteToolBoxClass parent_class;
};

struct _ToastView {
	DemoPage parent_instance;
	ToastViewPrivate * priv;
};

struct _ToastViewClass {
	DemoPageClass parent_class;
};

struct _Block7Data {
	int _ref_count_;
	ToastView* self;
	GraniteToast* toast;
	GtkBox* box;
};

static gpointer toast_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 toast_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ToastView, g_object_unref)
VALA_EXTERN ToastView* toast_view_new (void);
VALA_EXTERN ToastView* toast_view_construct (GType object_type);
VALA_EXTERN DemoPage* demo_page_new (void);
VALA_EXTERN DemoPage* demo_page_construct (GType object_type);
static GObject * toast_view_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static void _toast_view___lambda11_ (Block7Data* _data7_);
static void __toast_view___lambda11__gtk_button_clicked (GtkButton* _sender,
                                                  gpointer self);
static void _toast_view___lambda12_ (Block7Data* _data7_);
static void __toast_view___lambda12__granite_toast_default_action (GraniteToast* _sender,
                                                            gpointer self);
VALA_EXTERN void demo_page_set_child (DemoPage* self,
                          GtkWidget* value);
static GType toast_view_get_type_once (void);

ToastView*
toast_view_construct (GType object_type)
{
	ToastView * self = NULL;
	self = (ToastView*) demo_page_construct (object_type);
	return self;
}

ToastView*
toast_view_new (void)
{
	return toast_view_construct (TYPE_TOAST_VIEW);
}

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		ToastView* self;
		self = _data7_->self;
		_g_object_unref0 (_data7_->box);
		_g_object_unref0 (_data7_->toast);
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}

static void
_toast_view___lambda11_ (Block7Data* _data7_)
{
	ToastView* self;
	GraniteToast* _tmp0_;
	self = _data7_->self;
	_tmp0_ = _data7_->toast;
	granite_toast_send_notification (_tmp0_);
}

static void
__toast_view___lambda11__gtk_button_clicked (GtkButton* _sender,
                                             gpointer self)
{
	_toast_view___lambda11_ (self);
}

static void
_toast_view___lambda12_ (Block7Data* _data7_)
{
	ToastView* self;
	GtkLabel* label = NULL;
	GtkLabel* _tmp0_;
	GraniteToast* _tmp1_;
	GraniteToast* _tmp2_;
	GtkBox* _tmp3_;
	GtkLabel* _tmp4_;
	self = _data7_->self;
	_tmp0_ = (GtkLabel*) gtk_label_new (_ ("Did The Thing"));
	g_object_ref_sink (_tmp0_);
	label = _tmp0_;
	_tmp1_ = _data7_->toast;
	granite_toast_set_title (_tmp1_, _ ("Already did the thing"));
	_tmp2_ = _data7_->toast;
	granite_toast_set_default_action (_tmp2_, NULL);
	_tmp3_ = _data7_->box;
	_tmp4_ = label;
	gtk_box_append (_tmp3_, (GtkWidget*) _tmp4_);
	_g_object_unref0 (label);
}

static void
__toast_view___lambda12__granite_toast_default_action (GraniteToast* _sender,
                                                       gpointer self)
{
	_toast_view___lambda12_ (self);
}

static GObject *
toast_view_constructor (GType type,
                        guint n_construct_properties,
                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ToastView * self;
	Block7Data* _data7_;
	GtkOverlay* overlay = NULL;
	GtkOverlay* _tmp0_;
	GraniteToast* _tmp1_;
	GraniteToast* _tmp2_;
	GtkButton* button = NULL;
	GtkButton* _tmp3_;
	GtkBox* _tmp4_ = NULL;
	GtkBox* _tmp5_;
	GtkButton* _tmp6_;
	GtkOverlay* _tmp7_;
	GtkBox* _tmp8_;
	GtkOverlay* _tmp9_;
	GraniteToast* _tmp10_;
	GtkOverlay* _tmp11_;
	GraniteToast* _tmp12_;
	GtkButton* _tmp13_;
	GraniteToast* _tmp14_;
	GtkOverlay* _tmp15_;
	parent_class = G_OBJECT_CLASS (toast_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TOAST_VIEW, ToastView);
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->self = g_object_ref (self);
	_tmp0_ = (GtkOverlay*) gtk_overlay_new ();
	g_object_ref_sink (_tmp0_);
	overlay = _tmp0_;
	_tmp1_ = granite_toast_new (_ ("Button was pressed!"));
	g_object_ref_sink (_tmp1_);
	_data7_->toast = _tmp1_;
	_tmp2_ = _data7_->toast;
	granite_toast_set_default_action (_tmp2_, _ ("Do Things"));
	_tmp3_ = (GtkButton*) gtk_button_new_with_label (_ ("Press Me"));
	g_object_ref_sink (_tmp3_);
	button = _tmp3_;
	_tmp4_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp4_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp4_, 24);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp4_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp4_, 24);
	gtk_widget_set_halign ((GtkWidget*) _tmp4_, GTK_ALIGN_CENTER);
	gtk_widget_set_valign ((GtkWidget*) _tmp4_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp4_);
	_data7_->box = _tmp4_;
	_tmp5_ = _data7_->box;
	_tmp6_ = button;
	gtk_box_append (_tmp5_, (GtkWidget*) _tmp6_);
	_tmp7_ = overlay;
	_tmp8_ = _data7_->box;
	gtk_overlay_add_overlay (_tmp7_, (GtkWidget*) _tmp8_);
	_tmp9_ = overlay;
	_tmp10_ = _data7_->toast;
	gtk_overlay_add_overlay (_tmp9_, (GtkWidget*) _tmp10_);
	_tmp11_ = overlay;
	_tmp12_ = _data7_->toast;
	gtk_overlay_set_measure_overlay (_tmp11_, (GtkWidget*) _tmp12_, TRUE);
	_tmp13_ = button;
	g_signal_connect_data (_tmp13_, "clicked", (GCallback) __toast_view___lambda11__gtk_button_clicked, block7_data_ref (_data7_), (GClosureNotify) block7_data_unref, 0);
	_tmp14_ = _data7_->toast;
	g_signal_connect_data (_tmp14_, "default-action", (GCallback) __toast_view___lambda12__granite_toast_default_action, block7_data_ref (_data7_), (GClosureNotify) block7_data_unref, 0);
	_tmp15_ = overlay;
	demo_page_set_child ((DemoPage*) self, (GtkWidget*) _tmp15_);
	_g_object_unref0 (button);
	_g_object_unref0 (overlay);
	block7_data_unref (_data7_);
	_data7_ = NULL;
	return obj;
}

static void
toast_view_class_init (ToastViewClass * klass,
                       gpointer klass_data)
{
	toast_view_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = toast_view_constructor;
}

static void
toast_view_instance_init (ToastView * self,
                          gpointer klass)
{
}

static GType
toast_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ToastViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) toast_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ToastView), 0, (GInstanceInitFunc) toast_view_instance_init, NULL };
	GType toast_view_type_id;
	toast_view_type_id = g_type_register_static (TYPE_DEMO_PAGE, "ToastView", &g_define_type_info, 0);
	return toast_view_type_id;
}

GType
toast_view_get_type (void)
{
	static volatile gsize toast_view_type_id__once = 0;
	if (g_once_init_enter (&toast_view_type_id__once)) {
		GType toast_view_type_id;
		toast_view_type_id = toast_view_get_type_once ();
		g_once_init_leave (&toast_view_type_id__once, toast_view_type_id);
	}
	return toast_view_type_id__once;
}

