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

/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: 2016-2023 elementary, Inc. (https://elementary.io)
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <granite-7.h>
#include <glib.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <glib/gi18n-lib.h>

#define ONBOARDING_MIN_UID 1000
#define ONBOARDING_GETTEXT_PACKAGE "io.elementary.onboarding"
#define ONBOARDING_LOCALEDIR "/usr/share/locale"
#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_APP (onboarding_app_get_type ())
#define ONBOARDING_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ONBOARDING_TYPE_APP, OnboardingApp))
#define ONBOARDING_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ONBOARDING_TYPE_APP, OnboardingAppClass))
#define ONBOARDING_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ONBOARDING_TYPE_APP))
#define ONBOARDING_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ONBOARDING_TYPE_APP))
#define ONBOARDING_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ONBOARDING_TYPE_APP, OnboardingAppClass))

typedef struct _OnboardingApp OnboardingApp;
typedef struct _OnboardingAppClass OnboardingAppClass;
typedef struct _OnboardingAppPrivate OnboardingAppPrivate;
enum  {
	ONBOARDING_APP_0_PROPERTY,
	ONBOARDING_APP_NUM_PROPERTIES
};
static GParamSpec* onboarding_app_properties[ONBOARDING_APP_NUM_PROPERTIES];

#define ONBOARDING_TYPE_MAIN_WINDOW (onboarding_main_window_get_type ())
#define ONBOARDING_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ONBOARDING_TYPE_MAIN_WINDOW, OnboardingMainWindow))
#define ONBOARDING_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ONBOARDING_TYPE_MAIN_WINDOW, OnboardingMainWindowClass))
#define ONBOARDING_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ONBOARDING_TYPE_MAIN_WINDOW))
#define ONBOARDING_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ONBOARDING_TYPE_MAIN_WINDOW))
#define ONBOARDING_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ONBOARDING_TYPE_MAIN_WINDOW, OnboardingMainWindowClass))

typedef struct _OnboardingMainWindow OnboardingMainWindow;
typedef struct _OnboardingMainWindowClass OnboardingMainWindowClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _OnboardingApp {
	GtkApplication parent_instance;
	OnboardingAppPrivate * priv;
};

struct _OnboardingAppClass {
	GtkApplicationClass parent_class;
};

static gpointer onboarding_app_parent_class = NULL;

VALA_EXTERN GType onboarding_app_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OnboardingApp, g_object_unref)
static void onboarding_app_real_startup (GApplication* base);
static void onboarding_app_real_activate (GApplication* base);
VALA_EXTERN GType onboarding_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OnboardingMainWindow, g_object_unref)
VALA_EXTERN OnboardingMainWindow* onboarding_main_window_new (void);
VALA_EXTERN OnboardingMainWindow* onboarding_main_window_construct (GType object_type);
VALA_EXTERN OnboardingApp* onboarding_app_new (void);
VALA_EXTERN OnboardingApp* onboarding_app_construct (GType object_type);
static GObject * onboarding_app_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties);
static GType onboarding_app_get_type_once (void);
static gint _vala_main (gchar** args,
                 gint args_length1);

static void
onboarding_app_real_startup (GApplication* base)
{
	OnboardingApp * self;
	self = (OnboardingApp*) base;
	G_APPLICATION_CLASS (onboarding_app_parent_class)->startup ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_application_get_type (), GtkApplication));
	granite_init ();
}

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

static void
onboarding_app_real_activate (GApplication* base)
{
	OnboardingApp * self;
	gboolean _tmp0_ = FALSE;
	OnboardingMainWindow* window = NULL;
	GtkApplication* _tmp2_;
	OnboardingMainWindow* _tmp3_ = NULL;
	self = (OnboardingApp*) base;
	if (getuid () < ((uid_t) ONBOARDING_MIN_UID)) {
		const gchar* _tmp1_;
		_tmp1_ = g_get_user_name ();
		_tmp0_ = !g_str_has_prefix (_tmp1_, "guest-");
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		g_application_quit ((GApplication*) self);
	}
	_tmp2_ = _g_object_ref0 ((GtkApplication*) self);
	_tmp3_ = onboarding_main_window_new ();
	gtk_window_set_application ((GtkWindow*) _tmp3_, _tmp2_);
	_g_object_unref0 (_tmp2_);
	g_object_ref_sink (_tmp3_);
	window = _tmp3_;
	gtk_window_present ((GtkWindow*) window);
	_g_object_unref0 (window);
}

OnboardingApp*
onboarding_app_construct (GType object_type)
{
	OnboardingApp * self = NULL;
	self = (OnboardingApp*) g_object_new (object_type, NULL);
	return self;
}

OnboardingApp*
onboarding_app_new (void)
{
	return onboarding_app_construct (ONBOARDING_TYPE_APP);
}

static GObject *
onboarding_app_constructor (GType type,
                            guint n_construct_properties,
                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	OnboardingApp * self;
	parent_class = G_OBJECT_CLASS (onboarding_app_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ONBOARDING_TYPE_APP, OnboardingApp);
	g_application_set_application_id ((GApplication*) self, "io.elementary.onboarding");
	g_application_set_flags ((GApplication*) self, G_APPLICATION_FLAGS_NONE);
	setlocale (LC_ALL, "");
	bindtextdomain (ONBOARDING_GETTEXT_PACKAGE, ONBOARDING_LOCALEDIR);
	bind_textdomain_codeset (ONBOARDING_GETTEXT_PACKAGE, "UTF-8");
	textdomain (ONBOARDING_GETTEXT_PACKAGE);
	return obj;
}

static void
onboarding_app_class_init (OnboardingAppClass * klass,
                           gpointer klass_data)
{
	onboarding_app_parent_class = g_type_class_peek_parent (klass);
	((GApplicationClass *) klass)->startup = (void (*) (GApplication*)) onboarding_app_real_startup;
	((GApplicationClass *) klass)->activate = (void (*) (GApplication*)) onboarding_app_real_activate;
	G_OBJECT_CLASS (klass)->constructor = onboarding_app_constructor;
}

static void
onboarding_app_instance_init (OnboardingApp * self,
                              gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
onboarding_app_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (OnboardingAppClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) onboarding_app_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (OnboardingApp), 0, (GInstanceInitFunc) onboarding_app_instance_init, NULL };
	GType onboarding_app_type_id;
	onboarding_app_type_id = g_type_register_static (gtk_application_get_type (), "OnboardingApp", &g_define_type_info, 0);
	return onboarding_app_type_id;
}

GType
onboarding_app_get_type (void)
{
	static volatile gsize onboarding_app_type_id__once = 0;
	if (g_once_init_enter (&onboarding_app_type_id__once)) {
		GType onboarding_app_type_id;
		onboarding_app_type_id = onboarding_app_get_type_once ();
		g_once_init_leave (&onboarding_app_type_id__once, onboarding_app_type_id);
	}
	return onboarding_app_type_id__once;
}

static gint
_vala_main (gchar** args,
            gint args_length1)
{
	OnboardingApp* application = NULL;
	OnboardingApp* _tmp0_;
	gint result;
	_tmp0_ = onboarding_app_new ();
	application = _tmp0_;
	result = g_application_run ((GApplication*) application, (gint) args_length1, args);
	_g_object_unref0 (application);
	return result;
}

int
main (int argc,
      char ** argv)
{
	return _vala_main (argv, argc);
}

