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

/*
* Copyright (c) 2010-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 <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <gee.h>
#include <float.h>
#include <math.h>

#define MEDIA_PAGE_SORT_ORDER_ASCENDING 0
#define MEDIA_PAGE_SORT_ORDER_DESCENDING 1
#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  {
	MEDIA_PAGE_0_PROPERTY,
	MEDIA_PAGE_NUM_PROPERTIES
};
static GParamSpec* media_page_properties[MEDIA_PAGE_NUM_PROPERTIES];
typedef enum  {
	MEDIA_PAGE_SORT_BY_MIN = 1,
	MEDIA_PAGE_SORT_BY_TITLE = 1,
	MEDIA_PAGE_SORT_BY_EXPOSURE_DATE = 2,
	MEDIA_PAGE_SORT_BY_TIMESTAMP = 3,
	MEDIA_PAGE_SORT_BY_MAX = 3
} MediaPageSortBy;

#define MEDIA_PAGE_TYPE_SORT_BY (media_page_sort_by_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _drag_and_drop_handler_unref0(var) ((var == NULL) ? NULL : (var = (drag_and_drop_handler_unref (var), NULL)))
#define _core_tracker_unref0(var) ((var == NULL) ? NULL : (var = (core_tracker_unref (var), NULL)))
typedef struct _Block19Data Block19Data;
#define _alteration_unref0(var) ((var == NULL) ? NULL : (var = (alteration_unref (var), NULL)))
#define _data_collection_unref0(var) ((var == NULL) ? NULL : (var = (data_collection_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _command_manager_unref0(var) ((var == NULL) ? NULL : (var = (command_manager_unref (var), NULL)))
#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 _MediaPagePrivate {
	SliderAssembly* connected_slider;
	DragAndDropHandler* dnd_handler;
	MediaViewTracker* tracker;
	GtkMenu* page_context_menu;
};

struct _Block19Data {
	int _ref_count_;
	MediaPage* self;
	GtkRadioMenuItem* by_title_menu_item;
	GtkAction* by_title_action;
	GtkRadioMenuItem* by_exposure_menu_item;
	GtkAction* by_exposure_action;
	GtkRadioMenuItem* by_timestamp_menu_item;
	GtkAction* by_timestamp_action;
	GtkRadioMenuItem* ascending_photos_menu_item;
	GtkAction* ascending_photos_action;
	GtkRadioMenuItem* descending_photos_menu_item;
	GtkAction* descending_photos_action;
	GtkRadioMenuItem* ascending_menu_item;
	GtkAction* ascending_action;
	GtkRadioMenuItem* descending_menu_item;
	GtkAction* descending_action;
	GAction* fullscreen_action;
	GAction* select_action;
};

static gint MediaPage_private_offset;
static gpointer media_page_parent_class = NULL;

static GType media_page_sort_by_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static GtkMenu* media_page_real_get_page_context_menu (Page* base);
static Block19Data* block19_data_ref (Block19Data* _data19_);
static void block19_data_unref (void * _userdata_);
static void ___lambda23_ (Block19Data* _data19_);
static void ____lambda23__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda24_ (Block19Data* _data19_);
static void ____lambda24__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda25_ (Block19Data* _data19_);
static void ____lambda25__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda26_ (Block19Data* _data19_);
static void ____lambda26__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda27_ (Block19Data* _data19_);
static void ____lambda27__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda28_ (Block19Data* _data19_);
static void ____lambda28__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda29_ (Block19Data* _data19_);
static void ____lambda29__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda30_ (Block19Data* _data19_);
static void ____lambda30__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda31_ (Block19Data* _data19_);
static void ____lambda31__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static gint media_page_compute_zoom_scale_increase (gint current_scale);
static gint media_page_compute_zoom_scale_decrease (gint current_scale);
static GtkActionEntry* media_page_real_init_collect_action_entries (Page* base,
                                                             gint* result_length1);
static void _media_page_on_export_gcallback (GtkAction* action,
                                      gpointer self);
static void media_page_on_remove_from_library (MediaPage* self);
static void _media_page_on_remove_from_library_gcallback (GtkAction* action,
                                                   gpointer self);
static void _media_page_on_move_to_trash_gcallback (GtkAction* action,
                                             gpointer self);
static void media_page_on_new_event (MediaPage* self);
static void _media_page_on_new_event_gcallback (GtkAction* action,
                                         gpointer self);
static void _media_page_on_increase_size_gcallback (GtkAction* action,
                                             gpointer self);
static void _media_page_on_decrease_size_gcallback (GtkAction* action,
                                             gpointer self);
static void media_page_on_flag_unflag (MediaPage* self);
static void _media_page_on_flag_unflag_gcallback (GtkAction* action,
                                           gpointer self);
static void media_page_on_raw_developer_shotwell (MediaPage* self,
                                           GtkAction* action);
static void _media_page_on_raw_developer_shotwell_gcallback (GtkAction* action,
                                                      gpointer self);
static void media_page_on_raw_developer_camera (MediaPage* self,
                                         GtkAction* action);
static void _media_page_on_raw_developer_camera_gcallback (GtkAction* action,
                                                    gpointer self);
static void _vala_array_add190 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add191 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add192 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add193 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add194 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add195 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add196 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add197 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add198 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add199 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add200 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void _vala_array_add201 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static GtkToggleActionEntry* media_page_real_init_collect_toggle_action_entries (Page* base,
                                                                          gint* result_length1);
static void _media_page_on_display_titles_gcallback (GtkAction* action,
                                              gpointer self);
static void _vala_array_add202 (GtkToggleActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkToggleActionEntry* value);
static void _media_page_on_display_comments_gcallback (GtkAction* action,
                                                gpointer self);
static void _vala_array_add203 (GtkToggleActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkToggleActionEntry* value);
static void _media_page_on_display_tags_gcallback (GtkAction* action,
                                            gpointer self);
static void _vala_array_add204 (GtkToggleActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkToggleActionEntry* value);
static void media_page_real_register_radio_actions (Page* base,
                                             GtkActionGroup* action_group);
static void _vala_array_add205 (GtkRadioActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkRadioActionEntry* value);
static void _vala_array_add206 (GtkRadioActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkRadioActionEntry* value);
static void _vala_array_add207 (GtkRadioActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkRadioActionEntry* value);
static void _media_page_on_sort_changed_gcallback (GtkAction* action,
                                            GtkAction* current,
                                            gpointer self);
static void _vala_array_add208 (GtkRadioActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkRadioActionEntry* value);
static void _vala_array_add209 (GtkRadioActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkRadioActionEntry* value);
static void media_page_real_update_actions (Page* base,
                                     gint selected_count,
                                     gint count);
static gint media_page_get_thumb_size (MediaPage* self);
static void media_page_update_development_menu_item_sensitivity (MediaPage* self);
static void media_page_update_flag_action (MediaPage* self,
                                    gint selected_count);
static void media_page_on_media_altered (MediaPage* self,
                                  GeeMap* altered);
static CoreViewTracker* media_page_real_get_view_tracker (CheckerboardPage* base);
static gboolean media_page_real_on_mousewheel_up (Page* base,
                                           GdkEventScroll* event);
static void media_page_increase_zoom_level (MediaPage* self);
static gboolean media_page_real_on_mousewheel_down (Page* base,
                                             GdkEventScroll* event);
static void media_page_decrease_zoom_level (MediaPage* self);
static gboolean media_page_real_on_app_key_pressed (Page* base,
                                             GdkEventKey* event);
static void media_page_real_switched_to (Page* base);
static void media_page_set_display_tags (MediaPage* self,
                                  gboolean display);
static void media_page_real_switching_from (Page* base);
static void _media_page_on_zoom_changed_slider_assembly_value_changed (SliderAssembly* _sender,
                                                                gpointer self);
static void media_page_load_persistent_thumbnail_scale (MediaPage* self);
static void media_page_save_persistent_thumbnail_scale (MediaPage* self);
static void media_page_set_thumb_size (MediaPage* self,
                                gint new_scale);
static void media_page_real_on_zoom_changed (MediaPage* self);
static void media_page_real_on_export (MediaPage* self);
static void media_page_real_on_increase_size (MediaPage* self);
static void media_page_real_on_decrease_size (MediaPage* self);
static void media_page_real_on_move_to_trash (MediaPage* self);
static void media_page_real_on_display_titles (MediaPage* self,
                                        GtkAction* action);
static void media_page_real_on_display_comments (MediaPage* self,
                                          GtkAction* action);
static void media_page_real_on_display_tags (MediaPage* self,
                                      GtkAction* action);
static void media_page_real_get_config_photos_sort (MediaPage* self,
                                             gboolean* sort_order,
                                             gint* sort_by);
static void media_page_real_set_config_photos_sort (MediaPage* self,
                                             gboolean sort_order,
                                             gint sort_by);
static void media_page_real_on_sort_changed (MediaPage* self);
static void media_page_set_view_comparator (MediaPage* self,
                                     gint sort_by,
                                     gboolean ascending);
static void media_page_real_developer_changed (MediaPage* self,
                                        RawDeveloper rd);
static void media_page_real_set_display_titles (CheckerboardPage* base,
                                         gboolean display);
static void media_page_real_set_display_comments (CheckerboardPage* base,
                                           gboolean display);
static GtkRadioAction* media_page_sort_by_title_action (MediaPage* self);
static GtkRadioAction* media_page_sort_ascending_action (MediaPage* self);
static gint64 _thumbnail_title_ascending_comparator_comparator (void* a,
                                                         void* b,
                                                         gpointer self);
static gint64 _thumbnail_title_descending_comparator_comparator (void* a,
                                                          void* b,
                                                          gpointer self);
static gboolean _thumbnail_title_comparator_predicate_comparator_predicate (DataObject* object,
                                                                     Alteration* alteration,
                                                                     gpointer self);
static gint64 _thumbnail_exposure_time_ascending_comparator_comparator (void* a,
                                                                 void* b,
                                                                 gpointer self);
static gint64 _thumbnail_exposure_time_descending_comparator_comparator (void* a,
                                                                  void* b,
                                                                  gpointer self);
static gboolean _thumbnail_exposure_time_comparator_predicate_comparator_predicate (DataObject* object,
                                                                             Alteration* alteration,
                                                                             gpointer self);
static gint64 _thumbnail_timestamp_ascending_comparator_comparator (void* a,
                                                             void* b,
                                                             gpointer self);
static gint64 _thumbnail_timestamp_descending_comparator_comparator (void* a,
                                                              void* b,
                                                              gpointer self);
static gboolean _thumbnail_timestamp_comparator_predicate_comparator_predicate (DataObject* object,
                                                                         Alteration* alteration,
                                                                         gpointer self);
static void media_page_real_destroy (GtkWidget* base);
static DataView* media_page_real_create_thumbnail (MediaPage* self,
                                            DataSource* source);
static GObject * media_page_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties);
static void _media_page_on_media_altered_data_collection_items_altered (DataCollection* _sender,
                                                                 GeeMap* items,
                                                                 gpointer self);
static void media_page_finalize (GObject * obj);
static GType media_page_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
media_page_get_instance_private (MediaPage* self)
{
	return G_STRUCT_MEMBER_P (self, MediaPage_private_offset);
}

static GType
media_page_sort_by_get_type_once (void)
{
	static const GEnumValue values[] = {{MEDIA_PAGE_SORT_BY_MIN, "MEDIA_PAGE_SORT_BY_MIN", "min"}, {MEDIA_PAGE_SORT_BY_TITLE, "MEDIA_PAGE_SORT_BY_TITLE", "title"}, {MEDIA_PAGE_SORT_BY_EXPOSURE_DATE, "MEDIA_PAGE_SORT_BY_EXPOSURE_DATE", "exposure-date"}, {MEDIA_PAGE_SORT_BY_TIMESTAMP, "MEDIA_PAGE_SORT_BY_TIMESTAMP", "timestamp"}, {MEDIA_PAGE_SORT_BY_MAX, "MEDIA_PAGE_SORT_BY_MAX", "max"}, {0, NULL, NULL}};
	GType media_page_sort_by_type_id;
	media_page_sort_by_type_id = g_enum_register_static ("MediaPageSortBy", values);
	return media_page_sort_by_type_id;
}

static GType
media_page_sort_by_get_type (void)
{
	static volatile gsize media_page_sort_by_type_id__once = 0;
	if (g_once_init_enter (&media_page_sort_by_type_id__once)) {
		GType media_page_sort_by_type_id;
		media_page_sort_by_type_id = media_page_sort_by_get_type_once ();
		g_once_init_leave (&media_page_sort_by_type_id__once, media_page_sort_by_type_id);
	}
	return media_page_sort_by_type_id__once;
}

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

static Block19Data*
block19_data_ref (Block19Data* _data19_)
{
	g_atomic_int_inc (&_data19_->_ref_count_);
	return _data19_;
}

static void
block19_data_unref (void * _userdata_)
{
	Block19Data* _data19_;
	_data19_ = (Block19Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data19_->_ref_count_)) {
		MediaPage* self;
		self = _data19_->self;
		_g_object_unref0 (_data19_->select_action);
		_g_object_unref0 (_data19_->fullscreen_action);
		_g_object_unref0 (_data19_->descending_action);
		_g_object_unref0 (_data19_->descending_menu_item);
		_g_object_unref0 (_data19_->ascending_action);
		_g_object_unref0 (_data19_->ascending_menu_item);
		_g_object_unref0 (_data19_->descending_photos_action);
		_g_object_unref0 (_data19_->descending_photos_menu_item);
		_g_object_unref0 (_data19_->ascending_photos_action);
		_g_object_unref0 (_data19_->ascending_photos_menu_item);
		_g_object_unref0 (_data19_->by_timestamp_action);
		_g_object_unref0 (_data19_->by_timestamp_menu_item);
		_g_object_unref0 (_data19_->by_exposure_action);
		_g_object_unref0 (_data19_->by_exposure_menu_item);
		_g_object_unref0 (_data19_->by_title_action);
		_g_object_unref0 (_data19_->by_title_menu_item);
		_g_object_unref0 (self);
		g_slice_free (Block19Data, _data19_);
	}
}

static void
___lambda23_ (Block19Data* _data19_)
{
	MediaPage* self;
	GtkRadioMenuItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data19_->self;
	_tmp0_ = _data19_->by_title_menu_item;
	_tmp1_ = gtk_check_menu_item_get_active ((GtkCheckMenuItem*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkAction* _tmp3_;
		_tmp3_ = _data19_->by_title_action;
		gtk_action_activate (_tmp3_);
	}
}

static void
____lambda23__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda23_ (self);
}

static void
___lambda24_ (Block19Data* _data19_)
{
	MediaPage* self;
	GtkRadioMenuItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data19_->self;
	_tmp0_ = _data19_->by_exposure_menu_item;
	_tmp1_ = gtk_check_menu_item_get_active ((GtkCheckMenuItem*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkAction* _tmp3_;
		_tmp3_ = _data19_->by_exposure_action;
		gtk_action_activate (_tmp3_);
	}
}

static void
____lambda24__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda24_ (self);
}

static void
___lambda25_ (Block19Data* _data19_)
{
	MediaPage* self;
	GtkRadioMenuItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data19_->self;
	_tmp0_ = _data19_->by_timestamp_menu_item;
	_tmp1_ = gtk_check_menu_item_get_active ((GtkCheckMenuItem*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkAction* _tmp3_;
		_tmp3_ = _data19_->by_timestamp_action;
		gtk_action_activate (_tmp3_);
	}
}

static void
____lambda25__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda25_ (self);
}

static void
___lambda26_ (Block19Data* _data19_)
{
	MediaPage* self;
	GtkRadioMenuItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data19_->self;
	_tmp0_ = _data19_->ascending_photos_menu_item;
	_tmp1_ = gtk_check_menu_item_get_active ((GtkCheckMenuItem*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkAction* _tmp3_;
		_tmp3_ = _data19_->ascending_photos_action;
		gtk_action_activate (_tmp3_);
	}
}

static void
____lambda26__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda26_ (self);
}

static void
___lambda27_ (Block19Data* _data19_)
{
	MediaPage* self;
	GtkRadioMenuItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data19_->self;
	_tmp0_ = _data19_->descending_photos_menu_item;
	_tmp1_ = gtk_check_menu_item_get_active ((GtkCheckMenuItem*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkAction* _tmp3_;
		_tmp3_ = _data19_->descending_photos_action;
		gtk_action_activate (_tmp3_);
	}
}

static void
____lambda27__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda27_ (self);
}

static void
___lambda28_ (Block19Data* _data19_)
{
	MediaPage* self;
	GtkRadioMenuItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data19_->self;
	_tmp0_ = _data19_->ascending_menu_item;
	_tmp1_ = gtk_check_menu_item_get_active ((GtkCheckMenuItem*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkAction* _tmp3_;
		_tmp3_ = _data19_->ascending_action;
		gtk_action_activate (_tmp3_);
	}
}

static void
____lambda28__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda28_ (self);
}

static void
___lambda29_ (Block19Data* _data19_)
{
	MediaPage* self;
	GtkRadioMenuItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data19_->self;
	_tmp0_ = _data19_->descending_menu_item;
	_tmp1_ = gtk_check_menu_item_get_active ((GtkCheckMenuItem*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkAction* _tmp3_;
		_tmp3_ = _data19_->descending_action;
		gtk_action_activate (_tmp3_);
	}
}

static void
____lambda29__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda29_ (self);
}

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

static void
___lambda30_ (Block19Data* _data19_)
{
	MediaPage* self;
	GAction* _tmp0_;
	self = _data19_->self;
	_tmp0_ = _data19_->fullscreen_action;
	g_action_activate (_tmp0_, NULL);
}

static void
____lambda30__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda30_ (self);
}

static void
___lambda31_ (Block19Data* _data19_)
{
	MediaPage* self;
	GAction* _tmp0_;
	self = _data19_->self;
	_tmp0_ = _data19_->select_action;
	g_action_activate (_tmp0_, NULL);
}

static void
____lambda31__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda31_ (self);
}

static GtkMenu*
media_page_real_get_page_context_menu (Page* base)
{
	MediaPage * self;
	GtkMenu* _tmp0_;
	GtkMenu* _tmp123_;
	GtkMenu* _tmp124_;
	GtkMenu* result;
	self = (MediaPage*) base;
	_tmp0_ = self->priv->page_context_menu;
	if (_tmp0_ == NULL) {
		Block19Data* _data19_;
		GtkMenu* _tmp1_;
		GtkCheckMenuItem* title_menu_item = NULL;
		GtkCheckMenuItem* _tmp2_;
		GtkAction* title_action = NULL;
		GtkAction* _tmp3_;
		GtkAction* _tmp4_;
		GtkCheckMenuItem* _tmp5_;
		GtkCheckMenuItem* comment_menu_item = NULL;
		GtkCheckMenuItem* _tmp6_;
		GtkAction* comment_action = NULL;
		GtkAction* _tmp7_;
		GtkAction* _tmp8_;
		GtkCheckMenuItem* _tmp9_;
		GtkCheckMenuItem* tags_menu_item = NULL;
		GtkCheckMenuItem* _tmp10_;
		GtkAction* tags_action = NULL;
		GtkAction* _tmp11_;
		GtkAction* _tmp12_;
		GtkCheckMenuItem* _tmp13_;
		GtkMenuItem* sort_photos_menu_item = NULL;
		GtkMenuItem* _tmp14_;
		GtkRadioMenuItem* _tmp15_;
		GtkAction* _tmp16_;
		GtkAction* _tmp17_;
		GtkRadioMenuItem* _tmp18_;
		GtkRadioMenuItem* _tmp19_;
		GtkRadioMenuItem* _tmp20_;
		GtkRadioMenuItem* _tmp21_;
		GtkAction* _tmp22_;
		GtkAction* _tmp23_;
		GtkRadioMenuItem* _tmp24_;
		GtkRadioMenuItem* _tmp25_;
		GtkRadioMenuItem* _tmp26_;
		GtkRadioMenuItem* _tmp27_;
		GtkAction* _tmp28_;
		GtkAction* _tmp29_;
		GtkRadioMenuItem* _tmp30_;
		GtkRadioMenuItem* _tmp31_;
		GtkRadioMenuItem* _tmp32_;
		GtkAction* _tmp33_;
		GtkAction* _tmp34_;
		GtkRadioMenuItem* _tmp35_;
		GtkRadioMenuItem* _tmp36_;
		GtkRadioMenuItem* _tmp37_;
		GtkRadioMenuItem* _tmp38_;
		GtkAction* _tmp39_;
		GtkAction* _tmp40_;
		GtkRadioMenuItem* _tmp41_;
		GtkRadioMenuItem* _tmp42_;
		GtkMenu* sort_photos_menu = NULL;
		GtkMenu* _tmp43_;
		GtkMenu* _tmp44_;
		GtkRadioMenuItem* _tmp45_;
		GtkMenu* _tmp46_;
		GtkRadioMenuItem* _tmp47_;
		GtkMenu* _tmp48_;
		GtkRadioMenuItem* _tmp49_;
		GtkMenu* _tmp50_;
		GtkSeparatorMenuItem* _tmp51_;
		GtkSeparatorMenuItem* _tmp52_;
		GtkMenu* _tmp53_;
		GtkRadioMenuItem* _tmp54_;
		GtkMenu* _tmp55_;
		GtkRadioMenuItem* _tmp56_;
		GtkMenuItem* _tmp57_;
		GtkMenu* _tmp58_;
		GtkMenuItem* sort_menu_item = NULL;
		GtkMenuItem* _tmp59_;
		GtkRadioMenuItem* _tmp60_;
		GtkAction* _tmp61_;
		GtkAction* _tmp62_;
		GtkRadioMenuItem* _tmp63_;
		GtkRadioMenuItem* _tmp64_;
		GtkRadioMenuItem* _tmp65_;
		GtkRadioMenuItem* _tmp66_;
		GtkAction* _tmp67_;
		GtkAction* _tmp68_;
		GtkRadioMenuItem* _tmp69_;
		GtkRadioMenuItem* _tmp70_;
		GtkMenu* sort_menu = NULL;
		GtkMenu* _tmp71_;
		GtkMenu* _tmp72_;
		GtkRadioMenuItem* _tmp73_;
		GtkMenu* _tmp74_;
		GtkRadioMenuItem* _tmp75_;
		GtkMenuItem* _tmp76_;
		GtkMenu* _tmp77_;
		GtkMenuItem* fullscreen_menu_item = NULL;
		GtkMenuItem* _tmp78_;
		AppWindow* _tmp79_;
		AppWindow* _tmp80_;
		GAction* _tmp81_;
		GAction* _tmp82_;
		GAction* _tmp83_;
		GAction* _tmp84_;
		GtkMenuItem* _tmp85_;
		GtkMenuItem* _tmp86_;
		GtkMenuItem* select_menu_item = NULL;
		GtkMenuItem* _tmp87_;
		AppWindow* _tmp88_;
		AppWindow* _tmp89_;
		GAction* _tmp90_;
		GAction* _tmp91_;
		GAction* _tmp92_;
		GAction* _tmp93_;
		GtkMenuItem* _tmp94_;
		GtkMenuItem* _tmp95_;
		GtkMenu* _tmp96_;
		GtkCheckMenuItem* _tmp97_;
		GtkMenu* _tmp98_;
		GtkCheckMenuItem* _tmp99_;
		GtkMenu* _tmp100_;
		GtkCheckMenuItem* _tmp101_;
		GtkMenu* _tmp102_;
		GtkSeparatorMenuItem* _tmp103_;
		GtkSeparatorMenuItem* _tmp104_;
		GtkMenu* _tmp105_;
		GtkMenuItem* _tmp106_;
		GtkMenu* _tmp107_;
		GtkSeparatorMenuItem* _tmp108_;
		GtkSeparatorMenuItem* _tmp109_;
		GtkMenu* _tmp110_;
		GtkMenuItem* _tmp111_;
		GtkMenu* _tmp112_;
		GtkSeparatorMenuItem* _tmp113_;
		GtkSeparatorMenuItem* _tmp114_;
		GtkMenu* _tmp115_;
		GtkMenuItem* _tmp116_;
		GtkMenu* _tmp117_;
		GtkSeparatorMenuItem* _tmp118_;
		GtkSeparatorMenuItem* _tmp119_;
		GtkMenu* _tmp120_;
		GtkMenuItem* _tmp121_;
		GtkMenu* _tmp122_;
		_data19_ = g_slice_new0 (Block19Data);
		_data19_->_ref_count_ = 1;
		_data19_->self = g_object_ref (self);
		_tmp1_ = (GtkMenu*) gtk_menu_new ();
		g_object_ref_sink (_tmp1_);
		_g_object_unref0 (self->priv->page_context_menu);
		self->priv->page_context_menu = _tmp1_;
		_tmp2_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_mnemonic (_ ("_Titles"));
		g_object_ref_sink (_tmp2_);
		title_menu_item = _tmp2_;
		_tmp3_ = page_get_action ((Page*) self, "ViewTitle");
		title_action = _tmp3_;
		_tmp4_ = title_action;
		_tmp5_ = title_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp4_, "active", (GObject*) _tmp5_, "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)));
		_tmp6_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_mnemonic (_ ("_Comments"));
		g_object_ref_sink (_tmp6_);
		comment_menu_item = _tmp6_;
		_tmp7_ = page_get_action ((Page*) self, "ViewComment");
		comment_action = _tmp7_;
		_tmp8_ = comment_action;
		_tmp9_ = comment_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_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_mnemonic (_ ("Ta_gs"));
		g_object_ref_sink (_tmp10_);
		tags_menu_item = _tmp10_;
		_tmp11_ = page_get_action ((Page*) self, "ViewTags");
		tags_action = _tmp11_;
		_tmp12_ = tags_action;
		_tmp13_ = tags_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp12_, "active", (GObject*) _tmp13_, "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)));
		_tmp14_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (_ ("Sort _Photos"));
		g_object_ref_sink (_tmp14_);
		sort_photos_menu_item = _tmp14_;
		_tmp15_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_mnemonic (NULL, _ ("By _Title"));
		g_object_ref_sink (_tmp15_);
		_data19_->by_title_menu_item = _tmp15_;
		_tmp16_ = page_get_action ((Page*) self, "SortByTitle");
		_data19_->by_title_action = _tmp16_;
		_tmp17_ = _data19_->by_title_action;
		_tmp18_ = _data19_->by_title_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp17_, "active", (GObject*) _tmp18_, "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)));
		_tmp19_ = _data19_->by_title_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp19_, "activate", (GCallback) ____lambda23__gtk_menu_item_activate, block19_data_ref (_data19_), (GClosureNotify) block19_data_unref, 0);
		_tmp20_ = _data19_->by_title_menu_item;
		_tmp21_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_mnemonic_from_widget (_tmp20_, _ ("By Exposure _Date"));
		g_object_ref_sink (_tmp21_);
		_data19_->by_exposure_menu_item = _tmp21_;
		_tmp22_ = page_get_action ((Page*) self, "SortByExposureDate");
		_data19_->by_exposure_action = _tmp22_;
		_tmp23_ = _data19_->by_exposure_action;
		_tmp24_ = _data19_->by_exposure_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp23_, "active", (GObject*) _tmp24_, "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)));
		_tmp25_ = _data19_->by_exposure_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp25_, "activate", (GCallback) ____lambda24__gtk_menu_item_activate, block19_data_ref (_data19_), (GClosureNotify) block19_data_unref, 0);
		_tmp26_ = _data19_->by_title_menu_item;
		_tmp27_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_mnemonic_from_widget (_tmp26_, _ ("By _File Modification Time"));
		g_object_ref_sink (_tmp27_);
		_data19_->by_timestamp_menu_item = _tmp27_;
		_tmp28_ = page_get_action ((Page*) self, "SortByTimestamp");
		_data19_->by_timestamp_action = _tmp28_;
		_tmp29_ = _data19_->by_timestamp_action;
		_tmp30_ = _data19_->by_timestamp_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp29_, "active", (GObject*) _tmp30_, "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)));
		_tmp31_ = _data19_->by_timestamp_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp31_, "activate", (GCallback) ____lambda25__gtk_menu_item_activate, block19_data_ref (_data19_), (GClosureNotify) block19_data_unref, 0);
		_tmp32_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_mnemonic (NULL, _ ("_Ascending"));
		g_object_ref_sink (_tmp32_);
		_data19_->ascending_photos_menu_item = _tmp32_;
		_tmp33_ = page_get_action ((Page*) self, "SortAscending");
		_data19_->ascending_photos_action = _tmp33_;
		_tmp34_ = _data19_->ascending_photos_action;
		_tmp35_ = _data19_->ascending_photos_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp34_, "active", (GObject*) _tmp35_, "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)));
		_tmp36_ = _data19_->ascending_photos_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp36_, "activate", (GCallback) ____lambda26__gtk_menu_item_activate, block19_data_ref (_data19_), (GClosureNotify) block19_data_unref, 0);
		_tmp37_ = _data19_->ascending_photos_menu_item;
		_tmp38_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_mnemonic_from_widget (_tmp37_, _ ("D_escending"));
		g_object_ref_sink (_tmp38_);
		_data19_->descending_photos_menu_item = _tmp38_;
		_tmp39_ = page_get_action ((Page*) self, "SortDescending");
		_data19_->descending_photos_action = _tmp39_;
		_tmp40_ = _data19_->descending_photos_action;
		_tmp41_ = _data19_->descending_photos_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp40_, "active", (GObject*) _tmp41_, "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)));
		_tmp42_ = _data19_->descending_photos_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp42_, "activate", (GCallback) ____lambda27__gtk_menu_item_activate, block19_data_ref (_data19_), (GClosureNotify) block19_data_unref, 0);
		_tmp43_ = (GtkMenu*) gtk_menu_new ();
		g_object_ref_sink (_tmp43_);
		sort_photos_menu = _tmp43_;
		_tmp44_ = sort_photos_menu;
		_tmp45_ = _data19_->by_title_menu_item;
		gtk_container_add ((GtkContainer*) _tmp44_, (GtkWidget*) _tmp45_);
		_tmp46_ = sort_photos_menu;
		_tmp47_ = _data19_->by_exposure_menu_item;
		gtk_container_add ((GtkContainer*) _tmp46_, (GtkWidget*) _tmp47_);
		_tmp48_ = sort_photos_menu;
		_tmp49_ = _data19_->by_timestamp_menu_item;
		gtk_container_add ((GtkContainer*) _tmp48_, (GtkWidget*) _tmp49_);
		_tmp50_ = sort_photos_menu;
		_tmp51_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp51_);
		_tmp52_ = _tmp51_;
		gtk_container_add ((GtkContainer*) _tmp50_, (GtkWidget*) _tmp52_);
		_g_object_unref0 (_tmp52_);
		_tmp53_ = sort_photos_menu;
		_tmp54_ = _data19_->ascending_photos_menu_item;
		gtk_container_add ((GtkContainer*) _tmp53_, (GtkWidget*) _tmp54_);
		_tmp55_ = sort_photos_menu;
		_tmp56_ = _data19_->descending_photos_menu_item;
		gtk_container_add ((GtkContainer*) _tmp55_, (GtkWidget*) _tmp56_);
		_tmp57_ = sort_photos_menu_item;
		_tmp58_ = sort_photos_menu;
		gtk_menu_item_set_submenu (_tmp57_, _tmp58_);
		_tmp59_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (_ ("Sort _Events"));
		g_object_ref_sink (_tmp59_);
		sort_menu_item = _tmp59_;
		_tmp60_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_mnemonic (NULL, _ ("_Ascending"));
		g_object_ref_sink (_tmp60_);
		_data19_->ascending_menu_item = _tmp60_;
		_tmp61_ = page_get_common_action ((Page*) self, "CommonSortEventsAscending", TRUE);
		_data19_->ascending_action = _tmp61_;
		_tmp62_ = _data19_->ascending_action;
		_tmp63_ = _data19_->ascending_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp62_, "active", (GObject*) _tmp63_, "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)));
		_tmp64_ = _data19_->ascending_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp64_, "activate", (GCallback) ____lambda28__gtk_menu_item_activate, block19_data_ref (_data19_), (GClosureNotify) block19_data_unref, 0);
		_tmp65_ = _data19_->ascending_menu_item;
		_tmp66_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_mnemonic_from_widget (_tmp65_, _ ("D_escending"));
		g_object_ref_sink (_tmp66_);
		_data19_->descending_menu_item = _tmp66_;
		_tmp67_ = page_get_common_action ((Page*) self, "CommonSortEventsDescending", TRUE);
		_data19_->descending_action = _tmp67_;
		_tmp68_ = _data19_->descending_action;
		_tmp69_ = _data19_->descending_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp68_, "active", (GObject*) _tmp69_, "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)));
		_tmp70_ = _data19_->descending_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp70_, "activate", (GCallback) ____lambda29__gtk_menu_item_activate, block19_data_ref (_data19_), (GClosureNotify) block19_data_unref, 0);
		_tmp71_ = (GtkMenu*) gtk_menu_new ();
		g_object_ref_sink (_tmp71_);
		sort_menu = _tmp71_;
		_tmp72_ = sort_menu;
		_tmp73_ = _data19_->ascending_menu_item;
		gtk_container_add ((GtkContainer*) _tmp72_, (GtkWidget*) _tmp73_);
		_tmp74_ = sort_menu;
		_tmp75_ = _data19_->descending_menu_item;
		gtk_container_add ((GtkContainer*) _tmp74_, (GtkWidget*) _tmp75_);
		_tmp76_ = sort_menu_item;
		_tmp77_ = sort_menu;
		gtk_menu_item_set_submenu (_tmp76_, _tmp77_);
		_tmp78_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (_ ("Fulls_creen"));
		g_object_ref_sink (_tmp78_);
		fullscreen_menu_item = _tmp78_;
		_tmp79_ = app_window_get_instance ();
		_tmp80_ = _tmp79_;
		_tmp81_ = g_action_map_lookup_action ((GActionMap*) _tmp80_, APP_WINDOW_ACTION_FULLSCREEN);
		_tmp82_ = _g_object_ref0 (_tmp81_);
		_tmp83_ = _tmp82_;
		_g_object_unref0 (_tmp80_);
		_data19_->fullscreen_action = _tmp83_;
		_tmp84_ = _data19_->fullscreen_action;
		_tmp85_ = fullscreen_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp84_, "enabled", (GObject*) _tmp85_, "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)));
		_tmp86_ = fullscreen_menu_item;
		g_signal_connect_data (_tmp86_, "activate", (GCallback) ____lambda30__gtk_menu_item_activate, block19_data_ref (_data19_), (GClosureNotify) block19_data_unref, 0);
		_tmp87_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_SELECT_ALL_MENU);
		g_object_ref_sink (_tmp87_);
		select_menu_item = _tmp87_;
		_tmp88_ = app_window_get_instance ();
		_tmp89_ = _tmp88_;
		_tmp90_ = g_action_map_lookup_action ((GActionMap*) _tmp89_, APP_WINDOW_ACTION_SELECT_ALL);
		_tmp91_ = _g_object_ref0 (_tmp90_);
		_tmp92_ = _tmp91_;
		_g_object_unref0 (_tmp89_);
		_data19_->select_action = _tmp92_;
		_tmp93_ = _data19_->select_action;
		_tmp94_ = select_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp93_, "enabled", (GObject*) _tmp94_, "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)));
		_tmp95_ = select_menu_item;
		g_signal_connect_data (_tmp95_, "activate", (GCallback) ____lambda31__gtk_menu_item_activate, block19_data_ref (_data19_), (GClosureNotify) block19_data_unref, 0);
		_tmp96_ = self->priv->page_context_menu;
		_tmp97_ = title_menu_item;
		gtk_container_add ((GtkContainer*) _tmp96_, (GtkWidget*) _tmp97_);
		_tmp98_ = self->priv->page_context_menu;
		_tmp99_ = comment_menu_item;
		gtk_container_add ((GtkContainer*) _tmp98_, (GtkWidget*) _tmp99_);
		_tmp100_ = self->priv->page_context_menu;
		_tmp101_ = tags_menu_item;
		gtk_container_add ((GtkContainer*) _tmp100_, (GtkWidget*) _tmp101_);
		_tmp102_ = self->priv->page_context_menu;
		_tmp103_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp103_);
		_tmp104_ = _tmp103_;
		gtk_container_add ((GtkContainer*) _tmp102_, (GtkWidget*) _tmp104_);
		_g_object_unref0 (_tmp104_);
		_tmp105_ = self->priv->page_context_menu;
		_tmp106_ = sort_photos_menu_item;
		gtk_container_add ((GtkContainer*) _tmp105_, (GtkWidget*) _tmp106_);
		_tmp107_ = self->priv->page_context_menu;
		_tmp108_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp108_);
		_tmp109_ = _tmp108_;
		gtk_container_add ((GtkContainer*) _tmp107_, (GtkWidget*) _tmp109_);
		_g_object_unref0 (_tmp109_);
		_tmp110_ = self->priv->page_context_menu;
		_tmp111_ = sort_menu_item;
		gtk_container_add ((GtkContainer*) _tmp110_, (GtkWidget*) _tmp111_);
		_tmp112_ = self->priv->page_context_menu;
		_tmp113_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp113_);
		_tmp114_ = _tmp113_;
		gtk_container_add ((GtkContainer*) _tmp112_, (GtkWidget*) _tmp114_);
		_g_object_unref0 (_tmp114_);
		_tmp115_ = self->priv->page_context_menu;
		_tmp116_ = fullscreen_menu_item;
		gtk_container_add ((GtkContainer*) _tmp115_, (GtkWidget*) _tmp116_);
		_tmp117_ = self->priv->page_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->page_context_menu;
		_tmp121_ = select_menu_item;
		gtk_container_add ((GtkContainer*) _tmp120_, (GtkWidget*) _tmp121_);
		_tmp122_ = self->priv->page_context_menu;
		gtk_widget_show_all ((GtkWidget*) _tmp122_);
		_g_object_unref0 (select_menu_item);
		_g_object_unref0 (fullscreen_menu_item);
		_g_object_unref0 (sort_menu);
		_g_object_unref0 (sort_menu_item);
		_g_object_unref0 (sort_photos_menu);
		_g_object_unref0 (sort_photos_menu_item);
		_g_object_unref0 (tags_action);
		_g_object_unref0 (tags_menu_item);
		_g_object_unref0 (comment_action);
		_g_object_unref0 (comment_menu_item);
		_g_object_unref0 (title_action);
		_g_object_unref0 (title_menu_item);
		block19_data_unref (_data19_);
		_data19_ = NULL;
	}
	_tmp123_ = self->priv->page_context_menu;
	_tmp124_ = _g_object_ref0 (_tmp123_);
	result = _tmp124_;
	return result;
}

static gint
media_page_compute_zoom_scale_increase (gint current_scale)
{
	gint new_scale = 0;
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint result;
	new_scale = current_scale + MEDIA_PAGE_MANUAL_STEPPING;
	_tmp0_ = thumbnail_get_MIN_SCALE ();
	_tmp1_ = _tmp0_;
	_tmp2_ = thumbnail_get_MAX_SCALE ();
	_tmp3_ = _tmp2_;
	result = CLAMP (new_scale, _tmp1_, _tmp3_);
	return result;
}

static gint
media_page_compute_zoom_scale_decrease (gint current_scale)
{
	gint new_scale = 0;
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint result;
	new_scale = current_scale - MEDIA_PAGE_MANUAL_STEPPING;
	_tmp0_ = thumbnail_get_MIN_SCALE ();
	_tmp1_ = _tmp0_;
	_tmp2_ = thumbnail_get_MAX_SCALE ();
	_tmp3_ = _tmp2_;
	result = CLAMP (new_scale, _tmp1_, _tmp3_);
	return result;
}

static void
_media_page_on_export_gcallback (GtkAction* action,
                                 gpointer self)
{
	media_page_on_export ((MediaPage*) self);
}

static void
_media_page_on_remove_from_library_gcallback (GtkAction* action,
                                              gpointer self)
{
	media_page_on_remove_from_library ((MediaPage*) self);
}

static void
_media_page_on_move_to_trash_gcallback (GtkAction* action,
                                        gpointer self)
{
	media_page_on_move_to_trash ((MediaPage*) self);
}

static void
_media_page_on_new_event_gcallback (GtkAction* action,
                                    gpointer self)
{
	media_page_on_new_event ((MediaPage*) self);
}

static void
_media_page_on_increase_size_gcallback (GtkAction* action,
                                        gpointer self)
{
	media_page_on_increase_size ((MediaPage*) self);
}

static void
_media_page_on_decrease_size_gcallback (GtkAction* action,
                                        gpointer self)
{
	media_page_on_decrease_size ((MediaPage*) self);
}

static void
_media_page_on_flag_unflag_gcallback (GtkAction* action,
                                      gpointer self)
{
	media_page_on_flag_unflag ((MediaPage*) self);
}

static void
_media_page_on_raw_developer_shotwell_gcallback (GtkAction* action,
                                                 gpointer self)
{
	media_page_on_raw_developer_shotwell ((MediaPage*) self, action);
}

static void
_media_page_on_raw_developer_camera_gcallback (GtkAction* action,
                                               gpointer self)
{
	media_page_on_raw_developer_camera ((MediaPage*) self, action);
}

static void
_vala_array_add190 (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_add191 (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_add192 (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_add193 (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_add194 (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_add195 (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_add196 (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_add197 (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_add198 (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_add199 (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_add200 (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_add201 (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*
media_page_real_init_collect_action_entries (Page* base,
                                             gint* result_length1)
{
	MediaPage * self;
	GtkActionEntry export = {0};
	GtkActionEntry _tmp0_ = {0};
	GtkActionEntry remove_from_library = {0};
	GtkActionEntry _tmp1_ = {0};
	GtkActionEntry move_to_trash = {0};
	GtkActionEntry _tmp2_ = {0};
	GtkActionEntry new_event = {0};
	GtkActionEntry _tmp3_ = {0};
	GtkActionEntry increase_size = {0};
	GtkActionEntry _tmp4_ = {0};
	GtkActionEntry decrease_size = {0};
	GtkActionEntry _tmp5_ = {0};
	GtkActionEntry flag = {0};
	GtkActionEntry _tmp6_ = {0};
	GtkActionEntry sort_photos = {0};
	GtkActionEntry _tmp7_ = {0};
	GtkActionEntry filter_photos = {0};
	GtkActionEntry _tmp8_ = {0};
	GtkActionEntry raw_developer = {0};
	GtkActionEntry _tmp9_ = {0};
	GtkActionEntry dev_shotwell = {0};
	GtkActionEntry _tmp10_ = {0};
	GtkActionEntry dev_camera = {0};
	GtkActionEntry _tmp11_ = {0};
	GtkActionEntry* actions = NULL;
	gint _tmp12_ = 0;
	GtkActionEntry* _tmp13_;
	gint actions_length1;
	gint _actions_size_;
	GtkActionEntry _tmp14_;
	GtkActionEntry _tmp15_;
	GtkActionEntry _tmp16_;
	GtkActionEntry _tmp17_;
	GtkActionEntry _tmp18_;
	GtkActionEntry _tmp19_;
	GtkActionEntry _tmp20_;
	GtkActionEntry _tmp21_;
	GtkActionEntry _tmp22_;
	GtkActionEntry _tmp23_;
	GtkActionEntry _tmp24_;
	GtkActionEntry _tmp25_;
	GtkActionEntry* _tmp26_;
	gint _tmp26__length1;
	GtkActionEntry* result;
	self = (MediaPage*) base;
	_tmp0_.name = "Export";
	_tmp0_.stock_id = NULL;
	_tmp0_.label = NULL;
	_tmp0_.accelerator = "<Ctrl><Shift>E";
	_tmp0_.tooltip = NULL;
	_tmp0_.callback = (GCallback) _media_page_on_export_gcallback;
	export = _tmp0_;
	_tmp1_.name = "RemoveFromLibrary";
	_tmp1_.stock_id = NULL;
	_tmp1_.label = NULL;
	_tmp1_.accelerator = "<Shift>Delete";
	_tmp1_.tooltip = NULL;
	_tmp1_.callback = (GCallback) _media_page_on_remove_from_library_gcallback;
	remove_from_library = _tmp1_;
	_tmp2_.name = "MoveToTrash";
	_tmp2_.stock_id = NULL;
	_tmp2_.label = NULL;
	_tmp2_.accelerator = "Delete";
	_tmp2_.tooltip = NULL;
	_tmp2_.callback = (GCallback) _media_page_on_move_to_trash_gcallback;
	move_to_trash = _tmp2_;
	_tmp3_.name = "NewEvent";
	_tmp3_.stock_id = NULL;
	_tmp3_.label = NULL;
	_tmp3_.accelerator = "<Ctrl>N";
	_tmp3_.tooltip = NULL;
	_tmp3_.callback = (GCallback) _media_page_on_new_event_gcallback;
	new_event = _tmp3_;
	_tmp4_.name = "IncreaseSize";
	_tmp4_.stock_id = NULL;
	_tmp4_.label = NULL;
	_tmp4_.accelerator = "<Ctrl>plus";
	_tmp4_.tooltip = NULL;
	_tmp4_.callback = (GCallback) _media_page_on_increase_size_gcallback;
	increase_size = _tmp4_;
	_tmp5_.name = "DecreaseSize";
	_tmp5_.stock_id = NULL;
	_tmp5_.label = NULL;
	_tmp5_.accelerator = "<Ctrl>minus";
	_tmp5_.tooltip = NULL;
	_tmp5_.callback = (GCallback) _media_page_on_decrease_size_gcallback;
	decrease_size = _tmp5_;
	_tmp6_.name = "Flag";
	_tmp6_.stock_id = NULL;
	_tmp6_.label = NULL;
	_tmp6_.accelerator = "<Ctrl>G";
	_tmp6_.tooltip = NULL;
	_tmp6_.callback = (GCallback) _media_page_on_flag_unflag_gcallback;
	flag = _tmp6_;
	_tmp7_.name = "SortPhotos";
	_tmp7_.stock_id = NULL;
	_tmp7_.label = NULL;
	_tmp7_.accelerator = NULL;
	_tmp7_.tooltip = NULL;
	_tmp7_.callback = (GCallback) NULL;
	sort_photos = _tmp7_;
	_tmp8_.name = "FilterPhotos";
	_tmp8_.stock_id = NULL;
	_tmp8_.label = NULL;
	_tmp8_.accelerator = NULL;
	_tmp8_.tooltip = NULL;
	_tmp8_.callback = (GCallback) NULL;
	filter_photos = _tmp8_;
	_tmp9_.name = "RawDeveloper";
	_tmp9_.stock_id = NULL;
	_tmp9_.label = NULL;
	_tmp9_.accelerator = NULL;
	_tmp9_.tooltip = NULL;
	_tmp9_.callback = (GCallback) NULL;
	raw_developer = _tmp9_;
	_tmp10_.name = "RawDeveloperShotwell";
	_tmp10_.stock_id = NULL;
	_tmp10_.label = NULL;
	_tmp10_.accelerator = NULL;
	_tmp10_.tooltip = NULL;
	_tmp10_.callback = (GCallback) _media_page_on_raw_developer_shotwell_gcallback;
	dev_shotwell = _tmp10_;
	_tmp11_.name = "RawDeveloperCamera";
	_tmp11_.stock_id = NULL;
	_tmp11_.label = NULL;
	_tmp11_.accelerator = NULL;
	_tmp11_.tooltip = NULL;
	_tmp11_.callback = (GCallback) _media_page_on_raw_developer_camera_gcallback;
	dev_camera = _tmp11_;
	_tmp13_ = PAGE_CLASS (media_page_parent_class)->init_collect_action_entries ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), &_tmp12_);
	actions = _tmp13_;
	actions_length1 = _tmp12_;
	_actions_size_ = actions_length1;
	_tmp14_ = export;
	_vala_array_add190 (&actions, &actions_length1, &_actions_size_, &_tmp14_);
	_tmp15_ = remove_from_library;
	_vala_array_add191 (&actions, &actions_length1, &_actions_size_, &_tmp15_);
	_tmp16_ = move_to_trash;
	_vala_array_add192 (&actions, &actions_length1, &_actions_size_, &_tmp16_);
	_tmp17_ = new_event;
	_vala_array_add193 (&actions, &actions_length1, &_actions_size_, &_tmp17_);
	_tmp18_ = increase_size;
	_vala_array_add194 (&actions, &actions_length1, &_actions_size_, &_tmp18_);
	_tmp19_ = decrease_size;
	_vala_array_add195 (&actions, &actions_length1, &_actions_size_, &_tmp19_);
	_tmp20_ = flag;
	_vala_array_add196 (&actions, &actions_length1, &_actions_size_, &_tmp20_);
	_tmp21_ = sort_photos;
	_vala_array_add197 (&actions, &actions_length1, &_actions_size_, &_tmp21_);
	_tmp22_ = filter_photos;
	_vala_array_add198 (&actions, &actions_length1, &_actions_size_, &_tmp22_);
	_tmp23_ = raw_developer;
	_vala_array_add199 (&actions, &actions_length1, &_actions_size_, &_tmp23_);
	_tmp24_ = dev_shotwell;
	_vala_array_add200 (&actions, &actions_length1, &_actions_size_, &_tmp24_);
	_tmp25_ = dev_camera;
	_vala_array_add201 (&actions, &actions_length1, &_actions_size_, &_tmp25_);
	_tmp26_ = actions;
	_tmp26__length1 = actions_length1;
	if (result_length1) {
		*result_length1 = _tmp26__length1;
	}
	result = _tmp26_;
	return result;
}

static void
_media_page_on_display_titles_gcallback (GtkAction* action,
                                         gpointer self)
{
	media_page_on_display_titles ((MediaPage*) self, action);
}

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

static void
_media_page_on_display_comments_gcallback (GtkAction* action,
                                           gpointer self)
{
	media_page_on_display_comments ((MediaPage*) self, action);
}

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

static void
_media_page_on_display_tags_gcallback (GtkAction* action,
                                       gpointer self)
{
	media_page_on_display_tags ((MediaPage*) self, action);
}

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

static GtkToggleActionEntry*
media_page_real_init_collect_toggle_action_entries (Page* base,
                                                    gint* result_length1)
{
	MediaPage * self;
	GtkToggleActionEntry* toggle_actions = NULL;
	gint _tmp0_ = 0;
	GtkToggleActionEntry* _tmp1_;
	gint toggle_actions_length1;
	gint _toggle_actions_size_;
	GtkToggleActionEntry titles = {0};
	GSettings* _tmp2_;
	GtkToggleActionEntry _tmp3_ = {0};
	GtkToggleActionEntry _tmp4_;
	GtkToggleActionEntry comments = {0};
	GSettings* _tmp5_;
	GtkToggleActionEntry _tmp6_ = {0};
	GtkToggleActionEntry _tmp7_;
	GtkToggleActionEntry tags = {0};
	GSettings* _tmp8_;
	GtkToggleActionEntry _tmp9_ = {0};
	GtkToggleActionEntry _tmp10_;
	GtkToggleActionEntry* _tmp11_;
	gint _tmp11__length1;
	GtkToggleActionEntry* result;
	self = (MediaPage*) base;
	_tmp1_ = PAGE_CLASS (media_page_parent_class)->init_collect_toggle_action_entries ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), &_tmp0_);
	toggle_actions = _tmp1_;
	toggle_actions_length1 = _tmp0_;
	_toggle_actions_size_ = toggle_actions_length1;
	_tmp2_ = ((Page*) self)->ui_settings;
	_tmp3_.name = "ViewTitle";
	_tmp3_.stock_id = NULL;
	_tmp3_.label = _ ("_Titles");
	_tmp3_.accelerator = "<Ctrl><Shift>T";
	_tmp3_.tooltip = _ ("Display the title of each photo");
	_tmp3_.callback = (GCallback) _media_page_on_display_titles_gcallback;
	_tmp3_.is_active = g_settings_get_boolean (_tmp2_, "display-photo-titles");
	titles = _tmp3_;
	_tmp4_ = titles;
	_vala_array_add202 (&toggle_actions, &toggle_actions_length1, &_toggle_actions_size_, &_tmp4_);
	_tmp5_ = ((Page*) self)->ui_settings;
	_tmp6_.name = "ViewComment";
	_tmp6_.stock_id = NULL;
	_tmp6_.label = _ ("_Comments");
	_tmp6_.accelerator = "<Ctrl><Shift>C";
	_tmp6_.tooltip = _ ("Display the comment of each photo");
	_tmp6_.callback = (GCallback) _media_page_on_display_comments_gcallback;
	_tmp6_.is_active = g_settings_get_boolean (_tmp5_, "display-photo-comments");
	comments = _tmp6_;
	_tmp7_ = comments;
	_vala_array_add203 (&toggle_actions, &toggle_actions_length1, &_toggle_actions_size_, &_tmp7_);
	_tmp8_ = ((Page*) self)->ui_settings;
	_tmp9_.name = "ViewTags";
	_tmp9_.stock_id = NULL;
	_tmp9_.label = _ ("Ta_gs");
	_tmp9_.accelerator = "<Ctrl><Shift>G";
	_tmp9_.tooltip = _ ("Display each photo's tags");
	_tmp9_.callback = (GCallback) _media_page_on_display_tags_gcallback;
	_tmp9_.is_active = g_settings_get_boolean (_tmp8_, "display-photo-tags");
	tags = _tmp9_;
	_tmp10_ = tags;
	_vala_array_add204 (&toggle_actions, &toggle_actions_length1, &_toggle_actions_size_, &_tmp10_);
	_tmp11_ = toggle_actions;
	_tmp11__length1 = toggle_actions_length1;
	if (result_length1) {
		*result_length1 = _tmp11__length1;
	}
	result = _tmp11_;
	return result;
}

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

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

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

static void
_media_page_on_sort_changed_gcallback (GtkAction* action,
                                       GtkAction* current,
                                       gpointer self)
{
	media_page_on_sort_changed ((MediaPage*) self);
}

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

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

static void
media_page_real_register_radio_actions (Page* base,
                                        GtkActionGroup* action_group)
{
	MediaPage * self;
	gboolean sort_order = FALSE;
	gint sort_by = 0;
	gboolean _tmp0_ = FALSE;
	gint _tmp1_ = 0;
	GtkRadioActionEntry* sort_crit_actions = NULL;
	GtkRadioActionEntry* _tmp2_;
	gint sort_crit_actions_length1;
	gint _sort_crit_actions_size_;
	GtkRadioActionEntry by_title = {0};
	GtkRadioActionEntry _tmp3_ = {0};
	GtkRadioActionEntry _tmp4_;
	GtkRadioActionEntry by_date = {0};
	GtkRadioActionEntry _tmp5_ = {0};
	GtkRadioActionEntry _tmp6_;
	GtkRadioActionEntry by_timestamp = {0};
	GtkRadioActionEntry _tmp7_ = {0};
	GtkRadioActionEntry _tmp8_;
	GtkRadioActionEntry* _tmp9_;
	gint _tmp9__length1;
	GtkRadioActionEntry* sort_order_actions = NULL;
	GtkRadioActionEntry* _tmp10_;
	gint sort_order_actions_length1;
	gint _sort_order_actions_size_;
	GtkRadioActionEntry ascending = {0};
	GtkRadioActionEntry _tmp11_ = {0};
	GtkRadioActionEntry _tmp12_;
	GtkRadioActionEntry descending = {0};
	GtkRadioActionEntry _tmp13_ = {0};
	GtkRadioActionEntry _tmp14_;
	gint _tmp15_ = 0;
	GtkRadioActionEntry* _tmp16_;
	gint _tmp16__length1;
	self = (MediaPage*) base;
	g_return_if_fail (action_group != NULL);
	media_page_get_config_photos_sort (self, &_tmp0_, &_tmp1_);
	sort_order = _tmp0_;
	sort_by = _tmp1_;
	_tmp2_ = g_new0 (GtkRadioActionEntry, 0);
	sort_crit_actions = _tmp2_;
	sort_crit_actions_length1 = 0;
	_sort_crit_actions_size_ = sort_crit_actions_length1;
	_tmp3_.name = "SortByTitle";
	_tmp3_.stock_id = NULL;
	_tmp3_.label = _ ("By _Title");
	_tmp3_.accelerator = NULL;
	_tmp3_.tooltip = _ ("Sort photos by title");
	_tmp3_.value = (gint) MEDIA_PAGE_SORT_BY_TITLE;
	by_title = _tmp3_;
	_tmp4_ = by_title;
	_vala_array_add205 (&sort_crit_actions, &sort_crit_actions_length1, &_sort_crit_actions_size_, &_tmp4_);
	_tmp5_.name = "SortByExposureDate";
	_tmp5_.stock_id = NULL;
	_tmp5_.label = _ ("By Exposure _Date");
	_tmp5_.accelerator = NULL;
	_tmp5_.tooltip = _ ("Sort photos by exposure date");
	_tmp5_.value = (gint) MEDIA_PAGE_SORT_BY_EXPOSURE_DATE;
	by_date = _tmp5_;
	_tmp6_ = by_date;
	_vala_array_add206 (&sort_crit_actions, &sort_crit_actions_length1, &_sort_crit_actions_size_, &_tmp6_);
	_tmp7_.name = "SortByTimestamp";
	_tmp7_.stock_id = NULL;
	_tmp7_.label = _ ("By _File Modification Time");
	_tmp7_.accelerator = NULL;
	_tmp7_.tooltip = _ ("Sort photos by import timestamp");
	_tmp7_.value = (gint) MEDIA_PAGE_SORT_BY_TIMESTAMP;
	by_timestamp = _tmp7_;
	_tmp8_ = by_timestamp;
	_vala_array_add207 (&sort_crit_actions, &sort_crit_actions_length1, &_sort_crit_actions_size_, &_tmp8_);
	_tmp9_ = sort_crit_actions;
	_tmp9__length1 = sort_crit_actions_length1;
	gtk_action_group_add_radio_actions (action_group, _tmp9_, (guint) _tmp9__length1, sort_by, (GCallback) _media_page_on_sort_changed_gcallback, self);
	_tmp10_ = g_new0 (GtkRadioActionEntry, 0);
	sort_order_actions = _tmp10_;
	sort_order_actions_length1 = 0;
	_sort_order_actions_size_ = sort_order_actions_length1;
	_tmp11_.name = "SortAscending";
	_tmp11_.stock_id = NULL;
	_tmp11_.label = _ ("_Ascending");
	_tmp11_.accelerator = NULL;
	_tmp11_.tooltip = _ ("Sort photos in an ascending order");
	_tmp11_.value = MEDIA_PAGE_SORT_ORDER_ASCENDING;
	ascending = _tmp11_;
	_tmp12_ = ascending;
	_vala_array_add208 (&sort_order_actions, &sort_order_actions_length1, &_sort_order_actions_size_, &_tmp12_);
	_tmp13_.name = "SortDescending";
	_tmp13_.stock_id = NULL;
	_tmp13_.label = _ ("D_escending");
	_tmp13_.accelerator = NULL;
	_tmp13_.tooltip = _ ("Sort photos in a descending order");
	_tmp13_.value = MEDIA_PAGE_SORT_ORDER_DESCENDING;
	descending = _tmp13_;
	_tmp14_ = descending;
	_vala_array_add209 (&sort_order_actions, &sort_order_actions_length1, &_sort_order_actions_size_, &_tmp14_);
	if (sort_order) {
		_tmp15_ = MEDIA_PAGE_SORT_ORDER_ASCENDING;
	} else {
		_tmp15_ = MEDIA_PAGE_SORT_ORDER_DESCENDING;
	}
	_tmp16_ = sort_order_actions;
	_tmp16__length1 = sort_order_actions_length1;
	gtk_action_group_add_radio_actions (action_group, _tmp16_, (guint) _tmp16__length1, _tmp15_, (GCallback) _media_page_on_sort_changed_gcallback, self);
	PAGE_CLASS (media_page_parent_class)->register_radio_actions ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), action_group);
	sort_order_actions = (g_free (sort_order_actions), NULL);
	sort_crit_actions = (g_free (sort_crit_actions), NULL);
}

static void
media_page_real_update_actions (Page* base,
                                gint selected_count,
                                gint count)
{
	MediaPage * self;
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	self = (MediaPage*) base;
	page_set_action_sensitive ((Page*) self, "Export", selected_count > 0);
	_tmp0_ = thumbnail_get_MAX_SCALE ();
	_tmp1_ = _tmp0_;
	page_set_action_sensitive ((Page*) self, "IncreaseSize", media_page_get_thumb_size (self) < _tmp1_);
	_tmp2_ = thumbnail_get_MIN_SCALE ();
	_tmp3_ = _tmp2_;
	page_set_action_sensitive ((Page*) self, "DecreaseSize", media_page_get_thumb_size (self) > _tmp3_);
	page_set_action_sensitive ((Page*) self, "RemoveFromLibrary", selected_count > 0);
	page_set_action_sensitive ((Page*) self, "MoveToTrash", selected_count > 0);
	media_page_update_development_menu_item_sensitivity (self);
	media_page_update_flag_action (self, selected_count);
	PAGE_CLASS (media_page_parent_class)->update_actions ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), selected_count, count);
}

static void
media_page_on_media_altered (MediaPage* 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_;
			DataObject* _tmp8_;
			gpointer _tmp9_;
			Alteration* _tmp10_;
			gboolean _tmp11_;
			_tmp5_ = _object_it;
			if (!gee_iterator_next (_tmp5_)) {
				break;
			}
			_tmp6_ = _object_it;
			_tmp7_ = gee_iterator_get (_tmp6_);
			object = (DataObject*) _tmp7_;
			_tmp8_ = object;
			_tmp9_ = gee_map_get (altered, _tmp8_);
			_tmp10_ = (Alteration*) _tmp9_;
			_tmp11_ = alteration_has_detail (_tmp10_, "metadata", "flagged");
			_alteration_unref0 (_tmp10_);
			if (_tmp11_) {
				ViewCollection* _tmp12_;
				ViewCollection* _tmp13_;
				_tmp12_ = page_get_view ((Page*) self);
				_tmp13_ = _tmp12_;
				media_page_update_flag_action (self, view_collection_get_selected_count (_tmp13_));
				_data_collection_unref0 (_tmp13_);
				_g_object_unref0 (object);
				break;
			}
			_g_object_unref0 (object);
		}
		_g_object_unref0 (_object_it);
	}
}

static void
media_page_update_development_menu_item_sensitivity (MediaPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	GeeList* _tmp2_;
	GeeList* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gboolean _tmp6_;
	gboolean avail_shotwell = FALSE;
	gboolean avail_camera = FALSE;
	gboolean is_raw = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_ == 0;
	_g_object_unref0 (_tmp3_);
	_data_collection_unref0 (_tmp1_);
	if (_tmp6_) {
		page_set_action_sensitive ((Page*) self, "RawDeveloper", FALSE);
		return;
	}
	avail_shotwell = FALSE;
	avail_camera = FALSE;
	is_raw = FALSE;
	{
		GeeList* _view_list = NULL;
		ViewCollection* _tmp7_;
		ViewCollection* _tmp8_;
		GeeList* _tmp9_;
		GeeList* _tmp10_;
		gint _view_size = 0;
		GeeList* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		gint _view_index = 0;
		_tmp7_ = page_get_view ((Page*) self);
		_tmp8_ = _tmp7_;
		_tmp9_ = view_collection_get_selected (_tmp8_);
		_tmp10_ = _tmp9_;
		_data_collection_unref0 (_tmp8_);
		_view_list = _tmp10_;
		_tmp11_ = _view_list;
		_tmp12_ = gee_collection_get_size ((GeeCollection*) _tmp11_);
		_tmp13_ = _tmp12_;
		_view_size = _tmp13_;
		_view_index = -1;
		while (TRUE) {
			gint _tmp14_;
			gint _tmp15_;
			DataView* view = NULL;
			GeeList* _tmp16_;
			gpointer _tmp17_;
			Photo* photo = NULL;
			DataView* _tmp18_;
			MediaSource* _tmp19_;
			Photo* _tmp20_;
			gboolean _tmp21_ = FALSE;
			Photo* _tmp22_;
			_view_index = _view_index + 1;
			_tmp14_ = _view_index;
			_tmp15_ = _view_size;
			if (!(_tmp14_ < _tmp15_)) {
				break;
			}
			_tmp16_ = _view_list;
			_tmp17_ = gee_list_get (_tmp16_, _view_index);
			view = (DataView*) _tmp17_;
			_tmp18_ = view;
			_tmp19_ = thumbnail_get_media_source (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, TYPE_THUMBNAIL, Thumbnail));
			_tmp20_ = IS_PHOTO (_tmp19_) ? ((Photo*) _tmp19_) : NULL;
			if (_tmp20_ == NULL) {
				_g_object_unref0 (_tmp19_);
			}
			photo = _tmp20_;
			_tmp22_ = photo;
			if (_tmp22_ != NULL) {
				Photo* _tmp23_;
				_tmp23_ = photo;
				_tmp21_ = photo_get_master_file_format (_tmp23_) == PHOTO_FILE_FORMAT_RAW;
			} else {
				_tmp21_ = FALSE;
			}
			if (_tmp21_) {
				gboolean _tmp24_ = FALSE;
				gboolean _tmp26_ = FALSE;
				gboolean _tmp30_ = FALSE;
				is_raw = TRUE;
				if (!avail_shotwell) {
					Photo* _tmp25_;
					_tmp25_ = photo;
					_tmp24_ = photo_is_raw_developer_available (_tmp25_, RAW_DEVELOPER_SHOTWELL);
				} else {
					_tmp24_ = FALSE;
				}
				if (_tmp24_) {
					avail_shotwell = TRUE;
				}
				if (!avail_camera) {
					gboolean _tmp27_ = FALSE;
					Photo* _tmp28_;
					_tmp28_ = photo;
					if (photo_is_raw_developer_available (_tmp28_, RAW_DEVELOPER_CAMERA)) {
						_tmp27_ = TRUE;
					} else {
						Photo* _tmp29_;
						_tmp29_ = photo;
						_tmp27_ = photo_is_raw_developer_available (_tmp29_, RAW_DEVELOPER_EMBEDDED);
					}
					_tmp26_ = _tmp27_;
				} else {
					_tmp26_ = FALSE;
				}
				if (_tmp26_) {
					avail_camera = TRUE;
				}
				if (avail_shotwell) {
					_tmp30_ = avail_camera;
				} else {
					_tmp30_ = FALSE;
				}
				if (_tmp30_) {
					_g_object_unref0 (photo);
					_g_object_unref0 (view);
					break;
				}
			}
			_g_object_unref0 (photo);
			_g_object_unref0 (view);
		}
		_g_object_unref0 (_view_list);
	}
	page_set_action_sensitive ((Page*) self, "RawDeveloper", is_raw);
	if (is_raw) {
		page_set_action_sensitive ((Page*) self, "RawDeveloperShotwell", avail_shotwell);
		page_set_action_sensitive ((Page*) self, "RawDeveloperCamera", avail_camera);
	}
}

static void
media_page_update_flag_action (MediaPage* self,
                               gint selected_count)
{
	gchar* flag_label = NULL;
	gchar* _tmp0_;
	GtkAction* flag_action = NULL;
	GtkAction* _tmp18_;
	GtkAction* _tmp19_;
	g_return_if_fail (self != NULL);
	page_set_action_sensitive ((Page*) self, "Flag", selected_count > 0);
	_tmp0_ = g_strdup (RESOURCES_FLAG_MENU);
	flag_label = _tmp0_;
	if (selected_count > 0) {
		gboolean all_flagged = FALSE;
		all_flagged = TRUE;
		{
			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_;
				Flaggable* flaggable = NULL;
				DataSource* _tmp12_;
				Flaggable* _tmp13_;
				gboolean _tmp14_ = FALSE;
				Flaggable* _tmp15_;
				_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_FLAGGABLE (_tmp12_) ? ((Flaggable*) _tmp12_) : NULL);
				flaggable = _tmp13_;
				_tmp15_ = flaggable;
				if (_tmp15_ != NULL) {
					Flaggable* _tmp16_;
					_tmp16_ = flaggable;
					_tmp14_ = !flaggable_is_flagged (_tmp16_);
				} else {
					_tmp14_ = FALSE;
				}
				if (_tmp14_) {
					all_flagged = FALSE;
					_g_object_unref0 (flaggable);
					_g_object_unref0 (source);
					break;
				}
				_g_object_unref0 (flaggable);
				_g_object_unref0 (source);
			}
			_g_object_unref0 (_source_list);
		}
		if (all_flagged) {
			gchar* _tmp17_;
			_tmp17_ = g_strdup (RESOURCES_UNFLAG_MENU);
			_g_free0 (flag_label);
			flag_label = _tmp17_;
		}
	}
	_tmp18_ = page_get_action ((Page*) self, "Flag");
	flag_action = _tmp18_;
	_tmp19_ = flag_action;
	if (_tmp19_ != NULL) {
		GtkAction* _tmp20_;
		const gchar* _tmp21_;
		_tmp20_ = flag_action;
		_tmp21_ = flag_label;
		gtk_action_set_label (_tmp20_, _tmp21_);
	}
	_g_object_unref0 (flag_action);
	_g_free0 (flag_label);
}

static gpointer
_core_tracker_ref0 (gpointer self)
{
	return self ? core_tracker_ref (self) : NULL;
}

static CoreViewTracker*
media_page_real_get_view_tracker (CheckerboardPage* base)
{
	MediaPage * self;
	MediaViewTracker* _tmp0_;
	CoreViewTracker* _tmp1_;
	CoreViewTracker* result;
	self = (MediaPage*) base;
	_tmp0_ = self->priv->tracker;
	_tmp1_ = _core_tracker_ref0 ((CoreViewTracker*) _tmp0_);
	result = _tmp1_;
	return result;
}

static gboolean
media_page_real_on_mousewheel_up (Page* base,
                                  GdkEventScroll* event)
{
	MediaPage * self;
	gboolean result;
	self = (MediaPage*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	if ((event->state & GDK_CONTROL_MASK) != 0) {
		media_page_increase_zoom_level (self);
		result = TRUE;
		return result;
	} else {
		result = PAGE_CLASS (media_page_parent_class)->on_mousewheel_up ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), event);
		return result;
	}
}

static gboolean
media_page_real_on_mousewheel_down (Page* base,
                                    GdkEventScroll* event)
{
	MediaPage * self;
	gboolean result;
	self = (MediaPage*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	if ((event->state & GDK_CONTROL_MASK) != 0) {
		media_page_decrease_zoom_level (self);
		result = TRUE;
		return result;
	} else {
		result = PAGE_CLASS (media_page_parent_class)->on_mousewheel_down ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), event);
		return result;
	}
}

void
media_page_on_play_video (MediaPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	Video* video = NULL;
	ViewCollection* _tmp3_;
	ViewCollection* _tmp4_;
	DataView* _tmp5_;
	DataView* _tmp6_;
	DataSource* _tmp7_;
	DataSource* _tmp8_;
	Video* _tmp9_;
	Video* _tmp10_;
	Video* _tmp11_;
	GError* _inner_error0_ = NULL;
	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 (IS_VIDEO (_tmp8_) ? ((Video*) _tmp8_) : NULL);
	_tmp10_ = _tmp9_;
	_g_object_unref0 (_tmp6_);
	_data_collection_unref0 (_tmp4_);
	video = _tmp10_;
	_tmp11_ = video;
	if (_tmp11_ == NULL) {
		_g_object_unref0 (video);
		return;
	}
	{
		Video* _tmp12_;
		GFile* _tmp13_;
		GFile* _tmp14_;
		gchar* _tmp15_;
		gchar* _tmp16_;
		_tmp12_ = video;
		_tmp13_ = media_source_get_file ((MediaSource*) _tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = g_file_get_uri (_tmp14_);
		_tmp16_ = _tmp15_;
		g_app_info_launch_default_for_uri (_tmp16_, NULL, &_inner_error0_);
		_g_free0 (_tmp16_);
		_g_object_unref0 (_tmp14_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp17_;
		const gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp17_ = e;
		_tmp18_ = _tmp17_->message;
		_tmp19_ = g_strdup_printf (_ ("Photos was unable to play the selected video:\n%s"), _tmp18_);
		_tmp20_ = _tmp19_;
		app_window_error_message (_tmp20_, NULL, NULL);
		_g_free0 (_tmp20_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (video);
		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 (video);
}

static gboolean
media_page_real_on_app_key_pressed (Page* base,
                                    GdkEventKey* event)
{
	MediaPage * self;
	gboolean handled = FALSE;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	static GQuark _tmp2_label1 = 0;
	static GQuark _tmp2_label2 = 0;
	static GQuark _tmp2_label3 = 0;
	static GQuark _tmp2_label4 = 0;
	static GQuark _tmp2_label5 = 0;
	static GQuark _tmp2_label6 = 0;
	gboolean _tmp4_ = FALSE;
	gboolean result;
	self = (MediaPage*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	handled = TRUE;
	_tmp0_ = gdk_keyval_name (event->keyval);
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	if (((_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("equal")))) || (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("plus"))))) || (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("KP_Add"))))) {
		switch (0) {
			default:
			{
				page_activate_action ((Page*) self, "IncreaseSize");
				break;
			}
		}
	} else if (((_tmp3_ == ((0 != _tmp2_label3) ? _tmp2_label3 : (_tmp2_label3 = g_quark_from_static_string ("minus")))) || (_tmp3_ == ((0 != _tmp2_label4) ? _tmp2_label4 : (_tmp2_label4 = g_quark_from_static_string ("underscore"))))) || (_tmp3_ == ((0 != _tmp2_label5) ? _tmp2_label5 : (_tmp2_label5 = g_quark_from_static_string ("KP_Subtract"))))) {
		switch (0) {
			default:
			{
				page_activate_action ((Page*) self, "DecreaseSize");
				break;
			}
		}
	} else if (_tmp3_ == ((0 != _tmp2_label6) ? _tmp2_label6 : (_tmp2_label6 = g_quark_from_static_string ("slash")))) {
		switch (0) {
			default:
			{
				page_activate_action ((Page*) self, "Flag");
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				handled = FALSE;
				break;
			}
		}
	}
	if (handled) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = PAGE_CLASS (media_page_parent_class)->on_app_key_pressed ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), event);
	}
	result = _tmp4_;
	return result;
}

static void
media_page_real_switched_to (Page* base)
{
	MediaPage * self;
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	GSettings* _tmp2_;
	GSettings* _tmp3_;
	GSettings* _tmp4_;
	ViewCollection* _tmp5_;
	ViewCollection* _tmp6_;
	self = (MediaPage*) base;
	PAGE_CLASS (media_page_parent_class)->switched_to ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage));
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	data_collection_freeze_notifications ((DataCollection*) _tmp1_);
	_data_collection_unref0 (_tmp1_);
	_tmp2_ = ((Page*) self)->ui_settings;
	checkerboard_page_set_display_titles ((CheckerboardPage*) self, g_settings_get_boolean (_tmp2_, "display-photo-titles"));
	_tmp3_ = ((Page*) self)->ui_settings;
	checkerboard_page_set_display_comments ((CheckerboardPage*) self, g_settings_get_boolean (_tmp3_, "display-photo-comments"));
	_tmp4_ = ((Page*) self)->ui_settings;
	media_page_set_display_tags (self, g_settings_get_boolean (_tmp4_, "display-photo-tags"));
	_tmp5_ = page_get_view ((Page*) self);
	_tmp6_ = _tmp5_;
	data_collection_thaw_notifications ((DataCollection*) _tmp6_);
	_data_collection_unref0 (_tmp6_);
	media_page_sync_sort (self);
}

static void
media_page_real_switching_from (Page* base)
{
	MediaPage * self;
	self = (MediaPage*) base;
	media_page_disconnect_slider (self);
	PAGE_CLASS (media_page_parent_class)->switching_from ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage));
}

static void
_media_page_on_zoom_changed_slider_assembly_value_changed (SliderAssembly* _sender,
                                                           gpointer self)
{
	media_page_on_zoom_changed ((MediaPage*) self);
}

void
media_page_connect_slider (MediaPage* self,
                           SliderAssembly* slider)
{
	SliderAssembly* _tmp0_;
	SliderAssembly* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (slider != NULL);
	_tmp0_ = _g_object_ref0 (slider);
	_g_object_unref0 (self->priv->connected_slider);
	self->priv->connected_slider = _tmp0_;
	_tmp1_ = self->priv->connected_slider;
	g_signal_connect_object (_tmp1_, "value-changed", (GCallback) _media_page_on_zoom_changed_slider_assembly_value_changed, self, 0);
	media_page_load_persistent_thumbnail_scale (self);
}

static void
media_page_save_persistent_thumbnail_scale (MediaPage* self)
{
	SliderAssembly* _tmp0_;
	GSettings* _tmp1_;
	SliderAssembly* _tmp2_;
	gdouble _tmp3_;
	gdouble _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->connected_slider;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = ((Page*) self)->ui_settings;
	_tmp2_ = self->priv->connected_slider;
	_tmp3_ = slider_assembly_get_slider_value (_tmp2_);
	_tmp4_ = _tmp3_;
	g_settings_set_int (_tmp1_, "photo-thumbnail-scale", (gint) _tmp4_);
}

static void
media_page_load_persistent_thumbnail_scale (MediaPage* self)
{
	SliderAssembly* _tmp0_;
	gint persistent_scale = 0;
	GSettings* _tmp1_;
	SliderAssembly* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->connected_slider;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = ((Page*) self)->ui_settings;
	persistent_scale = g_settings_get_int (_tmp1_, "photo-thumbnail-scale");
	_tmp2_ = self->priv->connected_slider;
	slider_assembly_set_slider_value (_tmp2_, (gdouble) persistent_scale);
	media_page_set_thumb_size (self, persistent_scale);
}

void
media_page_disconnect_slider (MediaPage* self)
{
	SliderAssembly* _tmp0_;
	SliderAssembly* _tmp1_;
	guint _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->connected_slider;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->connected_slider;
	g_signal_parse_name ("value-changed", TYPE_SLIDER_ASSEMBLY, &_tmp2_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _media_page_on_zoom_changed_slider_assembly_value_changed, self);
	_g_object_unref0 (self->priv->connected_slider);
	self->priv->connected_slider = NULL;
}

static void
media_page_real_on_zoom_changed (MediaPage* self)
{
	SliderAssembly* _tmp0_;
	_tmp0_ = self->priv->connected_slider;
	if (_tmp0_ != NULL) {
		SliderAssembly* _tmp1_;
		gdouble _tmp2_;
		gdouble _tmp3_;
		_tmp1_ = self->priv->connected_slider;
		_tmp2_ = slider_assembly_get_slider_value (_tmp1_);
		_tmp3_ = _tmp2_;
		media_page_set_thumb_size (self, (gint) _tmp3_);
	}
	media_page_save_persistent_thumbnail_scale (self);
}

void
media_page_on_zoom_changed (MediaPage* self)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->on_zoom_changed) {
		_klass_->on_zoom_changed (self);
	}
}

static void
media_page_real_on_export (MediaPage* self)
{
	g_critical ("Type `%s' does not implement abstract method `media_page_on_export'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}

void
media_page_on_export (MediaPage* self)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->on_export) {
		_klass_->on_export (self);
	}
}

static void
media_page_real_on_increase_size (MediaPage* self)
{
	media_page_increase_zoom_level (self);
}

void
media_page_on_increase_size (MediaPage* self)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->on_increase_size) {
		_klass_->on_increase_size (self);
	}
}

static void
media_page_real_on_decrease_size (MediaPage* self)
{
	media_page_decrease_zoom_level (self);
}

void
media_page_on_decrease_size (MediaPage* self)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->on_decrease_size) {
		_klass_->on_decrease_size (self);
	}
}

static void
media_page_set_display_tags (MediaPage* self,
                             gboolean display)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	ViewCollection* _tmp2_;
	ViewCollection* _tmp3_;
	GValue _tmp4_ = {0};
	ViewCollection* _tmp5_;
	ViewCollection* _tmp6_;
	GtkToggleAction* action = NULL;
	GtkAction* _tmp7_;
	GtkToggleAction* _tmp8_;
	GtkToggleAction* _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	data_collection_freeze_notifications ((DataCollection*) _tmp1_);
	_data_collection_unref0 (_tmp1_);
	_tmp2_ = page_get_view ((Page*) self);
	_tmp3_ = _tmp2_;
	g_value_init (&_tmp4_, G_TYPE_BOOLEAN);
	g_value_set_boolean (&_tmp4_, display);
	data_collection_set_property ((DataCollection*) _tmp3_, THUMBNAIL_PROP_SHOW_TAGS, &_tmp4_, NULL, NULL);
	G_IS_VALUE (&_tmp4_) ? (g_value_unset (&_tmp4_), NULL) : NULL;
	_data_collection_unref0 (_tmp3_);
	_tmp5_ = page_get_view ((Page*) self);
	_tmp6_ = _tmp5_;
	data_collection_thaw_notifications ((DataCollection*) _tmp6_);
	_data_collection_unref0 (_tmp6_);
	_tmp7_ = page_get_action ((Page*) self, "ViewTags");
	_tmp8_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, gtk_toggle_action_get_type ()) ? ((GtkToggleAction*) _tmp7_) : NULL;
	if (_tmp8_ == NULL) {
		_g_object_unref0 (_tmp7_);
	}
	action = _tmp8_;
	_tmp9_ = action;
	if (_tmp9_ != NULL) {
		GtkToggleAction* _tmp10_;
		_tmp10_ = action;
		gtk_toggle_action_set_active (_tmp10_, display);
	}
	_g_object_unref0 (action);
}

static void
media_page_on_new_event (MediaPage* 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_) {
		CommandManager* _tmp3_;
		CommandManager* _tmp4_;
		ViewCollection* _tmp5_;
		ViewCollection* _tmp6_;
		GeeList* _tmp7_;
		GeeList* _tmp8_;
		NewEventCommand* _tmp9_;
		NewEventCommand* _tmp10_;
		_tmp3_ = page_get_command_manager ((Page*) self);
		_tmp4_ = _tmp3_;
		_tmp5_ = page_get_view ((Page*) self);
		_tmp6_ = _tmp5_;
		_tmp7_ = view_collection_get_selected (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = new_event_command_new ((GeeIterable*) _tmp8_);
		_tmp10_ = _tmp9_;
		command_manager_execute (_tmp4_, (Command*) _tmp10_);
		_g_object_unref0 (_tmp10_);
		_g_object_unref0 (_tmp8_);
		_data_collection_unref0 (_tmp6_);
		_command_manager_unref0 (_tmp4_);
	}
}

static void
media_page_on_flag_unflag (MediaPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	GeeCollection* sources = NULL;
	ViewCollection* _tmp3_;
	ViewCollection* _tmp4_;
	GeeList* _tmp5_;
	GeeCollection* _tmp6_;
	gboolean flag = FALSE;
	CommandManager* _tmp17_;
	CommandManager* _tmp18_;
	GeeCollection* _tmp19_;
	FlagUnflagCommand* _tmp20_;
	FlagUnflagCommand* _tmp21_;
	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_sources_of_type (_tmp4_, TYPE_MEDIA_SOURCE);
	_tmp6_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GEE_TYPE_COLLECTION, GeeCollection);
	_data_collection_unref0 (_tmp4_);
	sources = _tmp6_;
	flag = FALSE;
	{
		GeeIterator* _source_it = NULL;
		GeeCollection* _tmp7_;
		GeeIterator* _tmp8_;
		_tmp7_ = sources;
		_tmp8_ = gee_iterable_iterator ((GeeIterable*) _tmp7_);
		_source_it = _tmp8_;
		while (TRUE) {
			GeeIterator* _tmp9_;
			MediaSource* source = NULL;
			GeeIterator* _tmp10_;
			gpointer _tmp11_;
			Flaggable* flaggable = NULL;
			MediaSource* _tmp12_;
			Flaggable* _tmp13_;
			gboolean _tmp14_ = FALSE;
			Flaggable* _tmp15_;
			_tmp9_ = _source_it;
			if (!gee_iterator_next (_tmp9_)) {
				break;
			}
			_tmp10_ = _source_it;
			_tmp11_ = gee_iterator_get (_tmp10_);
			source = (MediaSource*) _tmp11_;
			_tmp12_ = source;
			_tmp13_ = _g_object_ref0 (IS_FLAGGABLE (_tmp12_) ? ((Flaggable*) _tmp12_) : NULL);
			flaggable = _tmp13_;
			_tmp15_ = flaggable;
			if (_tmp15_ != NULL) {
				Flaggable* _tmp16_;
				_tmp16_ = flaggable;
				_tmp14_ = !flaggable_is_flagged (_tmp16_);
			} else {
				_tmp14_ = FALSE;
			}
			if (_tmp14_) {
				flag = TRUE;
				_g_object_unref0 (flaggable);
				_g_object_unref0 (source);
				break;
			}
			_g_object_unref0 (flaggable);
			_g_object_unref0 (source);
		}
		_g_object_unref0 (_source_it);
	}
	_tmp17_ = page_get_command_manager ((Page*) self);
	_tmp18_ = _tmp17_;
	_tmp19_ = sources;
	_tmp20_ = flag_unflag_command_new (_tmp19_, flag);
	_tmp21_ = _tmp20_;
	command_manager_execute (_tmp18_, (Command*) _tmp21_);
	_g_object_unref0 (_tmp21_);
	_command_manager_unref0 (_tmp18_);
	_g_object_unref0 (sources);
}

static void
media_page_on_remove_from_library (MediaPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	GeeList* _tmp2_;
	GeeCollection* _tmp3_;
	g_return_if_fail (self != NULL);
	_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);
	remove_photos_from_library (_tmp3_);
	_g_object_unref0 (_tmp3_);
	_data_collection_unref0 (_tmp1_);
}

static void
media_page_real_on_move_to_trash (MediaPage* self)
{
	CheckerboardItem* restore_point = NULL;
	CheckerboardItem* _tmp0_;
	ViewCollection* _tmp6_;
	ViewCollection* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp17_ = FALSE;
	CheckerboardItem* _tmp18_;
	restore_point = NULL;
	_tmp0_ = ((CheckerboardPage*) self)->cursor;
	if (_tmp0_ != NULL) {
		ViewCollection* _tmp1_;
		ViewCollection* _tmp2_;
		CheckerboardItem* _tmp3_;
		DataView* _tmp4_;
		CheckerboardItem* _tmp5_;
		_tmp1_ = page_get_view ((Page*) self);
		_tmp2_ = _tmp1_;
		_tmp3_ = ((CheckerboardPage*) self)->cursor;
		_tmp4_ = view_collection_get_next (_tmp2_, (DataView*) _tmp3_);
		_tmp5_ = IS_CHECKERBOARD_ITEM (_tmp4_) ? ((CheckerboardItem*) _tmp4_) : NULL;
		if (_tmp5_ == NULL) {
			_g_object_unref0 (_tmp4_);
		}
		_g_object_unref0 (restore_point);
		restore_point = _tmp5_;
		_data_collection_unref0 (_tmp2_);
	}
	_tmp6_ = page_get_view ((Page*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = view_collection_get_selected_count (_tmp7_) > 0;
	_data_collection_unref0 (_tmp7_);
	if (_tmp8_) {
		CommandManager* _tmp9_;
		CommandManager* _tmp10_;
		ViewCollection* _tmp11_;
		ViewCollection* _tmp12_;
		GeeList* _tmp13_;
		GeeCollection* _tmp14_;
		TrashUntrashPhotosCommand* _tmp15_;
		TrashUntrashPhotosCommand* _tmp16_;
		_tmp9_ = page_get_command_manager ((Page*) self);
		_tmp10_ = _tmp9_;
		_tmp11_ = page_get_view ((Page*) self);
		_tmp12_ = _tmp11_;
		_tmp13_ = view_collection_get_selected_sources (_tmp12_);
		_tmp14_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, GEE_TYPE_COLLECTION, GeeCollection);
		_tmp15_ = trash_untrash_photos_command_new (_tmp14_, TRUE);
		_tmp16_ = _tmp15_;
		command_manager_execute (_tmp10_, (Command*) _tmp16_);
		_g_object_unref0 (_tmp16_);
		_g_object_unref0 (_tmp14_);
		_data_collection_unref0 (_tmp12_);
		_command_manager_unref0 (_tmp10_);
	}
	_tmp18_ = restore_point;
	if (_tmp18_ != NULL) {
		ViewCollection* _tmp19_;
		ViewCollection* _tmp20_;
		CheckerboardItem* _tmp21_;
		_tmp19_ = page_get_view ((Page*) self);
		_tmp20_ = _tmp19_;
		_tmp21_ = restore_point;
		_tmp17_ = data_collection_contains ((DataCollection*) _tmp20_, (DataObject*) _tmp21_);
		_data_collection_unref0 (_tmp20_);
	} else {
		_tmp17_ = FALSE;
	}
	if (_tmp17_) {
		CheckerboardItem* _tmp22_;
		_tmp22_ = restore_point;
		checkerboard_page_set_cursor ((CheckerboardPage*) self, _tmp22_);
	}
	_g_object_unref0 (restore_point);
}

void
media_page_on_move_to_trash (MediaPage* self)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->on_move_to_trash) {
		_klass_->on_move_to_trash (self);
	}
}

static void
media_page_real_on_display_titles (MediaPage* self,
                                   GtkAction* action)
{
	gboolean display = FALSE;
	GSettings* _tmp0_;
	g_return_if_fail (action != NULL);
	display = gtk_toggle_action_get_active (G_TYPE_CHECK_INSTANCE_CAST (action, gtk_toggle_action_get_type (), GtkToggleAction));
	checkerboard_page_set_display_titles ((CheckerboardPage*) self, display);
	_tmp0_ = ((Page*) self)->ui_settings;
	g_settings_set_boolean (_tmp0_, "display-photo-titles", display);
}

void
media_page_on_display_titles (MediaPage* self,
                              GtkAction* action)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->on_display_titles) {
		_klass_->on_display_titles (self, action);
	}
}

static void
media_page_real_on_display_comments (MediaPage* self,
                                     GtkAction* action)
{
	gboolean display = FALSE;
	GSettings* _tmp0_;
	g_return_if_fail (action != NULL);
	display = gtk_toggle_action_get_active (G_TYPE_CHECK_INSTANCE_CAST (action, gtk_toggle_action_get_type (), GtkToggleAction));
	checkerboard_page_set_display_comments ((CheckerboardPage*) self, display);
	_tmp0_ = ((Page*) self)->ui_settings;
	g_settings_set_boolean (_tmp0_, "display-photo-comments", display);
}

void
media_page_on_display_comments (MediaPage* self,
                                GtkAction* action)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->on_display_comments) {
		_klass_->on_display_comments (self, action);
	}
}

static void
media_page_real_on_display_tags (MediaPage* self,
                                 GtkAction* action)
{
	gboolean display = FALSE;
	GSettings* _tmp0_;
	g_return_if_fail (action != NULL);
	display = gtk_toggle_action_get_active (G_TYPE_CHECK_INSTANCE_CAST (action, gtk_toggle_action_get_type (), GtkToggleAction));
	media_page_set_display_tags (self, display);
	_tmp0_ = ((Page*) self)->ui_settings;
	g_settings_set_boolean (_tmp0_, "display-photo-tags", display);
}

void
media_page_on_display_tags (MediaPage* self,
                            GtkAction* action)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->on_display_tags) {
		_klass_->on_display_tags (self, action);
	}
}

static void
media_page_real_get_config_photos_sort (MediaPage* self,
                                        gboolean* sort_order,
                                        gint* sort_by)
{
	gboolean _vala_sort_order = FALSE;
	gint _vala_sort_by = 0;
	GSettings* _tmp0_;
	GSettings* _tmp1_;
	_tmp0_ = ((Page*) self)->ui_settings;
	_vala_sort_order = g_settings_get_boolean (_tmp0_, "library-photos-sort-ascending");
	_tmp1_ = ((Page*) self)->ui_settings;
	_vala_sort_by = g_settings_get_int (_tmp1_, "library-photos-sort-by");
	if (sort_order) {
		*sort_order = _vala_sort_order;
	}
	if (sort_by) {
		*sort_by = _vala_sort_by;
	}
}

void
media_page_get_config_photos_sort (MediaPage* self,
                                   gboolean* sort_order,
                                   gint* sort_by)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->get_config_photos_sort) {
		_klass_->get_config_photos_sort (self, sort_order, sort_by);
	}
}

static void
media_page_real_set_config_photos_sort (MediaPage* self,
                                        gboolean sort_order,
                                        gint sort_by)
{
	GSettings* _tmp0_;
	GSettings* _tmp1_;
	_tmp0_ = ((Page*) self)->ui_settings;
	g_settings_set_boolean (_tmp0_, "library-photos-sort-ascending", sort_order);
	_tmp1_ = ((Page*) self)->ui_settings;
	g_settings_set_int (_tmp1_, "library-photos-sort-by", sort_by);
}

void
media_page_set_config_photos_sort (MediaPage* self,
                                   gboolean sort_order,
                                   gint sort_by)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->set_config_photos_sort) {
		_klass_->set_config_photos_sort (self, sort_order, sort_by);
	}
}

static void
media_page_real_on_sort_changed (MediaPage* self)
{
	gint sort_by = 0;
	gboolean sort_order = FALSE;
	sort_by = media_page_get_menu_sort_by (self);
	sort_order = media_page_get_menu_sort_order (self);
	media_page_set_view_comparator (self, sort_by, sort_order);
	media_page_set_config_photos_sort (self, sort_order, sort_by);
}

void
media_page_on_sort_changed (MediaPage* self)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->on_sort_changed) {
		_klass_->on_sort_changed (self);
	}
}

static void
media_page_on_raw_developer_shotwell (MediaPage* self,
                                      GtkAction* action)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	media_page_developer_changed (self, RAW_DEVELOPER_SHOTWELL);
}

static void
media_page_on_raw_developer_camera (MediaPage* self,
                                    GtkAction* action)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	media_page_developer_changed (self, RAW_DEVELOPER_CAMERA);
}

static void
media_page_real_developer_changed (MediaPage* self,
                                   RawDeveloper rd)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	gboolean need_warn = FALSE;
	GeeArrayList* to_set = NULL;
	GeeArrayList* _tmp3_;
	gboolean _tmp25_ = FALSE;
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = view_collection_get_selected_count (_tmp1_) == 0;
	_data_collection_unref0 (_tmp1_);
	if (_tmp2_) {
		return;
	}
	need_warn = FALSE;
	_tmp3_ = gee_array_list_new (TYPE_DATA_VIEW, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	to_set = _tmp3_;
	{
		GeeList* _view_list = NULL;
		ViewCollection* _tmp4_;
		ViewCollection* _tmp5_;
		GeeList* _tmp6_;
		GeeList* _tmp7_;
		gint _view_size = 0;
		GeeList* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gint _view_index = 0;
		_tmp4_ = page_get_view ((Page*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = view_collection_get_selected (_tmp5_);
		_tmp7_ = _tmp6_;
		_data_collection_unref0 (_tmp5_);
		_view_list = _tmp7_;
		_tmp8_ = _view_list;
		_tmp9_ = gee_collection_get_size ((GeeCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		_view_size = _tmp10_;
		_view_index = -1;
		while (TRUE) {
			gint _tmp11_;
			gint _tmp12_;
			DataView* view = NULL;
			GeeList* _tmp13_;
			gpointer _tmp14_;
			Photo* p = NULL;
			DataView* _tmp15_;
			DataSource* _tmp16_;
			DataSource* _tmp17_;
			Photo* _tmp18_;
			gboolean _tmp19_ = FALSE;
			Photo* _tmp20_;
			_view_index = _view_index + 1;
			_tmp11_ = _view_index;
			_tmp12_ = _view_size;
			if (!(_tmp11_ < _tmp12_)) {
				break;
			}
			_tmp13_ = _view_list;
			_tmp14_ = gee_list_get (_tmp13_, _view_index);
			view = (DataView*) _tmp14_;
			_tmp15_ = view;
			_tmp16_ = data_view_get_source (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = _g_object_ref0 (IS_PHOTO (_tmp17_) ? ((Photo*) _tmp17_) : NULL);
			p = _tmp18_;
			_tmp20_ = p;
			if (_tmp20_ != NULL) {
				Photo* _tmp21_;
				_tmp21_ = p;
				_tmp19_ = !raw_developer_is_equivalent (rd, photo_get_raw_developer (_tmp21_));
			} else {
				_tmp19_ = FALSE;
			}
			if (_tmp19_) {
				GeeArrayList* _tmp22_;
				DataView* _tmp23_;
				Photo* _tmp24_;
				_tmp22_ = to_set;
				_tmp23_ = view;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, _tmp23_);
				_tmp24_ = p;
				if (photo_has_transformations (_tmp24_)) {
					need_warn = TRUE;
				}
			}
			_g_object_unref0 (p);
			_g_object_unref0 (view);
		}
		_g_object_unref0 (_view_list);
	}
	if (!need_warn) {
		_tmp25_ = TRUE;
	} else {
		GeeArrayList* _tmp26_;
		gint _tmp27_;
		gint _tmp28_;
		_tmp26_ = to_set;
		_tmp27_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp26_);
		_tmp28_ = _tmp27_;
		_tmp25_ = dialogs_confirm_warn_developer_changed (_tmp28_);
	}
	if (_tmp25_) {
		SetRawDeveloperCommand* command = NULL;
		GeeArrayList* _tmp29_;
		SetRawDeveloperCommand* _tmp30_;
		CommandManager* _tmp31_;
		CommandManager* _tmp32_;
		SetRawDeveloperCommand* _tmp33_;
		_tmp29_ = to_set;
		_tmp30_ = set_raw_developer_command_new ((GeeIterable*) _tmp29_, rd);
		command = _tmp30_;
		_tmp31_ = page_get_command_manager ((Page*) self);
		_tmp32_ = _tmp31_;
		_tmp33_ = command;
		command_manager_execute (_tmp32_, (Command*) _tmp33_);
		_command_manager_unref0 (_tmp32_);
		media_page_update_development_menu_item_sensitivity (self);
		_g_object_unref0 (command);
	}
	_g_object_unref0 (to_set);
}

void
media_page_developer_changed (MediaPage* self,
                              RawDeveloper rd)
{
	MediaPageClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->developer_changed) {
		_klass_->developer_changed (self, rd);
	}
}

static void
media_page_real_set_display_titles (CheckerboardPage* base,
                                    gboolean display)
{
	MediaPage * self;
	GtkToggleAction* action = NULL;
	GtkAction* _tmp0_;
	GtkToggleAction* _tmp1_;
	GtkToggleAction* _tmp2_;
	self = (MediaPage*) base;
	CHECKERBOARD_PAGE_CLASS (media_page_parent_class)->set_display_titles (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), display);
	_tmp0_ = page_get_action ((Page*) self, "ViewTitle");
	_tmp1_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_toggle_action_get_type ()) ? ((GtkToggleAction*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	action = _tmp1_;
	_tmp2_ = action;
	if (_tmp2_ != NULL) {
		GtkToggleAction* _tmp3_;
		_tmp3_ = action;
		gtk_toggle_action_set_active (_tmp3_, display);
	}
	_g_object_unref0 (action);
}

static void
media_page_real_set_display_comments (CheckerboardPage* base,
                                      gboolean display)
{
	MediaPage * self;
	GtkToggleAction* action = NULL;
	GtkAction* _tmp0_;
	GtkToggleAction* _tmp1_;
	GtkToggleAction* _tmp2_;
	self = (MediaPage*) base;
	CHECKERBOARD_PAGE_CLASS (media_page_parent_class)->set_display_comments (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), display);
	_tmp0_ = page_get_action ((Page*) self, "ViewComment");
	_tmp1_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_toggle_action_get_type ()) ? ((GtkToggleAction*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	action = _tmp1_;
	_tmp2_ = action;
	if (_tmp2_ != NULL) {
		GtkToggleAction* _tmp3_;
		_tmp3_ = action;
		gtk_toggle_action_set_active (_tmp3_, display);
	}
	_g_object_unref0 (action);
}

static GtkRadioAction*
media_page_sort_by_title_action (MediaPage* self)
{
	GtkRadioAction* action = NULL;
	GtkAction* _tmp0_;
	GtkRadioAction* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = page_get_action ((Page*) self, "SortByTitle");
	action = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_radio_action_get_type (), GtkRadioAction);
	_vala_assert (action != NULL, "action != null");
	result = action;
	return result;
}

static GtkRadioAction*
media_page_sort_ascending_action (MediaPage* self)
{
	GtkRadioAction* action = NULL;
	GtkAction* _tmp0_;
	GtkRadioAction* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = page_get_action ((Page*) self, "SortAscending");
	action = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_radio_action_get_type (), GtkRadioAction);
	_vala_assert (action != NULL, "action != null");
	result = action;
	return result;
}

gint
media_page_get_menu_sort_by (MediaPage* self)
{
	GtkRadioAction* _tmp0_;
	GtkRadioAction* _tmp1_;
	gint _tmp2_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = media_page_sort_by_title_action (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gtk_radio_action_get_current_value (_tmp1_);
	_g_object_unref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

void
media_page_set_menu_sort_by (MediaPage* self,
                             gint val)
{
	GtkRadioAction* _tmp0_;
	GtkRadioAction* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = media_page_sort_by_title_action (self);
	_tmp1_ = _tmp0_;
	gtk_radio_action_set_current_value (_tmp1_, val);
	_g_object_unref0 (_tmp1_);
}

gboolean
media_page_get_menu_sort_order (MediaPage* self)
{
	GtkRadioAction* _tmp0_;
	GtkRadioAction* _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = media_page_sort_ascending_action (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gtk_radio_action_get_current_value (_tmp1_) == MEDIA_PAGE_SORT_ORDER_ASCENDING;
	_g_object_unref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

void
media_page_set_menu_sort_order (MediaPage* self,
                                gboolean ascending)
{
	gint _tmp0_ = 0;
	GtkRadioAction* _tmp1_;
	GtkRadioAction* _tmp2_;
	g_return_if_fail (self != NULL);
	if (ascending) {
		_tmp0_ = MEDIA_PAGE_SORT_ORDER_ASCENDING;
	} else {
		_tmp0_ = MEDIA_PAGE_SORT_ORDER_DESCENDING;
	}
	_tmp1_ = media_page_sort_ascending_action (self);
	_tmp2_ = _tmp1_;
	gtk_radio_action_set_current_value (_tmp2_, _tmp0_);
	_g_object_unref0 (_tmp2_);
}

static gint64
_thumbnail_title_ascending_comparator_comparator (void* a,
                                                  void* b,
                                                  gpointer self)
{
	gint64 result;
	result = thumbnail_title_ascending_comparator (a, b);
	return result;
}

static gint64
_thumbnail_title_descending_comparator_comparator (void* a,
                                                   void* b,
                                                   gpointer self)
{
	gint64 result;
	result = thumbnail_title_descending_comparator (a, b);
	return result;
}

static gboolean
_thumbnail_title_comparator_predicate_comparator_predicate (DataObject* object,
                                                            Alteration* alteration,
                                                            gpointer self)
{
	gboolean result;
	result = thumbnail_title_comparator_predicate (object, alteration);
	return result;
}

static gint64
_thumbnail_exposure_time_ascending_comparator_comparator (void* a,
                                                          void* b,
                                                          gpointer self)
{
	gint64 result;
	result = thumbnail_exposure_time_ascending_comparator (a, b);
	return result;
}

static gint64
_thumbnail_exposure_time_descending_comparator_comparator (void* a,
                                                           void* b,
                                                           gpointer self)
{
	gint64 result;
	result = thumbnail_exposure_time_descending_comparator (a, b);
	return result;
}

static gboolean
_thumbnail_exposure_time_comparator_predicate_comparator_predicate (DataObject* object,
                                                                    Alteration* alteration,
                                                                    gpointer self)
{
	gboolean result;
	result = thumbnail_exposure_time_comparator_predicate (object, alteration);
	return result;
}

static gint64
_thumbnail_timestamp_ascending_comparator_comparator (void* a,
                                                      void* b,
                                                      gpointer self)
{
	gint64 result;
	result = thumbnail_timestamp_ascending_comparator (a, b);
	return result;
}

static gint64
_thumbnail_timestamp_descending_comparator_comparator (void* a,
                                                       void* b,
                                                       gpointer self)
{
	gint64 result;
	result = thumbnail_timestamp_descending_comparator (a, b);
	return result;
}

static gboolean
_thumbnail_timestamp_comparator_predicate_comparator_predicate (DataObject* object,
                                                                Alteration* alteration,
                                                                gpointer self)
{
	gboolean result;
	result = thumbnail_timestamp_comparator_predicate (object, alteration);
	return result;
}

static void
media_page_set_view_comparator (MediaPage* self,
                                gint sort_by,
                                gboolean ascending)
{
	Comparator comparator = NULL;
	gpointer comparator_target = NULL;
	GDestroyNotify comparator_target_destroy_notify = NULL;
	ComparatorPredicate predicate = NULL;
	gpointer predicate_target = NULL;
	GDestroyNotify predicate_target_destroy_notify = NULL;
	ViewCollection* _tmp2_;
	ViewCollection* _tmp3_;
	Comparator _tmp4_;
	gpointer _tmp4__target;
	ComparatorPredicate _tmp5_;
	gpointer _tmp5__target;
	g_return_if_fail (self != NULL);
	switch (sort_by) {
		case MEDIA_PAGE_SORT_BY_TITLE:
		{
			if (ascending) {
				(comparator_target_destroy_notify == NULL) ? NULL : (comparator_target_destroy_notify (comparator_target), NULL);
				comparator = NULL;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
				comparator = _thumbnail_title_ascending_comparator_comparator;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
			} else {
				(comparator_target_destroy_notify == NULL) ? NULL : (comparator_target_destroy_notify (comparator_target), NULL);
				comparator = NULL;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
				comparator = _thumbnail_title_descending_comparator_comparator;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
			}
			(predicate_target_destroy_notify == NULL) ? NULL : (predicate_target_destroy_notify (predicate_target), NULL);
			predicate = NULL;
			predicate_target = NULL;
			predicate_target_destroy_notify = NULL;
			predicate = _thumbnail_title_comparator_predicate_comparator_predicate;
			predicate_target = NULL;
			predicate_target_destroy_notify = NULL;
			break;
		}
		case MEDIA_PAGE_SORT_BY_EXPOSURE_DATE:
		{
			if (ascending) {
				(comparator_target_destroy_notify == NULL) ? NULL : (comparator_target_destroy_notify (comparator_target), NULL);
				comparator = NULL;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
				comparator = _thumbnail_exposure_time_ascending_comparator_comparator;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
			} else {
				(comparator_target_destroy_notify == NULL) ? NULL : (comparator_target_destroy_notify (comparator_target), NULL);
				comparator = NULL;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
				comparator = _thumbnail_exposure_time_descending_comparator_comparator;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
			}
			(predicate_target_destroy_notify == NULL) ? NULL : (predicate_target_destroy_notify (predicate_target), NULL);
			predicate = NULL;
			predicate_target = NULL;
			predicate_target_destroy_notify = NULL;
			predicate = _thumbnail_exposure_time_comparator_predicate_comparator_predicate;
			predicate_target = NULL;
			predicate_target_destroy_notify = NULL;
			break;
		}
		case MEDIA_PAGE_SORT_BY_TIMESTAMP:
		{
			if (ascending) {
				(comparator_target_destroy_notify == NULL) ? NULL : (comparator_target_destroy_notify (comparator_target), NULL);
				comparator = NULL;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
				comparator = _thumbnail_timestamp_ascending_comparator_comparator;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
			} else {
				(comparator_target_destroy_notify == NULL) ? NULL : (comparator_target_destroy_notify (comparator_target), NULL);
				comparator = NULL;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
				comparator = _thumbnail_timestamp_descending_comparator_comparator;
				comparator_target = NULL;
				comparator_target_destroy_notify = NULL;
			}
			(predicate_target_destroy_notify == NULL) ? NULL : (predicate_target_destroy_notify (predicate_target), NULL);
			predicate = NULL;
			predicate_target = NULL;
			predicate_target_destroy_notify = NULL;
			predicate = _thumbnail_timestamp_comparator_predicate_comparator_predicate;
			predicate_target = NULL;
			predicate_target_destroy_notify = NULL;
			break;
		}
		default:
		{
			gchar* _tmp0_;
			gchar* _tmp1_;
			_tmp0_ = g_strdup_printf ("%i", media_page_get_menu_sort_by (self));
			_tmp1_ = _tmp0_;
			g_debug ("MediaPage.vala:725: Unknown sort criteria: %s", _tmp1_);
			_g_free0 (_tmp1_);
			(comparator_target_destroy_notify == NULL) ? NULL : (comparator_target_destroy_notify (comparator_target), NULL);
			comparator = NULL;
			comparator_target = NULL;
			comparator_target_destroy_notify = NULL;
			comparator = _thumbnail_title_descending_comparator_comparator;
			comparator_target = NULL;
			comparator_target_destroy_notify = NULL;
			(predicate_target_destroy_notify == NULL) ? NULL : (predicate_target_destroy_notify (predicate_target), NULL);
			predicate = NULL;
			predicate_target = NULL;
			predicate_target_destroy_notify = NULL;
			predicate = _thumbnail_title_comparator_predicate_comparator_predicate;
			predicate_target = NULL;
			predicate_target_destroy_notify = NULL;
			break;
		}
	}
	_tmp2_ = page_get_view ((Page*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = comparator;
	_tmp4__target = comparator_target;
	_tmp5_ = predicate;
	_tmp5__target = predicate_target;
	data_collection_set_comparator ((DataCollection*) _tmp3_, _tmp4_, _tmp4__target, _tmp5_, _tmp5__target);
	_data_collection_unref0 (_tmp3_);
	(predicate_target_destroy_notify == NULL) ? NULL : (predicate_target_destroy_notify (predicate_target), NULL);
	predicate = NULL;
	predicate_target = NULL;
	predicate_target_destroy_notify = NULL;
	(comparator_target_destroy_notify == NULL) ? NULL : (comparator_target_destroy_notify (comparator_target), NULL);
	comparator = NULL;
	comparator_target = NULL;
	comparator_target_destroy_notify = NULL;
}

void
media_page_sync_sort (MediaPage* self)
{
	gboolean sort_ascending = FALSE;
	gint sort_by = 0;
	gboolean _tmp0_ = FALSE;
	gint _tmp1_ = 0;
	g_return_if_fail (self != NULL);
	media_page_get_config_photos_sort (self, &_tmp0_, &_tmp1_);
	sort_ascending = _tmp0_;
	sort_by = _tmp1_;
	media_page_set_menu_sort_by (self, sort_by);
	media_page_set_menu_sort_order (self, sort_ascending);
	media_page_set_view_comparator (self, sort_by, sort_ascending);
}

static void
media_page_real_destroy (GtkWidget* base)
{
	MediaPage * self;
	self = (MediaPage*) base;
	media_page_disconnect_slider (self);
	GTK_WIDGET_CLASS (media_page_parent_class)->destroy ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage));
}

static void
media_page_increase_zoom_level (MediaPage* self)
{
	SliderAssembly* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->connected_slider;
	if (_tmp0_ != NULL) {
		SliderAssembly* _tmp1_;
		_tmp1_ = self->priv->connected_slider;
		slider_assembly_increase_step (_tmp1_);
	} else {
		gint new_scale = 0;
		new_scale = media_page_compute_zoom_scale_increase (media_page_get_thumb_size (self));
		media_page_save_persistent_thumbnail_scale (self);
		media_page_set_thumb_size (self, new_scale);
	}
}

static void
media_page_decrease_zoom_level (MediaPage* self)
{
	SliderAssembly* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->connected_slider;
	if (_tmp0_ != NULL) {
		SliderAssembly* _tmp1_;
		_tmp1_ = self->priv->connected_slider;
		slider_assembly_decrease_step (_tmp1_);
	} else {
		gint new_scale = 0;
		new_scale = media_page_compute_zoom_scale_decrease (media_page_get_thumb_size (self));
		media_page_save_persistent_thumbnail_scale (self);
		media_page_set_thumb_size (self, new_scale);
	}
}

static DataView*
media_page_real_create_thumbnail (MediaPage* self,
                                  DataSource* source)
{
	Thumbnail* _tmp0_;
	DataView* result;
	g_return_val_if_fail (source != NULL, NULL);
	_tmp0_ = thumbnail_new (G_TYPE_CHECK_INSTANCE_CAST (source, TYPE_MEDIA_SOURCE, MediaSource), media_page_get_thumb_size (self));
	result = (DataView*) _tmp0_;
	return result;
}

DataView*
media_page_create_thumbnail (MediaPage* self,
                             DataSource* source)
{
	MediaPageClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = MEDIA_PAGE_GET_CLASS (self);
	if (_klass_->create_thumbnail) {
		return _klass_->create_thumbnail (self, source);
	}
	return NULL;
}

static void
media_page_set_thumb_size (MediaPage* self,
                           gint new_scale)
{
	gboolean _tmp0_ = FALSE;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	CheckerboardLayout* _tmp7_;
	CheckerboardLayout* _tmp8_;
	ViewCollection* _tmp9_;
	ViewCollection* _tmp10_;
	ViewCollection* _tmp11_;
	ViewCollection* _tmp12_;
	GValue _tmp13_ = {0};
	ViewCollection* _tmp14_;
	ViewCollection* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	g_return_if_fail (self != NULL);
	if (media_page_get_thumb_size (self) == new_scale) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp1_;
		gboolean _tmp2_;
		_tmp1_ = page_get_in_view ((Page*) self);
		_tmp2_ = _tmp1_;
		_tmp0_ = !_tmp2_;
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = thumbnail_get_MIN_SCALE ();
	_tmp4_ = _tmp3_;
	_tmp5_ = thumbnail_get_MAX_SCALE ();
	_tmp6_ = _tmp5_;
	new_scale = CLAMP (new_scale, _tmp4_, _tmp6_);
	_tmp7_ = checkerboard_page_get_checkerboard_layout ((CheckerboardPage*) self);
	_tmp8_ = _tmp7_;
	checkerboard_layout_set_scale (_tmp8_, new_scale);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = page_get_view ((Page*) self);
	_tmp10_ = _tmp9_;
	data_collection_freeze_notifications ((DataCollection*) _tmp10_);
	_data_collection_unref0 (_tmp10_);
	_tmp11_ = page_get_view ((Page*) self);
	_tmp12_ = _tmp11_;
	g_value_init (&_tmp13_, G_TYPE_INT);
	g_value_set_int (&_tmp13_, new_scale);
	data_collection_set_property ((DataCollection*) _tmp12_, THUMBNAIL_PROP_SIZE, &_tmp13_, NULL, NULL);
	G_IS_VALUE (&_tmp13_) ? (g_value_unset (&_tmp13_), NULL) : NULL;
	_data_collection_unref0 (_tmp12_);
	_tmp14_ = page_get_view ((Page*) self);
	_tmp15_ = _tmp14_;
	data_collection_thaw_notifications ((DataCollection*) _tmp15_);
	_data_collection_unref0 (_tmp15_);
	_tmp16_ = thumbnail_get_MAX_SCALE ();
	_tmp17_ = _tmp16_;
	page_set_action_sensitive ((Page*) self, "IncreaseSize", new_scale < _tmp17_);
	_tmp18_ = thumbnail_get_MIN_SCALE ();
	_tmp19_ = _tmp18_;
	page_set_action_sensitive ((Page*) self, "DecreaseSize", new_scale > _tmp19_);
}

static gint
media_page_get_thumb_size (MediaPage* self)
{
	CheckerboardLayout* _tmp0_;
	CheckerboardLayout* _tmp1_;
	gboolean _tmp2_;
	CheckerboardLayout* _tmp6_;
	CheckerboardLayout* _tmp7_;
	gint _tmp8_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = checkerboard_page_get_checkerboard_layout ((CheckerboardPage*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = checkerboard_layout_get_scale (_tmp1_) <= 0;
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		CheckerboardLayout* _tmp3_;
		CheckerboardLayout* _tmp4_;
		GSettings* _tmp5_;
		_tmp3_ = checkerboard_page_get_checkerboard_layout ((CheckerboardPage*) self);
		_tmp4_ = _tmp3_;
		_tmp5_ = ((Page*) self)->ui_settings;
		checkerboard_layout_set_scale (_tmp4_, g_settings_get_int (_tmp5_, "photo-thumbnail-scale"));
		_g_object_unref0 (_tmp4_);
	}
	_tmp6_ = checkerboard_page_get_checkerboard_layout ((CheckerboardPage*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = checkerboard_layout_get_scale (_tmp7_);
	_g_object_unref0 (_tmp7_);
	result = _tmp8_;
	return result;
}

GtkButton*
media_page_create_sidebar_button (void)
{
	GtkButton* show_sidebar_button = NULL;
	GtkButton* _tmp0_;
	GtkButton* result;
	_tmp0_ = (GtkButton*) gtk_button_new_from_icon_name (RESOURCES_SHOW_PANE, (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp0_);
	show_sidebar_button = _tmp0_;
	gtk_widget_set_tooltip_text ((GtkWidget*) show_sidebar_button, RESOURCES_TOGGLE_METAPANE_TOOLTIP);
	result = show_sidebar_button;
	return result;
}

static void
_media_page_on_media_altered_data_collection_items_altered (DataCollection* _sender,
                                                            GeeMap* items,
                                                            gpointer self)
{
	media_page_on_media_altered ((MediaPage*) self, items);
}

static GObject *
media_page_constructor (GType type,
                        guint n_construct_properties,
                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	MediaPage * self;
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	MediaViewTracker* _tmp2_;
	ViewCollection* _tmp3_;
	ViewCollection* _tmp4_;
	ViewCollection* _tmp5_;
	ViewCollection* _tmp6_;
	ViewCollection* _tmp7_;
	ViewCollection* _tmp8_;
	GSettings* _tmp9_;
	GValue _tmp10_ = {0};
	ViewCollection* _tmp11_;
	ViewCollection* _tmp12_;
	GSettings* _tmp13_;
	GValue _tmp14_ = {0};
	ViewCollection* _tmp15_;
	ViewCollection* _tmp16_;
	GSettings* _tmp17_;
	GValue _tmp18_ = {0};
	ViewCollection* _tmp19_;
	ViewCollection* _tmp20_;
	GValue _tmp21_ = {0};
	ViewCollection* _tmp22_;
	ViewCollection* _tmp23_;
	DragAndDropHandler* _tmp24_;
	parent_class = G_OBJECT_CLASS (media_page_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MEDIA_PAGE, MediaPage);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = media_view_tracker_new (_tmp1_);
	_core_tracker_unref0 (self->priv->tracker);
	self->priv->tracker = _tmp2_;
	_data_collection_unref0 (_tmp1_);
	_tmp3_ = page_get_view ((Page*) self);
	_tmp4_ = _tmp3_;
	g_signal_connect_object ((DataCollection*) _tmp4_, "items-altered", (GCallback) _media_page_on_media_altered_data_collection_items_altered, self, 0);
	_data_collection_unref0 (_tmp4_);
	_tmp5_ = page_get_view ((Page*) self);
	_tmp6_ = _tmp5_;
	data_collection_freeze_notifications ((DataCollection*) _tmp6_);
	_data_collection_unref0 (_tmp6_);
	_tmp7_ = page_get_view ((Page*) self);
	_tmp8_ = _tmp7_;
	_tmp9_ = ((Page*) self)->ui_settings;
	g_value_init (&_tmp10_, G_TYPE_BOOLEAN);
	g_value_set_boolean (&_tmp10_, g_settings_get_boolean (_tmp9_, "display-photo-titles"));
	data_collection_set_property ((DataCollection*) _tmp8_, CHECKERBOARD_ITEM_PROP_SHOW_TITLES, &_tmp10_, NULL, NULL);
	G_IS_VALUE (&_tmp10_) ? (g_value_unset (&_tmp10_), NULL) : NULL;
	_data_collection_unref0 (_tmp8_);
	_tmp11_ = page_get_view ((Page*) self);
	_tmp12_ = _tmp11_;
	_tmp13_ = ((Page*) self)->ui_settings;
	g_value_init (&_tmp14_, G_TYPE_BOOLEAN);
	g_value_set_boolean (&_tmp14_, g_settings_get_boolean (_tmp13_, "display-photo-comments"));
	data_collection_set_property ((DataCollection*) _tmp12_, CHECKERBOARD_ITEM_PROP_SHOW_COMMENTS, &_tmp14_, NULL, NULL);
	G_IS_VALUE (&_tmp14_) ? (g_value_unset (&_tmp14_), NULL) : NULL;
	_data_collection_unref0 (_tmp12_);
	_tmp15_ = page_get_view ((Page*) self);
	_tmp16_ = _tmp15_;
	_tmp17_ = ((Page*) self)->ui_settings;
	g_value_init (&_tmp18_, G_TYPE_BOOLEAN);
	g_value_set_boolean (&_tmp18_, g_settings_get_boolean (_tmp17_, "display-photo-tags"));
	data_collection_set_property ((DataCollection*) _tmp16_, THUMBNAIL_PROP_SHOW_TAGS, &_tmp18_, NULL, NULL);
	G_IS_VALUE (&_tmp18_) ? (g_value_unset (&_tmp18_), NULL) : NULL;
	_data_collection_unref0 (_tmp16_);
	_tmp19_ = page_get_view ((Page*) self);
	_tmp20_ = _tmp19_;
	g_value_init (&_tmp21_, G_TYPE_INT);
	g_value_set_int (&_tmp21_, media_page_get_thumb_size (self));
	data_collection_set_property ((DataCollection*) _tmp20_, THUMBNAIL_PROP_SIZE, &_tmp21_, NULL, NULL);
	G_IS_VALUE (&_tmp21_) ? (g_value_unset (&_tmp21_), NULL) : NULL;
	_data_collection_unref0 (_tmp20_);
	_tmp22_ = page_get_view ((Page*) self);
	_tmp23_ = _tmp22_;
	data_collection_thaw_notifications ((DataCollection*) _tmp23_);
	_data_collection_unref0 (_tmp23_);
	_tmp24_ = drag_and_drop_handler_new ((Page*) self);
	_drag_and_drop_handler_unref0 (self->priv->dnd_handler);
	self->priv->dnd_handler = _tmp24_;
	return obj;
}

static void
media_page_class_init (MediaPageClass * klass,
                       gpointer klass_data)
{
	media_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MediaPage_private_offset);
	((PageClass *) klass)->get_page_context_menu = (GtkMenu* (*) (Page*)) media_page_real_get_page_context_menu;
	((PageClass *) klass)->init_collect_action_entries = (GtkActionEntry* (*) (Page*, gint*)) media_page_real_init_collect_action_entries;
	((PageClass *) klass)->init_collect_toggle_action_entries = (GtkToggleActionEntry* (*) (Page*, gint*)) media_page_real_init_collect_toggle_action_entries;
	((PageClass *) klass)->register_radio_actions = (void (*) (Page*, GtkActionGroup*)) media_page_real_register_radio_actions;
	((PageClass *) klass)->update_actions = (void (*) (Page*, gint, gint)) media_page_real_update_actions;
	((CheckerboardPageClass *) klass)->get_view_tracker = (CoreViewTracker* (*) (CheckerboardPage*)) media_page_real_get_view_tracker;
	((PageClass *) klass)->on_mousewheel_up = (gboolean (*) (Page*, GdkEventScroll*)) media_page_real_on_mousewheel_up;
	((PageClass *) klass)->on_mousewheel_down = (gboolean (*) (Page*, GdkEventScroll*)) media_page_real_on_mousewheel_down;
	((PageClass *) klass)->on_app_key_pressed = (gboolean (*) (Page*, GdkEventKey*)) media_page_real_on_app_key_pressed;
	((PageClass *) klass)->switched_to = (void (*) (Page*)) media_page_real_switched_to;
	((PageClass *) klass)->switching_from = (void (*) (Page*)) media_page_real_switching_from;
	((MediaPageClass *) klass)->on_zoom_changed = (void (*) (MediaPage*)) media_page_real_on_zoom_changed;
	((MediaPageClass *) klass)->on_export = (void (*) (MediaPage*)) media_page_real_on_export;
	((MediaPageClass *) klass)->on_increase_size = (void (*) (MediaPage*)) media_page_real_on_increase_size;
	((MediaPageClass *) klass)->on_decrease_size = (void (*) (MediaPage*)) media_page_real_on_decrease_size;
	((MediaPageClass *) klass)->on_move_to_trash = (void (*) (MediaPage*)) media_page_real_on_move_to_trash;
	((MediaPageClass *) klass)->on_display_titles = (void (*) (MediaPage*, GtkAction*)) media_page_real_on_display_titles;
	((MediaPageClass *) klass)->on_display_comments = (void (*) (MediaPage*, GtkAction*)) media_page_real_on_display_comments;
	((MediaPageClass *) klass)->on_display_tags = (void (*) (MediaPage*, GtkAction*)) media_page_real_on_display_tags;
	((MediaPageClass *) klass)->get_config_photos_sort = (void (*) (MediaPage*, gboolean*, gint*)) media_page_real_get_config_photos_sort;
	((MediaPageClass *) klass)->set_config_photos_sort = (void (*) (MediaPage*, gboolean, gint)) media_page_real_set_config_photos_sort;
	((MediaPageClass *) klass)->on_sort_changed = (void (*) (MediaPage*)) media_page_real_on_sort_changed;
	((MediaPageClass *) klass)->developer_changed = (void (*) (MediaPage*, RawDeveloper)) media_page_real_developer_changed;
	((CheckerboardPageClass *) klass)->set_display_titles = (void (*) (CheckerboardPage*, gboolean)) media_page_real_set_display_titles;
	((CheckerboardPageClass *) klass)->set_display_comments = (void (*) (CheckerboardPage*, gboolean)) media_page_real_set_display_comments;
	((GtkWidgetClass *) klass)->destroy = (void (*) (GtkWidget*)) media_page_real_destroy;
	((MediaPageClass *) klass)->create_thumbnail = (DataView* (*) (MediaPage*, DataSource*)) media_page_real_create_thumbnail;
	G_OBJECT_CLASS (klass)->constructor = media_page_constructor;
	G_OBJECT_CLASS (klass)->finalize = media_page_finalize;
}

static void
media_page_instance_init (MediaPage * self,
                          gpointer klass)
{
	self->priv = media_page_get_instance_private (self);
	self->priv->connected_slider = NULL;
	self->priv->dnd_handler = NULL;
}

static void
media_page_finalize (GObject * obj)
{
	MediaPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MEDIA_PAGE, MediaPage);
	_g_object_unref0 (self->priv->connected_slider);
	_drag_and_drop_handler_unref0 (self->priv->dnd_handler);
	_core_tracker_unref0 (self->priv->tracker);
	_g_object_unref0 (self->priv->page_context_menu);
	G_OBJECT_CLASS (media_page_parent_class)->finalize (obj);
}

static GType
media_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MediaPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) media_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MediaPage), 0, (GInstanceInitFunc) media_page_instance_init, NULL };
	GType media_page_type_id;
	media_page_type_id = g_type_register_static (TYPE_CHECKERBOARD_PAGE, "MediaPage", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	MediaPage_private_offset = g_type_add_instance_private (media_page_type_id, sizeof (MediaPagePrivate));
	return media_page_type_id;
}

GType
media_page_get_type (void)
{
	static volatile gsize media_page_type_id__once = 0;
	if (g_once_init_enter (&media_page_type_id__once)) {
		GType media_page_type_id;
		media_page_type_id = media_page_get_type_once ();
		g_once_init_leave (&media_page_type_id__once, media_page_type_id);
	}
	return media_page_type_id__once;
}

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

