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

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

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

#define EVENTS_DIRECTORY_PAGE_MIN_PHOTOS_FOR_PROGRESS_WINDOW 50
#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 EVENTS_DIRECTORY_PAGE_TYPE_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER (events_directory_page_events_directory_search_view_filter_get_type ())
#define EVENTS_DIRECTORY_PAGE_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVENTS_DIRECTORY_PAGE_TYPE_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER, EventsDirectoryPageEventsDirectorySearchViewFilter))
#define EVENTS_DIRECTORY_PAGE_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVENTS_DIRECTORY_PAGE_TYPE_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER, EventsDirectoryPageEventsDirectorySearchViewFilterClass))
#define EVENTS_DIRECTORY_PAGE_IS_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVENTS_DIRECTORY_PAGE_TYPE_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER))
#define EVENTS_DIRECTORY_PAGE_IS_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EVENTS_DIRECTORY_PAGE_TYPE_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER))
#define EVENTS_DIRECTORY_PAGE_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EVENTS_DIRECTORY_PAGE_TYPE_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER, EventsDirectoryPageEventsDirectorySearchViewFilterClass))

typedef struct _EventsDirectoryPageEventsDirectorySearchViewFilter EventsDirectoryPageEventsDirectorySearchViewFilter;
typedef struct _EventsDirectoryPageEventsDirectorySearchViewFilterClass EventsDirectoryPageEventsDirectorySearchViewFilterClass;
enum  {
	EVENTS_DIRECTORY_PAGE_0_PROPERTY,
	EVENTS_DIRECTORY_PAGE_NUM_PROPERTIES
};
static GParamSpec* events_directory_page_properties[EVENTS_DIRECTORY_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _view_manager_unref0(var) ((var == NULL) ? NULL : (var = (view_manager_unref (var), NULL)))
#define _view_filter_unref0(var) ((var == NULL) ? NULL : (var = (view_filter_unref (var), NULL)))
#define _data_collection_unref0(var) ((var == NULL) ? NULL : (var = (data_collection_unref (var), NULL)))
#define _view_collection_monitor_unref0(var) ((var == NULL) ? NULL : (var = (view_collection_monitor_unref (var), NULL)))
typedef struct _Block14Data Block14Data;
typedef struct _Block15Data Block15Data;

#define TYPE_EVENT_DIRECTORY_ITEM (event_directory_item_get_type ())
#define EVENT_DIRECTORY_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EVENT_DIRECTORY_ITEM, EventDirectoryItem))
#define EVENT_DIRECTORY_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EVENT_DIRECTORY_ITEM, EventDirectoryItemClass))
#define IS_EVENT_DIRECTORY_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EVENT_DIRECTORY_ITEM))
#define IS_EVENT_DIRECTORY_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EVENT_DIRECTORY_ITEM))
#define EVENT_DIRECTORY_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EVENT_DIRECTORY_ITEM, EventDirectoryItemClass))

typedef struct _EventDirectoryItem EventDirectoryItem;
typedef struct _EventDirectoryItemClass EventDirectoryItemClass;
typedef struct _EventDirectoryItemPrivate EventDirectoryItemPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _text_entry_dialog_mediator_unref0(var) ((var == NULL) ? NULL : (var = (text_entry_dialog_mediator_unref (var), NULL)))
#define _command_manager_unref0(var) ((var == NULL) ? NULL : (var = (command_manager_unref (var), NULL)))
typedef struct _EventsDirectoryPageEventsDirectorySearchViewFilterPrivate EventsDirectoryPageEventsDirectorySearchViewFilterPrivate;
enum  {
	MASTER_EVENTS_DIRECTORY_PAGE_0_PROPERTY,
	MASTER_EVENTS_DIRECTORY_PAGE_NUM_PROPERTIES
};
static GParamSpec* master_events_directory_page_properties[MASTER_EVENTS_DIRECTORY_PAGE_NUM_PROPERTIES];
enum  {
	SUB_EVENTS_DIRECTORY_PAGE_0_PROPERTY,
	SUB_EVENTS_DIRECTORY_PAGE_NUM_PROPERTIES
};
static GParamSpec* sub_events_directory_page_properties[SUB_EVENTS_DIRECTORY_PAGE_NUM_PROPERTIES];

#define SUB_EVENTS_DIRECTORY_PAGE_TYPE_SUB_EVENT_DIRECTORY_MANAGER (sub_events_directory_page_sub_event_directory_manager_get_type ())
#define SUB_EVENTS_DIRECTORY_PAGE_SUB_EVENT_DIRECTORY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUB_EVENTS_DIRECTORY_PAGE_TYPE_SUB_EVENT_DIRECTORY_MANAGER, SubEventsDirectoryPageSubEventDirectoryManager))
#define SUB_EVENTS_DIRECTORY_PAGE_SUB_EVENT_DIRECTORY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SUB_EVENTS_DIRECTORY_PAGE_TYPE_SUB_EVENT_DIRECTORY_MANAGER, SubEventsDirectoryPageSubEventDirectoryManagerClass))
#define SUB_EVENTS_DIRECTORY_PAGE_IS_SUB_EVENT_DIRECTORY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUB_EVENTS_DIRECTORY_PAGE_TYPE_SUB_EVENT_DIRECTORY_MANAGER))
#define SUB_EVENTS_DIRECTORY_PAGE_IS_SUB_EVENT_DIRECTORY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SUB_EVENTS_DIRECTORY_PAGE_TYPE_SUB_EVENT_DIRECTORY_MANAGER))
#define SUB_EVENTS_DIRECTORY_PAGE_SUB_EVENT_DIRECTORY_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SUB_EVENTS_DIRECTORY_PAGE_TYPE_SUB_EVENT_DIRECTORY_MANAGER, SubEventsDirectoryPageSubEventDirectoryManagerClass))

typedef struct _SubEventsDirectoryPageSubEventDirectoryManager SubEventsDirectoryPageSubEventDirectoryManager;
typedef struct _SubEventsDirectoryPageSubEventDirectoryManagerClass SubEventsDirectoryPageSubEventDirectoryManagerClass;
typedef struct _SubEventsDirectoryPageSubEventDirectoryManagerPrivate SubEventsDirectoryPageSubEventDirectoryManagerPrivate;
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_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 _EventsDirectoryPagePrivate {
	EventsDirectoryPageEventsDirectorySearchViewFilter* search_filter;
	GtkMenu* page_context_menu;
	GtkMenu* item_context_menu;
};

struct _Block14Data {
	int _ref_count_;
	EventsDirectoryPage* self;
	GtkAction* merge_action;
	GtkAction* rename_action;
};

struct _Block15Data {
	int _ref_count_;
	EventsDirectoryPage* self;
	GtkRadioMenuItem* ascending_menu_item;
	GtkAction* ascending_action;
	GtkRadioMenuItem* descending_menu_item;
	GtkAction* descending_action;
	GAction* fullscreen_action;
	GAction* select_action;
};

struct _EventDirectoryItem {
	CheckerboardItem parent_instance;
	EventDirectoryItemPrivate * priv;
	Event* event;
};

struct _EventDirectoryItemClass {
	CheckerboardItemClass parent_class;
};

struct _EventsDirectoryPageEventsDirectorySearchViewFilter {
	SearchViewFilter parent_instance;
	EventsDirectoryPageEventsDirectorySearchViewFilterPrivate * priv;
};

struct _EventsDirectoryPageEventsDirectorySearchViewFilterClass {
	SearchViewFilterClass parent_class;
};

struct _SubEventsDirectoryPageSubEventDirectoryManager {
	EventsDirectoryPageEventDirectoryManager parent_instance;
	SubEventsDirectoryPageSubEventDirectoryManagerPrivate * priv;
};

struct _SubEventsDirectoryPageSubEventDirectoryManagerClass {
	EventsDirectoryPageEventDirectoryManagerClass parent_class;
};

struct _SubEventsDirectoryPageSubEventDirectoryManagerPrivate {
	gint month;
	gint year;
	SubEventsDirectoryPageDirectoryType type;
};

static gint EventsDirectoryPage_private_offset;
static gpointer events_directory_page_parent_class = NULL;
static gpointer events_directory_page_event_directory_manager_parent_class = NULL;
static gpointer events_directory_page_events_directory_search_view_filter_parent_class = NULL;
static gpointer master_events_directory_page_parent_class = NULL;
static gpointer sub_events_directory_page_parent_class = NULL;
static gint SubEventsDirectoryPageSubEventDirectoryManager_private_offset;
static gpointer sub_events_directory_page_sub_event_directory_manager_parent_class = NULL;

static GType events_directory_page_events_directory_search_view_filter_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static void events_directory_page_on_sort_changed (EventsDirectoryPage* self,
                                            GtkAction* action,
                                            GtkAction* c);
static void _events_directory_page_on_sort_changed_gtk_radio_action_changed (GtkRadioAction* _sender,
                                                                      GtkRadioAction* current,
                                                                      gpointer self);
static EventsDirectoryPageEventsDirectorySearchViewFilter* events_directory_page_events_directory_search_view_filter_new (void);
static EventsDirectoryPageEventsDirectorySearchViewFilter* events_directory_page_events_directory_search_view_filter_construct (GType object_type);
static Comparator events_directory_page_get_event_comparator (gboolean ascending,
                                                       gpointer* result_target,
                                                       GDestroyNotify* result_target_destroy_notify);
static gboolean _events_directory_page_event_comparator_predicate_comparator_predicate (DataObject* object,
                                                                                 Alteration* alteration,
                                                                                 gpointer self);
static GtkMenu* events_directory_page_real_get_item_context_menu (CheckerboardPage* base);
static Block14Data* block14_data_ref (Block14Data* _data14_);
static void block14_data_unref (void * _userdata_);
static void ___lambda56_ (Block14Data* _data14_);
static void ____lambda56__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda57_ (Block14Data* _data14_);
static void ____lambda57__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static GtkMenu* events_directory_page_real_get_page_context_menu (Page* base);
static Block15Data* block15_data_ref (Block15Data* _data15_);
static void block15_data_unref (void * _userdata_);
static void ___lambda58_ (Block15Data* _data15_);
static void ____lambda58__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda59_ (Block15Data* _data15_);
static void ____lambda59__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda60_ (Block15Data* _data15_);
static void ____lambda60__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static void ___lambda61_ (Block15Data* _data15_);
static void ____lambda61__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static gint64 events_directory_page_event_ascending_comparator (void* a,
                                                         void* b);
VALA_EXTERN GType event_directory_item_get_type (void) G_GNUC_CONST ;
static gint64 events_directory_page_event_descending_comparator (void* a,
                                                          void* b);
static gint64 _events_directory_page_event_ascending_comparator_comparator (void* a,
                                                                     void* b,
                                                                     gpointer self);
static gint64 _events_directory_page_event_descending_comparator_comparator (void* a,
                                                                      void* b,
                                                                      gpointer self);
static GtkActionEntry* events_directory_page_real_init_collect_action_entries (Page* base,
                                                                        gint* result_length1);
static void events_directory_page_on_rename (EventsDirectoryPage* self);
static void _events_directory_page_on_rename_gcallback (GtkAction* action,
                                                 gpointer self);
static void _vala_array_add150 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static void events_directory_page_on_merge (EventsDirectoryPage* self);
static void _events_directory_page_on_merge_gcallback (GtkAction* action,
                                                gpointer self);
static void _vala_array_add151 (GtkActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkActionEntry* value);
static GtkToggleActionEntry* events_directory_page_real_init_collect_toggle_action_entries (Page* base,
                                                                                     gint* result_length1);
static void events_directory_page_on_display_comments (EventsDirectoryPage* self,
                                                GtkAction* action);
static void _events_directory_page_on_display_comments_gcallback (GtkAction* action,
                                                           gpointer self);
static void _vala_array_add152 (GtkToggleActionEntry* * array,
                         gint* length,
                         gint* size,
                         const GtkToggleActionEntry* value);
static void events_directory_page_real_init_actions (Page* base,
                                              gint selected_count,
                                              gint count);
static void events_directory_page_real_update_actions (Page* base,
                                                gint selected_count,
                                                gint count);
static gchar* events_directory_page_real_get_view_empty_message (CheckerboardPage* base);
static gchar* events_directory_page_real_get_filter_no_match_message (CheckerboardPage* base);
static void events_directory_page_real_on_item_activated (CheckerboardPage* base,
                                                   CheckerboardItem* item);
static void events_directory_page_on_show_sidebar (EventsDirectoryPage* self);
static SearchViewFilter* events_directory_page_real_get_search_view_filter (CheckerboardPage* base);
static DataView* events_directory_page_event_directory_manager_real_create_view (ViewManager* base,
                                                                          DataSource* source);
VALA_EXTERN EventDirectoryItem* event_directory_item_new (Event* event);
VALA_EXTERN EventDirectoryItem* event_directory_item_construct (GType object_type,
                                                    Event* event);
static GType events_directory_page_event_directory_manager_get_type_once (void);
static guint events_directory_page_events_directory_search_view_filter_real_get_criteria (SearchViewFilter* base);
static gboolean events_directory_page_events_directory_search_view_filter_real_predicate (ViewFilter* base,
                                                                                   DataView* view);
static GType events_directory_page_events_directory_search_view_filter_get_type_once (void);
static GObject * events_directory_page_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void _events_directory_page_on_show_sidebar_gtk_button_clicked (GtkButton* _sender,
                                                                gpointer self);
static void events_directory_page_finalize (GObject * obj);
static GType events_directory_page_get_type_once (void);
static GType master_events_directory_page_get_type_once (void);
static SubEventsDirectoryPageSubEventDirectoryManager* sub_events_directory_page_sub_event_directory_manager_new (SubEventsDirectoryPageDirectoryType type,
                                                                                                           GDateTime* time);
static SubEventsDirectoryPageSubEventDirectoryManager* sub_events_directory_page_sub_event_directory_manager_construct (GType object_type,
                                                                                                                 SubEventsDirectoryPageDirectoryType type,
                                                                                                                 GDateTime* time);
static GType sub_events_directory_page_sub_event_directory_manager_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static gint sub_events_directory_page_sub_event_directory_manager_get_month (SubEventsDirectoryPageSubEventDirectoryManager* self);
static gint sub_events_directory_page_sub_event_directory_manager_get_year (SubEventsDirectoryPageSubEventDirectoryManager* self);
static SubEventsDirectoryPageDirectoryType sub_events_directory_page_sub_event_directory_manager_get_event_directory_type (SubEventsDirectoryPageSubEventDirectoryManager* self);
static gboolean sub_events_directory_page_sub_event_directory_manager_real_include_in_view (ViewManager* base,
                                                                                     DataSource* source);
static void sub_events_directory_page_sub_event_directory_manager_finalize (ViewManager * obj);
static GType sub_events_directory_page_sub_event_directory_manager_get_type_once (void);
static GType sub_events_directory_page_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
events_directory_page_get_instance_private (EventsDirectoryPage* self)
{
	return G_STRUCT_MEMBER_P (self, EventsDirectoryPage_private_offset);
}

static void
_events_directory_page_on_sort_changed_gtk_radio_action_changed (GtkRadioAction* _sender,
                                                                 GtkRadioAction* current,
                                                                 gpointer self)
{
	events_directory_page_on_sort_changed ((EventsDirectoryPage*) self, _sender, current);
}

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

static gpointer
_view_manager_ref0 (gpointer self)
{
	return self ? view_manager_ref (self) : NULL;
}

EventsDirectoryPage*
events_directory_page_construct (GType object_type,
                                 const gchar* page_name,
                                 ViewManager* view_manager,
                                 GeeCollection* initial_events)
{
	EventsDirectoryPage * self = NULL;
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	GSettings* _tmp2_;
	gpointer _tmp3_ = NULL;
	GDestroyNotify _tmp4_ = NULL;
	Comparator _tmp5_;
	Comparator _tmp6_;
	gpointer _tmp6__target;
	GDestroyNotify _tmp6__target_destroy_notify;
	ViewCollection* _tmp7_;
	ViewCollection* _tmp8_;
	EventSourceCollection* _tmp9_;
	ViewCollectionMonitor* _tmp10_;
	ViewCollectionMonitor* _tmp11_;
	ViewCollection* _tmp12_;
	ViewCollection* _tmp13_;
	GSettings* _tmp14_;
	GValue _tmp15_ = {0};
	ViewManager* _tmp16_;
	LibraryWindow* app = NULL;
	AppWindow* _tmp17_;
	LibraryWindow* _tmp18_;
	g_return_val_if_fail (page_name != NULL, NULL);
	g_return_val_if_fail (view_manager != NULL, NULL);
	self = (EventsDirectoryPage*) checkerboard_page_construct (object_type, page_name);
	_tmp0_ = page_get_view ((Page*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = ((Page*) self)->ui_settings;
	_tmp5_ = events_directory_page_get_event_comparator (g_settings_get_boolean (_tmp2_, "events-sort-ascending"), &_tmp3_, &_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp6__target = _tmp3_;
	_tmp6__target_destroy_notify = _tmp4_;
	data_collection_set_comparator ((DataCollection*) _tmp1_, _tmp6_, _tmp3_, _events_directory_page_event_comparator_predicate_comparator_predicate, NULL);
	(_tmp6__target_destroy_notify == NULL) ? NULL : (_tmp6__target_destroy_notify (_tmp6__target), NULL);
	_tmp6_ = NULL;
	_tmp6__target = NULL;
	_tmp6__target_destroy_notify = NULL;
	_data_collection_unref0 (_tmp1_);
	_tmp7_ = page_get_view ((Page*) self);
	_tmp8_ = _tmp7_;
	_tmp9_ = event_global;
	_tmp10_ = view_collection_monitor_source_collection (_tmp8_, (SourceCollection*) _tmp9_, view_manager, NULL, initial_events, NULL, NULL);
	_tmp11_ = _tmp10_;
	_view_collection_monitor_unref0 (_tmp11_);
	_data_collection_unref0 (_tmp8_);
	_tmp12_ = page_get_view ((Page*) self);
	_tmp13_ = _tmp12_;
	_tmp14_ = ((Page*) self)->ui_settings;
	g_value_init (&_tmp15_, G_TYPE_BOOLEAN);
	g_value_set_boolean (&_tmp15_, g_settings_get_boolean (_tmp14_, "display-event-comments"));
	data_collection_set_property ((DataCollection*) _tmp13_, EVENT_PROP_SHOW_COMMENTS, &_tmp15_, NULL, NULL);
	G_IS_VALUE (&_tmp15_) ? (g_value_unset (&_tmp15_), NULL) : NULL;
	_data_collection_unref0 (_tmp13_);
	_tmp16_ = _view_manager_ref0 (view_manager);
	_view_manager_unref0 (self->view_manager);
	self->view_manager = _tmp16_;
	_tmp17_ = app_window_get_instance ();
	_tmp18_ = IS_LIBRARY_WINDOW (_tmp17_) ? ((LibraryWindow*) _tmp17_) : NULL;
	if (_tmp18_ == NULL) {
		_g_object_unref0 (_tmp17_);
	}
	app = _tmp18_;
	page_update_sidebar_action ((Page*) self, !library_window_is_metadata_sidebar_visible (app));
	_g_object_unref0 (app);
	return self;
}

static Block14Data*
block14_data_ref (Block14Data* _data14_)
{
	g_atomic_int_inc (&_data14_->_ref_count_);
	return _data14_;
}

static void
block14_data_unref (void * _userdata_)
{
	Block14Data* _data14_;
	_data14_ = (Block14Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data14_->_ref_count_)) {
		EventsDirectoryPage* self;
		self = _data14_->self;
		_g_object_unref0 (_data14_->rename_action);
		_g_object_unref0 (_data14_->merge_action);
		_g_object_unref0 (self);
		g_slice_free (Block14Data, _data14_);
	}
}

static void
___lambda56_ (Block14Data* _data14_)
{
	EventsDirectoryPage* self;
	GtkAction* _tmp0_;
	self = _data14_->self;
	_tmp0_ = _data14_->merge_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda56__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda56_ (self);
}

static void
___lambda57_ (Block14Data* _data14_)
{
	EventsDirectoryPage* self;
	GtkAction* _tmp0_;
	self = _data14_->self;
	_tmp0_ = _data14_->rename_action;
	gtk_action_activate (_tmp0_);
}

static void
____lambda57__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda57_ (self);
}

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

static GtkMenu*
events_directory_page_real_get_item_context_menu (CheckerboardPage* base)
{
	EventsDirectoryPage * self;
	GtkMenu* _tmp0_;
	GtkMenu* _tmp17_;
	GtkMenu* _tmp18_;
	GtkMenu* result;
	self = (EventsDirectoryPage*) base;
	_tmp0_ = self->priv->item_context_menu;
	if (_tmp0_ == NULL) {
		Block14Data* _data14_;
		GtkMenu* _tmp1_;
		GtkMenuItem* merge_menu_item = NULL;
		GtkMenuItem* _tmp2_;
		GtkAction* _tmp3_;
		GtkAction* _tmp4_;
		GtkMenuItem* _tmp5_;
		GtkMenuItem* _tmp6_;
		GtkMenuItem* rename_menu_item = NULL;
		GtkMenuItem* _tmp7_;
		GtkAction* _tmp8_;
		GtkAction* _tmp9_;
		GtkMenuItem* _tmp10_;
		GtkMenuItem* _tmp11_;
		GtkMenu* _tmp12_;
		GtkMenuItem* _tmp13_;
		GtkMenu* _tmp14_;
		GtkMenuItem* _tmp15_;
		GtkMenu* _tmp16_;
		_data14_ = g_slice_new0 (Block14Data);
		_data14_->_ref_count_ = 1;
		_data14_->self = g_object_ref (self);
		_tmp1_ = (GtkMenu*) gtk_menu_new ();
		g_object_ref_sink (_tmp1_);
		_g_object_unref0 (self->priv->item_context_menu);
		self->priv->item_context_menu = _tmp1_;
		_tmp2_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_MERGE_MENU);
		g_object_ref_sink (_tmp2_);
		merge_menu_item = _tmp2_;
		_tmp3_ = page_get_action ((Page*) self, "Merge");
		_data14_->merge_action = _tmp3_;
		_tmp4_ = _data14_->merge_action;
		_tmp5_ = merge_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_ = merge_menu_item;
		g_signal_connect_data (_tmp6_, "activate", (GCallback) ____lambda56__gtk_menu_item_activate, block14_data_ref (_data14_), (GClosureNotify) block14_data_unref, 0);
		_tmp7_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_RENAME_EVENT_MENU);
		g_object_ref_sink (_tmp7_);
		rename_menu_item = _tmp7_;
		_tmp8_ = page_get_action ((Page*) self, "Rename");
		_data14_->rename_action = _tmp8_;
		_tmp9_ = _data14_->rename_action;
		_tmp10_ = rename_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp9_, "sensitive", (GObject*) _tmp10_, "sensitive", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
		_tmp11_ = rename_menu_item;
		g_signal_connect_data (_tmp11_, "activate", (GCallback) ____lambda57__gtk_menu_item_activate, block14_data_ref (_data14_), (GClosureNotify) block14_data_unref, 0);
		_tmp12_ = self->priv->item_context_menu;
		_tmp13_ = merge_menu_item;
		gtk_container_add ((GtkContainer*) _tmp12_, (GtkWidget*) _tmp13_);
		_tmp14_ = self->priv->item_context_menu;
		_tmp15_ = rename_menu_item;
		gtk_container_add ((GtkContainer*) _tmp14_, (GtkWidget*) _tmp15_);
		_tmp16_ = self->priv->item_context_menu;
		gtk_widget_show_all ((GtkWidget*) _tmp16_);
		_g_object_unref0 (rename_menu_item);
		_g_object_unref0 (merge_menu_item);
		block14_data_unref (_data14_);
		_data14_ = NULL;
	}
	_tmp17_ = self->priv->item_context_menu;
	_tmp18_ = _g_object_ref0 (_tmp17_);
	result = _tmp18_;
	return result;
}

