/* OfflinePage.c generated by valac 0.56.19, the Vala compiler
 * generated from OfflinePage.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 <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <gee.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <string.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define OFFLINE_PAGE_TYPE_OFFLINE_SEARCH_VIEW_FILTER (offline_page_offline_search_view_filter_get_type ())
#define OFFLINE_PAGE_OFFLINE_SEARCH_VIEW_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OFFLINE_PAGE_TYPE_OFFLINE_SEARCH_VIEW_FILTER, OfflinePageOfflineSearchViewFilter))
#define OFFLINE_PAGE_OFFLINE_SEARCH_VIEW_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OFFLINE_PAGE_TYPE_OFFLINE_SEARCH_VIEW_FILTER, OfflinePageOfflineSearchViewFilterClass))
#define OFFLINE_PAGE_IS_OFFLINE_SEARCH_VIEW_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OFFLINE_PAGE_TYPE_OFFLINE_SEARCH_VIEW_FILTER))
#define OFFLINE_PAGE_IS_OFFLINE_SEARCH_VIEW_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OFFLINE_PAGE_TYPE_OFFLINE_SEARCH_VIEW_FILTER))
#define OFFLINE_PAGE_OFFLINE_SEARCH_VIEW_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OFFLINE_PAGE_TYPE_OFFLINE_SEARCH_VIEW_FILTER, OfflinePageOfflineSearchViewFilterClass))

typedef struct _OfflinePageOfflineSearchViewFilter OfflinePageOfflineSearchViewFilter;
typedef struct _OfflinePageOfflineSearchViewFilterClass OfflinePageOfflineSearchViewFilterClass;
enum  {
	OFFLINE_PAGE_0_PROPERTY,
	OFFLINE_PAGE_NUM_PROPERTIES
};
static GParamSpec* offline_page_properties[OFFLINE_PAGE_NUM_PROPERTIES];
#define _view_filter_unref0(var) ((var == NULL) ? NULL : (var = (view_filter_unref (var), NULL)))
#define _core_tracker_unref0(var) ((var == NULL) ? NULL : (var = (core_tracker_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _data_collection_unref0(var) ((var == NULL) ? NULL : (var = (data_collection_unref (var), NULL)))
typedef struct _Block20Data Block20Data;
typedef struct _Block21Data Block21Data;
typedef struct _Block22Data Block22Data;

#define OFFLINE_PAGE_TYPE_OFFLINE_VIEW (offline_page_offline_view_get_type ())
#define OFFLINE_PAGE_OFFLINE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OFFLINE_PAGE_TYPE_OFFLINE_VIEW, OfflinePageOfflineView))
#define OFFLINE_PAGE_OFFLINE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OFFLINE_PAGE_TYPE_OFFLINE_VIEW, OfflinePageOfflineViewClass))
#define OFFLINE_PAGE_IS_OFFLINE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OFFLINE_PAGE_TYPE_OFFLINE_VIEW))
#define OFFLINE_PAGE_IS_OFFLINE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OFFLINE_PAGE_TYPE_OFFLINE_VIEW))
#define OFFLINE_PAGE_OFFLINE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OFFLINE_PAGE_TYPE_OFFLINE_VIEW, OfflinePageOfflineViewClass))

typedef struct _OfflinePageOfflineView OfflinePageOfflineView;
typedef struct _OfflinePageOfflineViewClass OfflinePageOfflineViewClass;
typedef struct _OfflinePageOfflineViewPrivate OfflinePageOfflineViewPrivate;
enum  {
	OFFLINE_PAGE_OFFLINE_VIEW_0_PROPERTY,
	OFFLINE_PAGE_OFFLINE_VIEW_NUM_PROPERTIES
};
static GParamSpec* offline_page_offline_view_properties[OFFLINE_PAGE_OFFLINE_VIEW_NUM_PROPERTIES];
typedef struct _OfflinePageOfflineSearchViewFilterPrivate OfflinePageOfflineSearchViewFilterPrivate;
#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 _OfflinePagePrivate {
	OfflinePageOfflineSearchViewFilter* search_filter;
	MediaViewTracker* tracker;
	GtkMenu* page_context_menu;
	GtkMenu* page_sidebar_menu;
};

struct _Block20Data {
	int _ref_count_;
	OfflinePage* self;
	GtkAction* remove_action;
};

struct _Block21Data {
	int _ref_count_;
	OfflinePage* self;
	GtkAction* remove_action;
};

struct _Block22Data {
	int _ref_count_;
	OfflinePage* self;
	GtkRadioMenuItem* ascending_menu_item;
	GtkAction* ascending_action;
	GtkRadioMenuItem* descending_menu_item;
	GtkAction* descending_action;
	GAction* select_action;
};

struct _OfflinePageOfflineView {
	Thumbnail parent_instance;
	OfflinePageOfflineViewPrivate * priv;
};

struct _OfflinePageOfflineViewClass {
	ThumbnailClass parent_class;
};

struct _OfflinePageOfflineSearchViewFilter {
	DefaultSearchViewFilter parent_instance;
	OfflinePageOfflineSearchViewFilterPrivate * priv;
};

struct _OfflinePageOfflineSearchViewFilterClass {
	DefaultSearchViewFilterClass parent_class;
};

static gint OfflinePage_private_offset;
static gpointer offline_page_parent_class = NULL;
static gpointer offline_page_offline_view_parent_class = NULL;
static gpointer offline_page_offline_search_view_filter_parent_class = NULL;

static GType offline_page_offline_search_view_filter_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void offline_page_on_offline_contents_altered (OfflinePage* self,
                                               GeeCollection* added,
                                               GeeCollection* removed);
static void _offline_page_on_offline_contents_altered_media_source_collection_offline_contents_altered (MediaSourceCollection* _sender,
                                                                                                 GeeCollection* added,
                                                                                                 GeeCollection* removed,
                                                                                                 gpointer self);
static OfflinePageOfflineSearchViewFilter* offline_page_offline_search_view_filter_new (void);
static OfflinePageOfflineSearchViewFilter* offline_page_offline_search_view_filter_construct (GType object_type);
static void offline_page_real_add_toolbar_widgets (Page* base,
                                            GtkActionBar* toolbar);
static Block20Data* block20_data_ref (Block20Data* _data20_);
static void block20_data_unref (void * _userdata_);
static void __lambda103_ (Block20Data* _data20_);
static void ___lambda103__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static GtkMenu* offline_page_real_get_page_sidebar_menu (Page* base);
static Block21Data* block21_data_ref (Block21Data* _data21_);
static void block21_data_unref (void * _userdata_);
static void ___lambda104_ (Block21Data* _data21_);
static void ____lambda104__gtk_menu_item_activate (GtkMenuItem* _sender,
                                            gpointer self);
static GtkMenu* offline_page_real_get_page_context_menu (Page* base);
static Block22Data* block22_data_ref (Block22Data* _data22_);
static void block22_data_unref (void * _userdata_);
static void ___lambda105_ (Block22Data* _data22_);
static void ____lambda105__gtk_menu_item_activate (GtkMenuItem* _sender,
                                            gpointer self);
static void ___lambda106_ (Block22Data* _data22_);
static void ____lambda106__gtk_menu_item_activate (GtkMenuItem* _sender,
                                            gpointer self);
static void ___lambda107_ (Block22Data* _data22_);
static void ____lambda107__gtk_menu_item_activate (GtkMenuItem* _sender,
                                            gpointer self);
static GtkActionEntry* offline_page_real_init_collect_action_entries (Page* base,
                                                               gint* result_length1);
static void offline_page_on_remove_from_library (OfflinePage* self);
static void _offline_page_on_remove_from_library_gcallback (GtkAction* action,
                                                     gpointer self);
static void _vala_array_add210 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static CoreViewTracker* offline_page_real_get_view_tracker (CheckerboardPage* base);
static void offline_page_real_update_actions (Page* base,
                                       gint selected_count,
                                       gint count);
static OfflinePageOfflineView* offline_page_offline_view_new (MediaSource* source);
static OfflinePageOfflineView* offline_page_offline_view_construct (GType object_type,
                                                             MediaSource* source);
static GType offline_page_offline_view_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static gboolean _progress_dialog_monitor_progress_monitor (guint64 current,
                                                    guint64 total,
                                                    gboolean do_event_loop,
                                                    gpointer self);
static SearchViewFilter* offline_page_real_get_search_view_filter (CheckerboardPage* base);
static GType offline_page_offline_view_get_type_once (void);
static guint offline_page_offline_search_view_filter_real_get_criteria (SearchViewFilter* base);
static GType offline_page_offline_search_view_filter_get_type_once (void);
static void offline_page_finalize (GObject * obj);
static GType offline_page_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
offline_page_get_instance_private (OfflinePage* self)
{
	return G_STRUCT_MEMBER_P (self, OfflinePage_private_offset);
}

static void
_offline_page_on_offline_contents_altered_media_source_collection_offline_contents_altered (MediaSourceCollection* _sender,
                                                                                            GeeCollection* added,
                                                                                            GeeCollection* removed,
                                                                                            gpointer self)
{
	offline_page_on_offline_contents_altered ((OfflinePage*) self, added, removed);
}

OfflinePage*
offline_page_construct (GType object_type)
{
	OfflinePage * self = NULL;
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	MediaViewTracker* _tmp2_;
	LibraryPhotoSourceCollection* _tmp3_;
	VideoSourceCollection* _tmp4_;
	LibraryPhotoSourceCollection* _tmp5_;
	GeeCollection* _tmp6_;
	GeeCollection* _tmp7_;
	VideoSourceCollection* _tmp8_;
	GeeCollection* _tmp9_;
	GeeCollection* _tmp10_;
	self = (OfflinePage*) checkerboard_page_construct (object_type, OFFLINE_PAGE_NAME);
	_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_ = library_photo_global;
	g_signal_connect_object ((MediaSourceCollection*) _tmp3_, "offline-contents-altered", (GCallback) _offline_page_on_offline_contents_altered_media_source_collection_offline_contents_altered, self, 0);
	_tmp4_ = video_global;
	g_signal_connect_object ((MediaSourceCollection*) _tmp4_, "offline-contents-altered", (GCallback) _offline_page_on_offline_contents_altered_media_source_collection_offline_contents_altered, self, 0);
	_tmp5_ = library_photo_global;
	_tmp6_ = media_source_collection_get_offline_bin_contents ((MediaSourceCollection*) _tmp5_);
	_tmp7_ = _tmp6_;
	offline_page_on_offline_contents_altered (self, _tmp7_, NULL);
	_g_object_unref0 (_tmp7_);
	_tmp8_ = video_global;
	_tmp9_ = media_source_collection_get_offline_bin_contents ((MediaSourceCollection*) _tmp8_);
	_tmp10_ = _tmp9_;
	offline_page_on_offline_contents_altered (self, _tmp10_, NULL);
	_g_object_unref0 (_tmp10_);
	return self;
}

OfflinePage*
offline_page_new (void)
{
	return offline_page_construct (TYPE_OFFLINE_PAGE);
}

static Block20Data*
block20_data_ref (Block20Data* _data20_)
{
	g_atomic_int_inc (&_data20_->_ref_count_);
	return _data20_;
}

static void
block20_data_unref (void * _userdata_)
{
	Block20Data* _data20_;
	_data20_ = (Block20Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data20_->_ref_count_)) {
		OfflinePage* self;
		self = _data20_->self;
		_g_object_unref0 (_data20_->remove_action);
		_g_object_unref0 (self);
		g_slice_free (Block20Data, _data20_);
	}
}

static void
__lambda103_ (Block20Data* _data20_)
{
	OfflinePage* self;
	self = _data20_->self;
	gtk_action_activate (_data20_->remove_action);
}

static void
___lambda103__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda103_ (self);
}

static void
offline_page_real_add_toolbar_widgets (Page* base,
                                       GtkActionBar* toolbar)
{
	OfflinePage * self;
	Block20Data* _data20_;
	GtkButton* remove_button = NULL;
	GtkButton* _tmp0_;
	GtkToolItem* remove_tool = NULL;
	GtkToolItem* _tmp1_;
	GtkAction* _tmp2_;
	self = (OfflinePage*) base;
	g_return_if_fail (toolbar != NULL);
	_data20_ = g_slice_new0 (Block20Data);
	_data20_->_ref_count_ = 1;
	_data20_->self = g_object_ref (self);
	_tmp0_ = (GtkButton*) gtk_button_new_with_mnemonic (RESOURCES_REMOVE_FROM_LIBRARY_MENU);
	g_object_ref_sink (_tmp0_);
	remove_button = _tmp0_;
	gtk_widget_set_margin_end ((GtkWidget*) remove_button, 3);
	gtk_widget_set_margin_start ((GtkWidget*) remove_button, 3);
	gtk_widget_set_tooltip_text ((GtkWidget*) remove_button, RESOURCES_DELETE_FROM_LIBRARY_TOOLTIP);
	_tmp1_ = gtk_tool_item_new ();
	g_object_ref_sink (_tmp1_);
	remove_tool = _tmp1_;
	gtk_container_add ((GtkContainer*) remove_tool, (GtkWidget*) remove_button);
	gtk_action_bar_pack_start (toolbar, (GtkWidget*) remove_tool);
	_tmp2_ = page_get_action ((Page*) self, "RemoveFromLibrary");
	_data20_->remove_action = _tmp2_;
	g_object_bind_property_with_closures ((GObject*) _data20_->remove_action, "sensitive", (GObject*) remove_button, "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)));
	g_signal_connect_data (remove_button, "clicked", (GCallback) ___lambda103__gtk_button_clicked, block20_data_ref (_data20_), (GClosureNotify) block20_data_unref, 0);
	PAGE_CLASS (offline_page_parent_class)->add_toolbar_widgets ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), toolbar);
	_g_object_unref0 (remove_tool);
	_g_object_unref0 (remove_button);
	block20_data_unref (_data20_);
	_data20_ = NULL;
}

static Block21Data*
block21_data_ref (Block21Data* _data21_)
{
	g_atomic_int_inc (&_data21_->_ref_count_);
	return _data21_;
}

static void
block21_data_unref (void * _userdata_)
{
	Block21Data* _data21_;
	_data21_ = (Block21Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data21_->_ref_count_)) {
		OfflinePage* self;
		self = _data21_->self;
		_g_object_unref0 (_data21_->remove_action);
		_g_object_unref0 (self);
		g_slice_free (Block21Data, _data21_);
	}
}

static void
___lambda104_ (Block21Data* _data21_)
{
	OfflinePage* self;
	GtkAction* _tmp0_;
	self = _data21_->self;
	_tmp0_ = _data21_->remove_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda104__gtk_menu_item_activate (GtkMenuItem* _sender,
                                       gpointer self)
{
	___lambda104_ (self);
}

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

static GtkMenu*
offline_page_real_get_page_sidebar_menu (Page* base)
{
	OfflinePage * self;
	GtkMenu* _tmp0_;
	GtkMenu* _tmp10_;
	GtkMenu* _tmp11_;
	GtkMenu* result;
	self = (OfflinePage*) base;
	_tmp0_ = self->priv->page_sidebar_menu;
	if (_tmp0_ == NULL) {
		Block21Data* _data21_;
		GtkMenu* _tmp1_;
		GtkCheckMenuItem* remove_menu_item = NULL;
		GtkCheckMenuItem* _tmp2_;
		GtkAction* _tmp3_;
		GtkAction* _tmp4_;
		GtkCheckMenuItem* _tmp5_;
		GtkCheckMenuItem* _tmp6_;
		GtkMenu* _tmp7_;
		GtkCheckMenuItem* _tmp8_;
		GtkMenu* _tmp9_;
		_data21_ = g_slice_new0 (Block21Data);
		_data21_->_ref_count_ = 1;
		_data21_->self = g_object_ref (self);
		_tmp1_ = (GtkMenu*) gtk_menu_new ();
		g_object_ref_sink (_tmp1_);
		_g_object_unref0 (self->priv->page_sidebar_menu);
		self->priv->page_sidebar_menu = _tmp1_;
		_tmp2_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_mnemonic (RESOURCES_REMOVE_FROM_LIBRARY_MENU);
		g_object_ref_sink (_tmp2_);
		remove_menu_item = _tmp2_;
		_tmp3_ = page_get_action ((Page*) self, "RemoveFromLibrary");
		_data21_->remove_action = _tmp3_;
		_tmp4_ = _data21_->remove_action;
		_tmp5_ = remove_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp4_, "sensitive", (GObject*) _tmp5_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp6_ = remove_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp6_, "activate", (GCallback) ____lambda104__gtk_menu_item_activate, block21_data_ref (_data21_), (GClosureNotify) block21_data_unref, 0);
		_tmp7_ = self->priv->page_sidebar_menu;
		_tmp8_ = remove_menu_item;
		gtk_container_add ((GtkContainer*) _tmp7_, (GtkWidget*) _tmp8_);
		_tmp9_ = self->priv->page_sidebar_menu;
		gtk_widget_show_all ((GtkWidget*) _tmp9_);
		_g_object_unref0 (remove_menu_item);
		block21_data_unref (_data21_);
		_data21_ = NULL;
	}
	_tmp10_ = self->priv->page_sidebar_menu;
	_tmp11_ = _g_object_ref0 (_tmp10_);
	result = _tmp11_;
	return result;
}

static Block22Data*
block22_data_ref (Block22Data* _data22_)
{
	g_atomic_int_inc (&_data22_->_ref_count_);
	return _data22_;
}

static void
block22_data_unref (void * _userdata_)
{
	Block22Data* _data22_;
	_data22_ = (Block22Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data22_->_ref_count_)) {
		OfflinePage* self;
		self = _data22_->self;
		_g_object_unref0 (_data22_->select_action);
		_g_object_unref0 (_data22_->descending_action);
		_g_object_unref0 (_data22_->descending_menu_item);
		_g_object_unref0 (_data22_->ascending_action);
		_g_object_unref0 (_data22_->ascending_menu_item);
		_g_object_unref0 (self);
		g_slice_free (Block22Data, _data22_);
	}
}

static void
___lambda105_ (Block22Data* _data22_)
{
	OfflinePage* self;
	GtkRadioMenuItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data22_->self;
	_tmp0_ = _data22_->ascending_menu_item;
	_tmp1_ = gtk_check_menu_item_get_active ((GtkCheckMenuItem*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkAction* _tmp3_;
		_tmp3_ = _data22_->ascending_action;
		gtk_action_activate (_tmp3_);
	}
}

static void
____lambda105__gtk_menu_item_activate (GtkMenuItem* _sender,
                                       gpointer self)
{
	___lambda105_ (self);
}

static void
___lambda106_ (Block22Data* _data22_)
{
	OfflinePage* self;
	GtkRadioMenuItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data22_->self;
	_tmp0_ = _data22_->descending_menu_item;
	_tmp1_ = gtk_check_menu_item_get_active ((GtkCheckMenuItem*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkAction* _tmp3_;
		_tmp3_ = _data22_->descending_action;
		gtk_action_activate (_tmp3_);
	}
}

static void
____lambda106__gtk_menu_item_activate (GtkMenuItem* _sender,
                                       gpointer self)
{
	___lambda106_ (self);
}

static void
___lambda107_ (Block22Data* _data22_)
{
	OfflinePage* self;
	GAction* _tmp0_;
	self = _data22_->self;
	_tmp0_ = _data22_->select_action;
	g_action_activate (_tmp0_, NULL);
}

static void
____lambda107__gtk_menu_item_activate (GtkMenuItem* _sender,
                                       gpointer self)
{
	___lambda107_ (self);
}

static GtkMenu*
offline_page_real_get_page_context_menu (Page* base)
{
	OfflinePage * self;
	GtkMenu* _tmp0_;
	GtkMenu* _tmp38_;
	GtkMenu* _tmp39_;
	GtkMenu* result;
	self = (OfflinePage*) base;
	_tmp0_ = self->priv->page_context_menu;
	if (_tmp0_ == NULL) {
		Block22Data* _data22_;
		GtkMenu* _tmp1_;
		GtkMenuItem* sort_menu_item = NULL;
		GtkMenuItem* _tmp2_;
		GtkRadioMenuItem* _tmp3_;
		GtkAction* _tmp4_;
		GtkAction* _tmp5_;
		GtkRadioMenuItem* _tmp6_;
		GtkRadioMenuItem* _tmp7_;
		GtkRadioMenuItem* _tmp8_;
		GtkRadioMenuItem* _tmp9_;
		GtkAction* _tmp10_;
		GtkAction* _tmp11_;
		GtkRadioMenuItem* _tmp12_;
		GtkRadioMenuItem* _tmp13_;
		GtkMenu* sort_menu = NULL;
		GtkMenu* _tmp14_;
		GtkMenu* _tmp15_;
		GtkRadioMenuItem* _tmp16_;
		GtkMenu* _tmp17_;
		GtkRadioMenuItem* _tmp18_;
		GtkMenuItem* _tmp19_;
		GtkMenu* _tmp20_;
		GtkMenuItem* select_menu_item = NULL;
		GtkMenuItem* _tmp21_;
		AppWindow* _tmp22_;
		AppWindow* _tmp23_;
		GAction* _tmp24_;
		GAction* _tmp25_;
		GAction* _tmp26_;
		GAction* _tmp27_;
		GtkMenuItem* _tmp28_;
		GtkMenuItem* _tmp29_;
		GtkMenu* _tmp30_;
		GtkMenuItem* _tmp31_;
		GtkMenu* _tmp32_;
		GtkSeparatorMenuItem* _tmp33_;
		GtkSeparatorMenuItem* _tmp34_;
		GtkMenu* _tmp35_;
		GtkMenuItem* _tmp36_;
		GtkMenu* _tmp37_;
		_data22_ = g_slice_new0 (Block22Data);
		_data22_->_ref_count_ = 1;
		_data22_->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_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (_ ("Sort _Events"));
		g_object_ref_sink (_tmp2_);
		sort_menu_item = _tmp2_;
		_tmp3_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_mnemonic (NULL, _ ("_Ascending"));
		g_object_ref_sink (_tmp3_);
		_data22_->ascending_menu_item = _tmp3_;
		_tmp4_ = page_get_common_action ((Page*) self, "CommonSortEventsAscending", TRUE);
		_data22_->ascending_action = _tmp4_;
		_tmp5_ = _data22_->ascending_action;
		_tmp6_ = _data22_->ascending_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp5_, "active", (GObject*) _tmp6_, "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)));
		_tmp7_ = _data22_->ascending_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp7_, "activate", (GCallback) ____lambda105__gtk_menu_item_activate, block22_data_ref (_data22_), (GClosureNotify) block22_data_unref, 0);
		_tmp8_ = _data22_->ascending_menu_item;
		_tmp9_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_mnemonic_from_widget (_tmp8_, _ ("D_escending"));
		g_object_ref_sink (_tmp9_);
		_data22_->descending_menu_item = _tmp9_;
		_tmp10_ = page_get_common_action ((Page*) self, "CommonSortEventsDescending", TRUE);
		_data22_->descending_action = _tmp10_;
		_tmp11_ = _data22_->descending_action;
		_tmp12_ = _data22_->descending_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp11_, "active", (GObject*) _tmp12_, "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)));
		_tmp13_ = _data22_->descending_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp13_, "activate", (GCallback) ____lambda106__gtk_menu_item_activate, block22_data_ref (_data22_), (GClosureNotify) block22_data_unref, 0);
		_tmp14_ = (GtkMenu*) gtk_menu_new ();
		g_object_ref_sink (_tmp14_);
		sort_menu = _tmp14_;
		_tmp15_ = sort_menu;
		_tmp16_ = _data22_->ascending_menu_item;
		gtk_container_add ((GtkContainer*) _tmp15_, (GtkWidget*) _tmp16_);
		_tmp17_ = sort_menu;
		_tmp18_ = _data22_->descending_menu_item;
		gtk_container_add ((GtkContainer*) _tmp17_, (GtkWidget*) _tmp18_);
		_tmp19_ = sort_menu_item;
		_tmp20_ = sort_menu;
		gtk_menu_item_set_submenu (_tmp19_, _tmp20_);
		_tmp21_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_SELECT_ALL_MENU);
		g_object_ref_sink (_tmp21_);
		select_menu_item = _tmp21_;
		_tmp22_ = app_window_get_instance ();
		_tmp23_ = _tmp22_;
		_tmp24_ = g_action_map_lookup_action ((GActionMap*) _tmp23_, APP_WINDOW_ACTION_SELECT_ALL);
		_tmp25_ = _g_object_ref0 (_tmp24_);
		_tmp26_ = _tmp25_;
		_g_object_unref0 (_tmp23_);
		_data22_->select_action = _tmp26_;
		_tmp27_ = _data22_->select_action;
		_tmp28_ = select_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp27_, "enabled", (GObject*) _tmp28_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp29_ = select_menu_item;
		g_signal_connect_data (_tmp29_, "activate", (GCallback) ____lambda107__gtk_menu_item_activate, block22_data_ref (_data22_), (GClosureNotify) block22_data_unref, 0);
		_tmp30_ = self->priv->page_context_menu;
		_tmp31_ = sort_menu_item;
		gtk_container_add ((GtkContainer*) _tmp30_, (GtkWidget*) _tmp31_);
		_tmp32_ = self->priv->page_context_menu;
		_tmp33_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp33_);
		_tmp34_ = _tmp33_;
		gtk_container_add ((GtkContainer*) _tmp32_, (GtkWidget*) _tmp34_);
		_g_object_unref0 (_tmp34_);
		_tmp35_ = self->priv->page_context_menu;
		_tmp36_ = select_menu_item;
		gtk_container_add ((GtkContainer*) _tmp35_, (GtkWidget*) _tmp36_);
		_tmp37_ = self->priv->page_context_menu;
		gtk_widget_show_all ((GtkWidget*) _tmp37_);
		_g_object_unref0 (select_menu_item);
		_g_object_unref0 (sort_menu);
		_g_object_unref0 (sort_menu_item);
		block22_data_unref (_data22_);
		_data22_ = NULL;
	}
	_tmp38_ = self->priv->page_context_menu;
	_tmp39_ = _g_object_ref0 (_tmp38_);
	result = _tmp39_;
	return result;
}

static void
_offline_page_on_remove_from_library_gcallback (GtkAction* action,
                                                gpointer self)
{
	offline_page_on_remove_from_library ((OfflinePage*) self);
}

static void
_vala_array_add210 (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*
offline_page_real_init_collect_action_entries (Page* base,
                                               gint* result_length1)
{
	OfflinePage * self;
	GtkActionEntry* actions = NULL;
	gint _tmp0_ = 0;
	GtkActionEntry* _tmp1_;
	gint actions_length1;
	gint _actions_size_;
	GtkActionEntry remove = {0};
	GtkActionEntry _tmp2_ = {0};
	GtkActionEntry _tmp3_;
	GtkActionEntry* _tmp4_;
	gint _tmp4__length1;
	GtkActionEntry* result;
	self = (OfflinePage*) base;
	_tmp1_ = PAGE_CLASS (offline_page_parent_class)->init_collect_action_entries ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), &_tmp0_);
	actions = _tmp1_;
	actions_length1 = _tmp0_;
	_actions_size_ = actions_length1;
	_tmp2_.name = "RemoveFromLibrary";
	_tmp2_.stock_id = NULL;
	_tmp2_.label = RESOURCES_REMOVE_FROM_LIBRARY_MENU;
	_tmp2_.accelerator = "Delete";
	_tmp2_.tooltip = RESOURCES_DELETE_FROM_LIBRARY_TOOLTIP;
	_tmp2_.callback = (GCallback) _offline_page_on_remove_from_library_gcallback;
	remove = _tmp2_;
	_tmp3_ = remove;
	_vala_array_add210 (&actions, &actions_length1, &_actions_size_, &_tmp3_);
	_tmp4_ = actions;
	_tmp4__length1 = actions_length1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	return result;
}

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

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

static void
offline_page_real_update_actions (Page* base,
                                  gint selected_count,
                                  gint count)
{
	OfflinePage * self;
	self = (OfflinePage*) base;
	page_set_action_sensitive ((Page*) self, "RemoveFromLibrary", selected_count > 0);
	PAGE_CLASS (offline_page_parent_class)->update_actions ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), selected_count, count);
}

static void
offline_page_on_offline_contents_altered (OfflinePage* self,
                                          GeeCollection* added,
                                          GeeCollection* removed)
{
	g_return_if_fail (self != NULL);
	if (added != NULL) {
		{
			GeeIterator* _source_it = NULL;
			GeeIterator* _tmp0_;
			_tmp0_ = gee_iterable_iterator ((GeeIterable*) added);
			_source_it = _tmp0_;
			while (TRUE) {
				GeeIterator* _tmp1_;
				MediaSource* source = NULL;
				GeeIterator* _tmp2_;
				gpointer _tmp3_;
				ViewCollection* _tmp4_;
				ViewCollection* _tmp5_;
				MediaSource* _tmp6_;
				OfflinePageOfflineView* _tmp7_;
				OfflinePageOfflineView* _tmp8_;
				_tmp1_ = _source_it;
				if (!gee_iterator_next (_tmp1_)) {
					break;
				}
				_tmp2_ = _source_it;
				_tmp3_ = gee_iterator_get (_tmp2_);
				source = (MediaSource*) _tmp3_;
				_tmp4_ = page_get_view ((Page*) self);
				_tmp5_ = _tmp4_;
				_tmp6_ = source;
				_tmp7_ = offline_page_offline_view_new (_tmp6_);
				_tmp8_ = _tmp7_;
				data_collection_add ((DataCollection*) _tmp5_, (DataObject*) _tmp8_);
				_g_object_unref0 (_tmp8_);
				_data_collection_unref0 (_tmp5_);
				_g_object_unref0 (source);
			}
			_g_object_unref0 (_source_it);
		}
	}
	if (removed != NULL) {
		Marker* marker = NULL;
		ViewCollection* _tmp9_;
		ViewCollection* _tmp10_;
		Marker* _tmp11_;
		Marker* _tmp12_;
		ViewCollection* _tmp23_;
		ViewCollection* _tmp24_;
		Marker* _tmp25_;
		_tmp9_ = page_get_view ((Page*) self);
		_tmp10_ = _tmp9_;
		_tmp11_ = data_collection_start_marking ((DataCollection*) _tmp10_);
		_tmp12_ = _tmp11_;
		_data_collection_unref0 (_tmp10_);
		marker = _tmp12_;
		{
			GeeIterator* _source_it = NULL;
			GeeIterator* _tmp13_;
			_tmp13_ = gee_iterable_iterator ((GeeIterable*) removed);
			_source_it = _tmp13_;
			while (TRUE) {
				GeeIterator* _tmp14_;
				MediaSource* source = NULL;
				GeeIterator* _tmp15_;
				gpointer _tmp16_;
				Marker* _tmp17_;
				ViewCollection* _tmp18_;
				ViewCollection* _tmp19_;
				MediaSource* _tmp20_;
				DataView* _tmp21_;
				DataView* _tmp22_;
				_tmp14_ = _source_it;
				if (!gee_iterator_next (_tmp14_)) {
					break;
				}
				_tmp15_ = _source_it;
				_tmp16_ = gee_iterator_get (_tmp15_);
				source = (MediaSource*) _tmp16_;
				_tmp17_ = marker;
				_tmp18_ = page_get_view ((Page*) self);
				_tmp19_ = _tmp18_;
				_tmp20_ = source;
				_tmp21_ = view_collection_get_view_for_source (_tmp19_, (DataSource*) _tmp20_);
				_tmp22_ = _tmp21_;
				marker_mark (_tmp17_, (DataObject*) _tmp22_);
				_g_object_unref0 (_tmp22_);
				_data_collection_unref0 (_tmp19_);
				_g_object_unref0 (source);
			}
			_g_object_unref0 (_source_it);
		}
		_tmp23_ = page_get_view ((Page*) self);
		_tmp24_ = _tmp23_;
		_tmp25_ = marker;
		data_collection_remove_marked ((DataCollection*) _tmp24_, _tmp25_);
		_data_collection_unref0 (_tmp24_);
		_g_object_unref0 (marker);
	}
}

static gboolean
_progress_dialog_monitor_progress_monitor (guint64 current,
                                           guint64 total,
                                           gboolean do_event_loop,
                                           gpointer self)
{
	gboolean result;
	result = progress_dialog_monitor ((ProgressDialog*) self, current, total, do_event_loop);
	return result;
}

static void
offline_page_on_remove_from_library (OfflinePage* self)
{
	GeeCollection* sources = NULL;
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	GeeList* _tmp2_;
	GeeCollection* _tmp3_;
	GeeCollection* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	AppWindow* _tmp7_;
	AppWindow* _tmp8_;
	GeeCollection* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gboolean _tmp12_;
	AppWindow* _tmp13_;
	AppWindow* _tmp14_;
	ProgressDialog* progress = NULL;
	GeeCollection* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	GeeArrayList* photos = NULL;
	GeeArrayList* _tmp21_;
	GeeArrayList* videos = NULL;
	GeeArrayList* _tmp22_;
	GeeCollection* _tmp23_;
	GeeArrayList* _tmp24_;
	GeeArrayList* _tmp25_;
	ProgressDialog* _tmp26_;
	ProgressDialog* _tmp37_;
	AppWindow* _tmp39_;
	AppWindow* _tmp40_;
	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);
	_data_collection_unref0 (_tmp1_);
	sources = _tmp3_;
	_tmp4_ = sources;
	_tmp5_ = gee_collection_get_size (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_ == 0) {
		_g_object_unref0 (sources);
		return;
	}
	_tmp7_ = app_window_get_instance ();
	_tmp8_ = _tmp7_;
	_tmp9_ = sources;
	_tmp10_ = gee_collection_get_size (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = !remove_offline_dialog ((GtkWindow*) _tmp8_, _tmp11_);
	_g_object_unref0 (_tmp8_);
	if (_tmp12_) {
		_g_object_unref0 (sources);
		return;
	}
	_tmp13_ = app_window_get_instance ();
	_tmp14_ = _tmp13_;
	page_window_set_busy_cursor ((PageWindow*) _tmp14_);
	_g_object_unref0 (_tmp14_);
	progress = NULL;
	_tmp15_ = sources;
	_tmp16_ = gee_collection_get_size (_tmp15_);
	_tmp17_ = _tmp16_;
	if (_tmp17_ >= 20) {
		AppWindow* _tmp18_;
		AppWindow* _tmp19_;
		ProgressDialog* _tmp20_;
		_tmp18_ = app_window_get_instance ();
		_tmp19_ = _tmp18_;
		_tmp20_ = progress_dialog_new ((GtkWindow*) _tmp19_, _ ("Deleting…"), NULL);
		g_object_ref_sink (_tmp20_);
		_g_object_unref0 (progress);
		progress = _tmp20_;
		_g_object_unref0 (_tmp19_);
	}
	_tmp21_ = gee_array_list_new (TYPE_LIBRARY_PHOTO, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	photos = _tmp21_;
	_tmp22_ = gee_array_list_new (TYPE_VIDEO, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	videos = _tmp22_;
	_tmp23_ = sources;
	_tmp24_ = photos;
	_tmp25_ = videos;
	media_source_collection_filter_media (_tmp23_, (GeeCollection*) _tmp24_, (GeeCollection*) _tmp25_);
	_tmp26_ = progress;
	if (_tmp26_ != NULL) {
		LibraryPhotoSourceCollection* _tmp27_;
		GeeArrayList* _tmp28_;
		ProgressDialog* _tmp29_;
		VideoSourceCollection* _tmp30_;
		GeeArrayList* _tmp31_;
		ProgressDialog* _tmp32_;
		_tmp27_ = library_photo_global;
		_tmp28_ = photos;
		_tmp29_ = progress;
		media_source_collection_remove_from_app ((MediaSourceCollection*) _tmp27_, (GeeCollection*) _tmp28_, FALSE, _progress_dialog_monitor_progress_monitor, _tmp29_, NULL);
		_tmp30_ = video_global;
		_tmp31_ = videos;
		_tmp32_ = progress;
		media_source_collection_remove_from_app ((MediaSourceCollection*) _tmp30_, (GeeCollection*) _tmp31_, FALSE, _progress_dialog_monitor_progress_monitor, _tmp32_, NULL);
	} else {
		LibraryPhotoSourceCollection* _tmp33_;
		GeeArrayList* _tmp34_;
		VideoSourceCollection* _tmp35_;
		GeeArrayList* _tmp36_;
		_tmp33_ = library_photo_global;
		_tmp34_ = photos;
		media_source_collection_remove_from_app ((MediaSourceCollection*) _tmp33_, (GeeCollection*) _tmp34_, FALSE, NULL, NULL, NULL);
		_tmp35_ = video_global;
		_tmp36_ = videos;
		media_source_collection_remove_from_app ((MediaSourceCollection*) _tmp35_, (GeeCollection*) _tmp36_, FALSE, NULL, NULL, NULL);
	}
	_tmp37_ = progress;
	if (_tmp37_ != NULL) {
		ProgressDialog* _tmp38_;
		_tmp38_ = progress;
		progress_dialog_close (_tmp38_);
	}
	_tmp39_ = app_window_get_instance ();
	_tmp40_ = _tmp39_;
	page_window_set_normal_cursor ((PageWindow*) _tmp40_);
	_g_object_unref0 (_tmp40_);
	_g_object_unref0 (videos);
	_g_object_unref0 (photos);
	_g_object_unref0 (progress);
	_g_object_unref0 (sources);
}

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

static SearchViewFilter*
offline_page_real_get_search_view_filter (CheckerboardPage* base)
{
	OfflinePage * self;
	OfflinePageOfflineSearchViewFilter* _tmp0_;
	SearchViewFilter* _tmp1_;
	SearchViewFilter* result;
	self = (OfflinePage*) base;
	_tmp0_ = self->priv->search_filter;
	_tmp1_ = _view_filter_ref0 ((SearchViewFilter*) _tmp0_);
	result = _tmp1_;
	return result;
}

static OfflinePageOfflineView*
offline_page_offline_view_construct (GType object_type,
                                     MediaSource* source)
{
	OfflinePageOfflineView * self = NULL;
	gint _tmp0_;
	gint _tmp1_;
	g_return_val_if_fail (source != NULL, NULL);
	_tmp0_ = thumbnail_get_DEFAULT_SCALE ();
	_tmp1_ = _tmp0_;
	self = (OfflinePageOfflineView*) thumbnail_construct (object_type, source, _tmp1_);
	_vala_assert (media_source_is_offline (source), "source.is_offline ()");
	return self;
}

static OfflinePageOfflineView*
offline_page_offline_view_new (MediaSource* source)
{
	return offline_page_offline_view_construct (OFFLINE_PAGE_TYPE_OFFLINE_VIEW, source);
}

static void
offline_page_offline_view_class_init (OfflinePageOfflineViewClass * klass,
                                      gpointer klass_data)
{
	offline_page_offline_view_parent_class = g_type_class_peek_parent (klass);
}

static void
offline_page_offline_view_instance_init (OfflinePageOfflineView * self,
                                         gpointer klass)
{
}

static GType
offline_page_offline_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (OfflinePageOfflineViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) offline_page_offline_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (OfflinePageOfflineView), 0, (GInstanceInitFunc) offline_page_offline_view_instance_init, NULL };
	GType offline_page_offline_view_type_id;
	offline_page_offline_view_type_id = g_type_register_static (TYPE_THUMBNAIL, "OfflinePageOfflineView", &g_define_type_info, 0);
	return offline_page_offline_view_type_id;
}

static GType
offline_page_offline_view_get_type (void)
{
	static volatile gsize offline_page_offline_view_type_id__once = 0;
	if (g_once_init_enter (&offline_page_offline_view_type_id__once)) {
		GType offline_page_offline_view_type_id;
		offline_page_offline_view_type_id = offline_page_offline_view_get_type_once ();
		g_once_init_leave (&offline_page_offline_view_type_id__once, offline_page_offline_view_type_id);
	}
	return offline_page_offline_view_type_id__once;
}

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

static OfflinePageOfflineSearchViewFilter*
offline_page_offline_search_view_filter_construct (GType object_type)
{
	OfflinePageOfflineSearchViewFilter* self = NULL;
	self = (OfflinePageOfflineSearchViewFilter*) default_search_view_filter_construct (object_type);
	return self;
}

static OfflinePageOfflineSearchViewFilter*
offline_page_offline_search_view_filter_new (void)
{
	return offline_page_offline_search_view_filter_construct (OFFLINE_PAGE_TYPE_OFFLINE_SEARCH_VIEW_FILTER);
}

static void
offline_page_offline_search_view_filter_class_init (OfflinePageOfflineSearchViewFilterClass * klass,
                                                    gpointer klass_data)
{
	offline_page_offline_search_view_filter_parent_class = g_type_class_peek_parent (klass);
	((SearchViewFilterClass *) klass)->get_criteria = (guint (*) (SearchViewFilter*)) offline_page_offline_search_view_filter_real_get_criteria;
}

static void
offline_page_offline_search_view_filter_instance_init (OfflinePageOfflineSearchViewFilter * self,
                                                       gpointer klass)
{
}

static GType
offline_page_offline_search_view_filter_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (OfflinePageOfflineSearchViewFilterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) offline_page_offline_search_view_filter_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (OfflinePageOfflineSearchViewFilter), 0, (GInstanceInitFunc) offline_page_offline_search_view_filter_instance_init, NULL };
	GType offline_page_offline_search_view_filter_type_id;
	offline_page_offline_search_view_filter_type_id = g_type_register_static (TYPE_DEFAULT_SEARCH_VIEW_FILTER, "OfflinePageOfflineSearchViewFilter", &g_define_type_info, 0);
	return offline_page_offline_search_view_filter_type_id;
}

static GType
offline_page_offline_search_view_filter_get_type (void)
{
	static volatile gsize offline_page_offline_search_view_filter_type_id__once = 0;
	if (g_once_init_enter (&offline_page_offline_search_view_filter_type_id__once)) {
		GType offline_page_offline_search_view_filter_type_id;
		offline_page_offline_search_view_filter_type_id = offline_page_offline_search_view_filter_get_type_once ();
		g_once_init_leave (&offline_page_offline_search_view_filter_type_id__once, offline_page_offline_search_view_filter_type_id);
	}
	return offline_page_offline_search_view_filter_type_id__once;
}

static void
offline_page_class_init (OfflinePageClass * klass,
                         gpointer klass_data)
{
	offline_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &OfflinePage_private_offset);
	((PageClass *) klass)->add_toolbar_widgets = (void (*) (Page*, GtkActionBar*)) offline_page_real_add_toolbar_widgets;
	((PageClass *) klass)->get_page_sidebar_menu = (GtkMenu* (*) (Page*)) offline_page_real_get_page_sidebar_menu;
	((PageClass *) klass)->get_page_context_menu = (GtkMenu* (*) (Page*)) offline_page_real_get_page_context_menu;
	((PageClass *) klass)->init_collect_action_entries = (GtkActionEntry* (*) (Page*, gint*)) offline_page_real_init_collect_action_entries;
	((CheckerboardPageClass *) klass)->get_view_tracker = (CoreViewTracker* (*) (CheckerboardPage*)) offline_page_real_get_view_tracker;
	((PageClass *) klass)->update_actions = (void (*) (Page*, gint, gint)) offline_page_real_update_actions;
	((CheckerboardPageClass *) klass)->get_search_view_filter = (SearchViewFilter* (*) (CheckerboardPage*)) offline_page_real_get_search_view_filter;
	G_OBJECT_CLASS (klass)->finalize = offline_page_finalize;
}

static void
offline_page_instance_init (OfflinePage * self,
                            gpointer klass)
{
	OfflinePageOfflineSearchViewFilter* _tmp0_;
	self->priv = offline_page_get_instance_private (self);
	_tmp0_ = offline_page_offline_search_view_filter_new ();
	self->priv->search_filter = _tmp0_;
}

static void
offline_page_finalize (GObject * obj)
{
	OfflinePage * self;
	LibraryPhotoSourceCollection* _tmp0_;
	guint _tmp1_;
	VideoSourceCollection* _tmp2_;
	guint _tmp3_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_OFFLINE_PAGE, OfflinePage);
	_tmp0_ = library_photo_global;
	g_signal_parse_name ("offline-contents-altered", TYPE_MEDIA_SOURCE_COLLECTION, &_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((MediaSourceCollection*) _tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _offline_page_on_offline_contents_altered_media_source_collection_offline_contents_altered, self);
	_tmp2_ = video_global;
	g_signal_parse_name ("offline-contents-altered", TYPE_MEDIA_SOURCE_COLLECTION, &_tmp3_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((MediaSourceCollection*) _tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _offline_page_on_offline_contents_altered_media_source_collection_offline_contents_altered, self);
	_view_filter_unref0 (self->priv->search_filter);
	_core_tracker_unref0 (self->priv->tracker);
	_g_object_unref0 (self->priv->page_context_menu);
	_g_object_unref0 (self->priv->page_sidebar_menu);
	G_OBJECT_CLASS (offline_page_parent_class)->finalize (obj);
}

static GType
offline_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (OfflinePageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) offline_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (OfflinePage), 0, (GInstanceInitFunc) offline_page_instance_init, NULL };
	GType offline_page_type_id;
	offline_page_type_id = g_type_register_static (TYPE_CHECKERBOARD_PAGE, "OfflinePage", &g_define_type_info, 0);
	OfflinePage_private_offset = g_type_add_instance_private (offline_page_type_id, sizeof (OfflinePagePrivate));
	return offline_page_type_id;
}

GType
offline_page_get_type (void)
{
	static volatile gsize offline_page_type_id__once = 0;
	if (g_once_init_enter (&offline_page_type_id__once)) {
		GType offline_page_type_id;
		offline_page_type_id = offline_page_get_type_once ();
		g_once_init_leave (&offline_page_type_id__once, offline_page_type_id);
	}
	return offline_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;
}

