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

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

#include <gtk/gtk.h>
#include <glib-object.h>
#include "granite.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_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 _Block15Data Block15Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

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

struct _ToastViewClass {
	GtkOverlayClass parent_class;
};

struct _Block15Data {
	int _ref_count_;
	ToastView* self;
	GraniteWidgetsToast* toast;
	GtkGrid* grid;
};

static gpointer toast_view_parent_class = NULL;

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);
static GObject * toast_view_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties);
static Block15Data* block15_data_ref (Block15Data* _data15_);
static void block15_data_unref (void * _userdata_);
static void _toast_view___lambda25_ (Block15Data* _data15_);
static void __toast_view___lambda25__gtk_button_clicked (GtkButton* _sender,
                                                  gpointer self);
static void _toast_view___lambda26_ (Block15Data* _data15_);
static void __toast_view___lambda26__granite_widgets_toast_default_action (GraniteWidgetsToast* _sender,
                                                                    gpointer self);
static GType toast_view_get_type_once (void);

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

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

static Block15Data*
block15_data_ref (Block15Data* _data15_)
{
	g_atomic_int_inc (&_data15_->_ref_count_);
	return _data15_;
}

static void
block15_data_unref (void * _userdata_)
{
	Block15Data* _data15_;
	_data15_ = (Block15Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data15_->_ref_count_)) {
		ToastView* self;
		self = _data15_->self;
		_g_object_unref0 (_data15_->grid);
		_g_object_unref0 (_data15_->toast);
		_g_object_unref0 (self);
		g_slice_free (Block15Data, _data15_);
	}
}

static void
_toast_view___lambda25_ (Block15Data* _data15_)
{
	ToastView* self;
	GraniteWidgetsToast* _tmp0_;
	self = _data15_->self;
	_tmp0_ = _data15_->toast;
	granite_widgets_toast_send_notification (_tmp0_);
}

static void
__toast_view___lambda25__gtk_button_clicked (GtkButton* _sender,
                                             gpointer self)
{
	_toast_view___lambda25_ (self);
}

static void
_toast_view___lambda26_ (Block15Data* _data15_)
{
	ToastView* self;
	GtkLabel* label = NULL;
	GtkLabel* _tmp0_;
	GraniteWidgetsToast* _tmp1_;
	GraniteWidgetsToast* _tmp2_;
	GtkGrid* _tmp3_;
	GtkLabel* _tmp4_;
	GtkGrid* _tmp5_;
	self = _data15_->self;
	_tmp0_ = (GtkLabel*) gtk_label_new (_ ("Did The Thing"));
	g_object_ref_sink (_tmp0_);
	label = _tmp0_;
	_tmp1_ = _data15_->toast;
	granite_widgets_toast_set_title (_tmp1_, _ ("Already did the thing"));
	_tmp2_ = _data15_->toast;
	granite_widgets_toast_set_default_action (_tmp2_, NULL);
	_tmp3_ = _data15_->grid;
	_tmp4_ = label;
	gtk_container_add ((GtkContainer*) _tmp3_, (GtkWidget*) _tmp4_);
	_tmp5_ = _data15_->grid;
	gtk_widget_show_all ((GtkWidget*) _tmp5_);
	_g_object_unref0 (label);
}

static void
__toast_view___lambda26__granite_widgets_toast_default_action (GraniteWidgetsToast* _sender,
                                                               gpointer self)
{
	_toast_view___lambda26_ (self);
}

static GObject *
toast_view_constructor (GType type,
                        guint n_construct_properties,
                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ToastView * self;
	Block15Data* _data15_;
	GraniteWidgetsToast* _tmp0_;
	GraniteWidgetsToast* _tmp1_;
	GtkButton* button = NULL;
	GtkButton* _tmp2_;
	GtkGrid* _tmp3_;
	GtkGrid* _tmp4_;
	GtkGrid* _tmp5_;
	GtkGrid* _tmp6_;
	GtkGrid* _tmp7_;
	GtkGrid* _tmp8_;
	GtkGrid* _tmp9_;
	GtkButton* _tmp10_;
	GtkGrid* _tmp11_;
	GraniteWidgetsToast* _tmp12_;
	GtkButton* _tmp13_;
	GraniteWidgetsToast* _tmp14_;
	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);
	_data15_ = g_slice_new0 (Block15Data);
	_data15_->_ref_count_ = 1;
	_data15_->self = g_object_ref (self);
	_tmp0_ = granite_widgets_toast_new (_ ("Button was pressed!"));
	g_object_ref_sink (_tmp0_);
	_data15_->toast = _tmp0_;
	_tmp1_ = _data15_->toast;
	granite_widgets_toast_set_default_action (_tmp1_, _ ("Do Things"));
	_tmp2_ = (GtkButton*) gtk_button_new_with_label (_ ("Press Me"));
	g_object_ref_sink (_tmp2_);
	button = _tmp2_;
	_tmp3_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp3_);
	_data15_->grid = _tmp3_;
	_tmp4_ = _data15_->grid;
	gtk_orientable_set_orientation ((GtkOrientable*) _tmp4_, GTK_ORIENTATION_VERTICAL);
	_tmp5_ = _data15_->grid;
	g_object_set ((GtkWidget*) _tmp5_, "margin", 24, NULL);
	_tmp6_ = _data15_->grid;
	gtk_widget_set_halign ((GtkWidget*) _tmp6_, GTK_ALIGN_CENTER);
	_tmp7_ = _data15_->grid;
	gtk_widget_set_valign ((GtkWidget*) _tmp7_, GTK_ALIGN_CENTER);
	_tmp8_ = _data15_->grid;
	gtk_grid_set_row_spacing (_tmp8_, 6);
	_tmp9_ = _data15_->grid;
	_tmp10_ = button;
	gtk_container_add ((GtkContainer*) _tmp9_, (GtkWidget*) _tmp10_);
	_tmp11_ = _data15_->grid;
	gtk_overlay_add_overlay ((GtkOverlay*) self, (GtkWidget*) _tmp11_);
	_tmp12_ = _data15_->toast;
	gtk_overlay_add_overlay ((GtkOverlay*) self, (GtkWidget*) _tmp12_);
	_tmp13_ = button;
	g_signal_connect_data (_tmp13_, "clicked", (GCallback) __toast_view___lambda25__gtk_button_clicked, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
	_tmp14_ = _data15_->toast;
	g_signal_connect_data (_tmp14_, "default-action", (GCallback) __toast_view___lambda26__granite_widgets_toast_default_action, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
	_g_object_unref0 (button);
	block15_data_unref (_data15_);
	_data15_ = 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 (gtk_overlay_get_type (), "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;
}

