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

/*
 * Copyright 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 <gio/gio.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_WELCOME_VIEW (welcome_view_get_type ())
#define WELCOME_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_WELCOME_VIEW, WelcomeView))
#define WELCOME_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_WELCOME_VIEW, WelcomeViewClass))
#define IS_WELCOME_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_WELCOME_VIEW))
#define IS_WELCOME_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_WELCOME_VIEW))
#define WELCOME_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_WELCOME_VIEW, WelcomeViewClass))

typedef struct _WelcomeView WelcomeView;
typedef struct _WelcomeViewClass WelcomeViewClass;
typedef struct _WelcomeViewPrivate WelcomeViewPrivate;
enum  {
	WELCOME_VIEW_0_PROPERTY,
	WELCOME_VIEW_NUM_PROPERTIES
};
static GParamSpec* welcome_view_properties[WELCOME_VIEW_NUM_PROPERTIES];
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _WelcomeView {
	GtkGrid parent_instance;
	WelcomeViewPrivate * priv;
};

struct _WelcomeViewClass {
	GtkGridClass parent_class;
};

static gpointer welcome_view_parent_class = NULL;

VALA_EXTERN GType welcome_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WelcomeView, g_object_unref)
VALA_EXTERN WelcomeView* welcome_view_new (void);
VALA_EXTERN WelcomeView* welcome_view_construct (GType object_type);
static GObject * welcome_view_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties);
static void _welcome_view___lambda29_ (WelcomeView* self,
                                gint index);
static void __welcome_view___lambda29__granite_widgets_welcome_activated (GraniteWidgetsWelcome* _sender,
                                                                   gint index,
                                                                   gpointer self);
static GType welcome_view_get_type_once (void);

WelcomeView*
welcome_view_construct (GType object_type)
{
	WelcomeView * self = NULL;
	self = (WelcomeView*) g_object_new (object_type, NULL);
	return self;
}

WelcomeView*
welcome_view_new (void)
{
	return welcome_view_construct (TYPE_WELCOME_VIEW);
}

static void
_welcome_view___lambda29_ (WelcomeView* self,
                           gint index)
{
	GError* _inner_error0_ = NULL;
	switch (index) {
		case 0:
		{
			{
				g_app_info_launch_default_for_uri ("https://valadoc.org/granite/Granite.html", NULL, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
			}
			goto __finally0;
			__catch0_g_error:
			{
				GError* e = NULL;
				GError* _tmp0_;
				const gchar* _tmp1_;
				e = _inner_error0_;
				_inner_error0_ = NULL;
				_tmp0_ = e;
				_tmp1_ = _tmp0_->message;
				g_warning ("WelcomeView.vala:20: %s", _tmp1_);
				_g_error_free0 (e);
			}
			__finally0:
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
			break;
		}
		case 1:
		{
			{
				g_app_info_launch_default_for_uri ("https://github.com/elementary/granite", NULL, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch1_g_error;
				}
			}
			goto __finally1;
			__catch1_g_error:
			{
				GError* e = NULL;
				GError* _tmp2_;
				const gchar* _tmp3_;
				e = _inner_error0_;
				_inner_error0_ = NULL;
				_tmp2_ = e;
				_tmp3_ = _tmp2_->message;
				g_warning ("WelcomeView.vala:28: %s", _tmp3_);
				_g_error_free0 (e);
			}
			__finally1:
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
			break;
		}
		default:
		break;
	}
}

static void
__welcome_view___lambda29__granite_widgets_welcome_activated (GraniteWidgetsWelcome* _sender,
                                                              gint index,
                                                              gpointer self)
{
	_welcome_view___lambda29_ ((WelcomeView*) self, index);
}

static GObject *
welcome_view_constructor (GType type,
                          guint n_construct_properties,
                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WelcomeView * self;
	GraniteWidgetsWelcome* welcome = NULL;
	GraniteWidgetsWelcome* _tmp0_;
	GraniteWidgetsWelcome* _tmp1_;
	GraniteWidgetsWelcome* _tmp2_;
	GraniteWidgetsWelcome* _tmp3_;
	GraniteWidgetsWelcome* _tmp4_;
	parent_class = G_OBJECT_CLASS (welcome_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_WELCOME_VIEW, WelcomeView);
	_tmp0_ = granite_widgets_welcome_new ("Granite Demo", "This is a demo of the Granite library.");
	g_object_ref_sink (_tmp0_);
	welcome = _tmp0_;
	_tmp1_ = welcome;
	granite_widgets_welcome_append (_tmp1_, "text-x-vala", "Visit Valadoc", "The canonical source for Vala API references.");
	_tmp2_ = welcome;
	granite_widgets_welcome_append (_tmp2_, "text-x-source", "Get Granite Source", "Granite's source code is hosted on GitHub.");
	_tmp3_ = welcome;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp3_);
	_tmp4_ = welcome;
	g_signal_connect_object (_tmp4_, "activated", (GCallback) __welcome_view___lambda29__granite_widgets_welcome_activated, self, 0);
	_g_object_unref0 (welcome);
	return obj;
}

static void
welcome_view_class_init (WelcomeViewClass * klass,
                         gpointer klass_data)
{
	welcome_view_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = welcome_view_constructor;
}

static void
welcome_view_instance_init (WelcomeView * self,
                            gpointer klass)
{
}

static GType
welcome_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WelcomeViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) welcome_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WelcomeView), 0, (GInstanceInitFunc) welcome_view_instance_init, NULL };
	GType welcome_view_type_id;
	welcome_view_type_id = g_type_register_static (gtk_grid_get_type (), "WelcomeView", &g_define_type_info, 0);
	return welcome_view_type_id;
}

GType
welcome_view_get_type (void)
{
	static volatile gsize welcome_view_type_id__once = 0;
	if (g_once_init_enter (&welcome_view_type_id__once)) {
		GType welcome_view_type_id;
		welcome_view_type_id = welcome_view_get_type_once ();
		g_once_init_leave (&welcome_view_type_id__once, welcome_view_type_id);
	}
	return welcome_view_type_id__once;
}

