/* DirectPhotoPage.c generated by valac 0.56.19, the Vala compiler
 * generated from DirectPhotoPage.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 <glib/gstdio.h>

#define RESOURCES_APP_TITLE "Shotwell"
#define RESOURCES_OK_LABEL _ ("_OK")
#define RESOURCES_CANCEL_LABEL _ ("_Cancel")
#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_EDITING_HOST_PAGE (editing_host_page_get_type ())
#define EDITING_HOST_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EDITING_HOST_PAGE, EditingHostPage))
#define EDITING_HOST_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EDITING_HOST_PAGE, EditingHostPageClass))
#define IS_EDITING_HOST_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EDITING_HOST_PAGE))
#define IS_EDITING_HOST_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EDITING_HOST_PAGE))
#define EDITING_HOST_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EDITING_HOST_PAGE, EditingHostPageClass))

typedef struct _EditingHostPage EditingHostPage;
typedef struct _EditingHostPageClass EditingHostPageClass;
typedef struct _EditingHostPagePrivate EditingHostPagePrivate;

#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_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_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_DIRECT_PHOTO_PAGE (direct_photo_page_get_type ())
#define DIRECT_PHOTO_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage))
#define DIRECT_PHOTO_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPageClass))
#define IS_DIRECT_PHOTO_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DIRECT_PHOTO_PAGE))
#define IS_DIRECT_PHOTO_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DIRECT_PHOTO_PAGE))
#define DIRECT_PHOTO_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPageClass))

typedef struct _DirectPhotoPage DirectPhotoPage;
typedef struct _DirectPhotoPageClass DirectPhotoPageClass;
typedef struct _DirectPhotoPagePrivate DirectPhotoPagePrivate;

#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 TYPE_DIRECT_VIEW_COLLECTION (direct_view_collection_get_type ())
#define DIRECT_VIEW_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DIRECT_VIEW_COLLECTION, DirectViewCollection))
#define DIRECT_VIEW_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DIRECT_VIEW_COLLECTION, DirectViewCollectionClass))
#define IS_DIRECT_VIEW_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DIRECT_VIEW_COLLECTION))
#define IS_DIRECT_VIEW_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DIRECT_VIEW_COLLECTION))
#define DIRECT_VIEW_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DIRECT_VIEW_COLLECTION, DirectViewCollectionClass))

typedef struct _DirectViewCollection DirectViewCollection;
typedef struct _DirectViewCollectionClass DirectViewCollectionClass;
enum  {
	DIRECT_PHOTO_PAGE_0_PROPERTY,
	DIRECT_PHOTO_PAGE_NUM_PROPERTIES
};
static GParamSpec* direct_photo_page_properties[DIRECT_PHOTO_PAGE_NUM_PROPERTIES];

#define TYPE_SOURCE_COLLECTION (source_collection_get_type ())
#define SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOURCE_COLLECTION, SourceCollection))
#define SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOURCE_COLLECTION, SourceCollectionClass))
#define IS_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOURCE_COLLECTION))
#define IS_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOURCE_COLLECTION))
#define SOURCE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOURCE_COLLECTION, SourceCollectionClass))

typedef struct _SourceCollection SourceCollection;
typedef struct _SourceCollectionClass SourceCollectionClass;

#define TYPE_DATABASE_SOURCE_COLLECTION (database_source_collection_get_type ())
#define DATABASE_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollection))
#define DATABASE_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollectionClass))
#define IS_DATABASE_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_SOURCE_COLLECTION))
#define IS_DATABASE_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_SOURCE_COLLECTION))
#define DATABASE_SOURCE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollectionClass))

typedef struct _DatabaseSourceCollection DatabaseSourceCollection;
typedef struct _DatabaseSourceCollectionClass DatabaseSourceCollectionClass;

#define TYPE_DIRECT_PHOTO_SOURCE_COLLECTION (direct_photo_source_collection_get_type ())
#define DIRECT_PHOTO_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DIRECT_PHOTO_SOURCE_COLLECTION, DirectPhotoSourceCollection))
#define DIRECT_PHOTO_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DIRECT_PHOTO_SOURCE_COLLECTION, DirectPhotoSourceCollectionClass))
#define IS_DIRECT_PHOTO_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DIRECT_PHOTO_SOURCE_COLLECTION))
#define IS_DIRECT_PHOTO_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DIRECT_PHOTO_SOURCE_COLLECTION))
#define DIRECT_PHOTO_SOURCE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DIRECT_PHOTO_SOURCE_COLLECTION, DirectPhotoSourceCollectionClass))

typedef struct _DirectPhotoSourceCollection DirectPhotoSourceCollection;
typedef struct _DirectPhotoSourceCollectionClass DirectPhotoSourceCollectionClass;

#define TYPE_ALTERATION (alteration_get_type ())
#define ALTERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ALTERATION, Alteration))
#define ALTERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ALTERATION, AlterationClass))
#define IS_ALTERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ALTERATION))
#define IS_ALTERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ALTERATION))
#define ALTERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ALTERATION, AlterationClass))

typedef struct _Alteration Alteration;
typedef struct _AlterationClass AlterationClass;
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 _data_collection_unref0(var) ((var == NULL) ? NULL : (var = (data_collection_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_APPLICATION (application_get_type ())
#define APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_APPLICATION, Application))
#define APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_APPLICATION, ApplicationClass))
#define IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_APPLICATION))
#define IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_APPLICATION))
#define APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_APPLICATION, ApplicationClass))

typedef struct _Application Application;
typedef struct _ApplicationClass ApplicationClass;
#define _application_unref0(var) ((var == NULL) ? NULL : (var = (application_unref (var), NULL)))
#define _injection_group_unref0(var) ((var == NULL) ? NULL : (var = (injection_group_unref (var), NULL)))

#define TYPE_DIRECT_PHOTO (direct_photo_get_type ())
#define DIRECT_PHOTO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DIRECT_PHOTO, DirectPhoto))
#define DIRECT_PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DIRECT_PHOTO, DirectPhotoClass))
#define IS_DIRECT_PHOTO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DIRECT_PHOTO))
#define IS_DIRECT_PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DIRECT_PHOTO))
#define DIRECT_PHOTO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DIRECT_PHOTO, DirectPhotoClass))

typedef struct _DirectPhoto DirectPhoto;
typedef struct _DirectPhotoClass DirectPhotoClass;
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_ZOOM_STATE (zoom_state_get_type ())
typedef struct _ZoomState ZoomState;
typedef enum  {
	PHOTO_FILE_FORMAT_JFIF,
	PHOTO_FILE_FORMAT_RAW,
	PHOTO_FILE_FORMAT_PNG,
	PHOTO_FILE_FORMAT_TIFF,
	PHOTO_FILE_FORMAT_BMP,
	PHOTO_FILE_FORMAT_GIF,
	PHOTO_FILE_FORMAT_WEBP,
	PHOTO_FILE_FORMAT_AVIF,
	PHOTO_FILE_FORMAT_HEIF,
	PHOTO_FILE_FORMAT_JPEGXL,
	PHOTO_FILE_FORMAT_UNKNOWN
} PhotoFileFormat;

#define TYPE_PHOTO_FILE_FORMAT (photo_file_format_get_type ())

#define TYPE_COMMAND_MANAGER (command_manager_get_type ())
#define COMMAND_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMMAND_MANAGER, CommandManager))
#define COMMAND_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMMAND_MANAGER, CommandManagerClass))
#define IS_COMMAND_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMMAND_MANAGER))
#define IS_COMMAND_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMMAND_MANAGER))
#define COMMAND_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COMMAND_MANAGER, CommandManagerClass))

typedef struct _CommandManager CommandManager;
typedef struct _CommandManagerClass CommandManagerClass;
#define _command_manager_unref0(var) ((var == NULL) ? NULL : (var = (command_manager_unref (var), NULL)))

#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;

#define TYPE_DIRECT_WINDOW (direct_window_get_type ())
#define DIRECT_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DIRECT_WINDOW, DirectWindow))
#define DIRECT_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DIRECT_WINDOW, DirectWindowClass))
#define IS_DIRECT_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DIRECT_WINDOW))
#define IS_DIRECT_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DIRECT_WINDOW))
#define DIRECT_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DIRECT_WINDOW, DirectWindowClass))

typedef struct _DirectWindow DirectWindow;
typedef struct _DirectWindowClass DirectWindowClass;

#define TYPE_SCALING (scaling_get_type ())
typedef struct _Scaling Scaling;
typedef enum  {
	SCALE_CONSTRAINT_ORIGINAL,
	SCALE_CONSTRAINT_DIMENSIONS,
	SCALE_CONSTRAINT_WIDTH,
	SCALE_CONSTRAINT_HEIGHT,
	SCALE_CONSTRAINT_FILL_VIEWPORT
} ScaleConstraint;

#define TYPE_SCALE_CONSTRAINT (scale_constraint_get_type ())
typedef enum  {
	JPEG_QUALITY_LOW = 50,
	JPEG_QUALITY_MEDIUM = 75,
	JPEG_QUALITY_HIGH = 90,
	JPEG_QUALITY_MAXIMUM = 100
} JpegQuality;

#define JPEG_TYPE_QUALITY (jpeg_quality_get_type ())
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define TYPE_DIRECT_VIEW (direct_view_get_type ())
#define DIRECT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DIRECT_VIEW, DirectView))
#define DIRECT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DIRECT_VIEW, DirectViewClass))
#define IS_DIRECT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DIRECT_VIEW))
#define IS_DIRECT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DIRECT_VIEW))
#define DIRECT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DIRECT_VIEW, DirectViewClass))

typedef struct _DirectView DirectView;
typedef struct _DirectViewClass DirectViewClass;

#define TYPE_EXPORT_DIALOG (export_dialog_get_type ())
#define EXPORT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EXPORT_DIALOG, ExportDialog))
#define EXPORT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EXPORT_DIALOG, ExportDialogClass))
#define IS_EXPORT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EXPORT_DIALOG))
#define IS_EXPORT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EXPORT_DIALOG))
#define EXPORT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EXPORT_DIALOG, ExportDialogClass))

typedef struct _ExportDialog ExportDialog;
typedef struct _ExportDialogClass ExportDialogClass;

#define TYPE_EXPORT_FORMAT_PARAMETERS (export_format_parameters_get_type ())
typedef struct _ExportFormatParameters ExportFormatParameters;
typedef enum  {
	EXPORT_FORMAT_MODE_UNMODIFIED,
	EXPORT_FORMAT_MODE_CURRENT,
	EXPORT_FORMAT_MODE_SPECIFIED,
	EXPORT_FORMAT_MODE_LAST
} ExportFormatMode;

#define TYPE_EXPORT_FORMAT_MODE (export_format_mode_get_type ())

#define TYPE_PHOTO_FILE_FORMAT_PROPERTIES (photo_file_format_properties_get_type ())
#define PHOTO_FILE_FORMAT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_FILE_FORMAT_PROPERTIES, PhotoFileFormatProperties))
#define PHOTO_FILE_FORMAT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_FILE_FORMAT_PROPERTIES, PhotoFileFormatPropertiesClass))
#define IS_PHOTO_FILE_FORMAT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_FILE_FORMAT_PROPERTIES))
#define IS_PHOTO_FILE_FORMAT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_FILE_FORMAT_PROPERTIES))
#define PHOTO_FILE_FORMAT_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_FILE_FORMAT_PROPERTIES, PhotoFileFormatPropertiesClass))

typedef struct _PhotoFileFormatProperties PhotoFileFormatProperties;
typedef struct _PhotoFileFormatPropertiesClass PhotoFileFormatPropertiesClass;
#define _photo_file_format_properties_unref0(var) ((var == NULL) ? NULL : (var = (photo_file_format_properties_unref (var), NULL)))

#define TYPE_PRINT_MANAGER (print_manager_get_type ())
#define PRINT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PRINT_MANAGER, PrintManager))
#define PRINT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PRINT_MANAGER, PrintManagerClass))
#define IS_PRINT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PRINT_MANAGER))
#define IS_PRINT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PRINT_MANAGER))
#define PRINT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PRINT_MANAGER, PrintManagerClass))

typedef struct _PrintManager PrintManager;
typedef struct _PrintManagerClass PrintManagerClass;
#define _print_manager_unref0(var) ((var == NULL) ? NULL : (var = (print_manager_unref (var), NULL)))
typedef struct _Block8Data Block8Data;

#define TYPE_DIRECT_FULLSCREEN_PHOTO_PAGE (direct_fullscreen_photo_page_get_type ())
#define DIRECT_FULLSCREEN_PHOTO_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DIRECT_FULLSCREEN_PHOTO_PAGE, DirectFullscreenPhotoPage))
#define DIRECT_FULLSCREEN_PHOTO_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DIRECT_FULLSCREEN_PHOTO_PAGE, DirectFullscreenPhotoPageClass))
#define IS_DIRECT_FULLSCREEN_PHOTO_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DIRECT_FULLSCREEN_PHOTO_PAGE))
#define IS_DIRECT_FULLSCREEN_PHOTO_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DIRECT_FULLSCREEN_PHOTO_PAGE))
#define DIRECT_FULLSCREEN_PHOTO_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DIRECT_FULLSCREEN_PHOTO_PAGE, DirectFullscreenPhotoPageClass))

typedef struct _DirectFullscreenPhotoPage DirectFullscreenPhotoPage;
typedef struct _DirectFullscreenPhotoPageClass DirectFullscreenPhotoPageClass;
typedef struct _DirectFullscreenPhotoPagePrivate DirectFullscreenPhotoPagePrivate;
enum  {
	DIRECT_FULLSCREEN_PHOTO_PAGE_0_PROPERTY,
	DIRECT_FULLSCREEN_PHOTO_PAGE_NUM_PROPERTIES
};
static GParamSpec* direct_fullscreen_photo_page_properties[DIRECT_FULLSCREEN_PHOTO_PAGE_NUM_PROPERTIES];

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 _EditingHostPage {
	SinglePhotoPage parent_instance;
	EditingHostPagePrivate * priv;
};

struct _EditingHostPageClass {
	SinglePhotoPageClass parent_class;
	gboolean (*on_zoom_slider_key_press) (EditingHostPage* self, GdkEventKey* event);
	void (*on_increase_size) (EditingHostPage* self);
	void (*on_decrease_size) (EditingHostPage* self);
	void (*photo_changing) (EditingHostPage* self, Photo* new_photo);
	DataView* (*create_photo_view) (EditingHostPage* self, DataSource* source);
	void (*update_ui) (EditingHostPage* self, gboolean missing);
	void (*notify_photo_backing_missing) (EditingHostPage* self, Photo* photo, gboolean missing);
	gboolean (*confirm_replace_photo) (EditingHostPage* self, Photo* old_photo, Photo* new_photo);
	gboolean (*on_double_click) (EditingHostPage* self, GdkEventButton* event);
	GdkPixbuf* (*get_bottom_left_trinket) (EditingHostPage* self, gint scale);
	GdkPixbuf* (*get_top_left_trinket) (EditingHostPage* self, gint scale);
	GdkPixbuf* (*get_top_right_trinket) (EditingHostPage* self, gint scale);
	GdkPixbuf* (*get_bottom_right_trinket) (EditingHostPage* self, gint scale);
	void (*insert_faces_button) (EditingHostPage* self, GtkToolbar* toolbar);
};

struct _DirectPhotoPage {
	EditingHostPage parent_instance;
	DirectPhotoPagePrivate * priv;
};

struct _DirectPhotoPageClass {
	EditingHostPageClass parent_class;
};

struct _DirectPhotoPagePrivate {
	GFile* initial_file;
	DirectViewCollection* view_controller;
	GFile* current_save_dir;
	gboolean drop_if_dirty;
	gboolean in_shutdown;
	GtkMenu* context_menu;
};

struct _ZoomState {
	Dimensions content_dimensions;
	Dimensions viewport_dimensions;
	gdouble zoom_factor;
	gdouble interpolation_factor;
	gdouble min_factor;
	gdouble max_factor;
	GdkPoint viewport_center;
};

struct _Scaling {
	ScaleConstraint constraint;
	gint scale;
	Dimensions viewport;
	gboolean scale_up;
};

struct _ExportFormatParameters {
	ExportFormatMode mode;
	PhotoFileFormat specified_format;
	JpegQuality quality;
	gboolean export_metadata;
};

struct _Block8Data {
	int _ref_count_;
	DirectPhotoPage* self;
	gboolean should_allow_rotation;
};

struct _DirectFullscreenPhotoPage {
	DirectPhotoPage parent_instance;
	DirectFullscreenPhotoPagePrivate * priv;
};

struct _DirectFullscreenPhotoPageClass {
	DirectPhotoPageClass parent_class;
};

static gint DirectPhotoPage_private_offset;
static gpointer direct_photo_page_parent_class = NULL;
VALA_EXTERN DirectPhotoSourceCollection* direct_photo_global;
static gpointer direct_fullscreen_photo_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 editing_host_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (EditingHostPage, g_object_unref)
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)
VALA_EXTERN GType media_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MediaSource, g_object_unref)
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 data_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataView, g_object_unref)
VALA_EXTERN GType direct_photo_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DirectPhotoPage, g_object_unref)
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 GType direct_view_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DirectViewCollection, data_collection_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);
VALA_EXTERN InjectionGroup** page_init_collect_injection_groups (Page* self,
                                                     gint* result_length1);
VALA_EXTERN void editing_host_page_photo_changing (EditingHostPage* self,
                                       Photo* new_photo);
VALA_EXTERN gboolean page_on_context_buttonpress (Page* self,
                                      GdkEventButton* event);
VALA_EXTERN void editing_host_page_on_increase_size (EditingHostPage* self);
VALA_EXTERN void editing_host_page_on_decrease_size (EditingHostPage* self);
VALA_EXTERN gboolean editing_host_page_on_double_click (EditingHostPage* self,
                                            GdkEventButton* event);
VALA_EXTERN void editing_host_page_update_ui (EditingHostPage* self,
                                  gboolean missing);
VALA_EXTERN void page_update_actions (Page* self,
                          gint selected_count,
                          gint count);
VALA_EXTERN gboolean editing_host_page_confirm_replace_photo (EditingHostPage* self,
                                                  Photo* old_photo,
                                                  Photo* new_photo);
VALA_EXTERN gboolean page_on_app_key_pressed (Page* self,
                                  GdkEventKey* event);
VALA_EXTERN DataView* editing_host_page_create_photo_view (EditingHostPage* self,
                                               DataSource* source);
VALA_EXTERN GType source_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SourceCollection, data_collection_unref)
VALA_EXTERN GType database_source_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DatabaseSourceCollection, data_collection_unref)
VALA_EXTERN GType direct_photo_source_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DirectPhotoSourceCollection, data_collection_unref)
VALA_EXTERN gpointer alteration_ref (gpointer instance);
VALA_EXTERN void alteration_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_alteration (const gchar* name,
                                   const gchar* nick,
                                   const gchar* blurb,
                                   GType object_type,
                                   GParamFlags flags);
VALA_EXTERN void value_set_alteration (GValue* value,
                           gpointer v_object);
VALA_EXTERN void value_take_alteration (GValue* value,
                            gpointer v_object);
VALA_EXTERN gpointer value_get_alteration (const GValue* value);
VALA_EXTERN GType alteration_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Alteration, alteration_unref)
static void direct_photo_page_on_photos_altered (DirectPhotoPage* self,
                                          GeeMap* map);
static void _direct_photo_page_on_photos_altered_data_collection_items_altered (DataCollection* _sender,
                                                                         GeeMap* items,
                                                                         gpointer self);
static void direct_photo_page_on_save (DirectPhotoPage* self);
static void _direct_photo_page_on_save_gsimple_action_activate_callback (GSimpleAction* action,
                                                                  GVariant* parameter,
                                                                  gpointer self);
static void direct_photo_page_on_save_as (DirectPhotoPage* self);
static void _direct_photo_page_on_save_as_gsimple_action_activate_callback (GSimpleAction* action,
                                                                     GVariant* parameter,
                                                                     gpointer self);
static void direct_photo_page_on_send_to (DirectPhotoPage* self);
static void _direct_photo_page_on_send_to_gsimple_action_activate_callback (GSimpleAction* action,
                                                                     GVariant* parameter,
                                                                     gpointer self);
static void direct_photo_page_on_print (DirectPhotoPage* self);
static void _direct_photo_page_on_print_gsimple_action_activate_callback (GSimpleAction* action,
                                                                   GVariant* parameter,
                                                                   gpointer self);
VALA_EXTERN void single_photo_page_on_previous_photo (SinglePhotoPage* self);
static void _single_photo_page_on_previous_photo_gsimple_action_activate_callback (GSimpleAction* action,
                                                                            GVariant* parameter,
                                                                            gpointer self);
VALA_EXTERN void single_photo_page_on_next_photo (SinglePhotoPage* self);
static void _single_photo_page_on_next_photo_gsimple_action_activate_callback (GSimpleAction* action,
                                                                        GVariant* parameter,
                                                                        gpointer self);
VALA_EXTERN void editing_host_page_on_rotate_clockwise (EditingHostPage* self);
static void _editing_host_page_on_rotate_clockwise_gsimple_action_activate_callback (GSimpleAction* action,
                                                                              GVariant* parameter,
                                                                              gpointer self);
VALA_EXTERN void editing_host_page_on_rotate_counterclockwise (EditingHostPage* self);
static void _editing_host_page_on_rotate_counterclockwise_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                     GVariant* parameter,
                                                                                     gpointer self);
VALA_EXTERN void editing_host_page_on_flip_horizontally (EditingHostPage* self);
static void _editing_host_page_on_flip_horizontally_gsimple_action_activate_callback (GSimpleAction* action,
                                                                               GVariant* parameter,
                                                                               gpointer self);
VALA_EXTERN void editing_host_page_on_flip_vertically (EditingHostPage* self);
static void _editing_host_page_on_flip_vertically_gsimple_action_activate_callback (GSimpleAction* action,
                                                                             GVariant* parameter,
                                                                             gpointer self);
VALA_EXTERN void editing_host_page_on_enhance (EditingHostPage* self);
static void _editing_host_page_on_enhance_gsimple_action_activate_callback (GSimpleAction* action,
                                                                     GVariant* parameter,
                                                                     gpointer self);
VALA_EXTERN void editing_host_page_toggle_crop (EditingHostPage* self);
static void _editing_host_page_toggle_crop_gsimple_action_activate_callback (GSimpleAction* action,
                                                                      GVariant* parameter,
                                                                      gpointer self);
VALA_EXTERN void editing_host_page_toggle_straighten (EditingHostPage* self);
static void _editing_host_page_toggle_straighten_gsimple_action_activate_callback (GSimpleAction* action,
                                                                            GVariant* parameter,
                                                                            gpointer self);
VALA_EXTERN void editing_host_page_toggle_redeye (EditingHostPage* self);
static void _editing_host_page_toggle_redeye_gsimple_action_activate_callback (GSimpleAction* action,
                                                                        GVariant* parameter,
                                                                        gpointer self);
VALA_EXTERN void editing_host_page_toggle_adjust (EditingHostPage* self);
static void _editing_host_page_toggle_adjust_gsimple_action_activate_callback (GSimpleAction* action,
                                                                        GVariant* parameter,
                                                                        gpointer self);
VALA_EXTERN void editing_host_page_on_revert (EditingHostPage* self);
static void _editing_host_page_on_revert_gsimple_action_activate_callback (GSimpleAction* action,
                                                                    GVariant* parameter,
                                                                    gpointer self);
VALA_EXTERN void editing_host_page_on_adjust_date_time (EditingHostPage* self);
static void _editing_host_page_on_adjust_date_time_gsimple_action_activate_callback (GSimpleAction* action,
                                                                              GVariant* parameter,
                                                                              gpointer self);
VALA_EXTERN void editing_host_page_on_set_background (EditingHostPage* self);
static void _editing_host_page_on_set_background_gsimple_action_activate_callback (GSimpleAction* action,
                                                                            GVariant* parameter,
                                                                            gpointer self);
static void _editing_host_page_on_increase_size_gsimple_action_activate_callback (GSimpleAction* action,
                                                                           GVariant* parameter,
                                                                           gpointer self);
static void _editing_host_page_on_decrease_size_gsimple_action_activate_callback (GSimpleAction* action,
                                                                           GVariant* parameter,
                                                                           gpointer self);
VALA_EXTERN void editing_host_page_snap_zoom_to_min (EditingHostPage* self);
static void _editing_host_page_snap_zoom_to_min_gsimple_action_activate_callback (GSimpleAction* action,
                                                                           GVariant* parameter,
                                                                           gpointer self);
VALA_EXTERN void editing_host_page_snap_zoom_to_isomorphic (EditingHostPage* self);
static void _editing_host_page_snap_zoom_to_isomorphic_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                  GVariant* parameter,
                                                                                  gpointer self);
VALA_EXTERN void editing_host_page_snap_zoom_to_max (EditingHostPage* self);
static void _editing_host_page_snap_zoom_to_max_gsimple_action_activate_callback (GSimpleAction* action,
                                                                           GVariant* parameter,
                                                                           gpointer self);
VALA_EXTERN DirectPhotoPage* direct_photo_page_new (GFile* file);
VALA_EXTERN DirectPhotoPage* direct_photo_page_construct (GType object_type,
                                              GFile* file);
VALA_EXTERN EditingHostPage* editing_host_page_construct (GType object_type,
                                              SourceCollection* sources,
                                              const gchar* name);
static gboolean direct_photo_page_check_editable_file (GFile* file);
VALA_EXTERN gpointer application_ref (gpointer instance);
VALA_EXTERN void application_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_application (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void value_set_application (GValue* value,
                            gpointer v_object);
VALA_EXTERN void value_take_application (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer value_get_application (const GValue* value);
VALA_EXTERN GType application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Application, application_unref)
VALA_EXTERN Application* application_get_instance (void);
VALA_EXTERN void application_panic (Application* self);
VALA_EXTERN DirectViewCollection* direct_view_collection_new (void);
VALA_EXTERN DirectViewCollection* direct_view_collection_construct (GType object_type);
VALA_EXTERN ViewCollection* page_get_view (Page* self);
static void direct_photo_page_on_selection_group_altered (DirectPhotoPage* self);
static void _direct_photo_page_on_selection_group_altered_view_collection_selection_group_altered (ViewCollection* _sender,
                                                                                            gpointer self);
static void direct_photo_page_real_init_collect_ui_filenames (Page* base,
                                                       GeeList* ui_filenames);
static void direct_photo_page_real_add_actions (Page* base,
                                         GActionMap* map);
static void direct_photo_page_real_remove_actions (Page* base,
                                            GActionMap* map);
static InjectionGroup** direct_photo_page_real_init_collect_injection_groups (Page* base,
                                                                       gint* result_length1);
VALA_EXTERN InjectionGroup* injection_group_new (const gchar* path);
VALA_EXTERN InjectionGroup* injection_group_construct (GType object_type,
                                           const gchar* path);
VALA_EXTERN void injection_group_add_menu_item (InjectionGroup* self,
                                    const gchar* name,
                                    const gchar* action,
                                    const gchar* accelerator);
static void _vala_array_add61 (InjectionGroup** * array,
                        gint* length,
                        gint* size,
                        InjectionGroup* value);
static void _vala_array_add62 (InjectionGroup** * array,
                        gint* length,
                        gint* size,
                        InjectionGroup* value);
VALA_EXTERN void app_window_error_message (const gchar* message,
                               GtkWindow* parent);
VALA_EXTERN gboolean photo_file_format_is_file_supported (GFile* file);
static void direct_photo_page_real_realize (GtkWidget* base);
VALA_EXTERN GType direct_photo_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DirectPhoto, g_object_unref)
VALA_EXTERN DirectPhoto* direct_photo_source_collection_get_file_source (DirectPhotoSourceCollection* self,
                                                             GFile* file);
VALA_EXTERN void editing_host_page_display_mirror_of (EditingHostPage* self,
                                          ViewCollection* controller,
                                          Photo* starting_photo);
VALA_EXTERN void app_window_panic (const gchar* msg);
static void direct_photo_page_real_photo_changing (EditingHostPage* base,
                                            Photo* new_photo);
VALA_EXTERN Photo* editing_host_page_get_photo (EditingHostPage* self);
static void direct_photo_page_on_dphoto_can_rotate_changed (DirectPhotoPage* self,
                                                     gboolean should_allow_rotation);
static void _direct_photo_page_on_dphoto_can_rotate_changed_direct_photo_can_rotate_changed (DirectPhoto* _sender,
                                                                                      gboolean b,
                                                                                      gpointer self);
VALA_EXTERN GType import_result_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ImportResult direct_photo_demand_load (DirectPhoto* self);
VALA_EXTERN GFile* direct_photo_page_get_current_file (DirectPhotoPage* self);
VALA_EXTERN GFile* media_source_get_file (MediaSource* self);
static gboolean direct_photo_page_real_on_context_buttonpress (Page* base,
                                                        GdkEventButton* event);
VALA_EXTERN gboolean page_popup_context_menu (Page* self,
                                  GtkMenu* context_menu,
                                  GdkEventButton* event);
static GtkMenu* direct_photo_page_get_context_menu (DirectPhotoPage* self);
static void direct_photo_page_update_zoom_menu_item_sensitivity (DirectPhotoPage* self);
VALA_EXTERN GType zoom_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ZoomState* zoom_state_dup (const ZoomState* self);
VALA_EXTERN void zoom_state_free (ZoomState* self);
VALA_EXTERN void single_photo_page_get_zoom_state (SinglePhotoPage* self,
                                       ZoomState* result);
VALA_EXTERN gboolean zoom_state_is_max (ZoomState *self);
VALA_EXTERN gboolean editing_host_page_get_photo_missing (EditingHostPage* self);
VALA_EXTERN void page_set_action_sensitive (Page* self,
                                const gchar* name,
                                gboolean sensitive);
VALA_EXTERN gboolean zoom_state_is_default (ZoomState *self);
static void direct_photo_page_real_on_increase_size (EditingHostPage* base);
static void direct_photo_page_real_on_decrease_size (EditingHostPage* base);
VALA_EXTERN gboolean editing_host_page_has_photo (EditingHostPage* self);
VALA_EXTERN GType photo_file_format_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PhotoFileFormat photo_get_file_format (Photo* self);
VALA_EXTERN gboolean photo_file_format_can_write (PhotoFileFormat self);
VALA_EXTERN gpointer command_manager_ref (gpointer instance);
VALA_EXTERN void command_manager_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_command_manager (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void value_set_command_manager (GValue* value,
                                gpointer v_object);
VALA_EXTERN void value_take_command_manager (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer value_get_command_manager (const GValue* value);
VALA_EXTERN GType command_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CommandManager, command_manager_unref)
VALA_EXTERN CommandManager* page_get_command_manager (Page* self);
VALA_EXTERN void command_manager_reset (CommandManager* self);
static gboolean direct_photo_page_real_on_double_click (EditingHostPage* base,
                                                 GdkEventButton* event);
VALA_EXTERN GtkWindow* page_get_container (Page* self);
VALA_EXTERN void fullscreen_window_close (FullscreenWindow* self);
VALA_EXTERN GType app_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AppWindow, g_object_unref)
VALA_EXTERN GType direct_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DirectWindow, g_object_unref)
VALA_EXTERN void direct_window_do_fullscreen (DirectWindow* self);
static void direct_photo_page_real_update_ui (EditingHostPage* base,
                                       gboolean missing);
static void direct_photo_page_real_update_actions (Page* base,
                                            gint selected_count,
                                            gint count);
VALA_EXTERN gint data_collection_get_count (DataCollection* self);
VALA_EXTERN gboolean photo_has_transformations (Photo* self);
VALA_EXTERN gboolean editing_host_page_is_rotate_available (EditingHostPage* self,
                                                Photo* photo);
VALA_EXTERN gboolean editing_host_page_is_enhance_available (EditingHostPage* self,
                                                 Photo* photo);
VALA_EXTERN GType scaling_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType scale_constraint_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Scaling* scaling_dup (const Scaling* self);
VALA_EXTERN void scaling_free (Scaling* self);
VALA_EXTERN gboolean editing_tools_crop_tool_is_available (Photo* photo,
                                               Scaling* scaling);
VALA_EXTERN void scaling_for_original (Scaling* result);
VALA_EXTERN gboolean editing_tools_redeye_tool_is_available (Photo* photo,
                                                 Scaling* scaling);
static gboolean direct_photo_page_check_ok_to_close_photo (DirectPhotoPage* self,
                                                    Photo* photo,
                                                    gboolean notify);
VALA_EXTERN gboolean photo_has_alterations (Photo* self);
VALA_EXTERN void photo_remove_all_transformations (Photo* self,
                                       gboolean notify);
VALA_EXTERN GtkResponseType app_window_negate_affirm_cancel_question (const gchar* message,
                                                          const gchar* negative,
                                                          const gchar* affirmative,
                                                          const gchar* title,
                                                          GtkWindow* parent);
VALA_EXTERN gchar* media_source_get_basename (MediaSource* self);
VALA_EXTERN GType jpeg_quality_get_type (void) G_GNUC_CONST ;
static void direct_photo_page_save (DirectPhotoPage* self,
                             GFile* dest,
                             gint scale,
                             ScaleConstraint constraint,
                             JpegQuality quality,
                             PhotoFileFormat format,
                             gboolean copy_unmodified,
                             gboolean save_metadata);
VALA_EXTERN gboolean direct_photo_page_check_quit (DirectPhotoPage* self);
static gboolean direct_photo_page_real_confirm_replace_photo (EditingHostPage* base,
                                                       Photo* old_photo,
                                                       Photo* new_photo);
VALA_EXTERN void scaling_for_constraint (ScaleConstraint constraint,
                             gint scale,
                             gboolean scale_up,
                             Scaling* result);
VALA_EXTERN void photo_export (Photo* self,
                   GFile* dest_file,
                   Scaling* scaling,
                   JpegQuality quality,
                   PhotoFileFormat export_format,
                   gboolean direct_copy_unmodified,
                   gboolean export_metadata,
                   GError** error);
VALA_EXTERN gchar* direct_photo_source_collection_fetch (DirectPhotoSourceCollection* self,
                                             GFile* file,
                                             DirectPhoto** photo,
                                             gboolean reimport);
VALA_EXTERN gboolean data_source_equals (DataSource* self,
                             DataSource* source);
VALA_EXTERN GType direct_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DirectView, g_object_unref)
VALA_EXTERN DirectView* direct_view_new (DirectPhoto* source);
VALA_EXTERN DirectView* direct_view_construct (GType object_type,
                                   DirectPhoto* source);
VALA_EXTERN gboolean data_collection_add (DataCollection* self,
                              DataObject* object);
VALA_EXTERN void direct_photo_source_collection_reimport_photo (DirectPhotoSourceCollection* self,
                                                    DirectPhoto* photo);
VALA_EXTERN GType export_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ExportDialog, g_object_unref)
VALA_EXTERN ExportDialog* export_dialog_new (const gchar* title);
VALA_EXTERN ExportDialog* export_dialog_construct (GType object_type,
                                       const gchar* title);
VALA_EXTERN GType export_format_parameters_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType export_format_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ExportFormatParameters* export_format_parameters_dup (const ExportFormatParameters* self);
VALA_EXTERN void export_format_parameters_free (ExportFormatParameters* self);
VALA_EXTERN void export_format_parameters_last (ExportFormatParameters* result);
VALA_EXTERN gboolean export_dialog_execute (ExportDialog* self,
                                gint* scale,
                                ScaleConstraint* constraint,
                                ExportFormatParameters* parameters);
VALA_EXTERN gchar* photo_get_export_basename_for_parameters (Photo* self,
                                                 ExportFormatParameters* params);
VALA_EXTERN PhotoFileFormat photo_get_export_format_for_parameters (Photo* self,
                                                        ExportFormatParameters* params);
VALA_EXTERN gpointer photo_file_format_properties_ref (gpointer instance);
VALA_EXTERN void photo_file_format_properties_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_photo_file_format_properties (const gchar* name,
                                                     const gchar* nick,
                                                     const gchar* blurb,
                                                     GType object_type,
                                                     GParamFlags flags);
VALA_EXTERN void value_set_photo_file_format_properties (GValue* value,
                                             gpointer v_object);
VALA_EXTERN void value_take_photo_file_format_properties (GValue* value,
                                              gpointer v_object);
VALA_EXTERN gpointer value_get_photo_file_format_properties (const GValue* value);
VALA_EXTERN GType photo_file_format_properties_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotoFileFormatProperties, photo_file_format_properties_unref)
VALA_EXTERN PhotoFileFormatProperties* photo_file_format_get_properties (PhotoFileFormat self);
VALA_EXTERN gchar** photo_file_format_properties_get_known_extensions (PhotoFileFormatProperties* self,
                                                           gint* result_length1);
VALA_EXTERN AppWindow* app_window_get_instance (void);
VALA_EXTERN void desktop_integration_send_to (GeeCollection* media);
VALA_EXTERN GeeList* view_collection_get_selected_sources (ViewCollection* self);
static gboolean direct_photo_page_real_on_app_key_pressed (Page* base,
                                                    GdkEventKey* event);
VALA_EXTERN void page_activate_action (Page* self,
                           const gchar* name);
VALA_EXTERN gint view_collection_get_selected_count (ViewCollection* self);
VALA_EXTERN gpointer print_manager_ref (gpointer instance);
VALA_EXTERN void print_manager_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_print_manager (const gchar* name,
                                      const gchar* nick,
                                      const gchar* blurb,
                                      GType object_type,
                                      GParamFlags flags);
VALA_EXTERN void value_set_print_manager (GValue* value,
                              gpointer v_object);
VALA_EXTERN void value_take_print_manager (GValue* value,
                               gpointer v_object);
VALA_EXTERN gpointer value_get_print_manager (const GValue* value);
VALA_EXTERN GType print_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PrintManager, print_manager_unref)
VALA_EXTERN PrintManager* print_manager_get_instance (void);
VALA_EXTERN void print_manager_spool_photo (PrintManager* self,
                                GeeCollection* to_print);
VALA_EXTERN GeeList* view_collection_get_selected_sources_of_type (ViewCollection* self,
                                                       GType t);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
static gboolean __lambda20_ (Block8Data* _data8_);
VALA_EXTERN void editing_host_page_enable_rotate (EditingHostPage* self,
                                      gboolean should_enable);
static gboolean ___lambda20__gsource_func (gpointer self);
static DataView* direct_photo_page_real_create_photo_view (EditingHostPage* base,
                                                    DataSource* source);
static void direct_photo_page_finalize (GObject * obj);
static GType direct_photo_page_get_type_once (void);
VALA_EXTERN GType direct_fullscreen_photo_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DirectFullscreenPhotoPage, g_object_unref)
VALA_EXTERN DirectFullscreenPhotoPage* direct_fullscreen_photo_page_new (GFile* file);
VALA_EXTERN DirectFullscreenPhotoPage* direct_fullscreen_photo_page_construct (GType object_type,
                                                                   GFile* file);
static void direct_fullscreen_photo_page_real_init_collect_ui_filenames (Page* base,
                                                                  GeeList* ui_filenames);
static GType direct_fullscreen_photo_page_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const GActionEntry DIRECT_PHOTO_PAGE_entries[23] = {{"Save", _direct_photo_page_on_save_gsimple_action_activate_callback}, {"SaveAs", _direct_photo_page_on_save_as_gsimple_action_activate_callback}, {"SendTo", _direct_photo_page_on_send_to_gsimple_action_activate_callback}, {"Print", _direct_photo_page_on_print_gsimple_action_activate_callback}, {"PrevPhoto", _single_photo_page_on_previous_photo_gsimple_action_activate_callback}, {"NextPhoto", _single_photo_page_on_next_photo_gsimple_action_activate_callback}, {"RotateClockwise", _editing_host_page_on_rotate_clockwise_gsimple_action_activate_callback}, {"RotateCounterclockwise", _editing_host_page_on_rotate_counterclockwise_gsimple_action_activate_callback}, {"FlipHorizontally", _editing_host_page_on_flip_horizontally_gsimple_action_activate_callback}, {"FlipVertically", _editing_host_page_on_flip_vertically_gsimple_action_activate_callback}, {"Enhance", _editing_host_page_on_enhance_gsimple_action_activate_callback}, {"Crop", _editing_host_page_toggle_crop_gsimple_action_activate_callback}, {"Straighten", _editing_host_page_toggle_straighten_gsimple_action_activate_callback}, {"RedEye", _editing_host_page_toggle_redeye_gsimple_action_activate_callback}, {"Adjust", _editing_host_page_toggle_adjust_gsimple_action_activate_callback}, {"Revert", _editing_host_page_on_revert_gsimple_action_activate_callback}, {"AdjustDateTime", _editing_host_page_on_adjust_date_time_gsimple_action_activate_callback}, {"SetBackground", _editing_host_page_on_set_background_gsimple_action_activate_callback}, {"IncreaseSize", _editing_host_page_on_increase_size_gsimple_action_activate_callback}, {"DecreaseSize", _editing_host_page_on_decrease_size_gsimple_action_activate_callback}, {"ZoomFit", _editing_host_page_snap_zoom_to_min_gsimple_action_activate_callback}, {"Zoom100", _editing_host_page_snap_zoom_to_isomorphic_gsimple_action_activate_callback}, {"Zoom200", _editing_host_page_snap_zoom_to_max_gsimple_action_activate_callback}};

static inline gpointer
direct_photo_page_get_instance_private (DirectPhotoPage* self)
{
	return G_STRUCT_MEMBER_P (self, DirectPhotoPage_private_offset);
}

static void
_direct_photo_page_on_photos_altered_data_collection_items_altered (DataCollection* _sender,
                                                                    GeeMap* items,
                                                                    gpointer self)
{
	direct_photo_page_on_photos_altered ((DirectPhotoPage*) self, items);
}

static void
_direct_photo_page_on_save_gsimple_action_activate_callback (GSimpleAction* action,
                                                             GVariant* parameter,
                                                             gpointer self)
{
	direct_photo_page_on_save ((DirectPhotoPage*) self);
}

static void
_direct_photo_page_on_save_as_gsimple_action_activate_callback (GSimpleAction* action,
                                                                GVariant* parameter,
                                                                gpointer self)
{
	direct_photo_page_on_save_as ((DirectPhotoPage*) self);
}

static void
_direct_photo_page_on_send_to_gsimple_action_activate_callback (GSimpleAction* action,
                                                                GVariant* parameter,
                                                                gpointer self)
{
	direct_photo_page_on_send_to ((DirectPhotoPage*) self);
}

static void
_direct_photo_page_on_print_gsimple_action_activate_callback (GSimpleAction* action,
                                                              GVariant* parameter,
                                                              gpointer self)
{
	direct_photo_page_on_print ((DirectPhotoPage*) self);
}

static void
_single_photo_page_on_previous_photo_gsimple_action_activate_callback (GSimpleAction* action,
                                                                       GVariant* parameter,
                                                                       gpointer self)
{
	single_photo_page_on_previous_photo ((SinglePhotoPage*) self);
}

static void
_single_photo_page_on_next_photo_gsimple_action_activate_callback (GSimpleAction* action,
                                                                   GVariant* parameter,
                                                                   gpointer self)
{
	single_photo_page_on_next_photo ((SinglePhotoPage*) self);
}

static void
_editing_host_page_on_rotate_clockwise_gsimple_action_activate_callback (GSimpleAction* action,
                                                                         GVariant* parameter,
                                                                         gpointer self)
{
	editing_host_page_on_rotate_clockwise ((EditingHostPage*) self);
}

static void
_editing_host_page_on_rotate_counterclockwise_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                GVariant* parameter,
                                                                                gpointer self)
{
	editing_host_page_on_rotate_counterclockwise ((EditingHostPage*) self);
}

static void
_editing_host_page_on_flip_horizontally_gsimple_action_activate_callback (GSimpleAction* action,
                                                                          GVariant* parameter,
                                                                          gpointer self)
{
	editing_host_page_on_flip_horizontally ((EditingHostPage*) self);
}

static void
_editing_host_page_on_flip_vertically_gsimple_action_activate_callback (GSimpleAction* action,
                                                                        GVariant* parameter,
                                                                        gpointer self)
{
	editing_host_page_on_flip_vertically ((EditingHostPage*) self);
}

static void
_editing_host_page_on_enhance_gsimple_action_activate_callback (GSimpleAction* action,
                                                                GVariant* parameter,
                                                                gpointer self)
{
	editing_host_page_on_enhance ((EditingHostPage*) self);
}

static void
_editing_host_page_toggle_crop_gsimple_action_activate_callback (GSimpleAction* action,
                                                                 GVariant* parameter,
                                                                 gpointer self)
{
	editing_host_page_toggle_crop ((EditingHostPage*) self);
}

static void
_editing_host_page_toggle_straighten_gsimple_action_activate_callback (GSimpleAction* action,
                                                                       GVariant* parameter,
                                                                       gpointer self)
{
	editing_host_page_toggle_straighten ((EditingHostPage*) self);
}

static void
_editing_host_page_toggle_redeye_gsimple_action_activate_callback (GSimpleAction* action,
                                                                   GVariant* parameter,
                                                                   gpointer self)
{
	editing_host_page_toggle_redeye ((EditingHostPage*) self);
}

static void
_editing_host_page_toggle_adjust_gsimple_action_activate_callback (GSimpleAction* action,
                                                                   GVariant* parameter,
                                                                   gpointer self)
{
	editing_host_page_toggle_adjust ((EditingHostPage*) self);
}

static void
_editing_host_page_on_revert_gsimple_action_activate_callback (GSimpleAction* action,
                                                               GVariant* parameter,
                                                               gpointer self)
{
	editing_host_page_on_revert ((EditingHostPage*) self);
}

static void
_editing_host_page_on_adjust_date_time_gsimple_action_activate_callback (GSimpleAction* action,
                                                                         GVariant* parameter,
                                                                         gpointer self)
{
	editing_host_page_on_adjust_date_time ((EditingHostPage*) self);
}

static void
_editing_host_page_on_set_background_gsimple_action_activate_callback (GSimpleAction* action,
                                                                       GVariant* parameter,
                                                                       gpointer self)
{
	editing_host_page_on_set_background ((EditingHostPage*) self);
}

static void
_editing_host_page_on_increase_size_gsimple_action_activate_callback (GSimpleAction* action,
                                                                      GVariant* parameter,
                                                                      gpointer self)
{
	editing_host_page_on_increase_size ((EditingHostPage*) self);
}

static void
_editing_host_page_on_decrease_size_gsimple_action_activate_callback (GSimpleAction* action,
                                                                      GVariant* parameter,
                                                                      gpointer self)
{
	editing_host_page_on_decrease_size ((EditingHostPage*) self);
}

static void
_editing_host_page_snap_zoom_to_min_gsimple_action_activate_callback (GSimpleAction* action,
                                                                      GVariant* parameter,
                                                                      gpointer self)
{
	editing_host_page_snap_zoom_to_min ((EditingHostPage*) self);
}

static void
_editing_host_page_snap_zoom_to_isomorphic_gsimple_action_activate_callback (GSimpleAction* action,
                                                                             GVariant* parameter,
                                                                             gpointer self)
{
	editing_host_page_snap_zoom_to_isomorphic ((EditingHostPage*) self);
}

static void
_editing_host_page_snap_zoom_to_max_gsimple_action_activate_callback (GSimpleAction* action,
                                                                      GVariant* parameter,
                                                                      gpointer self)
{
	editing_host_page_snap_zoom_to_max ((EditingHostPage*) self);
}

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

static void
_direct_photo_page_on_selection_group_altered_view_collection_selection_group_altered (ViewCollection* _sender,
                                                                                       gpointer self)
{
	direct_photo_page_on_selection_group_altered ((DirectPhotoPage*) self);
}

DirectPhotoPage*
direct_photo_page_construct (GType object_type,
                             GFile* file)
{
	DirectPhotoPage * self = NULL;
	DirectPhotoSourceCollection* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GFile* _tmp5_;
	DirectViewCollection* _tmp6_;
	GFile* _tmp7_;
	DirectPhotoSourceCollection* _tmp8_;
	ViewCollection* _tmp9_;
	ViewCollection* _tmp10_;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()), NULL);
	_tmp0_ = direct_photo_global;
	_tmp1_ = g_file_get_basename (file);
	_tmp2_ = _tmp1_;
	self = (DirectPhotoPage*) editing_host_page_construct (object_type, G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_SOURCE_COLLECTION, SourceCollection), _tmp2_);
	_g_free0 (_tmp2_);
	if (!direct_photo_page_check_editable_file (file)) {
		Application* _tmp3_;
		Application* _tmp4_;
		_tmp3_ = application_get_instance ();
		_tmp4_ = _tmp3_;
		application_panic (_tmp4_);
		_application_unref0 (_tmp4_);
		return self;
	}
	_tmp5_ = _g_object_ref0 (file);
	_g_object_unref0 (self->priv->initial_file);
	self->priv->initial_file = _tmp5_;
	_tmp6_ = direct_view_collection_new ();
	_data_collection_unref0 (self->priv->view_controller);
	self->priv->view_controller = _tmp6_;
	_tmp7_ = g_file_get_parent (file);
	_g_object_unref0 (self->priv->current_save_dir);
	self->priv->current_save_dir = _tmp7_;
	_tmp8_ = direct_photo_global;
	g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, TYPE_DATA_COLLECTION, DataCollection), "items-altered", (GCallback) _direct_photo_page_on_photos_altered_data_collection_items_altered, self, 0);
	_tmp9_ = page_get_view (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
	_tmp10_ = _tmp9_;
	g_signal_connect_object (_tmp10_, "selection-group-altered", (GCallback) _direct_photo_page_on_selection_group_altered_view_collection_selection_group_altered, self, 0);
	_data_collection_unref0 (_tmp10_);
	return self;
}

DirectPhotoPage*
direct_photo_page_new (GFile* file)
{
	return direct_photo_page_construct (TYPE_DIRECT_PHOTO_PAGE, file);
}

static void
direct_photo_page_real_init_collect_ui_filenames (Page* base,
                                                  GeeList* ui_filenames)
{
	DirectPhotoPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (ui_filenames, GEE_TYPE_LIST));
	PAGE_CLASS (direct_photo_page_parent_class)->init_collect_ui_filenames (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), TYPE_PAGE, Page), ui_filenames);
	gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (ui_filenames, GEE_TYPE_COLLECTION, GeeCollection), "direct_context.ui");
	gee_collection_add (G_TYPE_CHECK_INSTANCE_CAST (ui_filenames, GEE_TYPE_COLLECTION, GeeCollection), "direct.ui");
}

static void
direct_photo_page_real_add_actions (Page* base,
                                    GActionMap* map)
{
	DirectPhotoPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (map, g_action_map_get_type ()));
	PAGE_CLASS (direct_photo_page_parent_class)->add_actions (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), TYPE_PAGE, Page), map);
	g_action_map_add_action_entries (map, DIRECT_PHOTO_PAGE_entries, (gint) G_N_ELEMENTS (DIRECT_PHOTO_PAGE_entries), self);
}

static void
direct_photo_page_real_remove_actions (Page* base,
                                       GActionMap* map)
{
	DirectPhotoPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (map, g_action_map_get_type ()));
	PAGE_CLASS (direct_photo_page_parent_class)->remove_actions (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), TYPE_PAGE, Page), map);
	{
		GActionEntry* entry_collection = NULL;
		gint entry_collection_length1 = 0;
		gint _entry_collection_size_ = 0;
		gint entry_it = 0;
		entry_collection = DIRECT_PHOTO_PAGE_entries;
		entry_collection_length1 = G_N_ELEMENTS (DIRECT_PHOTO_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 gpointer
_injection_group_ref0 (gpointer self)
{
	return self ? injection_group_ref (self) : NULL;
}

static void
_vala_array_add61 (InjectionGroup** * array,
                   gint* length,
                   gint* size,
                   InjectionGroup* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (InjectionGroup*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add62 (InjectionGroup** * array,
                   gint* length,
                   gint* size,
                   InjectionGroup* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (InjectionGroup*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static InjectionGroup**
direct_photo_page_real_init_collect_injection_groups (Page* base,
                                                      gint* result_length1)
{
	DirectPhotoPage * self;
	InjectionGroup** groups = NULL;
	gint _tmp0_ = 0;
	InjectionGroup** _tmp1_;
	gint groups_length1;
	gint _groups_size_;
	InjectionGroup* print_group = NULL;
	InjectionGroup* _tmp2_;
	InjectionGroup* _tmp3_;
	InjectionGroup* bg_group = NULL;
	InjectionGroup* _tmp4_;
	InjectionGroup* _tmp5_;
	InjectionGroup** _tmp6_;
	gint _tmp6__length1;
	InjectionGroup** result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	_tmp1_ = PAGE_CLASS (direct_photo_page_parent_class)->init_collect_injection_groups (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), TYPE_PAGE, Page), &_tmp0_);
	groups = _tmp1_;
	groups_length1 = _tmp0_;
	_groups_size_ = groups_length1;
	_tmp2_ = injection_group_new ("PrintPlaceholder");
	print_group = _tmp2_;
	injection_group_add_menu_item (print_group, _ ("_Print"), "Print", "<Primary>p");
	_tmp3_ = _injection_group_ref0 (print_group);
	_vala_array_add61 (&groups, &groups_length1, &_groups_size_, _tmp3_);
	_tmp4_ = injection_group_new ("SetBackgroundPlaceholder");
	bg_group = _tmp4_;
	injection_group_add_menu_item (bg_group, _ ("Set as _Desktop Background"), "SetBackground", "<Primary>b");
	_tmp5_ = _injection_group_ref0 (bg_group);
	_vala_array_add62 (&groups, &groups_length1, &_groups_size_, _tmp5_);
	_tmp6_ = groups;
	_tmp6__length1 = groups_length1;
	if (result_length1) {
		*result_length1 = _tmp6__length1;
	}
	result = _tmp6_;
	_injection_group_unref0 (bg_group);
	_injection_group_unref0 (print_group);
	return result;
}

static gboolean
direct_photo_page_check_editable_file (GFile* file)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()), FALSE);
	_tmp0_ = g_file_get_path (file);
	_tmp1_ = _tmp0_;
	_tmp2_ = !g_file_test (_tmp1_, G_FILE_TEST_EXISTS);
	_g_free0 (_tmp1_);
	if (_tmp2_) {
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp3_ = g_file_get_path (file);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strdup_printf (_ ("%s does not exist."), _tmp4_);
		_tmp6_ = _tmp5_;
		app_window_error_message (_tmp6_, NULL);
		_g_free0 (_tmp6_);
		_g_free0 (_tmp4_);
	} else {
		gchar* _tmp7_;
		gchar* _tmp8_;
		gboolean _tmp9_;
		_tmp7_ = g_file_get_path (file);
		_tmp8_ = _tmp7_;
		_tmp9_ = !g_file_test (_tmp8_, G_FILE_TEST_IS_REGULAR);
		_g_free0 (_tmp8_);
		if (_tmp9_) {
			gchar* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			_tmp10_ = g_file_get_path (file);
			_tmp11_ = _tmp10_;
			_tmp12_ = g_strdup_printf (_ ("%s is not a file."), _tmp11_);
			_tmp13_ = _tmp12_;
			app_window_error_message (_tmp13_, NULL);
			_g_free0 (_tmp13_);
			_g_free0 (_tmp11_);
		} else {
			if (!photo_file_format_is_file_supported (file)) {
				gchar* _tmp14_;
				gchar* _tmp15_;
				gchar* _tmp16_;
				gchar* _tmp17_;
				_tmp14_ = g_file_get_path (file);
				_tmp15_ = _tmp14_;
				_tmp16_ = g_strdup_printf (_ ("%s does not support the file format of\n%s."), RESOURCES_APP_TITLE, _tmp15_);
				_tmp17_ = _tmp16_;
				app_window_error_message (_tmp17_, NULL);
				_g_free0 (_tmp17_);
				_g_free0 (_tmp15_);
			} else {
				result = TRUE;
				return result;
			}
		}
	}
	result = FALSE;
	return result;
}

static void
direct_photo_page_real_realize (GtkWidget* base)
{
	DirectPhotoPage * self;
	DirectPhoto* photo = NULL;
	DirectPhotoSourceCollection* _tmp0_;
	GFile* _tmp1_;
	DirectPhoto* _tmp2_;
	DirectPhoto* _tmp3_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	if (GTK_WIDGET_CLASS (direct_photo_page_parent_class)->realize != NULL) {
		GTK_WIDGET_CLASS (direct_photo_page_parent_class)->realize (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), gtk_widget_get_type (), GtkWidget));
	}
	_tmp0_ = direct_photo_global;
	_tmp1_ = self->priv->initial_file;
	_tmp2_ = direct_photo_source_collection_get_file_source (_tmp0_, _tmp1_);
	photo = _tmp2_;
	_tmp3_ = photo;
	if (_tmp3_ != NULL) {
		DirectViewCollection* _tmp4_;
		DirectPhoto* _tmp5_;
		_tmp4_ = self->priv->view_controller;
		_tmp5_ = photo;
		editing_host_page_display_mirror_of (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, TYPE_VIEW_COLLECTION, ViewCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, TYPE_PHOTO, Photo));
	} else {
		GFile* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp6_ = self->priv->initial_file;
		_tmp7_ = g_file_get_path (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_strdup_printf (_ ("Unable open photo %s. Sorry."), _tmp8_);
		_tmp10_ = _tmp9_;
		app_window_panic (_tmp10_);
		_g_free0 (_tmp10_);
		_g_free0 (_tmp8_);
	}
	_g_object_unref0 (self->priv->initial_file);
	self->priv->initial_file = NULL;
	_g_object_unref0 (photo);
}

static void
_direct_photo_page_on_dphoto_can_rotate_changed_direct_photo_can_rotate_changed (DirectPhoto* _sender,
                                                                                 gboolean b,
                                                                                 gpointer self)
{
	direct_photo_page_on_dphoto_can_rotate_changed ((DirectPhotoPage*) self, b);
}

static void
direct_photo_page_real_photo_changing (EditingHostPage* base,
                                       Photo* new_photo)
{
	DirectPhotoPage * self;
	Photo* _tmp0_;
	Photo* _tmp1_;
	gboolean _tmp2_;
	DirectPhoto* tmp = NULL;
	DirectPhoto* _tmp8_;
	DirectPhoto* _tmp9_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	g_return_if_fail (IS_PHOTO (new_photo));
	_tmp0_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_ != NULL;
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		DirectPhoto* tmp = NULL;
		Photo* _tmp3_;
		DirectPhoto* _tmp4_;
		DirectPhoto* _tmp5_;
		_tmp3_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		_tmp4_ = IS_DIRECT_PHOTO (_tmp3_) ? ((DirectPhoto*) _tmp3_) : NULL;
		if (_tmp4_ == NULL) {
			_g_object_unref0 (_tmp3_);
		}
		tmp = _tmp4_;
		_tmp5_ = tmp;
		if (_tmp5_ != NULL) {
			DirectPhoto* _tmp6_;
			guint _tmp7_;
			_tmp6_ = tmp;
			g_signal_parse_name ("can-rotate-changed", TYPE_DIRECT_PHOTO, &_tmp7_, NULL, FALSE);
			g_signal_handlers_disconnect_matched (_tmp6_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, 0, NULL, (GCallback) _direct_photo_page_on_dphoto_can_rotate_changed_direct_photo_can_rotate_changed, self);
		}
		_g_object_unref0 (tmp);
	}
	direct_photo_demand_load (G_TYPE_CHECK_INSTANCE_CAST (new_photo, TYPE_DIRECT_PHOTO, DirectPhoto));
	_tmp8_ = _g_object_ref0 (IS_DIRECT_PHOTO (new_photo) ? ((DirectPhoto*) new_photo) : NULL);
	tmp = _tmp8_;
	_tmp9_ = tmp;
	if (_tmp9_ != NULL) {
		DirectPhoto* _tmp10_;
		_tmp10_ = tmp;
		g_signal_connect_object (_tmp10_, "can-rotate-changed", (GCallback) _direct_photo_page_on_dphoto_can_rotate_changed_direct_photo_can_rotate_changed, self, 0);
	}
	_g_object_unref0 (tmp);
}

GFile*
direct_photo_page_get_current_file (DirectPhotoPage* self)
{
	Photo* _tmp0_;
	Photo* _tmp1_;
	GFile* _tmp2_;
	GFile* _tmp3_;
	GFile* result;
	g_return_val_if_fail (IS_DIRECT_PHOTO_PAGE (self), NULL);
	_tmp0_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	_tmp1_ = _tmp0_;
	_tmp2_ = media_source_get_file (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_MEDIA_SOURCE, MediaSource));
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static gboolean
direct_photo_page_real_on_context_buttonpress (Page* base,
                                               GdkEventButton* event)
{
	DirectPhotoPage * self;
	GtkMenu* _tmp0_;
	GtkMenu* _tmp1_;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = direct_photo_page_get_context_menu (self);
	_tmp1_ = _tmp0_;
	page_popup_context_menu (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), _tmp1_, event);
	_g_object_unref0 (_tmp1_);
	result = TRUE;
	return result;
}

static GtkMenu*
direct_photo_page_get_context_menu (DirectPhotoPage* self)
{
	GtkMenu* _tmp0_;
	GtkMenu* _tmp7_;
	GtkMenu* _tmp8_;
	GtkMenu* result;
	g_return_val_if_fail (IS_DIRECT_PHOTO_PAGE (self), NULL);
	_tmp0_ = self->priv->context_menu;
	if (_tmp0_ == NULL) {
		GMenuModel* model = NULL;
		GtkBuilder* _tmp1_;
		GObject* _tmp2_;
		GMenuModel* _tmp3_;
		GMenuModel* _tmp4_;
		GtkMenu* _tmp5_;
		GtkMenu* _tmp6_;
		_tmp1_ = G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page)->builder;
		_tmp2_ = gtk_builder_get_object (_tmp1_, "DirectContextMenu");
		_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, g_menu_model_get_type ()) ? ((GMenuModel*) _tmp2_) : NULL);
		model = _tmp3_;
		_tmp4_ = model;
		_tmp5_ = (GtkMenu*) gtk_menu_new_from_model (_tmp4_);
		g_object_ref_sink (_tmp5_);
		_g_object_unref0 (self->priv->context_menu);
		self->priv->context_menu = _tmp5_;
		_tmp6_ = self->priv->context_menu;
		gtk_menu_attach_to_widget (_tmp6_, G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), NULL);
		_g_object_unref0 (model);
	}
	_tmp7_ = self->priv->context_menu;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	result = _tmp8_;
	return result;
}

static void
direct_photo_page_update_zoom_menu_item_sensitivity (DirectPhotoPage* self)
{
	gboolean _tmp0_ = FALSE;
	ZoomState _tmp1_ = {0};
	gboolean _tmp2_ = FALSE;
	ZoomState _tmp3_ = {0};
	g_return_if_fail (IS_DIRECT_PHOTO_PAGE (self));
	single_photo_page_get_zoom_state (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SINGLE_PHOTO_PAGE, SinglePhotoPage), &_tmp1_);
	if (!zoom_state_is_max (&_tmp1_)) {
		_tmp0_ = !editing_host_page_get_photo_missing (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	} else {
		_tmp0_ = FALSE;
	}
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "IncreaseSize", _tmp0_);
	single_photo_page_get_zoom_state (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SINGLE_PHOTO_PAGE, SinglePhotoPage), &_tmp3_);
	if (!zoom_state_is_default (&_tmp3_)) {
		_tmp2_ = !editing_host_page_get_photo_missing (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	} else {
		_tmp2_ = FALSE;
	}
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "DecreaseSize", _tmp2_);
}

static void
direct_photo_page_real_on_increase_size (EditingHostPage* base)
{
	DirectPhotoPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	EDITING_HOST_PAGE_CLASS (direct_photo_page_parent_class)->on_increase_size (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	direct_photo_page_update_zoom_menu_item_sensitivity (self);
}

static void
direct_photo_page_real_on_decrease_size (EditingHostPage* base)
{
	DirectPhotoPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	EDITING_HOST_PAGE_CLASS (direct_photo_page_parent_class)->on_decrease_size (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	direct_photo_page_update_zoom_menu_item_sensitivity (self);
}

static void
direct_photo_page_on_photos_altered (DirectPhotoPage* self,
                                     GeeMap* map)
{
	gboolean contains = FALSE;
	gboolean _tmp11_ = FALSE;
	gboolean sensitive = FALSE;
	gboolean _tmp12_ = FALSE;
	g_return_if_fail (IS_DIRECT_PHOTO_PAGE (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (map, GEE_TYPE_MAP));
	contains = FALSE;
	if (editing_host_page_has_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage))) {
		Photo* photo = NULL;
		Photo* _tmp0_;
		_tmp0_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		photo = _tmp0_;
		{
			GeeIterator* _object_it = NULL;
			GeeSet* _tmp1_;
			GeeSet* _tmp2_;
			GeeSet* _tmp3_;
			GeeIterator* _tmp4_;
			GeeIterator* _tmp5_;
			_tmp1_ = gee_map_get_keys (map);
			_tmp2_ = _tmp1_;
			_tmp3_ = _tmp2_;
			_tmp4_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GEE_TYPE_ITERABLE, GeeIterable));
			_tmp5_ = _tmp4_;
			_g_object_unref0 (_tmp3_);
			_object_it = _tmp5_;
			while (TRUE) {
				GeeIterator* _tmp6_;
				DataObject* object = NULL;
				GeeIterator* _tmp7_;
				gpointer _tmp8_;
				DataObject* _tmp9_;
				Photo* _tmp10_;
				_tmp6_ = _object_it;
				if (!gee_iterator_next (_tmp6_)) {
					break;
				}
				_tmp7_ = _object_it;
				_tmp8_ = gee_iterator_get (_tmp7_);
				object = (DataObject*) _tmp8_;
				_tmp9_ = object;
				_tmp10_ = photo;
				if (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, TYPE_PHOTO, Photo) == _tmp10_) {
					contains = TRUE;
					_g_object_unref0 (object);
					break;
				}
				_g_object_unref0 (object);
			}
			_g_object_unref0 (_object_it);
		}
		_g_object_unref0 (photo);
	}
	if (editing_host_page_has_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage))) {
		_tmp11_ = !editing_host_page_get_photo_missing (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	} else {
		_tmp11_ = FALSE;
	}
	sensitive = _tmp11_;
	if (sensitive) {
		sensitive = contains;
	}
	if (sensitive) {
		Photo* _tmp13_;
		Photo* _tmp14_;
		_tmp13_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		_tmp14_ = _tmp13_;
		_tmp12_ = photo_file_format_can_write (photo_get_file_format (_tmp14_));
		_g_object_unref0 (_tmp14_);
	} else {
		_tmp12_ = FALSE;
	}
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Save", _tmp12_);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Revert", sensitive);
}

static void
direct_photo_page_on_selection_group_altered (DirectPhotoPage* self)
{
	CommandManager* _tmp0_;
	CommandManager* _tmp1_;
	g_return_if_fail (IS_DIRECT_PHOTO_PAGE (self));
	_tmp0_ = page_get_command_manager (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
	_tmp1_ = _tmp0_;
	command_manager_reset (_tmp1_);
	_command_manager_unref0 (_tmp1_);
}

static gboolean
direct_photo_page_real_on_double_click (EditingHostPage* base,
                                        GdkEventButton* event)
{
	DirectPhotoPage * self;
	FullscreenWindow* fs = NULL;
	GtkWindow* _tmp0_;
	FullscreenWindow* _tmp1_;
	FullscreenWindow* _tmp2_;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = page_get_container (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
	_tmp1_ = IS_FULLSCREEN_WINDOW (_tmp0_) ? ((FullscreenWindow*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	fs = _tmp1_;
	_tmp2_ = fs;
	if (_tmp2_ != NULL) {
		FullscreenWindow* _tmp3_;
		_tmp3_ = fs;
		fullscreen_window_close (_tmp3_);
		result = TRUE;
		_g_object_unref0 (fs);
		return result;
	} else {
		DirectWindow* direct_window = NULL;
		GtkWindow* _tmp4_;
		DirectWindow* _tmp5_;
		DirectWindow* _tmp6_;
		_tmp4_ = page_get_container (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
		_tmp5_ = IS_DIRECT_WINDOW (_tmp4_) ? ((DirectWindow*) _tmp4_) : NULL;
		if (_tmp5_ == NULL) {
			_g_object_unref0 (_tmp4_);
		}
		direct_window = _tmp5_;
		_tmp6_ = direct_window;
		if (_tmp6_ != NULL) {
			DirectWindow* _tmp7_;
			_tmp7_ = direct_window;
			direct_window_do_fullscreen (_tmp7_);
			result = TRUE;
			_g_object_unref0 (direct_window);
			_g_object_unref0 (fs);
			return result;
		}
		_g_object_unref0 (direct_window);
	}
	result = EDITING_HOST_PAGE_CLASS (direct_photo_page_parent_class)->on_double_click (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), event);
	_g_object_unref0 (fs);
	return result;
}

static void
direct_photo_page_real_update_ui (EditingHostPage* base,
                                  gboolean missing)
{
	DirectPhotoPage * self;
	gboolean sensitivity = FALSE;
	gboolean _tmp0_ = FALSE;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	sensitivity = !missing;
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Save", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "SaveAs", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "SendTo", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Publish", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Print", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "CommonJumpToFile", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "CommonUndo", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "CommonRedo", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "IncreaseSize", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "DecreaseSize", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "ZoomFit", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Zoom100", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Zoom200", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "RotateClockwise", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "RotateCounterclockwise", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "FlipHorizontally", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "FlipVertically", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Enhance", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Crop", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Straighten", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "RedEye", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Adjust", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Revert", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "AdjustDateTime", sensitivity);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Fullscreen", sensitivity);
	if (editing_host_page_has_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage))) {
		_tmp0_ = !editing_host_page_get_photo_missing (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	} else {
		_tmp0_ = FALSE;
	}
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "SetBackground", _tmp0_);
	EDITING_HOST_PAGE_CLASS (direct_photo_page_parent_class)->update_ui (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), missing);
}

static void
direct_photo_page_real_update_actions (Page* base,
                                       gint selected_count,
                                       gint count)
{
	DirectPhotoPage * self;
	gboolean multiple = FALSE;
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean revert_possible = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean rotate_possible = FALSE;
	gboolean _tmp11_ = FALSE;
	gboolean enhance_possible = FALSE;
	Photo* _tmp20_;
	Photo* _tmp21_;
	gboolean _tmp22_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	_tmp0_ = page_get_view (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
	_tmp1_ = _tmp0_;
	_tmp2_ = data_collection_get_count (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, TYPE_DATA_COLLECTION, DataCollection)) > 1;
	_data_collection_unref0 (_tmp1_);
	multiple = _tmp2_;
	if (editing_host_page_has_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage))) {
		gboolean _tmp4_ = FALSE;
		Photo* _tmp5_;
		Photo* _tmp6_;
		gboolean _tmp7_;
		_tmp5_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		_tmp6_ = _tmp5_;
		_tmp7_ = photo_has_transformations (_tmp6_);
		_g_object_unref0 (_tmp6_);
		if (_tmp7_) {
			_tmp4_ = !editing_host_page_get_photo_missing (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		} else {
			_tmp4_ = FALSE;
		}
		_tmp3_ = _tmp4_;
	} else {
		_tmp3_ = FALSE;
	}
	revert_possible = _tmp3_;
	if (editing_host_page_has_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage))) {
		Photo* _tmp9_;
		Photo* _tmp10_;
		_tmp9_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		_tmp10_ = _tmp9_;
		_tmp8_ = editing_host_page_is_rotate_available (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), _tmp10_);
		_g_object_unref0 (_tmp10_);
	} else {
		_tmp8_ = FALSE;
	}
	rotate_possible = _tmp8_;
	if (editing_host_page_has_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage))) {
		Photo* _tmp12_;
		Photo* _tmp13_;
		_tmp12_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		_tmp13_ = _tmp12_;
		_tmp11_ = editing_host_page_is_enhance_available (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), _tmp13_);
		_g_object_unref0 (_tmp13_);
	} else {
		_tmp11_ = FALSE;
	}
	enhance_possible = _tmp11_;
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "PrevPhoto", multiple);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "NextPhoto", multiple);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "RotateClockwise", rotate_possible);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "RotateCounterclockwise", rotate_possible);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "FlipHorizontally", rotate_possible);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "FlipVertically", rotate_possible);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Revert", revert_possible);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Enhance", enhance_possible);
	page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "SetBackground", editing_host_page_has_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage)));
	if (editing_host_page_has_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage))) {
		Photo* _tmp14_;
		Photo* _tmp15_;
		Scaling _tmp16_ = {0};
		Photo* _tmp17_;
		Photo* _tmp18_;
		Scaling _tmp19_ = {0};
		_tmp14_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		_tmp15_ = _tmp14_;
		scaling_for_original (&_tmp16_);
		page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "Crop", editing_tools_crop_tool_is_available (_tmp15_, &_tmp16_));
		_g_object_unref0 (_tmp15_);
		_tmp17_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		_tmp18_ = _tmp17_;
		scaling_for_original (&_tmp19_);
		page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "RedEye", editing_tools_redeye_tool_is_available (_tmp18_, &_tmp19_));
		_g_object_unref0 (_tmp18_);
	}
	_tmp20_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	_tmp21_ = _tmp20_;
	_tmp22_ = _tmp21_ != NULL;
	_g_object_unref0 (_tmp21_);
	if (_tmp22_) {
		Photo* _tmp23_;
		Photo* _tmp24_;
		_tmp23_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		_tmp24_ = _tmp23_;
		page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "AdjustDateTime", photo_get_file_format (_tmp24_) != PHOTO_FILE_FORMAT_RAW);
		_g_object_unref0 (_tmp24_);
	} else {
		page_set_action_sensitive (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "AdjustDateTime", FALSE);
	}
	PAGE_CLASS (direct_photo_page_parent_class)->update_actions (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), TYPE_PAGE, Page), selected_count, count);
}

static gboolean
direct_photo_page_check_ok_to_close_photo (DirectPhotoPage* self,
                                           Photo* photo,
                                           gboolean notify)
{
	gboolean is_writeable = FALSE;
	Photo* _tmp0_;
	Photo* _tmp1_;
	gboolean _tmp2_;
	const gchar* _tmp3_ = NULL;
	gchar* save_option = NULL;
	gchar* _tmp4_;
	GtkResponseType response = 0;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	GtkResponseType _tmp10_;
	gboolean result;
	g_return_val_if_fail (IS_DIRECT_PHOTO_PAGE (self), FALSE);
	g_return_val_if_fail ((photo == NULL) || IS_PHOTO (photo), FALSE);
	if (photo == NULL) {
		result = TRUE;
		return result;
	}
	if (!photo_has_alterations (photo)) {
		result = TRUE;
		return result;
	}
	if (self->priv->drop_if_dirty) {
		photo_remove_all_transformations (photo, notify);
		result = TRUE;
		return result;
	}
	_tmp0_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	_tmp1_ = _tmp0_;
	_tmp2_ = photo_file_format_can_write (photo_get_file_format (_tmp1_));
	_g_object_unref0 (_tmp1_);
	is_writeable = _tmp2_;
	if (is_writeable) {
		_tmp3_ = _ ("_Save");
	} else {
		_tmp3_ = _ ("_Save a Copy");
	}
	_tmp4_ = g_strdup (_tmp3_);
	save_option = _tmp4_;
	_tmp5_ = media_source_get_basename (G_TYPE_CHECK_INSTANCE_CAST (photo, TYPE_MEDIA_SOURCE, MediaSource));
	_tmp6_ = _tmp5_;
	_tmp7_ = g_strdup_printf (_ ("Lose changes to %s?"), _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = save_option;
	_tmp10_ = app_window_negate_affirm_cancel_question (_tmp8_, _tmp9_, _ ("Close _without Saving"), NULL, NULL);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
	response = _tmp10_;
	if (response == GTK_RESPONSE_YES) {
		photo_remove_all_transformations (photo, notify);
	} else {
		if (response == GTK_RESPONSE_NO) {
			if (is_writeable) {
				GFile* _tmp11_;
				GFile* _tmp12_;
				Photo* _tmp13_;
				Photo* _tmp14_;
				_tmp11_ = media_source_get_file (G_TYPE_CHECK_INSTANCE_CAST (photo, TYPE_MEDIA_SOURCE, MediaSource));
				_tmp12_ = _tmp11_;
				_tmp13_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
				_tmp14_ = _tmp13_;
				direct_photo_page_save (self, _tmp12_, 0, SCALE_CONSTRAINT_ORIGINAL, JPEG_QUALITY_HIGH, photo_get_file_format (_tmp14_), FALSE, TRUE);
				_g_object_unref0 (_tmp14_);
				_g_object_unref0 (_tmp12_);
			} else {
				direct_photo_page_on_save_as (self);
			}
		} else {
			gboolean _tmp15_ = FALSE;
			gboolean _tmp16_ = FALSE;
			if (response == GTK_RESPONSE_CANCEL) {
				_tmp16_ = TRUE;
			} else {
				_tmp16_ = response == GTK_RESPONSE_DELETE_EVENT;
			}
			if (_tmp16_) {
				_tmp15_ = TRUE;
			} else {
				_tmp15_ = response == GTK_RESPONSE_CLOSE;
			}
			if (_tmp15_) {
				self->priv->in_shutdown = FALSE;
				result = FALSE;
				_g_free0 (save_option);
				return result;
			}
		}
	}
	result = TRUE;
	_g_free0 (save_option);
	return result;
}

gboolean
direct_photo_page_check_quit (DirectPhotoPage* self)
{
	Photo* _tmp0_;
	Photo* _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	g_return_val_if_fail (IS_DIRECT_PHOTO_PAGE (self), FALSE);
	self->priv->in_shutdown = TRUE;
	_tmp0_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	_tmp1_ = _tmp0_;
	_tmp2_ = direct_photo_page_check_ok_to_close_photo (self, _tmp1_, FALSE);
	_g_object_unref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

static gboolean
direct_photo_page_real_confirm_replace_photo (EditingHostPage* base,
                                              Photo* old_photo,
                                              Photo* new_photo)
{
	DirectPhotoPage * self;
	gboolean _tmp0_ = FALSE;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	g_return_val_if_fail ((old_photo == NULL) || IS_PHOTO (old_photo), FALSE);
	g_return_val_if_fail (IS_PHOTO (new_photo), FALSE);
	if (old_photo != NULL) {
		_tmp0_ = direct_photo_page_check_ok_to_close_photo (self, old_photo, TRUE);
	} else {
		_tmp0_ = TRUE;
	}
	result = _tmp0_;
	return result;
}

static void
direct_photo_page_save (DirectPhotoPage* self,
                        GFile* dest,
                        gint scale,
                        ScaleConstraint constraint,
                        JpegQuality quality,
                        PhotoFileFormat format,
                        gboolean copy_unmodified,
                        gboolean save_metadata)
{
	Scaling scaling = {0};
	Scaling _tmp0_ = {0};
	DirectPhoto* photo = NULL;
	DirectPhotoSourceCollection* _tmp10_;
	DirectPhoto* _tmp11_ = NULL;
	gchar* _tmp12_;
	gchar* _tmp13_;
	Photo* _tmp14_;
	Photo* _tmp15_;
	DirectPhoto* _tmp16_;
	gboolean _tmp17_;
	DirectPhotoSourceCollection* _tmp22_;
	DirectPhoto* _tmp23_;
	DirectViewCollection* _tmp24_;
	DirectPhoto* _tmp25_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (IS_DIRECT_PHOTO_PAGE (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (dest, g_file_get_type ()));
	scaling_for_constraint (constraint, scale, FALSE, &_tmp0_);
	scaling = _tmp0_;
	{
		Photo* _tmp1_;
		Photo* _tmp2_;
		Scaling _tmp3_;
		_tmp1_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		_tmp2_ = _tmp1_;
		_tmp3_ = scaling;
		photo_export (_tmp2_, dest, &_tmp3_, quality, format, copy_unmodified, save_metadata, &_inner_error0_);
		_g_object_unref0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		gchar* _tmp4_;
		gchar* _tmp5_;
		GError* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp4_ = g_file_get_path (dest);
		_tmp5_ = _tmp4_;
		_tmp6_ = err;
		_tmp7_ = _tmp6_->message;
		_tmp8_ = g_strdup_printf (_ ("Error while saving to %s: %s"), _tmp5_, _tmp7_);
		_tmp9_ = _tmp8_;
		app_window_error_message (_tmp9_, NULL);
		_g_free0 (_tmp9_);
		_g_free0 (_tmp5_);
		_g_error_free0 (err);
		return;
	}
	__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;
	}
	if (self->priv->in_shutdown) {
		return;
	}
	_tmp10_ = direct_photo_global;
	_tmp12_ = direct_photo_source_collection_fetch (_tmp10_, dest, &_tmp11_, TRUE);
	_g_object_unref0 (photo);
	photo = _tmp11_;
	_tmp13_ = _tmp12_;
	_g_free0 (_tmp13_);
	_tmp14_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	_tmp15_ = _tmp14_;
	_tmp16_ = photo;
	_tmp17_ = !data_source_equals (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, TYPE_DATA_SOURCE, DataSource), G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, TYPE_DATA_SOURCE, DataSource));
	_g_object_unref0 (_tmp15_);
	if (_tmp17_) {
		DirectView* tmp_view = NULL;
		DirectPhoto* _tmp18_;
		DirectView* _tmp19_;
		DirectViewCollection* _tmp20_;
		DirectView* _tmp21_;
		_tmp18_ = photo;
		_tmp19_ = direct_view_new (_tmp18_);
		tmp_view = _tmp19_;
		_tmp20_ = self->priv->view_controller;
		_tmp21_ = tmp_view;
		data_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, TYPE_DATA_COLLECTION, DataCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, TYPE_DATA_OBJECT, DataObject));
		_g_object_unref0 (tmp_view);
	}
	_tmp22_ = direct_photo_global;
	_tmp23_ = photo;
	direct_photo_source_collection_reimport_photo (_tmp22_, _tmp23_);
	_tmp24_ = self->priv->view_controller;
	_tmp25_ = photo;
	editing_host_page_display_mirror_of (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, TYPE_VIEW_COLLECTION, ViewCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, TYPE_PHOTO, Photo));
	_g_object_unref0 (photo);
}

static void
direct_photo_page_on_save (DirectPhotoPage* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	Photo* _tmp2_;
	Photo* _tmp3_;
	gboolean _tmp4_;
	Photo* _tmp7_;
	Photo* _tmp8_;
	GFile* _tmp9_;
	GFile* _tmp10_;
	Photo* _tmp11_;
	Photo* _tmp12_;
	g_return_if_fail (IS_DIRECT_PHOTO_PAGE (self));
	_tmp2_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	_tmp3_ = _tmp2_;
	_tmp4_ = !photo_has_alterations (_tmp3_);
	_g_object_unref0 (_tmp3_);
	if (_tmp4_) {
		_tmp1_ = TRUE;
	} else {
		Photo* _tmp5_;
		Photo* _tmp6_;
		_tmp5_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
		_tmp6_ = _tmp5_;
		_tmp1_ = !photo_file_format_can_write (photo_get_file_format (_tmp6_));
		_g_object_unref0 (_tmp6_);
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = editing_host_page_get_photo_missing (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	}
	if (_tmp0_) {
		return;
	}
	_tmp7_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	_tmp8_ = _tmp7_;
	_tmp9_ = media_source_get_file (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, TYPE_MEDIA_SOURCE, MediaSource));
	_tmp10_ = _tmp9_;
	_tmp11_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	_tmp12_ = _tmp11_;
	direct_photo_page_save (self, _tmp10_, 0, SCALE_CONSTRAINT_ORIGINAL, JPEG_QUALITY_HIGH, photo_get_file_format (_tmp12_), FALSE, TRUE);
	_g_object_unref0 (_tmp12_);
	_g_object_unref0 (_tmp10_);
	_g_object_unref0 (_tmp8_);
}

static void
direct_photo_page_on_save_as (DirectPhotoPage* self)
{
	ExportDialog* export_dialog = NULL;
	ExportDialog* _tmp0_;
	gint scale = 0;
	ScaleConstraint constraint = 0;
	ExportFormatParameters export_params = {0};
	ExportFormatParameters _tmp1_ = {0};
	ExportDialog* _tmp2_;
	gint _tmp3_ = 0;
	ScaleConstraint _tmp4_ = 0;
	gboolean _tmp5_;
	gchar* filename = NULL;
	Photo* _tmp6_;
	Photo* _tmp7_;
	ExportFormatParameters _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	PhotoFileFormat effective_export_format = 0;
	Photo* _tmp11_;
	Photo* _tmp12_;
	ExportFormatParameters _tmp13_;
	PhotoFileFormat _tmp14_;
	gchar** output_format_extensions = NULL;
	PhotoFileFormatProperties* _tmp15_;
	PhotoFileFormatProperties* _tmp16_;
	gint _tmp17_ = 0;
	gchar** _tmp18_;
	gchar** _tmp19_;
	gint _tmp19__length1;
	gint output_format_extensions_length1;
	gint _output_format_extensions_size_;
	GtkFileFilter* output_format_filter = NULL;
	GtkFileFilter* _tmp20_;
	GtkFileFilter* _tmp21_;
	gchar** _tmp22_;
	gint _tmp22__length1;
	GtkFileFilter* all_files = NULL;
	GtkFileFilter* _tmp34_;
	GtkFileFilter* _tmp35_;
	GtkFileFilter* _tmp36_;
	GtkFileChooserNative* save_as_dialog = NULL;
	AppWindow* _tmp37_;
	AppWindow* _tmp38_;
	GtkFileChooserNative* _tmp39_;
	GtkFileChooserNative* _tmp40_;
	GtkFileChooserNative* _tmp41_;
	GtkFileChooserNative* _tmp42_;
	const gchar* _tmp43_;
	GtkFileChooserNative* _tmp44_;
	GFile* _tmp45_;
	gchar* _tmp46_;
	gchar* _tmp47_;
	GtkFileChooserNative* _tmp48_;
	GtkFileFilter* _tmp49_;
	GtkFileFilter* _tmp50_;
	GtkFileChooserNative* _tmp51_;
	GtkFileFilter* _tmp52_;
	GtkFileFilter* _tmp53_;
	GtkFileChooserNative* _tmp54_;
	GtkFileChooserNative* _tmp55_;
	gint response = 0;
	GtkFileChooserNative* _tmp56_;
	GtkFileChooserNative* _tmp69_;
	g_return_if_fail (IS_DIRECT_PHOTO_PAGE (self));
	_tmp0_ = export_dialog_new (_ ("Save As"));
	g_object_ref_sink (_tmp0_);
	export_dialog = _tmp0_;
	export_format_parameters_last (&_tmp1_);
	export_params = _tmp1_;
	_tmp2_ = export_dialog;
	_tmp5_ = export_dialog_execute (_tmp2_, &_tmp3_, &_tmp4_, &export_params);
	scale = _tmp3_;
	constraint = _tmp4_;
	if (!_tmp5_) {
		_g_object_unref0 (export_dialog);
		return;
	}
	_tmp6_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	_tmp7_ = _tmp6_;
	_tmp8_ = export_params;
	_tmp9_ = photo_get_export_basename_for_parameters (_tmp7_, &_tmp8_);
	_tmp10_ = _tmp9_;
	_g_object_unref0 (_tmp7_);
	filename = _tmp10_;
	_tmp11_ = editing_host_page_get_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage));
	_tmp12_ = _tmp11_;
	_tmp13_ = export_params;
	_tmp14_ = photo_get_export_format_for_parameters (_tmp12_, &_tmp13_);
	_g_object_unref0 (_tmp12_);
	effective_export_format = _tmp14_;
	_tmp15_ = photo_file_format_get_properties (effective_export_format);
	_tmp16_ = _tmp15_;
	_tmp18_ = photo_file_format_properties_get_known_extensions (_tmp16_, &_tmp17_);
	_tmp19_ = _tmp18_;
	_tmp19__length1 = _tmp17_;
	_photo_file_format_properties_unref0 (_tmp16_);
	output_format_extensions = _tmp19_;
	output_format_extensions_length1 = _tmp19__length1;
	_output_format_extensions_size_ = output_format_extensions_length1;
	_tmp20_ = gtk_file_filter_new ();
	g_object_ref_sink (_tmp20_);
	output_format_filter = _tmp20_;
	_tmp21_ = output_format_filter;
	gtk_file_filter_set_name (_tmp21_, _ ("Supported image formats"));
	_tmp22_ = output_format_extensions;
	_tmp22__length1 = output_format_extensions_length1;
	{
		gchar** extension_collection = NULL;
		gint extension_collection_length1 = 0;
		gint _extension_collection_size_ = 0;
		gint extension_it = 0;
		extension_collection = _tmp22_;
		extension_collection_length1 = _tmp22__length1;
		for (extension_it = 0; extension_it < extension_collection_length1; extension_it = extension_it + 1) {
			gchar* _tmp23_;
			gchar* extension = NULL;
			_tmp23_ = g_strdup (extension_collection[extension_it]);
			extension = _tmp23_;
			{
				gchar* uppercase_extension = NULL;
				const gchar* _tmp24_;
				gchar* _tmp25_;
				GtkFileFilter* _tmp26_;
				const gchar* _tmp27_;
				gchar* _tmp28_;
				gchar* _tmp29_;
				GtkFileFilter* _tmp30_;
				const gchar* _tmp31_;
				gchar* _tmp32_;
				gchar* _tmp33_;
				_tmp24_ = extension;
				_tmp25_ = g_utf8_strup (_tmp24_, (gssize) -1);
				uppercase_extension = _tmp25_;
				_tmp26_ = output_format_filter;
				_tmp27_ = extension;
				_tmp28_ = g_strconcat ("*.", _tmp27_, NULL);
				_tmp29_ = _tmp28_;
				gtk_file_filter_add_pattern (_tmp26_, _tmp29_);
				_g_free0 (_tmp29_);
				_tmp30_ = output_format_filter;
				_tmp31_ = uppercase_extension;
				_tmp32_ = g_strconcat ("*.", _tmp31_, NULL);
				_tmp33_ = _tmp32_;
				gtk_file_filter_add_pattern (_tmp30_, _tmp33_);
				_g_free0 (_tmp33_);
				_g_free0 (uppercase_extension);
				_g_free0 (extension);
			}
		}
	}
	_tmp34_ = gtk_file_filter_new ();
	g_object_ref_sink (_tmp34_);
	all_files = _tmp34_;
	_tmp35_ = all_files;
	gtk_file_filter_add_pattern (_tmp35_, "*");
	_tmp36_ = all_files;
	gtk_file_filter_set_name (_tmp36_, _ ("All files"));
	_tmp37_ = app_window_get_instance ();
	_tmp38_ = _tmp37_;
	_tmp39_ = gtk_file_chooser_native_new (_ ("Save As"), G_TYPE_CHECK_INSTANCE_CAST (_tmp38_, gtk_window_get_type (), GtkWindow), GTK_FILE_CHOOSER_ACTION_SAVE, RESOURCES_OK_LABEL, RESOURCES_CANCEL_LABEL);
	_tmp40_ = _tmp39_;
	_g_object_unref0 (_tmp38_);
	save_as_dialog = _tmp40_;
	_tmp41_ = save_as_dialog;
	gtk_file_chooser_set_select_multiple (G_TYPE_CHECK_INSTANCE_CAST (_tmp41_, gtk_file_chooser_get_type (), GtkFileChooser), FALSE);
	_tmp42_ = save_as_dialog;
	_tmp43_ = filename;
	gtk_file_chooser_set_current_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp42_, gtk_file_chooser_get_type (), GtkFileChooser), _tmp43_);
	_tmp44_ = save_as_dialog;
	_tmp45_ = self->priv->current_save_dir;
	_tmp46_ = g_file_get_path (_tmp45_);
	_tmp47_ = _tmp46_;
	gtk_file_chooser_set_current_folder (G_TYPE_CHECK_INSTANCE_CAST (_tmp44_, gtk_file_chooser_get_type (), GtkFileChooser), _tmp47_);
	_g_free0 (_tmp47_);
	_tmp48_ = save_as_dialog;
	_tmp49_ = output_format_filter;
	_tmp50_ = _g_object_ref0 (_tmp49_);
	gtk_file_chooser_add_filter (G_TYPE_CHECK_INSTANCE_CAST (_tmp48_, gtk_file_chooser_get_type (), GtkFileChooser), _tmp50_);
	_tmp51_ = save_as_dialog;
	_tmp52_ = all_files;
	_tmp53_ = _g_object_ref0 (_tmp52_);
	gtk_file_chooser_add_filter (G_TYPE_CHECK_INSTANCE_CAST (_tmp51_, gtk_file_chooser_get_type (), GtkFileChooser), _tmp53_);
	_tmp54_ = save_as_dialog;
	gtk_file_chooser_set_do_overwrite_confirmation (G_TYPE_CHECK_INSTANCE_CAST (_tmp54_, gtk_file_chooser_get_type (), GtkFileChooser), TRUE);
	_tmp55_ = save_as_dialog;
	gtk_file_chooser_set_local_only (G_TYPE_CHECK_INSTANCE_CAST (_tmp55_, gtk_file_chooser_get_type (), GtkFileChooser), FALSE);
	_tmp56_ = save_as_dialog;
	response = gtk_native_dialog_run (G_TYPE_CHECK_INSTANCE_CAST (_tmp56_, gtk_native_dialog_get_type (), GtkNativeDialog));
	if (response == ((gint) GTK_RESPONSE_ACCEPT)) {
		GtkFileChooserNative* _tmp57_;
		gchar* _tmp58_;
		gchar* _tmp59_;
		GFile* _tmp60_;
		GFile* _tmp61_;
		ExportFormatParameters _tmp62_;
		ExportFormatParameters _tmp63_;
		ExportFormatParameters _tmp64_;
		GtkFileChooserNative* _tmp65_;
		gchar* _tmp66_;
		gchar* _tmp67_;
		GFile* _tmp68_;
		self->priv->drop_if_dirty = TRUE;
		_tmp57_ = save_as_dialog;
		_tmp58_ = gtk_file_chooser_get_uri (G_TYPE_CHECK_INSTANCE_CAST (_tmp57_, gtk_file_chooser_get_type (), GtkFileChooser));
		_tmp59_ = _tmp58_;
		_tmp60_ = g_file_new_for_uri (_tmp59_);
		_tmp61_ = _tmp60_;
		_tmp62_ = export_params;
		_tmp63_ = export_params;
		_tmp64_ = export_params;
		direct_photo_page_save (self, _tmp61_, scale, constraint, _tmp62_.quality, effective_export_format, _tmp63_.mode == EXPORT_FORMAT_MODE_UNMODIFIED, _tmp64_.export_metadata);
		_g_object_unref0 (_tmp61_);
		_g_free0 (_tmp59_);
		self->priv->drop_if_dirty = FALSE;
		_tmp65_ = save_as_dialog;
		_tmp66_ = gtk_file_chooser_get_current_folder (G_TYPE_CHECK_INSTANCE_CAST (_tmp65_, gtk_file_chooser_get_type (), GtkFileChooser));
		_tmp67_ = _tmp66_;
		_tmp68_ = g_file_new_for_path (_tmp67_);
		_g_object_unref0 (self->priv->current_save_dir);
		self->priv->current_save_dir = _tmp68_;
		_g_free0 (_tmp67_);
	}
	_tmp69_ = save_as_dialog;
	gtk_native_dialog_destroy (G_TYPE_CHECK_INSTANCE_CAST (_tmp69_, gtk_native_dialog_get_type (), GtkNativeDialog));
	_g_object_unref0 (save_as_dialog);
	_g_object_unref0 (all_files);
	_g_object_unref0 (output_format_filter);
	output_format_extensions = (_vala_array_free (output_format_extensions, output_format_extensions_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (filename);
	_g_object_unref0 (export_dialog);
}

static void
direct_photo_page_on_send_to (DirectPhotoPage* self)
{
	g_return_if_fail (IS_DIRECT_PHOTO_PAGE (self));
	if (editing_host_page_has_photo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage))) {
		ViewCollection* _tmp0_;
		ViewCollection* _tmp1_;
		GeeList* _tmp2_;
		GeeCollection* _tmp3_;
		_tmp0_ = page_get_view (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
		_tmp1_ = _tmp0_;
		_tmp2_ = view_collection_get_selected_sources (_tmp1_);
		_tmp3_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_COLLECTION, GeeCollection);
		desktop_integration_send_to (_tmp3_);
		_g_object_unref0 (_tmp3_);
		_data_collection_unref0 (_tmp1_);
	}
}

static gboolean
direct_photo_page_real_on_app_key_pressed (Page* base,
                                           GdkEventKey* event)
{
	DirectPhotoPage * self;
	gboolean handled = FALSE;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	static GQuark _tmp2_label1 = 0;
	gboolean _tmp4_ = FALSE;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	g_return_val_if_fail (event != NULL, FALSE);
	handled = TRUE;
	_tmp0_ = gdk_keyval_name (event->keyval);
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("bracketright")))) {
		switch (0) {
			default:
			{
				page_activate_action (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "RotateClockwise");
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("bracketleft")))) {
		switch (0) {
			default:
			{
				page_activate_action (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page), "RotateCounterclockwise");
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				handled = FALSE;
				break;
			}
		}
	}
	if (handled) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = PAGE_CLASS (direct_photo_page_parent_class)->on_app_key_pressed (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), TYPE_PAGE, Page), event);
	}
	result = _tmp4_;
	return result;
}

static void
direct_photo_page_on_print (DirectPhotoPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (IS_DIRECT_PHOTO_PAGE (self));
	_tmp0_ = page_get_view (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_count (_tmp1_) > 0;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		PrintManager* _tmp3_;
		PrintManager* _tmp4_;
		ViewCollection* _tmp5_;
		ViewCollection* _tmp6_;
		GeeList* _tmp7_;
		GeeCollection* _tmp8_;
		_tmp3_ = print_manager_get_instance ();
		_tmp4_ = _tmp3_;
		_tmp5_ = page_get_view (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PAGE, Page));
		_tmp6_ = _tmp5_;
		_tmp7_ = view_collection_get_selected_sources_of_type (_tmp6_, TYPE_PHOTO);
		_tmp8_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GEE_TYPE_COLLECTION, GeeCollection);
		print_manager_spool_photo (_tmp4_, _tmp8_);
		_g_object_unref0 (_tmp8_);
		_data_collection_unref0 (_tmp6_);
		_print_manager_unref0 (_tmp4_);
	}
}

static Block8Data*
block8_data_ref (Block8Data* _data8_)
{
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		DirectPhotoPage* self;
		self = _data8_->self;
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

static gboolean
__lambda20_ (Block8Data* _data8_)
{
	DirectPhotoPage* self;
	gboolean result;
	self = _data8_->self;
	editing_host_page_enable_rotate (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_EDITING_HOST_PAGE, EditingHostPage), _data8_->should_allow_rotation);
	result = FALSE;
	return result;
}

static gboolean
___lambda20__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda20_ (self);
	return result;
}

static void
direct_photo_page_on_dphoto_can_rotate_changed (DirectPhotoPage* self,
                                                gboolean should_allow_rotation)
{
	Block8Data* _data8_;
	g_return_if_fail (IS_DIRECT_PHOTO_PAGE (self));
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->self = g_object_ref (self);
	_data8_->should_allow_rotation = should_allow_rotation;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda20__gsource_func, block8_data_ref (_data8_), block8_data_unref);
	block8_data_unref (_data8_);
	_data8_ = NULL;
}

static DataView*
direct_photo_page_real_create_photo_view (EditingHostPage* base,
                                          DataSource* source)
{
	DirectPhotoPage * self;
	DirectView* _tmp0_;
	DataView* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	g_return_val_if_fail (IS_DATA_SOURCE (source), NULL);
	_tmp0_ = direct_view_new (G_TYPE_CHECK_INSTANCE_CAST (source, TYPE_DIRECT_PHOTO, DirectPhoto));
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_DATA_VIEW, DataView);
	return result;
}

static void
direct_photo_page_class_init (DirectPhotoPageClass * klass,
                              gpointer klass_data)
{
	direct_photo_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DirectPhotoPage_private_offset);
	((PageClass *) klass)->init_collect_ui_filenames = (void (*) (Page*, GeeList*)) direct_photo_page_real_init_collect_ui_filenames;
	((PageClass *) klass)->add_actions = (void (*) (Page*, GActionMap*)) direct_photo_page_real_add_actions;
	((PageClass *) klass)->remove_actions = (void (*) (Page*, GActionMap*)) direct_photo_page_real_remove_actions;
	((PageClass *) klass)->init_collect_injection_groups = (InjectionGroup** (*) (Page*, gint*)) direct_photo_page_real_init_collect_injection_groups;
	((GtkWidgetClass *) klass)->realize = (void (*) (GtkWidget*)) direct_photo_page_real_realize;
	((EditingHostPageClass *) klass)->photo_changing = (void (*) (EditingHostPage*, Photo*)) direct_photo_page_real_photo_changing;
	((PageClass *) klass)->on_context_buttonpress = (gboolean (*) (Page*, GdkEventButton*)) direct_photo_page_real_on_context_buttonpress;
	((EditingHostPageClass *) klass)->on_increase_size = (void (*) (EditingHostPage*)) direct_photo_page_real_on_increase_size;
	((EditingHostPageClass *) klass)->on_decrease_size = (void (*) (EditingHostPage*)) direct_photo_page_real_on_decrease_size;
	((EditingHostPageClass *) klass)->on_double_click = (gboolean (*) (EditingHostPage*, GdkEventButton*)) direct_photo_page_real_on_double_click;
	((EditingHostPageClass *) klass)->update_ui = (void (*) (EditingHostPage*, gboolean)) direct_photo_page_real_update_ui;
	((PageClass *) klass)->update_actions = (void (*) (Page*, gint, gint)) direct_photo_page_real_update_actions;
	((EditingHostPageClass *) klass)->confirm_replace_photo = (gboolean (*) (EditingHostPage*, Photo*, Photo*)) direct_photo_page_real_confirm_replace_photo;
	((PageClass *) klass)->on_app_key_pressed = (gboolean (*) (Page*, GdkEventKey*)) direct_photo_page_real_on_app_key_pressed;
	((EditingHostPageClass *) klass)->create_photo_view = (DataView* (*) (EditingHostPage*, DataSource*)) direct_photo_page_real_create_photo_view;
	G_OBJECT_CLASS (klass)->finalize = direct_photo_page_finalize;
}

static void
direct_photo_page_instance_init (DirectPhotoPage * self,
                                 gpointer klass)
{
	self->priv = direct_photo_page_get_instance_private (self);
	self->priv->view_controller = NULL;
	self->priv->drop_if_dirty = FALSE;
	self->priv->in_shutdown = FALSE;
}

static void
direct_photo_page_finalize (GObject * obj)
{
	DirectPhotoPage * self;
	DirectPhotoSourceCollection* _tmp0_;
	guint _tmp1_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_DIRECT_PHOTO_PAGE, DirectPhotoPage);
	_tmp0_ = direct_photo_global;
	g_signal_parse_name ("items-altered", TYPE_DATA_COLLECTION, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_DATA_COLLECTION, DataCollection), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _direct_photo_page_on_photos_altered_data_collection_items_altered, self);
	_g_object_unref0 (self->priv->initial_file);
	_data_collection_unref0 (self->priv->view_controller);
	_g_object_unref0 (self->priv->current_save_dir);
	_g_object_unref0 (self->priv->context_menu);
	G_OBJECT_CLASS (direct_photo_page_parent_class)->finalize (obj);
}

static GType
direct_photo_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DirectPhotoPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) direct_photo_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DirectPhotoPage), 0, (GInstanceInitFunc) direct_photo_page_instance_init, NULL };
	GType direct_photo_page_type_id;
	direct_photo_page_type_id = g_type_register_static (TYPE_EDITING_HOST_PAGE, "DirectPhotoPage", &g_define_type_info, 0);
	DirectPhotoPage_private_offset = g_type_add_instance_private (direct_photo_page_type_id, sizeof (DirectPhotoPagePrivate));
	return direct_photo_page_type_id;
}

GType
direct_photo_page_get_type (void)
{
	static volatile gsize direct_photo_page_type_id__once = 0;
	if (g_once_init_enter (&direct_photo_page_type_id__once)) {
		GType direct_photo_page_type_id;
		direct_photo_page_type_id = direct_photo_page_get_type_once ();
		g_once_init_leave (&direct_photo_page_type_id__once, direct_photo_page_type_id);
	}
	return direct_photo_page_type_id__once;
}

DirectFullscreenPhotoPage*
direct_fullscreen_photo_page_construct (GType object_type,
                                        GFile* file)
{
	DirectFullscreenPhotoPage * self = NULL;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()), NULL);
	self = (DirectFullscreenPhotoPage*) direct_photo_page_construct (object_type, file);
	return self;
}

DirectFullscreenPhotoPage*
direct_fullscreen_photo_page_new (GFile* file)
{
	return direct_fullscreen_photo_page_construct (TYPE_DIRECT_FULLSCREEN_PHOTO_PAGE, file);
}

static void
direct_fullscreen_photo_page_real_init_collect_ui_filenames (Page* base,
                                                             GeeList* ui_filenames)
{
	DirectFullscreenPhotoPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DIRECT_FULLSCREEN_PHOTO_PAGE, DirectFullscreenPhotoPage);
	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), "direct_context.ui");
}

static void
direct_fullscreen_photo_page_class_init (DirectFullscreenPhotoPageClass * klass,
                                         gpointer klass_data)
{
	direct_fullscreen_photo_page_parent_class = g_type_class_peek_parent (klass);
	((PageClass *) klass)->init_collect_ui_filenames = (void (*) (Page*, GeeList*)) direct_fullscreen_photo_page_real_init_collect_ui_filenames;
}

static void
direct_fullscreen_photo_page_instance_init (DirectFullscreenPhotoPage * self,
                                            gpointer klass)
{
}

static GType
direct_fullscreen_photo_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DirectFullscreenPhotoPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) direct_fullscreen_photo_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DirectFullscreenPhotoPage), 0, (GInstanceInitFunc) direct_fullscreen_photo_page_instance_init, NULL };
	GType direct_fullscreen_photo_page_type_id;
	direct_fullscreen_photo_page_type_id = g_type_register_static (TYPE_DIRECT_PHOTO_PAGE, "DirectFullscreenPhotoPage", &g_define_type_info, 0);
	return direct_fullscreen_photo_page_type_id;
}

GType
direct_fullscreen_photo_page_get_type (void)
{
	static volatile gsize direct_fullscreen_photo_page_type_id__once = 0;
	if (g_once_init_enter (&direct_fullscreen_photo_page_type_id__once)) {
		GType direct_fullscreen_photo_page_type_id;
		direct_fullscreen_photo_page_type_id = direct_fullscreen_photo_page_get_type_once ();
		g_once_init_leave (&direct_fullscreen_photo_page_type_id__once, direct_fullscreen_photo_page_type_id);
	}
	return direct_fullscreen_photo_page_type_id__once;
}

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

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

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