static Block15Data*
block15_data_ref (Block15Data* _data15_)
{
	g_atomic_int_inc (&_data15_->_ref_count_);
	return _data15_;
}

static void
block15_data_unref (void * _userdata_)
{
	Block15Data* _data15_;
	_data15_ = (Block15Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data15_->_ref_count_)) {
		EventsDirectoryPage* self;
		self = _data15_->self;
		_g_object_unref0 (_data15_->select_action);
		_g_object_unref0 (_data15_->fullscreen_action);
		_g_object_unref0 (_data15_->descending_action);
		_g_object_unref0 (_data15_->descending_menu_item);
		_g_object_unref0 (_data15_->ascending_action);
		_g_object_unref0 (_data15_->ascending_menu_item);
		_g_object_unref0 (self);
		g_slice_free (Block15Data, _data15_);
	}
}

static void
___lambda58_ (Block15Data* _data15_)
{
	EventsDirectoryPage* self;
	GtkRadioMenuItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data15_->self;
	_tmp0_ = _data15_->ascending_menu_item;
	_tmp1_ = gtk_check_menu_item_get_active ((GtkCheckMenuItem*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkAction* _tmp3_;
		_tmp3_ = _data15_->ascending_action;
		gtk_action_activate (_tmp3_);
	}
}

static void
____lambda58__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda58_ (self);
}

