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

/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <gee.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>
#include <cairo-gobject.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib/gi18n-lib.h>
#include <pango/pango.h>

#define IMPORT_QUEUE_PAGE_NAME _ ("Importing…")
#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 TYPE_PAGE (page_get_type ())
#define PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PAGE, Page))
#define PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PAGE, PageClass))
#define IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PAGE))
#define IS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PAGE))
#define PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PAGE, PageClass))

typedef struct _Page Page;
typedef struct _PageClass PageClass;
typedef struct _PagePrivate PagePrivate;

#define TYPE_PAGE_WINDOW (page_window_get_type ())
#define PAGE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PAGE_WINDOW, PageWindow))
#define PAGE_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PAGE_WINDOW, PageWindowClass))
#define IS_PAGE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PAGE_WINDOW))
#define IS_PAGE_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PAGE_WINDOW))
#define PAGE_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PAGE_WINDOW, PageWindowClass))

typedef struct _PageWindow PageWindow;
typedef struct _PageWindowClass PageWindowClass;

#define TYPE_FULLSCREEN_WINDOW (fullscreen_window_get_type ())
#define FULLSCREEN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FULLSCREEN_WINDOW, FullscreenWindow))
#define FULLSCREEN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FULLSCREEN_WINDOW, FullscreenWindowClass))
#define IS_FULLSCREEN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FULLSCREEN_WINDOW))
#define IS_FULLSCREEN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FULLSCREEN_WINDOW))
#define FULLSCREEN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FULLSCREEN_WINDOW, FullscreenWindowClass))

typedef struct _FullscreenWindow FullscreenWindow;
typedef struct _FullscreenWindowClass FullscreenWindowClass;

#define TYPE_INJECTION_GROUP (injection_group_get_type ())
#define INJECTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_INJECTION_GROUP, InjectionGroup))
#define INJECTION_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_INJECTION_GROUP, InjectionGroupClass))
#define IS_INJECTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_INJECTION_GROUP))
#define IS_INJECTION_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_INJECTION_GROUP))
#define INJECTION_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_INJECTION_GROUP, InjectionGroupClass))

typedef struct _InjectionGroup InjectionGroup;
typedef struct _InjectionGroupClass InjectionGroupClass;

#define TYPE_SINGLE_PHOTO_PAGE (single_photo_page_get_type ())
#define SINGLE_PHOTO_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SINGLE_PHOTO_PAGE, SinglePhotoPage))
#define SINGLE_PHOTO_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SINGLE_PHOTO_PAGE, SinglePhotoPageClass))
#define IS_SINGLE_PHOTO_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SINGLE_PHOTO_PAGE))
#define IS_SINGLE_PHOTO_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SINGLE_PHOTO_PAGE))
#define SINGLE_PHOTO_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SINGLE_PHOTO_PAGE, SinglePhotoPageClass))

typedef struct _SinglePhotoPage SinglePhotoPage;
typedef struct _SinglePhotoPageClass SinglePhotoPageClass;
typedef struct _SinglePhotoPagePrivate SinglePhotoPagePrivate;

#define TYPE_ZOOM_BUFFER (zoom_buffer_get_type ())
#define ZOOM_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ZOOM_BUFFER, ZoomBuffer))
#define ZOOM_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ZOOM_BUFFER, ZoomBufferClass))
#define IS_ZOOM_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ZOOM_BUFFER))
#define IS_ZOOM_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ZOOM_BUFFER))
#define ZOOM_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ZOOM_BUFFER, ZoomBufferClass))

typedef struct _ZoomBuffer ZoomBuffer;
typedef struct _ZoomBufferClass ZoomBufferClass;

#define TYPE_DIMENSIONS (dimensions_get_type ())
typedef struct _Dimensions Dimensions;
typedef enum  {
	SINGLE_PHOTO_PAGE_UPDATE_REASON_NEW_PIXBUF,
	SINGLE_PHOTO_PAGE_UPDATE_REASON_QUALITY_IMPROVEMENT,
	SINGLE_PHOTO_PAGE_UPDATE_REASON_RESIZED_CANVAS
} SinglePhotoPageUpdateReason;

#define SINGLE_PHOTO_PAGE_TYPE_UPDATE_REASON (single_photo_page_update_reason_get_type ())

#define TYPE_IMPORT_QUEUE_PAGE (import_queue_page_get_type ())
#define IMPORT_QUEUE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IMPORT_QUEUE_PAGE, ImportQueuePage))
#define IMPORT_QUEUE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IMPORT_QUEUE_PAGE, ImportQueuePageClass))
#define IS_IMPORT_QUEUE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IMPORT_QUEUE_PAGE))
#define IS_IMPORT_QUEUE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IMPORT_QUEUE_PAGE))
#define IMPORT_QUEUE_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IMPORT_QUEUE_PAGE, ImportQueuePageClass))

typedef struct _ImportQueuePage ImportQueuePage;
typedef struct _ImportQueuePageClass ImportQueuePageClass;
typedef struct _ImportQueuePagePrivate ImportQueuePagePrivate;

#define TYPE_BATCH_IMPORT (batch_import_get_type ())
#define BATCH_IMPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BATCH_IMPORT, BatchImport))
#define BATCH_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BATCH_IMPORT, BatchImportClass))
#define IS_BATCH_IMPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BATCH_IMPORT))
#define IS_BATCH_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BATCH_IMPORT))
#define BATCH_IMPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BATCH_IMPORT, BatchImportClass))

typedef struct _BatchImport BatchImport;
typedef struct _BatchImportClass BatchImportClass;
enum  {
	IMPORT_QUEUE_PAGE_0_PROPERTY,
	IMPORT_QUEUE_PAGE_NUM_PROPERTIES
};
static GParamSpec* import_queue_page_properties[IMPORT_QUEUE_PAGE_NUM_PROPERTIES];
typedef void (*GSimpleActionActivateCallback) (GSimpleAction* action, GVariant* parameter, gpointer user_data);
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_DATA_OBJECT (data_object_get_type ())
#define DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_OBJECT, DataObject))
#define DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_OBJECT, DataObjectClass))
#define IS_DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_OBJECT))
#define IS_DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_OBJECT))
#define DATA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_OBJECT, DataObjectClass))

typedef struct _DataObject DataObject;
typedef struct _DataObjectClass DataObjectClass;

#define TYPE_DATA_SOURCE (data_source_get_type ())
#define DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_SOURCE, DataSource))
#define DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_SOURCE, DataSourceClass))
#define IS_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_SOURCE))
#define IS_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_SOURCE))
#define DATA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_SOURCE, DataSourceClass))

typedef struct _DataSource DataSource;
typedef struct _DataSourceClass DataSourceClass;

#define TYPE_THUMBNAIL_SOURCE (thumbnail_source_get_type ())
#define THUMBNAIL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THUMBNAIL_SOURCE, ThumbnailSource))
#define THUMBNAIL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THUMBNAIL_SOURCE, ThumbnailSourceClass))
#define IS_THUMBNAIL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THUMBNAIL_SOURCE))
#define IS_THUMBNAIL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THUMBNAIL_SOURCE))
#define THUMBNAIL_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THUMBNAIL_SOURCE, ThumbnailSourceClass))

