/* SplitPDF.c generated by valac 0.56.19, the Vala compiler
 * generated from SplitPDF.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 <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <granite.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 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;
typedef struct _pdftricksSplitPDFPrivate pdftricksSplitPDFPrivate;
enum  {
	PDFTRICKS_SPLIT_PDF_0_PROPERTY,
	PDFTRICKS_SPLIT_PDF_WINDOW_PROPERTY,
	PDFTRICKS_SPLIT_PDF_NUM_PROPERTIES
};
static GParamSpec* pdftricks_split_pdf_properties[PDFTRICKS_SPLIT_PDF_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block3Data Block3Data;
#define _g_thread_unref0(var) ((var == NULL) ? NULL : (var = (g_thread_unref (var), NULL)))
typedef struct _PdftricksSplitPdfSplitFileAllData PdftricksSplitPdfSplitFileAllData;
typedef struct _Block4Data Block4Data;
typedef struct _PdftricksSplitPdfSplitFileRangeData PdftricksSplitPdfSplitFileRangeData;
typedef struct _Block5Data Block5Data;
typedef struct _PdftricksSplitPdfCreateThumbsData PdftricksSplitPdfCreateThumbsData;
typedef struct _Block6Data Block6Data;
#define __vala_GtkTreePath_free0(var) ((var == NULL) ? NULL : (var = (_vala_GtkTreePath_free (var), NULL)))
enum  {
	PDFTRICKS_SPLIT_PDF_PROCCESS_BEGIN_SIGNAL,
	PDFTRICKS_SPLIT_PDF_PROCCESS_FINISHED_SIGNAL,
	PDFTRICKS_SPLIT_PDF_CREATE_THUMB_BEGIN_SIGNAL,
	PDFTRICKS_SPLIT_PDF_CREATE_THUMB_FINISHED_SIGNAL,
	PDFTRICKS_SPLIT_PDF_NUM_SIGNALS
};
static guint pdftricks_split_pdf_signals[PDFTRICKS_SPLIT_PDF_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _pdftricksSplitPDF {
	GtkBox parent_instance;
	pdftricksSplitPDFPrivate * priv;
};

struct _pdftricksSplitPDFClass {
	GtkBoxClass parent_class;
};

struct _pdftricksSplitPDFPrivate {
	GtkFileChooserButton* filechooser;
	GtkWindow* _window;
	gint page_size;
	GtkEntry* entry_range;
	gchar* type_split;
	GtkSpinner* spinner;
};

struct _Block3Data {
	int _ref_count_;
	pdftricksSplitPDF* self;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	gchar* input;
	gchar* output_file;
	gpointer _async_data_;
};

struct _PdftricksSplitPdfSplitFileAllData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	pdftricksSplitPDF* self;
	gchar* input;
	gchar* output_file;
	gboolean result;
	Block3Data* _data3_;
	gboolean ret;
	GThreadFunc run;
	gpointer run_target;
	GThread* _tmp0_;
	GThread* _tmp1_;
	GError* e;
	GError* _tmp2_;
	const gchar* _tmp3_;
	GError* _inner_error0_;
};

struct _Block4Data {
	int _ref_count_;
	pdftricksSplitPDF* self;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	gchar* input;
	gchar* output_file;
	gchar* pages;
	gpointer _async_data_;
};

struct _PdftricksSplitPdfSplitFileRangeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	pdftricksSplitPDF* self;
	gchar* input;
	gchar* output_file;
	gchar* pages;
	gboolean result;
	Block4Data* _data4_;
	gboolean ret;
	GThreadFunc run;
	gpointer run_target;
	GThread* _tmp0_;
	GThread* _tmp1_;
	GError* e;
	GError* _tmp2_;
	const gchar* _tmp3_;
	GError* _inner_error0_;
};

struct _Block5Data {
	int _ref_count_;
	pdftricksSplitPDF* self;
	gchar* file_pdf;
	gboolean ret;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	gpointer _async_data_;
};

struct _PdftricksSplitPdfCreateThumbsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	pdftricksSplitPDF* self;
	gchar* input_file;
	gboolean result;
	Block5Data* _data5_;
	gchar* _tmp0_;
	GThreadFunc run;
	gpointer run_target;
	GThread* _tmp1_;
	GThread* _tmp2_;
	GError* e;
	GError* _tmp3_;
	const gchar* _tmp4_;
	GError* _inner_error0_;
};

struct _Block6Data {
	int _ref_count_;
	pdftricksSplitPDF* self;
	GtkRadioButton* btn_all;
	GtkRadioButton* btn_range;
	GtkRadioButton* btn_colors;
	GtkRevealer* revealer;
	GtkListStore* model_thumbs;
	GtkTreeIter iter;
	GtkIconView* view_thumbs;
	GtkButton* split_button;
};

static gint pdftricksSplitPDF_private_offset;
static gpointer pdftricks_split_pdf_parent_class = NULL;

VALA_EXTERN GType pdftricks_split_pdf_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdftricksSplitPDF, g_object_unref)
VALA_EXTERN pdftricksSplitPDF* pdftricks_split_pdf_new (GtkWindow* window);
VALA_EXTERN pdftricksSplitPDF* pdftricks_split_pdf_construct (GType object_type,
                                                  GtkWindow* window);
static void pdftricks_split_pdf_confirm_split (pdftricksSplitPDF* self);
VALA_EXTERN GtkWindow* pdftricks_split_pdf_get_window (pdftricksSplitPDF* self);
static void pdftricks_split_pdf_split_file_all (pdftricksSplitPDF* self,
                                         const gchar* input,
                                         const gchar* output_file,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static gboolean pdftricks_split_pdf_split_file_all_finish (pdftricksSplitPDF* self,
                                                    GAsyncResult* _res_);
static void ____lambda11_ (pdftricksSplitPDF* self,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda11__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void pdftricks_split_pdf_split_file_range (pdftricksSplitPDF* self,
                                           const gchar* input,
                                           const gchar* output_file,
                                           const gchar* pages,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static gboolean pdftricks_split_pdf_split_file_range_finish (pdftricksSplitPDF* self,
                                                      GAsyncResult* _res_);
static void _____lambda13_ (pdftricksSplitPDF* self,
                     GObject* obj,
                     GAsyncResult* res);
static void ______lambda13__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
static gchar* pdftricks_split_pdf_get_colors (pdftricksSplitPDF* self,
                                       const gchar* input);
static gchar* pdftricks_split_pdf_group_list (pdftricksSplitPDF* self,
                                       const gchar* _result_);
static void _______lambda14_ (pdftricksSplitPDF* self,
                       GObject* obj,
                       GAsyncResult* res);
static void ________lambda14__gasync_ready_callback (GObject* source_object,
                                              GAsyncResult* res,
                                              gpointer self);
static void pdftricks_split_pdf_split_file_all_data_free (gpointer _data);
static gboolean pdftricks_split_pdf_split_file_all_co (PdftricksSplitPdfSplitFileAllData* _data_);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static gboolean _pdftricks_split_pdf_split_file_all_co_gsource_func (gpointer self);
static void* __lambda10_ (Block3Data* _data3_);
static gboolean pdftricks_split_pdf_split_page_range (pdftricksSplitPDF* self,
                                               const gchar* input,
                                               const gchar* output_file,
                                               gint page_start,
                                               gint page_end,
                                               const gchar* label);
static gpointer ___lambda10__gthread_func (gpointer self);
static void pdftricks_split_pdf_split_file_range_data_free (gpointer _data);
static gboolean pdftricks_split_pdf_split_file_range_co (PdftricksSplitPdfSplitFileRangeData* _data_);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static gboolean _pdftricks_split_pdf_split_file_range_co_gsource_func (gpointer self);
static void* __lambda12_ (Block4Data* _data4_);
static gpointer ___lambda12__gthread_func (gpointer self);
static gint pdftricks_split_pdf_get_page_count (pdftricksSplitPDF* self,
                                         const gchar* input_file);
static void pdftricks_split_pdf_create_thumbs_data_free (gpointer _data);
static void pdftricks_split_pdf_create_thumbs (pdftricksSplitPDF* self,
                                        const gchar* input_file,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static gboolean pdftricks_split_pdf_create_thumbs_finish (pdftricksSplitPDF* self,
                                                   GAsyncResult* _res_);
static gboolean pdftricks_split_pdf_create_thumbs_co (PdftricksSplitPdfCreateThumbsData* _data_);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
static gboolean _pdftricks_split_pdf_create_thumbs_co_gsource_func (gpointer self);
static void* __lambda15_ (Block5Data* _data5_);
static gpointer ___lambda15__gthread_func (gpointer self);
static void pdftricks_split_pdf_set_window (pdftricksSplitPDF* self,
                                     GtkWindow* value);
static GObject * pdftricks_split_pdf_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static void _pdftricks_split_pdf___lambda16_ (Block6Data* _data6_);
static GtkTreePath* _vala_GtkTreePath_copy (GtkTreePath* self);
static void _vala_GtkTreePath_free (GtkTreePath* self);
static void __vala_GtkTreePath_free0_ (gpointer var);
static inline void _g_list_free___vala_GtkTreePath_free0_ (GList* self);
static void __pdftricks_split_pdf___lambda16__gtk_icon_view_selection_changed (GtkIconView* _sender,
                                                                        gpointer self);
static void _pdftricks_split_pdf___lambda17_ (Block6Data* _data6_);
static void __pdftricks_split_pdf___lambda17__pdftricks_split_pdf_create_thumb_begin (pdftricksSplitPDF* _sender,
                                                                               gpointer self);
static void _pdftricks_split_pdf___lambda18_ (Block6Data* _data6_,
                                       gboolean _result_);
static void __pdftricks_split_pdf___lambda18__pdftricks_split_pdf_create_thumb_finished (pdftricksSplitPDF* _sender,
                                                                                  gboolean _result_,
                                                                                  gpointer self);
static void _pdftricks_split_pdf___lambda19_ (Block6Data* _data6_);
static void __pdftricks_split_pdf___lambda19__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                  gpointer self);
static void _pdftricks_split_pdf___lambda20_ (Block6Data* _data6_);
static void __pdftricks_split_pdf___lambda20__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                  gpointer self);
static void _pdftricks_split_pdf___lambda21_ (Block6Data* _data6_);
static void __pdftricks_split_pdf___lambda21__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                  gpointer self);
static void _pdftricks_split_pdf_confirm_split_gtk_button_clicked (GtkButton* _sender,
                                                            gpointer self);
static void _pdftricks_split_pdf___lambda22_ (Block6Data* _data6_);
static void __pdftricks_split_pdf___lambda22__gtk_file_chooser_button_file_set (GtkFileChooserButton* _sender,
                                                                         gpointer self);
static void _pdftricks_split_pdf___lambda23_ (Block6Data* _data6_);
static void __pdftricks_split_pdf___lambda23__pdftricks_split_pdf_proccess_begin (pdftricksSplitPDF* _sender,
                                                                           gpointer self);
static void _pdftricks_split_pdf___lambda24_ (Block6Data* _data6_,
                                       gboolean _result_);
static void __pdftricks_split_pdf___lambda24__pdftricks_split_pdf_proccess_finished (pdftricksSplitPDF* _sender,
                                                                              gboolean _result_,
                                                                              gpointer self);
static void pdftricks_split_pdf_finalize (GObject * obj);
static GType pdftricks_split_pdf_get_type_once (void);
static void _vala_pdftricks_split_pdf_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_pdftricks_split_pdf_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
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 gssize _vala_array_length (gpointer array);

static inline gpointer
pdftricks_split_pdf_get_instance_private (pdftricksSplitPDF* self)
{
	return G_STRUCT_MEMBER_P (self, pdftricksSplitPDF_private_offset);
}

pdftricksSplitPDF*
pdftricks_split_pdf_construct (GType object_type,
                               GtkWindow* window)
{
	pdftricksSplitPDF * self = NULL;
	g_return_val_if_fail (window != NULL, NULL);
	self = (pdftricksSplitPDF*) g_object_new (object_type, "margin-start", 20, "margin-end", 20, "window", window, "hexpand", TRUE, "homogeneous", TRUE, NULL);
	return self;
}

pdftricksSplitPDF*
pdftricks_split_pdf_new (GtkWindow* window)
{
	return pdftricks_split_pdf_construct (PDFTRICKS_TYPE_SPLIT_PDF, window);
}

static void
____lambda11_ (pdftricksSplitPDF* self,
               GObject* obj,
               GAsyncResult* res)
{
	g_return_if_fail (res != NULL);
	g_signal_emit (self, pdftricks_split_pdf_signals[PDFTRICKS_SPLIT_PDF_PROCCESS_FINISHED_SIGNAL], 0, pdftricks_split_pdf_split_file_all_finish (self, res));
}

static void
_____lambda11__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda11_ ((pdftricksSplitPDF*) self, source_object, res);
	g_object_unref (self);
}

static void
_____lambda13_ (pdftricksSplitPDF* self,
                GObject* obj,
                GAsyncResult* res)
{
	g_return_if_fail (res != NULL);
	g_signal_emit (self, pdftricks_split_pdf_signals[PDFTRICKS_SPLIT_PDF_PROCCESS_FINISHED_SIGNAL], 0, pdftricks_split_pdf_split_file_range_finish (self, res));
}

static void
______lambda13__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	_____lambda13_ ((pdftricksSplitPDF*) self, source_object, res);
	g_object_unref (self);
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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 NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected 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 NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	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 NULL;
}

static void
_______lambda14_ (pdftricksSplitPDF* self,
                  GObject* obj,
                  GAsyncResult* res)
{
	g_return_if_fail (res != NULL);
	g_signal_emit (self, pdftricks_split_pdf_signals[PDFTRICKS_SPLIT_PDF_PROCCESS_FINISHED_SIGNAL], 0, pdftricks_split_pdf_split_file_range_finish (self, res));
}

static void
________lambda14__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self)
{
	_______lambda14_ ((pdftricksSplitPDF*) self, source_object, res);
	g_object_unref (self);
}

static void
pdftricks_split_pdf_confirm_split (pdftricksSplitPDF* self)
{
	gboolean split = FALSE;
	gchar* file_pdf = NULL;
	GtkFileChooserButton* _tmp0_;
	gchar* _tmp1_;
	gchar* output_file = NULL;
	gchar* _tmp2_;
	GtkFileChooserNative* chooser_output = NULL;
	GtkWindow* _tmp3_;
	GtkFileChooserNative* _tmp4_;
	gchar** split_filename = NULL;
	const gchar* _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gint split_filename_length1;
	gint _split_filename_size_;
	gchar* filename = NULL;
	gchar** _tmp8_;
	gint _tmp8__length1;
	gchar** _tmp9_;
	gint _tmp9__length1;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	GtkFileChooserNative* _tmp12_;
	const gchar* _tmp13_;
	GtkFileChooserNative* _tmp14_;
	const gchar* _tmp15_;
	GtkFileChooserNative* _tmp16_;
	GtkFileChooserNative* _tmp17_;
	GtkFileChooserNative* _tmp20_;
	g_return_if_fail (self != NULL);
	split = FALSE;
	_tmp0_ = self->priv->filechooser;
	_tmp1_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp0_);
	file_pdf = _tmp1_;
	_tmp2_ = g_strdup ("");
	output_file = _tmp2_;
	_tmp3_ = self->priv->_window;
	_tmp4_ = gtk_file_chooser_native_new (_ ("Select the file to compress"), _tmp3_, GTK_FILE_CHOOSER_ACTION_SAVE, _ ("Save"), _ ("Cancel"));
	chooser_output = _tmp4_;
	_tmp5_ = file_pdf;
	_tmp7_ = _tmp6_ = g_strsplit (_tmp5_, "/", 0);
	split_filename = _tmp7_;
	split_filename_length1 = _vala_array_length (_tmp6_);
	_split_filename_size_ = split_filename_length1;
	_tmp8_ = split_filename;
	_tmp8__length1 = split_filename_length1;
	_tmp9_ = split_filename;
	_tmp9__length1 = split_filename_length1;
	_tmp10_ = _tmp8_[_tmp9__length1 - 1];
	_tmp11_ = g_strdup (_tmp10_);
	filename = _tmp11_;
	_tmp12_ = chooser_output;
	_tmp13_ = file_pdf;
	gtk_file_chooser_set_current_folder ((GtkFileChooser*) _tmp12_, _tmp13_);
	_tmp14_ = chooser_output;
	_tmp15_ = filename;
	gtk_file_chooser_set_current_name ((GtkFileChooser*) _tmp14_, _tmp15_);
	_tmp16_ = chooser_output;
	gtk_file_chooser_set_do_overwrite_confirmation ((GtkFileChooser*) _tmp16_, FALSE);
	_tmp17_ = chooser_output;
	if (gtk_native_dialog_run ((GtkNativeDialog*) _tmp17_) == ((gint) GTK_RESPONSE_ACCEPT)) {
		GtkFileChooserNative* _tmp18_;
		gchar* _tmp19_;
		_tmp18_ = chooser_output;
		_tmp19_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp18_);
		_g_free0 (output_file);
		output_file = _tmp19_;
		split = TRUE;
	}
	_tmp20_ = chooser_output;
	gtk_native_dialog_destroy ((GtkNativeDialog*) _tmp20_);
	if (split == TRUE) {
		const gchar* _tmp21_;
		_tmp21_ = self->priv->type_split;
		if (g_strcmp0 (_tmp21_, "all") == 0) {
			const gchar* _tmp22_;
			const gchar* _tmp23_;
			g_signal_emit (self, pdftricks_split_pdf_signals[PDFTRICKS_SPLIT_PDF_PROCCESS_BEGIN_SIGNAL], 0);
			_tmp22_ = file_pdf;
			_tmp23_ = output_file;
			pdftricks_split_pdf_split_file_all (self, _tmp22_, _tmp23_, _____lambda11__gasync_ready_callback, g_object_ref (self));
		} else {
			const gchar* _tmp24_;
			_tmp24_ = self->priv->type_split;
			if (g_strcmp0 (_tmp24_, "range") == 0) {
				gchar* pages = NULL;
				GtkEntry* _tmp25_;
				const gchar* _tmp26_;
				gchar* _tmp27_;
				const gchar* _tmp28_;
				const gchar* _tmp29_;
				const gchar* _tmp30_;
				_tmp25_ = self->priv->entry_range;
				_tmp26_ = gtk_entry_get_text (_tmp25_);
				_tmp27_ = g_strdup (_tmp26_);
				pages = _tmp27_;
				g_signal_emit (self, pdftricks_split_pdf_signals[PDFTRICKS_SPLIT_PDF_PROCCESS_BEGIN_SIGNAL], 0);
				_tmp28_ = file_pdf;
				_tmp29_ = output_file;
				_tmp30_ = pages;
				pdftricks_split_pdf_split_file_range (self, _tmp28_, _tmp29_, _tmp30_, ______lambda13__gasync_ready_callback, g_object_ref (self));
				_g_free0 (pages);
			} else {
				const gchar* _tmp31_;
				_tmp31_ = self->priv->type_split;
				if (g_strcmp0 (_tmp31_, "colors") == 0) {
					gchar* pages = NULL;
					const gchar* _tmp32_;
					gchar* _tmp33_;
					gboolean _tmp34_ = FALSE;
					const gchar* _tmp35_;
					_tmp32_ = file_pdf;
					_tmp33_ = pdftricks_split_pdf_get_colors (self, _tmp32_);
					pages = _tmp33_;
					_tmp35_ = pages;
					if (g_strcmp0 (_tmp35_, "") != 0) {
						const gchar* _tmp36_;
						_tmp36_ = pages;
						_tmp34_ = g_strcmp0 (_tmp36_, ";") != 0;
					} else {
						_tmp34_ = FALSE;
					}
					if (_tmp34_) {
						gchar* pages_black = NULL;
						const gchar* _tmp37_;
						gchar** _tmp38_;
						gchar** _tmp39_;
						gchar** _tmp40_;
						gint _tmp40__length1;
						const gchar* _tmp41_;
						gchar* _tmp42_;
						gchar* _tmp43_;
						gchar* pages_colored = NULL;
						const gchar* _tmp44_;
						gchar** _tmp45_;
						gchar** _tmp46_;
						gchar** _tmp47_;
						gint _tmp47__length1;
						const gchar* _tmp48_;
						gchar* _tmp49_;
						gchar* _tmp50_;
						gchar* output_file_black = NULL;
						const gchar* _tmp51_;
						gchar* _tmp52_;
						gchar* output_file_colored = NULL;
						const gchar* _tmp53_;
						gchar* _tmp54_;
						const gchar* _tmp55_;
						const gchar* _tmp56_;
						const gchar* _tmp57_;
						const gchar* _tmp58_;
						const gchar* _tmp59_;
						const gchar* _tmp60_;
						_tmp37_ = pages;
						_tmp39_ = _tmp38_ = g_strsplit (_tmp37_, ";", 0);
						_tmp40_ = _tmp39_;
						_tmp40__length1 = _vala_array_length (_tmp38_);
						_tmp41_ = _tmp40_[0];
						_tmp42_ = pdftricks_split_pdf_group_list (self, _tmp41_);
						_tmp43_ = _tmp42_;
						_tmp40_ = (_vala_array_free (_tmp40_, _tmp40__length1, (GDestroyNotify) g_free), NULL);
						pages_black = _tmp43_;
						_tmp44_ = pages;
						_tmp46_ = _tmp45_ = g_strsplit (_tmp44_, ";", 0);
						_tmp47_ = _tmp46_;
						_tmp47__length1 = _vala_array_length (_tmp45_);
						_tmp48_ = _tmp47_[1];
						_tmp49_ = pdftricks_split_pdf_group_list (self, _tmp48_);
						_tmp50_ = _tmp49_;
						_tmp47_ = (_vala_array_free (_tmp47_, _tmp47__length1, (GDestroyNotify) g_free), NULL);
						pages_colored = _tmp50_;
						_tmp51_ = output_file;
						_tmp52_ = string_replace (_tmp51_, ".pdf", "_black.pdf");
						output_file_black = _tmp52_;
						_tmp53_ = output_file;
						_tmp54_ = string_replace (_tmp53_, ".pdf", "_colored.pdf");
						output_file_colored = _tmp54_;
						g_signal_emit (self, pdftricks_split_pdf_signals[PDFTRICKS_SPLIT_PDF_PROCCESS_BEGIN_SIGNAL], 0);
						_tmp55_ = file_pdf;
						_tmp56_ = output_file_black;
						_tmp57_ = pages_black;
						pdftricks_split_pdf_split_file_range (self, _tmp55_, _tmp56_, _tmp57_, NULL, NULL);
						_tmp58_ = file_pdf;
						_tmp59_ = output_file_colored;
						_tmp60_ = pages_colored;
						pdftricks_split_pdf_split_file_range (self, _tmp58_, _tmp59_, _tmp60_, ________lambda14__gasync_ready_callback, g_object_ref (self));
						_g_free0 (output_file_colored);
						_g_free0 (output_file_black);
						_g_free0 (pages_colored);
						_g_free0 (pages_black);
					}
					_g_free0 (pages);
				}
			}
		}
	}
	_g_free0 (filename);
	split_filename = (_vala_array_free (split_filename, split_filename_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (chooser_output);
	_g_free0 (output_file);
	_g_free0 (file_pdf);
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static gchar*
pdftricks_split_pdf_get_colors (pdftricksSplitPDF* self,
                                const gchar* input)
{
	gchar* file_pdf = NULL;
	gchar* _tmp0_;
	gchar* output = NULL;
	gchar* stderr = NULL;
	gchar* _tmp1_;
	gint exit_status = 0;
	GtkSpinner* _tmp2_;
	const gchar* _tmp16_;
	GtkSpinner* _tmp18_;
	gchar** split_output = NULL;
	const gchar* _tmp19_;
	gchar** _tmp20_;
	gchar** _tmp21_;
	gint split_output_length1;
	gint _split_output_size_;
	gchar* pages_color = NULL;
	gchar* _tmp22_;
	gchar* pages_black = NULL;
	gchar* _tmp23_;
	const gchar* _tmp57_;
	const gchar* _tmp58_;
	gint _tmp59_;
	gint _tmp60_;
	gchar* _tmp61_;
	gchar* _tmp62_;
	gboolean _tmp63_;
	const gchar* _tmp69_;
	const gchar* _tmp70_;
	gint _tmp71_;
	gint _tmp72_;
	gchar* _tmp73_;
	gchar* _tmp74_;
	gboolean _tmp75_;
	const gchar* _tmp81_;
	gchar* _tmp82_;
	gchar* _tmp83_;
	const gchar* _tmp84_;
	gchar* _tmp85_;
	gchar* _tmp86_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (input != NULL, NULL);
	_tmp0_ = g_strdup (input);
	file_pdf = _tmp0_;
	_tmp1_ = g_strdup ("");
	stderr = _tmp1_;
	exit_status = 0;
	_tmp2_ = self->priv->spinner;
	gtk_widget_show ((GtkWidget*) _tmp2_);
	{
		gchar* cmd = NULL;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_ = NULL;
		gchar* _tmp10_ = NULL;
		gint _tmp11_ = 0;
		_tmp3_ = file_pdf;
		_tmp4_ = g_strconcat ("gs -dNOPAUSE -dQUIET -dBATCH -q  -o - -sDEVICE=inkcov \"", _tmp3_, NULL);
		_tmp5_ = _tmp4_;
		_tmp6_ = g_strconcat (_tmp5_, "\" -c quit  | grep -v Page", NULL);
		_tmp7_ = _tmp6_;
		_g_free0 (_tmp5_);
		cmd = _tmp7_;
		_tmp8_ = cmd;
		g_spawn_command_line_sync (_tmp8_, &_tmp9_, &_tmp10_, &_tmp11_, &_inner_error0_);
		_g_free0 (output);
		output = _tmp9_;
		_g_free0 (stderr);
		stderr = _tmp10_;
		exit_status = _tmp11_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (cmd);
			goto __catch0_g_error;
		}
		_g_free0 (cmd);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp12_;
		const gchar* _tmp13_;
		GtkSpinner* _tmp14_;
		gchar* _tmp15_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp12_ = e;
		_tmp13_ = _tmp12_->message;
		g_critical ("SplitPDF.vala:319: %s", _tmp13_);
		_tmp14_ = self->priv->spinner;
		gtk_widget_hide ((GtkWidget*) _tmp14_);
		_tmp15_ = g_strdup ("");
		result = _tmp15_;
		_g_error_free0 (e);
		_g_free0 (stderr);
		_g_free0 (output);
		_g_free0 (file_pdf);
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (stderr);
		_g_free0 (output);
		_g_free0 (file_pdf);
		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 NULL;
	}
	_tmp16_ = output;
	if (g_strcmp0 (_tmp16_, "") == 0) {
		gchar* _tmp17_;
		_tmp17_ = g_strdup ("");
		result = _tmp17_;
		_g_free0 (stderr);
		_g_free0 (output);
		_g_free0 (file_pdf);
		return result;
	}
	_tmp18_ = self->priv->spinner;
	gtk_widget_hide ((GtkWidget*) _tmp18_);
	_tmp19_ = output;
	_tmp21_ = _tmp20_ = g_strsplit (_tmp19_, "\n", 0);
	split_output = _tmp21_;
	split_output_length1 = _vala_array_length (_tmp20_);
	_split_output_size_ = split_output_length1;
	_tmp22_ = g_strdup ("");
	pages_color = _tmp22_;
	_tmp23_ = g_strdup ("");
	pages_black = _tmp23_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp24_ = FALSE;
			_tmp24_ = TRUE;
			while (TRUE) {
				gchar** _tmp26_;
				gint _tmp26__length1;
				gchar* page = NULL;
				gchar** _tmp27_;
				gint _tmp27__length1;
				const gchar* _tmp28_;
				gchar* _tmp29_;
				const gchar* _tmp30_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				_tmp26_ = split_output;
				_tmp26__length1 = split_output_length1;
				if (!(i < _tmp26__length1)) {
					break;
				}
				_tmp27_ = split_output;
				_tmp27__length1 = split_output_length1;
				_tmp28_ = _tmp27_[i];
				_tmp29_ = string_strip (_tmp28_);
				page = _tmp29_;
				_tmp30_ = page;
				if (string_contains (_tmp30_, "CMYK OK")) {
					gchar** cmyk = NULL;
					const gchar* _tmp31_;
					gchar* _tmp32_;
					gchar* _tmp33_;
					gchar** _tmp34_;
					gchar** _tmp35_;
					gchar** _tmp36_;
					gint _tmp36__length1;
					gint cmyk_length1;
					gint _cmyk_size_;
					gboolean _tmp37_ = FALSE;
					gboolean _tmp38_ = FALSE;
					gchar** _tmp39_;
					gint _tmp39__length1;
					const gchar* _tmp40_;
					_tmp31_ = page;
					_tmp32_ = string_replace (_tmp31_, "  ", " ");
					_tmp33_ = _tmp32_;
					_tmp35_ = _tmp34_ = g_strsplit (_tmp33_, " ", 0);
					_tmp36_ = _tmp35_;
					_tmp36__length1 = _vala_array_length (_tmp34_);
					_g_free0 (_tmp33_);
					cmyk = _tmp36_;
					cmyk_length1 = _tmp36__length1;
					_cmyk_size_ = cmyk_length1;
					_tmp39_ = cmyk;
					_tmp39__length1 = cmyk_length1;
					_tmp40_ = _tmp39_[0];
					if (g_strcmp0 (_tmp40_, "0.00000") == 0) {
						gchar** _tmp41_;
						gint _tmp41__length1;
						const gchar* _tmp42_;
						_tmp41_ = cmyk;
						_tmp41__length1 = cmyk_length1;
						_tmp42_ = _tmp41_[1];
						_tmp38_ = g_strcmp0 (_tmp42_, "0.00000") == 0;
					} else {
						_tmp38_ = FALSE;
					}
					if (_tmp38_) {
						gchar** _tmp43_;
						gint _tmp43__length1;
						const gchar* _tmp44_;
						_tmp43_ = cmyk;
						_tmp43__length1 = cmyk_length1;
						_tmp44_ = _tmp43_[2];
						_tmp37_ = g_strcmp0 (_tmp44_, "0.00000") == 0;
					} else {
						_tmp37_ = FALSE;
					}
					if (_tmp37_) {
						const gchar* _tmp45_;
						gchar* _tmp46_;
						gchar* _tmp47_;
						gchar* _tmp48_;
						gchar* _tmp49_;
						gchar* _tmp50_;
						_tmp45_ = pages_black;
						_tmp46_ = g_strdup_printf ("%i", i + 1);
						_tmp47_ = _tmp46_;
						_tmp48_ = g_strconcat (_tmp45_, _tmp47_, NULL);
						_tmp49_ = _tmp48_;
						_tmp50_ = g_strconcat (_tmp49_, ",", NULL);
						_g_free0 (pages_black);
						pages_black = _tmp50_;
						_g_free0 (_tmp49_);
						_g_free0 (_tmp47_);
					} else {
						const gchar* _tmp51_;
						gchar* _tmp52_;
						gchar* _tmp53_;
						gchar* _tmp54_;
						gchar* _tmp55_;
						gchar* _tmp56_;
						_tmp51_ = pages_color;
						_tmp52_ = g_strdup_printf ("%i", i + 1);
						_tmp53_ = _tmp52_;
						_tmp54_ = g_strconcat (_tmp51_, _tmp53_, NULL);
						_tmp55_ = _tmp54_;
						_tmp56_ = g_strconcat (_tmp55_, ",", NULL);
						_g_free0 (pages_color);
						pages_color = _tmp56_;
						_g_free0 (_tmp55_);
						_g_free0 (_tmp53_);
					}
					cmyk = (_vala_array_free (cmyk, cmyk_length1, (GDestroyNotify) g_free), NULL);
				}
				_g_free0 (page);
			}
		}
	}
	_tmp57_ = pages_black;
	_tmp58_ = pages_black;
	_tmp59_ = strlen (_tmp58_);
	_tmp60_ = _tmp59_;
	_tmp61_ = string_substring (_tmp57_, (glong) (_tmp60_ - 1), (glong) -1);
	_tmp62_ = _tmp61_;
	_tmp63_ = g_strcmp0 (_tmp62_, ",") == 0;
	_g_free0 (_tmp62_);
	if (_tmp63_) {
		const gchar* _tmp64_;
		const gchar* _tmp65_;
		gint _tmp66_;
		gint _tmp67_;
		gchar* _tmp68_;
		_tmp64_ = pages_black;
		_tmp65_ = pages_black;
		_tmp66_ = strlen (_tmp65_);
		_tmp67_ = _tmp66_;
		_tmp68_ = string_substring (_tmp64_, (glong) 0, (glong) (_tmp67_ - 1));
		_g_free0 (pages_black);
		pages_black = _tmp68_;
	}
	_tmp69_ = pages_color;
	_tmp70_ = pages_color;
	_tmp71_ = strlen (_tmp70_);
	_tmp72_ = _tmp71_;
	_tmp73_ = string_substring (_tmp69_, (glong) (_tmp72_ - 1), (glong) -1);
	_tmp74_ = _tmp73_;
	_tmp75_ = g_strcmp0 (_tmp74_, ",") == 0;
	_g_free0 (_tmp74_);
	if (_tmp75_) {
		const gchar* _tmp76_;
		const gchar* _tmp77_;
		gint _tmp78_;
		gint _tmp79_;
		gchar* _tmp80_;
		_tmp76_ = pages_color;
		_tmp77_ = pages_color;
		_tmp78_ = strlen (_tmp77_);
		_tmp79_ = _tmp78_;
		_tmp80_ = string_substring (_tmp76_, (glong) 0, (glong) (_tmp79_ - 1));
		_g_free0 (pages_color);
		pages_color = _tmp80_;
	}
	_tmp81_ = pages_black;
	_tmp82_ = g_strconcat (_tmp81_, ";", NULL);
	_tmp83_ = _tmp82_;
	_tmp84_ = pages_color;
	_tmp85_ = g_strconcat (_tmp83_, _tmp84_, NULL);
	_tmp86_ = _tmp85_;
	_g_free0 (_tmp83_);
	result = _tmp86_;
	_g_free0 (pages_black);
	_g_free0 (pages_color);
	split_output = (_vala_array_free (split_output, split_output_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (stderr);
	_g_free0 (output);
	_g_free0 (file_pdf);
	return result;
}

static void
pdftricks_split_pdf_split_file_all_data_free (gpointer _data)
{
	PdftricksSplitPdfSplitFileAllData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (PdftricksSplitPdfSplitFileAllData, _data_);
}

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

static void
pdftricks_split_pdf_split_file_all (pdftricksSplitPDF* self,
                                    const gchar* input,
                                    const gchar* output_file,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	PdftricksSplitPdfSplitFileAllData* _data_;
	pdftricksSplitPDF* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (input != NULL);
	g_return_if_fail (output_file != NULL);
	_data_ = g_slice_new0 (PdftricksSplitPdfSplitFileAllData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, pdftricks_split_pdf_split_file_all_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (input);
	_g_free0 (_data_->input);
	_data_->input = _tmp1_;
	_tmp2_ = g_strdup (output_file);
	_g_free0 (_data_->output_file);
	_data_->output_file = _tmp2_;
	pdftricks_split_pdf_split_file_all_co (_data_);
}

static gboolean
pdftricks_split_pdf_split_file_all_finish (pdftricksSplitPDF* self,
                                           GAsyncResult* _res_)
{
	gboolean result;
	PdftricksSplitPdfSplitFileAllData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		pdftricksSplitPDF* self;
		self = _data3_->self;
		(_data3_->callback_target_destroy_notify == NULL) ? NULL : (_data3_->callback_target_destroy_notify (_data3_->callback_target), NULL);
		_data3_->callback = NULL;
		_data3_->callback_target = NULL;
		_data3_->callback_target_destroy_notify = NULL;
		_g_free0 (_data3_->input);
		_g_free0 (_data3_->output_file);
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static gboolean
_pdftricks_split_pdf_split_file_all_co_gsource_func (gpointer self)
{
	gboolean result;
	result = pdftricks_split_pdf_split_file_all_co (self);
	return result;
}

static void*
__lambda10_ (Block3Data* _data3_)
{
	pdftricksSplitPDF* self;
	GSourceFunc _tmp4_;
	gpointer _tmp4__target;
	GDestroyNotify _tmp4__target_destroy_notify;
	void* result;
	self = _data3_->self;
	{
		gint a = 0;
		a = 1;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gchar* _tmp2_;
				gchar* _tmp3_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = a;
					a = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(a <= self->priv->page_size)) {
					break;
				}
				_tmp2_ = g_strdup_printf ("%i", a);
				_tmp3_ = _tmp2_;
				pdftricks_split_pdf_split_page_range (self, _data3_->input, _data3_->output_file, a, a, _tmp3_);
				_g_free0 (_tmp3_);
			}
		}
	}
	_tmp4_ = _data3_->callback;
	_tmp4__target = _data3_->callback_target;
	_tmp4__target_destroy_notify = _data3_->callback_target_destroy_notify;
	_data3_->callback = NULL;
	_data3_->callback_target = NULL;
	_data3_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp4_, _tmp4__target, _tmp4__target_destroy_notify);
	result = NULL;
	return result;
}

static gpointer
___lambda10__gthread_func (gpointer self)
{
	gpointer result;
	result = __lambda10_ (self);
	block3_data_unref (self);
	return result;
}

static gboolean
pdftricks_split_pdf_split_file_all_co (PdftricksSplitPdfSplitFileAllData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data3_ = g_slice_new0 (Block3Data);
	_data_->_data3_->_ref_count_ = 1;
	_data_->_data3_->self = g_object_ref (_data_->self);
	_g_free0 (_data_->_data3_->input);
	_data_->_data3_->input = _data_->input;
	_g_free0 (_data_->_data3_->output_file);
	_data_->_data3_->output_file = _data_->output_file;
	_data_->_data3_->_async_data_ = _data_;
	_data_->ret = TRUE;
	_data_->_data3_->callback = _pdftricks_split_pdf_split_file_all_co_gsource_func;
	_data_->_data3_->callback_target = _data_;
	_data_->_data3_->callback_target_destroy_notify = NULL;
	_data_->run = ___lambda10__gthread_func;
	_data_->run_target = block3_data_ref (_data_->_data3_);
	{
		_data_->_tmp0_ = g_thread_try_new (NULL, _data_->run, _data_->run_target, &_data_->_inner_error0_);
		_data_->_tmp1_ = _data_->_tmp0_;
		_g_thread_unref0 (_data_->_tmp1_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp2_ = _data_->e;
		_data_->_tmp3_ = _data_->_tmp2_->message;
		g_warning ("SplitPDF.vala:363: %s", _data_->_tmp3_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		block3_data_unref (_data_->_data3_);
		_data_->_data3_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->result = _data_->ret;
	block3_data_unref (_data_->_data3_);
	_data_->_data3_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
pdftricks_split_pdf_split_file_range_data_free (gpointer _data)
{
	PdftricksSplitPdfSplitFileRangeData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (PdftricksSplitPdfSplitFileRangeData, _data_);
}

static void
pdftricks_split_pdf_split_file_range (pdftricksSplitPDF* self,
                                      const gchar* input,
                                      const gchar* output_file,
                                      const gchar* pages,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	PdftricksSplitPdfSplitFileRangeData* _data_;
	pdftricksSplitPDF* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (input != NULL);
	g_return_if_fail (output_file != NULL);
	g_return_if_fail (pages != NULL);
	_data_ = g_slice_new0 (PdftricksSplitPdfSplitFileRangeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, pdftricks_split_pdf_split_file_range_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (input);
	_g_free0 (_data_->input);
	_data_->input = _tmp1_;
	_tmp2_ = g_strdup (output_file);
	_g_free0 (_data_->output_file);
	_data_->output_file = _tmp2_;
	_tmp3_ = g_strdup (pages);
	_g_free0 (_data_->pages);
	_data_->pages = _tmp3_;
	pdftricks_split_pdf_split_file_range_co (_data_);
}

static gboolean
pdftricks_split_pdf_split_file_range_finish (pdftricksSplitPDF* self,
                                             GAsyncResult* _res_)
{
	gboolean result;
	PdftricksSplitPdfSplitFileRangeData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		pdftricksSplitPDF* self;
		self = _data4_->self;
		(_data4_->callback_target_destroy_notify == NULL) ? NULL : (_data4_->callback_target_destroy_notify (_data4_->callback_target), NULL);
		_data4_->callback = NULL;
		_data4_->callback_target = NULL;
		_data4_->callback_target_destroy_notify = NULL;
		_g_free0 (_data4_->input);
		_g_free0 (_data4_->output_file);
		_g_free0 (_data4_->pages);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static gboolean
_pdftricks_split_pdf_split_file_range_co_gsource_func (gpointer self)
{
	gboolean result;
	result = pdftricks_split_pdf_split_file_range_co (self);
	return result;
}

static void*
__lambda12_ (Block4Data* _data4_)
{
	pdftricksSplitPDF* self;
	gchar** list_pages = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint list_pages_length1;
	gint _list_pages_size_;
	GSourceFunc _tmp33_;
	gpointer _tmp33__target;
	GDestroyNotify _tmp33__target_destroy_notify;
	void* result;
	self = _data4_->self;
	_tmp1_ = _tmp0_ = g_strsplit (_data4_->pages, ",", 0);
	list_pages = _tmp1_;
	list_pages_length1 = _vala_array_length (_tmp0_);
	_list_pages_size_ = list_pages_length1;
	{
		gint a = 0;
		a = 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				gchar** _tmp4_;
				gint _tmp4__length1;
				gchar* page = NULL;
				gchar** _tmp5_;
				gint _tmp5__length1;
				const gchar* _tmp6_;
				gchar* _tmp7_;
				gchar* start_page = NULL;
				const gchar* _tmp8_;
				gchar* _tmp9_;
				gchar* end_page = NULL;
				const gchar* _tmp10_;
				gchar* _tmp11_;
				gboolean _tmp12_ = FALSE;
				const gchar* _tmp13_;
				const gchar* _tmp30_;
				const gchar* _tmp31_;
				const gchar* _tmp32_;
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = a;
					a = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				_tmp4_ = list_pages;
				_tmp4__length1 = list_pages_length1;
				if (!(a < _tmp4__length1)) {
					break;
				}
				_tmp5_ = list_pages;
				_tmp5__length1 = list_pages_length1;
				_tmp6_ = _tmp5_[a];
				_tmp7_ = g_strdup (_tmp6_);
				page = _tmp7_;
				_tmp8_ = page;
				_tmp9_ = g_strdup (_tmp8_);
				start_page = _tmp9_;
				_tmp10_ = page;
				_tmp11_ = g_strdup (_tmp10_);
				end_page = _tmp11_;
				_tmp13_ = page;
				if (string_contains (_tmp13_, "-")) {
					const gchar* _tmp14_;
					gchar** _tmp15_;
					gchar** _tmp16_;
					gchar** _tmp17_;
					gint _tmp17__length1;
					_tmp14_ = page;
					_tmp16_ = _tmp15_ = g_strsplit (_tmp14_, "-", 0);
					_tmp17_ = _tmp16_;
					_tmp17__length1 = _vala_array_length (_tmp15_);
					_tmp12_ = _vala_array_length (_tmp15_) == 2;
					_tmp17_ = (_vala_array_free (_tmp17_, _tmp17__length1, (GDestroyNotify) g_free), NULL);
				} else {
					_tmp12_ = FALSE;
				}
				if (_tmp12_) {
					const gchar* _tmp18_;
					gchar** _tmp19_;
					gchar** _tmp20_;
					gchar** _tmp21_;
					gint _tmp21__length1;
					const gchar* _tmp22_;
					gchar* _tmp23_;
					const gchar* _tmp24_;
					gchar** _tmp25_;
					gchar** _tmp26_;
					gchar** _tmp27_;
					gint _tmp27__length1;
					const gchar* _tmp28_;
					gchar* _tmp29_;
					_tmp18_ = page;
					_tmp20_ = _tmp19_ = g_strsplit (_tmp18_, "-", 0);
					_tmp21_ = _tmp20_;
					_tmp21__length1 = _vala_array_length (_tmp19_);
					_tmp22_ = _tmp21_[0];
					_tmp23_ = g_strdup (_tmp22_);
					_g_free0 (start_page);
					start_page = _tmp23_;
					_tmp21_ = (_vala_array_free (_tmp21_, _tmp21__length1, (GDestroyNotify) g_free), NULL);
					_tmp24_ = page;
					_tmp26_ = _tmp25_ = g_strsplit (_tmp24_, "-", 0);
					_tmp27_ = _tmp26_;
					_tmp27__length1 = _vala_array_length (_tmp25_);
					_tmp28_ = _tmp27_[1];
					_tmp29_ = g_strdup (_tmp28_);
					_g_free0 (end_page);
					end_page = _tmp29_;
					_tmp27_ = (_vala_array_free (_tmp27_, _tmp27__length1, (GDestroyNotify) g_free), NULL);
				}
				_tmp30_ = start_page;
				_tmp31_ = end_page;
				_tmp32_ = page;
				pdftricks_split_pdf_split_page_range (self, _data4_->input, _data4_->output_file, atoi (_tmp30_), atoi (_tmp31_), _tmp32_);
				_g_free0 (end_page);
				_g_free0 (start_page);
				_g_free0 (page);
			}
		}
	}
	_tmp33_ = _data4_->callback;
	_tmp33__target = _data4_->callback_target;
	_tmp33__target_destroy_notify = _data4_->callback_target_destroy_notify;
	_data4_->callback = NULL;
	_data4_->callback_target = NULL;
	_data4_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp33_, _tmp33__target, _tmp33__target_destroy_notify);
	result = NULL;
	list_pages = (_vala_array_free (list_pages, list_pages_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static gpointer
___lambda12__gthread_func (gpointer self)
{
	gpointer result;
	result = __lambda12_ (self);
	block4_data_unref (self);
	return result;
}

static gboolean
pdftricks_split_pdf_split_file_range_co (PdftricksSplitPdfSplitFileRangeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data4_ = g_slice_new0 (Block4Data);
	_data_->_data4_->_ref_count_ = 1;
	_data_->_data4_->self = g_object_ref (_data_->self);
	_g_free0 (_data_->_data4_->input);
	_data_->_data4_->input = _data_->input;
	_g_free0 (_data_->_data4_->output_file);
	_data_->_data4_->output_file = _data_->output_file;
	_g_free0 (_data_->_data4_->pages);
	_data_->_data4_->pages = _data_->pages;
	_data_->_data4_->_async_data_ = _data_;
	_data_->ret = TRUE;
	_data_->_data4_->callback = _pdftricks_split_pdf_split_file_range_co_gsource_func;
	_data_->_data4_->callback_target = _data_;
	_data_->_data4_->callback_target_destroy_notify = NULL;
	_data_->run = ___lambda12__gthread_func;
	_data_->run_target = block4_data_ref (_data_->_data4_);
	{
		_data_->_tmp0_ = g_thread_try_new (NULL, _data_->run, _data_->run_target, &_data_->_inner_error0_);
		_data_->_tmp1_ = _data_->_tmp0_;
		_g_thread_unref0 (_data_->_tmp1_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp2_ = _data_->e;
		_data_->_tmp3_ = _data_->_tmp2_->message;
		g_warning ("SplitPDF.vala:390: %s", _data_->_tmp3_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		block4_data_unref (_data_->_data4_);
		_data_->_data4_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->result = _data_->ret;
	block4_data_unref (_data_->_data4_);
	_data_->_data4_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gboolean
pdftricks_split_pdf_split_page_range (pdftricksSplitPDF* self,
                                      const gchar* input,
                                      const gchar* output_file,
                                      gint page_start,
                                      gint page_end,
                                      const gchar* label)
{
	gchar* file_pdf = NULL;
	gchar* _tmp0_;
	gchar* output = NULL;
	gchar* stderr = NULL;
	gchar* _tmp1_;
	gint exit_status = 0;
	gchar* output_filename = NULL;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp37_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (input != NULL, FALSE);
	g_return_val_if_fail (output_file != NULL, FALSE);
	g_return_val_if_fail (label != NULL, FALSE);
	_tmp0_ = g_strdup (input);
	file_pdf = _tmp0_;
	_tmp1_ = g_strdup ("");
	stderr = _tmp1_;
	exit_status = 0;
	_tmp2_ = g_strconcat ("_", label, NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat (_tmp3_, ".pdf", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = string_replace (output_file, ".pdf", _tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	output_filename = _tmp7_;
	{
		gchar* cmd = NULL;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		const gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		gchar* _tmp24_;
		const gchar* _tmp25_;
		gchar* _tmp26_;
		gchar* _tmp27_;
		gchar* _tmp28_;
		gchar* _tmp29_;
		const gchar* _tmp30_;
		gchar* _tmp31_ = NULL;
		gchar* _tmp32_ = NULL;
		gint _tmp33_ = 0;
		_tmp8_ = g_strdup_printf ("%i", page_start);
		_tmp9_ = _tmp8_;
		_tmp10_ = g_strconcat ("gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATC" \
"H -dAutoFilterColorImages=false -dEncodeColorImages=true -dColorImageF" \
"ilter=/DCTEncode -dFirstPage=", _tmp9_, NULL);
		_tmp11_ = _tmp10_;
		_tmp12_ = g_strconcat (_tmp11_, " -dLastPage=", NULL);
		_tmp13_ = _tmp12_;
		_tmp14_ = g_strdup_printf ("%i", page_end);
		_tmp15_ = _tmp14_;
		_tmp16_ = g_strconcat (_tmp13_, _tmp15_, NULL);
		_tmp17_ = _tmp16_;
		_tmp18_ = g_strconcat (_tmp17_, " -sOutputFile=\"", NULL);
		_tmp19_ = _tmp18_;
		_tmp20_ = output_filename;
		_tmp21_ = g_strconcat (_tmp19_, _tmp20_, NULL);
		_tmp22_ = _tmp21_;
		_tmp23_ = g_strconcat (_tmp22_, "\" \"", NULL);
		_tmp24_ = _tmp23_;
		_tmp25_ = file_pdf;
		_tmp26_ = g_strconcat (_tmp24_, _tmp25_, NULL);
		_tmp27_ = _tmp26_;
		_tmp28_ = g_strconcat (_tmp27_, "\"", NULL);
		_tmp29_ = _tmp28_;
		_g_free0 (_tmp27_);
		_g_free0 (_tmp24_);
		_g_free0 (_tmp22_);
		_g_free0 (_tmp19_);
		_g_free0 (_tmp17_);
		_g_free0 (_tmp15_);
		_g_free0 (_tmp13_);
		_g_free0 (_tmp11_);
		_g_free0 (_tmp9_);
		cmd = _tmp29_;
		_tmp30_ = cmd;
		g_spawn_command_line_sync (_tmp30_, &_tmp31_, &_tmp32_, &_tmp33_, &_inner_error0_);
		_g_free0 (output);
		output = _tmp31_;
		_g_free0 (stderr);
		stderr = _tmp32_;
		exit_status = _tmp33_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (cmd);
			goto __catch0_g_error;
		}
		_g_free0 (cmd);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp34_;
		const gchar* _tmp35_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp34_ = e;
		_tmp35_ = _tmp34_->message;
		g_critical ("SplitPDF.vala:405: %s", _tmp35_);
		result = FALSE;
		_g_error_free0 (e);
		_g_free0 (output_filename);
		_g_free0 (stderr);
		_g_free0 (output);
		_g_free0 (file_pdf);
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp36_ = FALSE;
		_g_free0 (output_filename);
		_g_free0 (stderr);
		_g_free0 (output);
		_g_free0 (file_pdf);
		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 _tmp36_;
	}
	_tmp37_ = output;
	if (g_strcmp0 (_tmp37_, "") != 0) {
		const gchar* _tmp38_;
		_tmp38_ = output;
		if (string_contains (_tmp38_, "Error")) {
			result = FALSE;
			_g_free0 (output_filename);
			_g_free0 (stderr);
			_g_free0 (output);
			_g_free0 (file_pdf);
			return result;
		}
	}
	result = TRUE;
	_g_free0 (output_filename);
	_g_free0 (stderr);
	_g_free0 (output);
	_g_free0 (file_pdf);
	return result;
}

static gint
pdftricks_split_pdf_get_page_count (pdftricksSplitPDF* self,
                                    const gchar* input_file)
{
	gchar* file_pdf = NULL;
	gchar* _tmp0_;
	gchar* output = NULL;
	gchar* stderr = NULL;
	gchar* _tmp1_;
	gint exit_status = 0;
	gint _result_ = 0;
	const gchar* _tmp15_;
	GError* _inner_error0_ = NULL;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (input_file != NULL, -1);
	_tmp0_ = g_strdup (input_file);
	file_pdf = _tmp0_;
	_tmp1_ = g_strdup ("");
	stderr = _tmp1_;
	exit_status = 0;
	_result_ = 0;
	{
		gchar* cmd = NULL;
		const gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_ = NULL;
		gchar* _tmp9_ = NULL;
		gint _tmp10_ = 0;
		const gchar* _tmp11_;
		_tmp2_ = file_pdf;
		_tmp3_ = g_strconcat ("gs -q -dNODISPLAY -c \"(\"", _tmp2_, NULL);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strconcat (_tmp4_, "\") (r) file runpdfbegin pdfpagecount = quit\"", NULL);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		cmd = _tmp6_;
		_tmp7_ = cmd;
		g_spawn_command_line_sync (_tmp7_, &_tmp8_, &_tmp9_, &_tmp10_, &_inner_error0_);
		_g_free0 (output);
		output = _tmp8_;
		_g_free0 (stderr);
		stderr = _tmp9_;
		exit_status = _tmp10_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (cmd);
			goto __catch0_g_error;
		}
		_tmp11_ = output;
		_result_ = atoi (_tmp11_);
		_g_free0 (cmd);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp12_;
		const gchar* _tmp13_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp12_ = e;
		_tmp13_ = _tmp12_->message;
		g_critical ("SplitPDF.vala:426: %s", _tmp13_);
		result = 0;
		_g_error_free0 (e);
		_g_free0 (stderr);
		_g_free0 (output);
		_g_free0 (file_pdf);
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gint _tmp14_ = -1;
		_g_free0 (stderr);
		_g_free0 (output);
		_g_free0 (file_pdf);
		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 _tmp14_;
	}
	_tmp15_ = output;
	if (g_strcmp0 (_tmp15_, "") != 0) {
		const gchar* _tmp16_;
		_tmp16_ = output;
		if (string_contains (_tmp16_, "Error")) {
			result = 0;
			_g_free0 (stderr);
			_g_free0 (output);
			_g_free0 (file_pdf);
			return result;
		}
	}
	result = _result_;
	_g_free0 (stderr);
	_g_free0 (output);
	_g_free0 (file_pdf);
	return result;
}

static void
pdftricks_split_pdf_create_thumbs_data_free (gpointer _data)
{
	PdftricksSplitPdfCreateThumbsData* _data_;
	_data_ = _data;
	_g_free0 (_data_->input_file);
	_g_object_unref0 (_data_->self);
	g_slice_free (PdftricksSplitPdfCreateThumbsData, _data_);
}

static void
pdftricks_split_pdf_create_thumbs (pdftricksSplitPDF* self,
                                   const gchar* input_file,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	PdftricksSplitPdfCreateThumbsData* _data_;
	pdftricksSplitPDF* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (input_file != NULL);
	_data_ = g_slice_new0 (PdftricksSplitPdfCreateThumbsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, pdftricks_split_pdf_create_thumbs_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (input_file);
	_g_free0 (_data_->input_file);
	_data_->input_file = _tmp1_;
	pdftricks_split_pdf_create_thumbs_co (_data_);
}

static gboolean
pdftricks_split_pdf_create_thumbs_finish (pdftricksSplitPDF* self,
                                          GAsyncResult* _res_)
{
	gboolean result;
	PdftricksSplitPdfCreateThumbsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static Block5Data*
block5_data_ref (Block5Data* _data5_)
{
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		pdftricksSplitPDF* self;
		self = _data5_->self;
		(_data5_->callback_target_destroy_notify == NULL) ? NULL : (_data5_->callback_target_destroy_notify (_data5_->callback_target), NULL);
		_data5_->callback = NULL;
		_data5_->callback_target = NULL;
		_data5_->callback_target_destroy_notify = NULL;
		_g_free0 (_data5_->file_pdf);
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}

static gboolean
_pdftricks_split_pdf_create_thumbs_co_gsource_func (gpointer self)
{
	gboolean result;
	result = pdftricks_split_pdf_create_thumbs_co (self);
	return result;
}

static void*
__lambda15_ (Block5Data* _data5_)
{
	pdftricksSplitPDF* self;
	gchar* output = NULL;
	gchar* stderr = NULL;
	gchar* _tmp0_;
	gint exit_status = 0;
	const gchar* _tmp12_;
	GSourceFunc _tmp14_;
	gpointer _tmp14__target;
	GDestroyNotify _tmp14__target_destroy_notify;
	GError* _inner_error0_ = NULL;
	void* result;
	self = _data5_->self;
	_tmp0_ = g_strdup ("");
	stderr = _tmp0_;
	exit_status = 0;
	{
		gchar* cmd = NULL;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		gint _tmp7_ = 0;
		_tmp1_ = g_strconcat ("gs -dNumRenderingThreads=4 -dNOPAUSE -sDEVICE=jpeg -g125x175 -dPDFFitP" \
"age -sOutputFile=/tmp/h%d.jpg -dJPEGQ=100 -r300 -q \"", _data5_->file_pdf, NULL);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_strconcat (_tmp2_, "\" -c quit", NULL);
		_tmp4_ = _tmp3_;
		_g_free0 (_tmp2_);
		cmd = _tmp4_;
		g_spawn_command_line_sync (cmd, &_tmp5_, &_tmp6_, &_tmp7_, &_inner_error0_);
		_g_free0 (output);
		output = _tmp5_;
		_g_free0 (stderr);
		stderr = _tmp6_;
		exit_status = _tmp7_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (cmd);
			goto __catch0_g_error;
		}
		_g_free0 (cmd);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp8_;
		const gchar* _tmp9_;
		GtkSpinner* _tmp10_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp8_ = e;
		_tmp9_ = _tmp8_->message;
		g_print ("%s", _tmp9_);
		_tmp10_ = self->priv->spinner;
		g_object_set (_tmp10_, "active", FALSE, NULL);
		_data5_->ret = FALSE;
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (stderr);
		_g_free0 (output);
		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 NULL;
	}
	if (g_strcmp0 (output, "") != 0) {
		if (string_contains (output, "Error")) {
			GtkSpinner* _tmp11_;
			_tmp11_ = self->priv->spinner;
			g_object_set (_tmp11_, "active", FALSE, NULL);
			_data5_->ret = FALSE;
		}
	}
	_tmp12_ = stderr;
	if (g_strcmp0 (_tmp12_, "") != 0) {
		GtkSpinner* _tmp13_;
		_tmp13_ = self->priv->spinner;
		g_object_set (_tmp13_, "active", FALSE, NULL);
		_data5_->ret = FALSE;
	}
	_tmp14_ = _data5_->callback;
	_tmp14__target = _data5_->callback_target;
	_tmp14__target_destroy_notify = _data5_->callback_target_destroy_notify;
	_data5_->callback = NULL;
	_data5_->callback_target = NULL;
	_data5_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp14_, _tmp14__target, _tmp14__target_destroy_notify);
	result = NULL;
	_g_free0 (stderr);
	_g_free0 (output);
	return result;
}

static gpointer
___lambda15__gthread_func (gpointer self)
{
	gpointer result;
	result = __lambda15_ (self);
	block5_data_unref (self);
	return result;
}

static gboolean
pdftricks_split_pdf_create_thumbs_co (PdftricksSplitPdfCreateThumbsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data5_ = g_slice_new0 (Block5Data);
	_data_->_data5_->_ref_count_ = 1;
	_data_->_data5_->self = g_object_ref (_data_->self);
	_data_->_data5_->_async_data_ = _data_;
	_data_->_tmp0_ = g_strdup (_data_->input_file);
	_data_->_data5_->file_pdf = _data_->_tmp0_;
	_data_->_data5_->ret = TRUE;
	_data_->_data5_->callback = _pdftricks_split_pdf_create_thumbs_co_gsource_func;
	_data_->_data5_->callback_target = _data_;
	_data_->_data5_->callback_target_destroy_notify = NULL;
	_data_->run = ___lambda15__gthread_func;
	_data_->run_target = block5_data_ref (_data_->_data5_);
	{
		_data_->_tmp1_ = g_thread_try_new (NULL, _data_->run, _data_->run_target, &_data_->_inner_error0_);
		_data_->_tmp2_ = _data_->_tmp1_;
		_g_thread_unref0 (_data_->_tmp2_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp3_ = _data_->e;
		_data_->_tmp4_ = _data_->_tmp3_->message;
		g_warning ("SplitPDF.vala:470: %s", _data_->_tmp4_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		block5_data_unref (_data_->_data5_);
		_data_->_data5_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->result = _data_->_data5_->ret;
	block5_data_unref (_data_->_data5_);
	_data_->_data5_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gchar*
pdftricks_split_pdf_group_list (pdftricksSplitPDF* self,
                                const gchar* _result_)
{
	gchar** list_result = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint list_result_length1;
	gint _list_result_size_;
	gchar* first = NULL;
	gchar** _tmp2_;
	gint _tmp2__length1;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* last = NULL;
	gchar** _tmp5_;
	gint _tmp5__length1;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* result_grouped = NULL;
	gchar* _tmp8_;
	const gchar* _tmp49_;
	const gchar* _tmp50_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (_result_ != NULL, NULL);
	_tmp1_ = _tmp0_ = g_strsplit (_result_, ",", 0);
	list_result = _tmp1_;
	list_result_length1 = _vala_array_length (_tmp0_);
	_list_result_size_ = list_result_length1;
	_tmp2_ = list_result;
	_tmp2__length1 = list_result_length1;
	_tmp3_ = _tmp2_[0];
	_tmp4_ = g_strdup (_tmp3_);
	first = _tmp4_;
	_tmp5_ = list_result;
	_tmp5__length1 = list_result_length1;
	_tmp6_ = _tmp5_[0];
	_tmp7_ = g_strdup (_tmp6_);
	last = _tmp7_;
	_tmp8_ = g_strdup ("");
	result_grouped = _tmp8_;
	{
		gint a = 0;
		a = 0;
		{
			gboolean _tmp9_ = FALSE;
			_tmp9_ = TRUE;
			while (TRUE) {
				gchar** _tmp11_;
				gint _tmp11__length1;
				gchar* n = NULL;
				gchar** _tmp12_;
				gint _tmp12__length1;
				const gchar* _tmp13_;
				gchar* _tmp14_;
				const gchar* _tmp15_;
				const gchar* _tmp16_;
				if (!_tmp9_) {
					gint _tmp10_;
					_tmp10_ = a;
					a = _tmp10_ + 1;
				}
				_tmp9_ = FALSE;
				_tmp11_ = list_result;
				_tmp11__length1 = list_result_length1;
				if (!(a < _tmp11__length1)) {
					break;
				}
				if (a == 0) {
					continue;
				}
				_tmp12_ = list_result;
				_tmp12__length1 = list_result_length1;
				_tmp13_ = _tmp12_[a];
				_tmp14_ = g_strdup (_tmp13_);
				n = _tmp14_;
				_tmp15_ = n;
				_tmp16_ = last;
				if ((atoi (_tmp15_) - 1) == atoi (_tmp16_)) {
					const gchar* _tmp17_;
					gchar* _tmp18_;
					_tmp17_ = n;
					_tmp18_ = g_strdup (_tmp17_);
					_g_free0 (last);
					last = _tmp18_;
				} else {
					const gchar* _tmp19_;
					const gchar* _tmp20_;
					const gchar* _tmp45_;
					gchar* _tmp46_;
					const gchar* _tmp47_;
					gchar* _tmp48_;
					_tmp19_ = first;
					_tmp20_ = last;
					if (g_strcmp0 (_tmp19_, _tmp20_) == 0) {
						const gchar* _tmp21_;
						_tmp21_ = result_grouped;
						if (g_strcmp0 (_tmp21_, "") == 0) {
							const gchar* _tmp22_;
							gchar* _tmp23_;
							_tmp22_ = first;
							_tmp23_ = g_strdup (_tmp22_);
							_g_free0 (result_grouped);
							result_grouped = _tmp23_;
						} else {
							const gchar* _tmp24_;
							gchar* _tmp25_;
							gchar* _tmp26_;
							const gchar* _tmp27_;
							gchar* _tmp28_;
							_tmp24_ = result_grouped;
							_tmp25_ = g_strconcat (_tmp24_, ",", NULL);
							_tmp26_ = _tmp25_;
							_tmp27_ = first;
							_tmp28_ = g_strconcat (_tmp26_, _tmp27_, NULL);
							_g_free0 (result_grouped);
							result_grouped = _tmp28_;
							_g_free0 (_tmp26_);
						}
					} else {
						const gchar* _tmp29_;
						_tmp29_ = result_grouped;
						if (g_strcmp0 (_tmp29_, "") == 0) {
							const gchar* _tmp30_;
							gchar* _tmp31_;
							gchar* _tmp32_;
							const gchar* _tmp33_;
							gchar* _tmp34_;
							_tmp30_ = first;
							_tmp31_ = g_strconcat (_tmp30_, "-", NULL);
							_tmp32_ = _tmp31_;
							_tmp33_ = last;
							_tmp34_ = g_strconcat (_tmp32_, _tmp33_, NULL);
							_g_free0 (result_grouped);
							result_grouped = _tmp34_;
							_g_free0 (_tmp32_);
						} else {
							const gchar* _tmp35_;
							gchar* _tmp36_;
							gchar* _tmp37_;
							const gchar* _tmp38_;
							gchar* _tmp39_;
							gchar* _tmp40_;
							gchar* _tmp41_;
							gchar* _tmp42_;
							const gchar* _tmp43_;
							gchar* _tmp44_;
							_tmp35_ = result_grouped;
							_tmp36_ = g_strconcat (_tmp35_, ",", NULL);
							_tmp37_ = _tmp36_;
							_tmp38_ = first;
							_tmp39_ = g_strconcat (_tmp37_, _tmp38_, NULL);
							_tmp40_ = _tmp39_;
							_tmp41_ = g_strconcat (_tmp40_, "-", NULL);
							_tmp42_ = _tmp41_;
							_tmp43_ = last;
							_tmp44_ = g_strconcat (_tmp42_, _tmp43_, NULL);
							_g_free0 (result_grouped);
							result_grouped = _tmp44_;
							_g_free0 (_tmp42_);
							_g_free0 (_tmp40_);
							_g_free0 (_tmp37_);
						}
					}
					_tmp45_ = n;
					_tmp46_ = g_strdup (_tmp45_);
					_g_free0 (first);
					first = _tmp46_;
					_tmp47_ = n;
					_tmp48_ = g_strdup (_tmp47_);
					_g_free0 (last);
					last = _tmp48_;
				}
				_g_free0 (n);
			}
		}
	}
	_tmp49_ = first;
	_tmp50_ = last;
	if (g_strcmp0 (_tmp49_, _tmp50_) == 0) {
		const gchar* _tmp51_;
		_tmp51_ = result_grouped;
		if (g_strcmp0 (_tmp51_, "") == 0) {
			const gchar* _tmp52_;
			gchar* _tmp53_;
			_tmp52_ = first;
			_tmp53_ = g_strdup (_tmp52_);
			_g_free0 (result_grouped);
			result_grouped = _tmp53_;
		} else {
			const gchar* _tmp54_;
			gchar* _tmp55_;
			gchar* _tmp56_;
			const gchar* _tmp57_;
			gchar* _tmp58_;
			_tmp54_ = result_grouped;
			_tmp55_ = g_strconcat (_tmp54_, ",", NULL);
			_tmp56_ = _tmp55_;
			_tmp57_ = first;
			_tmp58_ = g_strconcat (_tmp56_, _tmp57_, NULL);
			_g_free0 (result_grouped);
			result_grouped = _tmp58_;
			_g_free0 (_tmp56_);
		}
	} else {
		const gchar* _tmp59_;
		_tmp59_ = result_grouped;
		if (g_strcmp0 (_tmp59_, "") == 0) {
			const gchar* _tmp60_;
			gchar* _tmp61_;
			gchar* _tmp62_;
			const gchar* _tmp63_;
			gchar* _tmp64_;
			_tmp60_ = first;
			_tmp61_ = g_strconcat (_tmp60_, "-", NULL);
			_tmp62_ = _tmp61_;
			_tmp63_ = last;
			_tmp64_ = g_strconcat (_tmp62_, _tmp63_, NULL);
			_g_free0 (result_grouped);
			result_grouped = _tmp64_;
			_g_free0 (_tmp62_);
		} else {
			const gchar* _tmp65_;
			gchar* _tmp66_;
			gchar* _tmp67_;
			const gchar* _tmp68_;
			gchar* _tmp69_;
			gchar* _tmp70_;
			gchar* _tmp71_;
			gchar* _tmp72_;
			const gchar* _tmp73_;
			gchar* _tmp74_;
			_tmp65_ = result_grouped;
			_tmp66_ = g_strconcat (_tmp65_, ",", NULL);
			_tmp67_ = _tmp66_;
			_tmp68_ = first;
			_tmp69_ = g_strconcat (_tmp67_, _tmp68_, NULL);
			_tmp70_ = _tmp69_;
			_tmp71_ = g_strconcat (_tmp70_, "-", NULL);
			_tmp72_ = _tmp71_;
			_tmp73_ = last;
			_tmp74_ = g_strconcat (_tmp72_, _tmp73_, NULL);
			_g_free0 (result_grouped);
			result_grouped = _tmp74_;
			_g_free0 (_tmp72_);
			_g_free0 (_tmp70_);
			_g_free0 (_tmp67_);
		}
	}
	result = result_grouped;
	_g_free0 (last);
	_g_free0 (first);
	list_result = (_vala_array_free (list_result, list_result_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

GtkWindow*
pdftricks_split_pdf_get_window (pdftricksSplitPDF* self)
{
	GtkWindow* result;
	GtkWindow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_window;
	result = _tmp0_;
	return result;
}

static void
pdftricks_split_pdf_set_window (pdftricksSplitPDF* self,
                                GtkWindow* value)
{
	GtkWindow* old_value;
	g_return_if_fail (self != NULL);
	old_value = pdftricks_split_pdf_get_window (self);
	if (old_value != value) {
		GtkWindow* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_window);
		self->priv->_window = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, pdftricks_split_pdf_properties[PDFTRICKS_SPLIT_PDF_WINDOW_PROPERTY]);
	}
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		pdftricksSplitPDF* self;
		self = _data6_->self;
		_g_object_unref0 (_data6_->split_button);
		_g_object_unref0 (_data6_->view_thumbs);
		_g_object_unref0 (_data6_->model_thumbs);
		_g_object_unref0 (_data6_->revealer);
		_g_object_unref0 (_data6_->btn_colors);
		_g_object_unref0 (_data6_->btn_range);
		_g_object_unref0 (_data6_->btn_all);
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static GtkTreePath*
_vala_GtkTreePath_copy (GtkTreePath* self)
{
	return g_boxed_copy (gtk_tree_path_get_type (), self);
}

static gpointer
__vala_GtkTreePath_copy0 (gpointer self)
{
	return self ? _vala_GtkTreePath_copy (self) : NULL;
}

static void
_vala_GtkTreePath_free (GtkTreePath* self)
{
	g_boxed_free (gtk_tree_path_get_type (), self);
}

static void
__vala_GtkTreePath_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_GtkTreePath_free (var), NULL));
}

static inline void
_g_list_free___vala_GtkTreePath_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) __vala_GtkTreePath_free0_);
}

static void
_pdftricks_split_pdf___lambda16_ (Block6Data* _data6_)
{
	pdftricksSplitPDF* self;
	GList* paths = NULL;
	GtkIconView* _tmp0_;
	GList* _tmp1_;
	GValue title = {0};
	gchar* _result_ = NULL;
	gchar* _tmp2_;
	GList* _tmp3_;
	gchar* result_grouped = NULL;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	const gchar* _tmp22_;
	self = _data6_->self;
	_tmp0_ = _data6_->view_thumbs;
	_tmp1_ = gtk_icon_view_get_selected_items (_tmp0_);
	paths = _tmp1_;
	_tmp2_ = g_strdup ("");
	_result_ = _tmp2_;
	_tmp3_ = paths;
	{
		GList* path_collection = NULL;
		GList* path_it = NULL;
		path_collection = _tmp3_;
		for (path_it = path_collection; path_it != NULL; path_it = path_it->next) {
			GtkTreePath* _tmp4_;
			GtkTreePath* path = NULL;
			_tmp4_ = __vala_GtkTreePath_copy0 ((GtkTreePath*) path_it->data);
			path = _tmp4_;
			{
				gboolean tmp = FALSE;
				GtkListStore* _tmp5_;
				GtkTreePath* _tmp6_;
				GtkTreeIter _tmp7_ = {0};
				gboolean _tmp8_;
				GtkListStore* _tmp9_;
				GtkTreeIter _tmp10_;
				GValue _tmp11_ = {0};
				const gchar* _tmp12_;
				_tmp5_ = _data6_->model_thumbs;
				_tmp6_ = path;
				_tmp8_ = gtk_tree_model_get_iter ((GtkTreeModel*) _tmp5_, &_tmp7_, _tmp6_);
				_data6_->iter = _tmp7_;
				tmp = _tmp8_;
				_vala_assert (tmp == TRUE, "tmp == true");
				_tmp9_ = _data6_->model_thumbs;
				_tmp10_ = _data6_->iter;
				gtk_tree_model_get_value ((GtkTreeModel*) _tmp9_, &_tmp10_, 1, &_tmp11_);
				G_IS_VALUE (&title) ? (g_value_unset (&title), NULL) : NULL;
				title = _tmp11_;
				_tmp12_ = _result_;
				if (g_strcmp0 (_tmp12_, "") == 0) {
					gchar* _tmp13_;
					_tmp13_ = g_value_dup_string (&title);
					_g_free0 (_result_);
					_result_ = _tmp13_;
				} else {
					gchar* _tmp14_;
					gchar* _tmp15_;
					gchar* _tmp16_;
					gchar* _tmp17_;
					const gchar* _tmp18_;
					gchar* _tmp19_;
					_tmp14_ = g_value_dup_string (&title);
					_tmp15_ = _tmp14_;
					_tmp16_ = g_strconcat (_tmp15_, ",", NULL);
					_tmp17_ = _tmp16_;
					_tmp18_ = _result_;
					_tmp19_ = g_strconcat (_tmp17_, _tmp18_, NULL);
					_g_free0 (_result_);
					_result_ = _tmp19_;
					_g_free0 (_tmp17_);
					_g_free0 (_tmp15_);
				}
				__vala_GtkTreePath_free0 (path);
			}
		}
	}
	_tmp20_ = _result_;
	_tmp21_ = pdftricks_split_pdf_group_list (self, _tmp20_);
	result_grouped = _tmp21_;
	_tmp22_ = result_grouped;
	if (g_strcmp0 (_tmp22_, "") != 0) {
		GtkEntry* _tmp23_;
		const gchar* _tmp24_;
		_tmp23_ = self->priv->entry_range;
		_tmp24_ = result_grouped;
		gtk_entry_set_text (_tmp23_, _tmp24_);
	}
	_g_free0 (result_grouped);
	_g_free0 (_result_);
	G_IS_VALUE (&title) ? (g_value_unset (&title), NULL) : NULL;
	(paths == NULL) ? NULL : (paths = (_g_list_free___vala_GtkTreePath_free0_ (paths), NULL));
}

static void
__pdftricks_split_pdf___lambda16__gtk_icon_view_selection_changed (GtkIconView* _sender,
                                                                   gpointer self)
{
	_pdftricks_split_pdf___lambda16_ (self);
}

static void
_pdftricks_split_pdf___lambda17_ (Block6Data* _data6_)
{
	pdftricksSplitPDF* self;
	GtkSpinner* _tmp0_;
	GtkButton* _tmp1_;
	self = _data6_->self;
	_tmp0_ = self->priv->spinner;
	g_object_set (_tmp0_, "active", TRUE, NULL);
	_tmp1_ = _data6_->split_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp1_, FALSE);
}

static void
__pdftricks_split_pdf___lambda17__pdftricks_split_pdf_create_thumb_begin (pdftricksSplitPDF* _sender,
                                                                          gpointer self)
{
	_pdftricks_split_pdf___lambda17_ (self);
}

static void
_pdftricks_split_pdf___lambda18_ (Block6Data* _data6_,
                                  gboolean _result_)
{
	pdftricksSplitPDF* self;
	GtkSpinner* _tmp0_;
	GtkButton* _tmp1_;
	GError* _inner_error0_ = NULL;
	self = _data6_->self;
	_tmp0_ = self->priv->spinner;
	g_object_set (_tmp0_, "active", FALSE, NULL);
	_tmp1_ = _data6_->split_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp1_, TRUE);
	if (_result_) {
		GtkIconView* _tmp2_;
		_tmp2_ = _data6_->view_thumbs;
		gtk_icon_view_set_columns (_tmp2_, self->priv->page_size);
		{
			gint a = 0;
			a = 1;
			{
				gboolean _tmp3_ = FALSE;
				_tmp3_ = TRUE;
				while (TRUE) {
					if (!_tmp3_) {
						gint _tmp4_;
						_tmp4_ = a;
						a = _tmp4_ + 1;
					}
					_tmp3_ = FALSE;
					if (!(a <= self->priv->page_size)) {
						break;
					}
					{
						GtkListStore* _tmp5_;
						GtkTreeIter _tmp6_ = {0};
						GdkPixbuf* pixbuf = NULL;
						gchar* _tmp7_;
						gchar* _tmp8_;
						gchar* _tmp9_;
						gchar* _tmp10_;
						gchar* _tmp11_;
						gchar* _tmp12_;
						GdkPixbuf* _tmp13_;
						GdkPixbuf* _tmp14_;
						GtkListStore* _tmp15_;
						GtkTreeIter _tmp16_;
						GdkPixbuf* _tmp17_;
						gchar* _tmp18_;
						gchar* _tmp19_;
						_tmp5_ = _data6_->model_thumbs;
						gtk_list_store_append (_tmp5_, &_tmp6_);
						_data6_->iter = _tmp6_;
						_tmp7_ = g_strdup_printf ("%i", a);
						_tmp8_ = _tmp7_;
						_tmp9_ = g_strconcat ("/tmp/h", _tmp8_, NULL);
						_tmp10_ = _tmp9_;
						_tmp11_ = g_strconcat (_tmp10_, ".jpg", NULL);
						_tmp12_ = _tmp11_;
						_tmp13_ = gdk_pixbuf_new_from_file (_tmp12_, &_inner_error0_);
						_tmp14_ = _tmp13_;
						_g_free0 (_tmp12_);
						_g_free0 (_tmp10_);
						_g_free0 (_tmp8_);
						pixbuf = _tmp14_;
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							goto __catch0_g_error;
						}
						_tmp15_ = _data6_->model_thumbs;
						_tmp16_ = _data6_->iter;
						_tmp17_ = pixbuf;
						_tmp18_ = g_strdup_printf ("%i", a);
						_tmp19_ = _tmp18_;
						gtk_list_store_set (_tmp15_, &_tmp16_, 0, _tmp17_, 1, _tmp19_, -1);
						_g_free0 (_tmp19_);
						_g_object_unref0 (pixbuf);
					}
					goto __finally0;
					__catch0_g_error:
					{
						g_clear_error (&_inner_error0_);
						g_print ("erro");
					}
					__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
__pdftricks_split_pdf___lambda18__pdftricks_split_pdf_create_thumb_finished (pdftricksSplitPDF* _sender,
                                                                             gboolean _result_,
                                                                             gpointer self)
{
	_pdftricks_split_pdf___lambda18_ (self, _result_);
}

static void
_pdftricks_split_pdf___lambda19_ (Block6Data* _data6_)
{
	pdftricksSplitPDF* self;
	GtkRadioButton* _tmp0_;
	gchar* file_pdf = NULL;
	GtkFileChooserButton* _tmp3_;
	gchar* _tmp4_;
	gboolean _tmp5_ = FALSE;
	const gchar* _tmp6_;
	self = _data6_->self;
	_tmp0_ = _data6_->btn_range;
	if (gtk_toggle_button_get_active ((GtkToggleButton*) _tmp0_) == TRUE) {
		GtkListStore* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = _data6_->model_thumbs;
		gtk_list_store_clear (_tmp1_);
		_tmp2_ = g_strdup ("range");
		_g_free0 (self->priv->type_split);
		self->priv->type_split = _tmp2_;
	}
	_tmp3_ = self->priv->filechooser;
	_tmp4_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp3_);
	file_pdf = _tmp4_;
	_tmp6_ = file_pdf;
	if (_tmp6_ != NULL) {
		const gchar* _tmp7_;
		_tmp7_ = file_pdf;
		_tmp5_ = g_strcmp0 (_tmp7_, "") != 0;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		GtkButton* _tmp8_;
		_tmp8_ = _data6_->split_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp8_, TRUE);
	}
	_g_free0 (file_pdf);
}

static void
__pdftricks_split_pdf___lambda19__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                             gpointer self)
{
	_pdftricks_split_pdf___lambda19_ (self);
}

static void
_pdftricks_split_pdf___lambda20_ (Block6Data* _data6_)
{
	pdftricksSplitPDF* self;
	GtkRadioButton* _tmp0_;
	gchar* file_pdf = NULL;
	GtkFileChooserButton* _tmp3_;
	gchar* _tmp4_;
	gboolean _tmp5_ = FALSE;
	const gchar* _tmp6_;
	self = _data6_->self;
	_tmp0_ = _data6_->btn_all;
	if (gtk_toggle_button_get_active ((GtkToggleButton*) _tmp0_) == TRUE) {
		gchar* _tmp1_;
		GtkRevealer* _tmp2_;
		_tmp1_ = g_strdup ("all");
		_g_free0 (self->priv->type_split);
		self->priv->type_split = _tmp1_;
		_tmp2_ = _data6_->revealer;
		gtk_revealer_set_reveal_child (_tmp2_, FALSE);
	}
	_tmp3_ = self->priv->filechooser;
	_tmp4_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp3_);
	file_pdf = _tmp4_;
	_tmp6_ = file_pdf;
	if (_tmp6_ != NULL) {
		const gchar* _tmp7_;
		_tmp7_ = file_pdf;
		_tmp5_ = g_strcmp0 (_tmp7_, "") != 0;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		GtkButton* _tmp8_;
		_tmp8_ = _data6_->split_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp8_, TRUE);
	}
	_g_free0 (file_pdf);
}

static void
__pdftricks_split_pdf___lambda20__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                             gpointer self)
{
	_pdftricks_split_pdf___lambda20_ (self);
}

static void
_pdftricks_split_pdf___lambda21_ (Block6Data* _data6_)
{
	pdftricksSplitPDF* self;
	GtkRadioButton* _tmp0_;
	gchar* file_pdf = NULL;
	GtkFileChooserButton* _tmp3_;
	gchar* _tmp4_;
	gboolean _tmp5_ = FALSE;
	const gchar* _tmp6_;
	self = _data6_->self;
	_tmp0_ = _data6_->btn_colors;
	if (gtk_toggle_button_get_active ((GtkToggleButton*) _tmp0_) == TRUE) {
		gchar* _tmp1_;
		GtkRevealer* _tmp2_;
		_tmp1_ = g_strdup ("colors");
		_g_free0 (self->priv->type_split);
		self->priv->type_split = _tmp1_;
		_tmp2_ = _data6_->revealer;
		gtk_revealer_set_reveal_child (_tmp2_, FALSE);
	}
	_tmp3_ = self->priv->filechooser;
	_tmp4_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp3_);
	file_pdf = _tmp4_;
	_tmp6_ = file_pdf;
	if (_tmp6_ != NULL) {
		const gchar* _tmp7_;
		_tmp7_ = file_pdf;
		_tmp5_ = g_strcmp0 (_tmp7_, "") != 0;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		GtkButton* _tmp8_;
		_tmp8_ = _data6_->split_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp8_, TRUE);
	}
	_g_free0 (file_pdf);
}

static void
__pdftricks_split_pdf___lambda21__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                             gpointer self)
{
	_pdftricks_split_pdf___lambda21_ (self);
}

static void
_pdftricks_split_pdf_confirm_split_gtk_button_clicked (GtkButton* _sender,
                                                       gpointer self)
{
	pdftricks_split_pdf_confirm_split ((pdftricksSplitPDF*) self);
}

static void
_pdftricks_split_pdf___lambda22_ (Block6Data* _data6_)
{
	pdftricksSplitPDF* self;
	gchar* file_pdf = NULL;
	GtkFileChooserButton* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	GtkButton* _tmp3_;
	GtkRadioButton* _tmp4_;
	GtkRadioButton* _tmp5_;
	GtkRadioButton* _tmp6_;
	GtkListStore* _tmp7_;
	self = _data6_->self;
	_tmp0_ = self->priv->filechooser;
	_tmp1_ = gtk_file_chooser_get_filename ((GtkFileChooser*) _tmp0_);
	file_pdf = _tmp1_;
	_tmp2_ = file_pdf;
	self->priv->page_size = pdftricks_split_pdf_get_page_count (self, _tmp2_);
	_tmp3_ = _data6_->split_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, TRUE);
	_tmp4_ = _data6_->btn_all;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, TRUE);
	_tmp5_ = _data6_->btn_range;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp5_, TRUE);
	_tmp6_ = _data6_->btn_colors;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp6_, TRUE);
	_tmp7_ = _data6_->model_thumbs;
	gtk_list_store_clear (_tmp7_);
	_g_free0 (file_pdf);
}

static void
__pdftricks_split_pdf___lambda22__gtk_file_chooser_button_file_set (GtkFileChooserButton* _sender,
                                                                    gpointer self)
{
	_pdftricks_split_pdf___lambda22_ (self);
}

static void
_pdftricks_split_pdf___lambda23_ (Block6Data* _data6_)
{
	pdftricksSplitPDF* self;
	GtkSpinner* _tmp0_;
	GtkButton* _tmp1_;
	self = _data6_->self;
	_tmp0_ = self->priv->spinner;
	g_object_set (_tmp0_, "active", TRUE, NULL);
	_tmp1_ = _data6_->split_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp1_, TRUE);
}

static void
__pdftricks_split_pdf___lambda23__pdftricks_split_pdf_proccess_begin (pdftricksSplitPDF* _sender,
                                                                      gpointer self)
{
	_pdftricks_split_pdf___lambda23_ (self);
}

static void
_pdftricks_split_pdf___lambda24_ (Block6Data* _data6_,
                                  gboolean _result_)
{
	pdftricksSplitPDF* self;
	GtkSpinner* _tmp0_;
	GtkButton* _tmp1_;
	self = _data6_->self;
	_tmp0_ = self->priv->spinner;
	g_object_set (_tmp0_, "active", FALSE, NULL);
	_tmp1_ = _data6_->split_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp1_, TRUE);
	if (_result_) {
		GraniteMessageDialog* message_dialog = NULL;
		GraniteMessageDialog* _tmp2_;
		GraniteMessageDialog* _tmp3_;
		GtkWindow* _tmp4_;
		GraniteMessageDialog* _tmp5_;
		GraniteMessageDialog* _tmp6_;
		GraniteMessageDialog* _tmp7_;
		_tmp2_ = granite_message_dialog_new_with_image_from_icon_name (_ ("Success."), _ ("File split."), "gtk-apply", GTK_BUTTONS_CLOSE);
		g_object_ref_sink (_tmp2_);
		message_dialog = _tmp2_;
		_tmp3_ = message_dialog;
		_tmp4_ = self->priv->_window;
		gtk_window_set_transient_for ((GtkWindow*) _tmp3_, _tmp4_);
		_tmp5_ = message_dialog;
		gtk_widget_show_all ((GtkWidget*) _tmp5_);
		_tmp6_ = message_dialog;
		gtk_dialog_run ((GtkDialog*) _tmp6_);
		_tmp7_ = message_dialog;
		gtk_widget_destroy ((GtkWidget*) _tmp7_);
		_g_object_unref0 (message_dialog);
	} else {
		GraniteMessageDialog* message_dialog = NULL;
		GraniteMessageDialog* _tmp8_;
		GraniteMessageDialog* _tmp9_;
		GtkWindow* _tmp10_;
		GraniteMessageDialog* _tmp11_;
		GraniteMessageDialog* _tmp12_;
		GraniteMessageDialog* _tmp13_;
		_tmp8_ = granite_message_dialog_new_with_image_from_icon_name (_ ("Failure."), _ ("Could not split this file."), "process-stop", GTK_BUTTONS_CLOSE);
		g_object_ref_sink (_tmp8_);
		message_dialog = _tmp8_;
		_tmp9_ = message_dialog;
		_tmp10_ = self->priv->_window;
		gtk_window_set_transient_for ((GtkWindow*) _tmp9_, _tmp10_);
		_tmp11_ = message_dialog;
		gtk_widget_show_all ((GtkWidget*) _tmp11_);
		_tmp12_ = message_dialog;
		gtk_dialog_run ((GtkDialog*) _tmp12_);
		_tmp13_ = message_dialog;
		gtk_widget_destroy ((GtkWidget*) _tmp13_);
		_g_object_unref0 (message_dialog);
	}
}

static void
__pdftricks_split_pdf___lambda24__pdftricks_split_pdf_proccess_finished (pdftricksSplitPDF* _sender,
                                                                         gboolean _result_,
                                                                         gpointer self)
{
	_pdftricks_split_pdf___lambda24_ (self, _result_);
}

static GObject *
pdftricks_split_pdf_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	pdftricksSplitPDF * self;
	Block6Data* _data6_;
	gchar* _tmp0_;
	GtkFileChooserButton* _tmp1_;
	GtkFileFilter* filter = NULL;
	GtkFileFilter* _tmp2_;
	GtkFileChooserButton* _tmp3_;
	GtkFileFilter* _tmp4_;
	GtkFileFilter* _tmp5_;
	GtkRadioButton* _tmp6_;
	GtkRadioButton* _tmp7_;
	GtkRadioButton* _tmp8_;
	GtkRadioButton* _tmp9_;
	GtkRadioButton* _tmp10_;
	GtkRadioButton* _tmp11_;
	GtkRadioButton* _tmp12_;
	GtkRadioButton* _tmp13_;
	GtkCheckButton* with_thumbs = NULL;
	GtkCheckButton* _tmp14_;
	GtkCheckButton* _tmp15_;
	GtkRevealer* _tmp16_;
	GtkListStore* _tmp17_;
	GtkListStore* _tmp18_;
	GtkIconView* _tmp19_;
	GtkIconView* _tmp20_;
	GtkIconView* _tmp21_;
	GtkIconView* _tmp22_;
	GtkIconView* _tmp23_;
	GtkIconView* _tmp24_;
	GtkIconView* _tmp25_;
	GtkIconView* _tmp26_;
	GtkScrolledWindow* scrolled_thumbs = NULL;
	GtkScrolledWindow* _tmp27_;
	GtkScrolledWindow* _tmp28_;
	GtkScrolledWindow* _tmp29_;
	GtkScrolledWindow* _tmp30_;
	GtkScrolledWindow* _tmp31_;
	GtkIconView* _tmp32_;
	GtkEntry* _tmp33_;
	GtkEntry* _tmp34_;
	GtkBox* range_box = NULL;
	GtkBox* _tmp35_;
	GtkBox* _tmp36_;
	GtkScrolledWindow* _tmp37_;
	GtkBox* _tmp38_;
	GtkEntry* _tmp39_;
	GtkRevealer* _tmp40_;
	GtkBox* _tmp41_;
	GtkButton* _tmp42_;
	GtkIconView* _tmp43_;
	GtkRadioButton* _tmp44_;
	GtkRadioButton* _tmp45_;
	GtkRadioButton* _tmp46_;
	GtkButton* _tmp47_;
	GtkStyleContext* _tmp48_;
	GtkButton* _tmp49_;
	GtkButton* _tmp50_;
	GtkButton* _tmp51_;
	GtkButton* _tmp52_;
	GtkFileChooserButton* _tmp53_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp54_;
	GtkGrid* _tmp55_;
	GtkGrid* _tmp56_;
	GtkGrid* _tmp57_;
	GtkGrid* _tmp58_;
	GtkGrid* _tmp59_;
	GtkGrid* _tmp60_;
	GtkGrid* _tmp61_;
	GtkGrid* _tmp62_;
	GraniteHeaderLabel* _tmp63_;
	GraniteHeaderLabel* _tmp64_;
	GtkGrid* _tmp65_;
	GtkFileChooserButton* _tmp66_;
	GtkGrid* _tmp67_;
	GtkRadioButton* _tmp68_;
	GtkGrid* _tmp69_;
	GtkRadioButton* _tmp70_;
	GtkGrid* _tmp71_;
	GtkRadioButton* _tmp72_;
	GtkGrid* _tmp73_;
	GtkButton* _tmp74_;
	GtkGrid* _tmp75_;
	GtkRevealer* _tmp76_;
	GtkSpinner* _tmp77_;
	GtkSpinner* _tmp78_;
	GtkGrid* _tmp79_;
	GtkSpinner* _tmp80_;
	GtkGrid* _tmp81_;
	parent_class = G_OBJECT_CLASS (pdftricks_split_pdf_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PDFTRICKS_TYPE_SPLIT_PDF, pdftricksSplitPDF);
	_data6_ = g_slice_new0 (Block6Data);
	_data6_->_ref_count_ = 1;
	_data6_->self = g_object_ref (self);
	self->priv->page_size = 0;
	_tmp0_ = g_strdup ("all");
	_g_free0 (self->priv->type_split);
	self->priv->type_split = _tmp0_;
	_tmp1_ = (GtkFileChooserButton*) gtk_file_chooser_button_new (_ ("Select the file to compress"), GTK_FILE_CHOOSER_ACTION_OPEN);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->filechooser);
	self->priv->filechooser = _tmp1_;
	_tmp2_ = gtk_file_filter_new ();
	g_object_ref_sink (_tmp2_);
	filter = _tmp2_;
	_tmp3_ = self->priv->filechooser;
	_tmp4_ = filter;
	gtk_file_chooser_set_filter ((GtkFileChooser*) _tmp3_, _tmp4_);
	_tmp5_ = filter;
	gtk_file_filter_add_mime_type (_tmp5_, "application/pdf");
	_tmp6_ = (GtkRadioButton*) gtk_radio_button_new_with_label_from_widget (NULL, _ ("Extract all pages"));
	g_object_ref_sink (_tmp6_);
	_data6_->btn_all = _tmp6_;
	_tmp7_ = _data6_->btn_all;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp7_, FALSE);
	_tmp8_ = _data6_->btn_all;
	_tmp9_ = (GtkRadioButton*) gtk_radio_button_new_with_label_from_widget (_tmp8_, _ ("Select range of pages"));
	g_object_ref_sink (_tmp9_);
	_data6_->btn_range = _tmp9_;
	_tmp10_ = _data6_->btn_range;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp10_, FALSE);
	_tmp11_ = _data6_->btn_all;
	_tmp12_ = (GtkRadioButton*) gtk_radio_button_new_with_label_from_widget (_tmp11_, _ ("Separate colored pages"));
	g_object_ref_sink (_tmp12_);
	_data6_->btn_colors = _tmp12_;
	_tmp13_ = _data6_->btn_colors;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp13_, FALSE);
	_tmp14_ = (GtkCheckButton*) gtk_check_button_new_with_label (_ ("Show Thumbnails"));
	g_object_ref_sink (_tmp14_);
	with_thumbs = _tmp14_;
	_tmp15_ = with_thumbs;
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp15_, FALSE);
	_tmp16_ = (GtkRevealer*) gtk_revealer_new ();
	g_object_ref_sink (_tmp16_);
	_data6_->revealer = _tmp16_;
	_tmp17_ = gtk_list_store_new (2, gdk_pixbuf_get_type (), G_TYPE_STRING, -1);
	_data6_->model_thumbs = _tmp17_;
	_tmp18_ = _data6_->model_thumbs;
	_tmp19_ = (GtkIconView*) gtk_icon_view_new_with_model ((GtkTreeModel*) _tmp18_);
	g_object_ref_sink (_tmp19_);
	_data6_->view_thumbs = _tmp19_;
	_tmp20_ = _data6_->view_thumbs;
	gtk_icon_view_set_pixbuf_column (_tmp20_, 0);
	_tmp21_ = _data6_->view_thumbs;
	gtk_icon_view_set_text_column (_tmp21_, 1);
	_tmp22_ = _data6_->view_thumbs;
	gtk_icon_view_set_selection_mode (_tmp22_, GTK_SELECTION_MULTIPLE);
	_tmp23_ = _data6_->view_thumbs;
	gtk_icon_view_set_item_width (_tmp23_, 105);
	_tmp24_ = _data6_->view_thumbs;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp24_, TRUE);
	_tmp25_ = _data6_->view_thumbs;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp25_, TRUE);
	_tmp26_ = _data6_->view_thumbs;
	gtk_icon_view_set_item_padding (_tmp26_, 5);
	_tmp27_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp27_);
	scrolled_thumbs = _tmp27_;
	_tmp28_ = scrolled_thumbs;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp28_, TRUE);
	_tmp29_ = scrolled_thumbs;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp29_, TRUE);
	_tmp30_ = scrolled_thumbs;
	gtk_scrolled_window_set_policy (_tmp30_, GTK_POLICY_ALWAYS, GTK_POLICY_NEVER);
	_tmp31_ = scrolled_thumbs;
	_tmp32_ = _data6_->view_thumbs;
	gtk_container_add ((GtkContainer*) _tmp31_, (GtkWidget*) _tmp32_);
	_tmp33_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp33_);
	_g_object_unref0 (self->priv->entry_range);
	self->priv->entry_range = _tmp33_;
	_tmp34_ = self->priv->entry_range;
	gtk_entry_set_placeholder_text (_tmp34_, "1-3,5,9");
	_tmp35_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp35_);
	range_box = _tmp35_;
	_tmp36_ = range_box;
	_tmp37_ = scrolled_thumbs;
	gtk_box_pack_start (_tmp36_, (GtkWidget*) _tmp37_, FALSE, FALSE, (guint) 0);
	_tmp38_ = range_box;
	_tmp39_ = self->priv->entry_range;
	gtk_box_pack_start (_tmp38_, (GtkWidget*) _tmp39_, FALSE, FALSE, (guint) 0);
	_tmp40_ = _data6_->revealer;
	_tmp41_ = range_box;
	gtk_container_add ((GtkContainer*) _tmp40_, (GtkWidget*) _tmp41_);
	_tmp42_ = (GtkButton*) gtk_button_new_with_label (_ ("Split"));
	g_object_ref_sink (_tmp42_);
	_data6_->split_button = _tmp42_;
	_tmp43_ = _data6_->view_thumbs;
	g_signal_connect_data (_tmp43_, "selection-changed", (GCallback) __pdftricks_split_pdf___lambda16__gtk_icon_view_selection_changed, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	g_signal_connect_data (self, "create-thumb-begin", (GCallback) __pdftricks_split_pdf___lambda17__pdftricks_split_pdf_create_thumb_begin, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	g_signal_connect_data (self, "create-thumb-finished", (GCallback) __pdftricks_split_pdf___lambda18__pdftricks_split_pdf_create_thumb_finished, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp44_ = _data6_->btn_range;
	g_signal_connect_data ((GtkToggleButton*) _tmp44_, "toggled", (GCallback) __pdftricks_split_pdf___lambda19__gtk_toggle_button_toggled, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp45_ = _data6_->btn_all;
	g_signal_connect_data ((GtkToggleButton*) _tmp45_, "toggled", (GCallback) __pdftricks_split_pdf___lambda20__gtk_toggle_button_toggled, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp46_ = _data6_->btn_colors;
	g_signal_connect_data ((GtkToggleButton*) _tmp46_, "toggled", (GCallback) __pdftricks_split_pdf___lambda21__gtk_toggle_button_toggled, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp47_ = _data6_->split_button;
	_tmp48_ = gtk_widget_get_style_context ((GtkWidget*) _tmp47_);
	gtk_style_context_add_class (_tmp48_, GTK_STYLE_CLASS_SUGGESTED_ACTION);
	_tmp49_ = _data6_->split_button;
	gtk_widget_set_can_default ((GtkWidget*) _tmp49_, TRUE);
	_tmp50_ = _data6_->split_button;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp50_, TRUE);
	_tmp51_ = _data6_->split_button;
	g_signal_connect_object (_tmp51_, "clicked", (GCallback) _pdftricks_split_pdf_confirm_split_gtk_button_clicked, self, 0);
	_tmp52_ = _data6_->split_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp52_, FALSE);
	_tmp53_ = self->priv->filechooser;
	g_signal_connect_data (_tmp53_, "file-set", (GCallback) __pdftricks_split_pdf___lambda22__gtk_file_chooser_button_file_set, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp54_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp54_);
	grid = _tmp54_;
	_tmp55_ = grid;
	gtk_orientable_set_orientation ((GtkOrientable*) _tmp55_, GTK_ORIENTATION_VERTICAL);
	_tmp56_ = grid;
	gtk_widget_set_halign ((GtkWidget*) _tmp56_, GTK_ALIGN_CENTER);
	_tmp57_ = grid;
	gtk_widget_set_valign ((GtkWidget*) _tmp57_, GTK_ALIGN_CENTER);
	_tmp58_ = grid;
	gtk_grid_set_column_spacing (_tmp58_, 16);
	_tmp59_ = grid;
	gtk_grid_set_row_spacing (_tmp59_, 8);
	_tmp60_ = grid;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp60_, TRUE);
	_tmp61_ = grid;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp61_, TRUE);
	_tmp62_ = grid;
	_tmp63_ = granite_header_label_new (_ ("File to Split:"));
	g_object_ref_sink (_tmp63_);
	_tmp64_ = _tmp63_;
	gtk_grid_attach (_tmp62_, (GtkWidget*) _tmp64_, 1, 0, 1, 1);
	_g_object_unref0 (_tmp64_);
	_tmp65_ = grid;
	_tmp66_ = self->priv->filechooser;
	gtk_grid_attach (_tmp65_, (GtkWidget*) _tmp66_, 2, 0, 1, 1);
	_tmp67_ = grid;
	_tmp68_ = _data6_->btn_all;
	gtk_grid_attach (_tmp67_, (GtkWidget*) _tmp68_, 2, 1, 1, 1);
	_tmp69_ = grid;
	_tmp70_ = _data6_->btn_range;
	gtk_grid_attach (_tmp69_, (GtkWidget*) _tmp70_, 2, 2, 1, 1);
	_tmp71_ = grid;
	_tmp72_ = _data6_->btn_colors;
	gtk_grid_attach (_tmp71_, (GtkWidget*) _tmp72_, 2, 3, 1, 1);
	_tmp73_ = grid;
	_tmp74_ = _data6_->split_button;
	gtk_grid_attach (_tmp73_, (GtkWidget*) _tmp74_, 1, 5, 2, 1);
	_tmp75_ = grid;
	_tmp76_ = _data6_->revealer;
	gtk_grid_attach (_tmp75_, (GtkWidget*) _tmp76_, 1, 6, 2, 1);
	_tmp77_ = (GtkSpinner*) gtk_spinner_new ();
	g_object_ref_sink (_tmp77_);
	_g_object_unref0 (self->priv->spinner);
	self->priv->spinner = _tmp77_;
	_tmp78_ = self->priv->spinner;
	g_object_set (_tmp78_, "active", FALSE, NULL);
	_tmp79_ = grid;
	_tmp80_ = self->priv->spinner;
	gtk_grid_attach (_tmp79_, (GtkWidget*) _tmp80_, 2, 7, 1, 1);
	_tmp81_ = grid;
	gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) _tmp81_, TRUE, TRUE, (guint) 0);
	g_signal_connect_data (self, "proccess-begin", (GCallback) __pdftricks_split_pdf___lambda23__pdftricks_split_pdf_proccess_begin, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	g_signal_connect_data (self, "proccess-finished", (GCallback) __pdftricks_split_pdf___lambda24__pdftricks_split_pdf_proccess_finished, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_g_object_unref0 (grid);
	_g_object_unref0 (range_box);
	_g_object_unref0 (scrolled_thumbs);
	_g_object_unref0 (with_thumbs);
	_g_object_unref0 (filter);
	block6_data_unref (_data6_);
	_data6_ = NULL;
	return obj;
}

static void
pdftricks_split_pdf_class_init (pdftricksSplitPDFClass * klass,
                                gpointer klass_data)
{
	pdftricks_split_pdf_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &pdftricksSplitPDF_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_pdftricks_split_pdf_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_pdftricks_split_pdf_set_property;
	G_OBJECT_CLASS (klass)->constructor = pdftricks_split_pdf_constructor;
	G_OBJECT_CLASS (klass)->finalize = pdftricks_split_pdf_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PDFTRICKS_SPLIT_PDF_WINDOW_PROPERTY, pdftricks_split_pdf_properties[PDFTRICKS_SPLIT_PDF_WINDOW_PROPERTY] = g_param_spec_object ("window", "window", "window", gtk_window_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	pdftricks_split_pdf_signals[PDFTRICKS_SPLIT_PDF_PROCCESS_BEGIN_SIGNAL] = g_signal_new ("proccess-begin", PDFTRICKS_TYPE_SPLIT_PDF, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	pdftricks_split_pdf_signals[PDFTRICKS_SPLIT_PDF_PROCCESS_FINISHED_SIGNAL] = g_signal_new ("proccess-finished", PDFTRICKS_TYPE_SPLIT_PDF, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
	pdftricks_split_pdf_signals[PDFTRICKS_SPLIT_PDF_CREATE_THUMB_BEGIN_SIGNAL] = g_signal_new ("create-thumb-begin", PDFTRICKS_TYPE_SPLIT_PDF, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	pdftricks_split_pdf_signals[PDFTRICKS_SPLIT_PDF_CREATE_THUMB_FINISHED_SIGNAL] = g_signal_new ("create-thumb-finished", PDFTRICKS_TYPE_SPLIT_PDF, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
}

static void
pdftricks_split_pdf_instance_init (pdftricksSplitPDF * self,
                                   gpointer klass)
{
	self->priv = pdftricks_split_pdf_get_instance_private (self);
}

static void
pdftricks_split_pdf_finalize (GObject * obj)
{
	pdftricksSplitPDF * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PDFTRICKS_TYPE_SPLIT_PDF, pdftricksSplitPDF);
	_g_object_unref0 (self->priv->filechooser);
	_g_object_unref0 (self->priv->_window);
	_g_object_unref0 (self->priv->entry_range);
	_g_free0 (self->priv->type_split);
	_g_object_unref0 (self->priv->spinner);
	G_OBJECT_CLASS (pdftricks_split_pdf_parent_class)->finalize (obj);
}

static GType
pdftricks_split_pdf_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (pdftricksSplitPDFClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdftricks_split_pdf_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdftricksSplitPDF), 0, (GInstanceInitFunc) pdftricks_split_pdf_instance_init, NULL };
	GType pdftricks_split_pdf_type_id;
	pdftricks_split_pdf_type_id = g_type_register_static (gtk_box_get_type (), "pdftricksSplitPDF", &g_define_type_info, 0);
	pdftricksSplitPDF_private_offset = g_type_add_instance_private (pdftricks_split_pdf_type_id, sizeof (pdftricksSplitPDFPrivate));
	return pdftricks_split_pdf_type_id;
}

GType
pdftricks_split_pdf_get_type (void)
{
	static volatile gsize pdftricks_split_pdf_type_id__once = 0;
	if (g_once_init_enter (&pdftricks_split_pdf_type_id__once)) {
		GType pdftricks_split_pdf_type_id;
		pdftricks_split_pdf_type_id = pdftricks_split_pdf_get_type_once ();
		g_once_init_leave (&pdftricks_split_pdf_type_id__once, pdftricks_split_pdf_type_id);
	}
	return pdftricks_split_pdf_type_id__once;
}

static void
_vala_pdftricks_split_pdf_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	pdftricksSplitPDF * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PDFTRICKS_TYPE_SPLIT_PDF, pdftricksSplitPDF);
	switch (property_id) {
		case PDFTRICKS_SPLIT_PDF_WINDOW_PROPERTY:
		g_value_set_object (value, pdftricks_split_pdf_get_window (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_pdftricks_split_pdf_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	pdftricksSplitPDF * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PDFTRICKS_TYPE_SPLIT_PDF, pdftricksSplitPDF);
	switch (property_id) {
		case PDFTRICKS_SPLIT_PDF_WINDOW_PROPERTY:
		pdftricks_split_pdf_set_window (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