static void
___lambda59_ (Block15Data* _data15_)
{
	EventsDirectoryPage* self;
	GtkRadioMenuItem* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data15_->self;
	_tmp0_ = _data15_->descending_menu_item;
	_tmp1_ = gtk_check_menu_item_get_active ((GtkCheckMenuItem*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		GtkAction* _tmp3_;
		_tmp3_ = _data15_->descending_action;
		gtk_action_activate (_tmp3_);
	}
}

static void
____lambda59__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda59_ (self);
}

static void
___lambda60_ (Block15Data* _data15_)
{
	EventsDirectoryPage* self;
	GAction* _tmp0_;
	self = _data15_->self;
	_tmp0_ = _data15_->fullscreen_action;
	g_action_activate (_tmp0_, NULL);
}

static void
____lambda60__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda60_ (self);
}

static void
___lambda61_ (Block15Data* _data15_)
{
	EventsDirectoryPage* self;
	GAction* _tmp0_;
	self = _data15_->self;
	_tmp0_ = _data15_->select_action;
	g_action_activate (_tmp0_, NULL);
}

static void
____lambda61__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda61_ (self);
}

static GtkMenu*
events_directory_page_real_get_page_context_menu (Page* base)
{
	EventsDirectoryPage * self;
	GtkMenu* _tmp0_;
	GtkMenu* _tmp52_;
	GtkMenu* _tmp53_;
	GtkMenu* result;
	self = (EventsDirectoryPage*) base;
	_tmp0_ = self->priv->page_context_menu;
	if (_tmp0_ == NULL) {
		Block15Data* _data15_;
		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* fullscreen_menu_item = NULL;
		GtkMenuItem* _tmp21_;
		AppWindow* _tmp22_;
		AppWindow* _tmp23_;
		GAction* _tmp24_;
		GAction* _tmp25_;
		GAction* _tmp26_;
		GAction* _tmp27_;
		GtkMenuItem* _tmp28_;
		GtkMenuItem* _tmp29_;
		GtkMenuItem* select_menu_item = NULL;
		GtkMenuItem* _tmp30_;
		AppWindow* _tmp31_;
		AppWindow* _tmp32_;
		GAction* _tmp33_;
		GAction* _tmp34_;
		GAction* _tmp35_;
		GAction* _tmp36_;
		GtkMenuItem* _tmp37_;
		GtkMenuItem* _tmp38_;
		GtkMenu* _tmp39_;
		GtkMenuItem* _tmp40_;
		GtkMenu* _tmp41_;
		GtkSeparatorMenuItem* _tmp42_;
		GtkSeparatorMenuItem* _tmp43_;
		GtkMenu* _tmp44_;
		GtkMenuItem* _tmp45_;
		GtkMenu* _tmp46_;
		GtkSeparatorMenuItem* _tmp47_;
		GtkSeparatorMenuItem* _tmp48_;
		GtkMenu* _tmp49_;
		GtkMenuItem* _tmp50_;
		GtkMenu* _tmp51_;
		_data15_ = g_slice_new0 (Block15Data);
		_data15_->_ref_count_ = 1;
		_data15_->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_);
		_data15_->ascending_menu_item = _tmp3_;
		_tmp4_ = page_get_common_action ((Page*) self, "CommonSortEventsAscending", TRUE);
		_data15_->ascending_action = _tmp4_;
		_tmp5_ = _data15_->ascending_action;
		_tmp6_ = _data15_->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_ = _data15_->ascending_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp7_, "activate", (GCallback) ____lambda58__gtk_menu_item_activate, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
		_tmp8_ = _data15_->ascending_menu_item;
		_tmp9_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_mnemonic_from_widget (_tmp8_, _ ("D_escending"));
		g_object_ref_sink (_tmp9_);
		_data15_->descending_menu_item = _tmp9_;
		_tmp10_ = page_get_common_action ((Page*) self, "CommonSortEventsDescending", TRUE);
		_data15_->descending_action = _tmp10_;
		_tmp11_ = _data15_->descending_action;
		_tmp12_ = _data15_->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_ = _data15_->descending_menu_item;
		g_signal_connect_data ((GtkMenuItem*) _tmp13_, "activate", (GCallback) ____lambda59__gtk_menu_item_activate, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
		_tmp14_ = (GtkMenu*) gtk_menu_new ();
		g_object_ref_sink (_tmp14_);
		sort_menu = _tmp14_;
		_tmp15_ = sort_menu;
		_tmp16_ = _data15_->ascending_menu_item;
		gtk_container_add ((GtkContainer*) _tmp15_, (GtkWidget*) _tmp16_);
		_tmp17_ = sort_menu;
		_tmp18_ = _data15_->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 (_ ("Fulls_creen"));
		g_object_ref_sink (_tmp21_);
		fullscreen_menu_item = _tmp21_;
		_tmp22_ = app_window_get_instance ();
		_tmp23_ = _tmp22_;
		_tmp24_ = g_action_map_lookup_action ((GActionMap*) _tmp23_, APP_WINDOW_ACTION_FULLSCREEN);
		_tmp25_ = _g_object_ref0 (_tmp24_);
		_tmp26_ = _tmp25_;
		_g_object_unref0 (_tmp23_);
		_data15_->fullscreen_action = _tmp26_;
		_tmp27_ = _data15_->fullscreen_action;
		_tmp28_ = fullscreen_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_ = fullscreen_menu_item;
		g_signal_connect_data (_tmp29_, "activate", (GCallback) ____lambda60__gtk_menu_item_activate, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
		_tmp30_ = (GtkMenuItem*) gtk_menu_item_new_with_mnemonic (RESOURCES_SELECT_ALL_MENU);
		g_object_ref_sink (_tmp30_);
		select_menu_item = _tmp30_;
		_tmp31_ = app_window_get_instance ();
		_tmp32_ = _tmp31_;
		_tmp33_ = g_action_map_lookup_action ((GActionMap*) _tmp32_, APP_WINDOW_ACTION_SELECT_ALL);
		_tmp34_ = _g_object_ref0 (_tmp33_);
		_tmp35_ = _tmp34_;
		_g_object_unref0 (_tmp32_);
		_data15_->select_action = _tmp35_;
		_tmp36_ = _data15_->select_action;
		_tmp37_ = select_menu_item;
		g_object_bind_property_with_closures ((GObject*) _tmp36_, "enabled", (GObject*) _tmp37_, "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)));
		_tmp38_ = select_menu_item;
		g_signal_connect_data (_tmp38_, "activate", (GCallback) ____lambda61__gtk_menu_item_activate, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
		_tmp39_ = self->priv->page_context_menu;
		_tmp40_ = sort_menu_item;
		gtk_container_add ((GtkContainer*) _tmp39_, (GtkWidget*) _tmp40_);
		_tmp41_ = self->priv->page_context_menu;
		_tmp42_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp42_);
		_tmp43_ = _tmp42_;
		gtk_container_add ((GtkContainer*) _tmp41_, (GtkWidget*) _tmp43_);
		_g_object_unref0 (_tmp43_);
		_tmp44_ = self->priv->page_context_menu;
		_tmp45_ = fullscreen_menu_item;
		gtk_container_add ((GtkContainer*) _tmp44_, (GtkWidget*) _tmp45_);
		_tmp46_ = self->priv->page_context_menu;
		_tmp47_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp47_);
		_tmp48_ = _tmp47_;
		gtk_container_add ((GtkContainer*) _tmp46_, (GtkWidget*) _tmp48_);
		_g_object_unref0 (_tmp48_);
		_tmp49_ = self->priv->page_context_menu;
		_tmp50_ = select_menu_item;
		gtk_container_add ((GtkContainer*) _tmp49_, (GtkWidget*) _tmp50_);
		_tmp51_ = self->priv->page_context_menu;
		gtk_widget_show_all ((GtkWidget*) _tmp51_);
		_g_object_unref0 (select_menu_item);
		_g_object_unref0 (fullscreen_menu_item);
		_g_object_unref0 (sort_menu);
		_g_object_unref0 (sort_menu_item);
		block15_data_unref (_data15_);
		_data15_ = NULL;
	}
	_tmp52_ = self->priv->page_context_menu;
	_tmp53_ = _g_object_ref0 (_tmp52_);
	result = _tmp53_;
	return result;
}

gboolean
events_directory_page_event_comparator_predicate (DataObject* object,
                                                  Alteration* alteration)
{
	gboolean result;
	g_return_val_if_fail (object != NULL, FALSE);
	g_return_val_if_fail (alteration != NULL, FALSE);
	result = alteration_has_detail (alteration, "metadata", "time");
	return result;
}

static gint64
events_directory_page_event_ascending_comparator (void* a,
                                                  void* b)
{
	gint64 start_a = 0LL;
	Event* _tmp0_;
	gint64 start_b = 0LL;
	Event* _tmp1_;
	gint64 result;
	_tmp0_ = ((EventDirectoryItem*) a)->event;
	start_a = event_source_get_start_time ((EventSource*) _tmp0_);
	_tmp1_ = ((EventDirectoryItem*) b)->event;
	start_b = event_source_get_start_time ((EventSource*) _tmp1_);
	result = start_a - start_b;
	return result;
}

static gint64
events_directory_page_event_descending_comparator (void* a,
                                                   void* b)
{
	gint64 result;
	result = events_directory_page_event_ascending_comparator (b, a);
	return result;
}

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

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

static Comparator
events_directory_page_get_event_comparator (gboolean ascending,
                                            gpointer* result_target,
                                            GDestroyNotify* result_target_destroy_notify)
{
	Comparator result;
	if (ascending) {
		Comparator _tmp0_;
		gpointer _tmp0__target;
		GDestroyNotify _tmp0__target_destroy_notify;
		_tmp0_ = _events_directory_page_event_ascending_comparator_comparator;
		_tmp0__target = NULL;
		_tmp0__target_destroy_notify = NULL;
		*result_target = _tmp0__target;
		*result_target_destroy_notify = _tmp0__target_destroy_notify;
		result = _tmp0_;
		return result;
	} else {
		Comparator _tmp1_;
		gpointer _tmp1__target;
		GDestroyNotify _tmp1__target_destroy_notify;
		_tmp1_ = _events_directory_page_event_descending_comparator_comparator;
		_tmp1__target = NULL;
		_tmp1__target_destroy_notify = NULL;
		*result_target = _tmp1__target;
		*result_target_destroy_notify = _tmp1__target_destroy_notify;
		result = _tmp1_;
		return result;
	}
}

static void
_events_directory_page_on_rename_gcallback (GtkAction* action,
                                            gpointer self)
{
	events_directory_page_on_rename ((EventsDirectoryPage*) self);
}

static void
_vala_array_add150 (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
_events_directory_page_on_merge_gcallback (GtkAction* action,
                                           gpointer self)
{
	events_directory_page_on_merge ((EventsDirectoryPage*) self);
}

static void
_vala_array_add151 (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*
events_directory_page_real_init_collect_action_entries (Page* base,
                                                        gint* result_length1)
{
	EventsDirectoryPage * self;
	GtkActionEntry* actions = NULL;
	gint _tmp0_ = 0;
	GtkActionEntry* _tmp1_;
	gint actions_length1;
	gint _actions_size_;
	GtkActionEntry rename = {0};
	GtkActionEntry _tmp2_ = {0};
	GtkActionEntry _tmp3_;
	GtkActionEntry merge = {0};
	GtkActionEntry _tmp4_ = {0};
	GtkActionEntry _tmp5_;
	GtkActionEntry* _tmp6_;
	gint _tmp6__length1;
	GtkActionEntry* result;
	self = (EventsDirectoryPage*) base;
	_tmp1_ = PAGE_CLASS (events_directory_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 = "Rename";
	_tmp2_.stock_id = NULL;
	_tmp2_.label = RESOURCES_RENAME_EVENT_MENU;
	_tmp2_.accelerator = "F2";
	_tmp2_.tooltip = RESOURCES_RENAME_EVENT_MENU;
	_tmp2_.callback = (GCallback) _events_directory_page_on_rename_gcallback;
	rename = _tmp2_;
	_tmp3_ = rename;
	_vala_array_add150 (&actions, &actions_length1, &_actions_size_, &_tmp3_);
	_tmp4_.name = "Merge";
	_tmp4_.stock_id = RESOURCES_MERGE;
	_tmp4_.label = RESOURCES_MERGE_MENU;
	_tmp4_.accelerator = NULL;
	_tmp4_.tooltip = RESOURCES_MERGE_TOOLTIP;
	_tmp4_.callback = (GCallback) _events_directory_page_on_merge_gcallback;
	merge = _tmp4_;
	_tmp5_ = merge;
	_vala_array_add151 (&actions, &actions_length1, &_actions_size_, &_tmp5_);
	_tmp6_ = actions;
	_tmp6__length1 = actions_length1;
	if (result_length1) {
		*result_length1 = _tmp6__length1;
	}
	result = _tmp6_;
	return result;
}

static void
_events_directory_page_on_display_comments_gcallback (GtkAction* action,
                                                      gpointer self)
{
	events_directory_page_on_display_comments ((EventsDirectoryPage*) self, action);
}

static void
_vala_array_add152 (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*
events_directory_page_real_init_collect_toggle_action_entries (Page* base,
                                                               gint* result_length1)
{
	EventsDirectoryPage * self;
	GtkToggleActionEntry* toggle_actions = NULL;
	gint _tmp0_ = 0;
	GtkToggleActionEntry* _tmp1_;
	gint toggle_actions_length1;
	gint _toggle_actions_size_;
	GtkToggleActionEntry comments = {0};
	GSettings* _tmp2_;
	GtkToggleActionEntry _tmp3_ = {0};
	GtkToggleActionEntry _tmp4_;
	GtkToggleActionEntry* _tmp5_;
	gint _tmp5__length1;
	GtkToggleActionEntry* result;
	self = (EventsDirectoryPage*) base;
	_tmp1_ = PAGE_CLASS (events_directory_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 = "ViewComment";
	_tmp3_.stock_id = NULL;
	_tmp3_.label = _ ("_Comments");
	_tmp3_.accelerator = "<Ctrl><Shift>C";
	_tmp3_.tooltip = _ ("Display the comment of each event");
	_tmp3_.callback = (GCallback) _events_directory_page_on_display_comments_gcallback;
	_tmp3_.is_active = g_settings_get_boolean (_tmp2_, "display-event-comments");
	comments = _tmp3_;
	_tmp4_ = comments;
	_vala_array_add152 (&toggle_actions, &toggle_actions_length1, &_toggle_actions_size_, &_tmp4_);
	_tmp5_ = toggle_actions;
	_tmp5__length1 = toggle_actions_length1;
	if (result_length1) {
		*result_length1 = _tmp5__length1;
	}
	result = _tmp5_;
	return result;
}

static void
events_directory_page_real_init_actions (Page* base,
                                         gint selected_count,
                                         gint count)
{
	EventsDirectoryPage * self;
	GtkRadioAction* action = NULL;
	GtkAction* _tmp0_;
	GtkRadioAction* _tmp1_;
	self = (EventsDirectoryPage*) base;
	PAGE_CLASS (events_directory_page_parent_class)->init_actions ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), selected_count, count);
	_tmp0_ = page_get_action ((Page*) self, "CommonSortEventsAscending");
	_tmp1_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_radio_action_get_type ()) ? ((GtkRadioAction*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	action = _tmp1_;
	_vala_assert (action != NULL, "action != null");
	g_signal_connect_object (action, "changed", (GCallback) _events_directory_page_on_sort_changed_gtk_radio_action_changed, self, 0);
	_g_object_unref0 (action);
}

static void
events_directory_page_real_update_actions (Page* base,
                                           gint selected_count,
                                           gint count)
{
	EventsDirectoryPage * self;
	self = (EventsDirectoryPage*) base;
	page_set_action_sensitive ((Page*) self, "Merge", selected_count > 1);
	page_set_action_sensitive ((Page*) self, "Rename", selected_count == 1);
	PAGE_CLASS (events_directory_page_parent_class)->update_actions ((Page*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_CHECKERBOARD_PAGE, CheckerboardPage), selected_count, count);
}

static gchar*
events_directory_page_real_get_view_empty_message (CheckerboardPage* base)
{
	EventsDirectoryPage * self;
	gchar* _tmp0_;
	gchar* result;
	self = (EventsDirectoryPage*) base;
	_tmp0_ = g_strdup (_ ("No events"));
	result = _tmp0_;
	return result;
}

static gchar*
events_directory_page_real_get_filter_no_match_message (CheckerboardPage* base)
{
	EventsDirectoryPage * self;
	gchar* _tmp0_;
	gchar* result;
	self = (EventsDirectoryPage*) base;
	_tmp0_ = g_strdup (_ ("No events found"));
	result = _tmp0_;
	return result;
}

static void
events_directory_page_real_on_item_activated (CheckerboardPage* base,
                                              CheckerboardItem* item)
{
	EventsDirectoryPage * self;
	EventDirectoryItem* event = NULL;
	EventDirectoryItem* _tmp0_;
	LibraryWindow* _tmp1_;
	LibraryWindow* _tmp2_;
	Event* _tmp3_;
	self = (EventsDirectoryPage*) base;
	g_return_if_fail (item != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (item, TYPE_EVENT_DIRECTORY_ITEM, EventDirectoryItem));
	event = _tmp0_;
	_tmp1_ = library_window_get_app ();
	_tmp2_ = _tmp1_;
	_tmp3_ = event->event;
	library_window_switch_to_event (_tmp2_, _tmp3_);
	_g_object_unref0 (_tmp2_);
	_g_object_unref0 (event);
}

static void
events_directory_page_on_sort_changed (EventsDirectoryPage* self,
                                       GtkAction* action,
                                       GtkAction* c)
{
	GtkRadioAction* current = NULL;
	GtkRadioAction* _tmp0_;
	ViewCollection* _tmp1_;
	ViewCollection* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gpointer _tmp5_ = NULL;
	GDestroyNotify _tmp6_ = NULL;
	Comparator _tmp7_;
	Comparator _tmp8_;
	gpointer _tmp8__target;
	GDestroyNotify _tmp8__target_destroy_notify;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	g_return_if_fail (c != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (c, gtk_radio_action_get_type (), GtkRadioAction));
	current = _tmp0_;
	_tmp1_ = page_get_view ((Page*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = gtk_radio_action_get_current_value (current);
	_tmp4_ = _tmp3_;
	_tmp7_ = events_directory_page_get_event_comparator (_tmp4_ == LIBRARY_WINDOW_SORT_EVENTS_ORDER_ASCENDING, &_tmp5_, &_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp8__target = _tmp5_;
	_tmp8__target_destroy_notify = _tmp6_;
	data_collection_set_comparator ((DataCollection*) _tmp2_, _tmp8_, _tmp5_, _events_directory_page_event_comparator_predicate_comparator_predicate, NULL);
	(_tmp8__target_destroy_notify == NULL) ? NULL : (_tmp8__target_destroy_notify (_tmp8__target), NULL);
	_tmp8_ = NULL;
	_tmp8__target = NULL;
	_tmp8__target_destroy_notify = NULL;
	_data_collection_unref0 (_tmp2_);
	_g_object_unref0 (current);
}

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

static void
events_directory_page_on_rename (EventsDirectoryPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	EventDirectoryItem* item = NULL;
	ViewCollection* _tmp3_;
	ViewCollection* _tmp4_;
	DataView* _tmp5_;
	EventDirectoryItem* _tmp6_;
	EventRenameDialog* rename_dialog = NULL;
	EventDirectoryItem* _tmp7_;
	Event* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	EventRenameDialog* _tmp11_;
	EventRenameDialog* _tmp12_;
	gchar* new_name = NULL;
	EventRenameDialog* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	RenameEventCommand* command = NULL;
	EventDirectoryItem* _tmp16_;
	Event* _tmp17_;
	const gchar* _tmp18_;
	RenameEventCommand* _tmp19_;
	CommandManager* _tmp20_;
	CommandManager* _tmp21_;
	RenameEventCommand* _tmp22_;
	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_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, TYPE_EVENT_DIRECTORY_ITEM, EventDirectoryItem);
	_data_collection_unref0 (_tmp4_);
	item = _tmp6_;
	_tmp7_ = item;
	_tmp8_ = _tmp7_->event;
	_tmp9_ = event_get_raw_name (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = event_rename_dialog_new (_tmp10_);
	_tmp12_ = _tmp11_;
	_g_free0 (_tmp10_);
	rename_dialog = _tmp12_;
	_tmp13_ = rename_dialog;
	_tmp14_ = event_rename_dialog_execute (_tmp13_);
	new_name = _tmp14_;
	_tmp15_ = new_name;
	if (_tmp15_ == NULL) {
		_g_free0 (new_name);
		_text_entry_dialog_mediator_unref0 (rename_dialog);
		_g_object_unref0 (item);
		return;
	}
	_tmp16_ = item;
	_tmp17_ = _tmp16_->event;
	_tmp18_ = new_name;
	_tmp19_ = rename_event_command_new (_tmp17_, _tmp18_);
	command = _tmp19_;
	_tmp20_ = page_get_command_manager ((Page*) self);
	_tmp21_ = _tmp20_;
	_tmp22_ = command;
	command_manager_execute (_tmp21_, (Command*) _tmp22_);
	_command_manager_unref0 (_tmp21_);
	_g_object_unref0 (command);
	_g_free0 (new_name);
	_text_entry_dialog_mediator_unref0 (rename_dialog);
	_g_object_unref0 (item);
}

static void
events_directory_page_on_merge (EventsDirectoryPage* self)
{
	ViewCollection* _tmp0_;
	ViewCollection* _tmp1_;
	gboolean _tmp2_;
	MergeEventsCommand* command = NULL;
	ViewCollection* _tmp3_;
	ViewCollection* _tmp4_;
	GeeList* _tmp5_;
	GeeList* _tmp6_;
	MergeEventsCommand* _tmp7_;
	MergeEventsCommand* _tmp8_;
	CommandManager* _tmp9_;
	CommandManager* _tmp10_;
	MergeEventsCommand* _tmp11_;
	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 (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = merge_events_command_new ((GeeIterable*) _tmp6_);
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp6_);
	_data_collection_unref0 (_tmp4_);
	command = _tmp8_;
	_tmp9_ = page_get_command_manager ((Page*) self);
	_tmp10_ = _tmp9_;
	_tmp11_ = command;
	command_manager_execute (_tmp10_, (Command*) _tmp11_);
	_command_manager_unref0 (_tmp10_);
	_g_object_unref0 (command);
}

static void
events_directory_page_on_display_comments (EventsDirectoryPage* self,
                                           GtkAction* action)
{
	gboolean display = FALSE;
	GSettings* _tmp0_;
	g_return_if_fail (self != NULL);
	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-event-comments", display);
}

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

static SearchViewFilter*
events_directory_page_real_get_search_view_filter (CheckerboardPage* base)
{
	EventsDirectoryPage * self;
	EventsDirectoryPageEventsDirectorySearchViewFilter* _tmp0_;
	SearchViewFilter* _tmp1_;
	SearchViewFilter* result;
	self = (EventsDirectoryPage*) base;
	_tmp0_ = self->priv->search_filter;
	_tmp1_ = _view_filter_ref0 ((SearchViewFilter*) _tmp0_);
	result = _tmp1_;
	return result;
}

static DataView*
events_directory_page_event_directory_manager_real_create_view (ViewManager* base,
                                                                DataSource* source)
{
	EventsDirectoryPageEventDirectoryManager * self;
	EventDirectoryItem* _tmp0_;
	DataView* result;
	self = (EventsDirectoryPageEventDirectoryManager*) base;
	g_return_val_if_fail (source != NULL, NULL);
	_tmp0_ = event_directory_item_new (G_TYPE_CHECK_INSTANCE_CAST (source, TYPE_EVENT, Event));
	result = (DataView*) _tmp0_;
	return result;
}

EventsDirectoryPageEventDirectoryManager*
events_directory_page_event_directory_manager_construct (GType object_type)
{
	EventsDirectoryPageEventDirectoryManager* self = NULL;
	self = (EventsDirectoryPageEventDirectoryManager*) view_manager_construct (object_type);
	return self;
}

EventsDirectoryPageEventDirectoryManager*
events_directory_page_event_directory_manager_new (void)
{
	return events_directory_page_event_directory_manager_construct (EVENTS_DIRECTORY_PAGE_TYPE_EVENT_DIRECTORY_MANAGER);
}

static void
events_directory_page_event_directory_manager_class_init (EventsDirectoryPageEventDirectoryManagerClass * klass,
                                                          gpointer klass_data)
{
	events_directory_page_event_directory_manager_parent_class = g_type_class_peek_parent (klass);
	((ViewManagerClass *) klass)->create_view = (DataView* (*) (ViewManager*, DataSource*)) events_directory_page_event_directory_manager_real_create_view;
}

static void
events_directory_page_event_directory_manager_instance_init (EventsDirectoryPageEventDirectoryManager * self,
                                                             gpointer klass)
{
}

static GType
events_directory_page_event_directory_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (EventsDirectoryPageEventDirectoryManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) events_directory_page_event_directory_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EventsDirectoryPageEventDirectoryManager), 0, (GInstanceInitFunc) events_directory_page_event_directory_manager_instance_init, NULL };
	GType events_directory_page_event_directory_manager_type_id;
	events_directory_page_event_directory_manager_type_id = g_type_register_static (TYPE_VIEW_MANAGER, "EventsDirectoryPageEventDirectoryManager", &g_define_type_info, 0);
	return events_directory_page_event_directory_manager_type_id;
}

GType
events_directory_page_event_directory_manager_get_type (void)
{
	static volatile gsize events_directory_page_event_directory_manager_type_id__once = 0;
	if (g_once_init_enter (&events_directory_page_event_directory_manager_type_id__once)) {
		GType events_directory_page_event_directory_manager_type_id;
		events_directory_page_event_directory_manager_type_id = events_directory_page_event_directory_manager_get_type_once ();
		g_once_init_leave (&events_directory_page_event_directory_manager_type_id__once, events_directory_page_event_directory_manager_type_id);
	}
	return events_directory_page_event_directory_manager_type_id__once;
}

static guint
events_directory_page_events_directory_search_view_filter_real_get_criteria (SearchViewFilter* base)
{
	EventsDirectoryPageEventsDirectorySearchViewFilter * self;
	guint result;
	self = (EventsDirectoryPageEventsDirectorySearchViewFilter*) base;
	result = (guint) SEARCH_FILTER_CRITERIA_TEXT;
	return result;
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gboolean
events_directory_page_events_directory_search_view_filter_real_predicate (ViewFilter* base,
                                                                          DataView* view)
{
	EventsDirectoryPageEventsDirectorySearchViewFilter * self;
	DataSource* _tmp0_;
	DataSource* _tmp1_;
	const gchar* _tmp2_;
	Event* source = NULL;
	DataSource* _tmp3_;
	DataSource* _tmp4_;
	Event* _tmp5_;
	const gchar* event_keywords = NULL;
	Event* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gint _tmp9_ = 0;
	gchar** _tmp10_;
	gboolean result;
	self = (EventsDirectoryPageEventsDirectorySearchViewFilter*) base;
	g_return_val_if_fail (view != NULL, FALSE);
	_tmp0_ = data_view_get_source (view);
	_tmp1_ = _tmp0_;
	_vala_assert (IS_EVENT (_tmp1_), "view.source is Event");
	_tmp2_ = search_view_filter_get_search_filter ((SearchViewFilter*) self);
	if (is_string_empty (_tmp2_)) {
		result = TRUE;
		return result;
	}
	_tmp3_ = data_view_get_source (view);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, TYPE_EVENT, Event));
	source = _tmp5_;
	_tmp6_ = source;
	_tmp7_ = indexable_get_indexable_keywords ((Indexable*) _tmp6_);
	event_keywords = _tmp7_;
	_tmp8_ = event_keywords;
	if (is_string_empty (_tmp8_)) {
		result = FALSE;
		_g_object_unref0 (source);
		return result;
	}
	_tmp10_ = search_view_filter_get_search_filter_words ((SearchViewFilter*) self, &_tmp9_);
	{
		gchar** word_collection = NULL;
		gint word_collection_length1 = 0;
		gint _word_collection_size_ = 0;
		gint word_it = 0;
		word_collection = _tmp10_;
		word_collection_length1 = _tmp9_;
		for (word_it = 0; word_it < word_collection_length1; word_it = word_it + 1) {
			const gchar* word = NULL;
			word = word_collection[word_it];
			{
				const gchar* _tmp11_;
				const gchar* _tmp12_;
				_tmp11_ = event_keywords;
				_tmp12_ = word;
				if (!string_contains (_tmp11_, _tmp12_)) {
					result = FALSE;
					_g_object_unref0 (source);
					return result;
				}
			}
		}
	}
	result = TRUE;
	_g_object_unref0 (source);
	return result;
}

static EventsDirectoryPageEventsDirectorySearchViewFilter*
events_directory_page_events_directory_search_view_filter_construct (GType object_type)
{
	EventsDirectoryPageEventsDirectorySearchViewFilter* self = NULL;
	self = (EventsDirectoryPageEventsDirectorySearchViewFilter*) search_view_filter_construct (object_type);
	return self;
}

static EventsDirectoryPageEventsDirectorySearchViewFilter*
events_directory_page_events_directory_search_view_filter_new (void)
{
	return events_directory_page_events_directory_search_view_filter_construct (EVENTS_DIRECTORY_PAGE_TYPE_EVENTS_DIRECTORY_SEARCH_VIEW_FILTER);
}

static void
events_directory_page_events_directory_search_view_filter_class_init (EventsDirectoryPageEventsDirectorySearchViewFilterClass * klass,
                                                                      gpointer klass_data)
{
	events_directory_page_events_directory_search_view_filter_parent_class = g_type_class_peek_parent (klass);
	((SearchViewFilterClass *) klass)->get_criteria = (guint (*) (SearchViewFilter*)) events_directory_page_events_directory_search_view_filter_real_get_criteria;
	((ViewFilterClass *) klass)->predicate = (gboolean (*) (ViewFilter*, DataView*)) events_directory_page_events_directory_search_view_filter_real_predicate;
}

static void
events_directory_page_events_directory_search_view_filter_instance_init (EventsDirectoryPageEventsDirectorySearchViewFilter * self,
                                                                         gpointer klass)
{
}

static GType
events_directory_page_events_directory_search_view_filter_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (EventsDirectoryPageEventsDirectorySearchViewFilterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) events_directory_page_events_directory_search_view_filter_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EventsDirectoryPageEventsDirectorySearchViewFilter), 0, (GInstanceInitFunc) events_directory_page_events_directory_search_view_filter_instance_init, NULL };
	GType events_directory_page_events_directory_search_view_filter_type_id;
	events_directory_page_events_directory_search_view_filter_type_id = g_type_register_static (TYPE_SEARCH_VIEW_FILTER, "EventsDirectoryPageEventsDirectorySearchViewFilter", &g_define_type_info, 0);
	return events_directory_page_events_directory_search_view_filter_type_id;
}

static GType
events_directory_page_events_directory_search_view_filter_get_type (void)
{
	static volatile gsize events_directory_page_events_directory_search_view_filter_type_id__once = 0;
	if (g_once_init_enter (&events_directory_page_events_directory_search_view_filter_type_id__once)) {
		GType events_directory_page_events_directory_search_view_filter_type_id;
		events_directory_page_events_directory_search_view_filter_type_id = events_directory_page_events_directory_search_view_filter_get_type_once ();
		g_once_init_leave (&events_directory_page_events_directory_search_view_filter_type_id__once, events_directory_page_events_directory_search_view_filter_type_id);
	}
	return events_directory_page_events_directory_search_view_filter_type_id__once;
}

static void
_events_directory_page_on_show_sidebar_gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self)
{
	events_directory_page_on_show_sidebar ((EventsDirectoryPage*) self);
}