typedef struct _ThumbnailSource ThumbnailSource;
typedef struct _ThumbnailSourceClass ThumbnailSourceClass;

#define TYPE_MEDIA_SOURCE (media_source_get_type ())
#define MEDIA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_SOURCE, MediaSource))
#define MEDIA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_SOURCE, MediaSourceClass))
#define IS_MEDIA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_SOURCE))
#define IS_MEDIA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_SOURCE))
#define MEDIA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_SOURCE, MediaSourceClass))

typedef struct _MediaSource MediaSource;
typedef struct _MediaSourceClass MediaSourceClass;

#define TYPE_IMPORT_MANIFEST (import_manifest_get_type ())
#define IMPORT_MANIFEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IMPORT_MANIFEST, ImportManifest))
#define IMPORT_MANIFEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IMPORT_MANIFEST, ImportManifestClass))
#define IS_IMPORT_MANIFEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IMPORT_MANIFEST))
#define IS_IMPORT_MANIFEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IMPORT_MANIFEST))
#define IMPORT_MANIFEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IMPORT_MANIFEST, ImportManifestClass))

typedef struct _ImportManifest ImportManifest;
typedef struct _ImportManifestClass ImportManifestClass;

#define TYPE_BATCH_IMPORT_ROLL (batch_import_roll_get_type ())
#define BATCH_IMPORT_ROLL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BATCH_IMPORT_ROLL, BatchImportRoll))
#define BATCH_IMPORT_ROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BATCH_IMPORT_ROLL, BatchImportRollClass))
#define IS_BATCH_IMPORT_ROLL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BATCH_IMPORT_ROLL))
#define IS_BATCH_IMPORT_ROLL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BATCH_IMPORT_ROLL))
#define BATCH_IMPORT_ROLL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BATCH_IMPORT_ROLL, BatchImportRollClass))

typedef struct _BatchImportRoll BatchImportRoll;
typedef struct _BatchImportRollClass BatchImportRollClass;
typedef enum  {
	IMPORT_RESULT_SUCCESS,
	IMPORT_RESULT_FILE_ERROR,
	IMPORT_RESULT_DECODE_ERROR,
	IMPORT_RESULT_DATABASE_ERROR,
	IMPORT_RESULT_USER_ABORT,
	IMPORT_RESULT_NOT_A_FILE,
	IMPORT_RESULT_PHOTO_EXISTS,
	IMPORT_RESULT_UNSUPPORTED_FORMAT,
	IMPORT_RESULT_NOT_AN_IMAGE,
	IMPORT_RESULT_DISK_FAILURE,
	IMPORT_RESULT_DISK_FULL,
	IMPORT_RESULT_CAMERA_ERROR,
	IMPORT_RESULT_FILE_WRITE_ERROR,
	IMPORT_RESULT_PIXBUF_CORRUPT_IMAGE
} ImportResult;

#define TYPE_IMPORT_RESULT (import_result_get_type ())

#define TYPE_APP_WINDOW (app_window_get_type ())
#define APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_APP_WINDOW, AppWindow))
#define APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_APP_WINDOW, AppWindowClass))
#define IS_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_APP_WINDOW))
#define IS_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_APP_WINDOW))
#define APP_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_APP_WINDOW, AppWindowClass))

typedef struct _AppWindow AppWindow;
typedef struct _AppWindowClass AppWindowClass;
typedef enum  {
	DIRECTION_FORWARD,
	DIRECTION_BACKWARD
} Direction;

#define TYPE_DIRECTION (direction_get_type ())

#define TYPE_DATA_COLLECTION (data_collection_get_type ())
#define DATA_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_COLLECTION, DataCollection))
#define DATA_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_COLLECTION, DataCollectionClass))
#define IS_DATA_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_COLLECTION))
#define IS_DATA_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_COLLECTION))
#define DATA_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_COLLECTION, DataCollectionClass))

typedef struct _DataCollection DataCollection;
typedef struct _DataCollectionClass DataCollectionClass;

#define TYPE_VIEW_COLLECTION (view_collection_get_type ())
#define VIEW_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VIEW_COLLECTION, ViewCollection))
#define VIEW_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VIEW_COLLECTION, ViewCollectionClass))
#define IS_VIEW_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VIEW_COLLECTION))
#define IS_VIEW_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VIEW_COLLECTION))
#define VIEW_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VIEW_COLLECTION, ViewCollectionClass))

typedef struct _ViewCollection ViewCollection;
typedef struct _ViewCollectionClass ViewCollectionClass;
#define _data_collection_unref0(var) ((var == NULL) ? NULL : (var = (data_collection_unref (var), NULL)))

#define TYPE_PHOTO_SOURCE (photo_source_get_type ())
#define PHOTO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_SOURCE, PhotoSource))
#define PHOTO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_SOURCE, PhotoSourceClass))
#define IS_PHOTO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_SOURCE))
#define IS_PHOTO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_SOURCE))
#define PHOTO_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_SOURCE, PhotoSourceClass))

typedef struct _PhotoSource PhotoSource;
typedef struct _PhotoSourceClass PhotoSourceClass;

#define TYPE_PHOTO (photo_get_type ())
#define PHOTO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO, Photo))
#define PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO, PhotoClass))
#define IS_PHOTO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO))
#define IS_PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO))
#define PHOTO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO, PhotoClass))

typedef struct _Photo Photo;
typedef struct _PhotoClass PhotoClass;

#define TYPE_LIBRARY_PHOTO (library_photo_get_type ())
#define LIBRARY_PHOTO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIBRARY_PHOTO, LibraryPhoto))
#define LIBRARY_PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIBRARY_PHOTO, LibraryPhotoClass))
#define IS_LIBRARY_PHOTO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIBRARY_PHOTO))
#define IS_LIBRARY_PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIBRARY_PHOTO))
#define LIBRARY_PHOTO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIBRARY_PHOTO, LibraryPhotoClass))

typedef struct _LibraryPhoto LibraryPhoto;
typedef struct _LibraryPhotoClass LibraryPhotoClass;

#define TYPE_DATA_VIEW (data_view_get_type ())
#define DATA_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_VIEW, DataView))
#define DATA_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_VIEW, DataViewClass))
#define IS_DATA_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_VIEW))
#define IS_DATA_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_VIEW))
#define DATA_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_VIEW, DataViewClass))

typedef struct _DataView DataView;
typedef struct _DataViewClass DataViewClass;

#define TYPE_THUMBNAIL_VIEW (thumbnail_view_get_type ())
#define THUMBNAIL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THUMBNAIL_VIEW, ThumbnailView))
#define THUMBNAIL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THUMBNAIL_VIEW, ThumbnailViewClass))
#define IS_THUMBNAIL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THUMBNAIL_VIEW))
#define IS_THUMBNAIL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THUMBNAIL_VIEW))
#define THUMBNAIL_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THUMBNAIL_VIEW, ThumbnailViewClass))

typedef struct _ThumbnailView ThumbnailView;
typedef struct _ThumbnailViewClass ThumbnailViewClass;

