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

/*-
 * Copyright 2019-2023 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, see <http://www.gnu.org/licenses/>.
 */

#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <granite-7.h>
#include <gio/gdesktopappinfo.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 ONBOARDING_TYPE_ABSTRACT_ONBOARDING_VIEW (onboarding_abstract_onboarding_view_get_type ())
#define ONBOARDING_ABSTRACT_ONBOARDING_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ONBOARDING_TYPE_ABSTRACT_ONBOARDING_VIEW, OnboardingAbstractOnboardingView))
#define ONBOARDING_ABSTRACT_ONBOARDING_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ONBOARDING_TYPE_ABSTRACT_ONBOARDING_VIEW, OnboardingAbstractOnboardingViewClass))
#define ONBOARDING_IS_ABSTRACT_ONBOARDING_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ONBOARDING_TYPE_ABSTRACT_ONBOARDING_VIEW))
#define ONBOARDING_IS_ABSTRACT_ONBOARDING_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ONBOARDING_TYPE_ABSTRACT_ONBOARDING_VIEW))
#define ONBOARDING_ABSTRACT_ONBOARDING_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ONBOARDING_TYPE_ABSTRACT_ONBOARDING_VIEW, OnboardingAbstractOnboardingViewClass))

typedef struct _OnboardingAbstractOnboardingView OnboardingAbstractOnboardingView;
typedef struct _OnboardingAbstractOnboardingViewClass OnboardingAbstractOnboardingViewClass;
typedef struct _OnboardingAbstractOnboardingViewPrivate OnboardingAbstractOnboardingViewPrivate;

#define ONBOARDING_TYPE_APP_CENTER_VIEW (onboarding_app_center_view_get_type ())
#define ONBOARDING_APP_CENTER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ONBOARDING_TYPE_APP_CENTER_VIEW, OnboardingAppCenterView))
#define ONBOARDING_APP_CENTER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ONBOARDING_TYPE_APP_CENTER_VIEW, OnboardingAppCenterViewClass))
#define ONBOARDING_IS_APP_CENTER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ONBOARDING_TYPE_APP_CENTER_VIEW))
#define ONBOARDING_IS_APP_CENTER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ONBOARDING_TYPE_APP_CENTER_VIEW))
#define ONBOARDING_APP_CENTER_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ONBOARDING_TYPE_APP_CENTER_VIEW, OnboardingAppCenterViewClass))

typedef struct _OnboardingAppCenterView OnboardingAppCenterView;
typedef struct _OnboardingAppCenterViewClass OnboardingAppCenterViewClass;
typedef struct _OnboardingAppCenterViewPrivate OnboardingAppCenterViewPrivate;
enum  {
	ONBOARDING_APP_CENTER_VIEW_0_PROPERTY,
	ONBOARDING_APP_CENTER_VIEW_NUM_PROPERTIES
};
static GParamSpec* onboarding_app_center_view_properties[ONBOARDING_APP_CENTER_VIEW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _OnboardingAbstractOnboardingView {
	AdwNavigationPage parent_instance;
	OnboardingAbstractOnboardingViewPrivate * priv;
};

struct _OnboardingAbstractOnboardingViewClass {
	AdwNavigationPageClass parent_class;
};

struct _OnboardingAppCenterView {
	OnboardingAbstractOnboardingView parent_instance;
	OnboardingAppCenterViewPrivate * priv;
};

struct _OnboardingAppCenterViewClass {
	OnboardingAbstractOnboardingViewClass parent_class;
};

static gpointer onboarding_app_center_view_parent_class = NULL;

VALA_EXTERN GType onboarding_abstract_onboarding_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OnboardingAbstractOnboardingView, g_object_unref)
VALA_EXTERN GType onboarding_app_center_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OnboardingAppCenterView, g_object_unref)
VALA_EXTERN OnboardingAppCenterView* onboarding_app_center_view_new (void);
VALA_EXTERN OnboardingAppCenterView* onboarding_app_center_view_construct (GType object_type);
static GObject * onboarding_app_center_view_constructor (GType type,
                                                  guint n_construct_properties,
                                                  GObjectConstructParam * construct_properties);
VALA_EXTERN GraniteBox* onboarding_abstract_onboarding_view_get_custom_bin (OnboardingAbstractOnboardingView* self);
static void _onboarding_app_center_view___lambda12_ (OnboardingAppCenterView* self);
static void __onboarding_app_center_view___lambda12__gtk_button_clicked (GtkButton* _sender,
                                                                  gpointer self);
static void _onboarding_app_center_view___lambda13_ (OnboardingAppCenterView* self);
static void __onboarding_app_center_view___lambda13__gtk_button_clicked (GtkButton* _sender,
                                                                  gpointer self);
static GType onboarding_app_center_view_get_type_once (void);

OnboardingAppCenterView*
onboarding_app_center_view_construct (GType object_type)
{
	OnboardingAppCenterView * self = NULL;
	self = (OnboardingAppCenterView*) g_object_new (object_type, "view-name", "appcenter", "description", _ ("Get the apps you need on AppCenter or sideload Flatpak apps from alter" \
"native stores."), "icon-name", "system-software-install", "title", _ ("Get Some Apps"), NULL);
	return self;
}