static GObject *
events_directory_page_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	EventsDirectoryPage * self;
	GtkButton* merge_button = NULL;
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	GtkAction* _tmp2_;
	GtkAction* _tmp3_;
	GtkButton* _tmp4_;
	GtkButton* _tmp5_;
	GtkButton* _tmp6_;
	GtkActionBar* toolbar = NULL;
	GtkActionBar* _tmp7_;
	GtkActionBar* _tmp8_;
	GtkButton* _tmp9_;
	GtkActionBar* _tmp10_;
	GtkButton* _tmp11_;
	parent_class = G_OBJECT_CLASS (events_directory_page_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_EVENTS_DIRECTORY_PAGE, EventsDirectoryPage);
	_tmp0_ = (GtkButton*) gtk_button_new_from_icon_name (RESOURCES_MERGE, (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp0_);
	merge_button = _tmp0_;
	_tmp1_ = merge_button;
	_tmp2_ = page_get_action ((Page*) self, "Merge");
	_tmp3_ = _tmp2_;
	gtk_activatable_set_related_action ((GtkActivatable*) _tmp1_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = merge_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp4_, _ ("Merge events"));
	_tmp5_ = media_page_create_sidebar_button ();
	_g_object_unref0 (((Page*) self)->show_sidebar_button);
	((Page*) self)->show_sidebar_button = _tmp5_;
	_tmp6_ = ((Page*) self)->show_sidebar_button;
	g_signal_connect_object (_tmp6_, "clicked", (GCallback) _events_directory_page_on_show_sidebar_gtk_button_clicked, self, 0);
	_tmp7_ = page_get_toolbar ((Page*) self, NULL, GTK_PACK_START);
	toolbar = _tmp7_;
	_tmp8_ = toolbar;
	_tmp9_ = merge_button;
	gtk_action_bar_pack_start (_tmp8_, (GtkWidget*) _tmp9_);
	_tmp10_ = toolbar;
	_tmp11_ = ((Page*) self)->show_sidebar_button;
	gtk_action_bar_pack_end (_tmp10_, (GtkWidget*) _tmp11_);
	_g_object_unref0 (toolbar);
	_g_object_unref0 (merge_button);
	return obj;
}