#define TYPE_PHOTO_VIEW (photo_view_get_type ())
#define PHOTO_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_VIEW, PhotoView))
#define PHOTO_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_VIEW, PhotoViewClass))
#define IS_PHOTO_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_VIEW))
#define IS_PHOTO_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_VIEW))
#define PHOTO_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_VIEW, PhotoViewClass))

typedef struct _PhotoView PhotoView;
typedef struct _PhotoViewClass PhotoViewClass;

#define TYPE_VIDEO_SOURCE (video_source_get_type ())
#define VIDEO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VIDEO_SOURCE, VideoSource))
#define VIDEO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VIDEO_SOURCE, VideoSourceClass))
#define IS_VIDEO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VIDEO_SOURCE))
#define IS_VIDEO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VIDEO_SOURCE))
#define VIDEO_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VIDEO_SOURCE, VideoSourceClass))

typedef struct _VideoSource VideoSource;
typedef struct _VideoSourceClass VideoSourceClass;

#define TYPE_VIDEO (video_get_type ())
#define VIDEO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VIDEO, Video))
#define VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VIDEO, VideoClass))
#define IS_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VIDEO))
#define IS_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VIDEO))
#define VIDEO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VIDEO, VideoClass))

typedef struct _Video Video;
typedef struct _VideoClass VideoClass;

#define TYPE_VIDEO_VIEW (video_view_get_type ())
#define VIDEO_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VIDEO_VIEW, VideoView))
#define VIDEO_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VIDEO_VIEW, VideoViewClass))
#define IS_VIDEO_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VIDEO_VIEW))
#define IS_VIDEO_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VIDEO_VIEW))
#define VIDEO_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VIDEO_VIEW, VideoViewClass))

typedef struct _VideoView VideoView;
typedef struct _VideoViewClass VideoViewClass;
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	IMPORT_QUEUE_PAGE_BATCH_ADDED_SIGNAL,
	IMPORT_QUEUE_PAGE_BATCH_REMOVED_SIGNAL,
	IMPORT_QUEUE_PAGE_NUM_SIGNALS
};
static guint import_queue_page_signals[IMPORT_QUEUE_PAGE_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 _Page {
	GtkScrolledWindow parent_instance;
	PagePrivate * priv;
	GtkBuilder* builder;
	GtkToolbar* toolbar;
	gboolean in_view;
	gdouble wheel_factor;
	gdouble modified_wheel_factor;
};

struct _PageClass {
	GtkScrolledWindowClass parent_class;
	void (*set_page_name) (Page* self, const gchar* page_name);
	void (*set_container) (Page* self, GtkWindow* container);
	void (*clear_container) (Page* self);
	GtkToolbar* (*get_toolbar) (Page* self);
	GtkMenu* (*get_page_context_menu) (Page* self);
	void (*switching_from) (Page* self);
	void (*switched_to) (Page* self);
	void (*ready) (Page* self);
	void (*switching_to_fullscreen) (Page* self, FullscreenWindow* fsw);
	void (*returning_from_fullscreen) (Page* self, FullscreenWindow* fsw);
	void (*add_actions) (Page* self, GActionMap* map);
	void (*remove_actions) (Page* self, GActionMap* map);
	void (*init_collect_ui_filenames) (Page* self, GeeList* ui_filenames);
	InjectionGroup** (*init_collect_injection_groups) (Page* self, gint* result_length1);
	void (*init_actions) (Page* self, gint selected_count, gint count);
	void (*update_actions) (Page* self, gint selected_count, gint count);
	gboolean (*on_left_click) (Page* self, GdkEventButton* event);
	gboolean (*on_middle_click) (Page* self, GdkEventButton* event);
	gboolean (*on_right_click) (Page* self, GdkEventButton* event);
	gboolean (*on_left_released) (Page* self, GdkEventButton* event);
	gboolean (*on_middle_released) (Page* self, GdkEventButton* event);
	gboolean (*on_right_released) (Page* self, GdkEventButton* event);
	gboolean (*on_ctrl_pressed) (Page* self, GdkEventKey* event);
	gboolean (*on_ctrl_released) (Page* self, GdkEventKey* event);
	gboolean (*on_alt_pressed) (Page* self, GdkEventKey* event);
	gboolean (*on_alt_released) (Page* self, GdkEventKey* event);
	gboolean (*on_shift_pressed) (Page* self, GdkEventKey* event);
	gboolean (*on_shift_released) (Page* self, GdkEventKey* event);
	gboolean (*on_super_pressed) (Page* self, GdkEventKey* event);
	gboolean (*on_super_released) (Page* self, GdkEventKey* event);
	gboolean (*on_app_key_pressed) (Page* self, GdkEventKey* event);
	gboolean (*on_app_key_released) (Page* self, GdkEventKey* event);
	void (*on_move) (Page* self, GdkRectangle* rect);
	void (*on_move_start) (Page* self, GdkRectangle* rect);
	void (*on_move_finished) (Page* self, GdkRectangle* rect);
	void (*on_resize) (Page* self, GdkRectangle* rect);
	void (*on_resize_start) (Page* self, GdkRectangle* rect);
	void (*on_resize_finished) (Page* self, GdkRectangle* rect);
	gboolean (*on_configure) (Page* self, GdkEventConfigure* event, GdkRectangle* rect);
	gboolean (*on_motion) (Page* self, GdkEventMotion* event, gint x, gint y, GdkModifierType mask);
	gboolean (*on_leave_notify_event) (Page* self);
	gboolean (*on_mousewheel_up) (Page* self, GdkEventScroll* event);
	gboolean (*on_mousewheel_down) (Page* self, GdkEventScroll* event);
	gboolean (*on_mousewheel_left) (Page* self, GdkEventScroll* event);
	gboolean (*on_mousewheel_right) (Page* self, GdkEventScroll* event);
	gboolean (*on_context_keypress) (Page* self);
	gboolean (*on_context_buttonpress) (Page* self, GdkEventButton* event);
	gboolean (*on_context_invoked) (Page* self);
	void (*set_page_cursor) (Page* self, GdkCursorType cursor_type);
};

struct _Dimensions {
	gint width;
	gint height;
};

struct _SinglePhotoPage {
	Page parent_instance;
	SinglePhotoPagePrivate * priv;
	GtkDrawingArea* canvas;
	GtkViewport* viewport;
};

struct _SinglePhotoPageClass {
	PageClass parent_class;
	gboolean (*is_zoom_supported) (SinglePhotoPage* self);
	void (*cancel_zoom) (SinglePhotoPage* self);
	void (*save_zoom_state) (SinglePhotoPage* self);
	void (*restore_zoom_state) (SinglePhotoPage* self);
	ZoomBuffer* (*get_zoom_buffer) (SinglePhotoPage* self);
	void (*new_surface) (SinglePhotoPage* self, cairo_t* ctx, Dimensions* ctx_dim);
	void (*updated_pixbuf) (SinglePhotoPage* self, GdkPixbuf* pixbuf, SinglePhotoPageUpdateReason reason, Dimensions* old_dim);
	void (*paint) (SinglePhotoPage* self, cairo_t* ctx, Dimensions* ctx_dim);
	void (*on_previous_photo) (SinglePhotoPage* self);
	void (*on_next_photo) (SinglePhotoPage* self);
};

struct _ImportQueuePage {
	SinglePhotoPage parent_instance;
	ImportQueuePagePrivate * priv;
};

struct _ImportQueuePageClass {
	SinglePhotoPageClass parent_class;
};

struct _ImportQueuePagePrivate {
	GeeArrayList* queue;
	GeeHashSet* cancel_unallowed;
	BatchImport* current_batch;
	GtkProgressBar* progress_bar;
	gboolean stopped;
};

static gint ImportQueuePage_private_offset;
static gpointer import_queue_page_parent_class = NULL;

VALA_EXTERN GType page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Page, g_object_unref)
VALA_EXTERN GType page_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PageWindow, g_object_unref)
VALA_EXTERN GType fullscreen_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FullscreenWindow, g_object_unref)
VALA_EXTERN gpointer injection_group_ref (gpointer instance);
VALA_EXTERN void injection_group_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_injection_group (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void value_set_injection_group (GValue* value,
                                gpointer v_object);
VALA_EXTERN void value_take_injection_group (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer value_get_injection_group (const GValue* value);
VALA_EXTERN GType injection_group_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (InjectionGroup, injection_group_unref)
VALA_EXTERN GType single_photo_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SinglePhotoPage, g_object_unref)
VALA_EXTERN GType zoom_buffer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ZoomBuffer, g_object_unref)
VALA_EXTERN GType dimensions_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Dimensions* dimensions_dup (const Dimensions* self);
VALA_EXTERN void dimensions_free (Dimensions* self);
VALA_EXTERN GType single_photo_page_update_reason_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType import_queue_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ImportQueuePage, g_object_unref)
VALA_EXTERN GType batch_import_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BatchImport, g_object_unref)
VALA_EXTERN void page_init_collect_ui_filenames (Page* self,
                                     GeeList* ui_filenames);
