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

/*
 * Copyright 2020 elementary, Inc. (https://elementary.io)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Marius Meisenzahl <mariusmeisenzahl@gmail.com>
 *
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <granite-7.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_MAIN_WINDOW (main_window_get_type ())
#define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
#define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
#define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
#define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
#define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;
typedef struct _MainWindowPrivate MainWindowPrivate;
enum  {
	MAIN_WINDOW_0_PROPERTY,
	MAIN_WINDOW_NUM_PROPERTIES
};
static GParamSpec* main_window_properties[MAIN_WINDOW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _Block2Data Block2Data;

struct _MainWindow {
	GtkApplicationWindow parent_instance;
	MainWindowPrivate * priv;
};

struct _MainWindowClass {
	GtkApplicationWindowClass parent_class;
};

struct _MainWindowPrivate {
	GtkEntry* title_entry;
	GtkEntry* body_entry;
	GtkEntry* icon_entry;
	GtkEntry* id_entry;
	GtkDropDown* priority_dropdown;
	GtkSpinButton* action_spinbutton;
};

struct _Block2Data {
	int _ref_count_;
	MainWindow* self;
	GraniteToast* toast;
};

static gint MainWindow_private_offset;
static gpointer main_window_parent_class = NULL;

VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
VALA_EXTERN MainWindow* main_window_new (GtkApplication* application);
VALA_EXTERN MainWindow* main_window_construct (GType object_type,
                                   GtkApplication* application);
static void main_window_send_notification (MainWindow* self);
static GObject * main_window_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void _main_window_send_notification_gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self);
static void _main_window___lambda5_ (Block2Data* _data2_,
                              GVariant* parameter);
static void __main_window___lambda5__g_simple_action_activate (GSimpleAction* _sender,
                                                        GVariant* parameter,
                                                        gpointer self);
static void main_window_finalize (GObject * obj);
static GType main_window_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
main_window_get_instance_private (MainWindow* self)
{
	return G_STRUCT_MEMBER_P (self, MainWindow_private_offset);
}

MainWindow*
main_window_construct (GType object_type,
                       GtkApplication* application)
{
	MainWindow * self = NULL;
	g_return_val_if_fail (application != NULL, NULL);
	self = (MainWindow*) g_object_new (object_type, "application", application, NULL);
	return self;
}

MainWindow*
main_window_new (GtkApplication* application)
{
	return main_window_construct (TYPE_MAIN_WINDOW, application);
}

static void
main_window_send_notification (MainWindow* self)
{
	GNotificationPriority priority = 0;
	GtkDropDown* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	GNotification* notification = NULL;
	GtkEntry* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	GNotification* _tmp6_;
	GNotification* _tmp7_;
	GtkEntry* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	GNotification* _tmp11_;
	const gchar* _tmp25_ = NULL;
	GtkEntry* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	gchar* id = NULL;
	gchar* _tmp34_;
	GtkEntry* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	GtkApplication* _tmp44_;
	GtkApplication* _tmp45_;
	const gchar* _tmp46_;
	GNotification* _tmp47_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->priority_dropdown;
	_tmp1_ = gtk_drop_down_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	switch (_tmp2_) {
		case 3:
		{
			priority = G_NOTIFICATION_PRIORITY_URGENT;
			break;
		}
		case 2:
		{
			priority = G_NOTIFICATION_PRIORITY_HIGH;
			break;
		}
		case 0:
		{
			priority = G_NOTIFICATION_PRIORITY_LOW;
			break;
		}
		default:
		case 1:
		{
			priority = G_NOTIFICATION_PRIORITY_NORMAL;
			break;
		}
	}
	_tmp3_ = self->priv->title_entry;
	_tmp4_ = gtk_editable_get_text ((GtkEditable*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_notification_new (_tmp5_);
	notification = _tmp6_;
	_tmp7_ = notification;
	_tmp8_ = self->priv->body_entry;
	_tmp9_ = gtk_editable_get_text ((GtkEditable*) _tmp8_);
	_tmp10_ = _tmp9_;
	g_notification_set_body (_tmp7_, _tmp10_);
	_tmp11_ = notification;
	g_notification_set_priority (_tmp11_, priority);
	{
		gint i = 0;
		i = 1;
		{
			gboolean _tmp12_ = FALSE;
			_tmp12_ = TRUE;
			while (TRUE) {
				GtkSpinButton* _tmp14_;
				gdouble _tmp15_;
				gdouble _tmp16_;
				gchar* title = NULL;
				gchar* _tmp17_;
				GNotification* _tmp18_;
				const gchar* _tmp19_;
				const gchar* _tmp20_;
				GVariant* _tmp21_;
				GVariant* _tmp22_;
				gchar* _tmp23_;
				gchar* _tmp24_;
				if (!_tmp12_) {
					gint _tmp13_;
					_tmp13_ = i;
					i = _tmp13_ + 1;
				}
				_tmp12_ = FALSE;
				_tmp14_ = self->priv->action_spinbutton;
				_tmp15_ = gtk_spin_button_get_value (_tmp14_);
				_tmp16_ = _tmp15_;
				if (!(((gdouble) i) <= _tmp16_)) {
					break;
				}
				_tmp17_ = g_strdup_printf ("Action %i", i);
				title = _tmp17_;
				_tmp18_ = notification;
				_tmp19_ = title;
				_tmp20_ = title;
				_tmp21_ = g_variant_new ("s", _tmp20_, NULL);
				g_variant_ref_sink (_tmp21_);
				_tmp22_ = _tmp21_;
				_tmp23_ = g_action_print_detailed_name ("app.toast", _tmp22_);
				_tmp24_ = _tmp23_;
				g_notification_add_button (_tmp18_, _tmp19_, _tmp24_);
				_g_free0 (_tmp24_);
				_g_variant_unref0 (_tmp22_);
				_g_free0 (title);
			}
		}
	}
	_tmp26_ = self->priv->id_entry;
	_tmp27_ = gtk_editable_get_text ((GtkEditable*) _tmp26_);
	_tmp28_ = _tmp27_;
	_tmp29_ = strlen (_tmp28_);
	_tmp30_ = _tmp29_;
	if (_tmp30_ == 0) {
		_tmp25_ = NULL;
	} else {
		GtkEntry* _tmp31_;
		const gchar* _tmp32_;
		const gchar* _tmp33_;
		_tmp31_ = self->priv->id_entry;
		_tmp32_ = gtk_editable_get_text ((GtkEditable*) _tmp31_);
		_tmp33_ = _tmp32_;
		_tmp25_ = _tmp33_;
	}
	_tmp34_ = g_strdup (_tmp25_);
	id = _tmp34_;
	_tmp35_ = self->priv->icon_entry;
	_tmp36_ = gtk_editable_get_text ((GtkEditable*) _tmp35_);
	_tmp37_ = _tmp36_;
	if (g_strcmp0 (_tmp37_, "") != 0) {
		GNotification* _tmp38_;
		GtkEntry* _tmp39_;
		const gchar* _tmp40_;
		const gchar* _tmp41_;
		GThemedIcon* _tmp42_;
		GThemedIcon* _tmp43_;
		_tmp38_ = notification;
		_tmp39_ = self->priv->icon_entry;
		_tmp40_ = gtk_editable_get_text ((GtkEditable*) _tmp39_);
		_tmp41_ = _tmp40_;
		_tmp42_ = (GThemedIcon*) g_themed_icon_new (_tmp41_);
		_tmp43_ = _tmp42_;
		g_notification_set_icon (_tmp38_, (GIcon*) _tmp43_);
		_g_object_unref0 (_tmp43_);
	}
	_tmp44_ = gtk_window_get_application ((GtkWindow*) self);
	_tmp45_ = _tmp44_;
	_tmp46_ = id;
	_tmp47_ = notification;
	g_application_send_notification ((GApplication*) _tmp45_, _tmp46_, _tmp47_);
	_g_free0 (id);
	_g_object_unref0 (notification);
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		MainWindow* self;
		self = _data2_->self;
		_g_object_unref0 (_data2_->toast);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

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

static void
_main_window_send_notification_gtk_button_clicked (GtkButton* _sender,
                                                   gpointer self)
{
	main_window_send_notification ((MainWindow*) self);
}

static void
_main_window___lambda5_ (Block2Data* _data2_,
                         GVariant* parameter)
{
	MainWindow* self;
	GraniteToast* _tmp0_;
	const gchar* _tmp1_;
	GraniteToast* _tmp2_;
	self = _data2_->self;
	_tmp0_ = _data2_->toast;
	_tmp1_ = g_variant_get_string (parameter, NULL);
	granite_toast_set_title (_tmp0_, _tmp1_);
	_tmp2_ = _data2_->toast;
	granite_toast_send_notification (_tmp2_);
}

static void
__main_window___lambda5__g_simple_action_activate (GSimpleAction* _sender,
                                                   GVariant* parameter,
                                                   gpointer self)
{
	_main_window___lambda5_ (self, parameter);
}

static GObject *
main_window_constructor (GType type,
                         guint n_construct_properties,
                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	MainWindow * self;
	Block2Data* _data2_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	GtkEntry* _tmp2_ = NULL;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GtkEntry* _tmp5_ = NULL;
	gchar* _tmp6_;
	GtkEntry* _tmp7_ = NULL;
	gchar* _tmp8_;
	GtkEntry* _tmp9_ = NULL;
	GtkLabel* priority_label = NULL;
	GtkLabel* _tmp10_;
	gchar** priorities = NULL;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar** _tmp15_;
	gint priorities_length1;
	gint _priorities_size_;
	gchar** _tmp16_;
	gint _tmp16__length1;
	GtkDropDown* _tmp17_ = NULL;
	GtkLabel* action_label = NULL;
	GtkLabel* _tmp18_;
	GtkSpinButton* _tmp19_;
	GtkButton* send_button = NULL;
	GtkButton* _tmp20_ = NULL;
	GtkButton* _tmp21_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp22_ = NULL;
	GtkGrid* _tmp23_;
	GtkEntry* _tmp24_;
	GtkGrid* _tmp25_;
	GtkEntry* _tmp26_;
	GtkGrid* _tmp27_;
	GtkEntry* _tmp28_;
	GtkGrid* _tmp29_;
	GtkEntry* _tmp30_;
	GtkGrid* _tmp31_;
	GtkLabel* _tmp32_;
	GtkGrid* _tmp33_;
	GtkDropDown* _tmp34_;
	GtkGrid* _tmp35_;
	GtkLabel* _tmp36_;
	GtkGrid* _tmp37_;
	GtkSpinButton* _tmp38_;
	GtkGrid* _tmp39_;
	GtkButton* _tmp40_;
	GraniteToast* _tmp41_;
	GtkOverlay* overlay = NULL;
	GtkGrid* _tmp42_;
	GtkWidget* _tmp43_;
	GtkOverlay* _tmp44_ = NULL;
	GtkOverlay* _tmp45_;
	GraniteToast* _tmp46_;
	GtkOverlay* _tmp47_;
	GtkButton* _tmp48_;
	GtkButton* _tmp49_;
	GSimpleAction* toast_action = NULL;
	const GVariantType* _tmp50_;
	GSimpleAction* _tmp51_;
	GApplication* _tmp52_;
	GSimpleAction* _tmp53_;
	GSimpleAction* _tmp54_;
	parent_class = G_OBJECT_CLASS (main_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW, MainWindow);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_data2_->self = g_object_ref (self);
	gtk_window_set_title ((GtkWindow*) self, "Notifications Demo");
	g_object_set ((GtkWindow*) self, "default-width", 400, NULL);
	_tmp0_ = g_strdup ("Title");
	_tmp1_ = g_strdup ("Title");
	_tmp2_ = (GtkEntry*) gtk_entry_new ();
	gtk_entry_set_activates_default (_tmp2_, TRUE);
	gtk_entry_set_placeholder_text (_tmp2_, _tmp0_);
	_g_free0 (_tmp0_);
	gtk_editable_set_text ((GtkEditable*) _tmp2_, _tmp1_);
	_g_free0 (_tmp1_);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->title_entry);
	self->priv->title_entry = _tmp2_;
	_tmp3_ = g_strdup ("Body");
	_tmp4_ = g_strdup ("Body");
	_tmp5_ = (GtkEntry*) gtk_entry_new ();
	gtk_entry_set_activates_default (_tmp5_, TRUE);
	gtk_entry_set_placeholder_text (_tmp5_, _tmp3_);
	_g_free0 (_tmp3_);
	gtk_editable_set_text ((GtkEditable*) _tmp5_, _tmp4_);
	_g_free0 (_tmp4_);
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->body_entry);
	self->priv->body_entry = _tmp5_;
	_tmp6_ = g_strdup ("Replaces Id");
	_tmp7_ = (GtkEntry*) gtk_entry_new ();
	gtk_entry_set_activates_default (_tmp7_, TRUE);
	gtk_entry_set_placeholder_text (_tmp7_, _tmp6_);
	_g_free0 (_tmp6_);
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->id_entry);
	self->priv->id_entry = _tmp7_;
	_tmp8_ = g_strdup ("Badge Icon Name");
	_tmp9_ = (GtkEntry*) gtk_entry_new ();
	gtk_entry_set_activates_default (_tmp9_, TRUE);
	gtk_entry_set_placeholder_text (_tmp9_, _tmp8_);
	_g_free0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->icon_entry);
	self->priv->icon_entry = _tmp9_;
	_tmp10_ = (GtkLabel*) gtk_label_new ("Priority:");
	g_object_ref_sink (_tmp10_);
	priority_label = _tmp10_;
	_tmp11_ = g_strdup ("Low");
	_tmp12_ = g_strdup ("Normal");
	_tmp13_ = g_strdup ("High");
	_tmp14_ = g_strdup ("Urgent");
	_tmp15_ = g_new0 (gchar*, 4 + 1);
	_tmp15_[0] = _tmp11_;
	_tmp15_[1] = _tmp12_;
	_tmp15_[2] = _tmp13_;
	_tmp15_[3] = _tmp14_;
	priorities = _tmp15_;
	priorities_length1 = 4;
	_priorities_size_ = priorities_length1;
	_tmp16_ = priorities;
	_tmp16__length1 = priorities_length1;
	_tmp17_ = (GtkDropDown*) gtk_drop_down_new_from_strings (_tmp16_);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp17_, TRUE);
	gtk_drop_down_set_selected (_tmp17_, (guint) 1);
	g_object_ref_sink (_tmp17_);
	_g_object_unref0 (self->priv->priority_dropdown);
	self->priv->priority_dropdown = _tmp17_;
	_tmp18_ = (GtkLabel*) gtk_label_new ("Actions:");
	g_object_ref_sink (_tmp18_);
	action_label = _tmp18_;
	_tmp19_ = (GtkSpinButton*) gtk_spin_button_new_with_range ((gdouble) 0, (gdouble) 3, (gdouble) 1);
	g_object_ref_sink (_tmp19_);
	_g_object_unref0 (self->priv->action_spinbutton);
	self->priv->action_spinbutton = _tmp19_;
	_tmp20_ = (GtkButton*) gtk_button_new_with_label ("Send Notification");
	gtk_widget_set_halign ((GtkWidget*) _tmp20_, GTK_ALIGN_END);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp20_, 12);
	g_object_ref_sink (_tmp20_);
	send_button = _tmp20_;
	_tmp21_ = send_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp21_, GRANITE_CSS_CLASS_SUGGESTED);
	_tmp22_ = (GtkGrid*) gtk_grid_new ();
	gtk_widget_set_valign ((GtkWidget*) _tmp22_, GTK_ALIGN_CENTER);
	gtk_grid_set_column_spacing (_tmp22_, 12);
	gtk_grid_set_row_spacing (_tmp22_, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp22_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp22_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp22_, 12);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp22_, 12);
	g_object_ref_sink (_tmp22_);
	grid = _tmp22_;
	_tmp23_ = grid;
	_tmp24_ = self->priv->title_entry;
	gtk_grid_attach (_tmp23_, (GtkWidget*) _tmp24_, 0, 0, 2, 1);
	_tmp25_ = grid;
	_tmp26_ = self->priv->body_entry;
	gtk_grid_attach (_tmp25_, (GtkWidget*) _tmp26_, 0, 1, 2, 1);
	_tmp27_ = grid;
	_tmp28_ = self->priv->id_entry;
	gtk_grid_attach (_tmp27_, (GtkWidget*) _tmp28_, 0, 2, 2, 1);
	_tmp29_ = grid;
	_tmp30_ = self->priv->icon_entry;
	gtk_grid_attach (_tmp29_, (GtkWidget*) _tmp30_, 0, 3, 2, 1);
	_tmp31_ = grid;
	_tmp32_ = priority_label;
	gtk_grid_attach (_tmp31_, (GtkWidget*) _tmp32_, 0, 4, 1, 1);
	_tmp33_ = grid;
	_tmp34_ = self->priv->priority_dropdown;
	gtk_grid_attach (_tmp33_, (GtkWidget*) _tmp34_, 1, 4, 1, 1);
	_tmp35_ = grid;
	_tmp36_ = action_label;
	gtk_grid_attach (_tmp35_, (GtkWidget*) _tmp36_, 0, 5, 1, 1);
	_tmp37_ = grid;
	_tmp38_ = self->priv->action_spinbutton;
	gtk_grid_attach (_tmp37_, (GtkWidget*) _tmp38_, 1, 5, 1, 1);
	_tmp39_ = grid;
	_tmp40_ = send_button;
	gtk_grid_attach (_tmp39_, (GtkWidget*) _tmp40_, 0, 6, 2, 1);
	_tmp41_ = granite_toast_new ("");
	g_object_ref_sink (_tmp41_);
	_data2_->toast = _tmp41_;
	_tmp42_ = grid;
	_tmp43_ = _g_object_ref0 ((GtkWidget*) _tmp42_);
	_tmp44_ = (GtkOverlay*) gtk_overlay_new ();
	gtk_overlay_set_child (_tmp44_, _tmp43_);
	_g_object_unref0 (_tmp43_);
	g_object_ref_sink (_tmp44_);
	overlay = _tmp44_;
	_tmp45_ = overlay;
	_tmp46_ = _data2_->toast;
	gtk_overlay_add_overlay (_tmp45_, (GtkWidget*) _tmp46_);
	_tmp47_ = overlay;
	gtk_window_set_child ((GtkWindow*) self, (GtkWidget*) _tmp47_);
	_tmp48_ = send_button;
	gtk_window_set_default_widget ((GtkWindow*) self, (GtkWidget*) _tmp48_);
	_tmp49_ = send_button;
	g_signal_connect_object (_tmp49_, "clicked", (GCallback) _main_window_send_notification_gtk_button_clicked, self, 0);
	_tmp50_ = G_VARIANT_TYPE_STRING;
	_tmp51_ = g_simple_action_new ("toast", _tmp50_);
	toast_action = _tmp51_;
	_tmp52_ = g_application_get_default ();
	_tmp53_ = toast_action;
	g_action_map_add_action ((GActionMap*) _tmp52_, (GAction*) _tmp53_);
	_tmp54_ = toast_action;
	g_signal_connect_data (_tmp54_, "activate", (GCallback) __main_window___lambda5__g_simple_action_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
	_g_object_unref0 (toast_action);
	_g_object_unref0 (overlay);
	_g_object_unref0 (grid);
	_g_object_unref0 (send_button);
	_g_object_unref0 (action_label);
	priorities = (_vala_array_free (priorities, priorities_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (priority_label);
	block2_data_unref (_data2_);
	_data2_ = NULL;
	return obj;
}

static void
main_window_class_init (MainWindowClass * klass,
                        gpointer klass_data)
{
	main_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MainWindow_private_offset);
	G_OBJECT_CLASS (klass)->constructor = main_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = main_window_finalize;
}

static void
main_window_instance_init (MainWindow * self,
                           gpointer klass)
{
	self->priv = main_window_get_instance_private (self);
}

static void
main_window_finalize (GObject * obj)
{
	MainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW, MainWindow);
	_g_object_unref0 (self->priv->title_entry);
	_g_object_unref0 (self->priv->body_entry);
	_g_object_unref0 (self->priv->icon_entry);
	_g_object_unref0 (self->priv->id_entry);
	_g_object_unref0 (self->priv->priority_dropdown);
	_g_object_unref0 (self->priv->action_spinbutton);
	G_OBJECT_CLASS (main_window_parent_class)->finalize (obj);
}

static GType
main_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MainWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) main_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MainWindow), 0, (GInstanceInitFunc) main_window_instance_init, NULL };
	GType main_window_type_id;
	main_window_type_id = g_type_register_static (gtk_application_window_get_type (), "MainWindow", &g_define_type_info, 0);
	MainWindow_private_offset = g_type_add_instance_private (main_window_type_id, sizeof (MainWindowPrivate));
	return main_window_type_id;
}

GType
main_window_get_type (void)
{
	static volatile gsize main_window_type_id__once = 0;
	if (g_once_init_enter (&main_window_type_id__once)) {
		GType main_window_type_id;
		main_window_type_id = main_window_get_type_once ();
		g_once_init_leave (&main_window_type_id__once, main_window_type_id);
	}
	return main_window_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