static void
events_directory_page_class_init (EventsDirectoryPageClass * klass,
                                  gpointer klass_data)
{
	events_directory_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &EventsDirectoryPage_private_offset);
	((CheckerboardPageClass *) klass)->get_item_context_menu = (GtkMenu* (*) (CheckerboardPage*)) events_directory_page_real_get_item_context_menu;
	((PageClass *) klass)->get_page_context_menu = (GtkMenu* (*) (Page*)) events_directory_page_real_get_page_context_menu;
	((PageClass *) klass)->init_collect_action_entries = (GtkActionEntry* (*) (Page*, gint*)) events_directory_page_real_init_collect_action_entries;
	((PageClass *) klass)->init_collect_toggle_action_entries = (GtkToggleActionEntry* (*) (Page*, gint*)) events_directory_page_real_init_collect_toggle_action_entries;
	((PageClass *) klass)->init_actions = (void (*) (Page*, gint, gint)) events_directory_page_real_init_actions;
	((PageClass *) klass)->update_actions = (void (*) (Page*, gint, gint)) events_directory_page_real_update_actions;
	((CheckerboardPageClass *) klass)->get_view_empty_message = (gchar* (*) (CheckerboardPage*)) events_directory_page_real_get_view_empty_message;
	((CheckerboardPageClass *) klass)->get_filter_no_match_message = (gchar* (*) (CheckerboardPage*)) events_directory_page_real_get_filter_no_match_message;
	((CheckerboardPageClass *) klass)->on_item_activated = (void (*) (CheckerboardPage*, CheckerboardItem*)) events_directory_page_real_on_item_activated;
	((CheckerboardPageClass *) klass)->get_search_view_filter = (SearchViewFilter* (*) (CheckerboardPage*)) events_directory_page_real_get_search_view_filter;
	G_OBJECT_CLASS (klass)->constructor = events_directory_page_constructor;
	G_OBJECT_CLASS (klass)->finalize = events_directory_page_finalize;
}