VALA_EXTERN void page_add_actions (Page* self,
                       GActionMap* map);
VALA_EXTERN void page_remove_actions (Page* self,
                          GActionMap* map);
static void import_queue_page_on_stop (ImportQueuePage* self);
static void _import_queue_page_on_stop_gsimple_action_activate_callback (GSimpleAction* action,
                                                                  GVariant* parameter,
                                                                  gpointer self);
VALA_EXTERN ImportQueuePage* import_queue_page_new (void);
VALA_EXTERN ImportQueuePage* import_queue_page_construct (GType object_type);
VALA_EXTERN SinglePhotoPage* single_photo_page_construct (GType object_type,
                                              const gchar* page_name,
                                              gboolean scale_up_to_viewport);
VALA_EXTERN GtkToolbar* page_get_toolbar (Page* self);
static void import_queue_page_real_init_collect_ui_filenames (Page* base,
                                                       GeeList* ui_filenames);
static void import_queue_page_real_add_actions (Page* base,
                                         GActionMap* map);
static void import_queue_page_real_remove_actions (Page* base,
                                            GActionMap* map);
VALA_EXTERN void import_queue_page_enqueue_and_schedule (ImportQueuePage* self,
                                             BatchImport* batch_import,
                                             gboolean allow_user_cancel);
static void import_queue_page_on_starting (ImportQueuePage* self,
                                    BatchImport* batch_import);
static void _import_queue_page_on_starting_batch_import_starting (BatchImport* _sender,
                                                           gpointer self);
static void import_queue_page_on_preparing (ImportQueuePage* self);
static void _import_queue_page_on_preparing_batch_import_preparing (BatchImport* _sender,
                                                             gpointer self);
static void import_queue_page_on_progress (ImportQueuePage* self,
                                    guint64 completed_bytes,
                                    guint64 total_bytes);
static void _import_queue_page_on_progress_batch_import_progress (BatchImport* _sender,
                                                           guint64 completed_bytes,
                                                           guint64 total_bytes,
                                                           gpointer self);
VALA_EXTERN GType data_object_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataObject, g_object_unref)
VALA_EXTERN GType data_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataSource, g_object_unref)
VALA_EXTERN GType thumbnail_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ThumbnailSource, g_object_unref)
static void import_queue_page_on_imported (ImportQueuePage* self,
                                    ThumbnailSource* source,
                                    GdkPixbuf* pixbuf,
                                    gint to_follow);
VALA_EXTERN GType media_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MediaSource, g_object_unref)
static void _import_queue_page_on_imported_batch_import_imported (BatchImport* _sender,
                                                           MediaSource* source,
                                                           GdkPixbuf* pixbuf,
                                                           gint to_follow,
                                                           gpointer self);
VALA_EXTERN gpointer import_manifest_ref (gpointer instance);
VALA_EXTERN void import_manifest_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_import_manifest (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void value_set_import_manifest (GValue* value,
                                gpointer v_object);
VALA_EXTERN void value_take_import_manifest (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer value_get_import_manifest (const GValue* value);
VALA_EXTERN GType import_manifest_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ImportManifest, import_manifest_unref)
VALA_EXTERN gpointer batch_import_roll_ref (gpointer instance);
VALA_EXTERN void batch_import_roll_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_batch_import_roll (const gchar* name,
                                          const gchar* nick,
                                          const gchar* blurb,
                                          GType object_type,
                                          GParamFlags flags);
VALA_EXTERN void value_set_batch_import_roll (GValue* value,
                                  gpointer v_object);
VALA_EXTERN void value_take_batch_import_roll (GValue* value,
                                   gpointer v_object);
VALA_EXTERN gpointer value_get_batch_import_roll (const GValue* value);
VALA_EXTERN GType batch_import_roll_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BatchImportRoll, batch_import_roll_unref)
static void import_queue_page_on_import_complete (ImportQueuePage* self,
                                           BatchImport* batch_import,
                                           ImportManifest* manifest,
                                           BatchImportRoll* import_roll);
static void _import_queue_page_on_import_complete_batch_import_import_complete (BatchImport* _sender,
                                                                         ImportManifest* manifest,
                                                                         BatchImportRoll* import_roll,
                                                                         gpointer self);
VALA_EXTERN GType import_result_get_type (void) G_GNUC_CONST ;
static void import_queue_page_on_fatal_error (ImportQueuePage* self,
                                       ImportResult _result_,
                                       const gchar* message);
static void _import_queue_page_on_fatal_error_batch_import_fatal_error (BatchImport* _sender,
                                                                 ImportResult _result_,
                                                                 const gchar* message,
                                                                 gpointer self);
VALA_EXTERN void batch_import_schedule (BatchImport* self);
static void import_queue_page_update_stop_action (ImportQueuePage* self);
VALA_EXTERN gint import_queue_page_get_batch_count (ImportQueuePage* self);
VALA_EXTERN void page_set_action_sensitive (Page* self,
                                const gchar* name,
                                gboolean sensitive);
VALA_EXTERN GType app_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AppWindow, g_object_unref)
VALA_EXTERN AppWindow* app_window_get_instance (void);
VALA_EXTERN void page_window_set_busy_cursor (PageWindow* self);
VALA_EXTERN void batch_import_user_halt (BatchImport* self);
VALA_EXTERN gboolean page_is_in_view (Page* self);
VALA_EXTERN GType direction_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void single_photo_page_set_pixbuf (SinglePhotoPage* self,
                                   GdkPixbuf* unscaled,
                                   Dimensions* max_dim,
                                   Direction* direction);
