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

/*
* Copyright (c) 2009-2013 Yorba Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

#include "io.elementary.photos.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include <gee.h>

#define COLLECTION_PAGE_DESKTOP_SLIDESHOW_TRANSITION_SEC 2.0
#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

enum  {
	COLLECTION_PAGE_0_PROPERTY,
	COLLECTION_PAGE_NUM_PROPERTIES
};
static GParamSpec* collection_page_properties[COLLECTION_PAGE_NUM_PROPERTIES];
typedef enum  {
	COLLECTION_PAGE_TARGET_TYPE_GNOME_COPIED_FILES,
	COLLECTION_PAGE_TARGET_TYPE_TEXT_URI_LIST
} CollectionPageTargetType;

#define COLLECTION_PAGE_TYPE_TARGET_TYPE (collection_page_target_type_get_type ())
#define _exporter_ui_unref0(var) ((var == NULL) ? NULL : (var = (exporter_ui_unref (var), NULL)))
#define _view_filter_unref0(var) ((var == NULL) ? NULL : (var = (view_filter_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block8Data Block8Data;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _data_collection_unref0(var) ((var == NULL) ? NULL : (var = (data_collection_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
#define _alteration_unref0(var) ((var == NULL) ? NULL : (var = (alteration_unref (var), NULL)))
#define _print_manager_unref0(var) ((var == NULL) ? NULL : (var = (print_manager_unref (var), NULL)))
#define _command_manager_unref0(var) ((var == NULL) ? NULL : (var = (command_manager_unref (var), NULL)))
#define _pixel_transformation_bundle_unref0(var) ((var == NULL) ? NULL : (var = (pixel_transformation_bundle_unref (var), NULL)))

#define TYPE_SLIDESHOW_PAGE (slideshow_page_get_type ())
#define SLIDESHOW_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SLIDESHOW_PAGE, SlideshowPage))
#define SLIDESHOW_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SLIDESHOW_PAGE, SlideshowPageClass))
#define IS_SLIDESHOW_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SLIDESHOW_PAGE))
#define IS_SLIDESHOW_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SLIDESHOW_PAGE))
#define SLIDESHOW_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SLIDESHOW_PAGE, SlideshowPageClass))

typedef struct _SlideshowPage SlideshowPage;
typedef struct _SlideshowPageClass SlideshowPageClass;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _CollectionPagePrivate {
	ExporterUI* exporter;
	CollectionPageCollectionSearchViewFilter* search_filter;
	GtkToggleButton* enhance_button;
	GtkMenu* item_context_menu;
	GtkMenu* contractor_menu;
	GtkButton* rotate_button;
	GtkButton* flip_button;
};

struct _Block8Data {
	int _ref_count_;
	CollectionPage* self;
	GtkAction* copy_images_action;
	GtkAction* revert_action;
	GtkAction* duplicate_action;
	GtkAction* copy_color_action;
	GtkAction* paste_color_action;
	GtkAction* flag_action;
	GtkAction* raw_developer_app_action;
	GtkAction* raw_developer_camera_action;
	GtkAction* adjust_datetime_action;
	GtkAction* new_event_action;
	GtkAction* jump_event_action;
	GtkAction* print_action;
	GtkAction* export_action;
	GtkAction* remove_action;
	GtkAction* trash_action;
};

static gint CollectionPage_private_offset;
static gpointer collection_page_parent_class = NULL;
static GList* collection_page_copied_photos;
static GList* collection_page_copied_photos = NULL;
static GtkClipboard* collection_page_clipboard;
static GtkClipboard* collection_page_clipboard = NULL;
static gpointer collection_page_collection_search_view_filter_parent_class = NULL;

static GType collection_page_target_type_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void collection_page_real_add_toolbar_widgets (Page* base,
                                               GtkActionBar* toolbar);
static void collection_page_on_slideshow (CollectionPage* self);
static void _collection_page_on_slideshow_gtk_button_clicked (GtkButton* _sender,
                                                       gpointer self);
static void collection_page_on_rotate_clockwise (CollectionPage* self);
static void _collection_page_on_rotate_clockwise_gtk_button_clicked (GtkButton* _sender,
                                                              gpointer self);
static void collection_page_on_flip_horizontally (CollectionPage* self);
static void _collection_page_on_flip_horizontally_gtk_button_clicked (GtkButton* _sender,
                                                               gpointer self);
static void collection_page_on_enhance (CollectionPage* self);
static void _collection_page_on_enhance_gtk_button_clicked (GtkButton* _sender,
                                                     gpointer self);
static void collection_page_on_show_sidebar (CollectionPage* self);
static void _collection_page_on_show_sidebar_gtk_button_clicked (GtkButton* _sender,
                                                          gpointer self);
static GtkMenu* collection_page_real_get_item_context_menu (CheckerboardPage* base);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
static void ___lambda79_ (Block8Data* _data8_);
static void ____lambda79__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda80_ (Block8Data* _data8_);
static void ____lambda80__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda81_ (Block8Data* _data8_);
static void ____lambda81__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda82_ (Block8Data* _data8_);
static void ____lambda82__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda83_ (Block8Data* _data8_);
static void ____lambda83__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda84_ (Block8Data* _data8_);
static void ____lambda84__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda85_ (Block8Data* _data8_);
static void ____lambda85__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda86_ (Block8Data* _data8_);
static void ____lambda86__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda87_ (Block8Data* _data8_);
static void ____lambda87__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda88_ (Block8Data* _data8_);
static void ____lambda88__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda89_ (Block8Data* _data8_);
static void ____lambda89__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda90_ (Block8Data* _data8_);
static void ____lambda90__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda91_ (Block8Data* _data8_);
static void ____lambda91__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda92_ (Block8Data* _data8_);
static void ____lambda92__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda93_ (Block8Data* _data8_);
static void ____lambda93__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static GtkActionEntry* collection_page_real_init_collect_action_entries (Page* base,
                                                                  gint* result_length1);
static void collection_page_on_print (CollectionPage* self);
static void _collection_page_on_print_gcallback (GtkAction* action,
                                          gpointer self);
static void _collection_page_on_rotate_clockwise_gcallback (GtkAction* action,
                                                     gpointer self);
static void collection_page_on_rotate_counterclockwise (CollectionPage* self);
static void _collection_page_on_rotate_counterclockwise_gcallback (GtkAction* action,
                                                            gpointer self);
static void _collection_page_on_flip_horizontally_gcallback (GtkAction* action,
                                                      gpointer self);
static void collection_page_on_flip_vertically (CollectionPage* self);
static void _collection_page_on_flip_vertically_gcallback (GtkAction* action,
                                                    gpointer self);
static void _collection_page_on_copy_adjustments_gcallback (GtkAction* action,
                                                     gpointer self);
static void _collection_page_on_paste_adjustments_gcallback (GtkAction* action,
                                                      gpointer self);
static void collection_page_on_revert (CollectionPage* self);
static void _collection_page_on_revert_gcallback (GtkAction* action,
                                           gpointer self);
static void collection_page_on_duplicate_photo (CollectionPage* self);
static void _collection_page_on_duplicate_photo_gcallback (GtkAction* action,
                                                    gpointer self);
static void collection_page_on_adjust_date_time (CollectionPage* self);
static void _collection_page_on_adjust_date_time_gcallback (GtkAction* action,
                                                     gpointer self);
static void _collection_page_on_enhance_gcallback (GtkAction* action,
                                            gpointer self);
static void _collection_page_on_slideshow_gcallback (GtkAction* action,
                                              gpointer self);
static void collection_page_on_copy_images (CollectionPage* self);
static void _collection_page_on_copy_images_gcallback (GtkAction* action,
                                                gpointer self);
static void _vala_array_add113 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add114 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add115 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add116 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add117 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add118 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add119 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add120 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add121 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add122 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add123 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add124 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add125 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add126 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add127 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add128 (gchar** * array,
                         gint* length,
                         gint* size,
                         gchar* value);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void _collection_page_get_image_data_for_clipboard_gtk_clipboard_get_func (GtkClipboard* clipboard,
                                                                           GtkSelectionData* selection_data,
                                                                           guint info,
                                                                           void* user_data_or_owner);
static void _collection_page_clear_data_for_clipboard_gtk_clipboard_clear_func (GtkClipboard* clipboard,
                                                                         void* user_data_or_owner);
static gboolean collection_page_selection_has_video (CollectionPage* self);
static gboolean collection_page_page_has_photo (CollectionPage* self);
static gboolean collection_page_selection_has_photo (CollectionPage* self);
static void collection_page_real_init_actions (Page* base,
                                        gint selected_count,
                                        gint count);
static void collection_page_real_update_actions (Page* base,
                                          gint selected_count,
                                          gint count);
static gboolean collection_page_can_revert_selected (CollectionPage* self);
static void collection_page_update_enhance_toggled (CollectionPage* self);
static void collection_page_on_photos_altered (CollectionPage* self,
                                        GeeMap* altered);
static void collection_page_real_on_item_activated (CheckerboardPage* base,
                                             CheckerboardItem* item);
static gboolean collection_page_real_on_app_key_pressed (Page* base,
                                                  GdkEventKey* event);
static void collection_page_real_on_export (MediaPage* base);
static void collection_page_on_export_completed (CollectionPage* self);
static void _collection_page_on_export_completed_exporter_completion_callback (Exporter* exporter,
                                                                        gboolean is_cancelled,
                                                                        gpointer self);
static gboolean collection_page_can_revert_editable_selected (CollectionPage* self);
VALA_EXTERN SlideshowPage* slideshow_page_new (SourceCollection* sources,
                                   ViewCollection* controller,
                                   Photo* start);
VALA_EXTERN SlideshowPage* slideshow_page_construct (GType object_type,
                                         SourceCollection* sources,
                                         ViewCollection* controller,
                                         Photo* start);
VALA_EXTERN GType slideshow_page_get_type (void) G_GNUC_CONST ;
static gboolean collection_page_real_on_ctrl_pressed (Page* base,
                                               GdkEventKey* event);
static void _collection_page_on_flip_vertically_gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void _collection_page_on_rotate_counterclockwise_gtk_button_clicked (GtkButton* _sender,
                                                                     gpointer self);
static gboolean collection_page_real_on_ctrl_released (Page* base,
                                                GdkEventKey* event);
static gchar* collection_page_real_get_view_empty_message (CheckerboardPage* base);
static SearchViewFilter* collection_page_real_get_search_view_filter (CheckerboardPage* base);
static guint collection_page_collection_search_view_filter_real_get_criteria (SearchViewFilter* base);
static GType collection_page_collection_search_view_filter_get_type_once (void);
static GObject * collection_page_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties);
static void _collection_page_on_photos_altered_data_collection_items_altered (DataCollection* _sender,
                                                                       GeeMap* items,
                                                                       gpointer self);
static void collection_page_finalize (GObject * obj);
static GType collection_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 GtkTargetEntry COLLECTION_PAGE_COPY_TARGETS[2] = {{"x-special/gnome-copied-files", (guint) GTK_TARGET_OTHER_APP, (guint) COLLECTION_PAGE_TARGET_TYPE_GNOME_COPIED_FILES}, {"text/uri-list", (guint) GTK_TARGET_OTHER_APP, (guint) COLLECTION_PAGE_TARGET_TYPE_TEXT_URI_LIST}};

static inline gpointer
collection_page_get_instance_private (CollectionPage* self)
{
	return G_STRUCT_MEMBER_P (self, CollectionPage_private_offset);
}

static GType
collection_page_target_type_get_type_once (void)
{
	static const GEnumValue values[] = {{COLLECTION_PAGE_TARGET_TYPE_GNOME_COPIED_FILES, "COLLECTION_PAGE_TARGET_TYPE_GNOME_COPIED_FILES", "gnome-copied-files"}, {COLLECTION_PAGE_TARGET_TYPE_TEXT_URI_LIST, "COLLECTION_PAGE_TARGET_TYPE_TEXT_URI_LIST", "text-uri-list"}, {0, NULL, NULL}};
	GType collection_page_target_type_type_id;
	collection_page_target_type_type_id = g_enum_register_static ("CollectionPageTargetType", values);
	return collection_page_target_type_type_id;
}

static GType
collection_page_target_type_get_type (void)
{
	static volatile gsize collection_page_target_type_type_id__once = 0;
	if (g_once_init_enter (&collection_page_target_type_type_id__once)) {
		GType collection_page_target_type_type_id;
		collection_page_target_type_type_id = collection_page_target_type_get_type_once ();
		g_once_init_leave (&collection_page_target_type_type_id__once, collection_page_target_type_type_id);
	}
	return collection_page_target_type_type_id__once;
}

CollectionPage*
collection_page_construct (GType object_type,
                           const gchar* page_name)
{
	CollectionPage * self = NULL;
	g_return_val_if_fail (page_name != NULL, NULL);
	self = (CollectionPage*) g_object_new (object_type, "page-name", page_name, NULL);
	return self;
}

static void
_collection_page_on_slideshow_gtk_button_clicked (GtkButton* _sender,
                                                  gpointer self)
{
	collection_page_on_slideshow ((CollectionPage*) self);
}

static void
_collection_page_on_rotate_clockwise_gtk_button_clicked (GtkButton* _sender,
                                                         gpointer self)
{
	collection_page_on_rotate_clockwise ((CollectionPage*) self);
}

static void
_collection_page_on_flip_horizontally_gtk_button_clicked (GtkButton* _sender,
                                                          gpointer self)
{
	collection_page_on_flip_horizontally ((CollectionPage*) self);
}

static void
_collection_page_on_enhance_gtk_button_clicked (GtkButton* _sender,
                                                gpointer self)
{
	collection_page_on_enhance ((CollectionPage*) self);
}

static void
_collection_page_on_show_sidebar_gtk_button_clicked (GtkButton* _sender,
                                                     gpointer self)
{
	collection_page_on_show_sidebar ((CollectionPage*) self);
}

static void
collection_page_real_add_toolbar_widgets (Page* base,
                                          GtkActionBar* toolbar)
{
	CollectionPage * self;
	GtkButton* slideshow_button = NULL;
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp2_;
	GtkButton* _tmp3_;
	GtkAction* rotate_action = NULL;
	GtkAction* _tmp4_;
	GtkButton* _tmp5_;
	GtkButton* _tmp6_;
	GtkButton* _tmp7_;
	GtkButton* _tmp8_;
	GtkAction* flip_action = NULL;
	GtkAction* _tmp9_;
	GtkButton* _tmp10_;
	GtkToggleButton* _tmp11_;
	GtkToggleButton* _tmp12_;
	GtkImage* _tmp13_;
	GtkImage* _tmp14_;
	GtkToggleButton* _tmp15_;
	GtkToggleButton* _tmp16_;
	SliderAssembly* zoom_assembly = NULL;
	gint _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	SliderAssembly* _tmp21_;
	GtkButton* _tmp22_;
	GtkButton* _tmp23_;
	GtkButton* _tmp24_;
	GtkButton* _tmp25_;
	GtkSeparator* _tmp26_;
	GtkSeparator* _tmp27_;
	GtkToggleButton* _tmp28_;
	GtkButton* _tmp29_;
	LibraryWindow* app = NULL;
	AppWindow* _tmp30_;
	LibraryWindow* _tmp31_;
	self = (CollectionPage*) base;
	g_return_if_fail (toolbar != NULL);
	_tmp0_ = (GtkButton*) gtk_button_new_from_icon_name ("media-playback-start-symbolic", (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp0_);
	slideshow_button = _tmp0_;
	gtk_widget_set_tooltip_text ((GtkWidget*) slideshow_button, _ ("Play a slideshow"));
	g_signal_connect_object (slideshow_button, "clicked", (GCallback) _collection_page_on_slideshow_gtk_button_clicked, self, 0);
	_tmp1_ = (GtkButton*) gtk_button_new_from_icon_name (RESOURCES_CLOCKWISE, (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->rotate_button);
	self->priv->rotate_button = _tmp1_;
	_tmp2_ = self->priv->rotate_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp2_, RESOURCES_ROTATE_CW_TOOLTIP);
	_tmp3_ = self->priv->rotate_button;
	g_signal_connect_object (_tmp3_, "clicked", (GCallback) _collection_page_on_rotate_clockwise_gtk_button_clicked, self, 0);
	_tmp4_ = page_get_action ((Page*) self, "RotateClockwise");
	rotate_action = _tmp4_;
	_tmp5_ = self->priv->rotate_button;
	g_object_bind_property_with_closures ((GObject*) rotate_action, "sensitive", (GObject*) _tmp5_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp6_ = (GtkButton*) gtk_button_new_from_icon_name (RESOURCES_HFLIP, (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->flip_button);
	self->priv->flip_button = _tmp6_;
	_tmp7_ = self->priv->flip_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp7_, RESOURCES_HFLIP_TOOLTIP);
	_tmp8_ = self->priv->flip_button;
	g_signal_connect_object (_tmp8_, "clicked", (GCallback) _collection_page_on_flip_horizontally_gtk_button_clicked, self, 0);
	_tmp9_ = page_get_action ((Page*) self, "FlipHorizontally");
	flip_action = _tmp9_;
	_tmp10_ = self->priv->flip_button;
	g_object_bind_property_with_closures ((GObject*) flip_action, "sensitive", (GObject*) _tmp10_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp11_ = (GtkToggleButton*) gtk_toggle_button_new ();
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->enhance_button);
	self->priv->enhance_button = _tmp11_;
	_tmp12_ = self->priv->enhance_button;
	_tmp13_ = (GtkImage*) gtk_image_new_from_icon_name (RESOURCES_ENHANCE, (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp13_);
	_tmp14_ = _tmp13_;
	gtk_button_set_image ((GtkButton*) _tmp12_, (GtkWidget*) _tmp14_);
	_g_object_unref0 (_tmp14_);
	_tmp15_ = self->priv->enhance_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp15_, RESOURCES_ENHANCE_TOOLTIP);
	_tmp16_ = self->priv->enhance_button;
	g_signal_connect_object ((GtkButton*) _tmp16_, "clicked", (GCallback) _collection_page_on_enhance_gtk_button_clicked, self, 0);
	_tmp17_ = thumbnail_get_MIN_SCALE ();
	_tmp18_ = _tmp17_;
	_tmp19_ = thumbnail_get_MAX_SCALE ();
	_tmp20_ = _tmp19_;
	_tmp21_ = slider_assembly_new ((gdouble) _tmp18_, (gdouble) _tmp20_, (gdouble) MEDIA_PAGE_MANUAL_STEPPING, (gdouble) 0);
	g_object_ref_sink (_tmp21_);
	zoom_assembly = _tmp21_;
	media_page_connect_slider ((MediaPage*) self, zoom_assembly);
	_tmp22_ = media_page_create_sidebar_button ();
	_g_object_unref0 (((Page*) self)->show_sidebar_button);
	((Page*) self)->show_sidebar_button = _tmp22_;
	_tmp23_ = ((Page*) self)->show_sidebar_button;
	g_signal_connect_object (_tmp23_, "clicked", (GCallback) _collection_page_on_show_sidebar_gtk_button_clicked, self, 0);
	gtk_action_bar_pack_start (toolbar, (GtkWidget*) slideshow_button);
	_tmp24_ = self->priv->rotate_button;
	gtk_action_bar_pack_start (toolbar, (GtkWidget*) _tmp24_);
	_tmp25_ = self->priv->flip_button;
	gtk_action_bar_pack_start (toolbar, (GtkWidget*) _tmp25_);
	_tmp26_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_VERTICAL);
	g_object_ref_sink (_tmp26_);
	_tmp27_ = _tmp26_;
	gtk_action_bar_pack_start (toolbar, (GtkWidget*) _tmp27_);
	_g_object_unref0 (_tmp27_);
	_tmp28_ = self->priv->enhance_button;
	gtk_action_bar_pack_start (toolbar, (GtkWidget*) _tmp28_);
	_tmp29_ = ((Page*) self)->show_sidebar_button;
	gtk_action_bar_pack_end (toolbar, (GtkWidget*) _tmp29_);
	gtk_action_bar_pack_end (toolbar, (GtkWidget*) zoom_assembly);
	_tmp30_ = app_window_get_instance ();
	_tmp31_ = IS_LIBRARY_WINDOW (_tmp30_) ? ((LibraryWindow*) _tmp30_) : NULL;
	if (_tmp31_ == NULL) {
		_g_object_unref0 (_tmp30_);
	}
	app = _tmp31_;
	page_update_sidebar_action ((Page*) self, !library_window_is_metadata_sidebar_visible (app));
	PAGE_CLASS (collection_page_parent_class)->add_toolbar_widgets ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MEDIA_PAGE, MediaPage), toolbar);
	_g_object_unref0 (app);
	_g_object_unref0 (zoom_assembly);
	_g_object_unref0 (flip_action);
	_g_object_unref0 (rotate_action);
	_g_object_unref0 (slideshow_button);
}

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_)) {
		CollectionPage* self;
		self = _data8_->self;
		_g_object_unref0 (_data8_->trash_action);
		_g_object_unref0 (_data8_->remove_action);
		_g_object_unref0 (_data8_->export_action);
		_g_object_unref0 (_data8_->print_action);
		_g_object_unref0 (_data8_->jump_event_action);
		_g_object_unref0 (_data8_->new_event_action);
		_g_object_unref0 (_data8_->adjust_datetime_action);
		_g_object_unref0 (_data8_->raw_developer_camera_action);
		_g_object_unref0 (_data8_->raw_developer_app_action);
		_g_object_unref0 (_data8_->flag_action);
		_g_object_unref0 (_data8_->paste_color_action);
		_g_object_unref0 (_data8_->copy_color_action);
		_g_object_unref0 (_data8_->duplicate_action);
		_g_object_unref0 (_data8_->revert_action);
		_g_object_unref0 (_data8_->copy_images_action);
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

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

static void
___lambda79_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->copy_images_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda79__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda79_ (self);
}

static void
___lambda80_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->revert_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda80__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda80_ (self);
}

static void
___lambda81_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->duplicate_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda81__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda81_ (self);
}

static void
___lambda82_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->copy_color_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda82__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda82_ (self);
}

static void
___lambda83_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->paste_color_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda83__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda83_ (self);
}

static void
___lambda84_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->flag_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda84__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda84_ (self);
}

static void
___lambda85_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->raw_developer_app_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda85__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda85_ (self);
}

static void
___lambda86_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->raw_developer_camera_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda86__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda86_ (self);
}

static void
___lambda87_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->adjust_datetime_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda87__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda87_ (self);
}

static void
___lambda88_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->new_event_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda88__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda88_ (self);
}

static void
___lambda89_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->jump_event_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda89__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda89_ (self);
}

static void
___lambda90_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->print_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda90__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda90_ (self);
}

static void
___lambda91_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->export_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda91__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda91_ (self);
}

static void
___lambda92_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->remove_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda92__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda92_ (self);
}

static void
___lambda93_ (Block8Data* _data8_)
{
	CollectionPage* self;
	GtkAction* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->trash_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda93__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda93_ (self);
}

static GtkMenu*
collection_page_real_get_item_context_menu (CheckerboardPage* base)
{
	CollectionPage * self;
	GtkMenu* _tmp0_;
	GtkMenu* _tmp179_;
	GtkMenu* _tmp180_;
	GtkMenu* _tmp181_;
	GtkMenu* result;
	self = (CollectionPage*) base;
	_tmp0_ = self->priv->item_context_menu;
	if (_tmp0_ == NULL) {
		Block8Data* _data8_;
		GtkWidget* _tmp1_;
		GtkMenu* _tmp2_ = NULL;
		GtkMenuItem* copy_images_menu_item = NULL;
		GtkMenuItem* _tmp3_;
		GtkAction* _tmp4_;
		GtkMenuItem* _tmp5_;
		GtkCheckMenuItem* metadata_menu_item = NULL;
		GtkCheckMenuItem* _tmp6_;
		GtkAction* metadata_action = NULL;
		GtkAction* _tmp7_;
		GtkAction* _tmp8_;
		GtkCheckMenuItem* _tmp9_;
		GtkMenuItem* revert_menu_item = NULL;
		GtkMenuItem* _tmp10_;
		GtkAction* _tmp11_;
		GtkAction* _tmp12_;
		GtkMenuItem* _tmp13_;
		GtkMenuItem* _tmp14_;
		GtkMenuItem* duplicate_menu_item = NULL;
		GtkMenuItem* _tmp15_;
		GtkAction* _tmp16_;
		GtkAction* _tmp17_;
		GtkMenuItem* _tmp18_;
		GtkMenuItem* _tmp19_;
		GtkMenuItem* copy_color_menu_item = NULL;
		GtkMenuItem* _tmp20_;
		GtkAction* _tmp21_;
		GtkAction* _tmp22_;
		GtkMenuItem* _tmp23_;
		GtkMenuItem* _tmp24_;
		GtkMenuItem* paste_color_menu_item = NULL;
		GtkMenuItem* _tmp25_;
		GtkAction* _tmp26_;
		GtkAction* _tmp27_;
		GtkMenuItem* _tmp28_;
		GtkMenuItem* _tmp29_;
		GtkMenuItem* flag_menu_item = NULL;
		GtkMenuItem* _tmp30_;
		GtkAction* _tmp31_;
		GtkAction* _tmp32_;
		GtkMenuItem* _tmp33_;
		GtkMenuItem* _tmp34_;
		GtkMenuItem* raw_developer_app_menu_item = NULL;
		gchar* _tmp35_;
		gchar* _tmp36_;
		GtkMenuItem* _tmp37_;
		GtkMenuItem* _tmp38_;
		GtkAction* _tmp39_;
		GtkAction* _tmp40_;
		GtkMenuItem* _tmp41_;
		GtkMenuItem* _tmp42_;
		GtkMenuItem* raw_developer_camera_menu_item = NULL;
		gchar* _tmp43_;
		gchar* _tmp44_;
		GtkMenuItem* _tmp45_;
		GtkMenuItem* _tmp46_;
		GtkAction* _tmp47_;
		GtkAction* _tmp48_;
		GtkMenuItem* _tmp49_;
		GtkMenuItem* _tmp50_;
		GtkMenuItem* raw_developer_menu_item = NULL;
		GtkMenuItem* _tmp51_;
		GtkAction* raw_developer_action = NULL;
		GtkAction* _tmp52_;
		GtkAction* _tmp53_;
		GtkMenuItem* _tmp54_;
		GtkMenu* raw_developer_menu = NULL;
		GtkMenu* _tmp55_;
		GtkMenu* _tmp56_;
		GtkMenuItem* _tmp57_;
		GtkMenu* _tmp58_;
		GtkMenuItem* _tmp59_;
		GtkMenuItem* _tmp60_;
		GtkMenu* _tmp61_;
		GtkMenuItem* adjust_datetime_menu_item = NULL;
		GtkMenuItem* _tmp62_;
		GtkAction* _tmp63_;
		GtkAction* _tmp64_;
		GtkMenuItem* _tmp65_;
		GtkMenuItem* _tmp66_;
		GtkMenuItem* open_menu_item = NULL;
		gchar* _tmp67_;
		GtkMenuItem* _tmp68_ = NULL;
		GtkMenuItem* new_event_menu_item = NULL;
		GtkMenuItem* _tmp69_;
		GtkAction* _tmp70_;
		GtkAction* _tmp71_;
		GtkMenuItem* _tmp72_;
		GtkMenuItem* _tmp73_;
		GtkMenuItem* jump_event_menu_item = NULL;
		GtkMenuItem* _tmp74_;
		GtkAction* _tmp75_;
		GtkAction* _tmp76_;
		GtkMenuItem* _tmp77_;
		GtkMenuItem* _tmp78_;
		GtkMenuItem* print_menu_item = NULL;
		GtkMenuItem* _tmp79_;
		GtkAction* _tmp80_;
		GtkAction* _tmp81_;
		GtkMenuItem* _tmp82_;
		GtkMenuItem* _tmp83_;
		GtkMenuItem* export_menu_item = NULL;
		GtkMenuItem* _tmp84_;
		GtkAction* _tmp85_;
		GtkAction* _tmp86_;
		GtkMenuItem* _tmp87_;
		GtkMenuItem* _tmp88_;
		GtkMenuItem* wallpaper_menuitem = NULL;
		gchar* _tmp89_;
		GtkMenuItem* _tmp90_ = NULL;
		GtkMenuItem* contractor_menu_item = NULL;
		GtkMenuItem* _tmp91_;
		GtkMenu* _tmp92_;
		GtkMenuItem* _tmp93_;
		GtkMenu* _tmp94_;
		GtkMenuItem* remove_menu_item = NULL;
		GtkMenuItem* _tmp95_;
		GtkAction* _tmp96_;
		GtkAction* _tmp97_;
		GtkMenuItem* _tmp98_;
		GtkMenuItem* _tmp99_;
		GtkMenuItem* trash_menu_item = NULL;
		GtkMenuItem* _tmp100_;
		GtkAction* _tmp101_;
		GtkAction* _tmp102_;
		GtkMenuItem* _tmp103_;
		GtkMenuItem* _tmp104_;
		GtkMenu* _tmp105_;
		GtkMenuItem* _tmp106_;
		GtkMenu* _tmp107_;
		GtkMenuItem* _tmp108_;
		GtkMenu* _tmp109_;
		GtkMenuItem* _tmp110_;
		GtkMenu* _tmp111_;
		GtkMenuItem* _tmp112_;
		GtkMenu* _tmp113_;
		GtkMenuItem* _tmp114_;
		GtkMenu* _tmp115_;
		GtkMenuItem* _tmp116_;
		GtkMenu* _tmp117_;
		GtkSeparatorMenuItem* _tmp118_;
		GtkSeparatorMenuItem* _tmp119_;
		GtkMenu* _tmp120_;
		GtkMenuItem* _tmp121_;
		GtkMenu* _tmp122_;
		GtkMenuItem* _tmp123_;
		GtkMenu* _tmp124_;
		GtkSeparatorMenuItem* _tmp125_;
		GtkSeparatorMenuItem* _tmp126_;
		GtkMenu* _tmp127_;
		GtkMenuItem* _tmp128_;
		GtkMenu* _tmp129_;
		GtkMenuItem* _tmp130_;
		GtkMenu* _tmp131_;
		GtkMenuItem* _tmp132_;
		GtkMenu* _tmp133_;
		GtkSeparatorMenuItem* _tmp134_;
		GtkSeparatorMenuItem* _tmp135_;
		GtkMenu* _tmp136_;
		GtkMenuItem* _tmp137_;
		GtkMenu* _tmp138_;
		GtkMenuItem* _tmp139_;
		GtkMenu* _tmp140_;
		GtkSeparatorMenuItem* _tmp141_;
		GtkSeparatorMenuItem* _tmp142_;
		GtkMenu* _tmp143_;
		GtkMenuItem* _tmp144_;
		GtkMenu* _tmp145_;
		GtkMenuItem* _tmp146_;
		GtkMenu* _tmp147_;
		GtkSeparatorMenuItem* _tmp148_;
		GtkSeparatorMenuItem* _tmp149_;
		GtkMenu* _tmp150_;
		GtkCheckMenuItem* _tmp151_;
		GtkMenu* _tmp152_;
		GtkSeparatorMenuItem* _tmp153_;
		GtkSeparatorMenuItem* _tmp154_;
		GtkMenu* _tmp155_;
		GtkMenuItem* _tmp156_;
		GtkMenu* _tmp157_;
		GtkMenuItem* _tmp158_;
		GtkMenu* _tmp159_;
		DataSource* source = NULL;
		ViewCollection* _tmp160_;
		ViewCollection* _tmp161_;
		DataView* _tmp162_;
		DataView* _tmp163_;
		DataSource* _tmp164_;
		DataSource* _tmp165_;
		DataSource* _tmp166_;
		DataSource* _tmp167_;
		gboolean _tmp168_ = FALSE;
		DataSource* _tmp169_;
		_data8_ = g_slice_new0 (Block8Data);
		_data8_->_ref_count_ = 1;
		_data8_->self = g_object_ref (self);
		_tmp1_ = _g_object_ref0 ((GtkWidget*) self);
		_tmp2_ = (GtkMenu*) gtk_menu_new ();
		g_object_set (_tmp2_, "attach-widget", _tmp1_, NULL);
		_g_object_unref0 (_tmp1_);
		g_object_ref_sink (_tmp2_);
		_g_object_unref0 (self->priv->item_context_menu);
		self->priv->item_context_menu = _tmp2_;
		_tmp3_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_COPY_IMAGE_LABEL);
		g_object_ref_sink (_tmp3_);
		copy_images_menu_item = _tmp3_;
		_tmp4_ = page_get_action ((Page*) self, "CopyImages");
		_data8_->copy_images_action = _tmp4_;
		_tmp5_ = copy_images_menu_item;
		g_signal_connect_data (_tmp5_, "activate", (GCallback) ____lambda79__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp6_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_mnemonic (_ ("Edit Photo In_fo"));
		g_object_ref_sink (_tmp6_);
		metadata_menu_item = _tmp6_;
		_tmp7_ = page_get_common_action ((Page*) self, "CommonDisplayMetadataSidebar", TRUE);
		metadata_action = _tmp7_;
		_tmp8_ = metadata_action;
		_tmp9_ = metadata_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp8_, "active", (GObject*) _tmp9_, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp10_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_REVERT_MENU);
		g_object_ref_sink (_tmp10_);
		revert_menu_item = _tmp10_;
		_tmp11_ = page_get_action ((Page*) self, "Revert");
		_data8_->revert_action = _tmp11_;
		_tmp12_ = _data8_->revert_action;
		_tmp13_ = revert_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp12_, "sensitive", (GObject*) _tmp13_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp14_ = revert_menu_item;
		g_signal_connect_data (_tmp14_, "activate", (GCallback) ____lambda80__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp15_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_DUPLICATE_PHOTO_MENU);
		g_object_ref_sink (_tmp15_);
		duplicate_menu_item = _tmp15_;
		_tmp16_ = page_get_action ((Page*) self, "Duplicate");
		_data8_->duplicate_action = _tmp16_;
		_tmp17_ = _data8_->duplicate_action;
		_tmp18_ = duplicate_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp17_, "sensitive", (GObject*) _tmp18_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp19_ = duplicate_menu_item;
		g_signal_connect_data (_tmp19_, "activate", (GCallback) ____lambda81__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp20_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_COPY_ADJUSTMENTS_MENU);
		g_object_ref_sink (_tmp20_);
		copy_color_menu_item = _tmp20_;
		_tmp21_ = page_get_action ((Page*) self, "CopyColorAdjustments");
		_data8_->copy_color_action = _tmp21_;
		_tmp22_ = _data8_->copy_color_action;
		_tmp23_ = copy_color_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp22_, "sensitive", (GObject*) _tmp23_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp24_ = copy_color_menu_item;
		g_signal_connect_data (_tmp24_, "activate", (GCallback) ____lambda82__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp25_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_PASTE_ADJUSTMENTS_MENU);
		g_object_ref_sink (_tmp25_);
		paste_color_menu_item = _tmp25_;
		_tmp26_ = page_get_action ((Page*) self, "PasteColorAdjustments");
		_data8_->paste_color_action = _tmp26_;
		_tmp27_ = _data8_->paste_color_action;
		_tmp28_ = paste_color_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp27_, "sensitive", (GObject*) _tmp28_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp29_ = paste_color_menu_item;
		g_signal_connect_data (_tmp29_, "activate", (GCallback) ____lambda83__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp30_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_FLAG_MENU);
		g_object_ref_sink (_tmp30_);
		flag_menu_item = _tmp30_;
		_tmp31_ = page_get_action ((Page*) self, "Flag");
		_data8_->flag_action = _tmp31_;
		_tmp32_ = _data8_->flag_action;
		_tmp33_ = flag_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp32_, "sensitive", (GObject*) _tmp33_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp34_ = flag_menu_item;
		g_signal_connect_data (_tmp34_, "activate", (GCallback) ____lambda84__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp35_ = raw_developer_get_label (RAW_DEVELOPER_SHOTWELL);
		_tmp36_ = _tmp35_;
		_tmp37_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (_tmp36_);
		g_object_ref_sink (_tmp37_);
		_tmp38_ = _tmp37_;
		_g_free0 (_tmp36_);
		raw_developer_app_menu_item = _tmp38_;
		_tmp39_ = page_get_action ((Page*) self, "RawDeveloperShotwell");
		_data8_->raw_developer_app_action = _tmp39_;
		_tmp40_ = _data8_->raw_developer_app_action;
		_tmp41_ = raw_developer_app_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp40_, "sensitive", (GObject*) _tmp41_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp42_ = raw_developer_app_menu_item;
		g_signal_connect_data (_tmp42_, "activate", (GCallback) ____lambda85__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp43_ = raw_developer_get_label (RAW_DEVELOPER_CAMERA);
		_tmp44_ = _tmp43_;
		_tmp45_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (_tmp44_);
		g_object_ref_sink (_tmp45_);
		_tmp46_ = _tmp45_;
		_g_free0 (_tmp44_);
		raw_developer_camera_menu_item = _tmp46_;
		_tmp47_ = page_get_action ((Page*) self, "RawDeveloperCamera");
		_data8_->raw_developer_camera_action = _tmp47_;
		_tmp48_ = _data8_->raw_developer_camera_action;
		_tmp49_ = raw_developer_camera_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp48_, "sensitive", (GObject*) _tmp49_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp50_ = raw_developer_camera_menu_item;
		g_signal_connect_data (_tmp50_, "activate", (GCallback) ____lambda86__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp51_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (_ ("_Developer"));
		g_object_ref_sink (_tmp51_);
		raw_developer_menu_item = _tmp51_;
		_tmp52_ = page_get_action ((Page*) self, "RawDeveloper");
		raw_developer_action = _tmp52_;
		_tmp53_ = raw_developer_action;
		_tmp54_ = raw_developer_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp53_, "sensitive", (GObject*) _tmp54_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp55_ = (GtkMenu*) gtk_menu_new ();
		g_object_ref_sink (_tmp55_);
		raw_developer_menu = _tmp55_;
		_tmp56_ = raw_developer_menu;
		_tmp57_ = raw_developer_app_menu_item;
		gtk_container_add ((GtkContainer*) _tmp56_, (GtkWidget*) _tmp57_);
		_tmp58_ = raw_developer_menu;
		_tmp59_ = raw_developer_camera_menu_item;
		gtk_container_add ((GtkContainer*) _tmp58_, (GtkWidget*) _tmp59_);
		_tmp60_ = raw_developer_menu_item;
		_tmp61_ = raw_developer_menu;
		gtk_menu_item_set_submenu (_tmp60_, _tmp61_);
		_tmp62_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_ADJUST_DATE_TIME_MENU);
		g_object_ref_sink (_tmp62_);
		adjust_datetime_menu_item = _tmp62_;
		_tmp63_ = page_get_action ((Page*) self, "AdjustDateTime");
		_data8_->adjust_datetime_action = _tmp63_;
		_tmp64_ = _data8_->adjust_datetime_action;
		_tmp65_ = adjust_datetime_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp64_, "sensitive", (GObject*) _tmp65_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp66_ = adjust_datetime_menu_item;
		g_signal_connect_data (_tmp66_, "activate", (GCallback) ____lambda87__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp67_ = g_strdup (APP_WINDOW_ACTION_PREFIX APP_WINDOW_ACTION_JUMP_TO_FILE);
		_tmp68_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("Show in Files"));
		gtk_actionable_set_action_name ((GtkActionable*) _tmp68_, _tmp67_);
		_g_free0 (_tmp67_);
		g_object_ref_sink (_tmp68_);
		open_menu_item = _tmp68_;
		_tmp69_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_NEW_EVENT_MENU);
		g_object_ref_sink (_tmp69_);
		new_event_menu_item = _tmp69_;
		_tmp70_ = page_get_action ((Page*) self, "NewEvent");
		_data8_->new_event_action = _tmp70_;
		_tmp71_ = _data8_->new_event_action;
		_tmp72_ = new_event_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp71_, "sensitive", (GObject*) _tmp72_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp73_ = new_event_menu_item;
		g_signal_connect_data (_tmp73_, "activate", (GCallback) ____lambda88__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp74_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (_ ("View Eve_nt for Photo"));
		g_object_ref_sink (_tmp74_);
		jump_event_menu_item = _tmp74_;
		_tmp75_ = page_get_common_action ((Page*) self, "CommonJumpToEvent", TRUE);
		_data8_->jump_event_action = _tmp75_;
		_tmp76_ = _data8_->jump_event_action;
		_tmp77_ = jump_event_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp76_, "sensitive", (GObject*) _tmp77_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp78_ = jump_event_menu_item;
		g_signal_connect_data (_tmp78_, "activate", (GCallback) ____lambda89__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp79_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_PRINT_MENU);
		g_object_ref_sink (_tmp79_);
		print_menu_item = _tmp79_;
		_tmp80_ = page_get_action ((Page*) self, "Print");
		_data8_->print_action = _tmp80_;
		_tmp81_ = _data8_->print_action;
		_tmp82_ = print_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp81_, "sensitive", (GObject*) _tmp82_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp83_ = print_menu_item;
		g_signal_connect_data (_tmp83_, "activate", (GCallback) ____lambda90__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp84_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_EXPORT_MENU);
		g_object_ref_sink (_tmp84_);
		export_menu_item = _tmp84_;
		_tmp85_ = page_get_action ((Page*) self, "Export");
		_data8_->export_action = _tmp85_;
		_tmp86_ = _data8_->export_action;
		_tmp87_ = export_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp86_, "sensitive", (GObject*) _tmp87_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp88_ = export_menu_item;
		g_signal_connect_data (_tmp88_, "activate", (GCallback) ____lambda91__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp89_ = g_strdup (APP_WINDOW_ACTION_PREFIX APP_WINDOW_ACTION_SET_WALLPAPER);
		_tmp90_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("Set as Wallpaper"));
		gtk_actionable_set_action_name ((GtkActionable*) _tmp90_, _tmp89_);
		_g_free0 (_tmp89_);
		g_object_ref_sink (_tmp90_);
		wallpaper_menuitem = _tmp90_;
		_tmp91_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (_ ("Other Actions"));
		g_object_ref_sink (_tmp91_);
		contractor_menu_item = _tmp91_;
		_tmp92_ = (GtkMenu*) gtk_menu_new ();
		g_object_ref_sink (_tmp92_);
		_g_object_unref0 (self->priv->contractor_menu);
		self->priv->contractor_menu = _tmp92_;
		_tmp93_ = contractor_menu_item;
		_tmp94_ = self->priv->contractor_menu;
		gtk_menu_item_set_submenu (_tmp93_, _tmp94_);
		_tmp95_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_REMOVE_FROM_LIBRARY_MENU);
		g_object_ref_sink (_tmp95_);
		remove_menu_item = _tmp95_;
		_tmp96_ = page_get_action ((Page*) self, "RemoveFromLibrary");
		_data8_->remove_action = _tmp96_;
		_tmp97_ = _data8_->remove_action;
		_tmp98_ = remove_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp97_, "sensitive", (GObject*) _tmp98_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp99_ = remove_menu_item;
		g_signal_connect_data (_tmp99_, "activate", (GCallback) ____lambda92__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp100_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_MOVE_TO_TRASH_MENU);
		g_object_ref_sink (_tmp100_);
		trash_menu_item = _tmp100_;
		_tmp101_ = page_get_action ((Page*) self, "MoveToTrash");
		_data8_->trash_action = _tmp101_;
		_tmp102_ = _data8_->trash_action;
		_tmp103_ = trash_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp102_, "sensitive", (GObject*) _tmp103_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp104_ = trash_menu_item;
		g_signal_connect_data (_tmp104_, "activate", (GCallback) ____lambda93__gtk_menu_item_activate, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
		_tmp105_ = self->priv->contractor_menu;
		_tmp106_ = print_menu_item;
		gtk_container_add ((GtkContainer*) _tmp105_, (GtkWidget*) _tmp106_);
		_tmp107_ = self->priv->contractor_menu;
		_tmp108_ = export_menu_item;
		gtk_container_add ((GtkContainer*) _tmp107_, (GtkWidget*) _tmp108_);
		_tmp109_ = self->priv->contractor_menu;
		_tmp110_ = wallpaper_menuitem;
		gtk_container_add ((GtkContainer*) _tmp109_, (GtkWidget*) _tmp110_);
		_tmp111_ = self->priv->item_context_menu;
		_tmp112_ = copy_images_menu_item;
		gtk_container_add ((GtkContainer*) _tmp111_, (GtkWidget*) _tmp112_);
		_tmp113_ = self->priv->item_context_menu;
		_tmp114_ = adjust_datetime_menu_item;
		gtk_container_add ((GtkContainer*) _tmp113_, (GtkWidget*) _tmp114_);
		_tmp115_ = self->priv->item_context_menu;
		_tmp116_ = duplicate_menu_item;
		gtk_container_add ((GtkContainer*) _tmp115_, (GtkWidget*) _tmp116_);
		_tmp117_ = self->priv->item_context_menu;
		_tmp118_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp118_);
		_tmp119_ = _tmp118_;
		gtk_container_add ((GtkContainer*) _tmp117_, (GtkWidget*) _tmp119_);
		_g_object_unref0 (_tmp119_);
		_tmp120_ = self->priv->item_context_menu;
		_tmp121_ = open_menu_item;
		gtk_container_add ((GtkContainer*) _tmp120_, (GtkWidget*) _tmp121_);
		_tmp122_ = self->priv->item_context_menu;
		_tmp123_ = contractor_menu_item;
		gtk_container_add ((GtkContainer*) _tmp122_, (GtkWidget*) _tmp123_);
		_tmp124_ = self->priv->item_context_menu;
		_tmp125_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp125_);
		_tmp126_ = _tmp125_;
		gtk_container_add ((GtkContainer*) _tmp124_, (GtkWidget*) _tmp126_);
		_g_object_unref0 (_tmp126_);
		_tmp127_ = self->priv->item_context_menu;
		_tmp128_ = copy_color_menu_item;
		gtk_container_add ((GtkContainer*) _tmp127_, (GtkWidget*) _tmp128_);
		_tmp129_ = self->priv->item_context_menu;
		_tmp130_ = paste_color_menu_item;
		gtk_container_add ((GtkContainer*) _tmp129_, (GtkWidget*) _tmp130_);
		_tmp131_ = self->priv->item_context_menu;
		_tmp132_ = revert_menu_item;
		gtk_container_add ((GtkContainer*) _tmp131_, (GtkWidget*) _tmp132_);
		_tmp133_ = self->priv->item_context_menu;
		_tmp134_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp134_);
		_tmp135_ = _tmp134_;
		gtk_container_add ((GtkContainer*) _tmp133_, (GtkWidget*) _tmp135_);
		_g_object_unref0 (_tmp135_);
		_tmp136_ = self->priv->item_context_menu;
		_tmp137_ = flag_menu_item;
		gtk_container_add ((GtkContainer*) _tmp136_, (GtkWidget*) _tmp137_);
		_tmp138_ = self->priv->item_context_menu;
		_tmp139_ = raw_developer_menu_item;
		gtk_container_add ((GtkContainer*) _tmp138_, (GtkWidget*) _tmp139_);
		_tmp140_ = self->priv->item_context_menu;
		_tmp141_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp141_);
		_tmp142_ = _tmp141_;
		gtk_container_add ((GtkContainer*) _tmp140_, (GtkWidget*) _tmp142_);
		_g_object_unref0 (_tmp142_);
		_tmp143_ = self->priv->item_context_menu;
		_tmp144_ = new_event_menu_item;
		gtk_container_add ((GtkContainer*) _tmp143_, (GtkWidget*) _tmp144_);
		_tmp145_ = self->priv->item_context_menu;
		_tmp146_ = jump_event_menu_item;
		gtk_container_add ((GtkContainer*) _tmp145_, (GtkWidget*) _tmp146_);
		_tmp147_ = self->priv->item_context_menu;
		_tmp148_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp148_);
		_tmp149_ = _tmp148_;
		gtk_container_add ((GtkContainer*) _tmp147_, (GtkWidget*) _tmp149_);
		_g_object_unref0 (_tmp149_);
		_tmp150_ = self->priv->item_context_menu;
		_tmp151_ = metadata_menu_item;
		gtk_container_add ((GtkContainer*) _tmp150_, (GtkWidget*) _tmp151_);
		_tmp152_ = self->priv->item_context_menu;
		_tmp153_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp153_);
		_tmp154_ = _tmp153_;
		gtk_container_add ((GtkContainer*) _tmp152_, (GtkWidget*) _tmp154_);
		_g_object_unref0 (_tmp154_);
		_tmp155_ = self->priv->item_context_menu;
		_tmp156_ = remove_menu_item;
		gtk_container_add ((GtkContainer*) _tmp155_, (GtkWidget*) _tmp156_);
		_tmp157_ = self->priv->item_context_menu;
		_tmp158_ = trash_menu_item;
		gtk_container_add ((GtkContainer*) _tmp157_, (GtkWidget*) _tmp158_);
		_tmp159_ = self->priv->item_context_menu;
		gtk_widget_show_all ((GtkWidget*) _tmp159_);
		_tmp160_ = page_get_view ((Page*) self);
		_tmp161_ = _tmp160_;
		_tmp162_ = view_collection_get_selected_at (_tmp161_, 0);
		_tmp163_ = _tmp162_;
		_tmp164_ = data_view_get_source (_tmp163_);
		_tmp165_ = _tmp164_;
		_tmp166_ = _g_object_ref0 (_tmp165_);
		_tmp167_ = _tmp166_;
		_g_object_unref0 (_tmp163_);
		_data_collection_unref0 (_tmp161_);
		source = _tmp167_;
		_tmp169_ = source;
		if (_tmp169_ != NULL) {
			DataSource* _tmp170_;
			_tmp170_ = source;
			_tmp168_ = IS_PHOTO (_tmp170_);
		} else {
			_tmp168_ = FALSE;
		}
		if (_tmp168_) {
			GFile* file = NULL;
			DataSource* _tmp171_;
			GFile* _tmp172_;
			GtkMenuItem* _tmp173_;
			GFile* _tmp174_;
			gchar* _tmp175_;
			gchar* _tmp176_;
			GVariant* _tmp177_;
			GVariant* _tmp178_;
			_tmp171_ = source;
			_tmp172_ = media_source_get_file ((MediaSource*) G_TYPE_CHECK_INSTANCE_CAST (_tmp171_, TYPE_PHOTO, Photo));
			file = _tmp172_;
			_tmp173_ = wallpaper_menuitem;
			_tmp174_ = file;
			_tmp175_ = g_file_get_uri (_tmp174_);
			_tmp176_ = _tmp175_;
			_tmp177_ = g_variant_new_string (_tmp176_);
			g_variant_ref_sink (_tmp177_);
			_tmp178_ = _tmp177_;
			g_object_set ((GtkActionable*) _tmp173_, "action-target", _tmp178_, NULL);
			_g_variant_unref0 (_tmp178_);
			_g_free0 (_tmp176_);
			_g_object_unref0 (file);
		}
		_g_object_unref0 (source);
		_g_object_unref0 (trash_menu_item);
		_g_object_unref0 (remove_menu_item);
		_g_object_unref0 (contractor_menu_item);
		_g_object_unref0 (wallpaper_menuitem);
		_g_object_unref0 (export_menu_item);
		_g_object_unref0 (print_menu_item);
		_g_object_unref0 (jump_event_menu_item);
		_g_object_unref0 (new_event_menu_item);
		_g_object_unref0 (open_menu_item);
		_g_object_unref0 (adjust_datetime_menu_item);
		_g_object_unref0 (raw_developer_menu);
		_g_object_unref0 (raw_developer_action);
		_g_object_unref0 (raw_developer_menu_item);
		_g_object_unref0 (raw_developer_camera_menu_item);
		_g_object_unref0 (raw_developer_app_menu_item);
		_g_object_unref0 (flag_menu_item);
		_g_object_unref0 (paste_color_menu_item);
		_g_object_unref0 (copy_color_menu_item);
		_g_object_unref0 (duplicate_menu_item);
		_g_object_unref0 (revert_menu_item);
		_g_object_unref0 (metadata_action);
		_g_object_unref0 (metadata_menu_item);
		_g_object_unref0 (copy_images_menu_item);
		block8_data_unref (_data8_);
		_data8_ = NULL;
	}
	_tmp179_ = self->priv->contractor_menu;
	page_populate_contractor_menu ((Page*) self, _tmp179_);
	_tmp180_ = self->priv->item_context_menu;
	_tmp181_ = _g_object_ref0 (_tmp180_);
	result = _tmp181_;
	return result;
}

static void
_collection_page_on_print_gcallback (GtkAction* action,
                                     gpointer self)
{
	collection_page_on_print ((CollectionPage*) self);
}

static void
_collection_page_on_rotate_clockwise_gcallback (GtkAction* action,
                                                gpointer self)
{
	collection_page_on_rotate_clockwise ((CollectionPage*) self);
}

static void
_collection_page_on_rotate_counterclockwise_gcallback (GtkAction* action,
                                                       gpointer self)
{
	collection_page_on_rotate_counterclockwise ((CollectionPage*) self);
}

static void
_collection_page_on_flip_horizontally_gcallback (GtkAction* action,
                                                 gpointer self)
{
	collection_page_on_flip_horizontally ((CollectionPage*) self);
}

static void
_collection_page_on_flip_vertically_gcallback (GtkAction* action,
                                               gpointer self)
{
	collection_page_on_flip_vertically ((CollectionPage*) self);
}

static void
_collection_page_on_copy_adjustments_gcallback (GtkAction* action,
                                                gpointer self)
{
	collection_page_on_copy_adjustments ((CollectionPage*) self);
}

static void
_collection_page_on_paste_adjustments_gcallback (GtkAction* action,
                                                 gpointer self)
{
	collection_page_on_paste_adjustments ((CollectionPage*) self);
}

static void
_collection_page_on_revert_gcallback (GtkAction* action,
                                      gpointer self)
{
	collection_page_on_revert ((CollectionPage*) self);
}

static void
_collection_page_on_duplicate_photo_gcallback (GtkAction* action,
                                               gpointer self)
{
	collection_page_on_duplicate_photo ((CollectionPage*) self);
}

static void
_collection_page_on_adjust_date_time_gcallback (GtkAction* action,
                                                gpointer self)
{
	collection_page_on_adjust_date_time ((CollectionPage*) self);
}

static void
_collection_page_on_enhance_gcallback (GtkAction* action,
                                       gpointer self)
{
	collection_page_on_enhance ((CollectionPage*) self);
}

static void
_collection_page_on_slideshow_gcallback (GtkAction* action,
                                         gpointer self)
{
	collection_page_on_slideshow ((CollectionPage*) self);
}

static void
_collection_page_on_copy_images_gcallback (GtkAction* action,
                                           gpointer self)
{
	collection_page_on_copy_images ((CollectionPage*) self);
}

static void
_vala_array_add113 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add114 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add115 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add116 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add117 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add118 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add119 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add120 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add121 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add122 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add123 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add124 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add125 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add126 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
_vala_array_add127 (GtkActionEntry* * array,
                    gint* length,
                    gint* size,
                    const GtkActionEntry* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GtkActionEntry, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static GtkActionEntry*
collection_page_real_init_collect_action_entries (Page* base,
                                                  gint* result_length1)
{
	CollectionPage * self;
	GtkActionEntry print = {0};
	GtkActionEntry _tmp0_ = {0};
	GtkActionEntry rotate_right = {0};
	GtkActionEntry _tmp1_ = {0};
	GtkActionEntry rotate_left = {0};
	GtkActionEntry _tmp2_ = {0};
	GtkActionEntry hflip = {0};
	GtkActionEntry _tmp3_ = {0};
	GtkActionEntry vflip = {0};
	GtkActionEntry _tmp4_ = {0};
	GtkActionEntry copy_adjustments = {0};
	GtkActionEntry _tmp5_ = {0};
	GtkActionEntry paste_adjustments = {0};
	GtkActionEntry _tmp6_ = {0};
	GtkActionEntry revert = {0};
	GtkActionEntry _tmp7_ = {0};
	GtkActionEntry duplicate = {0};
	GtkActionEntry _tmp8_ = {0};
	GtkActionEntry adjust_date_time = {0};
	GtkActionEntry _tmp9_ = {0};
	GtkActionEntry open_with = {0};
	GtkActionEntry _tmp10_ = {0};
	GtkActionEntry open_with_raw = {0};
	GtkActionEntry _tmp11_ = {0};
	GtkActionEntry enhance = {0};
	GtkActionEntry _tmp12_ = {0};
	GtkActionEntry slideshow = {0};
	GtkActionEntry _tmp13_ = {0};
	GtkActionEntry copy = {0};
	GtkActionEntry _tmp14_ = {0};
	GtkActionEntry* actions = NULL;
	gint _tmp15_ = 0;
	GtkActionEntry* _tmp16_;
	gint actions_length1;
	gint _actions_size_;
	GtkActionEntry _tmp17_;
	GtkActionEntry _tmp18_;
	GtkActionEntry _tmp19_;
	GtkActionEntry _tmp20_;
	GtkActionEntry _tmp21_;
	GtkActionEntry _tmp22_;
	GtkActionEntry _tmp23_;
	GtkActionEntry _tmp24_;
	GtkActionEntry _tmp25_;
	GtkActionEntry _tmp26_;
	GtkActionEntry _tmp27_;
	GtkActionEntry _tmp28_;
	GtkActionEntry _tmp29_;
	GtkActionEntry _tmp30_;
	GtkActionEntry _tmp31_;
	GtkActionEntry* _tmp32_;
	gint _tmp32__length1;
	GtkActionEntry* result;
	self = (CollectionPage*) base;
	_tmp0_.name = "Print";
	_tmp0_.stock_id = NULL;
	_tmp0_.label = NULL;
	_tmp0_.accelerator = "<Ctrl>P";
	_tmp0_.tooltip = NULL;
	_tmp0_.callback = (GCallback) _collection_page_on_print_gcallback;
	print = _tmp0_;
	_tmp1_.name = "RotateClockwise";
	_tmp1_.stock_id = NULL;
	_tmp1_.label = NULL;
	_tmp1_.accelerator = "<Ctrl>R";
	_tmp1_.tooltip = NULL;
	_tmp1_.callback = (GCallback) _collection_page_on_rotate_clockwise_gcallback;
	rotate_right = _tmp1_;
	_tmp2_.name = "RotateCounterclockwise";
	_tmp2_.stock_id = NULL;
	_tmp2_.label = NULL;
	_tmp2_.accelerator = "<Ctrl><Shift>R";
	_tmp2_.tooltip = NULL;
	_tmp2_.callback = (GCallback) _collection_page_on_rotate_counterclockwise_gcallback;
	rotate_left = _tmp2_;
	_tmp3_.name = "FlipHorizontally";
	_tmp3_.stock_id = NULL;
	_tmp3_.label = NULL;
	_tmp3_.accelerator = NULL;
	_tmp3_.tooltip = NULL;
	_tmp3_.callback = (GCallback) _collection_page_on_flip_horizontally_gcallback;
	hflip = _tmp3_;
	_tmp4_.name = "FlipVertically";
	_tmp4_.stock_id = NULL;
	_tmp4_.label = NULL;
	_tmp4_.accelerator = NULL;
	_tmp4_.tooltip = NULL;
	_tmp4_.callback = (GCallback) _collection_page_on_flip_vertically_gcallback;
	vflip = _tmp4_;
	_tmp5_.name = "CopyColorAdjustments";
	_tmp5_.stock_id = NULL;
	_tmp5_.label = NULL;
	_tmp5_.accelerator = "<Ctrl><Shift>C";
	_tmp5_.tooltip = NULL;
	_tmp5_.callback = (GCallback) _collection_page_on_copy_adjustments_gcallback;
	copy_adjustments = _tmp5_;
	_tmp6_.name = "PasteColorAdjustments";
	_tmp6_.stock_id = NULL;
	_tmp6_.label = NULL;
	_tmp6_.accelerator = "<Ctrl><Shift>V";
	_tmp6_.tooltip = NULL;
	_tmp6_.callback = (GCallback) _collection_page_on_paste_adjustments_gcallback;
	paste_adjustments = _tmp6_;
	_tmp7_.name = "Revert";
	_tmp7_.stock_id = NULL;
	_tmp7_.label = NULL;
	_tmp7_.accelerator = NULL;
	_tmp7_.tooltip = NULL;
	_tmp7_.callback = (GCallback) _collection_page_on_revert_gcallback;
	revert = _tmp7_;
	_tmp8_.name = "Duplicate";
	_tmp8_.stock_id = NULL;
	_tmp8_.label = NULL;
	_tmp8_.accelerator = "<Ctrl>D";
	_tmp8_.tooltip = NULL;
	_tmp8_.callback = (GCallback) _collection_page_on_duplicate_photo_gcallback;
	duplicate = _tmp8_;
	_tmp9_.name = "AdjustDateTime";
	_tmp9_.stock_id = NULL;
	_tmp9_.label = NULL;
	_tmp9_.accelerator = NULL;
	_tmp9_.tooltip = NULL;
	_tmp9_.callback = (GCallback) _collection_page_on_adjust_date_time_gcallback;
	adjust_date_time = _tmp9_;
	_tmp10_.name = "OpenWith";
	_tmp10_.stock_id = NULL;
	_tmp10_.label = NULL;
	_tmp10_.accelerator = NULL;
	_tmp10_.tooltip = NULL;
	_tmp10_.callback = (GCallback) NULL;
	open_with = _tmp10_;
	_tmp11_.name = "OpenWithRaw";
	_tmp11_.stock_id = NULL;
	_tmp11_.label = NULL;
	_tmp11_.accelerator = NULL;
	_tmp11_.tooltip = NULL;
	_tmp11_.callback = (GCallback) NULL;
	open_with_raw = _tmp11_;
	_tmp12_.name = "Enhance";
	_tmp12_.stock_id = NULL;
	_tmp12_.label = NULL;
	_tmp12_.accelerator = "<Ctrl>E";
	_tmp12_.tooltip = NULL;
	_tmp12_.callback = (GCallback) _collection_page_on_enhance_gcallback;
	enhance = _tmp12_;
	_tmp13_.name = "Slideshow";
	_tmp13_.stock_id = NULL;
	_tmp13_.label = NULL;
	_tmp13_.accelerator = "F5";
	_tmp13_.tooltip = NULL;
	_tmp13_.callback = (GCallback) _collection_page_on_slideshow_gcallback;
	slideshow = _tmp13_;
	_tmp14_.name = "CopyImages";
	_tmp14_.stock_id = NULL;
	_tmp14_.label = NULL;
	_tmp14_.accelerator = "<Ctrl>C";
	_tmp14_.tooltip = NULL;
	_tmp14_.callback = (GCallback) _collection_page_on_copy_images_gcallback;
	copy = _tmp14_;
	_tmp16_ = PAGE_CLASS (collection_page_parent_class)->init_collect_action_entries ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MEDIA_PAGE, MediaPage), &_tmp15_);
	actions = _tmp16_;
	actions_length1 = _tmp15_;
	_actions_size_ = actions_length1;
	_tmp17_ = copy;
	_vala_array_add113 (&actions, &actions_length1, &_actions_size_, &_tmp17_);
	_tmp18_ = print;
	_vala_array_add114 (&actions, &actions_length1, &_actions_size_, &_tmp18_);
	_tmp19_ = rotate_right;
	_vala_array_add115 (&actions, &actions_length1, &_actions_size_, &_tmp19_);
	_tmp20_ = rotate_left;
	_vala_array_add116 (&actions, &actions_length1, &_actions_size_, &_tmp20_);
	_tmp21_ = hflip;
	_vala_array_add117 (&actions, &actions_length1, &_actions_size_, &_tmp21_);
	_tmp22_ = vflip;
	_vala_array_add118 (&actions, &actions_length1, &_actions_size_, &_tmp22_);
	_tmp23_ = copy_adjustments;
	_vala_array_add119 (&actions, &actions_length1, &_actions_size_, &_tmp23_);
	_tmp24_ = paste_adjustments;
	_vala_array_add120 (&actions, &actions_length1, &_actions_size_, &_tmp24_);
	_tmp25_ = revert;
	_vala_array_add121 (&actions, &actions_length1, &_actions_size_, &_tmp25_);
	_tmp26_ = duplicate;
	_vala_array_add122 (&actions, &actions_length1, &_actions_size_, &_tmp26_);
	_tmp27_ = adjust_date_time;
	_vala_array_add123 (&actions, &actions_length1, &_actions_size_, &_tmp27_);
	_tmp28_ = open_with;
	_vala_array_add124 (&actions, &actions_length1, &_actions_size_, &_tmp28_);
	_tmp29_ = open_with_raw;
	_vala_array_add125 (&actions, &actions_length1, &_actions_size_, &_tmp29_);
	_tmp30_ = enhance;
	_vala_array_add126 (&actions, &actions_length1, &_actions_size_, &_tmp30_);
	_tmp31_ = slideshow;
	_vala_array_add127 (&actions, &actions_length1, &_actions_size_, &_tmp31_);
	_tmp32_ = actions;
	_tmp32__length1 = actions_length1;
	if (result_length1) {
		*result_length1 = _tmp32__length1;
	}
	result = _tmp32_;
	return result;
}

void
collection_page_set_action_details (CollectionPage* self,
                                    const gchar* name,
                                    const gchar* label,
                                    const gchar* tooltip,
                                    gboolean sensitive)
{
	GtkAction* action = NULL;
	GtkAction* _tmp0_;
	GtkAction* _tmp1_;
	GtkAction* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = page_get_action ((Page*) self, name);
	action = _tmp0_;
	_tmp1_ = action;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (action);
		return;
	}
	if (label != NULL) {
		GtkAction* _tmp2_;
		_tmp2_ = action;
		gtk_action_set_label (_tmp2_, label);
	}
	if (tooltip != NULL) {
		GtkAction* _tmp3_;
		_tmp3_ = action;
		gtk_action_set_tooltip (_tmp3_, tooltip);
	}
	_tmp4_ = action;
	gtk_action_set_sensitive (_tmp4_, sensitive);
	_g_object_unref0 (action);
}

static guint8*
g_string_get_data (GString* self,
                   gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	const gchar* _tmp0_;
	gint res_length1;
	gint _res_size_;
	guint8* _tmp1_;
	gint _tmp1__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->str;
	res = (guint8*) _tmp0_;
	res_length1 = -1;
	_res_size_ = res_length1;
	res_length1 = (gint) self->len;
	_tmp1_ = res;
	_tmp1__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

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

void
collection_page_get_image_data_for_clipboard (GtkClipboard* cb,
                                              GtkSelectionData* sd,
                                              guint info,
                                              void* parent)
{
	GList* _tmp0_;
	g_return_if_fail (cb != NULL);
	g_return_if_fail (sd != NULL);
	_tmp0_ = collection_page_copied_photos;
	if (_tmp0_ == NULL) {
		g_critical ("CollectionPage.vala:312: Attempt to copy image but data for clipboard " \
"is null");
		return;
	}
	switch (info) {
		case COLLECTION_PAGE_TARGET_TYPE_GNOME_COPIED_FILES:
		{
			GString* sb = NULL;
			GString* _tmp1_;
			GList* _tmp2_;
			GString* _tmp11_;
			guint8* _tmp12_;
			gint _tmp12__length1;
			gint _tmp13_ = 0;
			guint8* _tmp14_;
			gint _tmp14__length1;
			_tmp1_ = g_string_new ("copy ");
			sb = _tmp1_;
			_tmp2_ = collection_page_copied_photos;
			{
				GList* photo_collection = NULL;
				GList* photo_it = NULL;
				photo_collection = _tmp2_;
				for (photo_it = photo_collection; photo_it != NULL; photo_it = photo_it->next) {
					Photo* _tmp3_;
					Photo* photo = NULL;
					_tmp3_ = _g_object_ref0 ((Photo*) photo_it->data);
					photo = _tmp3_;
					{
						GString* _tmp4_;
						GString* _tmp5_;
						Photo* _tmp6_;
						GFile* _tmp7_;
						GFile* _tmp8_;
						gchar* _tmp9_;
						gchar* _tmp10_;
						_tmp4_ = sb;
						g_string_append (_tmp4_, "\r\n");
						_tmp5_ = sb;
						_tmp6_ = photo;
						_tmp7_ = media_source_get_file ((MediaSource*) _tmp6_);
						_tmp8_ = _tmp7_;
						_tmp9_ = g_file_get_uri (_tmp8_);
						_tmp10_ = _tmp9_;
						g_string_append (_tmp5_, _tmp10_);
						_g_free0 (_tmp10_);
						_g_object_unref0 (_tmp8_);
						_g_object_unref0 (photo);
					}
				}
			}
			_tmp11_ = sb;
			_tmp12_ = g_string_get_data (_tmp11_, &_tmp13_);
			_tmp12__length1 = _tmp13_;
			_tmp14_ = _tmp12_;
			_tmp14__length1 = _tmp12__length1;
			gtk_selection_data_set (sd, gtk_selection_data_get_target (sd), 8, _tmp14_, (gint) _tmp14__length1);
			_g_string_free0 (sb);
			break;
		}
		case COLLECTION_PAGE_TARGET_TYPE_TEXT_URI_LIST:
		{
			gchar** uris = NULL;
			gchar** _tmp15_;
			gint uris_length1;
			gint _uris_size_;
			GList* _tmp16_;
			gchar** _tmp22_;
			gint _tmp22__length1;
			_tmp15_ = g_new0 (gchar*, 0 + 1);
			uris = _tmp15_;
			uris_length1 = 0;
			_uris_size_ = uris_length1;
			_tmp16_ = collection_page_copied_photos;
			{
				GList* photo_collection = NULL;
				GList* photo_it = NULL;
				photo_collection = _tmp16_;
				for (photo_it = photo_collection; photo_it != NULL; photo_it = photo_it->next) {
					Photo* _tmp17_;
					Photo* photo = NULL;
					_tmp17_ = _g_object_ref0 ((Photo*) photo_it->data);
					photo = _tmp17_;
					{
						Photo* _tmp18_;
						GFile* _tmp19_;
						GFile* _tmp20_;
						gchar* _tmp21_;
						_tmp18_ = photo;
						_tmp19_ = media_source_get_file ((MediaSource*) _tmp18_);
						_tmp20_ = _tmp19_;
						_tmp21_ = g_file_get_uri (_tmp20_);
						_vala_array_add128 (&uris, &uris_length1, &_uris_size_, _tmp21_);
						_g_object_unref0 (_tmp20_);
						_g_object_unref0 (photo);
					}
				}
			}
			_tmp22_ = uris;
			_tmp22__length1 = uris_length1;
			gtk_selection_data_set_uris (sd, _tmp22_);
			uris = (_vala_array_free (uris, uris_length1, (GDestroyNotify) g_free), NULL);
			break;
		}
		default:
		{
			g_warning ("CollectionPage.vala:337: Unknown target type");
			break;
		}
	}
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

void
collection_page_clear_data_for_clipboard (GtkClipboard* cb,
                                          void* parent)
{
	g_return_if_fail (cb != NULL);
	(collection_page_copied_photos == NULL) ? NULL : (collection_page_copied_photos = (_g_list_free__g_object_unref0_ (collection_page_copied_photos), NULL));
	collection_page_copied_photos = NULL;
}

static void
_collection_page_get_image_data_for_clipboard_gtk_clipboard_get_func (GtkClipboard* clipboard,
                                                                      GtkSelectionData* selection_data,
                                                                      guint info,
                                                                      void* user_data_or_owner)
{
	collection_page_get_image_data_for_clipboard (clipboard, selection_data, info, user_data_or_owner);
}

static void
_collection_page_clear_data_for_clipboard_gtk_clipboard_clear_func (GtkClipboard* clipboard,
                                                                    void* user_data_or_owner)
{
	collection_page_clear_data_for_clipboard (clipboard, user_data_or_owner);
}

static void
collection_page_on_copy_images (CollectionPage* self)
{
	GtkClipboard* _tmp0_;
	GList* _tmp17_;
	GtkClipboard* _tmp18_;
	g_return_if_fail (self != NULL);
	_tmp0_ = collection_page_clipboard;
	gtk_clipboard_clear (_tmp0_);
	{
		GeeList* _source_list = NULL;
		ViewCollection* _tmp1_;
		ViewCollection* _tmp2_;
		GeeList* _tmp3_;
		GeeList* _tmp4_;
		gint _source_size = 0;
		GeeList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _source_index = 0;
		_tmp1_ = page_get_view ((Page*) self);
		_tmp2_ = _tmp1_;
		_tmp3_ = view_collection_get_selected_sources (_tmp2_);
		_tmp4_ = _tmp3_;
		_data_collection_unref0 (_tmp2_);
		_source_list = _tmp4_;
		_tmp5_ = _source_list;
		_tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_source_size = _tmp7_;
		_source_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			DataSource* source = NULL;
			GeeList* _tmp10_;
			gpointer _tmp11_;
			Photo* photo = NULL;
			DataSource* _tmp12_;
			Photo* _tmp13_;
			Photo* _tmp14_;
			_source_index = _source_index + 1;
			_tmp8_ = _source_index;
			_tmp9_ = _source_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _source_list;
			_tmp11_ = gee_list_get (_tmp10_, _source_index);
			source = (DataSource*) _tmp11_;
			_tmp12_ = source;
			_tmp13_ = _g_object_ref0 (IS_PHOTO (_tmp12_) ? ((Photo*) _tmp12_) : NULL);
			photo = _tmp13_;
			_tmp14_ = photo;
			if (_tmp14_ != NULL) {
				Photo* _tmp15_;
				Photo* _tmp16_;
				_tmp15_ = photo;
				_tmp16_ = _g_object_ref0 (_tmp15_);
				collection_page_copied_photos = g_list_append (collection_page_copied_photos, _tmp16_);
			}
			_g_object_unref0 (photo);
			_g_object_unref0 (source);
		}
		_g_object_unref0 (_source_list);
	}
	_tmp17_ = collection_page_copied_photos;
	if (_tmp17_ == NULL) {
		return;
	}
	_tmp18_ = collection_page_clipboard;
	gtk_clipboard_set_with_owner (_tmp18_, COLLECTION_PAGE_COPY_TARGETS, (guint) G_N_ELEMENTS (COLLECTION_PAGE_COPY_TARGETS), _collection_page_get_image_data_for_clipboard_gtk_clipboard_get_func, _collection_page_clear_data_for_clipboard_gtk_clipboard_clear_func, (GObject*) self);
}

static gboolean
collection_page_selection_has_video (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	GeeList* _tmp2_;
	GeeCollection* _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_sources (_tmp1_);
	_tmp3_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_COLLECTION, GeeCollection);
	_tmp4_ = media_source_collection_has_video (_tmp3_);
	_g_object_unref0 (_tmp3_);
	_data_collection_unref0 (_tmp1_);
	result = _tmp4_;
	return result;
}

static gboolean
collection_page_page_has_photo (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	GeeCollection* _tmp2_;
	GeeCollection* _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_sources (_tmp1_);
	_tmp3_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_COLLECTION, GeeCollection);
	_tmp4_ = media_source_collection_has_photo (_tmp3_);
	_g_object_unref0 (_tmp3_);
	_data_collection_unref0 (_tmp1_);
	result = _tmp4_;
	return result;
}

static gboolean
collection_page_selection_has_photo (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	GeeList* _tmp2_;
	GeeCollection* _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_sources (_tmp1_);
	_tmp3_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_COLLECTION, GeeCollection);
	_tmp4_ = media_source_collection_has_photo (_tmp3_);
	_g_object_unref0 (_tmp3_);
	_data_collection_unref0 (_tmp1_);
	result = _tmp4_;
	return result;
}

static void
collection_page_real_init_actions (Page* base,
                                   gint selected_count,
                                   gint count)
{
	CollectionPage * self;
	self = (CollectionPage*) base;
	PAGE_CLASS (collection_page_parent_class)->init_actions ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MEDIA_PAGE, MediaPage), selected_count, count);
}

static void
collection_page_real_update_actions (Page* base,
                                     gint selected_count,
                                     gint count)
{
	CollectionPage * self;
	gboolean one_selected = FALSE;
	gboolean has_selected = FALSE;
	gboolean primary_is_video = FALSE;
	gboolean selection_has_videos = FALSE;
	gboolean page_has_photos = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_ = FALSE;
	gboolean _tmp18_ = FALSE;
	gboolean _tmp19_ = FALSE;
	gboolean _tmp26_ = FALSE;
	gboolean _tmp27_ = FALSE;
	gboolean _tmp28_ = FALSE;
	gboolean _tmp29_ = FALSE;
	gboolean _tmp30_ = FALSE;
	gboolean _tmp31_ = FALSE;
	gboolean _tmp32_ = FALSE;
	gboolean _tmp33_ = FALSE;
	GtkToggleButton* _tmp34_;
	self = (CollectionPage*) base;
	PAGE_CLASS (collection_page_parent_class)->update_actions ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MEDIA_PAGE, MediaPage), selected_count, count);
	one_selected = selected_count == 1;
	has_selected = selected_count > 0;
	primary_is_video = FALSE;
	if (has_selected) {
		ViewCollection* _tmp0_;
		ViewCollection* _tmp1_;
		DataView* _tmp2_;
		DataView* _tmp3_;
		DataSource* _tmp4_;
		DataSource* _tmp5_;
		gboolean _tmp6_;
		_tmp0_ = page_get_view ((Page*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = view_collection_get_selected_at (_tmp1_, 0);
		_tmp3_ = _tmp2_;
		_tmp4_ = data_view_get_source (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = IS_VIDEO (_tmp5_);
		_g_object_unref0 (_tmp3_);
		_data_collection_unref0 (_tmp1_);
		if (_tmp6_) {
			primary_is_video = TRUE;
		}
	}
	selection_has_videos = collection_page_selection_has_video (self);
	page_has_photos = collection_page_page_has_photo (self);
	if (has_selected) {
		_tmp7_ = !selection_has_videos;
	} else {
		_tmp7_ = FALSE;
	}
	page_set_action_sensitive ((Page*) self, "Duplicate", _tmp7_);
	page_set_action_visible ((Page*) self, "OpenWith", !primary_is_video);
	page_set_action_sensitive ((Page*) self, "OpenWith", one_selected);
	if (one_selected) {
		_tmp9_ = !primary_is_video;
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		ViewCollection* _tmp10_;
		ViewCollection* _tmp11_;
		DataView* _tmp12_;
		DataView* _tmp13_;
		DataSource* _tmp14_;
		DataSource* _tmp15_;
		_tmp10_ = page_get_view ((Page*) self);
		_tmp11_ = _tmp10_;
		_tmp12_ = view_collection_get_selected_at (_tmp11_, 0);
		_tmp13_ = _tmp12_;
		_tmp14_ = data_view_get_source (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp8_ = photo_get_master_file_format (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, TYPE_PHOTO, Photo)) == PHOTO_FILE_FORMAT_RAW;
		_g_object_unref0 (_tmp13_);
		_data_collection_unref0 (_tmp11_);
	} else {
		_tmp8_ = FALSE;
	}
	page_set_action_visible ((Page*) self, "OpenWithRaw", _tmp8_);
	if (!selection_has_videos) {
		_tmp16_ = collection_page_can_revert_selected (self);
	} else {
		_tmp16_ = FALSE;
	}
	page_set_action_sensitive ((Page*) self, "Revert", _tmp16_);
	if (!selection_has_videos) {
		_tmp17_ = has_selected;
	} else {
		_tmp17_ = FALSE;
	}
	page_set_action_sensitive ((Page*) self, "Enhance", _tmp17_);
	if (!selection_has_videos) {
		_tmp19_ = one_selected;
	} else {
		_tmp19_ = FALSE;
	}
	if (_tmp19_) {
		ViewCollection* _tmp20_;
		ViewCollection* _tmp21_;
		DataView* _tmp22_;
		DataView* _tmp23_;
		DataSource* _tmp24_;
		DataSource* _tmp25_;
		_tmp20_ = page_get_view ((Page*) self);
		_tmp21_ = _tmp20_;
		_tmp22_ = view_collection_get_selected_at (_tmp21_, 0);
		_tmp23_ = _tmp22_;
		_tmp24_ = data_view_get_source (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp18_ = photo_has_color_adjustments (G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, TYPE_PHOTO, Photo));
		_g_object_unref0 (_tmp23_);
		_data_collection_unref0 (_tmp21_);
	} else {
		_tmp18_ = FALSE;
	}
	page_set_action_sensitive ((Page*) self, "CopyColorAdjustments", _tmp18_);
	if (!selection_has_videos) {
		_tmp27_ = has_selected;
	} else {
		_tmp27_ = FALSE;
	}
	if (_tmp27_) {
		_tmp26_ = pixel_transformation_bundle_has_copied_color_adjustments ();
	} else {
		_tmp26_ = FALSE;
	}
	page_set_action_sensitive ((Page*) self, "PasteColorAdjustments", _tmp26_);
	if (!selection_has_videos) {
		_tmp28_ = has_selected;
	} else {
		_tmp28_ = FALSE;
	}
	page_set_action_sensitive ((Page*) self, "RotateClockwise", _tmp28_);
	if (!selection_has_videos) {
		_tmp29_ = has_selected;
	} else {
		_tmp29_ = FALSE;
	}
	page_set_action_sensitive ((Page*) self, "RotateCounterclockwise", _tmp29_);
	if (!selection_has_videos) {
		_tmp30_ = has_selected;
	} else {
		_tmp30_ = FALSE;
	}
	page_set_action_sensitive ((Page*) self, "FlipHorizontally", _tmp30_);
	if (!selection_has_videos) {
		_tmp31_ = has_selected;
	} else {
		_tmp31_ = FALSE;
	}
	page_set_action_sensitive ((Page*) self, "FlipVertically", _tmp31_);
	page_set_action_sensitive ((Page*) self, "AdjustDateTime", has_selected);
	page_set_action_sensitive ((Page*) self, "NewEvent", has_selected);
	if (page_has_photos) {
		_tmp32_ = !primary_is_video;
	} else {
		_tmp32_ = FALSE;
	}
	page_set_action_sensitive ((Page*) self, "Slideshow", _tmp32_);
	if (!selection_has_videos) {
		_tmp33_ = has_selected;
	} else {
		_tmp33_ = FALSE;
	}
	page_set_action_sensitive ((Page*) self, "Print", _tmp33_);
	_tmp34_ = self->priv->enhance_button;
	if (_tmp34_ != NULL) {
		gboolean _tmp35_ = FALSE;
		GtkToggleButton* _tmp36_;
		if (!selection_has_videos) {
			_tmp35_ = has_selected;
		} else {
			_tmp35_ = FALSE;
		}
		_tmp36_ = self->priv->enhance_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp36_, _tmp35_);
		collection_page_update_enhance_toggled (self);
	}
}

static void
collection_page_on_photos_altered (CollectionPage* self,
                                   GeeMap* altered)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (altered != NULL);
	{
		GeeIterator* _object_it = NULL;
		GeeSet* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeIterator* _tmp3_;
		GeeIterator* _tmp4_;
		_tmp0_ = gee_map_get_keys (altered);
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		_object_it = _tmp4_;
		while (TRUE) {
			GeeIterator* _tmp5_;
			DataObject* object = NULL;
			GeeIterator* _tmp6_;
			gpointer _tmp7_;
			DataView* view = NULL;
			DataObject* _tmp8_;
			DataView* _tmp9_;
			gboolean _tmp10_ = FALSE;
			DataView* _tmp11_;
			LibraryPhoto* photo = NULL;
			DataView* _tmp15_;
			DataSource* _tmp16_;
			DataSource* _tmp17_;
			LibraryPhoto* _tmp18_;
			LibraryPhoto* _tmp19_;
			LibraryPhoto* _tmp20_;
			_tmp5_ = _object_it;
			if (!gee_iterator_next (_tmp5_)) {
				break;
			}
			_tmp6_ = _object_it;
			_tmp7_ = gee_iterator_get (_tmp6_);
			object = (DataObject*) _tmp7_;
			_tmp8_ = object;
			_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, TYPE_DATA_VIEW, DataView));
			view = _tmp9_;
			_tmp11_ = view;
			if (!data_view_is_selected (_tmp11_)) {
				_tmp10_ = TRUE;
			} else {
				DataView* _tmp12_;
				gpointer _tmp13_;
				Alteration* _tmp14_;
				_tmp12_ = view;
				_tmp13_ = gee_map_get (altered, (DataObject*) _tmp12_);
				_tmp14_ = (Alteration*) _tmp13_;
				_tmp10_ = !alteration_has_subject (_tmp14_, "image");
				_alteration_unref0 (_tmp14_);
			}
			if (_tmp10_) {
				_g_object_unref0 (view);
				_g_object_unref0 (object);
				continue;
			}
			_tmp15_ = view;
			_tmp16_ = data_view_get_source (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = _g_object_ref0 (IS_LIBRARY_PHOTO (_tmp17_) ? ((LibraryPhoto*) _tmp17_) : NULL);
			photo = _tmp18_;
			_tmp19_ = photo;
			if (_tmp19_ == NULL) {
				_g_object_unref0 (photo);
				_g_object_unref0 (view);
				_g_object_unref0 (object);
				continue;
			}
			page_set_action_sensitive ((Page*) self, "Revert", collection_page_can_revert_selected (self));
			_tmp20_ = photo;
			page_set_action_sensitive ((Page*) self, "CopyColorAdjustments", photo_has_color_adjustments ((Photo*) _tmp20_));
			collection_page_update_enhance_toggled (self);
			_g_object_unref0 (photo);
			_g_object_unref0 (view);
			_g_object_unref0 (object);
			break;
		}
		_g_object_unref0 (_object_it);
	}
}

static void
collection_page_update_enhance_toggled (CollectionPage* self)
{
	gboolean toggled = FALSE;
	GtkToggleButton* _tmp19_;
	guint _tmp20_;
	GtkToggleButton* _tmp21_;
	GtkToggleButton* _tmp22_;
	GtkAction* action = NULL;
	GtkAction* _tmp23_;
	GtkAction* _tmp24_;
	const gchar* _tmp25_ = NULL;
	GtkAction* _tmp26_;
	g_return_if_fail (self != NULL);
	toggled = FALSE;
	{
		GeeList* _view_list = NULL;
		ViewCollection* _tmp0_;
		ViewCollection* _tmp1_;
		GeeList* _tmp2_;
		GeeList* _tmp3_;
		gint _view_size = 0;
		GeeList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _view_index = 0;
		_tmp0_ = page_get_view ((Page*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = view_collection_get_selected (_tmp1_);
		_tmp3_ = _tmp2_;
		_data_collection_unref0 (_tmp1_);
		_view_list = _tmp3_;
		_tmp4_ = _view_list;
		_tmp5_ = gee_collection_get_size ((GeeCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_view_size = _tmp6_;
		_view_index = -1;
		while (TRUE) {
			gint _tmp7_;
			gint _tmp8_;
			DataView* view = NULL;
			GeeList* _tmp9_;
			gpointer _tmp10_;
			Photo* photo = NULL;
			DataView* _tmp11_;
			DataSource* _tmp12_;
			DataSource* _tmp13_;
			Photo* _tmp14_;
			gboolean _tmp15_ = FALSE;
			Photo* _tmp16_;
			_view_index = _view_index + 1;
			_tmp7_ = _view_index;
			_tmp8_ = _view_size;
			if (!(_tmp7_ < _tmp8_)) {
				break;
			}
			_tmp9_ = _view_list;
			_tmp10_ = gee_list_get (_tmp9_, _view_index);
			view = (DataView*) _tmp10_;
			_tmp11_ = view;
			_tmp12_ = data_view_get_source (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = _g_object_ref0 (IS_PHOTO (_tmp13_) ? ((Photo*) _tmp13_) : NULL);
			photo = _tmp14_;
			_tmp16_ = photo;
			if (_tmp16_ != NULL) {
				Photo* _tmp17_;
				_tmp17_ = photo;
				_tmp15_ = !photo_is_enhanced (_tmp17_);
			} else {
				_tmp15_ = FALSE;
			}
			if (_tmp15_) {
				toggled = FALSE;
				_g_object_unref0 (photo);
				_g_object_unref0 (view);
				break;
			} else {
				Photo* _tmp18_;
				_tmp18_ = photo;
				if (_tmp18_ != NULL) {
					toggled = TRUE;
				}
			}
			_g_object_unref0 (photo);
			_g_object_unref0 (view);
		}
		_g_object_unref0 (_view_list);
	}
	_tmp19_ = self->priv->enhance_button;
	g_signal_parse_name ("clicked", gtk_button_get_type (), &_tmp20_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkButton*) _tmp19_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp20_, 0, NULL, (GCallback) _collection_page_on_enhance_gtk_button_clicked, self);
	_tmp21_ = self->priv->enhance_button;
	gtk_toggle_button_set_active (_tmp21_, toggled);
	_tmp22_ = self->priv->enhance_button;
	g_signal_connect_object ((GtkButton*) _tmp22_, "clicked", (GCallback) _collection_page_on_enhance_gtk_button_clicked, self, 0);
	_tmp23_ = page_get_action ((Page*) self, "Enhance");
	action = _tmp23_;
	_tmp24_ = action;
	_vala_assert (_tmp24_ != NULL, "action != null");
	if (toggled) {
		_tmp25_ = RESOURCES_UNENHANCE_MENU;
	} else {
		_tmp25_ = RESOURCES_ENHANCE_MENU;
	}
	_tmp26_ = action;
	gtk_action_set_label (_tmp26_, _tmp25_);
	_g_object_unref0 (action);
}

static void
collection_page_on_print (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_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 ((Page*) self);
		_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 void
collection_page_real_on_item_activated (CheckerboardPage* base,
                                        CheckerboardItem* item)
{
	CollectionPage * self;
	Thumbnail* thumbnail = NULL;
	Thumbnail* _tmp0_;
	Thumbnail* _tmp1_;
	MediaSource* _tmp2_;
	MediaSource* _tmp3_;
	gboolean _tmp4_;
	LibraryPhoto* photo = NULL;
	Thumbnail* _tmp5_;
	MediaSource* _tmp6_;
	LibraryPhoto* _tmp7_;
	LibraryPhoto* _tmp8_;
	LibraryPhoto* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	LibraryWindow* _tmp12_;
	LibraryWindow* _tmp13_;
	LibraryPhoto* _tmp14_;
	self = (CollectionPage*) base;
	g_return_if_fail (item != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (item, TYPE_THUMBNAIL, Thumbnail));
	thumbnail = _tmp0_;
	_tmp1_ = thumbnail;
	_tmp2_ = thumbnail_get_media_source (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = IS_VIDEO (_tmp3_);
	_g_object_unref0 (_tmp3_);
	if (_tmp4_) {
		media_page_on_play_video ((MediaPage*) self);
		_g_object_unref0 (thumbnail);
		return;
	}
	_tmp5_ = thumbnail;
	_tmp6_ = thumbnail_get_media_source (_tmp5_);
	_tmp7_ = IS_LIBRARY_PHOTO (_tmp6_) ? ((LibraryPhoto*) _tmp6_) : NULL;
	if (_tmp7_ == NULL) {
		_g_object_unref0 (_tmp6_);
	}
	photo = _tmp7_;
	_tmp8_ = photo;
	if (_tmp8_ == NULL) {
		_g_object_unref0 (photo);
		_g_object_unref0 (thumbnail);
		return;
	}
	_tmp9_ = photo;
	_tmp10_ = data_object_to_string ((DataObject*) _tmp9_);
	_tmp11_ = _tmp10_;
	g_debug ("CollectionPage.vala:498: activating %s", _tmp11_);
	_g_free0 (_tmp11_);
	_tmp12_ = library_window_get_app ();
	_tmp13_ = _tmp12_;
	_tmp14_ = photo;
	library_window_switch_to_photo_page (_tmp13_, self, (Photo*) _tmp14_);
	_g_object_unref0 (_tmp13_);
	_g_object_unref0 (photo);
	_g_object_unref0 (thumbnail);
}

static gboolean
collection_page_real_on_app_key_pressed (Page* base,
                                         GdkEventKey* event)
{
	CollectionPage * self;
	gboolean handled = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GQuark _tmp4_ = 0U;
	static GQuark _tmp3_label0 = 0;
	static GQuark _tmp3_label1 = 0;
	static GQuark _tmp3_label2 = 0;
	static GQuark _tmp3_label3 = 0;
	static GQuark _tmp3_label4 = 0;
	static GQuark _tmp3_label5 = 0;
	static GQuark _tmp3_label6 = 0;
	static GQuark _tmp3_label7 = 0;
	static GQuark _tmp3_label8 = 0;
	static GQuark _tmp3_label9 = 0;
	gboolean _tmp6_ = FALSE;
	gboolean result;
	self = (CollectionPage*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	handled = TRUE;
	if (page_match_keycode ((Page*) self, GDK_KEY_c, (guint) event->hardware_keycode)) {
		gboolean _tmp0_ = FALSE;
		if ((event->state & GDK_CONTROL_MASK) != 0) {
			_tmp0_ = (event->state & GDK_SHIFT_MASK) == 0;
		} else {
			_tmp0_ = FALSE;
		}
		if (_tmp0_) {
			page_activate_action ((Page*) self, "CopyImages");
		}
	}
	_tmp1_ = gdk_keyval_name (event->keyval);
	_tmp2_ = _tmp1_;
	_tmp4_ = (NULL == _tmp2_) ? 0 : g_quark_from_string (_tmp2_);
	if ((((((((_tmp4_ == ((0 != _tmp3_label0) ? _tmp3_label0 : (_tmp3_label0 = g_quark_from_static_string ("Page_Up")))) || (_tmp4_ == ((0 != _tmp3_label1) ? _tmp3_label1 : (_tmp3_label1 = g_quark_from_static_string ("KP_Page_Up"))))) || (_tmp4_ == ((0 != _tmp3_label2) ? _tmp3_label2 : (_tmp3_label2 = g_quark_from_static_string ("Page_Down"))))) || (_tmp4_ == ((0 != _tmp3_label3) ? _tmp3_label3 : (_tmp3_label3 = g_quark_from_static_string ("KP_Page_Down"))))) || (_tmp4_ == ((0 != _tmp3_label4) ? _tmp3_label4 : (_tmp3_label4 = g_quark_from_static_string ("Home"))))) || (_tmp4_ == ((0 != _tmp3_label5) ? _tmp3_label5 : (_tmp3_label5 = g_quark_from_static_string ("KP_Home"))))) || (_tmp4_ == ((0 != _tmp3_label6) ? _tmp3_label6 : (_tmp3_label6 = g_quark_from_static_string ("End"))))) || (_tmp4_ == ((0 != _tmp3_label7) ? _tmp3_label7 : (_tmp3_label7 = g_quark_from_static_string ("KP_End"))))) {
		switch (0) {
			default:
			{
				gboolean _tmp5_ = FALSE;
				g_signal_emit_by_name ((GtkWidget*) self, "key-press-event", event, &_tmp5_);
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label8) ? _tmp3_label8 : (_tmp3_label8 = g_quark_from_static_string ("bracketright")))) {
		switch (0) {
			default:
			{
				page_activate_action ((Page*) self, "RotateClockwise");
				break;
			}
		}
	} else if (_tmp4_ == ((0 != _tmp3_label9) ? _tmp3_label9 : (_tmp3_label9 = g_quark_from_static_string ("bracketleft")))) {
		switch (0) {
			default:
			{
				page_activate_action ((Page*) self, "RotateCounterclockwise");
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				handled = FALSE;
				break;
			}
		}
	}
	if (handled) {
		_tmp6_ = TRUE;
	} else {
		_tmp6_ = PAGE_CLASS (collection_page_parent_class)->on_app_key_pressed ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MEDIA_PAGE, MediaPage), event);
	}
	result = _tmp6_;
	return result;
}

static void
_collection_page_on_export_completed_exporter_completion_callback (Exporter* exporter,
                                                                   gboolean is_cancelled,
                                                                   gpointer self)
{
	collection_page_on_export_completed ((CollectionPage*) self);
}

static void
collection_page_real_on_export (MediaPage* base)
{
	CollectionPage * self;
	ExporterUI* _tmp0_;
	GeeCollection* export_list = NULL;
	ViewCollection* _tmp1_;
	ViewCollection* _tmp2_;
	GeeList* _tmp3_;
	GeeCollection* _tmp4_;
	GeeCollection* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gboolean has_some_photos = FALSE;
	gboolean has_some_videos = FALSE;
	gboolean _tmp8_ = FALSE;
	gchar* title = NULL;
	ExportDialog* export_dialog = NULL;
	const gchar* _tmp19_;
	ExportDialog* _tmp20_;
	ExportFormatParameters _tmp21_ = {0};
	ExportFormatParameters export_params = {0};
	gint scale = 0;
	ScaleConstraint constraint = 0;
	ExportDialog* _tmp24_;
	gint _tmp25_ = 0;
	ScaleConstraint _tmp26_ = 0;
	gboolean _tmp27_;
	Scaling scaling = {0};
	Scaling _tmp28_ = {0};
	GeeCollection* _tmp29_;
	gint _tmp30_;
	gint _tmp31_;
	GFile* export_dir = NULL;
	const gchar* _tmp61_;
	GFile* _tmp62_;
	GFile* _tmp63_;
	GeeCollection* _tmp64_;
	GFile* _tmp65_;
	Scaling _tmp66_;
	ExportFormatParameters _tmp67_;
	Exporter* _tmp68_;
	Exporter* _tmp69_;
	ExporterUI* _tmp70_;
	ExporterUI* _tmp71_;
	GError* _inner_error0_ = NULL;
	self = (CollectionPage*) base;
	_tmp0_ = self->priv->exporter;
	if (_tmp0_ != NULL) {
		return;
	}
	_tmp1_ = page_get_view ((Page*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = view_collection_get_selected_sources (_tmp2_);
	_tmp4_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GEE_TYPE_COLLECTION, GeeCollection);
	_data_collection_unref0 (_tmp2_);
	export_list = _tmp4_;
	_tmp5_ = export_list;
	_tmp6_ = gee_collection_get_size (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp7_ == 0) {
		_g_object_unref0 (export_list);
		return;
	}
	has_some_photos = collection_page_selection_has_photo (self);
	has_some_videos = collection_page_selection_has_video (self);
	if (has_some_photos) {
		_tmp8_ = TRUE;
	} else {
		_tmp8_ = has_some_videos;
	}
	_vala_assert (_tmp8_, "has_some_photos || has_some_videos");
	if (!has_some_photos) {
		GeeCollection* _tmp9_;
		ExporterUI* _tmp10_;
		_tmp9_ = export_list;
		_tmp10_ = video_export_many (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, GEE_TYPE_COLLECTION, GeeCollection), _collection_page_on_export_completed_exporter_completion_callback, self, FALSE);
		_exporter_ui_unref0 (self->priv->exporter);
		self->priv->exporter = _tmp10_;
		_g_object_unref0 (export_list);
		return;
	}
	title = NULL;
	if (has_some_videos) {
		GeeCollection* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		gchar* _tmp14_;
		_tmp11_ = export_list;
		_tmp12_ = gee_collection_get_size (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = g_strdup (ngettext ("Export Photo/Video", "Export Photos/Videos", (gulong) _tmp13_));
		_g_free0 (title);
		title = _tmp14_;
	} else {
		GeeCollection* _tmp15_;
		gint _tmp16_;
		gint _tmp17_;
		gchar* _tmp18_;
		_tmp15_ = export_list;
		_tmp16_ = gee_collection_get_size (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = g_strdup (ngettext ("Export Photo", "Export Photos", (gulong) _tmp17_));
		_g_free0 (title);
		title = _tmp18_;
	}
	_tmp19_ = title;
	_tmp20_ = export_dialog_new (_tmp19_);
	g_object_ref_sink (_tmp20_);
	export_dialog = _tmp20_;
	if (has_some_videos) {
		ExportFormatParameters _tmp22_ = {0};
		export_format_parameters_current (&_tmp22_);
		_tmp21_ = _tmp22_;
	} else {
		ExportFormatParameters _tmp23_ = {0};
		export_format_parameters_last (&_tmp23_);
		_tmp21_ = _tmp23_;
	}
	export_params = _tmp21_;
	_tmp24_ = export_dialog;
	_tmp27_ = export_dialog_execute (_tmp24_, &_tmp25_, &_tmp26_, &export_params);
	scale = _tmp25_;
	constraint = _tmp26_;
	if (!_tmp27_) {
		_g_object_unref0 (export_dialog);
		_g_free0 (title);
		_g_object_unref0 (export_list);
		return;
	}
	scaling_for_constraint (constraint, scale, FALSE, &_tmp28_);
	scaling = _tmp28_;
	_tmp29_ = export_list;
	_tmp30_ = gee_collection_get_size (_tmp29_);
	_tmp31_ = _tmp30_;
	if (_tmp31_ == 1) {
		LibraryPhoto* photo = NULL;
		GFile* save_as = NULL;
		LibraryPhoto* _tmp39_;
		ExportFormatParameters _tmp40_;
		gchar* _tmp41_;
		gchar* _tmp42_;
		GFile* _tmp43_;
		GFile* _tmp44_;
		GFile* _tmp45_;
		photo = NULL;
		{
			GeeIterator* _p_it = NULL;
			GeeCollection* _tmp32_;
			GeeIterator* _tmp33_;
			_tmp32_ = export_list;
			_tmp33_ = gee_iterable_iterator ((GeeIterable*) G_TYPE_CHECK_INSTANCE_CAST (_tmp32_, GEE_TYPE_COLLECTION, GeeCollection));
			_p_it = _tmp33_;
			while (TRUE) {
				GeeIterator* _tmp34_;
				LibraryPhoto* p = NULL;
				GeeIterator* _tmp35_;
				gpointer _tmp36_;
				LibraryPhoto* _tmp37_;
				LibraryPhoto* _tmp38_;
				_tmp34_ = _p_it;
				if (!gee_iterator_next (_tmp34_)) {
					break;
				}
				_tmp35_ = _p_it;
				_tmp36_ = gee_iterator_get (_tmp35_);
				p = (LibraryPhoto*) _tmp36_;
				_tmp37_ = p;
				_tmp38_ = _g_object_ref0 (_tmp37_);
				_g_object_unref0 (photo);
				photo = _tmp38_;
				_g_object_unref0 (p);
				break;
			}
			_g_object_unref0 (_p_it);
		}
		_tmp39_ = photo;
		_tmp40_ = export_params;
		_tmp41_ = photo_get_export_basename_for_parameters ((Photo*) _tmp39_, &_tmp40_);
		_tmp42_ = _tmp41_;
		_tmp43_ = export_ui_choose_file (_tmp42_);
		_tmp44_ = _tmp43_;
		_g_free0 (_tmp42_);
		save_as = _tmp44_;
		_tmp45_ = save_as;
		if (_tmp45_ == NULL) {
			_g_object_unref0 (save_as);
			_g_object_unref0 (photo);
			_g_object_unref0 (export_dialog);
			_g_free0 (title);
			_g_object_unref0 (export_list);
			return;
		}
		{
			AppWindow* _tmp46_;
			AppWindow* _tmp47_;
			LibraryPhoto* _tmp48_;
			GFile* _tmp49_;
			Scaling _tmp50_;
			ExportFormatParameters _tmp51_;
			LibraryPhoto* _tmp52_;
			ExportFormatParameters _tmp53_;
			ExportFormatParameters _tmp54_;
			ExportFormatParameters _tmp55_;
			AppWindow* _tmp56_;
			AppWindow* _tmp57_;
			_tmp46_ = app_window_get_instance ();
			_tmp47_ = _tmp46_;
			page_window_set_busy_cursor ((PageWindow*) _tmp47_);
			_g_object_unref0 (_tmp47_);
			_tmp48_ = photo;
			_tmp49_ = save_as;
			_tmp50_ = scaling;
			_tmp51_ = export_params;
			_tmp52_ = photo;
			_tmp53_ = export_params;
			_tmp54_ = export_params;
			_tmp55_ = export_params;
			photo_export ((Photo*) _tmp48_, _tmp49_, &_tmp50_, _tmp51_.quality, photo_get_export_format_for_parameters ((Photo*) _tmp52_, &_tmp53_), _tmp54_.mode == EXPORT_FORMAT_MODE_UNMODIFIED, _tmp55_.export_metadata, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_tmp56_ = app_window_get_instance ();
			_tmp57_ = _tmp56_;
			page_window_set_normal_cursor ((PageWindow*) _tmp57_);
			_g_object_unref0 (_tmp57_);
		}
		goto __finally0;
		__catch0_g_error:
		{
			AppWindow* _tmp58_;
			AppWindow* _tmp59_;
			GFile* _tmp60_;
			g_clear_error (&_inner_error0_);
			_tmp58_ = app_window_get_instance ();
			_tmp59_ = _tmp58_;
			page_window_set_normal_cursor ((PageWindow*) _tmp59_);
			_g_object_unref0 (_tmp59_);
			_tmp60_ = save_as;
			export_error_dialog (_tmp60_, FALSE);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (save_as);
			_g_object_unref0 (photo);
			_g_object_unref0 (export_dialog);
			_g_free0 (title);
			_g_object_unref0 (export_list);
			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;
		}
		_g_object_unref0 (save_as);
		_g_object_unref0 (photo);
		_g_object_unref0 (export_dialog);
		_g_free0 (title);
		_g_object_unref0 (export_list);
		return;
	}
	_tmp61_ = title;
	_tmp62_ = export_ui_choose_dir (_tmp61_);
	export_dir = _tmp62_;
	_tmp63_ = export_dir;
	if (_tmp63_ == NULL) {
		_g_object_unref0 (export_dir);
		_g_object_unref0 (export_dialog);
		_g_free0 (title);
		_g_object_unref0 (export_list);
		return;
	}
	_tmp64_ = export_list;
	_tmp65_ = export_dir;
	_tmp66_ = scaling;
	_tmp67_ = export_params;
	_tmp68_ = exporter_new (_tmp64_, _tmp65_, &_tmp66_, &_tmp67_, FALSE);
	_tmp69_ = _tmp68_;
	_tmp70_ = exporter_ui_new (_tmp69_);
	_exporter_ui_unref0 (self->priv->exporter);
	self->priv->exporter = _tmp70_;
	_g_object_unref0 (_tmp69_);
	_tmp71_ = self->priv->exporter;
	exporter_ui_export (_tmp71_, _collection_page_on_export_completed_exporter_completion_callback, self);
	_g_object_unref0 (export_dir);
	_g_object_unref0 (export_dialog);
	_g_free0 (title);
	_g_object_unref0 (export_list);
}

static void
collection_page_on_export_completed (CollectionPage* self)
{
	g_return_if_fail (self != NULL);
	_exporter_ui_unref0 (self->priv->exporter);
	self->priv->exporter = NULL;
}

static gboolean
collection_page_can_revert_selected (CollectionPage* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	{
		GeeList* _source_list = NULL;
		ViewCollection* _tmp0_;
		ViewCollection* _tmp1_;
		GeeList* _tmp2_;
		GeeList* _tmp3_;
		gint _source_size = 0;
		GeeList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _source_index = 0;
		_tmp0_ = page_get_view ((Page*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = view_collection_get_selected_sources (_tmp1_);
		_tmp3_ = _tmp2_;
		_data_collection_unref0 (_tmp1_);
		_source_list = _tmp3_;
		_tmp4_ = _source_list;
		_tmp5_ = gee_collection_get_size ((GeeCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_source_size = _tmp6_;
		_source_index = -1;
		while (TRUE) {
			gint _tmp7_;
			gint _tmp8_;
			DataSource* source = NULL;
			GeeList* _tmp9_;
			gpointer _tmp10_;
			LibraryPhoto* photo = NULL;
			DataSource* _tmp11_;
			LibraryPhoto* _tmp12_;
			gboolean _tmp13_ = FALSE;
			LibraryPhoto* _tmp14_;
			_source_index = _source_index + 1;
			_tmp7_ = _source_index;
			_tmp8_ = _source_size;
			if (!(_tmp7_ < _tmp8_)) {
				break;
			}
			_tmp9_ = _source_list;
			_tmp10_ = gee_list_get (_tmp9_, _source_index);
			source = (DataSource*) _tmp10_;
			_tmp11_ = source;
			_tmp12_ = _g_object_ref0 (IS_LIBRARY_PHOTO (_tmp11_) ? ((LibraryPhoto*) _tmp11_) : NULL);
			photo = _tmp12_;
			_tmp14_ = photo;
			if (_tmp14_ != NULL) {
				gboolean _tmp15_ = FALSE;
				LibraryPhoto* _tmp16_;
				_tmp16_ = photo;
				if (photo_has_transformations ((Photo*) _tmp16_)) {
					_tmp15_ = TRUE;
				} else {
					LibraryPhoto* _tmp17_;
					_tmp17_ = photo;
					_tmp15_ = photo_has_editable ((Photo*) _tmp17_);
				}
				_tmp13_ = _tmp15_;
			} else {
				_tmp13_ = FALSE;
			}
			if (_tmp13_) {
				result = TRUE;
				_g_object_unref0 (photo);
				_g_object_unref0 (source);
				_g_object_unref0 (_source_list);
				return result;
			}
			_g_object_unref0 (photo);
			_g_object_unref0 (source);
		}
		_g_object_unref0 (_source_list);
	}
	result = FALSE;
	return result;
}

static gboolean
collection_page_can_revert_editable_selected (CollectionPage* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	{
		GeeList* _source_list = NULL;
		ViewCollection* _tmp0_;
		ViewCollection* _tmp1_;
		GeeList* _tmp2_;
		GeeList* _tmp3_;
		gint _source_size = 0;
		GeeList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _source_index = 0;
		_tmp0_ = page_get_view ((Page*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = view_collection_get_selected_sources (_tmp1_);
		_tmp3_ = _tmp2_;
		_data_collection_unref0 (_tmp1_);
		_source_list = _tmp3_;
		_tmp4_ = _source_list;
		_tmp5_ = gee_collection_get_size ((GeeCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_source_size = _tmp6_;
		_source_index = -1;
		while (TRUE) {
			gint _tmp7_;
			gint _tmp8_;
			DataSource* source = NULL;
			GeeList* _tmp9_;
			gpointer _tmp10_;
			LibraryPhoto* photo = NULL;
			DataSource* _tmp11_;
			LibraryPhoto* _tmp12_;
			gboolean _tmp13_ = FALSE;
			LibraryPhoto* _tmp14_;
			_source_index = _source_index + 1;
			_tmp7_ = _source_index;
			_tmp8_ = _source_size;
			if (!(_tmp7_ < _tmp8_)) {
				break;
			}
			_tmp9_ = _source_list;
			_tmp10_ = gee_list_get (_tmp9_, _source_index);
			source = (DataSource*) _tmp10_;
			_tmp11_ = source;
			_tmp12_ = _g_object_ref0 (IS_LIBRARY_PHOTO (_tmp11_) ? ((LibraryPhoto*) _tmp11_) : NULL);
			photo = _tmp12_;
			_tmp14_ = photo;
			if (_tmp14_ != NULL) {
				LibraryPhoto* _tmp15_;
				_tmp15_ = photo;
				_tmp13_ = photo_has_editable ((Photo*) _tmp15_);
			} else {
				_tmp13_ = FALSE;
			}
			if (_tmp13_) {
				result = TRUE;
				_g_object_unref0 (photo);
				_g_object_unref0 (source);
				_g_object_unref0 (_source_list);
				return result;
			}
			_g_object_unref0 (photo);
			_g_object_unref0 (source);
		}
		_g_object_unref0 (_source_list);
	}
	result = FALSE;
	return result;
}

static void
collection_page_on_show_sidebar (CollectionPage* self)
{
	LibraryWindow* app = NULL;
	AppWindow* _tmp0_;
	LibraryWindow* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = app_window_get_instance ();
	_tmp1_ = IS_LIBRARY_WINDOW (_tmp0_) ? ((LibraryWindow*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	app = _tmp1_;
	library_window_set_metadata_sidebar_visible (app, !library_window_is_metadata_sidebar_visible (app));
	page_update_sidebar_action ((Page*) self, !library_window_is_metadata_sidebar_visible (app));
	_g_object_unref0 (app);
}

static void
collection_page_on_rotate_clockwise (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	RotateMultipleCommand* command = NULL;
	ViewCollection* _tmp3_;
	ViewCollection* _tmp4_;
	GeeList* _tmp5_;
	GeeList* _tmp6_;
	RotateMultipleCommand* _tmp7_;
	RotateMultipleCommand* _tmp8_;
	CommandManager* _tmp9_;
	CommandManager* _tmp10_;
	RotateMultipleCommand* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_count (_tmp1_) == 0;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = page_get_view ((Page*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = view_collection_get_selected (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = rotate_multiple_command_new ((GeeIterable*) _tmp6_, ROTATION_CLOCKWISE, RESOURCES_ROTATE_CW_FULL_LABEL, RESOURCES_ROTATE_CW_TOOLTIP, _ ("Rotating"), _ ("Undoing Rotate"));
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp6_);
	_data_collection_unref0 (_tmp4_);
	command = _tmp8_;
	_tmp9_ = page_get_command_manager ((Page*) self);
	_tmp10_ = _tmp9_;
	_tmp11_ = command;
	command_manager_execute (_tmp10_, (Command*) _tmp11_);
	_command_manager_unref0 (_tmp10_);
	_g_object_unref0 (command);
}

static void
collection_page_on_rotate_counterclockwise (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	RotateMultipleCommand* command = NULL;
	ViewCollection* _tmp3_;
	ViewCollection* _tmp4_;
	GeeList* _tmp5_;
	GeeList* _tmp6_;
	RotateMultipleCommand* _tmp7_;
	RotateMultipleCommand* _tmp8_;
	CommandManager* _tmp9_;
	CommandManager* _tmp10_;
	RotateMultipleCommand* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_count (_tmp1_) == 0;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = page_get_view ((Page*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = view_collection_get_selected (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = rotate_multiple_command_new ((GeeIterable*) _tmp6_, ROTATION_COUNTERCLOCKWISE, RESOURCES_ROTATE_CCW_FULL_LABEL, RESOURCES_ROTATE_CCW_TOOLTIP, _ ("Rotating"), _ ("Undoing Rotate"));
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp6_);
	_data_collection_unref0 (_tmp4_);
	command = _tmp8_;
	_tmp9_ = page_get_command_manager ((Page*) self);
	_tmp10_ = _tmp9_;
	_tmp11_ = command;
	command_manager_execute (_tmp10_, (Command*) _tmp11_);
	_command_manager_unref0 (_tmp10_);
	_g_object_unref0 (command);
}

static void
collection_page_on_flip_horizontally (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	RotateMultipleCommand* command = NULL;
	ViewCollection* _tmp3_;
	ViewCollection* _tmp4_;
	GeeList* _tmp5_;
	GeeList* _tmp6_;
	RotateMultipleCommand* _tmp7_;
	RotateMultipleCommand* _tmp8_;
	CommandManager* _tmp9_;
	CommandManager* _tmp10_;
	RotateMultipleCommand* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_count (_tmp1_) == 0;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = page_get_view ((Page*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = view_collection_get_selected (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = rotate_multiple_command_new ((GeeIterable*) _tmp6_, ROTATION_MIRROR, RESOURCES_HFLIP_LABEL, "", _ ("Flipping Horizontally"), _ ("Undoing Flip Horizontally"));
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp6_);
	_data_collection_unref0 (_tmp4_);
	command = _tmp8_;
	_tmp9_ = page_get_command_manager ((Page*) self);
	_tmp10_ = _tmp9_;
	_tmp11_ = command;
	command_manager_execute (_tmp10_, (Command*) _tmp11_);
	_command_manager_unref0 (_tmp10_);
	_g_object_unref0 (command);
}

static void
collection_page_on_flip_vertically (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	RotateMultipleCommand* command = NULL;
	ViewCollection* _tmp3_;
	ViewCollection* _tmp4_;
	GeeList* _tmp5_;
	GeeList* _tmp6_;
	RotateMultipleCommand* _tmp7_;
	RotateMultipleCommand* _tmp8_;
	CommandManager* _tmp9_;
	CommandManager* _tmp10_;
	RotateMultipleCommand* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_count (_tmp1_) == 0;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = page_get_view ((Page*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = view_collection_get_selected (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = rotate_multiple_command_new ((GeeIterable*) _tmp6_, ROTATION_UPSIDE_DOWN, RESOURCES_VFLIP_LABEL, "", _ ("Flipping Vertically"), _ ("Undoing Flip Vertically"));
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp6_);
	_data_collection_unref0 (_tmp4_);
	command = _tmp8_;
	_tmp9_ = page_get_command_manager ((Page*) self);
	_tmp10_ = _tmp9_;
	_tmp11_ = command;
	command_manager_execute (_tmp10_, (Command*) _tmp11_);
	_command_manager_unref0 (_tmp10_);
	_g_object_unref0 (command);
}

static void
collection_page_on_revert (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	RevertMultipleCommand* command = NULL;
	ViewCollection* _tmp22_;
	ViewCollection* _tmp23_;
	GeeList* _tmp24_;
	GeeList* _tmp25_;
	RevertMultipleCommand* _tmp26_;
	RevertMultipleCommand* _tmp27_;
	CommandManager* _tmp28_;
	CommandManager* _tmp29_;
	RevertMultipleCommand* _tmp30_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_count (_tmp1_) == 0;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	if (collection_page_can_revert_editable_selected (self)) {
		AppWindow* _tmp3_;
		AppWindow* _tmp4_;
		ViewCollection* _tmp5_;
		ViewCollection* _tmp6_;
		GeeList* _tmp7_;
		GeeCollection* _tmp8_;
		gboolean _tmp9_;
		_tmp3_ = app_window_get_instance ();
		_tmp4_ = _tmp3_;
		_tmp5_ = page_get_view ((Page*) self);
		_tmp6_ = _tmp5_;
		_tmp7_ = view_collection_get_selected_sources (_tmp6_);
		_tmp8_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GEE_TYPE_COLLECTION, GeeCollection);
		_tmp9_ = !revert_editable_dialog ((GtkWindow*) _tmp4_, _tmp8_);
		_g_object_unref0 (_tmp8_);
		_data_collection_unref0 (_tmp6_);
		_g_object_unref0 (_tmp4_);
		if (_tmp9_) {
			return;
		}
		{
			GeeList* _object_list = NULL;
			ViewCollection* _tmp10_;
			ViewCollection* _tmp11_;
			GeeList* _tmp12_;
			GeeList* _tmp13_;
			gint _object_size = 0;
			GeeList* _tmp14_;
			gint _tmp15_;
			gint _tmp16_;
			gint _object_index = 0;
			_tmp10_ = page_get_view ((Page*) self);
			_tmp11_ = _tmp10_;
			_tmp12_ = view_collection_get_selected_sources (_tmp11_);
			_tmp13_ = _tmp12_;
			_data_collection_unref0 (_tmp11_);
			_object_list = _tmp13_;
			_tmp14_ = _object_list;
			_tmp15_ = gee_collection_get_size ((GeeCollection*) _tmp14_);
			_tmp16_ = _tmp15_;
			_object_size = _tmp16_;
			_object_index = -1;
			while (TRUE) {
				gint _tmp17_;
				gint _tmp18_;
				DataObject* object = NULL;
				GeeList* _tmp19_;
				gpointer _tmp20_;
				DataObject* _tmp21_;
				_object_index = _object_index + 1;
				_tmp17_ = _object_index;
				_tmp18_ = _object_size;
				if (!(_tmp17_ < _tmp18_)) {
					break;
				}
				_tmp19_ = _object_list;
				_tmp20_ = gee_list_get (_tmp19_, _object_index);
				object = (DataObject*) ((DataSource*) _tmp20_);
				_tmp21_ = object;
				photo_revert_to_master (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, TYPE_PHOTO, Photo), TRUE);
				_g_object_unref0 (object);
			}
			_g_object_unref0 (_object_list);
		}
	}
	_tmp22_ = page_get_view ((Page*) self);
	_tmp23_ = _tmp22_;
	_tmp24_ = view_collection_get_selected (_tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = revert_multiple_command_new ((GeeIterable*) _tmp25_);
	_tmp27_ = _tmp26_;
	_g_object_unref0 (_tmp25_);
	_data_collection_unref0 (_tmp23_);
	command = _tmp27_;
	_tmp28_ = page_get_command_manager ((Page*) self);
	_tmp29_ = _tmp28_;
	_tmp30_ = command;
	command_manager_execute (_tmp29_, (Command*) _tmp30_);
	_command_manager_unref0 (_tmp29_);
	_g_object_unref0 (command);
}

void
collection_page_on_copy_adjustments (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	Photo* photo = NULL;
	ViewCollection* _tmp3_;
	ViewCollection* _tmp4_;
	DataView* _tmp5_;
	DataView* _tmp6_;
	DataSource* _tmp7_;
	DataSource* _tmp8_;
	Photo* _tmp9_;
	Photo* _tmp10_;
	Photo* _tmp11_;
	PixelTransformationBundle* _tmp12_;
	PixelTransformationBundle* _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_count (_tmp1_) != 1;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = page_get_view ((Page*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = view_collection_get_selected_at (_tmp4_, 0);
	_tmp6_ = _tmp5_;
	_tmp7_ = data_view_get_source (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, TYPE_PHOTO, Photo));
	_tmp10_ = _tmp9_;
	_g_object_unref0 (_tmp6_);
	_data_collection_unref0 (_tmp4_);
	photo = _tmp10_;
	_tmp11_ = photo;
	_tmp12_ = photo_get_color_adjustments (_tmp11_);
	_tmp13_ = _tmp12_;
	pixel_transformation_bundle_set_copied_color_adjustments (_tmp13_);
	_pixel_transformation_bundle_unref0 (_tmp13_);
	page_set_action_sensitive ((Page*) self, "PasteColorAdjustments", TRUE);
	_g_object_unref0 (photo);
}

void
collection_page_on_paste_adjustments (CollectionPage* self)
{
	PixelTransformationBundle* copied_adjustments = NULL;
	PixelTransformationBundle* _tmp0_;
	gboolean _tmp1_ = FALSE;
	ViewCollection* _tmp2_;
	ViewCollection* _tmp3_;
	gboolean _tmp4_;
	AdjustColorsMultipleCommand* command = NULL;
	ViewCollection* _tmp6_;
	ViewCollection* _tmp7_;
	GeeList* _tmp8_;
	GeeList* _tmp9_;
	PixelTransformationBundle* _tmp10_;
	AdjustColorsMultipleCommand* _tmp11_;
	AdjustColorsMultipleCommand* _tmp12_;
	CommandManager* _tmp13_;
	CommandManager* _tmp14_;
	AdjustColorsMultipleCommand* _tmp15_;
	g_return_if_fail (self != NULL);
	_tmp0_ = pixel_transformation_bundle_get_copied_color_adjustments ();
	copied_adjustments = _tmp0_;
	_tmp2_ = page_get_view ((Page*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = view_collection_get_selected_count (_tmp3_) == 0;
	_data_collection_unref0 (_tmp3_);
	if (_tmp4_) {
		_tmp1_ = TRUE;
	} else {
		PixelTransformationBundle* _tmp5_;
		_tmp5_ = copied_adjustments;
		_tmp1_ = _tmp5_ == NULL;
	}
	if (_tmp1_) {
		_pixel_transformation_bundle_unref0 (copied_adjustments);
		return;
	}
	_tmp6_ = page_get_view ((Page*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = view_collection_get_selected (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = copied_adjustments;
	_tmp11_ = adjust_colors_multiple_command_new ((GeeIterable*) _tmp9_, _tmp10_, RESOURCES_PASTE_ADJUSTMENTS_LABEL, RESOURCES_PASTE_ADJUSTMENTS_TOOLTIP);
	_tmp12_ = _tmp11_;
	_g_object_unref0 (_tmp9_);
	_data_collection_unref0 (_tmp7_);
	command = _tmp12_;
	_tmp13_ = page_get_command_manager ((Page*) self);
	_tmp14_ = _tmp13_;
	_tmp15_ = command;
	command_manager_execute (_tmp14_, (Command*) _tmp15_);
	_command_manager_unref0 (_tmp14_);
	_g_object_unref0 (command);
	_pixel_transformation_bundle_unref0 (copied_adjustments);
}

static void
collection_page_on_enhance (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	GeeArrayList* unenhanced_list = NULL;
	GeeArrayList* _tmp3_;
	GeeArrayList* enhanced_list = NULL;
	GeeArrayList* _tmp4_;
	gboolean _tmp28_ = FALSE;
	GeeArrayList* _tmp29_;
	gint _tmp30_;
	gint _tmp31_;
	GeeArrayList* _tmp35_;
	gint _tmp36_;
	gint _tmp37_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_count (_tmp1_) == 0;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = gee_array_list_new (TYPE_DATA_VIEW, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	unenhanced_list = _tmp3_;
	_tmp4_ = gee_array_list_new (TYPE_DATA_VIEW, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	enhanced_list = _tmp4_;
	{
		GeeList* _view_list = NULL;
		ViewCollection* _tmp5_;
		ViewCollection* _tmp6_;
		GeeList* _tmp7_;
		GeeList* _tmp8_;
		gint _view_size = 0;
		GeeList* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		gint _view_index = 0;
		_tmp5_ = page_get_view ((Page*) self);
		_tmp6_ = _tmp5_;
		_tmp7_ = view_collection_get_selected (_tmp6_);
		_tmp8_ = _tmp7_;
		_data_collection_unref0 (_tmp6_);
		_view_list = _tmp8_;
		_tmp9_ = _view_list;
		_tmp10_ = gee_collection_get_size ((GeeCollection*) _tmp9_);
		_tmp11_ = _tmp10_;
		_view_size = _tmp11_;
		_view_index = -1;
		while (TRUE) {
			gint _tmp12_;
			gint _tmp13_;
			DataView* view = NULL;
			GeeList* _tmp14_;
			gpointer _tmp15_;
			Photo* photo = NULL;
			DataView* _tmp16_;
			DataSource* _tmp17_;
			DataSource* _tmp18_;
			Photo* _tmp19_;
			gboolean _tmp20_ = FALSE;
			Photo* _tmp21_;
			_view_index = _view_index + 1;
			_tmp12_ = _view_index;
			_tmp13_ = _view_size;
			if (!(_tmp12_ < _tmp13_)) {
				break;
			}
			_tmp14_ = _view_list;
			_tmp15_ = gee_list_get (_tmp14_, _view_index);
			view = (DataView*) _tmp15_;
			_tmp16_ = view;
			_tmp17_ = data_view_get_source (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp19_ = _g_object_ref0 (IS_PHOTO (_tmp18_) ? ((Photo*) _tmp18_) : NULL);
			photo = _tmp19_;
			_tmp21_ = photo;
			if (_tmp21_ != NULL) {
				Photo* _tmp22_;
				_tmp22_ = photo;
				_tmp20_ = !photo_is_enhanced (_tmp22_);
			} else {
				_tmp20_ = FALSE;
			}
			if (_tmp20_) {
				GeeArrayList* _tmp23_;
				DataView* _tmp24_;
				_tmp23_ = unenhanced_list;
				_tmp24_ = view;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp23_, _tmp24_);
			} else {
				Photo* _tmp25_;
				_tmp25_ = photo;
				if (_tmp25_ != NULL) {
					GeeArrayList* _tmp26_;
					DataView* _tmp27_;
					_tmp26_ = enhanced_list;
					_tmp27_ = view;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp26_, _tmp27_);
				}
			}
			_g_object_unref0 (photo);
			_g_object_unref0 (view);
		}
		_g_object_unref0 (_view_list);
	}
	_tmp29_ = enhanced_list;
	_tmp30_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp29_);
	_tmp31_ = _tmp30_;
	if (_tmp31_ == 0) {
		GeeArrayList* _tmp32_;
		gint _tmp33_;
		gint _tmp34_;
		_tmp32_ = unenhanced_list;
		_tmp33_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp32_);
		_tmp34_ = _tmp33_;
		_tmp28_ = _tmp34_ == 0;
	} else {
		_tmp28_ = FALSE;
	}
	if (_tmp28_) {
		_g_object_unref0 (enhanced_list);
		_g_object_unref0 (unenhanced_list);
		return;
	}
	_tmp35_ = unenhanced_list;
	_tmp36_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp35_);
	_tmp37_ = _tmp36_;
	if (_tmp37_ == 0) {
		EnhanceMultipleCommand* cmd = NULL;
		CommandManager* _tmp38_;
		CommandManager* _tmp39_;
		Command* _tmp40_;
		EnhanceMultipleCommand* _tmp41_;
		EnhanceMultipleCommand* _tmp42_;
		gboolean _tmp43_ = FALSE;
		EnhanceMultipleCommand* _tmp44_;
		_tmp38_ = page_get_command_manager ((Page*) self);
		_tmp39_ = _tmp38_;
		_tmp40_ = command_manager_get_undo_command (_tmp39_);
		_tmp41_ = IS_ENHANCE_MULTIPLE_COMMAND (_tmp40_) ? ((EnhanceMultipleCommand*) _tmp40_) : NULL;
		if (_tmp41_ == NULL) {
			_g_object_unref0 (_tmp40_);
		}
		_tmp42_ = _tmp41_;
		_command_manager_unref0 (_tmp39_);
		cmd = _tmp42_;
		_tmp44_ = cmd;
		if (_tmp44_ != NULL) {
			EnhanceMultipleCommand* _tmp45_;
			GeeIterable* _tmp46_;
			GeeIterable* _tmp47_;
			ViewCollection* _tmp48_;
			ViewCollection* _tmp49_;
			GeeList* _tmp50_;
			GeeList* _tmp51_;
			_tmp45_ = cmd;
			_tmp46_ = multiple_data_source_command_get_sources ((MultipleDataSourceCommand*) _tmp45_);
			_tmp47_ = _tmp46_;
			_tmp48_ = page_get_view ((Page*) self);
			_tmp49_ = _tmp48_;
			_tmp50_ = view_collection_get_selected_sources (_tmp49_);
			_tmp51_ = _tmp50_;
			_tmp43_ = _tmp47_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp51_, GEE_TYPE_ITERABLE, GeeIterable);
			_g_object_unref0 (_tmp51_);
			_data_collection_unref0 (_tmp49_);
			_g_object_unref0 (_tmp47_);
		} else {
			_tmp43_ = FALSE;
		}
		if (_tmp43_) {
			CommandManager* _tmp52_;
			CommandManager* _tmp53_;
			_tmp52_ = page_get_command_manager ((Page*) self);
			_tmp53_ = _tmp52_;
			command_manager_undo (_tmp53_);
			_command_manager_unref0 (_tmp53_);
		} else {
			UnEnhanceMultipleCommand* command = NULL;
			GeeArrayList* _tmp54_;
			UnEnhanceMultipleCommand* _tmp55_;
			CommandManager* _tmp56_;
			CommandManager* _tmp57_;
			UnEnhanceMultipleCommand* _tmp58_;
			_tmp54_ = enhanced_list;
			_tmp55_ = un_enhance_multiple_command_new ((GeeIterable*) _tmp54_);
			command = _tmp55_;
			_tmp56_ = page_get_command_manager ((Page*) self);
			_tmp57_ = _tmp56_;
			_tmp58_ = command;
			command_manager_execute (_tmp57_, (Command*) _tmp58_);
			_command_manager_unref0 (_tmp57_);
			_g_object_unref0 (command);
		}
		{
			GeeArrayList* _view_list = NULL;
			GeeArrayList* _tmp59_;
			gint _view_size = 0;
			GeeArrayList* _tmp60_;
			gint _tmp61_;
			gint _tmp62_;
			gint _view_index = 0;
			_tmp59_ = enhanced_list;
			_view_list = _tmp59_;
			_tmp60_ = _view_list;
			_tmp61_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp60_);
			_tmp62_ = _tmp61_;
			_view_size = _tmp62_;
			_view_index = -1;
			while (TRUE) {
				gint _tmp63_;
				gint _tmp64_;
				DataView* view = NULL;
				GeeArrayList* _tmp65_;
				gpointer _tmp66_;
				Photo* photo = NULL;
				DataView* _tmp67_;
				DataSource* _tmp68_;
				DataSource* _tmp69_;
				Photo* _tmp70_;
				Photo* _tmp71_;
				_view_index = _view_index + 1;
				_tmp63_ = _view_index;
				_tmp64_ = _view_size;
				if (!(_tmp63_ < _tmp64_)) {
					break;
				}
				_tmp65_ = _view_list;
				_tmp66_ = gee_abstract_list_get ((GeeAbstractList*) _tmp65_, _view_index);
				view = (DataView*) _tmp66_;
				_tmp67_ = view;
				_tmp68_ = data_view_get_source (_tmp67_);
				_tmp69_ = _tmp68_;
				_tmp70_ = _g_object_ref0 (IS_PHOTO (_tmp69_) ? ((Photo*) _tmp69_) : NULL);
				photo = _tmp70_;
				_tmp71_ = photo;
				photo_set_enhanced (_tmp71_, FALSE);
				_g_object_unref0 (photo);
				_g_object_unref0 (view);
			}
		}
		_g_object_unref0 (cmd);
	} else {
		UnEnhanceMultipleCommand* cmd = NULL;
		CommandManager* _tmp72_;
		CommandManager* _tmp73_;
		Command* _tmp74_;
		UnEnhanceMultipleCommand* _tmp75_;
		UnEnhanceMultipleCommand* _tmp76_;
		gboolean _tmp77_ = FALSE;
		UnEnhanceMultipleCommand* _tmp78_;
		_tmp72_ = page_get_command_manager ((Page*) self);
		_tmp73_ = _tmp72_;
		_tmp74_ = command_manager_get_undo_command (_tmp73_);
		_tmp75_ = IS_UN_ENHANCE_MULTIPLE_COMMAND (_tmp74_) ? ((UnEnhanceMultipleCommand*) _tmp74_) : NULL;
		if (_tmp75_ == NULL) {
			_g_object_unref0 (_tmp74_);
		}
		_tmp76_ = _tmp75_;
		_command_manager_unref0 (_tmp73_);
		cmd = _tmp76_;
		_tmp78_ = cmd;
		if (_tmp78_ != NULL) {
			UnEnhanceMultipleCommand* _tmp79_;
			GeeIterable* _tmp80_;
			GeeIterable* _tmp81_;
			ViewCollection* _tmp82_;
			ViewCollection* _tmp83_;
			GeeList* _tmp84_;
			GeeList* _tmp85_;
			_tmp79_ = cmd;
			_tmp80_ = multiple_data_source_command_get_sources ((MultipleDataSourceCommand*) _tmp79_);
			_tmp81_ = _tmp80_;
			_tmp82_ = page_get_view ((Page*) self);
			_tmp83_ = _tmp82_;
			_tmp84_ = view_collection_get_selected_sources (_tmp83_);
			_tmp85_ = _tmp84_;
			_tmp77_ = _tmp81_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp85_, GEE_TYPE_ITERABLE, GeeIterable);
			_g_object_unref0 (_tmp85_);
			_data_collection_unref0 (_tmp83_);
			_g_object_unref0 (_tmp81_);
		} else {
			_tmp77_ = FALSE;
		}
		if (_tmp77_) {
			CommandManager* _tmp86_;
			CommandManager* _tmp87_;
			_tmp86_ = page_get_command_manager ((Page*) self);
			_tmp87_ = _tmp86_;
			command_manager_undo (_tmp87_);
			_command_manager_unref0 (_tmp87_);
		} else {
			EnhanceMultipleCommand* command = NULL;
			GeeArrayList* _tmp88_;
			EnhanceMultipleCommand* _tmp89_;
			CommandManager* _tmp90_;
			CommandManager* _tmp91_;
			EnhanceMultipleCommand* _tmp92_;
			_tmp88_ = unenhanced_list;
			_tmp89_ = enhance_multiple_command_new ((GeeIterable*) _tmp88_);
			command = _tmp89_;
			_tmp90_ = page_get_command_manager ((Page*) self);
			_tmp91_ = _tmp90_;
			_tmp92_ = command;
			command_manager_execute (_tmp91_, (Command*) _tmp92_);
			_command_manager_unref0 (_tmp91_);
			_g_object_unref0 (command);
		}
		{
			GeeArrayList* _view_list = NULL;
			GeeArrayList* _tmp93_;
			gint _view_size = 0;
			GeeArrayList* _tmp94_;
			gint _tmp95_;
			gint _tmp96_;
			gint _view_index = 0;
			_tmp93_ = enhanced_list;
			_view_list = _tmp93_;
			_tmp94_ = _view_list;
			_tmp95_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp94_);
			_tmp96_ = _tmp95_;
			_view_size = _tmp96_;
			_view_index = -1;
			while (TRUE) {
				gint _tmp97_;
				gint _tmp98_;
				DataView* view = NULL;
				GeeArrayList* _tmp99_;
				gpointer _tmp100_;
				Photo* photo = NULL;
				DataView* _tmp101_;
				DataSource* _tmp102_;
				DataSource* _tmp103_;
				Photo* _tmp104_;
				Photo* _tmp105_;
				_view_index = _view_index + 1;
				_tmp97_ = _view_index;
				_tmp98_ = _view_size;
				if (!(_tmp97_ < _tmp98_)) {
					break;
				}
				_tmp99_ = _view_list;
				_tmp100_ = gee_abstract_list_get ((GeeAbstractList*) _tmp99_, _view_index);
				view = (DataView*) _tmp100_;
				_tmp101_ = view;
				_tmp102_ = data_view_get_source (_tmp101_);
				_tmp103_ = _tmp102_;
				_tmp104_ = _g_object_ref0 (IS_PHOTO (_tmp103_) ? ((Photo*) _tmp103_) : NULL);
				photo = _tmp104_;
				_tmp105_ = photo;
				photo_set_enhanced (_tmp105_, TRUE);
				_g_object_unref0 (photo);
				_g_object_unref0 (view);
			}
		}
		_g_object_unref0 (cmd);
	}
	collection_page_update_enhance_toggled (self);
	_g_object_unref0 (enhanced_list);
	_g_object_unref0 (unenhanced_list);
}

static void
collection_page_on_duplicate_photo (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	DuplicateMultiplePhotosCommand* command = NULL;
	ViewCollection* _tmp3_;
	ViewCollection* _tmp4_;
	GeeList* _tmp5_;
	GeeList* _tmp6_;
	DuplicateMultiplePhotosCommand* _tmp7_;
	DuplicateMultiplePhotosCommand* _tmp8_;
	CommandManager* _tmp9_;
	CommandManager* _tmp10_;
	DuplicateMultiplePhotosCommand* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_count (_tmp1_) == 0;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp3_ = page_get_view ((Page*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = view_collection_get_selected (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = duplicate_multiple_photos_command_new ((GeeIterable*) _tmp6_);
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp6_);
	_data_collection_unref0 (_tmp4_);
	command = _tmp8_;
	_tmp9_ = page_get_command_manager ((Page*) self);
	_tmp10_ = _tmp9_;
	_tmp11_ = command;
	command_manager_execute (_tmp10_, (Command*) _tmp11_);
	_command_manager_unref0 (_tmp10_);
	_g_object_unref0 (command);
}

static void
collection_page_on_adjust_date_time (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	gboolean selected_has_videos = FALSE;
	gboolean only_videos_selected = FALSE;
	Dateable* photo_source = NULL;
	ViewCollection* _tmp17_;
	ViewCollection* _tmp18_;
	DataView* _tmp19_;
	DataView* _tmp20_;
	DataSource* _tmp21_;
	DataSource* _tmp22_;
	Dateable* _tmp23_;
	Dateable* _tmp24_;
	AdjustDateTimeDialog* dialog = NULL;
	Dateable* _tmp25_;
	ViewCollection* _tmp26_;
	ViewCollection* _tmp27_;
	AdjustDateTimeDialog* _tmp28_;
	AdjustDateTimeDialog* _tmp29_;
	gint64 time_shift = 0LL;
	gboolean keep_relativity = FALSE;
	gboolean modify_originals = FALSE;
	AdjustDateTimeDialog* _tmp30_;
	gint64 _tmp31_ = 0LL;
	gboolean _tmp32_ = FALSE;
	gboolean _tmp33_ = FALSE;
	gboolean _tmp34_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_count (_tmp1_) == 0;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	selected_has_videos = FALSE;
	only_videos_selected = TRUE;
	{
		GeeList* _dv_list = NULL;
		ViewCollection* _tmp3_;
		ViewCollection* _tmp4_;
		GeeList* _tmp5_;
		GeeList* _tmp6_;
		gint _dv_size = 0;
		GeeList* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		gint _dv_index = 0;
		_tmp3_ = page_get_view ((Page*) self);
		_tmp4_ = _tmp3_;
		_tmp5_ = view_collection_get_selected (_tmp4_);
		_tmp6_ = _tmp5_;
		_data_collection_unref0 (_tmp4_);
		_dv_list = _tmp6_;
		_tmp7_ = _dv_list;
		_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
		_tmp9_ = _tmp8_;
		_dv_size = _tmp9_;
		_dv_index = -1;
		while (TRUE) {
			gint _tmp10_;
			gint _tmp11_;
			DataView* dv = NULL;
			GeeList* _tmp12_;
			gpointer _tmp13_;
			DataView* _tmp14_;
			DataSource* _tmp15_;
			DataSource* _tmp16_;
			_dv_index = _dv_index + 1;
			_tmp10_ = _dv_index;
			_tmp11_ = _dv_size;
			if (!(_tmp10_ < _tmp11_)) {
				break;
			}
			_tmp12_ = _dv_list;
			_tmp13_ = gee_list_get (_tmp12_, _dv_index);
			dv = (DataView*) _tmp13_;
			_tmp14_ = dv;
			_tmp15_ = data_view_get_source (_tmp14_);
			_tmp16_ = _tmp15_;
			if (IS_VIDEO (_tmp16_)) {
				selected_has_videos = TRUE;
			} else {
				only_videos_selected = FALSE;
			}
			_g_object_unref0 (dv);
		}
		_g_object_unref0 (_dv_list);
	}
	_tmp17_ = page_get_view ((Page*) self);
	_tmp18_ = _tmp17_;
	_tmp19_ = view_collection_get_selected_at (_tmp18_, 0);
	_tmp20_ = _tmp19_;
	_tmp21_ = data_view_get_source (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, TYPE_DATEABLE, Dateable));
	_tmp24_ = _tmp23_;
	_g_object_unref0 (_tmp20_);
	_data_collection_unref0 (_tmp18_);
	photo_source = _tmp24_;
	_tmp25_ = photo_source;
	_tmp26_ = page_get_view ((Page*) self);
	_tmp27_ = _tmp26_;
	_tmp28_ = adjust_date_time_dialog_new (_tmp25_, view_collection_get_selected_count (_tmp27_), TRUE, selected_has_videos, only_videos_selected);
	g_object_ref_sink (_tmp28_);
	_tmp29_ = _tmp28_;
	_data_collection_unref0 (_tmp27_);
	dialog = _tmp29_;
	_tmp30_ = dialog;
	_tmp34_ = adjust_date_time_dialog_execute (_tmp30_, &_tmp31_, &_tmp32_, &_tmp33_);
	time_shift = _tmp31_;
	keep_relativity = _tmp32_;
	modify_originals = _tmp33_;
	if (_tmp34_) {
		AdjustDateTimePhotosCommand* command = NULL;
		ViewCollection* _tmp35_;
		ViewCollection* _tmp36_;
		GeeList* _tmp37_;
		GeeList* _tmp38_;
		AdjustDateTimePhotosCommand* _tmp39_;
		AdjustDateTimePhotosCommand* _tmp40_;
		CommandManager* _tmp41_;
		CommandManager* _tmp42_;
		AdjustDateTimePhotosCommand* _tmp43_;
		_tmp35_ = page_get_view ((Page*) self);
		_tmp36_ = _tmp35_;
		_tmp37_ = view_collection_get_selected (_tmp36_);
		_tmp38_ = _tmp37_;
		_tmp39_ = adjust_date_time_photos_command_new ((GeeIterable*) _tmp38_, time_shift, keep_relativity, modify_originals);
		_tmp40_ = _tmp39_;
		_g_object_unref0 (_tmp38_);
		_data_collection_unref0 (_tmp36_);
		command = _tmp40_;
		_tmp41_ = page_get_command_manager ((Page*) self);
		_tmp42_ = _tmp41_;
		_tmp43_ = command;
		command_manager_execute (_tmp42_, (Command*) _tmp43_);
		_command_manager_unref0 (_tmp42_);
		_g_object_unref0 (command);
	}
	_g_object_unref0 (dialog);
	_g_object_unref0 (photo_source);
}

static void
collection_page_on_slideshow (CollectionPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	GeeList* _tmp3_ = NULL;
	ViewCollection* _tmp4_;
	ViewCollection* _tmp5_;
	gboolean _tmp6_;
	GeeList* sources = NULL;
	GeeList* _tmp13_;
	gboolean _tmp14_ = FALSE;
	GeeList* _tmp15_;
	Thumbnail* thumbnail = NULL;
	ViewCollection* _tmp19_;
	ViewCollection* _tmp20_;
	GeeList* _tmp21_;
	gpointer _tmp22_;
	DataSource* _tmp23_;
	DataView* _tmp24_;
	Thumbnail* _tmp25_;
	Thumbnail* _tmp26_;
	LibraryPhoto* photo = NULL;
	Thumbnail* _tmp27_;
	MediaSource* _tmp28_;
	LibraryPhoto* _tmp29_;
	LibraryPhoto* _tmp30_;
	AppWindow* _tmp31_;
	AppWindow* _tmp32_;
	LibraryPhotoSourceCollection* _tmp33_;
	ViewCollection* _tmp34_;
	ViewCollection* _tmp35_;
	LibraryPhoto* _tmp36_;
	SlideshowPage* _tmp37_;
	SlideshowPage* _tmp38_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = data_collection_get_count ((DataCollection*) _tmp1_) == 0;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	_tmp4_ = page_get_view ((Page*) self);
	_tmp5_ = _tmp4_;
	_tmp6_ = view_collection_get_selected_count (_tmp5_) > 0;
	_data_collection_unref0 (_tmp5_);
	if (_tmp6_) {
		ViewCollection* _tmp7_;
		ViewCollection* _tmp8_;
		GeeList* _tmp9_;
		_tmp7_ = page_get_view ((Page*) self);
		_tmp8_ = _tmp7_;
		_tmp9_ = view_collection_get_selected_sources_of_type (_tmp8_, TYPE_LIBRARY_PHOTO);
		_g_object_unref0 (_tmp3_);
		_tmp3_ = _tmp9_;
		_data_collection_unref0 (_tmp8_);
	} else {
		ViewCollection* _tmp10_;
		ViewCollection* _tmp11_;
		GeeList* _tmp12_;
		_tmp10_ = page_get_view ((Page*) self);
		_tmp11_ = _tmp10_;
		_tmp12_ = view_collection_get_sources_of_type (_tmp11_, TYPE_LIBRARY_PHOTO);
		_g_object_unref0 (_tmp3_);
		_tmp3_ = _tmp12_;
		_data_collection_unref0 (_tmp11_);
	}
	_tmp13_ = _tmp3_;
	_tmp3_ = NULL;
	sources = _tmp13_;
	_tmp15_ = sources;
	if (_tmp15_ == NULL) {
		_tmp14_ = TRUE;
	} else {
		GeeList* _tmp16_;
		gint _tmp17_;
		gint _tmp18_;
		_tmp16_ = sources;
		_tmp17_ = gee_collection_get_size ((GeeCollection*) _tmp16_);
		_tmp18_ = _tmp17_;
		_tmp14_ = _tmp18_ == 0;
	}
	if (_tmp14_) {
		_g_object_unref0 (sources);
		_g_object_unref0 (_tmp3_);
		return;
	}
	_tmp19_ = page_get_view ((Page*) self);
	_tmp20_ = _tmp19_;
	_tmp21_ = sources;
	_tmp22_ = gee_list_get (_tmp21_, 0);
	_tmp23_ = (DataSource*) _tmp22_;
	_tmp24_ = view_collection_get_view_for_source (_tmp20_, _tmp23_);
	_tmp25_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, TYPE_THUMBNAIL, Thumbnail);
	_g_object_unref0 (_tmp23_);
	_data_collection_unref0 (_tmp20_);
	thumbnail = _tmp25_;
	_tmp26_ = thumbnail;
	if (_tmp26_ == NULL) {
		_g_object_unref0 (thumbnail);
		_g_object_unref0 (sources);
		_g_object_unref0 (_tmp3_);
		return;
	}
	_tmp27_ = thumbnail;
	_tmp28_ = thumbnail_get_media_source (_tmp27_);
	_tmp29_ = IS_LIBRARY_PHOTO (_tmp28_) ? ((LibraryPhoto*) _tmp28_) : NULL;
	if (_tmp29_ == NULL) {
		_g_object_unref0 (_tmp28_);
	}
	photo = _tmp29_;
	_tmp30_ = photo;
	if (_tmp30_ == NULL) {
		_g_object_unref0 (photo);
		_g_object_unref0 (thumbnail);
		_g_object_unref0 (sources);
		_g_object_unref0 (_tmp3_);
		return;
	}
	_tmp31_ = app_window_get_instance ();
	_tmp32_ = _tmp31_;
	_tmp33_ = library_photo_global;
	_tmp34_ = page_get_view ((Page*) self);
	_tmp35_ = _tmp34_;
	_tmp36_ = photo;
	_tmp37_ = slideshow_page_new ((SourceCollection*) _tmp33_, _tmp35_, (Photo*) _tmp36_);
	g_object_ref_sink (_tmp37_);
	_tmp38_ = _tmp37_;
	app_window_go_fullscreen (_tmp32_, (Page*) _tmp38_);
	_g_object_unref0 (_tmp38_);
	_data_collection_unref0 (_tmp35_);
	_g_object_unref0 (_tmp32_);
	_g_object_unref0 (photo);
	_g_object_unref0 (thumbnail);
	_g_object_unref0 (sources);
	_g_object_unref0 (_tmp3_);
}

static void
_collection_page_on_flip_vertically_gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	collection_page_on_flip_vertically ((CollectionPage*) self);
}

static void
_collection_page_on_rotate_counterclockwise_gtk_button_clicked (GtkButton* _sender,
                                                                gpointer self)
{
	collection_page_on_rotate_counterclockwise ((CollectionPage*) self);
}

static gboolean
collection_page_real_on_ctrl_pressed (Page* base,
                                      GdkEventKey* event)
{
	CollectionPage * self;
	GtkButton* _tmp0_;
	GtkImage* _tmp1_;
	GtkImage* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	GtkImage* _tmp5_;
	GtkImage* _tmp6_;
	GtkButton* _tmp7_;
	GtkButton* _tmp8_;
	guint _tmp9_;
	GtkButton* _tmp10_;
	GtkButton* _tmp11_;
	guint _tmp12_;
	GtkButton* _tmp13_;
	gboolean result;
	self = (CollectionPage*) base;
	_tmp0_ = self->priv->flip_button;
	_tmp1_ = (GtkImage*) gtk_image_new_from_icon_name (RESOURCES_VFLIP, (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	gtk_button_set_image (_tmp0_, (GtkWidget*) _tmp2_);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = self->priv->flip_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp3_, RESOURCES_VFLIP_TOOLTIP);
	_tmp4_ = self->priv->rotate_button;
	_tmp5_ = (GtkImage*) gtk_image_new_from_icon_name (RESOURCES_COUNTERCLOCKWISE, (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp5_);
	_tmp6_ = _tmp5_;
	gtk_button_set_image (_tmp4_, (GtkWidget*) _tmp6_);
	_g_object_unref0 (_tmp6_);
	_tmp7_ = self->priv->rotate_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp7_, RESOURCES_ROTATE_CCW_TOOLTIP);
	_tmp8_ = self->priv->flip_button;
	g_signal_parse_name ("clicked", gtk_button_get_type (), &_tmp9_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _collection_page_on_flip_horizontally_gtk_button_clicked, self);
	_tmp10_ = self->priv->flip_button;
	g_signal_connect_object (_tmp10_, "clicked", (GCallback) _collection_page_on_flip_vertically_gtk_button_clicked, self, 0);
	_tmp11_ = self->priv->rotate_button;
	g_signal_parse_name ("clicked", gtk_button_get_type (), &_tmp12_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp11_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp12_, 0, NULL, (GCallback) _collection_page_on_rotate_clockwise_gtk_button_clicked, self);
	_tmp13_ = self->priv->rotate_button;
	g_signal_connect_object (_tmp13_, "clicked", (GCallback) _collection_page_on_rotate_counterclockwise_gtk_button_clicked, self, 0);
	result = PAGE_CLASS (collection_page_parent_class)->on_ctrl_pressed ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MEDIA_PAGE, MediaPage), event);
	return result;
}

static gboolean
collection_page_real_on_ctrl_released (Page* base,
                                       GdkEventKey* event)
{
	CollectionPage * self;
	GtkButton* _tmp0_;
	GtkImage* _tmp1_;
	GtkImage* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	GtkImage* _tmp5_;
	GtkImage* _tmp6_;
	GtkButton* _tmp7_;
	GtkButton* _tmp8_;
	guint _tmp9_;
	GtkButton* _tmp10_;
	GtkButton* _tmp11_;
	guint _tmp12_;
	GtkButton* _tmp13_;
	gboolean result;
	self = (CollectionPage*) base;
	_tmp0_ = self->priv->flip_button;
	_tmp1_ = (GtkImage*) gtk_image_new_from_icon_name (RESOURCES_HFLIP, (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	gtk_button_set_image (_tmp0_, (GtkWidget*) _tmp2_);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = self->priv->flip_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp3_, RESOURCES_HFLIP_TOOLTIP);
	_tmp4_ = self->priv->rotate_button;
	_tmp5_ = (GtkImage*) gtk_image_new_from_icon_name (RESOURCES_CLOCKWISE, (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp5_);
	_tmp6_ = _tmp5_;
	gtk_button_set_image (_tmp4_, (GtkWidget*) _tmp6_);
	_g_object_unref0 (_tmp6_);
	_tmp7_ = self->priv->rotate_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp7_, RESOURCES_ROTATE_CW_TOOLTIP);
	_tmp8_ = self->priv->flip_button;
	g_signal_parse_name ("clicked", gtk_button_get_type (), &_tmp9_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _collection_page_on_flip_vertically_gtk_button_clicked, self);
	_tmp10_ = self->priv->flip_button;
	g_signal_connect_object (_tmp10_, "clicked", (GCallback) _collection_page_on_flip_horizontally_gtk_button_clicked, self, 0);
	_tmp11_ = self->priv->rotate_button;
	g_signal_parse_name ("clicked", gtk_button_get_type (), &_tmp12_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp11_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp12_, 0, NULL, (GCallback) _collection_page_on_rotate_counterclockwise_gtk_button_clicked, self);
	_tmp13_ = self->priv->rotate_button;
	g_signal_connect_object (_tmp13_, "clicked", (GCallback) _collection_page_on_rotate_clockwise_gtk_button_clicked, self, 0);
	result = PAGE_CLASS (collection_page_parent_class)->on_ctrl_released ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_MEDIA_PAGE, MediaPage), event);
	return result;
}

static gchar*
collection_page_real_get_view_empty_message (CheckerboardPage* base)
{
	CollectionPage * self;
	LibraryWindow* window = NULL;
	AppWindow* _tmp0_;
	LibraryWindow* _tmp1_;
	LibraryWindow* _tmp2_;
	LibraryWindow* _tmp3_;
	gchar* _tmp5_;
	gchar* result;
	self = (CollectionPage*) base;
	_tmp0_ = app_window_get_instance ();
	_tmp1_ = IS_LIBRARY_WINDOW (_tmp0_) ? ((LibraryWindow*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	window = _tmp1_;
	_tmp2_ = window;
	g_warn_if_fail (_tmp2_ != NULL);
	_tmp3_ = window;
	if (_tmp3_ != NULL) {
		LibraryWindow* _tmp4_;
		_tmp4_ = window;
		library_window_toggle_welcome_page (_tmp4_, TRUE, "", _ ("No photos/videos"), FALSE);
	}
	_tmp5_ = g_strdup (_ ("No photos/videos"));
	result = _tmp5_;
	_g_object_unref0 (window);
	return result;
}

static gpointer
_view_filter_ref0 (gpointer self)
{
	return self ? view_filter_ref (self) : NULL;
}

static SearchViewFilter*
collection_page_real_get_search_view_filter (CheckerboardPage* base)
{
	CollectionPage * self;
	CollectionPageCollectionSearchViewFilter* _tmp0_;
	SearchViewFilter* _tmp1_;
	SearchViewFilter* result;
	self = (CollectionPage*) base;
	_tmp0_ = self->priv->search_filter;
	_tmp1_ = _view_filter_ref0 ((SearchViewFilter*) _tmp0_);
	result = _tmp1_;
	return result;
}

static guint
collection_page_collection_search_view_filter_real_get_criteria (SearchViewFilter* base)
{
	CollectionPageCollectionSearchViewFilter * self;
	guint result;
	self = (CollectionPageCollectionSearchViewFilter*) base;
	result = (guint) ((SEARCH_FILTER_CRITERIA_TEXT | SEARCH_FILTER_CRITERIA_FLAG) | SEARCH_FILTER_CRITERIA_MEDIA);
	return result;
}

CollectionPageCollectionSearchViewFilter*
collection_page_collection_search_view_filter_construct (GType object_type)
{
	CollectionPageCollectionSearchViewFilter* self = NULL;
	self = (CollectionPageCollectionSearchViewFilter*) default_search_view_filter_construct (object_type);
	return self;
}

CollectionPageCollectionSearchViewFilter*
collection_page_collection_search_view_filter_new (void)
{
	return collection_page_collection_search_view_filter_construct (COLLECTION_PAGE_TYPE_COLLECTION_SEARCH_VIEW_FILTER);
}

static void
collection_page_collection_search_view_filter_class_init (CollectionPageCollectionSearchViewFilterClass * klass,
                                                          gpointer klass_data)
{
	collection_page_collection_search_view_filter_parent_class = g_type_class_peek_parent (klass);
	((SearchViewFilterClass *) klass)->get_criteria = (guint (*) (SearchViewFilter*)) collection_page_collection_search_view_filter_real_get_criteria;
}

static void
collection_page_collection_search_view_filter_instance_init (CollectionPageCollectionSearchViewFilter * self,
                                                             gpointer klass)
{
}

static GType
collection_page_collection_search_view_filter_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (CollectionPageCollectionSearchViewFilterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) collection_page_collection_search_view_filter_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CollectionPageCollectionSearchViewFilter), 0, (GInstanceInitFunc) collection_page_collection_search_view_filter_instance_init, NULL };
	GType collection_page_collection_search_view_filter_type_id;
	collection_page_collection_search_view_filter_type_id = g_type_register_static (TYPE_DEFAULT_SEARCH_VIEW_FILTER, "CollectionPageCollectionSearchViewFilter", &g_define_type_info, 0);
	return collection_page_collection_search_view_filter_type_id;
}

GType
collection_page_collection_search_view_filter_get_type (void)
{
	static volatile gsize collection_page_collection_search_view_filter_type_id__once = 0;
	if (g_once_init_enter (&collection_page_collection_search_view_filter_type_id__once)) {
		GType collection_page_collection_search_view_filter_type_id;
		collection_page_collection_search_view_filter_type_id = collection_page_collection_search_view_filter_get_type_once ();
		g_once_init_leave (&collection_page_collection_search_view_filter_type_id__once, collection_page_collection_search_view_filter_type_id);
	}
	return collection_page_collection_search_view_filter_type_id__once;
}

static void
_collection_page_on_photos_altered_data_collection_items_altered (DataCollection* _sender,
                                                                  GeeMap* items,
                                                                  gpointer self)
{
	collection_page_on_photos_altered ((CollectionPage*) self, items);
}

static GObject *
collection_page_constructor (GType type,
                             guint n_construct_properties,
                             GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	CollectionPage * self;
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	parent_class = G_OBJECT_CLASS (collection_page_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_COLLECTION_PAGE, CollectionPage);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	g_signal_connect_object ((DataCollection*) _tmp1_, "items-altered", (GCallback) _collection_page_on_photos_altered_data_collection_items_altered, self, 0);
	_data_collection_unref0 (_tmp1_);
	gtk_widget_show_all ((GtkWidget*) self);
	return obj;
}

static void
collection_page_class_init (CollectionPageClass * klass,
                            gpointer klass_data)
{
	GdkDisplay* _tmp0_;
	GtkClipboard* _tmp1_;
	GtkClipboard* _tmp2_;
	collection_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &CollectionPage_private_offset);
	((PageClass *) klass)->add_toolbar_widgets = (void (*) (Page*, GtkActionBar*)) collection_page_real_add_toolbar_widgets;
	((CheckerboardPageClass *) klass)->get_item_context_menu = (GtkMenu* (*) (CheckerboardPage*)) collection_page_real_get_item_context_menu;
	((PageClass *) klass)->init_collect_action_entries = (GtkActionEntry* (*) (Page*, gint*)) collection_page_real_init_collect_action_entries;
	((PageClass *) klass)->init_actions = (void (*) (Page*, gint, gint)) collection_page_real_init_actions;
	((PageClass *) klass)->update_actions = (void (*) (Page*, gint, gint)) collection_page_real_update_actions;
	((CheckerboardPageClass *) klass)->on_item_activated = (void (*) (CheckerboardPage*, CheckerboardItem*)) collection_page_real_on_item_activated;
	((PageClass *) klass)->on_app_key_pressed = (gboolean (*) (Page*, GdkEventKey*)) collection_page_real_on_app_key_pressed;
	((MediaPageClass *) klass)->on_export = (void (*) (MediaPage*)) collection_page_real_on_export;
	((PageClass *) klass)->on_ctrl_pressed = (gboolean (*) (Page*, GdkEventKey*)) collection_page_real_on_ctrl_pressed;
	((PageClass *) klass)->on_ctrl_released = (gboolean (*) (Page*, GdkEventKey*)) collection_page_real_on_ctrl_released;
	((CheckerboardPageClass *) klass)->get_view_empty_message = (gchar* (*) (CheckerboardPage*)) collection_page_real_get_view_empty_message;
	((CheckerboardPageClass *) klass)->get_search_view_filter = (SearchViewFilter* (*) (CheckerboardPage*)) collection_page_real_get_search_view_filter;
	G_OBJECT_CLASS (klass)->constructor = collection_page_constructor;
	G_OBJECT_CLASS (klass)->finalize = collection_page_finalize;
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gtk_clipboard_get_for_display (_tmp0_, GDK_SELECTION_CLIPBOARD);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (collection_page_clipboard);
	collection_page_clipboard = _tmp2_;
}

static void
collection_page_instance_init (CollectionPage * self,
                               gpointer klass)
{
	CollectionPageCollectionSearchViewFilter* _tmp0_;
	self->priv = collection_page_get_instance_private (self);
	self->priv->exporter = NULL;
	_tmp0_ = collection_page_collection_search_view_filter_new ();
	self->priv->search_filter = _tmp0_;
	self->priv->enhance_button = NULL;
}

static void
collection_page_finalize (GObject * obj)
{
	CollectionPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_COLLECTION_PAGE, CollectionPage);
	_exporter_ui_unref0 (self->priv->exporter);
	_view_filter_unref0 (self->priv->search_filter);
	_g_object_unref0 (self->priv->enhance_button);
	_g_object_unref0 (self->priv->item_context_menu);
	_g_object_unref0 (self->priv->contractor_menu);
	_g_object_unref0 (self->priv->rotate_button);
	_g_object_unref0 (self->priv->flip_button);
	G_OBJECT_CLASS (collection_page_parent_class)->finalize (obj);
}

static GType
collection_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (CollectionPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) collection_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CollectionPage), 0, (GInstanceInitFunc) collection_page_instance_init, NULL };
	GType collection_page_type_id;
	collection_page_type_id = g_type_register_static (TYPE_MEDIA_PAGE, "CollectionPage", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	CollectionPage_private_offset = g_type_add_instance_private (collection_page_type_id, sizeof (CollectionPagePrivate));
	return collection_page_type_id;
}

GType
collection_page_get_type (void)
{
	static volatile gsize collection_page_type_id__once = 0;
	if (g_once_init_enter (&collection_page_type_id__once)) {
		GType collection_page_type_id;
		collection_page_type_id = collection_page_get_type_once ();
		g_once_init_leave (&collection_page_type_id__once, collection_page_type_id);
	}
	return collection_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;
}