static void
events_directory_page_instance_init (EventsDirectoryPage * self,
                                     gpointer klass)
{
	EventsDirectoryPageEventsDirectorySearchViewFilter* _tmp0_;
	self->priv = events_directory_page_get_instance_private (self);
	_tmp0_ = events_directory_page_events_directory_search_view_filter_new ();
	self->priv->search_filter = _tmp0_;
}

static void
events_directory_page_finalize (GObject * obj)
{
	EventsDirectoryPage * self;
	GtkRadioAction* action = NULL;
	GtkAction* _tmp0_;
	GtkRadioAction* _tmp1_;
	GtkRadioAction* _tmp2_;
	GtkRadioAction* _tmp3_;
	guint _tmp4_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_EVENTS_DIRECTORY_PAGE, EventsDirectoryPage);
	_tmp0_ = page_get_action ((Page*) self, "CommonSortEventsAscending");
	_tmp1_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_radio_action_get_type ()) ? ((GtkRadioAction*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	action = _tmp1_;
	_tmp2_ = action;
	_vala_assert (_tmp2_ != NULL, "action != null");
	_tmp3_ = action;
	g_signal_parse_name ("changed", gtk_radio_action_get_type (), &_tmp4_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _events_directory_page_on_sort_changed_gtk_radio_action_changed, self);
	_g_object_unref0 (action);
	_view_manager_unref0 (self->view_manager);
	_view_filter_unref0 (self->priv->search_filter);
	_g_object_unref0 (self->priv->page_context_menu);
	_g_object_unref0 (self->priv->item_context_menu);
	G_OBJECT_CLASS (events_directory_page_parent_class)->finalize (obj);
}

static GType
events_directory_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (EventsDirectoryPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) events_directory_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EventsDirectoryPage), 0, (GInstanceInitFunc) events_directory_page_instance_init, NULL };
	GType events_directory_page_type_id;
	events_directory_page_type_id = g_type_register_static (TYPE_CHECKERBOARD_PAGE, "EventsDirectoryPage", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	EventsDirectoryPage_private_offset = g_type_add_instance_private (events_directory_page_type_id, sizeof (EventsDirectoryPagePrivate));
	return events_directory_page_type_id;
}