VALA_EXTERN void dimensions_for_pixbuf (GdkPixbuf* pixbuf,
                            Dimensions* result);
VALA_EXTERN gpointer data_collection_ref (gpointer instance);
VALA_EXTERN void data_collection_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_data_collection (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void value_set_data_collection (GValue* value,
                                gpointer v_object);
VALA_EXTERN void value_take_data_collection (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer value_get_data_collection (const GValue* value);
VALA_EXTERN GType data_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataCollection, data_collection_unref)
VALA_EXTERN GType view_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ViewCollection, data_collection_unref)
VALA_EXTERN ViewCollection* page_get_view (Page* self);
VALA_EXTERN void data_collection_clear (DataCollection* self);
VALA_EXTERN GType photo_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotoSource, g_object_unref)
VALA_EXTERN GType photo_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Photo, g_object_unref)
VALA_EXTERN GType library_photo_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LibraryPhoto, g_object_unref)
VALA_EXTERN gboolean data_collection_add (DataCollection* self,
                              DataObject* object);
VALA_EXTERN PhotoView* photo_view_new (PhotoSource* source);
VALA_EXTERN PhotoView* photo_view_construct (GType object_type,
                                 PhotoSource* source);
VALA_EXTERN GType data_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataView, g_object_unref)
VALA_EXTERN GType thumbnail_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ThumbnailView, g_object_unref)
VALA_EXTERN GType photo_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotoView, g_object_unref)
VALA_EXTERN GType video_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (VideoSource, g_object_unref)
VALA_EXTERN GType video_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Video, g_object_unref)
VALA_EXTERN VideoView* video_view_new (VideoSource* source);
VALA_EXTERN VideoView* video_view_construct (GType object_type,
                                 VideoSource* source);
VALA_EXTERN GType video_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (VideoView, g_object_unref)
VALA_EXTERN gchar* data_object_get_name (DataObject* self);
VALA_EXTERN void single_photo_page_blank_display (SinglePhotoPage* self);
VALA_EXTERN void page_window_set_normal_cursor (PageWindow* self);
VALA_EXTERN void app_window_error_message (const gchar* message,
                               GtkWindow* parent);
static void import_queue_page_finalize (GObject * obj);
static GType import_queue_page_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const GActionEntry IMPORT_QUEUE_PAGE_entries[1] = {{"Stop", _import_queue_page_on_stop_gsimple_action_activate_callback}};

static inline gpointer
import_queue_page_get_instance_private (ImportQueuePage* self)
{
	return G_STRUCT_MEMBER_P (self, ImportQueuePage_private_offset);
}

static void
_import_queue_page_on_stop_gsimple_action_activate_callback (GSimpleAction* action,
                                                             GVariant* parameter,
                                                             gpointer self)
{
	import_queue_page_on_stop ((ImportQueuePage*) self);
}

ImportQueuePage*
import_queue_page_construct (GType object_type)
{
	ImportQueuePage * self = NULL;
	GtkToolbar* toolbar = NULL;
	GtkToolbar* _tmp0_;
	GtkToolButton* stop_button = NULL;
	GtkToolButton* _tmp1_;
	GtkSeparatorToolItem* separator = NULL;
	GtkSeparatorToolItem* _tmp2_;
	GtkToolItem* progress_item = NULL;
	GtkToolItem* _tmp3_;
	GtkProgressBar* _tmp4_;
	GtkProgressBar* _tmp5_;
	self = (ImportQueuePage*) single_photo_page_construct (object_type, IMPORT_QUEUE_PAGE_NAME, FALSE);
	_tmp0_ = page_get_toolbar (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
	toolbar = _tmp0_;
	_tmp1_ = (GtkToolButton*) gtk_tool_button_new (NULL, NULL);
	g_object_ref_sink (_tmp1_);
	stop_button = _tmp1_;
	gtk_tool_button_set_icon_name (stop_button, "process-stop-symbolic");
	gtk_actionable_set_action_name (G_TYPE_CHECK_INSTANCE_CAST (stop_button, gtk_actionable_get_type (), GtkActionable), "win.Stop");
	gtk_toolbar_insert (toolbar, G_TYPE_CHECK_INSTANCE_CAST (stop_button, gtk_tool_item_get_type (), GtkToolItem), -1);
	_tmp2_ = (GtkSeparatorToolItem*) gtk_separator_tool_item_new ();
	g_object_ref_sink (_tmp2_);
	separator = _tmp2_;
	gtk_separator_tool_item_set_draw (separator, FALSE);
	gtk_toolbar_insert (toolbar, G_TYPE_CHECK_INSTANCE_CAST (separator, gtk_tool_item_get_type (), GtkToolItem), -1);
	_tmp3_ = gtk_tool_item_new ();
	g_object_ref_sink (_tmp3_);
	progress_item = _tmp3_;
	gtk_tool_item_set_expand (progress_item, TRUE);
	_tmp4_ = self->priv->progress_bar;
	gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (progress_item, gtk_container_get_type (), GtkContainer), G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, gtk_widget_get_type (), GtkWidget));
	_tmp5_ = self->priv->progress_bar;
	gtk_progress_bar_set_show_text (_tmp5_, TRUE);
	gtk_toolbar_insert (toolbar, progress_item, -1);
	_g_object_unref0 (progress_item);
	_g_object_unref0 (separator);
	_g_object_unref0 (stop_button);
	_g_object_unref0 (toolbar);
	return self;
}

ImportQueuePage*
import_queue_page_new (void)
{
	return import_queue_page_construct (TYPE_IMPORT_QUEUE_PAGE);
}

static void
import_queue_page_real_init_collect_ui_filenames (Page* base,
                                                  GeeList* ui_filenames)
{
	ImportQueuePage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_IMPORT_QUEUE_PAGE, ImportQueuePage);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (ui_filenames, GEE_TYPE_LIST));
	gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (ui_filenames, GEE_TYPE_COLLECTION, GeeCollection), "import_queue.ui");
	PAGE_CLASS (import_queue_page_parent_class)->init_collect_ui_filenames (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SINGLE_PHOTO_PAGE, SinglePhotoPage), TYPE_PAGE, Page), ui_filenames);
}

static void
import_queue_page_real_add_actions (Page* base,
                                    GActionMap* map)
{
	ImportQueuePage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_IMPORT_QUEUE_PAGE, ImportQueuePage);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (map, g_action_map_get_type ()));
	PAGE_CLASS (import_queue_page_parent_class)->add_actions (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SINGLE_PHOTO_PAGE, SinglePhotoPage), TYPE_PAGE, Page), map);
	g_action_map_add_action_entries (map, IMPORT_QUEUE_PAGE_entries, (gint) G_N_ELEMENTS (IMPORT_QUEUE_PAGE_entries), self);
}

