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

#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <locale.h>
#include "config.h"
#include <glib/gi18n-lib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <adwaita.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 PROTON_PLUS_CLI_TYPE_HANDLER (proton_plus_cli_handler_get_type ())
#define PROTON_PLUS_CLI_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_CLI_TYPE_HANDLER, ProtonPlusCLIHandler))
#define PROTON_PLUS_CLI_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_CLI_TYPE_HANDLER, ProtonPlusCLIHandlerClass))
#define PROTON_PLUS_CLI_IS_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_CLI_TYPE_HANDLER))
#define PROTON_PLUS_CLI_IS_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_CLI_TYPE_HANDLER))
#define PROTON_PLUS_CLI_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_CLI_TYPE_HANDLER, ProtonPlusCLIHandlerClass))

typedef struct _ProtonPlusCLIHandler ProtonPlusCLIHandler;
typedef struct _ProtonPlusCLIHandlerClass ProtonPlusCLIHandlerClass;
typedef struct _Block1Data Block1Data;
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _proton_plus_cli_handler_unref0(var) ((var == NULL) ? NULL : (var = (proton_plus_cli_handler_unref (var), NULL)))

#define PROTON_PLUS_WIDGETS_TYPE_APPLICATION (proton_plus_widgets_application_get_type ())
#define PROTON_PLUS_WIDGETS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_WIDGETS_TYPE_APPLICATION, ProtonPlusWidgetsApplication))
#define PROTON_PLUS_WIDGETS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_WIDGETS_TYPE_APPLICATION, ProtonPlusWidgetsApplicationClass))
#define PROTON_PLUS_WIDGETS_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_WIDGETS_TYPE_APPLICATION))
#define PROTON_PLUS_WIDGETS_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_WIDGETS_TYPE_APPLICATION))
#define PROTON_PLUS_WIDGETS_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_WIDGETS_TYPE_APPLICATION, ProtonPlusWidgetsApplicationClass))

typedef struct _ProtonPlusWidgetsApplication ProtonPlusWidgetsApplication;
typedef struct _ProtonPlusWidgetsApplicationClass ProtonPlusWidgetsApplicationClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _Block1Data {
	int _ref_count_;
	ProtonPlusCLIHandler* cli;
	GMainLoop* loop;
	gint _result_;
};

static gint proton_plus_main (gchar** args,
                       gint args_length1);
VALA_EXTERN gpointer proton_plus_cli_handler_ref (gpointer instance);
VALA_EXTERN void proton_plus_cli_handler_unref (gpointer instance);
VALA_EXTERN GParamSpec* proton_plus_cli_param_spec_handler (const gchar* name,
                                                const gchar* nick,
                                                const gchar* blurb,
                                                GType object_type,
                                                GParamFlags flags);
VALA_EXTERN void proton_plus_cli_value_set_handler (GValue* value,
                                        gpointer v_object);
VALA_EXTERN void proton_plus_cli_value_take_handler (GValue* value,
                                         gpointer v_object);
VALA_EXTERN gpointer proton_plus_cli_value_get_handler (const GValue* value);
VALA_EXTERN GType proton_plus_cli_handler_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusCLIHandler, proton_plus_cli_handler_unref)
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
VALA_EXTERN ProtonPlusCLIHandler* proton_plus_cli_handler_new (void);
VALA_EXTERN ProtonPlusCLIHandler* proton_plus_cli_handler_construct (GType object_type);
VALA_EXTERN void proton_plus_cli_handler_run (ProtonPlusCLIHandler* self,
                                  gchar** args,
                                  gint args_length1,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN gint proton_plus_cli_handler_run_finish (ProtonPlusCLIHandler* self,
                                         GAsyncResult* _res_);
static void ___lambda74_ (Block1Data* _data1_,
                   GObject* obj,
                   GAsyncResult* res);
static void ____lambda74__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
VALA_EXTERN GType proton_plus_widgets_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusWidgetsApplication, g_object_unref)
VALA_EXTERN ProtonPlusWidgetsApplication* proton_plus_widgets_application_new (void);
VALA_EXTERN ProtonPlusWidgetsApplication* proton_plus_widgets_application_construct (GType object_type);

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		_g_main_loop_unref0 (_data1_->loop);
		_proton_plus_cli_handler_unref0 (_data1_->cli);
		g_slice_free (Block1Data, _data1_);
	}
}

static void
___lambda74_ (Block1Data* _data1_,
              GObject* obj,
              GAsyncResult* res)
{
	ProtonPlusCLIHandler* _tmp0_;
	GMainLoop* _tmp1_;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data1_->cli;
	_data1_->_result_ = proton_plus_cli_handler_run_finish (_tmp0_, res);
	_tmp1_ = _data1_->loop;
	g_main_loop_quit (_tmp1_);
}

static void
____lambda74__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda74_ (self, source_object, res);
	block1_data_unref (self);
}

static gint
proton_plus_main (gchar** args,
                  gint args_length1)
{
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	ProtonPlusWidgetsApplication* application = NULL;
	ProtonPlusWidgetsApplication* _tmp6_;
	ProtonPlusWidgetsApplication* _tmp7_;
	gint result;
	if (!g_thread_supported ()) {
		g_warning ("main.vala:4: Threads are not supported!");
		result = -1;
		return result;
	}
	setlocale (LC_ALL, "");
	_tmp1_ = g_getenv ("LOCALE_DIR");
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		_tmp0_ = LOCALE_DIR;
	}
	bindtextdomain (APP_ID, _tmp0_);
	bind_textdomain_codeset (APP_ID, "UTF-8");
	textdomain (APP_ID);
	if (args_length1 > 1) {
		Block1Data* _data1_;
		ProtonPlusCLIHandler* _tmp2_;
		GMainLoop* _tmp3_;
		ProtonPlusCLIHandler* _tmp4_;
		GMainLoop* _tmp5_;
		_data1_ = g_slice_new0 (Block1Data);
		_data1_->_ref_count_ = 1;
		_tmp2_ = proton_plus_cli_handler_new ();
		_data1_->cli = _tmp2_;
		_tmp3_ = g_main_loop_new (NULL, FALSE);
		_data1_->loop = _tmp3_;
		_data1_->_result_ = 0;
		_tmp4_ = _data1_->cli;
		proton_plus_cli_handler_run (_tmp4_, args, (gint) args_length1, ____lambda74__gasync_ready_callback, block1_data_ref (_data1_));
		_tmp5_ = _data1_->loop;
		g_main_loop_run (_tmp5_);
		result = _data1_->_result_;
		block1_data_unref (_data1_);
		_data1_ = NULL;
		return result;
	}
	_tmp6_ = proton_plus_widgets_application_new ();
	application = _tmp6_;
	_tmp7_ = application;
	result = g_application_run ((GApplication*) _tmp7_, (gint) args_length1, args);
	_g_object_unref0 (application);
	return result;
}

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