GType
events_directory_page_get_type (void)
{
	static volatile gsize events_directory_page_type_id__once = 0;
	if (g_once_init_enter (&events_directory_page_type_id__once)) {
		GType events_directory_page_type_id;
		events_directory_page_type_id = events_directory_page_get_type_once ();
		g_once_init_leave (&events_directory_page_type_id__once, events_directory_page_type_id);
	}
	return events_directory_page_type_id__once;
}

MasterEventsDirectoryPage*
master_events_directory_page_construct (GType object_type)
{
	MasterEventsDirectoryPage * self = NULL;
	EventsDirectoryPageEventDirectoryManager* _tmp0_;
	EventsDirectoryPageEventDirectoryManager* _tmp1_;
	EventSourceCollection* _tmp2_;
	GeeCollection* _tmp3_;
	GeeCollection* _tmp4_;
	_tmp0_ = events_directory_page_event_directory_manager_new ();
	_tmp1_ = _tmp0_;
	_tmp2_ = event_global;
	_tmp3_ = data_collection_get_all ((DataCollection*) _tmp2_);
	_tmp4_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, GEE_TYPE_COLLECTION, GeeCollection);
	self = (MasterEventsDirectoryPage*) events_directory_page_construct (object_type, MASTER_EVENTS_DIRECTORY_PAGE_NAME, (ViewManager*) _tmp1_, _tmp4_);
	_g_object_unref0 (_tmp4_);
	_view_manager_unref0 (_tmp1_);
	return self;
}

MasterEventsDirectoryPage*
master_events_directory_page_new (void)
{
	return master_events_directory_page_construct (TYPE_MASTER_EVENTS_DIRECTORY_PAGE);
}

static void
master_events_directory_page_class_init (MasterEventsDirectoryPageClass * klass,
                                         gpointer klass_data)
{
	master_events_directory_page_parent_class = g_type_class_peek_parent (klass);
}

static void
master_events_directory_page_instance_init (MasterEventsDirectoryPage * self,
                                            gpointer klass)
{
}

static GType
master_events_directory_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MasterEventsDirectoryPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) master_events_directory_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MasterEventsDirectoryPage), 0, (GInstanceInitFunc) master_events_directory_page_instance_init, NULL };
	GType master_events_directory_page_type_id;
	master_events_directory_page_type_id = g_type_register_static (TYPE_EVENTS_DIRECTORY_PAGE, "MasterEventsDirectoryPage", &g_define_type_info, 0);
	return master_events_directory_page_type_id;
}

GType
master_events_directory_page_get_type (void)
{
	static volatile gsize master_events_directory_page_type_id__once = 0;
	if (g_once_init_enter (&master_events_directory_page_type_id__once)) {
		GType master_events_directory_page_type_id;
		master_events_directory_page_type_id = master_events_directory_page_get_type_once ();
		g_once_init_leave (&master_events_directory_page_type_id__once, master_events_directory_page_type_id);
	}
	return master_events_directory_page_type_id__once;
}

static GType
sub_events_directory_page_directory_type_get_type_once (void)
{
	static const GEnumValue values[] = {{SUB_EVENTS_DIRECTORY_PAGE_DIRECTORY_TYPE_YEAR, "SUB_EVENTS_DIRECTORY_PAGE_DIRECTORY_TYPE_YEAR", "year"}, {SUB_EVENTS_DIRECTORY_PAGE_DIRECTORY_TYPE_MONTH, "SUB_EVENTS_DIRECTORY_PAGE_DIRECTORY_TYPE_MONTH", "month"}, {SUB_EVENTS_DIRECTORY_PAGE_DIRECTORY_TYPE_UNDATED, "SUB_EVENTS_DIRECTORY_PAGE_DIRECTORY_TYPE_UNDATED", "undated"}, {0, NULL, NULL}};
	GType sub_events_directory_page_directory_type_type_id;
	sub_events_directory_page_directory_type_type_id = g_enum_register_static ("SubEventsDirectoryPageDirectoryType", values);
	return sub_events_directory_page_directory_type_type_id;
}

GType
sub_events_directory_page_directory_type_get_type (void)
{
	static volatile gsize sub_events_directory_page_directory_type_type_id__once = 0;
	if (g_once_init_enter (&sub_events_directory_page_directory_type_type_id__once)) {
		GType sub_events_directory_page_directory_type_type_id;
		sub_events_directory_page_directory_type_type_id = sub_events_directory_page_directory_type_get_type_once ();
		g_once_init_leave (&sub_events_directory_page_directory_type_type_id__once, sub_events_directory_page_directory_type_type_id);
	}
	return sub_events_directory_page_directory_type_type_id__once;
}

SubEventsDirectoryPage*
sub_events_directory_page_construct (GType object_type,
                                     SubEventsDirectoryPageDirectoryType type,
                                     GDateTime* time)
{
	SubEventsDirectoryPage * self = NULL;
	gchar* page_name = NULL;
	const gchar* _tmp3_;
	SubEventsDirectoryPageSubEventDirectoryManager* _tmp4_;
	SubEventsDirectoryPageSubEventDirectoryManager* _tmp5_;
	g_return_val_if_fail (time != NULL, NULL);
	if (type == SUB_EVENTS_DIRECTORY_PAGE_DIRECTORY_TYPE_UNDATED) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (SUB_EVENTS_DIRECTORY_PAGE_UNDATED_PAGE_NAME);
		_g_free0 (page_name);
		page_name = _tmp0_;
	} else {
		const gchar* _tmp1_ = NULL;
		gchar* _tmp2_;
		if (type == SUB_EVENTS_DIRECTORY_PAGE_DIRECTORY_TYPE_YEAR) {
			_tmp1_ = SUB_EVENTS_DIRECTORY_PAGE_YEAR_FORMAT;
		} else {
			_tmp1_ = SUB_EVENTS_DIRECTORY_PAGE_MONTH_FORMAT;
		}
		_tmp2_ = g_date_time_format (time, _tmp1_);
		_g_free0 (page_name);
		page_name = _tmp2_;
	}
	_tmp3_ = page_name;
	_tmp4_ = sub_events_directory_page_sub_event_directory_manager_new (type, time);
	_tmp5_ = _tmp4_;
	self = (SubEventsDirectoryPage*) events_directory_page_construct (object_type, _tmp3_, (ViewManager*) _tmp5_, NULL);
	_view_manager_unref0 (_tmp5_);
	_g_free0 (page_name);
	return self;
}

SubEventsDirectoryPage*
sub_events_directory_page_new (SubEventsDirectoryPageDirectoryType type,
                               GDateTime* time)
{
	return sub_events_directory_page_construct (TYPE_SUB_EVENTS_DIRECTORY_PAGE, type, time);
}