static void
import_queue_page_real_remove_actions (Page* base,
                                       GActionMap* map)
{
	ImportQueuePage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_IMPORT_QUEUE_PAGE, ImportQueuePage);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (map, g_action_map_get_type ()));
	PAGE_CLASS (import_queue_page_parent_class)->remove_actions (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SINGLE_PHOTO_PAGE, SinglePhotoPage), TYPE_PAGE, Page), map);
	{
		GActionEntry* entry_collection = NULL;
		gint entry_collection_length1 = 0;
		gint _entry_collection_size_ = 0;
		gint entry_it = 0;
		entry_collection = IMPORT_QUEUE_PAGE_entries;
		entry_collection_length1 = G_N_ELEMENTS (IMPORT_QUEUE_PAGE_entries);
		for (entry_it = 0; entry_it < entry_collection_length1; entry_it = entry_it + 1) {
			GActionEntry entry = {0};
			entry = entry_collection[entry_it];
			{
				GActionEntry _tmp0_;
				const gchar* _tmp1_;
				_tmp0_ = entry;
				_tmp1_ = _tmp0_.name;
				g_action_map_remove_action (map, _tmp1_);
			}
		}
	}
}

static void
_import_queue_page_on_starting_batch_import_starting (BatchImport* _sender,
                                                      gpointer self)
{
	import_queue_page_on_starting ((ImportQueuePage*) self, _sender);
}

static void
_import_queue_page_on_preparing_batch_import_preparing (BatchImport* _sender,
                                                        gpointer self)
{
	import_queue_page_on_preparing ((ImportQueuePage*) self);
}

static void
_import_queue_page_on_progress_batch_import_progress (BatchImport* _sender,
                                                      guint64 completed_bytes,
                                                      guint64 total_bytes,
                                                      gpointer self)
{
	import_queue_page_on_progress ((ImportQueuePage*) self, completed_bytes, total_bytes);
}

static void
_import_queue_page_on_imported_batch_import_imported (BatchImport* _sender,
                                                      MediaSource* source,
                                                      GdkPixbuf* pixbuf,
                                                      gint to_follow,
                                                      gpointer self)
{
	import_queue_page_on_imported ((ImportQueuePage*) self, source, pixbuf, to_follow);
}

static void
_import_queue_page_on_import_complete_batch_import_import_complete (BatchImport* _sender,
                                                                    ImportManifest* manifest,
                                                                    BatchImportRoll* import_roll,
                                                                    gpointer self)
{
	import_queue_page_on_import_complete ((ImportQueuePage*) self, _sender, manifest, import_roll);
}

static void
_import_queue_page_on_fatal_error_batch_import_fatal_error (BatchImport* _sender,
                                                            ImportResult _result_,
                                                            const gchar* message,
                                                            gpointer self)
{
	import_queue_page_on_fatal_error ((ImportQueuePage*) self, _result_, message);
}

void
import_queue_page_enqueue_and_schedule (ImportQueuePage* self,
                                        BatchImport* batch_import,
                                        gboolean allow_user_cancel)
{
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	g_return_if_fail (IS_IMPORT_QUEUE_PAGE (self));
	g_return_if_fail (IS_BATCH_IMPORT (batch_import));
	_tmp0_ = self->priv->queue;
	_vala_assert (!gee_abstract_collection_contains (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), batch_import), "!queue.contains(batch_import)");
	g_signal_connect_object (batch_import, "starting", (GCallback) _import_queue_page_on_starting_batch_import_starting, self, 0);
	g_signal_connect_object (batch_import, "preparing", (GCallback) _import_queue_page_on_preparing_batch_import_preparing, self, 0);
	g_signal_connect_object (batch_import, "progress", (GCallback) _import_queue_page_on_progress_batch_import_progress, self, 0);
	g_signal_connect_object (batch_import, "imported", (GCallback) _import_queue_page_on_imported_batch_import_imported, self, 0);
	g_signal_connect_object (batch_import, "import-complete", (GCallback) _import_queue_page_on_import_complete_batch_import_import_complete, self, 0);
	g_signal_connect_object (batch_import, "fatal-error", (GCallback) _import_queue_page_on_fatal_error_batch_import_fatal_error, self, 0);
	if (!allow_user_cancel) {
		GeeHashSet* _tmp1_;
		_tmp1_ = self->priv->cancel_unallowed;
		gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), batch_import);
	}
	_tmp2_ = self->priv->queue;
	gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), batch_import);
	g_signal_emit (self, import_queue_page_signals[IMPORT_QUEUE_PAGE_BATCH_ADDED_SIGNAL], 0, batch_import);
	_tmp3_ = self->priv->queue;
	_tmp4_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection));
	_tmp5_ = _tmp4_;
	if (_tmp5_ == 1) {
		batch_import_schedule (batch_import);
	}
	import_queue_page_update_stop_action (self);
}

gint
import_queue_page_get_batch_count (ImportQueuePage* self)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint result;
	g_return_val_if_fail (IS_IMPORT_QUEUE_PAGE (self), -1);
	_tmp0_ = self->priv->queue;
	_tmp1_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection));
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static void
import_queue_page_update_stop_action (ImportQueuePage* self)
{
	gboolean _tmp0_ = FALSE;
	GeeHashSet* _tmp1_;
	BatchImport* _tmp2_;
	g_return_if_fail (IS_IMPORT_QUEUE_PAGE (self));
	_tmp1_ = self->priv->cancel_unallowed;
	_tmp2_ = self->priv->current_batch;
	if (!gee_abstract_collection_contains (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp2_)) {
		GeeArrayList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		_tmp3_ = self->priv->queue;
		_tmp4_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection));
		_tmp5_ = _tmp4_;
		_tmp0_ = _tmp5_ > 0;
	} else {
		_tmp0_ = FALSE;
	}
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Stop", _tmp0_);
}

static void
import_queue_page_on_stop (ImportQueuePage* self)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	AppWindow* _tmp3_;
	AppWindow* _tmp4_;
	g_return_if_fail (IS_IMPORT_QUEUE_PAGE (self));
	import_queue_page_update_stop_action (self);
	_tmp0_ = self->priv->queue;
	_tmp1_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection));
	_tmp2_ = _tmp1_;
	if (_tmp2_ == 0) {
		return;
	}
	_tmp3_ = app_window_get_instance ();
	_tmp4_ = _tmp3_;
	page_window_set_busy_cursor (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, TYPE_PAGE_WINDOW, PageWindow));
	_g_object_unref0 (_tmp4_);
	self->priv->stopped = TRUE;
	{
		GeeArrayList* _batch_import_list = NULL;
		GeeArrayList* _tmp5_;
		gint _batch_import_size = 0;
		GeeArrayList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _batch_import_index = 0;
		_tmp5_ = self->priv->queue;
		_batch_import_list = _tmp5_;
		_tmp6_ = _batch_import_list;
		_tmp7_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection));
		_tmp8_ = _tmp7_;
		_batch_import_size = _tmp8_;
		_batch_import_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			BatchImport* batch_import = NULL;
			GeeArrayList* _tmp11_;
			gpointer _tmp12_;
			BatchImport* _tmp13_;
			_batch_import_index = _batch_import_index + 1;
			_tmp9_ = _batch_import_index;
			_tmp10_ = _batch_import_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _batch_import_list;
			_tmp12_ = gee_abstract_list_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, GEE_TYPE_ABSTRACT_LIST, GeeAbstractList), _batch_import_index);
			batch_import = (BatchImport*) _tmp12_;
			_tmp13_ = batch_import;
			batch_import_user_halt (_tmp13_);
			_g_object_unref0 (batch_import);
		}
	}
}

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

