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

/* Copyright 2017 Siddhartha Das (bablu.boy@gmail.com)
*
* This file is part of Bookworm and entry point to the
* application with the main method
*
* Bookworm 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.
*
* Bookworm 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 Bookworm. If not, see http://www.gnu.org/licenses/.
*/

#include <granite.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.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 BOOKWORM_APP_TYPE_BOOKWORM (bookworm_app_bookworm_get_type ())
#define BOOKWORM_APP_BOOKWORM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOOKWORM_APP_TYPE_BOOKWORM, BookwormAppBookworm))
#define BOOKWORM_APP_BOOKWORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOOKWORM_APP_TYPE_BOOKWORM, BookwormAppBookwormClass))
#define BOOKWORM_APP_IS_BOOKWORM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOOKWORM_APP_TYPE_BOOKWORM))
#define BOOKWORM_APP_IS_BOOKWORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOOKWORM_APP_TYPE_BOOKWORM))
#define BOOKWORM_APP_BOOKWORM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOOKWORM_APP_TYPE_BOOKWORM, BookwormAppBookwormClass))

typedef struct _BookwormAppBookworm BookwormAppBookworm;
typedef struct _BookwormAppBookwormClass BookwormAppBookwormClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

VALA_EXTERN BookwormAppBookworm* application;
BookwormAppBookworm* application = NULL;
VALA_EXTERN gboolean bookworm_app_bookworm_command_line_option_debug;
VALA_EXTERN gboolean bookworm_app_bookworm_command_line_option_info;

VALA_EXTERN GType bookworm_app_bookworm_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BookwormAppBookworm, g_object_unref)
static gint _vala_main (gchar** args,
                 gint args_length1);
VALA_EXTERN BookwormAppBookworm* bookworm_app_bookworm_getAppInstance (void);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
VALA_EXTERN gint bookworm_app_bookworm_processCommandLine (BookwormAppBookworm* self,
                                               gchar** args,
                                               gint args_length1);

static gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
#line 25 "../src/main.vala"
	for (i = 0; i < stack_length; i++) {
#line 25 "../src/main.vala"
		if (g_strcmp0 (stack[i], needle) == 0) {
#line 25 "../src/main.vala"
			return TRUE;
#line 89 "main.c"
		}
	}
#line 25 "../src/main.vala"
	return FALSE;
#line 94 "main.c"
}

static gint
_vala_main (gchar** args,
            gint args_length1)
{
	BookwormAppBookworm* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gint result;
#line 21 "../src/main.vala"
	g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
#line 23 "../src/main.vala"
	_tmp0_ = bookworm_app_bookworm_getAppInstance ();
#line 23 "../src/main.vala"
	_g_object_unref0 (application);
#line 23 "../src/main.vala"
	application = _tmp0_;
#line 25 "../src/main.vala"
	if (_vala_string_array_contains (args, args_length1, "--help")) {
#line 25 "../src/main.vala"
		_tmp3_ = TRUE;
#line 118 "main.c"
	} else {
#line 25 "../src/main.vala"
		_tmp3_ = _vala_string_array_contains (args, args_length1, "-h");
#line 122 "main.c"
	}
#line 25 "../src/main.vala"
	if (_tmp3_) {
#line 25 "../src/main.vala"
		_tmp2_ = TRUE;
#line 128 "main.c"
	} else {
#line 25 "../src/main.vala"
		_tmp2_ = _vala_string_array_contains (args, args_length1, "--version");
#line 132 "main.c"
	}
#line 25 "../src/main.vala"
	if (_tmp2_) {
#line 25 "../src/main.vala"
		_tmp1_ = TRUE;
#line 138 "main.c"
	} else {
#line 25 "../src/main.vala"
		_tmp1_ = _vala_string_array_contains (args, args_length1, "--discover");
#line 142 "main.c"
	}
#line 25 "../src/main.vala"
	if (_tmp1_) {
#line 146 "main.c"
		BookwormAppBookworm* _tmp4_;
#line 26 "../src/main.vala"
		_tmp4_ = application;
#line 26 "../src/main.vala"
		result = bookworm_app_bookworm_processCommandLine (_tmp4_, args, (gint) args_length1);
#line 26 "../src/main.vala"
		return result;
#line 154 "main.c"
	} else {
		BookwormAppBookworm* _tmp5_;
#line 28 "../src/main.vala"
		gtk_init ((gint*) (&args_length1), &args);
#line 29 "../src/main.vala"
		if (_vala_string_array_contains (args, args_length1, "--debug")) {
#line 30 "../src/main.vala"
			bookworm_app_bookworm_command_line_option_debug = TRUE;
#line 163 "main.c"
		}
#line 32 "../src/main.vala"
		if (_vala_string_array_contains (args, args_length1, "--info")) {
#line 33 "../src/main.vala"
			bookworm_app_bookworm_command_line_option_info = TRUE;
#line 169 "main.c"
		}
#line 35 "../src/main.vala"
		_tmp5_ = application;
#line 35 "../src/main.vala"
		result = granite_application_run ((GraniteApplication*) _tmp5_, args, (gint) args_length1);
#line 35 "../src/main.vala"
		return result;
#line 177 "main.c"
	}
}

int
main (int argc,
      char ** argv)
{
#line 20 "../src/main.vala"
	return _vala_main (argv, argc);
#line 187 "main.c"
}