OnboardingAppCenterView*
onboarding_app_center_view_new (void)
{
	return onboarding_app_center_view_construct (ONBOARDING_TYPE_APP_CENTER_VIEW);
}

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

static void
_onboarding_app_center_view___lambda12_ (OnboardingAppCenterView* self)
{
	GError* _inner_error0_ = NULL;
	{
		GDesktopAppInfo* appcenter = NULL;
		GDesktopAppInfo* _tmp0_;
		GDesktopAppInfo* _tmp1_;
		_tmp0_ = g_desktop_app_info_new ("io.elementary.appcenter.desktop");
		appcenter = _tmp0_;
		_tmp1_ = appcenter;
		g_app_info_launch ((GAppInfo*) _tmp1_, NULL, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (appcenter);
			goto __catch0_g_error;
		}
		_g_object_unref0 (appcenter);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp2_;
		const gchar* _tmp3_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = e;
		_tmp3_ = _tmp2_->message;
		g_critical ("AppCenterView.vala:73: %s", _tmp3_);
		_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;
	}
}

static void
__onboarding_app_center_view___lambda12__gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self)
{
	_onboarding_app_center_view___lambda12_ ((OnboardingAppCenterView*) self);
}

static void
_onboarding_app_center_view___lambda13_ (OnboardingAppCenterView* self)
{
	GError* _inner_error0_ = NULL;
	{
		g_app_info_launch_default_for_uri ("https://flathub.org", 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_critical ("AppCenterView.vala:81: %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;
	}
}

static void
__onboarding_app_center_view___lambda13__gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self)
{
	_onboarding_app_center_view___lambda13_ ((OnboardingAppCenterView*) self);
}

static GObject *
onboarding_app_center_view_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	OnboardingAppCenterView * self;
	GtkImage* appcenter_image = NULL;
	GtkImage* _tmp0_ = NULL;
	GtkLabel* appcenter_label = NULL;
	GtkLabel* _tmp1_ = NULL;
	GraniteBox* appcenter_box = NULL;
	GraniteBox* _tmp2_;
	GraniteBox* _tmp3_;
	GtkImage* _tmp4_;
	GraniteBox* _tmp5_;
	GtkLabel* _tmp6_;
	GtkButton* appcenter_button = NULL;
	GraniteBox* _tmp7_;
	GtkWidget* _tmp8_;
	GtkButton* _tmp9_ = NULL;
	GtkLabel* _tmp10_;
	GtkButton* _tmp11_;
	GtkImage* sideload_image = NULL;
	GtkImage* _tmp12_ = NULL;
	GtkLabel* sideload_label = NULL;
	GtkLabel* _tmp13_ = NULL;
	GraniteBox* sideload_box = NULL;
	GraniteBox* _tmp14_;
	GraniteBox* _tmp15_;
	GtkImage* _tmp16_;
	GraniteBox* _tmp17_;
	GtkLabel* _tmp18_;
	GtkButton* sideload_button = NULL;
	GraniteBox* _tmp19_;
	GtkWidget* _tmp20_;
	GtkButton* _tmp21_ = NULL;
	GtkLabel* _tmp22_;
	GtkButton* _tmp23_;
	GraniteBox* _tmp24_;
	GraniteBox* _tmp25_;
	GtkButton* _tmp26_;
	GraniteBox* _tmp27_;
	GraniteBox* _tmp28_;
	GtkButton* _tmp29_;
	GtkButton* _tmp30_;
	GtkButton* _tmp31_;
	parent_class = G_OBJECT_CLASS (onboarding_app_center_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ONBOARDING_TYPE_APP_CENTER_VIEW, OnboardingAppCenterView);
	_tmp0_ = (GtkImage*) gtk_image_new_from_icon_name ("io.elementary.appcenter");
	gtk_image_set_icon_size (_tmp0_, GTK_ICON_SIZE_LARGE);
	g_object_ref_sink (_tmp0_);
	appcenter_image = _tmp0_;
	_tmp1_ = (GtkLabel*) gtk_label_new (_ ("Get apps made for elementary OS and reviewed by elementary on AppCente" \
"r"));
	gtk_label_set_max_width_chars (_tmp1_, 35);
	gtk_label_set_wrap (_tmp1_, TRUE);
	g_object_ref_sink (_tmp1_);
	appcenter_label = _tmp1_;
	_tmp2_ = granite_box_new (GTK_ORIENTATION_HORIZONTAL, GRANITE_BOX_SPACING_HALF);
	g_object_ref_sink (_tmp2_);
	appcenter_box = _tmp2_;
	_tmp3_ = appcenter_box;
	_tmp4_ = appcenter_image;
	gtk_box_append ((GtkBox*) _tmp3_, (GtkWidget*) _tmp4_);
	_tmp5_ = appcenter_box;
	_tmp6_ = appcenter_label;
	gtk_box_append ((GtkBox*) _tmp5_, (GtkWidget*) _tmp6_);
	_tmp7_ = appcenter_box;
	_tmp8_ = _g_object_ref0 ((GtkWidget*) _tmp7_);
	_tmp9_ = (GtkButton*) gtk_button_new ();
	gtk_button_set_child (_tmp9_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	appcenter_button = _tmp9_;
	_tmp10_ = appcenter_label;
	_tmp11_ = appcenter_button;
	gtk_label_set_mnemonic_widget (_tmp10_, (GtkWidget*) _tmp11_);
	_tmp12_ = (GtkImage*) gtk_image_new_from_icon_name ("io.elementary.sideload");
	gtk_image_set_icon_size (_tmp12_, GTK_ICON_SIZE_LARGE);
	g_object_ref_sink (_tmp12_);
	sideload_image = _tmp12_;
	_tmp13_ = (GtkLabel*) gtk_label_new (_ ("Sideload apps from alternative app stores like Flathub"));
	gtk_label_set_max_width_chars (_tmp13_, 35);
	gtk_label_set_wrap (_tmp13_, TRUE);
	g_object_ref_sink (_tmp13_);
	sideload_label = _tmp13_;
	_tmp14_ = granite_box_new (GTK_ORIENTATION_HORIZONTAL, GRANITE_BOX_SPACING_HALF);
	g_object_ref_sink (_tmp14_);
	sideload_box = _tmp14_;
	_tmp15_ = sideload_box;
	_tmp16_ = sideload_image;
	gtk_box_append ((GtkBox*) _tmp15_, (GtkWidget*) _tmp16_);
	_tmp17_ = sideload_box;
	_tmp18_ = sideload_label;
	gtk_box_append ((GtkBox*) _tmp17_, (GtkWidget*) _tmp18_);
	_tmp19_ = sideload_box;
	_tmp20_ = _g_object_ref0 ((GtkWidget*) _tmp19_);
	_tmp21_ = (GtkButton*) gtk_button_new ();
	gtk_button_set_child (_tmp21_, _tmp20_);
	_g_object_unref0 (_tmp20_);
	g_object_ref_sink (_tmp21_);
	sideload_button = _tmp21_;
	_tmp22_ = sideload_label;
	_tmp23_ = sideload_button;
	gtk_label_set_mnemonic_widget (_tmp22_, (GtkWidget*) _tmp23_);
	_tmp24_ = onboarding_abstract_onboarding_view_get_custom_bin ((OnboardingAbstractOnboardingView*) self);
	_tmp25_ = _tmp24_;
	_tmp26_ = appcenter_button;
	gtk_box_append ((GtkBox*) _tmp25_, (GtkWidget*) _tmp26_);
	_tmp27_ = onboarding_abstract_onboarding_view_get_custom_bin ((OnboardingAbstractOnboardingView*) self);
	_tmp28_ = _tmp27_;
	_tmp29_ = sideload_button;
	gtk_box_append ((GtkBox*) _tmp28_, (GtkWidget*) _tmp29_);
	_tmp30_ = appcenter_button;
	g_signal_connect_object (_tmp30_, "clicked", (GCallback) __onboarding_app_center_view___lambda12__gtk_button_clicked, self, 0);
	_tmp31_ = sideload_button;
	g_signal_connect_object (_tmp31_, "clicked", (GCallback) __onboarding_app_center_view___lambda13__gtk_button_clicked, self, 0);
	_g_object_unref0 (sideload_button);
	_g_object_unref0 (sideload_box);
	_g_object_unref0 (sideload_label);
	_g_object_unref0 (sideload_image);
	_g_object_unref0 (appcenter_button);
	_g_object_unref0 (appcenter_box);
	_g_object_unref0 (appcenter_label);
	_g_object_unref0 (appcenter_image);
	return obj;
}

static void
onboarding_app_center_view_class_init (OnboardingAppCenterViewClass * klass,
                                       gpointer klass_data)
{
	onboarding_app_center_view_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = onboarding_app_center_view_constructor;
}

static void
onboarding_app_center_view_instance_init (OnboardingAppCenterView * self,
                                          gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
onboarding_app_center_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (OnboardingAppCenterViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) onboarding_app_center_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (OnboardingAppCenterView), 0, (GInstanceInitFunc) onboarding_app_center_view_instance_init, NULL };
	GType onboarding_app_center_view_type_id;
	onboarding_app_center_view_type_id = g_type_register_static (ONBOARDING_TYPE_ABSTRACT_ONBOARDING_VIEW, "OnboardingAppCenterView", &g_define_type_info, 0);
	return onboarding_app_center_view_type_id;
}

GType
onboarding_app_center_view_get_type (void)
{
	static volatile gsize onboarding_app_center_view_type_id__once = 0;
	if (g_once_init_enter (&onboarding_app_center_view_type_id__once)) {
		GType onboarding_app_center_view_type_id;
		onboarding_app_center_view_type_id = onboarding_app_center_view_get_type_once ();
		g_once_init_leave (&onboarding_app_center_view_type_id__once, onboarding_app_center_view_type_id);
	}
	return onboarding_app_center_view_type_id__once;
}