static void
import_queue_page_on_starting (ImportQueuePage* self,
                               BatchImport* batch_import)
{
	BatchImport* _tmp0_;
	g_return_if_fail (IS_IMPORT_QUEUE_PAGE (self));
	g_return_if_fail (IS_BATCH_IMPORT (batch_import));
	import_queue_page_update_stop_action (self);
	_tmp0_ = _g_object_ref0 (batch_import);
	_g_object_unref0 (self->priv->current_batch);
	self->priv->current_batch = _tmp0_;
}

static void
import_queue_page_on_preparing (ImportQueuePage* self)
{
	GtkProgressBar* _tmp0_;
	GtkProgressBar* _tmp1_;
	g_return_if_fail (IS_IMPORT_QUEUE_PAGE (self));
	_tmp0_ = self->priv->progress_bar;
	gtk_progress_bar_set_text (_tmp0_, _ ("Preparing to import…"));
	_tmp1_ = self->priv->progress_bar;
	gtk_progress_bar_pulse (_tmp1_);
}

static void
import_queue_page_on_progress (ImportQueuePage* self,
                               guint64 completed_bytes,
                               guint64 total_bytes)
{
	gdouble _tmp0_ = 0.0;
	gdouble pct = 0.0;
	GtkProgressBar* _tmp1_;
	g_return_if_fail (IS_IMPORT_QUEUE_PAGE (self));
	if (completed_bytes <= total_bytes) {
		_tmp0_ = ((gdouble) completed_bytes) / ((gdouble) total_bytes);
	} else {
		_tmp0_ = 0.0;
	}
	pct = _tmp0_;
	_tmp1_ = self->priv->progress_bar;
	gtk_progress_bar_set_fraction (_tmp1_, pct);
}

static void
import_queue_page_on_imported (ImportQueuePage* self,
                               ThumbnailSource* source,
                               GdkPixbuf* pixbuf,
                               gint to_follow)
{
	gboolean _tmp0_ = FALSE;
	Dimensions _tmp1_ = {0};
	ViewCollection* _tmp2_;
	ViewCollection* _tmp3_;
	gboolean _tmp4_ = FALSE;
	GtkProgressBar* _tmp13_;
	GtkProgressBar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	g_return_if_fail (IS_IMPORT_QUEUE_PAGE (self));
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (pixbuf, gdk_pixbuf_get_type ()));
	if (to_follow > 0) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = !page_is_in_view (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
	}
	if (_tmp0_) {
		return;
	}
	dimensions_for_pixbuf (pixbuf, &_tmp1_);
	single_photo_page_set_pixbuf (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SINGLE_PHOTO_PAGE, SinglePhotoPage), pixbuf, &_tmp1_, NULL);
	_tmp2_ = page_get_view (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
	_tmp3_ = _tmp2_;
	data_collection_clear (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, TYPE_DATA_COLLECTION, DataCollection));
	_data_collection_unref0 (_tmp3_);
	if (IS_LIBRARY_PHOTO (source)) {
		ViewCollection* _tmp5_;
		ViewCollection* _tmp6_;
		PhotoView* _tmp7_;
		PhotoView* _tmp8_;
		_tmp5_ = page_get_view (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
		_tmp6_ = _tmp5_;
		_tmp7_ = photo_view_new (G_TYPE_CHECK_INSTANCE_CAST (IS_LIBRARY_PHOTO (source) ? ((LibraryPhoto*) source) : NULL, TYPE_PHOTO_SOURCE, PhotoSource));
		_tmp8_ = _tmp7_;
		_tmp4_ = data_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, TYPE_DATA_COLLECTION, DataCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, TYPE_DATA_OBJECT, DataObject));
		_g_object_unref0 (_tmp8_);
		_data_collection_unref0 (_tmp6_);
	} else {
		ViewCollection* _tmp9_;
		ViewCollection* _tmp10_;
		VideoView* _tmp11_;
		VideoView* _tmp12_;
		_tmp9_ = page_get_view (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
		_tmp10_ = _tmp9_;
		_tmp11_ = video_view_new (G_TYPE_CHECK_INSTANCE_CAST (IS_VIDEO (source) ? ((Video*) source) : NULL, TYPE_VIDEO_SOURCE, VideoSource));
		_tmp12_ = _tmp11_;
		_tmp4_ = data_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, TYPE_DATA_COLLECTION, DataCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, TYPE_DATA_OBJECT, DataObject));
		_g_object_unref0 (_tmp12_);
		_data_collection_unref0 (_tmp10_);
	}
	_tmp13_ = self->priv->progress_bar;
	gtk_progress_bar_set_ellipsize (_tmp13_, PANGO_ELLIPSIZE_MIDDLE);
	_tmp14_ = self->priv->progress_bar;
	_tmp15_ = data_object_get_name (G_TYPE_CHECK_INSTANCE_CAST (source, TYPE_DATA_OBJECT, DataObject));
	_tmp16_ = _tmp15_;
	_tmp17_ = g_strdup_printf (_ ("Imported %s"), _tmp16_);
	_tmp18_ = _tmp17_;
	gtk_progress_bar_set_text (_tmp14_, _tmp18_);
	_g_free0 (_tmp18_);
	_g_free0 (_tmp16_);
}

