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

/*
* Copyright (c) 2018 Murilo Venturoso
*
* 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, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Murilo Venturoso <muriloventuroso@gmail.com>
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <locale.h>

#define PDFTRICKS_APPLICATION_ACTION_PREFIX "win."
#define PDFTRICKS_APPLICATION_ACTION_COMPRESS_PDF "action_compress_pdf"
#define PDFTRICKS_APPLICATION_ACTION_SPLIT_PDF "action_split_pdf"
#define PDFTRICKS_APPLICATION_ACTION_MERGE_PDF "action_merge_pdf"
#define PDFTRICKS_APPLICATION_ACTION_CONVERT_PDF "action_convert_pdf"
#define CONSTANTS_GETTEXT_PACKAGE "com.github.muriloventuroso.pdftricks"
#define CONSTANTS_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 PDFTRICKS_TYPE_APPLICATION (pdftricks_application_get_type ())
#define PDFTRICKS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFTRICKS_TYPE_APPLICATION, pdftricksApplication))
#define PDFTRICKS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFTRICKS_TYPE_APPLICATION, pdftricksApplicationClass))
#define PDFTRICKS_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFTRICKS_TYPE_APPLICATION))
#define PDFTRICKS_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFTRICKS_TYPE_APPLICATION))
#define PDFTRICKS_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFTRICKS_TYPE_APPLICATION, pdftricksApplicationClass))

typedef struct _pdftricksApplication pdftricksApplication;
typedef struct _pdftricksApplicationClass pdftricksApplicationClass;
typedef struct _pdftricksApplicationPrivate pdftricksApplicationPrivate;

#define PDFTRICKS_TYPE_WELCOME (pdftricks_welcome_get_type ())
#define PDFTRICKS_WELCOME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFTRICKS_TYPE_WELCOME, pdftricksWelcome))
#define PDFTRICKS_WELCOME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFTRICKS_TYPE_WELCOME, pdftricksWelcomeClass))
#define PDFTRICKS_IS_WELCOME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFTRICKS_TYPE_WELCOME))
#define PDFTRICKS_IS_WELCOME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFTRICKS_TYPE_WELCOME))
#define PDFTRICKS_WELCOME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFTRICKS_TYPE_WELCOME, pdftricksWelcomeClass))

typedef struct _pdftricksWelcome pdftricksWelcome;
typedef struct _pdftricksWelcomeClass pdftricksWelcomeClass;

#define PDFTRICKS_TYPE_COMPRESS_PDF (pdftricks_compress_pdf_get_type ())
#define PDFTRICKS_COMPRESS_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFTRICKS_TYPE_COMPRESS_PDF, pdftricksCompressPDF))
#define PDFTRICKS_COMPRESS_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFTRICKS_TYPE_COMPRESS_PDF, pdftricksCompressPDFClass))
#define PDFTRICKS_IS_COMPRESS_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFTRICKS_TYPE_COMPRESS_PDF))
#define PDFTRICKS_IS_COMPRESS_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFTRICKS_TYPE_COMPRESS_PDF))
#define PDFTRICKS_COMPRESS_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFTRICKS_TYPE_COMPRESS_PDF, pdftricksCompressPDFClass))

typedef struct _pdftricksCompressPDF pdftricksCompressPDF;
typedef struct _pdftricksCompressPDFClass pdftricksCompressPDFClass;

#define PDFTRICKS_TYPE_SPLIT_PDF (pdftricks_split_pdf_get_type ())
#define PDFTRICKS_SPLIT_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFTRICKS_TYPE_SPLIT_PDF, pdftricksSplitPDF))
#define PDFTRICKS_SPLIT_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFTRICKS_TYPE_SPLIT_PDF, pdftricksSplitPDFClass))
#define PDFTRICKS_IS_SPLIT_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFTRICKS_TYPE_SPLIT_PDF))
#define PDFTRICKS_IS_SPLIT_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFTRICKS_TYPE_SPLIT_PDF))
#define PDFTRICKS_SPLIT_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFTRICKS_TYPE_SPLIT_PDF, pdftricksSplitPDFClass))

typedef struct _pdftricksSplitPDF pdftricksSplitPDF;
typedef struct _pdftricksSplitPDFClass pdftricksSplitPDFClass;

#define PDFTRICKS_TYPE_MERGE_PDF (pdftricks_merge_pdf_get_type ())
#define PDFTRICKS_MERGE_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFTRICKS_TYPE_MERGE_PDF, pdftricksMergePDF))
#define PDFTRICKS_MERGE_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFTRICKS_TYPE_MERGE_PDF, pdftricksMergePDFClass))
#define PDFTRICKS_IS_MERGE_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFTRICKS_TYPE_MERGE_PDF))
#define PDFTRICKS_IS_MERGE_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFTRICKS_TYPE_MERGE_PDF))
#define PDFTRICKS_MERGE_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFTRICKS_TYPE_MERGE_PDF, pdftricksMergePDFClass))

typedef struct _pdftricksMergePDF pdftricksMergePDF;
typedef struct _pdftricksMergePDFClass pdftricksMergePDFClass;

#define PDFTRICKS_TYPE_CONVERT_PDF (pdftricks_convert_pdf_get_type ())
#define PDFTRICKS_CONVERT_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFTRICKS_TYPE_CONVERT_PDF, pdftricksConvertPDF))
#define PDFTRICKS_CONVERT_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFTRICKS_TYPE_CONVERT_PDF, pdftricksConvertPDFClass))
#define PDFTRICKS_IS_CONVERT_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFTRICKS_TYPE_CONVERT_PDF))
#define PDFTRICKS_IS_CONVERT_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFTRICKS_TYPE_CONVERT_PDF))
#define PDFTRICKS_CONVERT_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFTRICKS_TYPE_CONVERT_PDF, pdftricksConvertPDFClass))

typedef struct _pdftricksConvertPDF pdftricksConvertPDF;
typedef struct _pdftricksConvertPDFClass pdftricksConvertPDFClass;
enum  {
	PDFTRICKS_APPLICATION_0_PROPERTY,
	PDFTRICKS_APPLICATION_NUM_PROPERTIES
};
static GParamSpec* pdftricks_application_properties[PDFTRICKS_APPLICATION_NUM_PROPERTIES];
typedef void (*GSimpleActionActivateCallback) (GSimpleAction* action, GVariant* parameter, gpointer user_data);
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _pdftricksApplication {
	GtkApplication parent_instance;
	pdftricksApplicationPrivate * priv;
	GSimpleActionGroup* actions;
	GtkActionGroup* main_actions;
};

struct _pdftricksApplicationClass {
	GtkApplicationClass parent_class;
};

struct _pdftricksApplicationPrivate {
	GtkWindow* main_window;
	GtkButton* navigation_button;
	GtkHeaderBar* headerbar;
	pdftricksWelcome* welcome;
	pdftricksCompressPDF* compress_pdf;
	pdftricksSplitPDF* split_pdf;
	pdftricksMergePDF* merge_pdf;
	pdftricksConvertPDF* convert_pdf;
	GtkStack* stack;
};

static gint pdftricksApplication_private_offset;
static gpointer pdftricks_application_parent_class = NULL;

VALA_EXTERN GType pdftricks_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdftricksApplication, g_object_unref)
VALA_EXTERN GType pdftricks_welcome_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdftricksWelcome, g_object_unref)
VALA_EXTERN GType pdftricks_compress_pdf_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdftricksCompressPDF, g_object_unref)
VALA_EXTERN GType pdftricks_split_pdf_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdftricksSplitPDF, g_object_unref)
VALA_EXTERN GType pdftricks_merge_pdf_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdftricksMergePDF, g_object_unref)
VALA_EXTERN GType pdftricks_convert_pdf_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdftricksConvertPDF, g_object_unref)
static void pdftricks_application_action_compress_pdf (pdftricksApplication* self);
static void _pdftricks_application_action_compress_pdf_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                  GVariant* parameter,
                                                                                  gpointer self);
static void pdftricks_application_action_split_pdf (pdftricksApplication* self);
static void _pdftricks_application_action_split_pdf_gsimple_action_activate_callback (GSimpleAction* action,
                                                                               GVariant* parameter,
                                                                               gpointer self);
static void pdftricks_application_action_merge_pdf (pdftricksApplication* self);
static void _pdftricks_application_action_merge_pdf_gsimple_action_activate_callback (GSimpleAction* action,
                                                                               GVariant* parameter,
                                                                               gpointer self);
static void pdftricks_application_action_convert_pdf (pdftricksApplication* self);
static void _pdftricks_application_action_convert_pdf_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                 GVariant* parameter,
                                                                                 gpointer self);
VALA_EXTERN pdftricksApplication* pdftricks_application_new (void);
VALA_EXTERN pdftricksApplication* pdftricks_application_construct (GType object_type);
static void pdftricks_application_real_activate (GApplication* base);
VALA_EXTERN pdftricksWelcome* pdftricks_welcome_new (void);
VALA_EXTERN pdftricksWelcome* pdftricks_welcome_construct (GType object_type);
VALA_EXTERN pdftricksCompressPDF* pdftricks_compress_pdf_new (GtkWindow* window);
VALA_EXTERN pdftricksCompressPDF* pdftricks_compress_pdf_construct (GType object_type,
                                                        GtkWindow* window);
VALA_EXTERN pdftricksSplitPDF* pdftricks_split_pdf_new (GtkWindow* window);
VALA_EXTERN pdftricksSplitPDF* pdftricks_split_pdf_construct (GType object_type,
                                                  GtkWindow* window);
VALA_EXTERN pdftricksMergePDF* pdftricks_merge_pdf_new (GtkWindow* window);
VALA_EXTERN pdftricksMergePDF* pdftricks_merge_pdf_construct (GType object_type,
                                                  GtkWindow* window);
VALA_EXTERN pdftricksConvertPDF* pdftricks_convert_pdf_new (GtkWindow* window);
VALA_EXTERN pdftricksConvertPDF* pdftricks_convert_pdf_construct (GType object_type,
                                                      GtkWindow* window);
static void __lambda38_ (pdftricksApplication* self);
static void ___lambda38__g_simple_action_activate (GSimpleAction* _sender,
                                            GVariant* parameter,
                                            gpointer self);
static void __lambda39_ (pdftricksApplication* self);
static void pdftricks_application_handle_navigation_button_clicked (pdftricksApplication* self);
static void ___lambda39__g_simple_action_activate (GSimpleAction* _sender,
                                            GVariant* parameter,
                                            gpointer self);
static gint pdftricks_application_main (gchar** args,
                                 gint args_length1);
static GObject * pdftricks_application_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void pdftricks_application_finalize (GObject * obj);
static GType pdftricks_application_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static const GActionEntry PDFTRICKS_APPLICATION_action_entries[4] = {{PDFTRICKS_APPLICATION_ACTION_COMPRESS_PDF, _pdftricks_application_action_compress_pdf_gsimple_action_activate_callback}, {PDFTRICKS_APPLICATION_ACTION_SPLIT_PDF, _pdftricks_application_action_split_pdf_gsimple_action_activate_callback}, {PDFTRICKS_APPLICATION_ACTION_MERGE_PDF, _pdftricks_application_action_merge_pdf_gsimple_action_activate_callback}, {PDFTRICKS_APPLICATION_ACTION_CONVERT_PDF, _pdftricks_application_action_convert_pdf_gsimple_action_activate_callback}};

static inline gpointer
pdftricks_application_get_instance_private (pdftricksApplication* self)
{
	return G_STRUCT_MEMBER_P (self, pdftricksApplication_private_offset);
}

static void
_pdftricks_application_action_compress_pdf_gsimple_action_activate_callback (GSimpleAction* action,
                                                                             GVariant* parameter,
                                                                             gpointer self)
{
	pdftricks_application_action_compress_pdf ((pdftricksApplication*) self);
}

static void
_pdftricks_application_action_split_pdf_gsimple_action_activate_callback (GSimpleAction* action,
                                                                          GVariant* parameter,
                                                                          gpointer self)
{
	pdftricks_application_action_split_pdf ((pdftricksApplication*) self);
}

static void
_pdftricks_application_action_merge_pdf_gsimple_action_activate_callback (GSimpleAction* action,
                                                                          GVariant* parameter,
                                                                          gpointer self)
{
	pdftricks_application_action_merge_pdf ((pdftricksApplication*) self);
}

static void
_pdftricks_application_action_convert_pdf_gsimple_action_activate_callback (GSimpleAction* action,
                                                                            GVariant* parameter,
                                                                            gpointer self)
{
	pdftricks_application_action_convert_pdf ((pdftricksApplication*) self);
}

pdftricksApplication*
pdftricks_application_construct (GType object_type)
{
	pdftricksApplication * self = NULL;
	self = (pdftricksApplication*) g_object_new (object_type, "application-id", "com.github.muriloventuroso.pdftricks", "flags", G_APPLICATION_FLAGS_NONE, NULL);
	return self;
}

pdftricksApplication*
pdftricks_application_new (void)
{
	return pdftricks_application_construct (PDFTRICKS_TYPE_APPLICATION);
}

static void
__lambda38_ (pdftricksApplication* self)
{
	GtkWindow* _tmp0_;
	_tmp0_ = self->priv->main_window;
	if (_tmp0_ != NULL) {
		GtkWindow* _tmp1_;
		_tmp1_ = self->priv->main_window;
		gtk_widget_destroy ((GtkWidget*) _tmp1_);
	}
}

static void
___lambda38__g_simple_action_activate (GSimpleAction* _sender,
                                       GVariant* parameter,
                                       gpointer self)
{
	__lambda38_ ((pdftricksApplication*) self);
}

static void
__lambda39_ (pdftricksApplication* self)
{
	pdftricks_application_handle_navigation_button_clicked (self);
}

static void
___lambda39__g_simple_action_activate (GSimpleAction* _sender,
                                       GVariant* parameter,
                                       gpointer self)
{
	__lambda39_ ((pdftricksApplication*) self);
}

static void
pdftricks_application_real_activate (GApplication* base)
{
	pdftricksApplication * self;
	GList* _tmp0_;
	GSimpleActionGroup* _tmp3_;
	GSimpleActionGroup* _tmp4_;
	GtkWindow* _tmp5_;
	GtkButton* _tmp6_;
	GtkButton* _tmp7_;
	GtkButton* _tmp8_;
	GtkStyleContext* _tmp9_;
	GtkButton* _tmp10_;
	GtkHeaderBar* _tmp11_;
	GtkHeaderBar* _tmp12_;
	GtkHeaderBar* _tmp13_;
	GtkHeaderBar* _tmp14_;
	GtkButton* _tmp15_;
	pdftricksWelcome* _tmp16_;
	GtkWindow* _tmp17_;
	pdftricksCompressPDF* _tmp18_;
	GtkWindow* _tmp19_;
	pdftricksSplitPDF* _tmp20_;
	GtkWindow* _tmp21_;
	pdftricksMergePDF* _tmp22_;
	GtkWindow* _tmp23_;
	pdftricksConvertPDF* _tmp24_;
	GtkStack* _tmp25_;
	GtkStack* _tmp26_;
	GtkStack* _tmp27_;
	pdftricksWelcome* _tmp28_;
	GtkStack* _tmp29_;
	pdftricksCompressPDF* _tmp30_;
	GtkStack* _tmp31_;
	pdftricksSplitPDF* _tmp32_;
	GtkStack* _tmp33_;
	pdftricksMergePDF* _tmp34_;
	GtkStack* _tmp35_;
	pdftricksConvertPDF* _tmp36_;
	GtkWindow* _tmp37_;
	GtkWindow* _tmp38_;
	GtkWindow* _tmp39_;
	GtkWindow* _tmp40_;
	GtkStack* _tmp41_;
	GtkWindow* _tmp42_;
	GtkWindow* _tmp43_;
	GtkWindow* _tmp44_;
	GtkHeaderBar* _tmp45_;
	GtkWindow* _tmp46_;
	GSimpleActionGroup* _tmp47_;
	GtkWindow* _tmp48_;
	GtkButton* _tmp49_;
	GtkWindow* _tmp50_;
	GSimpleAction* quit_action = NULL;
	GSimpleAction* _tmp51_;
	GSimpleAction* back_action = NULL;
	GSimpleAction* _tmp52_;
	GSimpleAction* _tmp53_;
	GSimpleAction* _tmp54_;
	GSimpleAction* _tmp55_;
	GSimpleAction* _tmp56_;
	gchar* _tmp57_;
	gchar* _tmp58_;
	gchar** _tmp59_;
	gchar** _tmp60_;
	gint _tmp60__length1;
	self = (pdftricksApplication*) base;
	_tmp0_ = gtk_application_get_windows ((GtkApplication*) self);
	if (g_list_length (_tmp0_) > ((guint) 0)) {
		GList* _tmp1_;
		gconstpointer _tmp2_;
		_tmp1_ = gtk_application_get_windows ((GtkApplication*) self);
		_tmp2_ = _tmp1_->data;
		gtk_window_present ((GtkWindow*) _tmp2_);
		return;
	}
	_tmp3_ = g_simple_action_group_new ();
	_g_object_unref0 (self->actions);
	self->actions = _tmp3_;
	_tmp4_ = self->actions;
	g_action_map_add_action_entries ((GActionMap*) _tmp4_, PDFTRICKS_APPLICATION_action_entries, (gint) G_N_ELEMENTS (PDFTRICKS_APPLICATION_action_entries), self);
	_tmp5_ = (GtkWindow*) gtk_window_new (GTK_WINDOW_TOPLEVEL);
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->main_window);
	self->priv->main_window = _tmp5_;
	_tmp6_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->navigation_button);
	self->priv->navigation_button = _tmp6_;
	_tmp7_ = self->priv->navigation_button;
	gtk_actionable_set_action_name ((GtkActionable*) _tmp7_, "app.back");
	_tmp8_ = self->priv->navigation_button;
	_tmp9_ = gtk_widget_get_style_context ((GtkWidget*) _tmp8_);
	gtk_style_context_add_class (_tmp9_, "back-button");
	_tmp10_ = self->priv->navigation_button;
	gtk_button_set_label (_tmp10_, _ ("Back"));
	_tmp11_ = (GtkHeaderBar*) gtk_header_bar_new ();
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->headerbar);
	self->priv->headerbar = _tmp11_;
	_tmp12_ = self->priv->headerbar;
	gtk_header_bar_set_show_close_button (_tmp12_, TRUE);
	_tmp13_ = self->priv->headerbar;
	gtk_header_bar_set_title (_tmp13_, _ ("PDF Tricks"));
	_tmp14_ = self->priv->headerbar;
	_tmp15_ = self->priv->navigation_button;
	gtk_header_bar_pack_start (_tmp14_, (GtkWidget*) _tmp15_);
	_tmp16_ = pdftricks_welcome_new ();
	g_object_ref_sink (_tmp16_);
	_g_object_unref0 (self->priv->welcome);
	self->priv->welcome = _tmp16_;
	_tmp17_ = self->priv->main_window;
	_tmp18_ = pdftricks_compress_pdf_new (_tmp17_);
	g_object_ref_sink (_tmp18_);
	_g_object_unref0 (self->priv->compress_pdf);
	self->priv->compress_pdf = _tmp18_;
	_tmp19_ = self->priv->main_window;
	_tmp20_ = pdftricks_split_pdf_new (_tmp19_);
	g_object_ref_sink (_tmp20_);
	_g_object_unref0 (self->priv->split_pdf);
	self->priv->split_pdf = _tmp20_;
	_tmp21_ = self->priv->main_window;
	_tmp22_ = pdftricks_merge_pdf_new (_tmp21_);
	g_object_ref_sink (_tmp22_);
	_g_object_unref0 (self->priv->merge_pdf);
	self->priv->merge_pdf = _tmp22_;
	_tmp23_ = self->priv->main_window;
	_tmp24_ = pdftricks_convert_pdf_new (_tmp23_);
	g_object_ref_sink (_tmp24_);
	_g_object_unref0 (self->priv->convert_pdf);
	self->priv->convert_pdf = _tmp24_;
	_tmp25_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp25_);
	_g_object_unref0 (self->priv->stack);
	self->priv->stack = _tmp25_;
	_tmp26_ = self->priv->stack;
	gtk_stack_set_transition_type (_tmp26_, GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT);
	_tmp27_ = self->priv->stack;
	_tmp28_ = self->priv->welcome;
	gtk_stack_add_named (_tmp27_, (GtkWidget*) _tmp28_, "main");
	_tmp29_ = self->priv->stack;
	_tmp30_ = self->priv->compress_pdf;
	gtk_stack_add_named (_tmp29_, (GtkWidget*) _tmp30_, "compress_pdf");
	_tmp31_ = self->priv->stack;
	_tmp32_ = self->priv->split_pdf;
	gtk_stack_add_named (_tmp31_, (GtkWidget*) _tmp32_, "split_pdf");
	_tmp33_ = self->priv->stack;
	_tmp34_ = self->priv->merge_pdf;
	gtk_stack_add_named (_tmp33_, (GtkWidget*) _tmp34_, "merge_pdf");
	_tmp35_ = self->priv->stack;
	_tmp36_ = self->priv->convert_pdf;
	gtk_stack_add_named (_tmp35_, (GtkWidget*) _tmp36_, "convert_pdf");
	_tmp37_ = self->priv->main_window;
	gtk_window_set_application (_tmp37_, (GtkApplication*) self);
	_tmp38_ = self->priv->main_window;
	gtk_window_set_icon_name (_tmp38_, "com.github.muriloventuroso.pdftricks");
	_tmp39_ = self->priv->main_window;
	gtk_window_set_title (_tmp39_, _ ("PDF Tricks"));
	_tmp40_ = self->priv->main_window;
	_tmp41_ = self->priv->stack;
	gtk_container_add ((GtkContainer*) _tmp40_, (GtkWidget*) _tmp41_);
	_tmp42_ = self->priv->main_window;
	gtk_widget_set_size_request ((GtkWidget*) _tmp42_, 800, 640);
	_tmp43_ = self->priv->main_window;
	gtk_window_set_resizable (_tmp43_, FALSE);
	_tmp44_ = self->priv->main_window;
	_tmp45_ = self->priv->headerbar;
	gtk_window_set_titlebar (_tmp44_, (GtkWidget*) _tmp45_);
	_tmp46_ = self->priv->main_window;
	_tmp47_ = self->actions;
	gtk_widget_insert_action_group ((GtkWidget*) _tmp46_, "win", (GActionGroup*) _tmp47_);
	_tmp48_ = self->priv->main_window;
	gtk_widget_show_all ((GtkWidget*) _tmp48_);
	_tmp49_ = self->priv->navigation_button;
	gtk_widget_hide ((GtkWidget*) _tmp49_);
	_tmp50_ = self->priv->main_window;
	gtk_application_add_window ((GtkApplication*) self, _tmp50_);
	_tmp51_ = g_simple_action_new ("quit", NULL);
	quit_action = _tmp51_;
	_tmp52_ = g_simple_action_new ("back", NULL);
	back_action = _tmp52_;
	_tmp53_ = back_action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp53_);
	_tmp54_ = quit_action;
	g_action_map_add_action ((GActionMap*) self, (GAction*) _tmp54_);
	_tmp55_ = quit_action;
	g_signal_connect_object (_tmp55_, "activate", (GCallback) ___lambda38__g_simple_action_activate, self, 0);
	_tmp56_ = back_action;
	g_signal_connect_object (_tmp56_, "activate", (GCallback) ___lambda39__g_simple_action_activate, self, 0);
	_tmp57_ = g_strdup ("<Alt>Left");
	_tmp58_ = g_strdup ("Back");
	_tmp59_ = g_new0 (gchar*, 2 + 1);
	_tmp59_[0] = _tmp57_;
	_tmp59_[1] = _tmp58_;
	_tmp60_ = _tmp59_;
	_tmp60__length1 = 2;
	gtk_application_set_accels_for_action ((GtkApplication*) self, "app.back", _tmp60_);
	_tmp60_ = (_vala_array_free (_tmp60_, _tmp60__length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (back_action);
	_g_object_unref0 (quit_action);
}

static void
pdftricks_application_handle_navigation_button_clicked (pdftricksApplication* self)
{
	GtkButton* _tmp0_;
	GtkStack* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->navigation_button;
	gtk_widget_hide ((GtkWidget*) _tmp0_);
	_tmp1_ = self->priv->stack;
	gtk_stack_set_visible_child_name (_tmp1_, "main");
}

static void
pdftricks_application_action_compress_pdf (pdftricksApplication* self)
{
	GtkStack* _tmp0_;
	GtkButton* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stack;
	gtk_stack_set_visible_child_name (_tmp0_, "compress_pdf");
	_tmp1_ = self->priv->navigation_button;
	gtk_widget_show ((GtkWidget*) _tmp1_);
}

static void
pdftricks_application_action_split_pdf (pdftricksApplication* self)
{
	GtkStack* _tmp0_;
	GtkButton* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stack;
	gtk_stack_set_visible_child_name (_tmp0_, "split_pdf");
	_tmp1_ = self->priv->navigation_button;
	gtk_widget_show ((GtkWidget*) _tmp1_);
}

static void
pdftricks_application_action_merge_pdf (pdftricksApplication* self)
{
	GtkStack* _tmp0_;
	GtkButton* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stack;
	gtk_stack_set_visible_child_name (_tmp0_, "merge_pdf");
	_tmp1_ = self->priv->navigation_button;
	gtk_widget_show ((GtkWidget*) _tmp1_);
}

static void
pdftricks_application_action_convert_pdf (pdftricksApplication* self)
{
	GtkStack* _tmp0_;
	GtkButton* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stack;
	gtk_stack_set_visible_child_name (_tmp0_, "convert_pdf");
	_tmp1_ = self->priv->navigation_button;
	gtk_widget_show ((GtkWidget*) _tmp1_);
}

static gint
pdftricks_application_main (gchar** args,
                            gint args_length1)
{
	pdftricksApplication* app = NULL;
	pdftricksApplication* _tmp0_;
	gint result;
	gtk_init ((gint*) (&args_length1), &args);
	_tmp0_ = pdftricks_application_new ();
	app = _tmp0_;
	result = g_application_run ((GApplication*) app, (gint) args_length1, args);
	_g_object_unref0 (app);
	return result;
}

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

static GObject *
pdftricks_application_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	pdftricksApplication * self;
	parent_class = G_OBJECT_CLASS (pdftricks_application_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PDFTRICKS_TYPE_APPLICATION, pdftricksApplication);
	setlocale (LC_ALL, "");
	bindtextdomain (CONSTANTS_GETTEXT_PACKAGE, CONSTANTS_LOCALEDIR);
	bind_textdomain_codeset (CONSTANTS_GETTEXT_PACKAGE, "UTF-8");
	textdomain (CONSTANTS_GETTEXT_PACKAGE);
	return obj;
}

static void
pdftricks_application_class_init (pdftricksApplicationClass * klass,
                                  gpointer klass_data)
{
	pdftricks_application_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &pdftricksApplication_private_offset);
	((GApplicationClass *) klass)->activate = (void (*) (GApplication*)) pdftricks_application_real_activate;
	G_OBJECT_CLASS (klass)->constructor = pdftricks_application_constructor;
	G_OBJECT_CLASS (klass)->finalize = pdftricks_application_finalize;
}

static void
pdftricks_application_instance_init (pdftricksApplication * self,
                                     gpointer klass)
{
	self->priv = pdftricks_application_get_instance_private (self);
}

static void
pdftricks_application_finalize (GObject * obj)
{
	pdftricksApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PDFTRICKS_TYPE_APPLICATION, pdftricksApplication);
	_g_object_unref0 (self->priv->main_window);
	_g_object_unref0 (self->priv->navigation_button);
	_g_object_unref0 (self->priv->headerbar);
	_g_object_unref0 (self->priv->welcome);
	_g_object_unref0 (self->priv->compress_pdf);
	_g_object_unref0 (self->priv->split_pdf);
	_g_object_unref0 (self->priv->merge_pdf);
	_g_object_unref0 (self->priv->convert_pdf);
	_g_object_unref0 (self->priv->stack);
	_g_object_unref0 (self->actions);
	_g_object_unref0 (self->main_actions);
	G_OBJECT_CLASS (pdftricks_application_parent_class)->finalize (obj);
}

static GType
pdftricks_application_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (pdftricksApplicationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdftricks_application_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdftricksApplication), 0, (GInstanceInitFunc) pdftricks_application_instance_init, NULL };
	GType pdftricks_application_type_id;
	pdftricks_application_type_id = g_type_register_static (gtk_application_get_type (), "pdftricksApplication", &g_define_type_info, 0);
	pdftricksApplication_private_offset = g_type_add_instance_private (pdftricks_application_type_id, sizeof (pdftricksApplicationPrivate));
	return pdftricks_application_type_id;
}

GType
pdftricks_application_get_type (void)
{
	static volatile gsize pdftricks_application_type_id__once = 0;
	if (g_once_init_enter (&pdftricks_application_type_id__once)) {
		GType pdftricks_application_type_id;
		pdftricks_application_type_id = pdftricks_application_get_type_once ();
		g_once_init_leave (&pdftricks_application_type_id__once, pdftricks_application_type_id);
	}
	return pdftricks_application_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