gint
sub_events_directory_page_get_month (SubEventsDirectoryPage* self)
{
	ViewManager* _tmp0_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = ((EventsDirectoryPage*) self)->view_manager;
	result = sub_events_directory_page_sub_event_directory_manager_get_month (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, SUB_EVENTS_DIRECTORY_PAGE_TYPE_SUB_EVENT_DIRECTORY_MANAGER, SubEventsDirectoryPageSubEventDirectoryManager));
	return result;
}

gint
sub_events_directory_page_get_year (SubEventsDirectoryPage* self)
{
	ViewManager* _tmp0_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = ((EventsDirectoryPage*) self)->view_manager;
	result = sub_events_directory_page_sub_event_directory_manager_get_year (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, SUB_EVENTS_DIRECTORY_PAGE_TYPE_SUB_EVENT_DIRECTORY_MANAGER, SubEventsDirectoryPageSubEventDirectoryManager));
	return result;
}

SubEventsDirectoryPageDirectoryType
sub_events_directory_page_get_event_directory_type (SubEventsDirectoryPage* self)
{
	ViewManager* _tmp0_;
	SubEventsDirectoryPageDirectoryType result;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = ((EventsDirectoryPage*) self)->view_manager;
	result = sub_events_directory_page_sub_event_directory_manager_get_event_directory_type (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, SUB_EVENTS_DIRECTORY_PAGE_TYPE_SUB_EVENT_DIRECTORY_MANAGER, SubEventsDirectoryPageSubEventDirectoryManager));
	return result;
}

static inline gpointer
sub_events_directory_page_sub_event_directory_manager_get_instance_private (SubEventsDirectoryPageSubEventDirectoryManager* self)
{
	return G_STRUCT_MEMBER_P (self, SubEventsDirectoryPageSubEventDirectoryManager_private_offset);
}

static SubEventsDirectoryPageSubEventDirectoryManager*
sub_events_directory_page_sub_event_directory_manager_construct (GType object_type,
                                                                 SubEventsDirectoryPageDirectoryType type,
                                                                 GDateTime* time)
{
	SubEventsDirectoryPageSubEventDirectoryManager* self = NULL;
	g_return_val_if_fail (time != NULL, NULL);
	self = (SubEventsDirectoryPageSubEventDirectoryManager*) events_directory_page_event_directory_manager_construct (object_type);
	if (type == SUB_EVENTS_DIRECTORY_PAGE_DIRECTORY_TYPE_MONTH) {
		self->priv->month = g_date_time_get_month (time);
	}
	self->priv->type = type;
	self->priv->year = g_date_time_get_year (time);
	return self;
}

static SubEventsDirectoryPageSubEventDirectoryManager*
sub_events_directory_page_sub_event_directory_manager_new (SubEventsDirectoryPageDirectoryType type,
                                                           GDateTime* time)
{
	return sub_events_directory_page_sub_event_directory_manager_construct (SUB_EVENTS_DIRECTORY_PAGE_TYPE_SUB_EVENT_DIRECTORY_MANAGER, type, time);
}

static gboolean
sub_events_directory_page_sub_event_directory_manager_real_include_in_view (ViewManager* base,
                                                                            DataSource* source)
{
	SubEventsDirectoryPageSubEventDirectoryManager * self;
	EventSource* event = NULL;
	EventSource* _tmp0_;
	GDateTime* event_time = NULL;
	EventSource* _tmp1_;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	gboolean result;
	self = (SubEventsDirectoryPageSubEventDirectoryManager*) base;
	g_return_val_if_fail (source != NULL, FALSE);
	if (!VIEW_MANAGER_CLASS (sub_events_directory_page_sub_event_directory_manager_parent_class)->include_in_view ((ViewManager*) G_TYPE_CHECK_INSTANCE_CAST (self, EVENTS_DIRECTORY_PAGE_TYPE_EVENT_DIRECTORY_MANAGER, EventsDirectoryPageEventDirectoryManager), source)) {
		result = FALSE;
		return result;
	}
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (source, TYPE_EVENT_SOURCE, EventSource));
	event = _tmp0_;
	_tmp1_ = event;
	_tmp2_ = g_date_time_new_from_unix_local (event_source_get_start_time (_tmp1_));
	event_time = _tmp2_;
	_tmp3_ = event_time;
	if (g_date_time_get_year (_tmp3_) == self->priv->year) {
		if (self->priv->type == SUB_EVENTS_DIRECTORY_PAGE_DIRECTORY_TYPE_MONTH) {
			GDateTime* _tmp4_;
			_tmp4_ = event_time;
			result = g_date_time_get_month (_tmp4_) == self->priv->month;
			_g_date_time_unref0 (event_time);
			_g_object_unref0 (event);
			return result;
		}
		result = TRUE;
		_g_date_time_unref0 (event_time);
		_g_object_unref0 (event);
		return result;
	}
	result = FALSE;
	_g_date_time_unref0 (event_time);
	_g_object_unref0 (event);
	return result;
}

static gint
sub_events_directory_page_sub_event_directory_manager_get_month (SubEventsDirectoryPageSubEventDirectoryManager* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->month;
	return result;
}

static gint
sub_events_directory_page_sub_event_directory_manager_get_year (SubEventsDirectoryPageSubEventDirectoryManager* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->year;
	return result;
}

static SubEventsDirectoryPageDirectoryType
sub_events_directory_page_sub_event_directory_manager_get_event_directory_type (SubEventsDirectoryPageSubEventDirectoryManager* self)
{
	SubEventsDirectoryPageDirectoryType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->type;
	return result;
}

static void
sub_events_directory_page_sub_event_directory_manager_class_init (SubEventsDirectoryPageSubEventDirectoryManagerClass * klass,
                                                                  gpointer klass_data)
{
	sub_events_directory_page_sub_event_directory_manager_parent_class = g_type_class_peek_parent (klass);
	((ViewManagerClass *) klass)->finalize = sub_events_directory_page_sub_event_directory_manager_finalize;
	g_type_class_adjust_private_offset (klass, &SubEventsDirectoryPageSubEventDirectoryManager_private_offset);
	((ViewManagerClass *) klass)->include_in_view = (gboolean (*) (ViewManager*, DataSource*)) sub_events_directory_page_sub_event_directory_manager_real_include_in_view;
}

static void
sub_events_directory_page_sub_event_directory_manager_instance_init (SubEventsDirectoryPageSubEventDirectoryManager * self,
                                                                     gpointer klass)
{
	self->priv = sub_events_directory_page_sub_event_directory_manager_get_instance_private (self);
	self->priv->month = 0;
	self->priv->year = 0;
}

static void
sub_events_directory_page_sub_event_directory_manager_finalize (ViewManager * obj)
{
	SubEventsDirectoryPageSubEventDirectoryManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SUB_EVENTS_DIRECTORY_PAGE_TYPE_SUB_EVENT_DIRECTORY_MANAGER, SubEventsDirectoryPageSubEventDirectoryManager);
	VIEW_MANAGER_CLASS (sub_events_directory_page_sub_event_directory_manager_parent_class)->finalize (obj);
}

static GType
sub_events_directory_page_sub_event_directory_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SubEventsDirectoryPageSubEventDirectoryManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sub_events_directory_page_sub_event_directory_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SubEventsDirectoryPageSubEventDirectoryManager), 0, (GInstanceInitFunc) sub_events_directory_page_sub_event_directory_manager_instance_init, NULL };
	GType sub_events_directory_page_sub_event_directory_manager_type_id;
	sub_events_directory_page_sub_event_directory_manager_type_id = g_type_register_static (EVENTS_DIRECTORY_PAGE_TYPE_EVENT_DIRECTORY_MANAGER, "SubEventsDirectoryPageSubEventDirectoryManager", &g_define_type_info, 0);
	SubEventsDirectoryPageSubEventDirectoryManager_private_offset = g_type_add_instance_private (sub_events_directory_page_sub_event_directory_manager_type_id, sizeof (SubEventsDirectoryPageSubEventDirectoryManagerPrivate));
	return sub_events_directory_page_sub_event_directory_manager_type_id;
}

static GType
sub_events_directory_page_sub_event_directory_manager_get_type (void)
{
	static volatile gsize sub_events_directory_page_sub_event_directory_manager_type_id__once = 0;
	if (g_once_init_enter (&sub_events_directory_page_sub_event_directory_manager_type_id__once)) {
		GType sub_events_directory_page_sub_event_directory_manager_type_id;
		sub_events_directory_page_sub_event_directory_manager_type_id = sub_events_directory_page_sub_event_directory_manager_get_type_once ();
		g_once_init_leave (&sub_events_directory_page_sub_event_directory_manager_type_id__once, sub_events_directory_page_sub_event_directory_manager_type_id);
	}
	return sub_events_directory_page_sub_event_directory_manager_type_id__once;
}

static void
sub_events_directory_page_class_init (SubEventsDirectoryPageClass * klass,
                                      gpointer klass_data)
{
	sub_events_directory_page_parent_class = g_type_class_peek_parent (klass);
}

static void
sub_events_directory_page_instance_init (SubEventsDirectoryPage * self,
                                         gpointer klass)
{
}

static GType
sub_events_directory_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SubEventsDirectoryPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sub_events_directory_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SubEventsDirectoryPage), 0, (GInstanceInitFunc) sub_events_directory_page_instance_init, NULL };
	GType sub_events_directory_page_type_id;
	sub_events_directory_page_type_id = g_type_register_static (TYPE_EVENTS_DIRECTORY_PAGE, "SubEventsDirectoryPage", &g_define_type_info, 0);
	return sub_events_directory_page_type_id;
}

GType
sub_events_directory_page_get_type (void)
{
	static volatile gsize sub_events_directory_page_type_id__once = 0;
	if (g_once_init_enter (&sub_events_directory_page_type_id__once)) {
		GType sub_events_directory_page_type_id;
		sub_events_directory_page_type_id = sub_events_directory_page_get_type_once ();
		g_once_init_leave (&sub_events_directory_page_type_id__once, sub_events_directory_page_type_id);
	}
	return sub_events_directory_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;
}