static void
import_queue_page_on_import_complete (ImportQueuePage* self,
                                      BatchImport* batch_import,
                                      ImportManifest* manifest,
                                      BatchImportRoll* import_roll)
{
	BatchImport* _tmp0_;
	GeeArrayList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	GeeArrayList* _tmp4_;
	gpointer _tmp5_;
	BatchImport* _tmp6_;
	gboolean removed = FALSE;
	GeeArrayList* _tmp7_;
	GeeHashSet* _tmp8_;
	guint _tmp9_;
	guint _tmp10_;
	guint _tmp11_;
	guint _tmp12_;
	guint _tmp13_;
	guint _tmp14_;
	GeeArrayList* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	g_return_if_fail (IS_IMPORT_QUEUE_PAGE (self));
	g_return_if_fail (IS_BATCH_IMPORT (batch_import));
	g_return_if_fail (IS_IMPORT_MANIFEST (manifest));
	g_return_if_fail (IS_BATCH_IMPORT_ROLL (import_roll));
	_tmp0_ = self->priv->current_batch;
	_vala_assert (batch_import == _tmp0_, "batch_import == current_batch");
	_g_object_unref0 (self->priv->current_batch);
	self->priv->current_batch = NULL;
	_tmp1_ = self->priv->queue;
	_tmp2_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection));
	_tmp3_ = _tmp2_;
	_vala_assert (_tmp3_ > 0, "queue.size > 0");
	_tmp4_ = self->priv->queue;
	_tmp5_ = gee_abstract_list_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, GEE_TYPE_ABSTRACT_LIST, GeeAbstractList), 0);
	_tmp6_ = (BatchImport*) _tmp5_;
	_vala_assert (_tmp6_ == batch_import, "queue.get(0) == batch_import");
	_g_object_unref0 (_tmp6_);
	_tmp7_ = self->priv->queue;
	removed = gee_abstract_collection_remove (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), batch_import);
	_vala_assert (removed, "removed");
	_tmp8_ = self->priv->cancel_unallowed;
	gee_abstract_collection_remove (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), batch_import);
	g_signal_parse_name ("starting", TYPE_BATCH_IMPORT, &_tmp9_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (batch_import, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _import_queue_page_on_starting_batch_import_starting, self);
	g_signal_parse_name ("preparing", TYPE_BATCH_IMPORT, &_tmp10_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (batch_import, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp10_, 0, NULL, (GCallback) _import_queue_page_on_preparing_batch_import_preparing, self);
	g_signal_parse_name ("progress", TYPE_BATCH_IMPORT, &_tmp11_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (batch_import, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp11_, 0, NULL, (GCallback) _import_queue_page_on_progress_batch_import_progress, self);
	g_signal_parse_name ("imported", TYPE_BATCH_IMPORT, &_tmp12_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (batch_import, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp12_, 0, NULL, (GCallback) _import_queue_page_on_imported_batch_import_imported, self);
	g_signal_parse_name ("import-complete", TYPE_BATCH_IMPORT, &_tmp13_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (batch_import, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp13_, 0, NULL, (GCallback) _import_queue_page_on_import_complete_batch_import_import_complete, self);
	g_signal_parse_name ("fatal-error", TYPE_BATCH_IMPORT, &_tmp14_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (batch_import, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp14_, 0, NULL, (GCallback) _import_queue_page_on_fatal_error_batch_import_fatal_error, self);
	_tmp15_ = self->priv->queue;
	_tmp16_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection));
	_tmp17_ = _tmp16_;
	if (_tmp17_ > 0) {
		GeeArrayList* _tmp18_;
		gpointer _tmp19_;
		BatchImport* _tmp20_;
		_tmp18_ = self->priv->queue;
		_tmp19_ = gee_abstract_list_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, GEE_TYPE_ABSTRACT_LIST, GeeAbstractList), 0);
		_tmp20_ = (BatchImport*) _tmp19_;
		batch_import_schedule (_tmp20_);
		_g_object_unref0 (_tmp20_);
	} else {
		GtkProgressBar* _tmp21_;
		GtkProgressBar* _tmp22_;
		GtkProgressBar* _tmp23_;
		_tmp21_ = self->priv->progress_bar;
		gtk_progress_bar_set_ellipsize (_tmp21_, PANGO_ELLIPSIZE_NONE);
		_tmp22_ = self->priv->progress_bar;
		gtk_progress_bar_set_text (_tmp22_, "");
		_tmp23_ = self->priv->progress_bar;
		gtk_progress_bar_set_fraction (_tmp23_, 0.0);
		single_photo_page_blank_display (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SINGLE_PHOTO_PAGE, SinglePhotoPage));
		if (self->priv->stopped) {
			AppWindow* _tmp24_;
			AppWindow* _tmp25_;
			_tmp24_ = app_window_get_instance ();
			_tmp25_ = _tmp24_;
			page_window_set_normal_cursor (G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, TYPE_PAGE_WINDOW, PageWindow));
			_g_object_unref0 (_tmp25_);
		}
		self->priv->stopped = FALSE;
	}
	import_queue_page_update_stop_action (self);
	g_signal_emit (self, import_queue_page_signals[IMPORT_QUEUE_PAGE_BATCH_REMOVED_SIGNAL], 0, batch_import);
}

static void
import_queue_page_on_fatal_error (ImportQueuePage* self,
                                  ImportResult _result_,
                                  const gchar* message)
{
	g_return_if_fail (IS_IMPORT_QUEUE_PAGE (self));
	g_return_if_fail (message != NULL);
	app_window_error_message (message, NULL);
}

static void
import_queue_page_class_init (ImportQueuePageClass * klass,
                              gpointer klass_data)
{
	import_queue_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ImportQueuePage_private_offset);
	((PageClass *) klass)->init_collect_ui_filenames = (void (*) (Page*, GeeList*)) import_queue_page_real_init_collect_ui_filenames;
	((PageClass *) klass)->add_actions = (void (*) (Page*, GActionMap*)) import_queue_page_real_add_actions;
	((PageClass *) klass)->remove_actions = (void (*) (Page*, GActionMap*)) import_queue_page_real_remove_actions;
	G_OBJECT_CLASS (klass)->finalize = import_queue_page_finalize;
	import_queue_page_signals[IMPORT_QUEUE_PAGE_BATCH_ADDED_SIGNAL] = g_signal_new ("batch-added", TYPE_IMPORT_QUEUE_PAGE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, TYPE_BATCH_IMPORT);
	import_queue_page_signals[IMPORT_QUEUE_PAGE_BATCH_REMOVED_SIGNAL] = g_signal_new ("batch-removed", TYPE_IMPORT_QUEUE_PAGE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, TYPE_BATCH_IMPORT);
}

static void
import_queue_page_instance_init (ImportQueuePage * self,
                                 gpointer klass)
{
	GeeArrayList* _tmp0_;
	GeeHashSet* _tmp1_;
	GtkProgressBar* _tmp2_;
	self->priv = import_queue_page_get_instance_private (self);
	_tmp0_ = gee_array_list_new (TYPE_BATCH_IMPORT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->queue = _tmp0_;
	_tmp1_ = gee_hash_set_new (TYPE_BATCH_IMPORT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->cancel_unallowed = _tmp1_;
	self->priv->current_batch = NULL;
	_tmp2_ = (GtkProgressBar*) gtk_progress_bar_new ();
	g_object_ref_sink (_tmp2_);
	self->priv->progress_bar = _tmp2_;
	self->priv->stopped = FALSE;
}

static void
import_queue_page_finalize (GObject * obj)
{
	ImportQueuePage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_IMPORT_QUEUE_PAGE, ImportQueuePage);
	_g_object_unref0 (self->priv->queue);
	_g_object_unref0 (self->priv->cancel_unallowed);
	_g_object_unref0 (self->priv->current_batch);
	_g_object_unref0 (self->priv->progress_bar);
	G_OBJECT_CLASS (import_queue_page_parent_class)->finalize (obj);
}

static GType
import_queue_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ImportQueuePageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) import_queue_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ImportQueuePage), 0, (GInstanceInitFunc) import_queue_page_instance_init, NULL };
	GType import_queue_page_type_id;
	import_queue_page_type_id = g_type_register_static (TYPE_SINGLE_PHOTO_PAGE, "ImportQueuePage", &g_define_type_info, 0);
	ImportQueuePage_private_offset = g_type_add_instance_private (import_queue_page_type_id, sizeof (ImportQueuePagePrivate));
	return import_queue_page_type_id;
}

GType
import_queue_page_get_type (void)
{
	static volatile gsize import_queue_page_type_id__once = 0;
	if (g_once_init_enter (&import_queue_page_type_id__once)) {
		GType import_queue_page_type_id;
		import_queue_page_type_id = import_queue_page_get_type_once ();
		g_once_init_leave (&import_queue_page_type_id__once, import_queue_page_type_id);
	}
	return import_queue_page_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

