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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 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
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.h>
#include "planify.h"
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <gio/gio.h>
#include <libportal/portal.h>
#include <glib/gi18n-lib.h>
#include <gobject/gvaluecollector.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>

#define MAIN_WINDOW_VIEW_TIMEOUT ((gint64) 300000000)
#define BUILD_APPLICATION_ID "io.github.alainm23.planify"
#define BUILD_PROFILE "default"
#define BUILD_VERSION "4.19.5"
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_MAIN_WINDOW (main_window_get_type ())
#define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
#define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
#define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
#define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
#define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;
typedef struct _MainWindowPrivate MainWindowPrivate;

#define SERVICES_TYPE_ACTION_MANAGER (services_action_manager_get_type ())
#define SERVICES_ACTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SERVICES_TYPE_ACTION_MANAGER, ServicesActionManager))
#define SERVICES_ACTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SERVICES_TYPE_ACTION_MANAGER, ServicesActionManagerClass))
#define SERVICES_IS_ACTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SERVICES_TYPE_ACTION_MANAGER))
#define SERVICES_IS_ACTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SERVICES_TYPE_ACTION_MANAGER))
#define SERVICES_ACTION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SERVICES_TYPE_ACTION_MANAGER, ServicesActionManagerClass))

typedef struct _ServicesActionManager ServicesActionManager;
typedef struct _ServicesActionManagerClass ServicesActionManagerClass;

#define TYPE_PLANIFY (planify_get_type ())
#define PLANIFY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLANIFY, Planify))
#define PLANIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLANIFY, PlanifyClass))
#define IS_PLANIFY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLANIFY))
#define IS_PLANIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLANIFY))
#define PLANIFY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLANIFY, PlanifyClass))

typedef struct _Planify Planify;
typedef struct _PlanifyClass PlanifyClass;

#define LAYOUTS_TYPE_SIDEBAR (layouts_sidebar_get_type ())
#define LAYOUTS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LAYOUTS_TYPE_SIDEBAR, LayoutsSidebar))
#define LAYOUTS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LAYOUTS_TYPE_SIDEBAR, LayoutsSidebarClass))
#define LAYOUTS_IS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LAYOUTS_TYPE_SIDEBAR))
#define LAYOUTS_IS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LAYOUTS_TYPE_SIDEBAR))
#define LAYOUTS_SIDEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LAYOUTS_TYPE_SIDEBAR, LayoutsSidebarClass))

typedef struct _LayoutsSidebar LayoutsSidebar;
typedef struct _LayoutsSidebarClass LayoutsSidebarClass;

#define LAYOUTS_TYPE_ITEM_SIDEBAR_VIEW (layouts_item_sidebar_view_get_type ())
#define LAYOUTS_ITEM_SIDEBAR_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LAYOUTS_TYPE_ITEM_SIDEBAR_VIEW, LayoutsItemSidebarView))
#define LAYOUTS_ITEM_SIDEBAR_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LAYOUTS_TYPE_ITEM_SIDEBAR_VIEW, LayoutsItemSidebarViewClass))
#define LAYOUTS_IS_ITEM_SIDEBAR_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LAYOUTS_TYPE_ITEM_SIDEBAR_VIEW))
#define LAYOUTS_IS_ITEM_SIDEBAR_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LAYOUTS_TYPE_ITEM_SIDEBAR_VIEW))
#define LAYOUTS_ITEM_SIDEBAR_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LAYOUTS_TYPE_ITEM_SIDEBAR_VIEW, LayoutsItemSidebarViewClass))

typedef struct _LayoutsItemSidebarView LayoutsItemSidebarView;
typedef struct _LayoutsItemSidebarViewClass LayoutsItemSidebarViewClass;

#define MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM (main_window_view_cache_item_get_type ())
#define MAIN_WINDOW_VIEW_CACHE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM, MainWindowViewCacheItem))
#define MAIN_WINDOW_VIEW_CACHE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM, MainWindowViewCacheItemClass))
#define MAIN_WINDOW_IS_VIEW_CACHE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM))
#define MAIN_WINDOW_IS_VIEW_CACHE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM))
#define MAIN_WINDOW_VIEW_CACHE_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM, MainWindowViewCacheItemClass))

typedef struct _MainWindowViewCacheItem MainWindowViewCacheItem;
typedef struct _MainWindowViewCacheItemClass MainWindowViewCacheItemClass;
enum  {
	MAIN_WINDOW_0_PROPERTY,
	MAIN_WINDOW_APP_PROPERTY,
	MAIN_WINDOW_NUM_PROPERTIES
};
static GParamSpec* main_window_properties[MAIN_WINDOW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define VIEWS_TYPE_PROJECT (views_project_get_type ())
#define VIEWS_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIEWS_TYPE_PROJECT, ViewsProject))
#define VIEWS_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIEWS_TYPE_PROJECT, ViewsProjectClass))
#define VIEWS_IS_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIEWS_TYPE_PROJECT))
#define VIEWS_IS_PROJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIEWS_TYPE_PROJECT))
#define VIEWS_PROJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIEWS_TYPE_PROJECT, ViewsProjectClass))

typedef struct _ViewsProject ViewsProject;
typedef struct _ViewsProjectClass ViewsProjectClass;
typedef struct _MainWindowViewCacheItemPrivate MainWindowViewCacheItemPrivate;
#define _main_window_view_cache_item_unref0(var) ((var == NULL) ? NULL : (var = (main_window_view_cache_item_unref (var), NULL)))

#define VIEWS_TYPE_TODAY (views_today_get_type ())
#define VIEWS_TODAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIEWS_TYPE_TODAY, ViewsToday))
#define VIEWS_TODAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIEWS_TYPE_TODAY, ViewsTodayClass))
#define VIEWS_IS_TODAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIEWS_TYPE_TODAY))
#define VIEWS_IS_TODAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIEWS_TYPE_TODAY))
#define VIEWS_TODAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIEWS_TYPE_TODAY, ViewsTodayClass))

typedef struct _ViewsToday ViewsToday;
typedef struct _ViewsTodayClass ViewsTodayClass;

#define VIEWS_SCHEDULED_TYPE_SCHEDULED (views_scheduled_scheduled_get_type ())
#define VIEWS_SCHEDULED_SCHEDULED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIEWS_SCHEDULED_TYPE_SCHEDULED, ViewsScheduledScheduled))
#define VIEWS_SCHEDULED_SCHEDULED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIEWS_SCHEDULED_TYPE_SCHEDULED, ViewsScheduledScheduledClass))
#define VIEWS_SCHEDULED_IS_SCHEDULED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIEWS_SCHEDULED_TYPE_SCHEDULED))
#define VIEWS_SCHEDULED_IS_SCHEDULED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIEWS_SCHEDULED_TYPE_SCHEDULED))
#define VIEWS_SCHEDULED_SCHEDULED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIEWS_SCHEDULED_TYPE_SCHEDULED, ViewsScheduledScheduledClass))

typedef struct _ViewsScheduledScheduled ViewsScheduledScheduled;
typedef struct _ViewsScheduledScheduledClass ViewsScheduledScheduledClass;

#define VIEWS_TYPE_LABELS (views_labels_get_type ())
#define VIEWS_LABELS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIEWS_TYPE_LABELS, ViewsLabels))
#define VIEWS_LABELS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIEWS_TYPE_LABELS, ViewsLabelsClass))
#define VIEWS_IS_LABELS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIEWS_TYPE_LABELS))
#define VIEWS_IS_LABELS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIEWS_TYPE_LABELS))
#define VIEWS_LABELS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIEWS_TYPE_LABELS, ViewsLabelsClass))

typedef struct _ViewsLabels ViewsLabels;
typedef struct _ViewsLabelsClass ViewsLabelsClass;

#define VIEWS_TYPE_LABEL (views_label_get_type ())
#define VIEWS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIEWS_TYPE_LABEL, ViewsLabel))
#define VIEWS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIEWS_TYPE_LABEL, ViewsLabelClass))
#define VIEWS_IS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIEWS_TYPE_LABEL))
#define VIEWS_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIEWS_TYPE_LABEL))
#define VIEWS_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIEWS_TYPE_LABEL, ViewsLabelClass))

typedef struct _ViewsLabel ViewsLabel;
typedef struct _ViewsLabelClass ViewsLabelClass;

#define VIEWS_TYPE_FILTER (views_filter_get_type ())
#define VIEWS_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIEWS_TYPE_FILTER, ViewsFilter))
#define VIEWS_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIEWS_TYPE_FILTER, ViewsFilterClass))
#define VIEWS_IS_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIEWS_TYPE_FILTER))
#define VIEWS_IS_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIEWS_TYPE_FILTER))
#define VIEWS_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIEWS_TYPE_FILTER, ViewsFilterClass))

typedef struct _ViewsFilter ViewsFilter;
typedef struct _ViewsFilterClass ViewsFilterClass;
typedef struct _Block3Data Block3Data;

#define DIALOGS_TYPE_QUICK_ADD (dialogs_quick_add_get_type ())
#define DIALOGS_QUICK_ADD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_TYPE_QUICK_ADD, DialogsQuickAdd))
#define DIALOGS_QUICK_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_TYPE_QUICK_ADD, DialogsQuickAddClass))
#define DIALOGS_IS_QUICK_ADD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_TYPE_QUICK_ADD))
#define DIALOGS_IS_QUICK_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_TYPE_QUICK_ADD))
#define DIALOGS_QUICK_ADD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_TYPE_QUICK_ADD, DialogsQuickAddClass))

typedef struct _DialogsQuickAdd DialogsQuickAdd;
typedef struct _DialogsQuickAddClass DialogsQuickAddClass;
typedef struct _PlanifyPrivate PlanifyPrivate;
typedef struct _Block4Data Block4Data;

#define DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_REPORT_DIALOG (dialogs_productivity_report_productivity_report_dialog_get_type ())
#define DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_REPORT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_REPORT_DIALOG, DialogsProductivityReportProductivityReportDialog))
#define DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_REPORT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_REPORT_DIALOG, DialogsProductivityReportProductivityReportDialogClass))
#define DIALOGS_PRODUCTIVITY_REPORT_IS_PRODUCTIVITY_REPORT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_REPORT_DIALOG))
#define DIALOGS_PRODUCTIVITY_REPORT_IS_PRODUCTIVITY_REPORT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_REPORT_DIALOG))
#define DIALOGS_PRODUCTIVITY_REPORT_PRODUCTIVITY_REPORT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_PRODUCTIVITY_REPORT_TYPE_PRODUCTIVITY_REPORT_DIALOG, DialogsProductivityReportProductivityReportDialogClass))

typedef struct _DialogsProductivityReportProductivityReportDialog DialogsProductivityReportProductivityReportDialog;
typedef struct _DialogsProductivityReportProductivityReportDialogClass DialogsProductivityReportProductivityReportDialogClass;

#define DIALOGS_TYPE_MANAGE_PROJECTS (dialogs_manage_projects_get_type ())
#define DIALOGS_MANAGE_PROJECTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_TYPE_MANAGE_PROJECTS, DialogsManageProjects))
#define DIALOGS_MANAGE_PROJECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_TYPE_MANAGE_PROJECTS, DialogsManageProjectsClass))
#define DIALOGS_IS_MANAGE_PROJECTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_TYPE_MANAGE_PROJECTS))
#define DIALOGS_IS_MANAGE_PROJECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_TYPE_MANAGE_PROJECTS))
#define DIALOGS_MANAGE_PROJECTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_TYPE_MANAGE_PROJECTS, DialogsManageProjectsClass))

typedef struct _DialogsManageProjects DialogsManageProjects;
typedef struct _DialogsManageProjectsClass DialogsManageProjectsClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW (dialogs_preferences_preferences_window_get_type ())
#define DIALOGS_PREFERENCES_PREFERENCES_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW, DialogsPreferencesPreferencesWindow))
#define DIALOGS_PREFERENCES_PREFERENCES_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW, DialogsPreferencesPreferencesWindowClass))
#define DIALOGS_PREFERENCES_IS_PREFERENCES_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW))
#define DIALOGS_PREFERENCES_IS_PREFERENCES_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW))
#define DIALOGS_PREFERENCES_PREFERENCES_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_PREFERENCES_TYPE_PREFERENCES_WINDOW, DialogsPreferencesPreferencesWindowClass))

typedef struct _DialogsPreferencesPreferencesWindow DialogsPreferencesPreferencesWindow;
typedef struct _DialogsPreferencesPreferencesWindowClass DialogsPreferencesPreferencesWindowClass;
typedef struct _Block5Data Block5Data;

#define DIALOGS_TYPE_ERROR_DIALOG (dialogs_error_dialog_get_type ())
#define DIALOGS_ERROR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_TYPE_ERROR_DIALOG, DialogsErrorDialog))
#define DIALOGS_ERROR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_TYPE_ERROR_DIALOG, DialogsErrorDialogClass))
#define DIALOGS_IS_ERROR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_TYPE_ERROR_DIALOG))
#define DIALOGS_IS_ERROR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_TYPE_ERROR_DIALOG))
#define DIALOGS_ERROR_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_TYPE_ERROR_DIALOG, DialogsErrorDialogClass))

typedef struct _DialogsErrorDialog DialogsErrorDialog;
typedef struct _DialogsErrorDialogClass DialogsErrorDialogClass;
typedef struct _Block6Data Block6Data;
typedef struct _Block7Data Block7Data;
typedef struct _MainWindowParamSpecViewCacheItem MainWindowParamSpecViewCacheItem;
typedef struct _Block8Data Block8Data;
#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))

#define SERVICES_TYPE_NOTIFICATION (services_notification_get_type ())
#define SERVICES_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SERVICES_TYPE_NOTIFICATION, ServicesNotification))
#define SERVICES_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SERVICES_TYPE_NOTIFICATION, ServicesNotificationClass))
#define SERVICES_IS_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SERVICES_TYPE_NOTIFICATION))
#define SERVICES_IS_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SERVICES_TYPE_NOTIFICATION))
#define SERVICES_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SERVICES_TYPE_NOTIFICATION, ServicesNotificationClass))

typedef struct _ServicesNotification ServicesNotification;
typedef struct _ServicesNotificationClass ServicesNotificationClass;

#define SERVICES_TYPE_TIME_MONITOR (services_time_monitor_get_type ())
#define SERVICES_TIME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SERVICES_TYPE_TIME_MONITOR, ServicesTimeMonitor))
#define SERVICES_TIME_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SERVICES_TYPE_TIME_MONITOR, ServicesTimeMonitorClass))
#define SERVICES_IS_TIME_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SERVICES_TYPE_TIME_MONITOR))
#define SERVICES_IS_TIME_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SERVICES_TYPE_TIME_MONITOR))
#define SERVICES_TIME_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SERVICES_TYPE_TIME_MONITOR, ServicesTimeMonitorClass))

typedef struct _ServicesTimeMonitor ServicesTimeMonitor;
typedef struct _ServicesTimeMonitorClass ServicesTimeMonitorClass;

#define SERVICES_TYPE_BACKUP_MANAGER (services_backup_manager_get_type ())
#define SERVICES_BACKUP_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SERVICES_TYPE_BACKUP_MANAGER, ServicesBackupManager))
#define SERVICES_BACKUP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SERVICES_TYPE_BACKUP_MANAGER, ServicesBackupManagerClass))
#define SERVICES_IS_BACKUP_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SERVICES_TYPE_BACKUP_MANAGER))
#define SERVICES_IS_BACKUP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SERVICES_TYPE_BACKUP_MANAGER))
#define SERVICES_BACKUP_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SERVICES_TYPE_BACKUP_MANAGER, ServicesBackupManagerClass))

typedef struct _ServicesBackupManager ServicesBackupManager;
typedef struct _ServicesBackupManagerClass ServicesBackupManagerClass;

#define SERVICES_TYPE_DBUS_SERVER (services_dbus_server_get_type ())
#define SERVICES_DBUS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SERVICES_TYPE_DBUS_SERVER, ServicesDBusServer))
#define SERVICES_DBUS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SERVICES_TYPE_DBUS_SERVER, ServicesDBusServerClass))
#define SERVICES_IS_DBUS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SERVICES_TYPE_DBUS_SERVER))
#define SERVICES_IS_DBUS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SERVICES_TYPE_DBUS_SERVER))
#define SERVICES_DBUS_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SERVICES_TYPE_DBUS_SERVER, ServicesDBusServerClass))

typedef struct _ServicesDBusServer ServicesDBusServer;
typedef struct _ServicesDBusServerClass ServicesDBusServerClass;
typedef struct _Block9Data Block9Data;

#define DIALOGS_QUICK_FIND_TYPE_QUICK_FIND (dialogs_quick_find_quick_find_get_type ())
#define DIALOGS_QUICK_FIND_QUICK_FIND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND, DialogsQuickFindQuickFind))
#define DIALOGS_QUICK_FIND_QUICK_FIND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND, DialogsQuickFindQuickFindClass))
#define DIALOGS_QUICK_FIND_IS_QUICK_FIND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND))
#define DIALOGS_QUICK_FIND_IS_QUICK_FIND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND))
#define DIALOGS_QUICK_FIND_QUICK_FIND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIALOGS_QUICK_FIND_TYPE_QUICK_FIND, DialogsQuickFindQuickFindClass))

typedef struct _DialogsQuickFindQuickFind DialogsQuickFindQuickFind;
typedef struct _DialogsQuickFindQuickFindClass DialogsQuickFindQuickFindClass;
typedef struct _Block10Data Block10Data;

struct _MainWindow {
	AdwApplicationWindow parent_instance;
	MainWindowPrivate * priv;
	ServicesActionManager* action_manager;
};

struct _MainWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _MainWindowPrivate {
	Planify* _app;
	gboolean _did_startup_sync;
	LayoutsSidebar* sidebar;
	AdwViewStack* views_stack;
	AdwOverlaySplitView* overlay_split_view;
	GtkMenuButton* settings_button;
	LayoutsItemSidebarView* item_sidebar_view;
	GtkButton* fake_button;
	WidgetsContextMenuMenuItem* archive_item;
	WidgetsContextMenuMenuSeparator* archive_separator;
	AdwToastOverlay* toast_overlay;
	AdwViewStack* view_stack;
	GtkWidget* error_db_page;
	gchar* previous_inbox_project_id;
	GeeArrayList* view_cache;
};

struct _MainWindowViewCacheItem {
	GTypeInstance parent_instance;
	volatile int ref_count;
	MainWindowViewCacheItemPrivate * priv;
	gchar* view_id;
	GtkWidget* view;
	gint64 last_access;
};

struct _MainWindowViewCacheItemClass {
	GTypeClass parent_class;
	void (*finalize) (MainWindowViewCacheItem *self);
};

struct _Block3Data {
	int _ref_count_;
	MainWindow* self;
	ViewsProject* project_view;
};

struct _Planify {
	AdwApplication parent_instance;
	PlanifyPrivate * priv;
	MainWindow* main_window;
};

struct _PlanifyClass {
	AdwApplicationClass parent_class;
};

struct _Block4Data {
	int _ref_count_;
	MainWindow* self;
	GtkPopover* popover;
};

struct _Block5Data {
	int _ref_count_;
	MainWindow* self;
	gint error_code;
	gchar* error_message;
};

struct _Block6Data {
	int _ref_count_;
	MainWindow* self;
	ObjectsProject* project;
};

struct _Block7Data {
	int _ref_count_;
	MainWindow* self;
	guint network_timeout_id;
	GNetworkMonitor* network_monitor;
};

struct _MainWindowParamSpecViewCacheItem {
	GParamSpec parent_instance;
};

struct _Block8Data {
	int _ref_count_;
	MainWindow* self;
	AdwOverlaySplitView* views_split_view;
	ColorSchemeSettingsSettings* color_scheme_settings;
};

struct _Block9Data {
	int _ref_count_;
	MainWindow* self;
	ObjectsSource* source;
};

struct _Block10Data {
	int _ref_count_;
	Block8Data * _data8_;
	ObjectsItem* item;
};

static gint MainWindow_private_offset;
static gpointer main_window_parent_class = NULL;
VALA_EXTERN Planify* planify__instance;
static gpointer main_window_view_cache_item_parent_class = NULL;

VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
VALA_EXTERN GType services_action_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ServicesActionManager, g_object_unref)
VALA_EXTERN GType planify_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Planify, g_object_unref)
VALA_EXTERN GType layouts_sidebar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LayoutsSidebar, g_object_unref)
VALA_EXTERN GType layouts_item_sidebar_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LayoutsItemSidebarView, g_object_unref)
static gpointer main_window_view_cache_item_ref (gpointer instance);
static void main_window_view_cache_item_unref (gpointer instance);
static GParamSpec* main_window_param_spec_view_cache_item (const gchar* name,
                                                    const gchar* nick,
                                                    const gchar* blurb,
                                                    GType object_type,
                                                    GParamFlags flags) G_GNUC_UNUSED ;
static void main_window_value_set_view_cache_item (GValue* value,
                                            gpointer v_object) G_GNUC_UNUSED ;
static void main_window_value_take_view_cache_item (GValue* value,
                                             gpointer v_object) G_GNUC_UNUSED ;
static gpointer main_window_value_get_view_cache_item (const GValue* value) G_GNUC_UNUSED ;
static GType main_window_view_cache_item_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindowViewCacheItem, main_window_view_cache_item_unref)
VALA_EXTERN MainWindow* main_window_new (Planify* application);
VALA_EXTERN MainWindow* main_window_construct (GType object_type,
                                   Planify* application);
VALA_EXTERN void main_window_show_hide_sidebar (MainWindow* self);
static void main_window_update_autostart (MainWindow* self);
VALA_EXTERN Planify* planify_get_instance (void);
VALA_EXTERN void planify_ask_for_background (Planify* self,
                                 XdpBackgroundFlags flags,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_);
VALA_EXTERN gboolean planify_ask_for_background_finish (Planify* self,
                                            GAsyncResult* _res_);
static void ___lambda903_ (MainWindow* self,
                    GObject* obj,
                    GAsyncResult* res);
static void ____lambda903__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void ___lambda904_ (MainWindow* self,
                    GObject* obj,
                    GAsyncResult* res);
static void ____lambda904__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void main_window_clear_multi_select (MainWindow* self);
static void main_window_init_backend (MainWindow* self);
static void main_window_check_archived (MainWindow* self);
static void main_window_add_inbox_view (MainWindow* self);
VALA_EXTERN GType views_project_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ViewsProject, g_object_unref)
VALA_EXTERN ViewsProject* main_window_add_project_view (MainWindow* self,
                                            ObjectsProject* project);
static void main_window_handle_inbox_project_change (MainWindow* self);
static void main_window_cleanup_view (MainWindow* self,
                               GtkWidget* view);
VALA_EXTERN ViewsProject* views_project_new (ObjectsProject* project);
VALA_EXTERN ViewsProject* views_project_construct (GType object_type,
                                       ObjectsProject* project);
static void main_window_add_view_to_cache (MainWindow* self,
                                    const gchar* view_id,
                                    GtkWidget* view);
static void main_window_update_view_access (MainWindow* self,
                                     const gchar* view_id);
VALA_EXTERN void main_window_add_today_view (MainWindow* self);
VALA_EXTERN GType views_today_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ViewsToday, g_object_unref)
VALA_EXTERN ViewsToday* views_today_new (void);
VALA_EXTERN ViewsToday* views_today_construct (GType object_type);
VALA_EXTERN void main_window_add_scheduled_view (MainWindow* self);
VALA_EXTERN GType views_scheduled_scheduled_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ViewsScheduledScheduled, g_object_unref)
VALA_EXTERN ViewsScheduledScheduled* views_scheduled_scheduled_new (void);
VALA_EXTERN ViewsScheduledScheduled* views_scheduled_scheduled_construct (GType object_type);
VALA_EXTERN void main_window_add_labels_view (MainWindow* self);
VALA_EXTERN GType views_labels_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ViewsLabels, g_object_unref)
VALA_EXTERN ViewsLabels* views_labels_new (void);
VALA_EXTERN ViewsLabels* views_labels_construct (GType object_type);
static void main_window_add_label_view (MainWindow* self,
                                 const gchar* id);
VALA_EXTERN GType views_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ViewsLabel, g_object_unref)
VALA_EXTERN ViewsLabel* views_label_new (void);
VALA_EXTERN ViewsLabel* views_label_construct (GType object_type);
VALA_EXTERN void views_label_set_label (ViewsLabel* self,
                            ObjectsLabel* value);
VALA_EXTERN void main_window_add_priority_view (MainWindow* self,
                                    const gchar* view_id);
VALA_EXTERN GType views_filter_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ViewsFilter, g_object_unref)
VALA_EXTERN ViewsFilter* views_filter_new (ObjectsBaseObject* filter);
VALA_EXTERN ViewsFilter* views_filter_construct (GType object_type,
                                     ObjectsBaseObject* filter);
static void main_window_add_filter_view (MainWindow* self,
                                  ObjectsBaseObject* base_object);
VALA_EXTERN void main_window_go_homepage (MainWindow* self);
VALA_EXTERN void main_window_view_item (MainWindow* self,
                            const gchar* id);
VALA_EXTERN void main_window_valid_view_removed (MainWindow* self,
                                     ObjectsProject* project);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static gboolean ____lambda905_ (Block3Data* _data3_);
VALA_EXTERN void views_project_clean_up (ViewsProject* self);
static gboolean _____lambda905__gsource_func (gpointer self);
VALA_EXTERN void main_window_add_task_action (MainWindow* self,
                                  const gchar* content);
VALA_EXTERN void views_project_prepare_new_item (ViewsProject* self,
                                     const gchar* content);
VALA_EXTERN void views_today_prepare_new_item (ViewsToday* self,
                                   const gchar* content);
VALA_EXTERN void views_scheduled_scheduled_prepare_new_item (ViewsScheduledScheduled* self,
                                                 const gchar* content);
VALA_EXTERN void views_labels_prepare_new_item (ViewsLabels* self,
                                    const gchar* content);
VALA_EXTERN void views_label_prepare_new_item (ViewsLabel* self,
                                   const gchar* content);
VALA_EXTERN void views_filter_prepare_new_item (ViewsFilter* self,
                                    const gchar* content);
VALA_EXTERN GType dialogs_quick_add_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsQuickAdd, g_object_unref)
VALA_EXTERN DialogsQuickAdd* dialogs_quick_add_new (void);
VALA_EXTERN DialogsQuickAdd* dialogs_quick_add_construct (GType object_type);
VALA_EXTERN void dialogs_quick_add_update_content (DialogsQuickAdd* self,
                                       const gchar* content);
VALA_EXTERN void main_window_new_section_action (MainWindow* self);
VALA_EXTERN void views_project_prepare_new_section (ViewsProject* self);
static GtkPopover* main_window_build_menu_app (MainWindow* self);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static void __lambda906_ (Block4Data* _data4_);
VALA_EXTERN GType dialogs_productivity_report_productivity_report_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsProductivityReportProductivityReportDialog, g_object_unref)
VALA_EXTERN DialogsProductivityReportProductivityReportDialog* dialogs_productivity_report_productivity_report_dialog_new (void);
VALA_EXTERN DialogsProductivityReportProductivityReportDialog* dialogs_productivity_report_productivity_report_dialog_construct (GType object_type);
static void ___lambda906__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda931_ (MainWindow* self);
VALA_EXTERN void main_window_open_preferences_window (MainWindow* self);
static void ___lambda931__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda932_ (MainWindow* self);
static void main_window_about_dialog (MainWindow* self);
static void ___lambda932__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda933_ (MainWindow* self);
VALA_EXTERN void main_window_open_shortcuts_window (MainWindow* self);
static void ___lambda933__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda934_ (MainWindow* self);
VALA_EXTERN GType dialogs_manage_projects_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsManageProjects, g_object_unref)
VALA_EXTERN DialogsManageProjects* dialogs_manage_projects_new (void);
VALA_EXTERN DialogsManageProjects* dialogs_manage_projects_construct (GType object_type);
static void ___lambda934__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
VALA_EXTERN GType dialogs_preferences_preferences_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsPreferencesPreferencesWindow, g_object_unref)
VALA_EXTERN DialogsPreferencesPreferencesWindow* dialogs_preferences_preferences_window_new (void);
VALA_EXTERN DialogsPreferencesPreferencesWindow* dialogs_preferences_preferences_window_construct (GType object_type);
VALA_EXTERN void main_window_send_toast_error (MainWindow* self,
                                   gint error_code,
                                   const gchar* error_message);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
static void __lambda946_ (Block5Data* _data5_);
VALA_EXTERN DialogsErrorDialog* dialogs_error_dialog_new (gint error_code,
                                              const gchar* error_message);
VALA_EXTERN DialogsErrorDialog* dialogs_error_dialog_construct (GType object_type,
                                                    gint error_code,
                                                    const gchar* error_message);
VALA_EXTERN GType dialogs_error_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsErrorDialog, g_object_unref)
static void ___lambda946__adw_toast_button_clicked (AdwToast* _sender,
                                             gpointer self);
VALA_EXTERN void main_window_show_task_completed_toast (MainWindow* self,
                                            const gchar* project_id);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static void __lambda947_ (Block6Data* _data6_);
static void ___lambda947__adw_toast_button_clicked (AdwToast* _sender,
                                             gpointer self);
static GtkWidget* main_window_build_error_db_page (MainWindow* self);
static void __lambda948_ (MainWindow* self);
static gboolean __lambda949_ (MainWindow* self);
static gboolean ___lambda949__gsource_func (gpointer self);
static void ___lambda948__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void main_window_setup_network_monitor (MainWindow* self);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static void __lambda950_ (Block7Data* _data7_);
static gboolean __lambda951_ (Block7Data* _data7_);
static gboolean ___lambda951__gsource_func (gpointer self);
static void ___lambda950__g_network_monitor_network_changed (GNetworkMonitor* _sender,
                                                      gboolean network_available,
                                                      gpointer self);
static void main_window_cleanup_unused_views (MainWindow* self);
static gint64 main_window_get_timeout_for_view (MainWindow* self,
                                         const gchar* view_id);
VALA_EXTERN void views_today_clean_up (ViewsToday* self);
VALA_EXTERN void views_scheduled_scheduled_clean_up (ViewsScheduledScheduled* self);
VALA_EXTERN void views_filter_clean_up (ViewsFilter* self);
VALA_EXTERN void views_label_clean_up (ViewsLabel* self);
VALA_EXTERN void views_labels_clean_up (ViewsLabels* self);
static void main_window_view_cache_item_update_access (MainWindowViewCacheItem* self);
static MainWindowViewCacheItem* main_window_view_cache_item_new (const gchar* id,
                                                          GtkWidget* widget);
static MainWindowViewCacheItem* main_window_view_cache_item_construct (GType object_type,
                                                                const gchar* id,
                                                                GtkWidget* widget);
VALA_EXTERN Planify* main_window_get_app (MainWindow* self);
static void main_window_set_app (MainWindow* self,
                          Planify* value);
static void main_window_view_cache_item_finalize (MainWindowViewCacheItem * obj);
static GType main_window_view_cache_item_get_type_once (void);
static GObject * main_window_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
VALA_EXTERN ServicesActionManager* services_action_manager_new (Planify* app,
                                                    MainWindow* window);
VALA_EXTERN ServicesActionManager* services_action_manager_construct (GType object_type,
                                                          Planify* app,
                                                          MainWindow* window);
VALA_EXTERN LayoutsSidebar* layouts_sidebar_new (void);
VALA_EXTERN LayoutsSidebar* layouts_sidebar_construct (GType object_type);
VALA_EXTERN LayoutsItemSidebarView* layouts_item_sidebar_view_new (void);
VALA_EXTERN LayoutsItemSidebarView* layouts_item_sidebar_view_construct (GType object_type);
static void _vala_GValue_free (GValue* self);
static gboolean _main_window___lambda952_ (MainWindow* self);
static gboolean __main_window___lambda952__gsource_func (gpointer self);
static void _main_window___lambda953_ (MainWindow* self);
VALA_EXTERN void layouts_sidebar_init (LayoutsSidebar* self);
VALA_EXTERN GType services_notification_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ServicesNotification, g_object_unref)
VALA_EXTERN ServicesNotification* services_notification_get_default (void);
VALA_EXTERN GType services_time_monitor_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ServicesTimeMonitor, g_object_unref)
VALA_EXTERN ServicesTimeMonitor* services_time_monitor_get_default (void);
VALA_EXTERN void services_time_monitor_init_timeout (ServicesTimeMonitor* self);
VALA_EXTERN GType services_backup_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ServicesBackupManager, g_object_unref)
VALA_EXTERN ServicesBackupManager* services_backup_manager_get_default (void);
VALA_EXTERN void services_backup_manager_init_auto_backup (ServicesBackupManager* self);
static void _main_window_valid_view_removed_services_store_project_deleted (ServicesStore* _sender,
                                                                     ObjectsProject* project,
                                                                     gpointer self);
static void _main_window_valid_view_removed_services_store_project_archived (ServicesStore* _sender,
                                                                      ObjectsProject* project,
                                                                      gpointer self);
VALA_EXTERN GType services_dbus_server_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ServicesDBusServer, g_object_unref)
VALA_EXTERN guint services_dbus_server_register_object (void* object,
                                            GDBusConnection* connection,
                                            const gchar* path,
                                            GError** error);
VALA_EXTERN ServicesDBusServer* services_dbus_server_get_default (void);
static void __lambda963_ (MainWindow* self,
                   const gchar* id);
static void ___lambda963__services_dbus_server_item_added (ServicesDBusServer* _sender,
                                                    const gchar* id,
                                                    gpointer self);
static gboolean __lambda964_ (MainWindow* self);
static gboolean ___lambda964__gsource_func (gpointer self);
static void __lambda965_ (MainWindow* self,
                   ObjectsSource* source);
static void ___lambda965__services_store_source_added (ServicesStore* _sender,
                                                ObjectsSource* source,
                                                gpointer self);
static void __main_window___lambda953__services_database_opened (ServicesDatabase* _sender,
                                                          gpointer self);
static void _main_window___lambda966_ (Block8Data* _data8_);
static void __main_window___lambda966__g_object_notify (GObject* _sender,
                                                 GParamSpec* pspec,
                                                 gpointer self);
static void _main_window___lambda967_ (MainWindow* self);
static void __main_window___lambda967__g_object_notify (GObject* _sender,
                                                 GParamSpec* pspec,
                                                 gpointer self);
static void _main_window___lambda968_ (Block8Data* _data8_);
static void __main_window___lambda968__g_settings_changed (GSettings* _sender,
                                                    const gchar* key,
                                                    gpointer self);
static void _util_update_theme_g_settings_changed (GSettings* _sender,
                                            const gchar* key,
                                            gpointer self);
static void _main_window___lambda969_ (MainWindow* self);
static void __main_window___lambda969__g_settings_changed (GSettings* _sender,
                                                    const gchar* key,
                                                    gpointer self);
static void _main_window___lambda970_ (MainWindow* self);
static void __main_window___lambda970__g_settings_changed (GSettings* _sender,
                                                    const gchar* key,
                                                    gpointer self);
static void _main_window___lambda971_ (MainWindow* self);
static void __main_window___lambda971__g_settings_changed (GSettings* _sender,
                                                    const gchar* key,
                                                    gpointer self);
static void _util_update_font_scale_g_settings_changed (GSettings* _sender,
                                                 const gchar* key,
                                                 gpointer self);
static void _main_window___lambda972_ (MainWindow* self,
                                PaneType pane_type,
                                const gchar* id);
static void __main_window___lambda972__services_event_bus_pane_selected (ServicesEventBus* _sender,
                                                                  PaneType panel_type,
                                                                  const gchar* id,
                                                                  gpointer self);
static void _main_window___lambda973_ (MainWindow* self,
                                AdwToast* toast);
static void __main_window___lambda973__services_event_bus_send_toast (ServicesEventBus* _sender,
                                                               AdwToast* toast,
                                                               gpointer self);
static void _main_window_send_toast_error_services_event_bus_send_error_toast (ServicesEventBus* _sender,
                                                                        gint error_code,
                                                                        const gchar* error_message,
                                                                        gpointer self);
static void _main_window___lambda974_ (MainWindow* self,
                                ObjectsSource* source);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static void __lambda975_ (Block9Data* _data9_);
static void ___lambda975__adw_toast_button_clicked (AdwToast* _sender,
                                             gpointer self);
static void __main_window___lambda974__services_event_bus_send_conflict_toast (ServicesEventBus* _sender,
                                                                        ObjectsSource* source,
                                                                        gpointer self);
static void _main_window_show_task_completed_toast_services_event_bus_send_task_completed_toast (ServicesEventBus* _sender,
                                                                                          const gchar* project_id,
                                                                                          gpointer self);
static void _main_window___lambda976_ (MainWindow* self);
VALA_EXTERN DialogsQuickFindQuickFind* dialogs_quick_find_quick_find_new (void);
VALA_EXTERN DialogsQuickFindQuickFind* dialogs_quick_find_quick_find_construct (GType object_type);
VALA_EXTERN GType dialogs_quick_find_quick_find_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DialogsQuickFindQuickFind, g_object_unref)
static void __main_window___lambda976__gtk_button_clicked (GtkButton* _sender,
                                                    gpointer self);
static void _main_window___lambda977_ (Block8Data* _data8_,
                                ObjectsItem* item);
static Block10Data* block10_data_ref (Block10Data* _data10_);
static void block10_data_unref (void * _userdata_);
VALA_EXTERN void layouts_item_sidebar_view_present_item (LayoutsItemSidebarView* self,
                                             ObjectsItem* _item);
static gboolean ____lambda978_ (Block10Data* _data10_);
static gboolean _____lambda978__gsource_func (gpointer self);
static void __main_window___lambda977__services_event_bus_open_item (ServicesEventBus* _sender,
                                                              ObjectsItem* item,
                                                              gpointer self);
static void _main_window___lambda979_ (Block8Data* _data8_);
static void __main_window___lambda979__services_event_bus_close_item (ServicesEventBus* _sender,
                                                               gpointer self);
static void _main_window___lambda980_ (Block8Data* _data8_);
VALA_EXTERN void layouts_item_sidebar_view_clean_up (LayoutsItemSidebarView* self);
static void __main_window___lambda980__g_object_notify (GObject* _sender,
                                                 GParamSpec* pspec,
                                                 gpointer self);
static void _main_window_check_archived_services_store_project_archived (ServicesStore* _sender,
                                                                  ObjectsProject* project,
                                                                  gpointer self);
static void _main_window_check_archived_services_store_project_unarchived (ServicesStore* _sender,
                                                                    ObjectsProject* project,
                                                                    gpointer self);
static void _main_window___lambda981_ (Block8Data* _data8_);
static void __main_window___lambda981__g_settings_changed (GSettings* _sender,
                                                    const gchar* key,
                                                    gpointer self);
static void _main_window___lambda982_ (MainWindow* self);
static void __main_window___lambda982__services_event_bus_theme_changed (ServicesEventBus* _sender,
                                                                  gpointer self);
static gboolean _main_window___lambda983_ (MainWindow* self);
static gboolean __main_window___lambda983__gsource_func (gpointer self);
static gboolean _main_window___lambda984_ (Block8Data* _data8_,
                                    guint keyval,
                                    guint keycode,
                                    GdkModifierType state);
static gboolean __main_window___lambda984__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                          guint keyval,
                                                                          guint keycode,
                                                                          GdkModifierType state,
                                                                          gpointer self);
static void _main_window___lambda985_ (MainWindow* self,
                                gint n_press,
                                gdouble x,
                                gdouble y);
static void __main_window___lambda985__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                                           gint n_press,
                                                           gdouble x,
                                                           gdouble y,
                                                           gpointer self);
static void _main_window___lambda986_ (MainWindow* self);
static void __main_window___lambda986__g_settings_changed (GSettings* _sender,
                                                    const gchar* key,
                                                    gpointer self);
static gboolean _main_window___lambda987_ (MainWindow* self);
static gboolean __main_window___lambda987__gtk_window_close_request (GtkWindow* _sender,
                                                              gpointer self);
static void main_window_finalize (GObject * obj);
static GType main_window_get_type_once (void);
static void _vala_main_window_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec);
static void _vala_main_window_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
main_window_get_instance_private (MainWindow* self)
{
	return G_STRUCT_MEMBER_P (self, MainWindow_private_offset);
}

MainWindow*
main_window_construct (GType object_type,
                       Planify* application)
{
	MainWindow * self = NULL;
	g_return_val_if_fail (application != NULL, NULL);
	self = (MainWindow*) g_object_new (object_type, "application", application, "app", application, "icon-name", BUILD_APPLICATION_ID, "title", "Planify", "width-request", 360, "height-request", 294, NULL);
	return self;
}

MainWindow*
main_window_new (Planify* application)
{
	return main_window_construct (TYPE_MAIN_WINDOW, application);
}

void
main_window_show_hide_sidebar (MainWindow* self)
{
	AdwOverlaySplitView* _tmp0_;
	AdwOverlaySplitView* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->overlay_split_view;
	_tmp1_ = self->priv->overlay_split_view;
	_tmp2_ = adw_overlay_split_view_get_show_sidebar (_tmp1_);
	_tmp3_ = _tmp2_;
	adw_overlay_split_view_set_show_sidebar (_tmp0_, !_tmp3_);
}

static void
___lambda903_ (MainWindow* self,
               GObject* obj,
               GAsyncResult* res)
{
	Planify* _tmp0_;
	Planify* _tmp1_;
	g_return_if_fail (res != NULL);
	_tmp0_ = planify_get_instance ();
	_tmp1_ = _tmp0_;
	planify_ask_for_background_finish (_tmp1_, res);
}

static void
____lambda903__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	___lambda903_ ((MainWindow*) self, source_object, res);
	g_object_unref (self);
}

static void
___lambda904_ (MainWindow* self,
               GObject* obj,
               GAsyncResult* res)
{
	Planify* _tmp0_;
	Planify* _tmp1_;
	g_return_if_fail (res != NULL);
	_tmp0_ = planify_get_instance ();
	_tmp1_ = _tmp0_;
	planify_ask_for_background_finish (_tmp1_, res);
}

static void
____lambda904__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	___lambda904_ ((MainWindow*) self, source_object, res);
	g_object_unref (self);
}

static void
main_window_update_autostart (MainWindow* self)
{
	gboolean run_on_startup = FALSE;
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_boolean (_tmp2_, "run-on-startup");
	_g_object_unref0 (_tmp1_);
	run_on_startup = _tmp3_;
	if (run_on_startup) {
		Planify* _tmp4_;
		Planify* _tmp5_;
		_tmp4_ = planify_get_instance ();
		_tmp5_ = _tmp4_;
		planify_ask_for_background (_tmp5_, XDP_BACKGROUND_FLAG_AUTOSTART, ____lambda903__gasync_ready_callback, g_object_ref (self));
	} else {
		Planify* _tmp6_;
		Planify* _tmp7_;
		_tmp6_ = planify_get_instance ();
		_tmp7_ = _tmp6_;
		planify_ask_for_background (_tmp7_, XDP_BACKGROUND_FLAG_NONE, ____lambda904__gasync_ready_callback, g_object_ref (self));
	}
}

static void
main_window_clear_multi_select (MainWindow* self)
{
	ServicesEventBus* _tmp0_;
	ServicesEventBus* _tmp1_;
	ServicesEventBus* _tmp2_;
	ServicesEventBus* _tmp3_;
	ServicesEventBus* _tmp4_;
	ServicesEventBus* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_event_bus_get_default ();
	_tmp1_ = _tmp0_;
	_tmp1_->multi_select_enabled = FALSE;
	_g_object_unref0 (_tmp1_);
	_tmp2_ = services_event_bus_get_default ();
	_tmp3_ = _tmp2_;
	g_signal_emit_by_name (_tmp3_, "show-multi-select", FALSE);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = services_event_bus_get_default ();
	_tmp5_ = _tmp4_;
	g_signal_emit_by_name (_tmp5_, "unselect-all");
	_g_object_unref0 (_tmp5_);
}

static void
main_window_init_backend (MainWindow* self)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	services_database_init_database (_tmp1_);
	_g_object_unref0 (_tmp1_);
}

static void
main_window_check_archived (MainWindow* self)
{
	WidgetsContextMenuMenuItem* _tmp0_;
	ServicesStore* _tmp1_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	WidgetsContextMenuMenuSeparator* _tmp6_;
	ServicesStore* _tmp7_;
	GeeArrayList* _tmp8_;
	GeeArrayList* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->archive_item;
	_tmp1_ = services_store_instance ();
	_tmp2_ = services_store_get_all_projects_archived (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
	_tmp5_ = _tmp4_;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, _tmp5_ > 0);
	_g_object_unref0 (_tmp3_);
	_tmp6_ = self->priv->archive_separator;
	_tmp7_ = services_store_instance ();
	_tmp8_ = services_store_get_all_projects_archived (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp9_);
	_tmp11_ = _tmp10_;
	gtk_widget_set_visible ((GtkWidget*) _tmp6_, _tmp11_ > 0);
	_g_object_unref0 (_tmp9_);
}

static void
main_window_add_inbox_view (MainWindow* self)
{
	ObjectsProject* inbox_project = NULL;
	ServicesStore* _tmp0_;
	ServicesSettings* _tmp1_;
	ServicesSettings* _tmp2_;
	GSettings* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	ObjectsProject* _tmp6_;
	ObjectsProject* _tmp7_;
	ObjectsProject* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_store_instance ();
	_tmp1_ = services_settings_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_->settings;
	_tmp4_ = g_settings_get_string (_tmp3_, "local-inbox-project-id");
	_tmp5_ = _tmp4_;
	_tmp6_ = services_store_get_project (_tmp0_, _tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	_g_object_unref0 (_tmp2_);
	inbox_project = _tmp7_;
	_tmp8_ = inbox_project;
	if (_tmp8_ != NULL) {
		ObjectsProject* _tmp9_;
		ViewsProject* _tmp10_;
		ViewsProject* _tmp11_;
		ObjectsProject* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		gchar* _tmp15_;
		_tmp9_ = inbox_project;
		_tmp10_ = main_window_add_project_view (self, _tmp9_);
		_tmp11_ = _tmp10_;
		_g_object_unref0 (_tmp11_);
		_tmp12_ = inbox_project;
		_tmp13_ = objects_base_object_get_id ((ObjectsBaseObject*) _tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = g_strdup (_tmp14_);
		_g_free0 (self->priv->previous_inbox_project_id);
		self->priv->previous_inbox_project_id = _tmp15_;
	}
	_g_object_unref0 (inbox_project);
}

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

static void
main_window_handle_inbox_project_change (MainWindow* self)
{
	const gchar* _tmp0_;
	ObjectsProject* old_project = NULL;
	ServicesStore* _tmp1_;
	const gchar* _tmp2_;
	ObjectsProject* _tmp3_;
	ObjectsProject* _tmp4_;
	gchar* old_view_id = NULL;
	ObjectsProject* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* current_visible = NULL;
	AdwViewStack* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->previous_inbox_project_id;
	if (g_strcmp0 (_tmp0_, "") == 0) {
		return;
	}
	_tmp1_ = services_store_instance ();
	_tmp2_ = self->priv->previous_inbox_project_id;
	_tmp3_ = services_store_get_project (_tmp1_, _tmp2_);
	old_project = _tmp3_;
	_tmp4_ = old_project;
	if (_tmp4_ == NULL) {
		_g_object_unref0 (old_project);
		return;
	}
	_tmp5_ = old_project;
	_tmp6_ = objects_project_get_view_id (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strdup (_tmp7_);
	old_view_id = _tmp8_;
	_tmp9_ = self->priv->views_stack;
	_tmp10_ = adw_view_stack_get_visible_child_name (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = g_strdup (_tmp11_);
	current_visible = _tmp12_;
	_tmp13_ = current_visible;
	_tmp14_ = old_view_id;
	if (g_strcmp0 (_tmp13_, _tmp14_) == 0) {
		GtkWidget* old_view = NULL;
		AdwViewStack* _tmp15_;
		const gchar* _tmp16_;
		GtkWidget* _tmp17_;
		GtkWidget* _tmp18_;
		GtkWidget* _tmp19_;
		_tmp15_ = self->priv->views_stack;
		_tmp16_ = old_view_id;
		_tmp17_ = adw_view_stack_get_child_by_name (_tmp15_, _tmp16_);
		_tmp18_ = _g_object_ref0 (_tmp17_);
		old_view = _tmp18_;
		_tmp19_ = old_view;
		if (_tmp19_ != NULL) {
			GtkWidget* _tmp33_;
			AdwViewStack* _tmp34_;
			GtkWidget* _tmp35_;
			{
				GeeArrayList* _item_list = NULL;
				GeeArrayList* _tmp20_;
				gint _item_size = 0;
				GeeArrayList* _tmp21_;
				gint _tmp22_;
				gint _tmp23_;
				gint _item_index = 0;
				_tmp20_ = self->priv->view_cache;
				_item_list = _tmp20_;
				_tmp21_ = _item_list;
				_tmp22_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp21_);
				_tmp23_ = _tmp22_;
				_item_size = _tmp23_;
				_item_index = -1;
				while (TRUE) {
					gint _tmp24_;
					gint _tmp25_;
					MainWindowViewCacheItem* item = NULL;
					GeeArrayList* _tmp26_;
					gpointer _tmp27_;
					MainWindowViewCacheItem* _tmp28_;
					const gchar* _tmp29_;
					const gchar* _tmp30_;
					_item_index = _item_index + 1;
					_tmp24_ = _item_index;
					_tmp25_ = _item_size;
					if (!(_tmp24_ < _tmp25_)) {
						break;
					}
					_tmp26_ = _item_list;
					_tmp27_ = gee_abstract_list_get ((GeeAbstractList*) _tmp26_, _item_index);
					item = (MainWindowViewCacheItem*) _tmp27_;
					_tmp28_ = item;
					_tmp29_ = _tmp28_->view_id;
					_tmp30_ = old_view_id;
					if (g_strcmp0 (_tmp29_, _tmp30_) == 0) {
						GeeArrayList* _tmp31_;
						MainWindowViewCacheItem* _tmp32_;
						_tmp31_ = self->priv->view_cache;
						_tmp32_ = item;
						gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp31_, _tmp32_);
						_main_window_view_cache_item_unref0 (item);
						break;
					}
					_main_window_view_cache_item_unref0 (item);
				}
			}
			_tmp33_ = old_view;
			main_window_cleanup_view (self, _tmp33_);
			_tmp34_ = self->priv->views_stack;
			_tmp35_ = old_view;
			adw_view_stack_remove (_tmp34_, _tmp35_);
		}
		main_window_add_inbox_view (self);
		_g_object_unref0 (old_view);
	}
	_g_free0 (current_visible);
	_g_free0 (old_view_id);
	_g_object_unref0 (old_project);
}

ViewsProject*
main_window_add_project_view (MainWindow* self,
                              ObjectsProject* project)
{
	ViewsProject* project_view = NULL;
	AdwViewStack* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GtkWidget* _tmp3_;
	ViewsProject* _tmp4_;
	ViewsProject* _tmp5_;
	AdwViewStack* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	ViewsProject* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (project != NULL, NULL);
	_tmp0_ = self->priv->views_stack;
	_tmp1_ = objects_project_get_view_id (project);
	_tmp2_ = _tmp1_;
	_tmp3_ = adw_view_stack_get_child_by_name (_tmp0_, _tmp2_);
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, VIEWS_TYPE_PROJECT, ViewsProject));
	project_view = _tmp4_;
	_tmp5_ = project_view;
	if (_tmp5_ == NULL) {
		ViewsProject* _tmp6_;
		AdwViewStack* _tmp7_;
		ViewsProject* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		ViewsProject* _tmp13_;
		_tmp6_ = views_project_new (project);
		g_object_ref_sink (_tmp6_);
		_g_object_unref0 (project_view);
		project_view = _tmp6_;
		_tmp7_ = self->priv->views_stack;
		_tmp8_ = project_view;
		_tmp9_ = objects_project_get_view_id (project);
		_tmp10_ = _tmp9_;
		adw_view_stack_add_named (_tmp7_, (GtkWidget*) _tmp8_, _tmp10_);
		_tmp11_ = objects_project_get_view_id (project);
		_tmp12_ = _tmp11_;
		_tmp13_ = project_view;
		main_window_add_view_to_cache (self, _tmp12_, (GtkWidget*) _tmp13_);
	} else {
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		_tmp14_ = objects_project_get_view_id (project);
		_tmp15_ = _tmp14_;
		main_window_update_view_access (self, _tmp15_);
	}
	_tmp16_ = self->priv->views_stack;
	_tmp17_ = objects_project_get_view_id (project);
	_tmp18_ = _tmp17_;
	adw_view_stack_set_visible_child_name (_tmp16_, _tmp18_);
	result = project_view;
	return result;
}

void
main_window_add_today_view (MainWindow* self)
{
	ViewsToday* today_view = NULL;
	AdwViewStack* _tmp0_;
	GtkWidget* _tmp1_;
	ViewsToday* _tmp2_;
	ViewsToday* _tmp3_;
	AdwViewStack* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->views_stack;
	_tmp1_ = adw_view_stack_get_child_by_name (_tmp0_, "today-view");
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, VIEWS_TYPE_TODAY, ViewsToday));
	today_view = _tmp2_;
	_tmp3_ = today_view;
	if (_tmp3_ == NULL) {
		ViewsToday* _tmp4_;
		AdwViewStack* _tmp5_;
		ViewsToday* _tmp6_;
		ViewsToday* _tmp7_;
		_tmp4_ = views_today_new ();
		g_object_ref_sink (_tmp4_);
		_g_object_unref0 (today_view);
		today_view = _tmp4_;
		_tmp5_ = self->priv->views_stack;
		_tmp6_ = today_view;
		adw_view_stack_add_named (_tmp5_, (GtkWidget*) _tmp6_, "today-view");
		_tmp7_ = today_view;
		main_window_add_view_to_cache (self, "today-view", (GtkWidget*) _tmp7_);
	} else {
		main_window_update_view_access (self, "today-view");
	}
	_tmp8_ = self->priv->views_stack;
	adw_view_stack_set_visible_child_name (_tmp8_, "today-view");
	_g_object_unref0 (today_view);
}

void
main_window_add_scheduled_view (MainWindow* self)
{
	ViewsScheduledScheduled* scheduled_view = NULL;
	AdwViewStack* _tmp0_;
	GtkWidget* _tmp1_;
	ViewsScheduledScheduled* _tmp2_;
	ViewsScheduledScheduled* _tmp3_;
	AdwViewStack* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->views_stack;
	_tmp1_ = adw_view_stack_get_child_by_name (_tmp0_, "scheduled-view");
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, VIEWS_SCHEDULED_TYPE_SCHEDULED, ViewsScheduledScheduled));
	scheduled_view = _tmp2_;
	_tmp3_ = scheduled_view;
	if (_tmp3_ == NULL) {
		ViewsScheduledScheduled* _tmp4_;
		AdwViewStack* _tmp5_;
		ViewsScheduledScheduled* _tmp6_;
		ViewsScheduledScheduled* _tmp7_;
		_tmp4_ = views_scheduled_scheduled_new ();
		g_object_ref_sink (_tmp4_);
		_g_object_unref0 (scheduled_view);
		scheduled_view = _tmp4_;
		_tmp5_ = self->priv->views_stack;
		_tmp6_ = scheduled_view;
		adw_view_stack_add_named (_tmp5_, (GtkWidget*) _tmp6_, "scheduled-view");
		_tmp7_ = scheduled_view;
		main_window_add_view_to_cache (self, "scheduled-view", (GtkWidget*) _tmp7_);
	} else {
		main_window_update_view_access (self, "scheduled-view");
	}
	_tmp8_ = self->priv->views_stack;
	adw_view_stack_set_visible_child_name (_tmp8_, "scheduled-view");
	_g_object_unref0 (scheduled_view);
}

void
main_window_add_labels_view (MainWindow* self)
{
	ViewsLabels* labels_view = NULL;
	AdwViewStack* _tmp0_;
	GtkWidget* _tmp1_;
	ViewsLabels* _tmp2_;
	ViewsLabels* _tmp3_;
	AdwViewStack* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->views_stack;
	_tmp1_ = adw_view_stack_get_child_by_name (_tmp0_, "labels-view");
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, VIEWS_TYPE_LABELS, ViewsLabels));
	labels_view = _tmp2_;
	_tmp3_ = labels_view;
	if (_tmp3_ == NULL) {
		ViewsLabels* _tmp4_;
		AdwViewStack* _tmp5_;
		ViewsLabels* _tmp6_;
		ViewsLabels* _tmp7_;
		_tmp4_ = views_labels_new ();
		g_object_ref_sink (_tmp4_);
		_g_object_unref0 (labels_view);
		labels_view = _tmp4_;
		_tmp5_ = self->priv->views_stack;
		_tmp6_ = labels_view;
		adw_view_stack_add_named (_tmp5_, (GtkWidget*) _tmp6_, "labels-view");
		_tmp7_ = labels_view;
		main_window_add_view_to_cache (self, "labels-view", (GtkWidget*) _tmp7_);
	} else {
		main_window_update_view_access (self, "labels-view");
	}
	_tmp8_ = self->priv->views_stack;
	adw_view_stack_set_visible_child_name (_tmp8_, "labels-view");
	_g_object_unref0 (labels_view);
}

static void
main_window_add_label_view (MainWindow* self,
                            const gchar* id)
{
	ViewsLabel* label_view = NULL;
	AdwViewStack* _tmp0_;
	GtkWidget* _tmp1_;
	ViewsLabel* _tmp2_;
	ViewsLabel* _tmp3_;
	ViewsLabel* _tmp8_;
	ServicesStore* _tmp9_;
	ObjectsLabel* _tmp10_;
	ObjectsLabel* _tmp11_;
	AdwViewStack* _tmp12_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	_tmp0_ = self->priv->views_stack;
	_tmp1_ = adw_view_stack_get_child_by_name (_tmp0_, "label-view");
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, VIEWS_TYPE_LABEL, ViewsLabel));
	label_view = _tmp2_;
	_tmp3_ = label_view;
	if (_tmp3_ == NULL) {
		ViewsLabel* _tmp4_;
		AdwViewStack* _tmp5_;
		ViewsLabel* _tmp6_;
		ViewsLabel* _tmp7_;
		_tmp4_ = views_label_new ();
		g_object_ref_sink (_tmp4_);
		_g_object_unref0 (label_view);
		label_view = _tmp4_;
		_tmp5_ = self->priv->views_stack;
		_tmp6_ = label_view;
		adw_view_stack_add_named (_tmp5_, (GtkWidget*) _tmp6_, "label-view");
		_tmp7_ = label_view;
		main_window_add_view_to_cache (self, "label-view", (GtkWidget*) _tmp7_);
	} else {
		main_window_update_view_access (self, "label-view");
	}
	_tmp8_ = label_view;
	_tmp9_ = services_store_instance ();
	_tmp10_ = services_store_get_label (_tmp9_, id);
	_tmp11_ = _tmp10_;
	views_label_set_label (_tmp8_, _tmp11_);
	_g_object_unref0 (_tmp11_);
	_tmp12_ = self->priv->views_stack;
	adw_view_stack_set_visible_child_name (_tmp12_, "label-view");
	_g_object_unref0 (label_view);
}

void
main_window_add_priority_view (MainWindow* self,
                               const gchar* view_id)
{
	ViewsFilter* filter_view = NULL;
	AdwViewStack* _tmp0_;
	GtkWidget* _tmp1_;
	ViewsFilter* _tmp2_;
	ViewsFilter* _tmp3_;
	AdwViewStack* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (view_id != NULL);
	_tmp0_ = self->priv->views_stack;
	_tmp1_ = adw_view_stack_get_child_by_name (_tmp0_, view_id);
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, VIEWS_TYPE_FILTER, ViewsFilter));
	filter_view = _tmp2_;
	_tmp3_ = filter_view;
	if (_tmp3_ == NULL) {
		gchar** _tmp4_;
		gchar** _tmp5_;
		gchar** _tmp6_;
		gint _tmp6__length1;
		const gchar* _tmp7_;
		ObjectsFiltersPriority* _tmp8_;
		ObjectsFiltersPriority* _tmp9_;
		ViewsFilter* _tmp10_;
		AdwViewStack* _tmp11_;
		ViewsFilter* _tmp12_;
		ViewsFilter* _tmp13_;
		_tmp5_ = _tmp4_ = g_strsplit (view_id, "-", 0);
		_tmp6_ = _tmp5_;
		_tmp6__length1 = _vala_array_length (_tmp4_);
		_tmp7_ = _tmp6_[1];
		_tmp8_ = objects_filters_priority_get_default (atoi (_tmp7_));
		_tmp9_ = _tmp8_;
		_tmp10_ = views_filter_new ((ObjectsBaseObject*) _tmp9_);
		g_object_ref_sink (_tmp10_);
		_g_object_unref0 (filter_view);
		filter_view = _tmp10_;
		_g_object_unref0 (_tmp9_);
		_tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
		_tmp11_ = self->priv->views_stack;
		_tmp12_ = filter_view;
		adw_view_stack_add_named (_tmp11_, (GtkWidget*) _tmp12_, view_id);
		_tmp13_ = filter_view;
		main_window_add_view_to_cache (self, view_id, (GtkWidget*) _tmp13_);
	} else {
		main_window_update_view_access (self, view_id);
	}
	_tmp14_ = self->priv->views_stack;
	adw_view_stack_set_visible_child_name (_tmp14_, view_id);
	_g_object_unref0 (filter_view);
}

static void
main_window_add_filter_view (MainWindow* self,
                             ObjectsBaseObject* base_object)
{
	ViewsFilter* filter_view = NULL;
	AdwViewStack* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GtkWidget* _tmp3_;
	ViewsFilter* _tmp4_;
	ViewsFilter* _tmp5_;
	AdwViewStack* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (base_object != NULL);
	_tmp0_ = self->priv->views_stack;
	_tmp1_ = objects_base_object_get_view_id (base_object);
	_tmp2_ = _tmp1_;
	_tmp3_ = adw_view_stack_get_child_by_name (_tmp0_, _tmp2_);
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, VIEWS_TYPE_FILTER, ViewsFilter));
	filter_view = _tmp4_;
	_tmp5_ = filter_view;
	if (_tmp5_ == NULL) {
		ViewsFilter* _tmp6_;
		AdwViewStack* _tmp7_;
		ViewsFilter* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		ViewsFilter* _tmp13_;
		_tmp6_ = views_filter_new (base_object);
		g_object_ref_sink (_tmp6_);
		_g_object_unref0 (filter_view);
		filter_view = _tmp6_;
		_tmp7_ = self->priv->views_stack;
		_tmp8_ = filter_view;
		_tmp9_ = objects_base_object_get_view_id (base_object);
		_tmp10_ = _tmp9_;
		adw_view_stack_add_named (_tmp7_, (GtkWidget*) _tmp8_, _tmp10_);
		_tmp11_ = objects_base_object_get_view_id (base_object);
		_tmp12_ = _tmp11_;
		_tmp13_ = filter_view;
		main_window_add_view_to_cache (self, _tmp12_, (GtkWidget*) _tmp13_);
	} else {
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		_tmp14_ = objects_base_object_get_view_id (base_object);
		_tmp15_ = _tmp14_;
		main_window_update_view_access (self, _tmp15_);
	}
	_tmp16_ = self->priv->views_stack;
	_tmp17_ = objects_base_object_get_view_id (base_object);
	_tmp18_ = _tmp17_;
	adw_view_stack_set_visible_child_name (_tmp16_, _tmp18_);
	_g_object_unref0 (filter_view);
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

void
main_window_go_homepage (MainWindow* self)
{
	gchar* home_page_id = NULL;
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_settings_get_string (_tmp1_, "home-view");
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	home_page_id = _tmp3_;
	_tmp4_ = home_page_id;
	if (g_str_has_prefix (_tmp4_, "project-")) {
		gchar* project_id = NULL;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gboolean _tmp7_ = FALSE;
		const gchar* _tmp8_;
		_tmp5_ = home_page_id;
		_tmp6_ = string_substring (_tmp5_, (glong) 8, (glong) -1);
		project_id = _tmp6_;
		_tmp8_ = project_id;
		if (_tmp8_ != NULL) {
			const gchar* _tmp9_;
			gint _tmp10_;
			gint _tmp11_;
			_tmp9_ = project_id;
			_tmp10_ = strlen (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp7_ = _tmp11_ > 0;
		} else {
			_tmp7_ = FALSE;
		}
		if (_tmp7_) {
			ServicesEventBus* _tmp12_;
			ServicesEventBus* _tmp13_;
			const gchar* _tmp14_;
			_tmp12_ = services_event_bus_get_default ();
			_tmp13_ = _tmp12_;
			_tmp14_ = project_id;
			g_signal_emit_by_name (_tmp13_, "pane-selected", PANE_TYPE_PROJECT, _tmp14_);
			_g_object_unref0 (_tmp13_);
		}
		_g_free0 (project_id);
	} else {
		ServicesEventBus* _tmp15_;
		ServicesEventBus* _tmp16_;
		const gchar* _tmp17_;
		_tmp15_ = services_event_bus_get_default ();
		_tmp16_ = _tmp15_;
		_tmp17_ = home_page_id;
		g_signal_emit_by_name (_tmp16_, "pane-selected", PANE_TYPE_FILTER, _tmp17_);
		_g_object_unref0 (_tmp16_);
	}
	_g_free0 (home_page_id);
}

void
main_window_view_item (MainWindow* self,
                       const gchar* id)
{
	ObjectsItem* item = NULL;
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	ObjectsItem* _tmp2_;
	ObjectsItem* _tmp3_;
	ServicesEventBus* _tmp4_;
	ServicesEventBus* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_get_item_by_id (_tmp1_, id);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	item = _tmp3_;
	_tmp4_ = services_event_bus_get_default ();
	_tmp5_ = _tmp4_;
	_tmp6_ = objects_item_get_project_id (item);
	_tmp7_ = _tmp6_;
	g_signal_emit_by_name (_tmp5_, "pane-selected", PANE_TYPE_PROJECT, _tmp7_);
	_g_object_unref0 (_tmp5_);
	_g_object_unref0 (item);
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		MainWindow* self;
		self = _data3_->self;
		_g_object_unref0 (_data3_->project_view);
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static gboolean
____lambda905_ (Block3Data* _data3_)
{
	MainWindow* self;
	ViewsProject* _tmp0_;
	ViewsProject* _tmp1_;
	AdwViewStack* _tmp2_;
	ViewsProject* _tmp3_;
	gboolean result;
	self = _data3_->self;
	_tmp0_ = _data3_->project_view;
	views_project_clean_up (_tmp0_);
	_tmp1_ = _data3_->project_view;
	g_signal_emit_by_name ((GtkWidget*) _tmp1_, "destroy");
	_tmp2_ = self->priv->views_stack;
	_tmp3_ = _data3_->project_view;
	adw_view_stack_remove (_tmp2_, (GtkWidget*) _tmp3_);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
_____lambda905__gsource_func (gpointer self)
{
	gboolean result;
	result = ____lambda905_ (self);
	return result;
}

void
main_window_valid_view_removed (MainWindow* self,
                                ObjectsProject* project)
{
	Block3Data* _data3_;
	AdwViewStack* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GtkWidget* _tmp3_;
	ViewsProject* _tmp4_;
	ViewsProject* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project != NULL);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_data3_->self = g_object_ref (self);
	_tmp0_ = self->priv->views_stack;
	_tmp1_ = objects_project_get_view_id (project);
	_tmp2_ = _tmp1_;
	_tmp3_ = adw_view_stack_get_child_by_name (_tmp0_, _tmp2_);
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, VIEWS_TYPE_PROJECT, ViewsProject));
	_data3_->project_view = _tmp4_;
	_tmp5_ = _data3_->project_view;
	if (_tmp5_ != NULL) {
		AdwViewStack* _tmp20_;
		GtkWidget* _tmp21_;
		GtkWidget* _tmp22_;
		ViewsProject* _tmp23_;
		{
			GeeArrayList* _item_list = NULL;
			GeeArrayList* _tmp6_;
			gint _item_size = 0;
			GeeArrayList* _tmp7_;
			gint _tmp8_;
			gint _tmp9_;
			gint _item_index = 0;
			_tmp6_ = self->priv->view_cache;
			_item_list = _tmp6_;
			_tmp7_ = _item_list;
			_tmp8_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp7_);
			_tmp9_ = _tmp8_;
			_item_size = _tmp9_;
			_item_index = -1;
			while (TRUE) {
				gint _tmp10_;
				gint _tmp11_;
				MainWindowViewCacheItem* item = NULL;
				GeeArrayList* _tmp12_;
				gpointer _tmp13_;
				MainWindowViewCacheItem* _tmp14_;
				const gchar* _tmp15_;
				const gchar* _tmp16_;
				const gchar* _tmp17_;
				_item_index = _item_index + 1;
				_tmp10_ = _item_index;
				_tmp11_ = _item_size;
				if (!(_tmp10_ < _tmp11_)) {
					break;
				}
				_tmp12_ = _item_list;
				_tmp13_ = gee_abstract_list_get ((GeeAbstractList*) _tmp12_, _item_index);
				item = (MainWindowViewCacheItem*) _tmp13_;
				_tmp14_ = item;
				_tmp15_ = _tmp14_->view_id;
				_tmp16_ = objects_project_get_view_id (project);
				_tmp17_ = _tmp16_;
				if (g_strcmp0 (_tmp15_, _tmp17_) == 0) {
					GeeArrayList* _tmp18_;
					MainWindowViewCacheItem* _tmp19_;
					_tmp18_ = self->priv->view_cache;
					_tmp19_ = item;
					gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp18_, _tmp19_);
					_main_window_view_cache_item_unref0 (item);
					break;
				}
				_main_window_view_cache_item_unref0 (item);
			}
		}
		_tmp20_ = self->priv->views_stack;
		_tmp21_ = adw_view_stack_get_visible_child (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = _data3_->project_view;
		if (_tmp22_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, gtk_widget_get_type (), GtkWidget)) {
			AdwViewStack* _tmp24_;
			guint _tmp25_;
			guint _tmp26_;
			main_window_go_homepage (self);
			_tmp24_ = self->priv->views_stack;
			_tmp25_ = adw_view_stack_get_transition_duration (_tmp24_);
			_tmp26_ = _tmp25_;
			g_timeout_add_full (G_PRIORITY_DEFAULT, _tmp26_, _____lambda905__gsource_func, block3_data_ref (_data3_), block3_data_unref);
		} else {
			ViewsProject* _tmp27_;
			ViewsProject* _tmp28_;
			AdwViewStack* _tmp29_;
			ViewsProject* _tmp30_;
			_tmp27_ = _data3_->project_view;
			views_project_clean_up (_tmp27_);
			_tmp28_ = _data3_->project_view;
			g_signal_emit_by_name ((GtkWidget*) _tmp28_, "destroy");
			_tmp29_ = self->priv->views_stack;
			_tmp30_ = _data3_->project_view;
			adw_view_stack_remove (_tmp29_, (GtkWidget*) _tmp30_);
		}
	}
	block3_data_unref (_data3_);
	_data3_ = NULL;
}

void
main_window_add_task_action (MainWindow* self,
                             const gchar* content)
{
	AdwViewStack* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content != NULL);
	_tmp0_ = self->priv->views_stack;
	_tmp1_ = adw_view_stack_get_visible_child_name (_tmp0_);
	_tmp2_ = _tmp1_;
	if (g_str_has_prefix (_tmp2_, "project")) {
		ViewsProject* project_view = NULL;
		AdwViewStack* _tmp3_;
		GtkWidget* _tmp4_;
		GtkWidget* _tmp5_;
		ViewsProject* _tmp6_;
		ViewsProject* _tmp7_;
		_tmp3_ = self->priv->views_stack;
		_tmp4_ = adw_view_stack_get_visible_child (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, VIEWS_TYPE_PROJECT, ViewsProject));
		project_view = _tmp6_;
		_tmp7_ = project_view;
		if (_tmp7_ != NULL) {
			ViewsProject* _tmp8_;
			_tmp8_ = project_view;
			views_project_prepare_new_item (_tmp8_, content);
		}
		_g_object_unref0 (project_view);
	} else {
		AdwViewStack* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp9_ = self->priv->views_stack;
		_tmp10_ = adw_view_stack_get_visible_child_name (_tmp9_);
		_tmp11_ = _tmp10_;
		if (g_str_has_prefix (_tmp11_, "today-view")) {
			ViewsToday* today_view = NULL;
			AdwViewStack* _tmp12_;
			GtkWidget* _tmp13_;
			GtkWidget* _tmp14_;
			ViewsToday* _tmp15_;
			ViewsToday* _tmp16_;
			_tmp12_ = self->priv->views_stack;
			_tmp13_ = adw_view_stack_get_visible_child (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, VIEWS_TYPE_TODAY, ViewsToday));
			today_view = _tmp15_;
			_tmp16_ = today_view;
			if (_tmp16_ != NULL) {
				ViewsToday* _tmp17_;
				_tmp17_ = today_view;
				views_today_prepare_new_item (_tmp17_, content);
			}
			_g_object_unref0 (today_view);
		} else {
			AdwViewStack* _tmp18_;
			const gchar* _tmp19_;
			const gchar* _tmp20_;
			_tmp18_ = self->priv->views_stack;
			_tmp19_ = adw_view_stack_get_visible_child_name (_tmp18_);
			_tmp20_ = _tmp19_;
			if (g_str_has_prefix (_tmp20_, "scheduled-view")) {
				ViewsScheduledScheduled* scheduled_view = NULL;
				AdwViewStack* _tmp21_;
				GtkWidget* _tmp22_;
				GtkWidget* _tmp23_;
				ViewsScheduledScheduled* _tmp24_;
				ViewsScheduledScheduled* _tmp25_;
				_tmp21_ = self->priv->views_stack;
				_tmp22_ = adw_view_stack_get_visible_child (_tmp21_);
				_tmp23_ = _tmp22_;
				_tmp24_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, VIEWS_SCHEDULED_TYPE_SCHEDULED, ViewsScheduledScheduled));
				scheduled_view = _tmp24_;
				_tmp25_ = scheduled_view;
				if (_tmp25_ != NULL) {
					ViewsScheduledScheduled* _tmp26_;
					_tmp26_ = scheduled_view;
					views_scheduled_scheduled_prepare_new_item (_tmp26_, content);
				}
				_g_object_unref0 (scheduled_view);
			} else {
				AdwViewStack* _tmp27_;
				const gchar* _tmp28_;
				const gchar* _tmp29_;
				_tmp27_ = self->priv->views_stack;
				_tmp28_ = adw_view_stack_get_visible_child_name (_tmp27_);
				_tmp29_ = _tmp28_;
				if (g_str_has_prefix (_tmp29_, "labels-view")) {
					ViewsLabels* labels_view = NULL;
					AdwViewStack* _tmp30_;
					GtkWidget* _tmp31_;
					GtkWidget* _tmp32_;
					ViewsLabels* _tmp33_;
					ViewsLabels* _tmp34_;
					_tmp30_ = self->priv->views_stack;
					_tmp31_ = adw_view_stack_get_visible_child (_tmp30_);
					_tmp32_ = _tmp31_;
					_tmp33_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp32_, VIEWS_TYPE_LABELS, ViewsLabels));
					labels_view = _tmp33_;
					_tmp34_ = labels_view;
					if (_tmp34_ != NULL) {
						ViewsLabels* _tmp35_;
						_tmp35_ = labels_view;
						views_labels_prepare_new_item (_tmp35_, content);
					}
					_g_object_unref0 (labels_view);
				} else {
					AdwViewStack* _tmp36_;
					const gchar* _tmp37_;
					const gchar* _tmp38_;
					_tmp36_ = self->priv->views_stack;
					_tmp37_ = adw_view_stack_get_visible_child_name (_tmp36_);
					_tmp38_ = _tmp37_;
					if (g_str_has_prefix (_tmp38_, "label-view")) {
						ViewsLabel* label_view = NULL;
						AdwViewStack* _tmp39_;
						GtkWidget* _tmp40_;
						GtkWidget* _tmp41_;
						ViewsLabel* _tmp42_;
						ViewsLabel* _tmp43_;
						_tmp39_ = self->priv->views_stack;
						_tmp40_ = adw_view_stack_get_visible_child (_tmp39_);
						_tmp41_ = _tmp40_;
						_tmp42_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp41_, VIEWS_TYPE_LABEL, ViewsLabel));
						label_view = _tmp42_;
						_tmp43_ = label_view;
						if (_tmp43_ != NULL) {
							ViewsLabel* _tmp44_;
							_tmp44_ = label_view;
							views_label_prepare_new_item (_tmp44_, content);
						}
						_g_object_unref0 (label_view);
					} else {
						ViewsFilter* filter_view = NULL;
						AdwViewStack* _tmp45_;
						GtkWidget* _tmp46_;
						GtkWidget* _tmp47_;
						ViewsFilter* _tmp48_;
						ViewsFilter* _tmp49_;
						_tmp45_ = self->priv->views_stack;
						_tmp46_ = adw_view_stack_get_visible_child (_tmp45_);
						_tmp47_ = _tmp46_;
						_tmp48_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp47_, VIEWS_TYPE_FILTER, ViewsFilter));
						filter_view = _tmp48_;
						_tmp49_ = filter_view;
						if (_tmp49_ != NULL) {
							ViewsFilter* _tmp50_;
							_tmp50_ = filter_view;
							views_filter_prepare_new_item (_tmp50_, content);
						} else {
							DialogsQuickAdd* dialog = NULL;
							DialogsQuickAdd* _tmp51_;
							DialogsQuickAdd* _tmp52_;
							DialogsQuickAdd* _tmp53_;
							Planify* _tmp54_;
							MainWindow* _tmp55_;
							_tmp51_ = dialogs_quick_add_new ();
							g_object_ref_sink (_tmp51_);
							dialog = _tmp51_;
							_tmp52_ = dialog;
							dialogs_quick_add_update_content (_tmp52_, content);
							_tmp53_ = dialog;
							_tmp54_ = planify__instance;
							_tmp55_ = _tmp54_->main_window;
							adw_dialog_present ((AdwDialog*) _tmp53_, (GtkWidget*) _tmp55_);
							_g_object_unref0 (dialog);
						}
						_g_object_unref0 (filter_view);
					}
				}
			}
		}
	}
}

void
main_window_new_section_action (MainWindow* self)
{
	AdwViewStack* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	AdwViewStack* _tmp3_;
	GtkWidget* _tmp4_;
	GtkWidget* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->views_stack;
	_tmp1_ = adw_view_stack_get_visible_child (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		return;
	}
	_tmp3_ = self->priv->views_stack;
	_tmp4_ = adw_view_stack_get_visible_child (_tmp3_);
	_tmp5_ = _tmp4_;
	if (VIEWS_IS_PROJECT (_tmp5_)) {
		ViewsProject* project_view = NULL;
		AdwViewStack* _tmp6_;
		GtkWidget* _tmp7_;
		GtkWidget* _tmp8_;
		ViewsProject* _tmp9_;
		ViewsProject* _tmp10_;
		_tmp6_ = self->priv->views_stack;
		_tmp7_ = adw_view_stack_get_visible_child (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, VIEWS_TYPE_PROJECT, ViewsProject));
		project_view = _tmp9_;
		_tmp10_ = project_view;
		if (_tmp10_ != NULL) {
			ViewsProject* _tmp11_;
			_tmp11_ = project_view;
			views_project_prepare_new_section (_tmp11_);
		}
		_g_object_unref0 (project_view);
	}
}

static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		MainWindow* self;
		self = _data4_->self;
		_g_object_unref0 (_data4_->popover);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static void
__lambda906_ (Block4Data* _data4_)
{
	MainWindow* self;
	DialogsProductivityReportProductivityReportDialog* dialog = NULL;
	DialogsProductivityReportProductivityReportDialog* _tmp0_;
	Planify* _tmp1_;
	MainWindow* _tmp2_;
	self = _data4_->self;
	gtk_popover_popdown (_data4_->popover);
	_tmp0_ = dialogs_productivity_report_productivity_report_dialog_new ();
	g_object_ref_sink (_tmp0_);
	dialog = _tmp0_;
	_tmp1_ = planify__instance;
	_tmp2_ = _tmp1_->main_window;
	adw_dialog_present ((AdwDialog*) dialog, (GtkWidget*) _tmp2_);
	_g_object_unref0 (dialog);
}

static void
___lambda906__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda906_ (self);
}

static void
__lambda931_ (MainWindow* self)
{
	main_window_open_preferences_window (self);
}

static void
___lambda931__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda931_ ((MainWindow*) self);
}

static void
__lambda932_ (MainWindow* self)
{
	main_window_about_dialog (self);
}

static void
___lambda932__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda932_ ((MainWindow*) self);
}

static void
__lambda933_ (MainWindow* self)
{
	main_window_open_shortcuts_window (self);
}

static void
___lambda933__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda933_ ((MainWindow*) self);
}

static void
__lambda934_ (MainWindow* self)
{
	DialogsManageProjects* dialog = NULL;
	DialogsManageProjects* _tmp0_;
	Planify* _tmp1_;
	MainWindow* _tmp2_;
	_tmp0_ = dialogs_manage_projects_new ();
	g_object_ref_sink (_tmp0_);
	dialog = _tmp0_;
	_tmp1_ = planify__instance;
	_tmp2_ = _tmp1_->main_window;
	adw_dialog_present ((AdwDialog*) dialog, (GtkWidget*) _tmp2_);
	_g_object_unref0 (dialog);
}

static void
___lambda934__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda934_ ((MainWindow*) self);
}

static GtkPopover*
main_window_build_menu_app (MainWindow* self)
{
	Block4Data* _data4_;
	WidgetsContextMenuMenuItem* preferences_item = NULL;
	WidgetsContextMenuMenuItem* _tmp0_;
	WidgetsContextMenuMenuItem* productivity_item = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	WidgetsContextMenuMenuItem* _tmp3_;
	WidgetsContextMenuMenuItem* _tmp4_;
	WidgetsContextMenuMenuItem* keyboard_shortcuts_item = NULL;
	WidgetsContextMenuMenuItem* _tmp5_;
	WidgetsContextMenuMenuItem* about_item = NULL;
	WidgetsContextMenuMenuItem* _tmp6_;
	WidgetsContextMenuMenuItem* _tmp7_;
	WidgetsContextMenuMenuSeparator* _tmp8_;
	GtkBox* menu_box = NULL;
	GtkBox* _tmp9_;
	WidgetsContextMenuMenuSeparator* _tmp10_;
	WidgetsContextMenuMenuSeparator* _tmp11_;
	WidgetsContextMenuMenuSeparator* _tmp12_;
	WidgetsContextMenuMenuSeparator* _tmp13_;
	WidgetsContextMenuMenuItem* _tmp14_;
	WidgetsContextMenuMenuSeparator* _tmp15_;
	GtkWidget* _tmp16_;
	GtkPopover* _tmp17_ = NULL;
	WidgetsContextMenuMenuItem* _tmp18_;
	GtkPopover* _tmp19_;
	GtkPopover* result;
	g_return_val_if_fail (self != NULL, NULL);
	_data4_ = g_slice_new0 (Block4Data);
	_data4_->_ref_count_ = 1;
	_data4_->self = g_object_ref (self);
	_tmp0_ = widgets_context_menu_menu_item_new (_ ("Preferences"), NULL);
	g_object_ref_sink (_tmp0_);
	preferences_item = _tmp0_;
	widgets_context_menu_menu_item_set_secondary_text (preferences_item, "Ctrl+,");
	_tmp1_ = g_markup_escape_text (_ ("Summary & Productivity"), (gssize) -1);
	_tmp2_ = _tmp1_;
	_tmp3_ = widgets_context_menu_menu_item_new (_tmp2_, NULL);
	g_object_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp2_);
	productivity_item = _tmp4_;
	_tmp5_ = widgets_context_menu_menu_item_new (_ ("Keyboard Shortcuts"), NULL);
	g_object_ref_sink (_tmp5_);
	keyboard_shortcuts_item = _tmp5_;
	widgets_context_menu_menu_item_set_secondary_text (keyboard_shortcuts_item, "F1");
	_tmp6_ = widgets_context_menu_menu_item_new (_ ("About Planify"), NULL);
	g_object_ref_sink (_tmp6_);
	about_item = _tmp6_;
	_tmp7_ = widgets_context_menu_menu_item_new (_ ("Archived Projects"), NULL);
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->archive_item);
	self->priv->archive_item = _tmp7_;
	_tmp8_ = widgets_context_menu_menu_separator_new ();
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->priv->archive_separator);
	self->priv->archive_separator = _tmp8_;
	_tmp9_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp9_);
	menu_box = _tmp9_;
	gtk_widget_set_margin_bottom ((GtkWidget*) menu_box, 3);
	gtk_widget_set_margin_top ((GtkWidget*) menu_box, 3);
	gtk_box_append (menu_box, (GtkWidget*) preferences_item);
	_tmp10_ = widgets_context_menu_menu_separator_new ();
	g_object_ref_sink (_tmp10_);
	_tmp11_ = _tmp10_;
	gtk_box_append (menu_box, (GtkWidget*) _tmp11_);
	_g_object_unref0 (_tmp11_);
	gtk_box_append (menu_box, (GtkWidget*) productivity_item);
	_tmp12_ = widgets_context_menu_menu_separator_new ();
	g_object_ref_sink (_tmp12_);
	_tmp13_ = _tmp12_;
	gtk_box_append (menu_box, (GtkWidget*) _tmp13_);
	_g_object_unref0 (_tmp13_);
	_tmp14_ = self->priv->archive_item;
	gtk_box_append (menu_box, (GtkWidget*) _tmp14_);
	_tmp15_ = self->priv->archive_separator;
	gtk_box_append (menu_box, (GtkWidget*) _tmp15_);
	gtk_box_append (menu_box, (GtkWidget*) keyboard_shortcuts_item);
	gtk_box_append (menu_box, (GtkWidget*) about_item);
	_tmp16_ = _g_object_ref0 ((GtkWidget*) menu_box);
	_tmp17_ = (GtkPopover*) gtk_popover_new ();
	gtk_popover_set_has_arrow (_tmp17_, TRUE);
	gtk_popover_set_child (_tmp17_, _tmp16_);
	_g_object_unref0 (_tmp16_);
	g_object_set ((GtkWidget*) _tmp17_, "width-request", 250, NULL);
	gtk_popover_set_position (_tmp17_, GTK_POS_BOTTOM);
	g_object_ref_sink (_tmp17_);
	_data4_->popover = _tmp17_;
	g_signal_connect_data ((GtkButton*) productivity_item, "clicked", (GCallback) ___lambda906__gtk_button_clicked, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
	g_signal_connect_object ((GtkButton*) preferences_item, "clicked", (GCallback) ___lambda931__gtk_button_clicked, self, 0);
	g_signal_connect_object ((GtkButton*) about_item, "clicked", (GCallback) ___lambda932__gtk_button_clicked, self, 0);
	g_signal_connect_object ((GtkButton*) keyboard_shortcuts_item, "clicked", (GCallback) ___lambda933__gtk_button_clicked, self, 0);
	_tmp18_ = self->priv->archive_item;
	g_signal_connect_object ((GtkButton*) _tmp18_, "clicked", (GCallback) ___lambda934__gtk_button_clicked, self, 0);
	_tmp19_ = _g_object_ref0 (_data4_->popover);
	result = _tmp19_;
	_g_object_unref0 (menu_box);
	_g_object_unref0 (about_item);
	_g_object_unref0 (keyboard_shortcuts_item);
	_g_object_unref0 (productivity_item);
	_g_object_unref0 (preferences_item);
	block4_data_unref (_data4_);
	_data4_ = NULL;
	return result;
}

void
main_window_open_shortcuts_window (MainWindow* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		GtkBuilder* shortcuts_builder = NULL;
		GtkBuilder* _tmp0_;
		GtkShortcutsWindow* shortcuts_window = NULL;
		GObject* _tmp1_;
		GtkShortcutsWindow* _tmp2_;
		GtkShortcutsWindow* _tmp3_;
		GtkShortcutsWindow* _tmp4_;
		_tmp0_ = gtk_builder_new ();
		shortcuts_builder = _tmp0_;
		gtk_builder_add_from_resource (shortcuts_builder, "/io/github/alainm23/planify/shortcuts.ui", &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (shortcuts_builder);
			goto __catch0_g_error;
		}
		_tmp1_ = gtk_builder_get_object (shortcuts_builder, "shortcuts-planify");
		_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_shortcuts_window_get_type (), GtkShortcutsWindow));
		shortcuts_window = _tmp2_;
		_tmp3_ = shortcuts_window;
		gtk_window_set_transient_for ((GtkWindow*) _tmp3_, (GtkWindow*) self);
		_tmp4_ = shortcuts_window;
		gtk_widget_show ((GtkWidget*) _tmp4_);
		_g_object_unref0 (shortcuts_window);
		_g_object_unref0 (shortcuts_builder);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		g_warning ("MainWindow.vala:812: Failed to open shortcuts window: %s\n", _tmp6_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

void
main_window_open_preferences_window (MainWindow* self)
{
	DialogsPreferencesPreferencesWindow* preferences_dialog = NULL;
	DialogsPreferencesPreferencesWindow* _tmp0_;
	Planify* _tmp1_;
	MainWindow* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = dialogs_preferences_preferences_window_new ();
	g_object_ref_sink (_tmp0_);
	preferences_dialog = _tmp0_;
	_tmp1_ = planify__instance;
	_tmp2_ = _tmp1_->main_window;
	adw_dialog_present ((AdwDialog*) preferences_dialog, (GtkWidget*) _tmp2_);
	_g_object_unref0 (preferences_dialog);
}

static Block5Data*
block5_data_ref (Block5Data* _data5_)
{
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		MainWindow* self;
		self = _data5_->self;
		_g_free0 (_data5_->error_message);
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}

static void
__lambda946_ (Block5Data* _data5_)
{
	MainWindow* self;
	DialogsErrorDialog* _tmp0_;
	DialogsErrorDialog* _tmp1_;
	self = _data5_->self;
	_tmp0_ = dialogs_error_dialog_new (_data5_->error_code, _data5_->error_message);
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	adw_dialog_present ((AdwDialog*) _tmp1_, (GtkWidget*) self);
	_g_object_unref0 (_tmp1_);
}

static void
___lambda946__adw_toast_button_clicked (AdwToast* _sender,
                                        gpointer self)
{
	__lambda946_ (self);
}

void
main_window_send_toast_error (MainWindow* self,
                              gint error_code,
                              const gchar* error_message)
{
	Block5Data* _data5_;
	gchar* _tmp0_;
	AdwToast* toast = NULL;
	AdwToast* _tmp1_;
	AdwToastOverlay* _tmp2_;
	AdwToast* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (error_message != NULL);
	_data5_ = g_slice_new0 (Block5Data);
	_data5_->_ref_count_ = 1;
	_data5_->self = g_object_ref (self);
	_data5_->error_code = error_code;
	_tmp0_ = g_strdup (error_message);
	_g_free0 (_data5_->error_message);
	_data5_->error_message = _tmp0_;
	_tmp1_ = adw_toast_new (_ ("Oops! Something happened"));
	toast = _tmp1_;
	adw_toast_set_timeout (toast, (guint) 3);
	adw_toast_set_priority (toast, ADW_TOAST_PRIORITY_HIGH);
	adw_toast_set_button_label (toast, _ ("See More"));
	g_signal_connect_data (toast, "button-clicked", (GCallback) ___lambda946__adw_toast_button_clicked, block5_data_ref (_data5_), (GClosureNotify) block5_data_unref, 0);
	_tmp2_ = self->priv->toast_overlay;
	_tmp3_ = _g_object_ref0 (toast);
	adw_toast_overlay_add_toast (_tmp2_, _tmp3_);
	_g_object_unref0 (toast);
	block5_data_unref (_data5_);
	_data5_ = NULL;
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		MainWindow* self;
		self = _data6_->self;
		_g_object_unref0 (_data6_->project);
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static void
__lambda947_ (Block6Data* _data6_)
{
	MainWindow* self;
	ObjectsProject* _tmp0_;
	ObjectsProject* _tmp1_;
	self = _data6_->self;
	_tmp0_ = _data6_->project;
	objects_project_set_show_completed (_tmp0_, TRUE);
	_tmp1_ = _data6_->project;
	objects_project_update_local (_tmp1_);
}

static void
___lambda947__adw_toast_button_clicked (AdwToast* _sender,
                                        gpointer self)
{
	__lambda947_ (self);
}

void
main_window_show_task_completed_toast (MainWindow* self,
                                       const gchar* project_id)
{
	Block6Data* _data6_;
	ServicesStore* _tmp0_;
	ObjectsProject* _tmp1_;
	ObjectsProject* _tmp2_;
	AdwToast* toast = NULL;
	AdwToast* _tmp3_;
	AdwToast* _tmp4_;
	AdwToast* _tmp5_;
	AdwToast* _tmp6_;
	AdwToastOverlay* _tmp7_;
	AdwToast* _tmp8_;
	AdwToast* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (project_id != NULL);
	_data6_ = g_slice_new0 (Block6Data);
	_data6_->_ref_count_ = 1;
	_data6_->self = g_object_ref (self);
	_tmp0_ = services_store_instance ();
	_tmp1_ = services_store_get_project (_tmp0_, project_id);
	_data6_->project = _tmp1_;
	_tmp2_ = _data6_->project;
	if (_tmp2_ == NULL) {
		block6_data_unref (_data6_);
		_data6_ = NULL;
		return;
	}
	_tmp3_ = adw_toast_new (_ ("Task completed"));
	toast = _tmp3_;
	_tmp4_ = toast;
	adw_toast_set_button_label (_tmp4_, _ ("View"));
	_tmp5_ = toast;
	adw_toast_set_timeout (_tmp5_, (guint) 3);
	_tmp6_ = toast;
	g_signal_connect_data (_tmp6_, "button-clicked", (GCallback) ___lambda947__adw_toast_button_clicked, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp7_ = self->priv->toast_overlay;
	_tmp8_ = toast;
	_tmp9_ = _g_object_ref0 (_tmp8_);
	adw_toast_overlay_add_toast (_tmp7_, _tmp9_);
	_g_object_unref0 (toast);
	block6_data_unref (_data6_);
	_data6_ = NULL;
}

static void
main_window_about_dialog (MainWindow* self)
{
	AdwAboutDialog* dialog = NULL;
	AdwAboutDialog* _tmp2_;
	AdwAboutDialog* _tmp3_;
	AdwAboutDialog* _tmp4_;
	AdwAboutDialog* _tmp5_;
	gchar* _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	AdwAboutDialog* _tmp9_;
	AdwAboutDialog* _tmp10_;
	gchar* _tmp11_;
	gchar** _tmp12_;
	gchar** _tmp13_;
	gint _tmp13__length1;
	AdwAboutDialog* _tmp14_;
	AdwAboutDialog* _tmp15_;
	Planify* _tmp16_;
	MainWindow* _tmp17_;
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (BUILD_PROFILE, "development") == 0) {
		AdwAboutDialog* _tmp0_;
		_tmp0_ = (AdwAboutDialog*) adw_about_dialog_new ();
		g_object_ref_sink (_tmp0_);
		_g_object_unref0 (dialog);
		dialog = _tmp0_;
	} else {
		AdwAboutDialog* _tmp1_;
		_tmp1_ = (AdwAboutDialog*) adw_about_dialog_new_from_appdata ("/io/github/alainm23/planify/" BUILD_APPLICATION_ID ".metainfo.xml.in.in", BUILD_VERSION);
		g_object_ref_sink (_tmp1_);
		_g_object_unref0 (dialog);
		dialog = _tmp1_;
	}
	_tmp2_ = dialog;
	adw_about_dialog_set_application_icon (_tmp2_, BUILD_APPLICATION_ID);
	_tmp3_ = dialog;
	adw_about_dialog_set_application_name (_tmp3_, "Planify");
	_tmp4_ = dialog;
	adw_about_dialog_set_developer_name (_tmp4_, "Alain");
	_tmp5_ = dialog;
	_tmp6_ = g_strdup ("Alain");
	_tmp7_ = g_new0 (gchar*, 1 + 1);
	_tmp7_[0] = _tmp6_;
	_tmp8_ = _tmp7_;
	_tmp8__length1 = 1;
	adw_about_dialog_set_designers (_tmp5_, _tmp8_);
	_tmp8_ = (_vala_array_free (_tmp8_, _tmp8__length1, (GDestroyNotify) g_free), NULL);
	_tmp9_ = dialog;
	adw_about_dialog_set_website (_tmp9_, "https://github.com/alainm23/planify");
	_tmp10_ = dialog;
	_tmp11_ = g_strdup ("Alain");
	_tmp12_ = g_new0 (gchar*, 1 + 1);
	_tmp12_[0] = _tmp11_;
	_tmp13_ = _tmp12_;
	_tmp13__length1 = 1;
	adw_about_dialog_set_developers (_tmp10_, _tmp13_);
	_tmp13_ = (_vala_array_free (_tmp13_, _tmp13__length1, (GDestroyNotify) g_free), NULL);
	_tmp14_ = dialog;
	adw_about_dialog_set_issue_url (_tmp14_, "https://github.com/alainm23/planify/issues");
	_tmp15_ = dialog;
	_tmp16_ = planify__instance;
	_tmp17_ = _tmp16_->main_window;
	adw_dialog_present ((AdwDialog*) _tmp15_, (GtkWidget*) _tmp17_);
	_g_object_unref0 (dialog);
}

static gboolean
__lambda949_ (MainWindow* self)
{
	gboolean result;
	main_window_init_backend (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda949__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda949_ ((MainWindow*) self);
	return result;
}

static void
__lambda948_ (MainWindow* self)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	ServicesSettings* _tmp2_;
	ServicesSettings* _tmp3_;
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	services_database_clear_database (_tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = services_settings_get_default ();
	_tmp3_ = _tmp2_;
	services_settings_reset_settings (_tmp3_);
	_g_object_unref0 (_tmp3_);
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 250, ___lambda949__gsource_func, g_object_ref (self), g_object_unref);
}

static void
___lambda948__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda948_ ((MainWindow*) self);
}

static GtkWidget*
main_window_build_error_db_page (MainWindow* self)
{
	AdwHeaderBar* headerbar = NULL;
	AdwHeaderBar* _tmp0_;
	AdwStatusPage* status_page = NULL;
	AdwStatusPage* _tmp1_;
	GtkButton* reset_button = NULL;
	GtkButton* _tmp2_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp3_ = NULL;
	AdwToolbarView* toolbar_view = NULL;
	GtkWidget* _tmp4_;
	AdwToolbarView* _tmp5_ = NULL;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (AdwHeaderBar*) adw_header_bar_new ();
	g_object_ref_sink (_tmp0_);
	headerbar = _tmp0_;
	_tmp1_ = (AdwStatusPage*) adw_status_page_new ();
	g_object_ref_sink (_tmp1_);
	status_page = _tmp1_;
	adw_status_page_set_icon_name (status_page, "process-error-symbolic");
	adw_status_page_set_title (status_page, _ ("Database Integrity Check Failed"));
	adw_status_page_set_description (status_page, _ ("We've detected issues with the database structure that may prevent the" \
" application from functioning properly. This may be due to missing tab" \
"les or columns, likely caused by data corruption or an incomplete upda" \
"te.\n" \
"\n" \
"The database will now be reset to restore normal functionality, and an" \
"y existing data will be removed.\n" \
"\n" \
"After the reset, you’ll be able to restore any backup you’ve created p" \
"reviously. Thank you for your patience"));
	_tmp2_ = (GtkButton*) gtk_button_new_with_label (_ ("Reset Database"));
	gtk_widget_set_halign ((GtkWidget*) _tmp2_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp2_);
	reset_button = _tmp2_;
	gtk_widget_add_css_class ((GtkWidget*) reset_button, "destructive-action");
	gtk_widget_add_css_class ((GtkWidget*) reset_button, "pill");
	_tmp3_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
	gtk_widget_set_valign ((GtkWidget*) _tmp3_, GTK_ALIGN_CENTER);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp3_, 32);
	g_object_ref_sink (_tmp3_);
	box = _tmp3_;
	gtk_box_append (box, (GtkWidget*) status_page);
	gtk_box_append (box, (GtkWidget*) reset_button);
	_tmp4_ = _g_object_ref0 ((GtkWidget*) box);
	_tmp5_ = (AdwToolbarView*) adw_toolbar_view_new ();
	adw_toolbar_view_set_content (_tmp5_, _tmp4_);
	_g_object_unref0 (_tmp4_);
	g_object_ref_sink (_tmp5_);
	toolbar_view = _tmp5_;
	adw_toolbar_view_add_top_bar (toolbar_view, (GtkWidget*) headerbar);
	g_signal_connect_object (reset_button, "clicked", (GCallback) ___lambda948__gtk_button_clicked, self, 0);
	result = (GtkWidget*) toolbar_view;
	_g_object_unref0 (box);
	_g_object_unref0 (reset_button);
	_g_object_unref0 (status_page);
	_g_object_unref0 (headerbar);
	return result;
}

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		MainWindow* self;
		self = _data7_->self;
		_g_object_unref0 (_data7_->network_monitor);
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}

static gchar*
bool_to_string (gboolean self)
{
	gchar* result;
	if (self) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("true");
		result = _tmp0_;
		return result;
	} else {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("false");
		result = _tmp1_;
		return result;
	}
}

static gboolean
__lambda951_ (Block7Data* _data7_)
{
	MainWindow* self;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gboolean result;
	self = _data7_->self;
	_data7_->network_timeout_id = (guint) 0;
	_tmp0_ = services_log_service_get_default ();
	_tmp1_ = _tmp0_;
	services_log_service_info (_tmp1_, "NetworkMonitor", "Network stable, triggering sync for all sources");
	_g_object_unref0 (_tmp1_);
	{
		GeeArrayList* _source_list = NULL;
		ServicesStore* _tmp2_;
		GeeArrayList* _tmp3_;
		GeeArrayList* _tmp4_;
		gint _source_size = 0;
		GeeArrayList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _source_index = 0;
		_tmp2_ = services_store_instance ();
		_tmp3_ = services_store_get_sources (_tmp2_);
		_tmp4_ = _tmp3_;
		_source_list = _tmp4_;
		_tmp5_ = _source_list;
		_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_source_size = _tmp7_;
		_source_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			ObjectsSource* source = NULL;
			GeeArrayList* _tmp10_;
			gpointer _tmp11_;
			ServicesLogService* _tmp12_;
			ServicesLogService* _tmp13_;
			ObjectsSource* _tmp14_;
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			gchar* _tmp17_;
			gchar* _tmp18_;
			ObjectsSource* _tmp19_;
			_source_index = _source_index + 1;
			_tmp8_ = _source_index;
			_tmp9_ = _source_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _source_list;
			_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _source_index);
			source = (ObjectsSource*) _tmp11_;
			_tmp12_ = services_log_service_get_default ();
			_tmp13_ = _tmp12_;
			_tmp14_ = source;
			_tmp15_ = objects_source_get_display_name (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = g_strdup_printf ("Triggering sync for source: %s", _tmp16_);
			_tmp18_ = _tmp17_;
			services_log_service_debug (_tmp13_, "NetworkMonitor", _tmp18_);
			_g_free0 (_tmp18_);
			_g_object_unref0 (_tmp13_);
			_tmp19_ = source;
			objects_source_run_server (_tmp19_, FALSE);
			_g_object_unref0 (source);
		}
	}
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda951__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda951_ (self);
	return result;
}

static void
__lambda950_ (Block7Data* _data7_)
{
	MainWindow* self;
	gboolean available = FALSE;
	ServicesLogService* _tmp0_;
	ServicesLogService* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	self = _data7_->self;
	available = g_network_monitor_get_network_available (_data7_->network_monitor);
	_tmp0_ = services_log_service_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = bool_to_string (available);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup_printf ("Network changed — available: %s", _tmp3_);
	_tmp5_ = _tmp4_;
	services_log_service_info (_tmp1_, "NetworkMonitor", _tmp5_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_g_object_unref0 (_tmp1_);
	if (self->priv->_did_startup_sync == FALSE) {
		ServicesLogService* _tmp6_;
		ServicesLogService* _tmp7_;
		_tmp6_ = services_log_service_get_default ();
		_tmp7_ = _tmp6_;
		services_log_service_debug (_tmp7_, "NetworkMonitor", "Ignoring early network change (startup sync not done yet)");
		_g_object_unref0 (_tmp7_);
		return;
	}
	if (!available) {
		ServicesLogService* _tmp8_;
		ServicesLogService* _tmp9_;
		_tmp8_ = services_log_service_get_default ();
		_tmp9_ = _tmp8_;
		services_log_service_info (_tmp9_, "NetworkMonitor", "Network unavailable, skipping sync");
		_g_object_unref0 (_tmp9_);
		if (_data7_->network_timeout_id != ((guint) 0)) {
			g_source_remove (_data7_->network_timeout_id);
			_data7_->network_timeout_id = (guint) 0;
		}
		return;
	}
	if (_data7_->network_timeout_id != ((guint) 0)) {
		g_source_remove (_data7_->network_timeout_id);
	}
	_data7_->network_timeout_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 3, ___lambda951__gsource_func, block7_data_ref (_data7_), block7_data_unref);
}

static void
___lambda950__g_network_monitor_network_changed (GNetworkMonitor* _sender,
                                                 gboolean network_available,
                                                 gpointer self)
{
	__lambda950_ (self);
}

static void
main_window_setup_network_monitor (MainWindow* self)
{
	Block7Data* _data7_;
	GNetworkMonitor* _tmp0_;
	GNetworkMonitor* _tmp1_;
	g_return_if_fail (self != NULL);
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->self = g_object_ref (self);
	_data7_->network_timeout_id = (guint) 0;
	_tmp0_ = g_network_monitor_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_data7_->network_monitor = _tmp1_;
	g_signal_connect_data (_data7_->network_monitor, "network-changed", (GCallback) ___lambda950__g_network_monitor_network_changed, block7_data_ref (_data7_), (GClosureNotify) block7_data_unref, 0);
	block7_data_unref (_data7_);
	_data7_ = NULL;
}

static void
main_window_cleanup_unused_views (MainWindow* self)
{
	gint64 current_time = 0LL;
	gchar* current_view = NULL;
	AdwViewStack* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	GeeArrayList* to_remove = NULL;
	GeeArrayList* _tmp4_;
	g_return_if_fail (self != NULL);
	current_time = g_get_monotonic_time ();
	_tmp0_ = self->priv->views_stack;
	_tmp1_ = adw_view_stack_get_visible_child_name (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	current_view = _tmp3_;
	_tmp4_ = gee_array_list_new (MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM, (GBoxedCopyFunc) main_window_view_cache_item_ref, (GDestroyNotify) main_window_view_cache_item_unref, NULL, NULL, NULL);
	to_remove = _tmp4_;
	{
		GeeArrayList* _item_list = NULL;
		GeeArrayList* _tmp5_;
		gint _item_size = 0;
		GeeArrayList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _item_index = 0;
		_tmp5_ = self->priv->view_cache;
		_item_list = _tmp5_;
		_tmp6_ = _item_list;
		_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_item_size = _tmp8_;
		_item_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			MainWindowViewCacheItem* item = NULL;
			GeeArrayList* _tmp11_;
			gpointer _tmp12_;
			gboolean _tmp13_ = FALSE;
			MainWindowViewCacheItem* _tmp14_;
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			_item_index = _item_index + 1;
			_tmp9_ = _item_index;
			_tmp10_ = _item_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _item_list;
			_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp11_, _item_index);
			item = (MainWindowViewCacheItem*) _tmp12_;
			_tmp14_ = item;
			_tmp15_ = _tmp14_->view_id;
			_tmp16_ = current_view;
			if (g_strcmp0 (_tmp15_, _tmp16_) != 0) {
				MainWindowViewCacheItem* _tmp17_;
				MainWindowViewCacheItem* _tmp18_;
				const gchar* _tmp19_;
				_tmp17_ = item;
				_tmp18_ = item;
				_tmp19_ = _tmp18_->view_id;
				_tmp13_ = (current_time - _tmp17_->last_access) > main_window_get_timeout_for_view (self, _tmp19_);
			} else {
				_tmp13_ = FALSE;
			}
			if (_tmp13_) {
				GeeArrayList* _tmp20_;
				MainWindowViewCacheItem* _tmp21_;
				_tmp20_ = to_remove;
				_tmp21_ = item;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp20_, _tmp21_);
			}
			_main_window_view_cache_item_unref0 (item);
		}
	}
	{
		GeeArrayList* _item_list = NULL;
		GeeArrayList* _tmp22_;
		gint _item_size = 0;
		GeeArrayList* _tmp23_;
		gint _tmp24_;
		gint _tmp25_;
		gint _item_index = 0;
		_tmp22_ = to_remove;
		_item_list = _tmp22_;
		_tmp23_ = _item_list;
		_tmp24_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp23_);
		_tmp25_ = _tmp24_;
		_item_size = _tmp25_;
		_item_index = -1;
		while (TRUE) {
			gint _tmp26_;
			gint _tmp27_;
			MainWindowViewCacheItem* item = NULL;
			GeeArrayList* _tmp28_;
			gpointer _tmp29_;
			MainWindowViewCacheItem* _tmp30_;
			GtkWidget* _tmp31_;
			AdwViewStack* _tmp32_;
			MainWindowViewCacheItem* _tmp33_;
			GtkWidget* _tmp34_;
			GeeArrayList* _tmp35_;
			MainWindowViewCacheItem* _tmp36_;
			_item_index = _item_index + 1;
			_tmp26_ = _item_index;
			_tmp27_ = _item_size;
			if (!(_tmp26_ < _tmp27_)) {
				break;
			}
			_tmp28_ = _item_list;
			_tmp29_ = gee_abstract_list_get ((GeeAbstractList*) _tmp28_, _item_index);
			item = (MainWindowViewCacheItem*) _tmp29_;
			_tmp30_ = item;
			_tmp31_ = _tmp30_->view;
			main_window_cleanup_view (self, _tmp31_);
			_tmp32_ = self->priv->views_stack;
			_tmp33_ = item;
			_tmp34_ = _tmp33_->view;
			adw_view_stack_remove (_tmp32_, _tmp34_);
			_tmp35_ = self->priv->view_cache;
			_tmp36_ = item;
			gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp35_, _tmp36_);
			_main_window_view_cache_item_unref0 (item);
		}
	}
	_g_object_unref0 (to_remove);
	_g_free0 (current_view);
}

static gint64
main_window_get_timeout_for_view (MainWindow* self,
                                  const gchar* view_id)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	g_return_val_if_fail (view_id != NULL, -1LL);
	if (g_str_has_prefix (view_id, "project-")) {
		result = (gint64) 600000000;
		return result;
	}
	if (g_strcmp0 (view_id, "today-view") == 0) {
		result = (gint64) 180000000;
		return result;
	}
	result = MAIN_WINDOW_VIEW_TIMEOUT;
	return result;
}

static void
main_window_cleanup_view (MainWindow* self,
                          GtkWidget* view)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (view != NULL);
	if (VIEWS_IS_PROJECT (view)) {
		views_project_clean_up (G_TYPE_CHECK_INSTANCE_CAST (view, VIEWS_TYPE_PROJECT, ViewsProject));
	} else {
		if (VIEWS_IS_TODAY (view)) {
			views_today_clean_up (G_TYPE_CHECK_INSTANCE_CAST (view, VIEWS_TYPE_TODAY, ViewsToday));
		} else {
			if (VIEWS_SCHEDULED_IS_SCHEDULED (view)) {
				views_scheduled_scheduled_clean_up (G_TYPE_CHECK_INSTANCE_CAST (view, VIEWS_SCHEDULED_TYPE_SCHEDULED, ViewsScheduledScheduled));
			} else {
				if (VIEWS_IS_FILTER (view)) {
					views_filter_clean_up (G_TYPE_CHECK_INSTANCE_CAST (view, VIEWS_TYPE_FILTER, ViewsFilter));
				} else {
					if (VIEWS_IS_LABEL (view)) {
						views_label_clean_up (G_TYPE_CHECK_INSTANCE_CAST (view, VIEWS_TYPE_LABEL, ViewsLabel));
					} else {
						if (VIEWS_IS_LABELS (view)) {
							views_labels_clean_up (G_TYPE_CHECK_INSTANCE_CAST (view, VIEWS_TYPE_LABELS, ViewsLabels));
						}
					}
				}
			}
		}
	}
}

static void
main_window_update_view_access (MainWindow* self,
                                const gchar* view_id)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (view_id != NULL);
	{
		GeeArrayList* _item_list = NULL;
		GeeArrayList* _tmp0_;
		gint _item_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _item_index = 0;
		_tmp0_ = self->priv->view_cache;
		_item_list = _tmp0_;
		_tmp1_ = _item_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_item_size = _tmp3_;
		_item_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			MainWindowViewCacheItem* item = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			MainWindowViewCacheItem* _tmp8_;
			const gchar* _tmp9_;
			_item_index = _item_index + 1;
			_tmp4_ = _item_index;
			_tmp5_ = _item_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _item_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _item_index);
			item = (MainWindowViewCacheItem*) _tmp7_;
			_tmp8_ = item;
			_tmp9_ = _tmp8_->view_id;
			if (g_strcmp0 (_tmp9_, view_id) == 0) {
				MainWindowViewCacheItem* _tmp10_;
				_tmp10_ = item;
				main_window_view_cache_item_update_access (_tmp10_);
				_main_window_view_cache_item_unref0 (item);
				break;
			}
			_main_window_view_cache_item_unref0 (item);
		}
	}
}

static void
main_window_add_view_to_cache (MainWindow* self,
                               const gchar* view_id,
                               GtkWidget* view)
{
	GeeArrayList* _tmp0_;
	MainWindowViewCacheItem* _tmp1_;
	MainWindowViewCacheItem* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (view_id != NULL);
	g_return_if_fail (view != NULL);
	_tmp0_ = self->priv->view_cache;
	_tmp1_ = main_window_view_cache_item_new (view_id, view);
	_tmp2_ = _tmp1_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp2_);
	_main_window_view_cache_item_unref0 (_tmp2_);
}

Planify*
main_window_get_app (MainWindow* self)
{
	Planify* result;
	Planify* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_app;
	result = _tmp0_;
	return result;
}

static void
main_window_set_app (MainWindow* self,
                     Planify* value)
{
	Planify* old_value;
	g_return_if_fail (self != NULL);
	old_value = main_window_get_app (self);
	if (old_value != value) {
		self->priv->_app = value;
		g_object_notify_by_pspec ((GObject *) self, main_window_properties[MAIN_WINDOW_APP_PROPERTY]);
	}
}

static MainWindowViewCacheItem*
main_window_view_cache_item_construct (GType object_type,
                                       const gchar* id,
                                       GtkWidget* widget)
{
	MainWindowViewCacheItem* self = NULL;
	gchar* _tmp0_;
	GtkWidget* _tmp1_;
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (widget != NULL, NULL);
	self = (MainWindowViewCacheItem*) g_type_create_instance (object_type);
	_tmp0_ = g_strdup (id);
	_g_free0 (self->view_id);
	self->view_id = _tmp0_;
	_tmp1_ = _g_object_ref0 (widget);
	_g_object_unref0 (self->view);
	self->view = _tmp1_;
	self->last_access = g_get_monotonic_time ();
	return self;
}

static MainWindowViewCacheItem*
main_window_view_cache_item_new (const gchar* id,
                                 GtkWidget* widget)
{
	return main_window_view_cache_item_construct (MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM, id, widget);
}

static void
main_window_view_cache_item_update_access (MainWindowViewCacheItem* self)
{
	g_return_if_fail (self != NULL);
	self->last_access = g_get_monotonic_time ();
}

static void
main_window_value_view_cache_item_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
main_window_value_view_cache_item_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		main_window_view_cache_item_unref (value->data[0].v_pointer);
	}
}

static void
main_window_value_view_cache_item_copy_value (const GValue* src_value,
                                              GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = main_window_view_cache_item_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
main_window_value_view_cache_item_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
main_window_value_view_cache_item_collect_value (GValue* value,
                                                 guint n_collect_values,
                                                 GTypeCValue* collect_values,
                                                 guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		MainWindowViewCacheItem * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = main_window_view_cache_item_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
main_window_value_view_cache_item_lcopy_value (const GValue* value,
                                               guint n_collect_values,
                                               GTypeCValue* collect_values,
                                               guint collect_flags)
{
	MainWindowViewCacheItem ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = main_window_view_cache_item_ref (value->data[0].v_pointer);
	}
	return NULL;
}

static GParamSpec*
main_window_param_spec_view_cache_item (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags)
{
	MainWindowParamSpecViewCacheItem* spec;
	g_return_val_if_fail (g_type_is_a (object_type, MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

static gpointer
main_window_value_get_view_cache_item (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM), NULL);
	return value->data[0].v_pointer;
}

static void
main_window_value_set_view_cache_item (GValue* value,
                                       gpointer v_object)
{
	MainWindowViewCacheItem * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		main_window_view_cache_item_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		main_window_view_cache_item_unref (old);
	}
}

static void
main_window_value_take_view_cache_item (GValue* value,
                                        gpointer v_object)
{
	MainWindowViewCacheItem * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		main_window_view_cache_item_unref (old);
	}
}

static void
main_window_view_cache_item_class_init (MainWindowViewCacheItemClass * klass,
                                        gpointer klass_data)
{
	main_window_view_cache_item_parent_class = g_type_class_peek_parent (klass);
	((MainWindowViewCacheItemClass *) klass)->finalize = main_window_view_cache_item_finalize;
}

static void
main_window_view_cache_item_instance_init (MainWindowViewCacheItem * self,
                                           gpointer klass)
{
	self->ref_count = 1;
}

static void
main_window_view_cache_item_finalize (MainWindowViewCacheItem * obj)
{
	MainWindowViewCacheItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM, MainWindowViewCacheItem);
	g_signal_handlers_destroy (self);
	_g_free0 (self->view_id);
	_g_object_unref0 (self->view);
}

static GType
main_window_view_cache_item_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { main_window_value_view_cache_item_init, main_window_value_view_cache_item_free_value, main_window_value_view_cache_item_copy_value, main_window_value_view_cache_item_peek_pointer, "p", main_window_value_view_cache_item_collect_value, "p", main_window_value_view_cache_item_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (MainWindowViewCacheItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) main_window_view_cache_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MainWindowViewCacheItem), 0, (GInstanceInitFunc) main_window_view_cache_item_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType main_window_view_cache_item_type_id;
	main_window_view_cache_item_type_id = g_type_register_fundamental (g_type_fundamental_next (), "MainWindowViewCacheItem", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return main_window_view_cache_item_type_id;
}

static GType
main_window_view_cache_item_get_type (void)
{
	static volatile gsize main_window_view_cache_item_type_id__once = 0;
	if (g_once_init_enter (&main_window_view_cache_item_type_id__once)) {
		GType main_window_view_cache_item_type_id;
		main_window_view_cache_item_type_id = main_window_view_cache_item_get_type_once ();
		g_once_init_leave (&main_window_view_cache_item_type_id__once, main_window_view_cache_item_type_id);
	}
	return main_window_view_cache_item_type_id__once;
}

static gpointer
main_window_view_cache_item_ref (gpointer instance)
{
	MainWindowViewCacheItem * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

static void
main_window_view_cache_item_unref (gpointer instance)
{
	MainWindowViewCacheItem * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		MAIN_WINDOW_VIEW_CACHE_ITEM_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

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

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

static void
_vala_GValue_free (GValue* self)
{
	g_boxed_free (G_TYPE_VALUE, self);
}

static gboolean
_main_window___lambda952_ (MainWindow* self)
{
	AdwOverlaySplitView* _tmp0_;
	GtkButton* _tmp1_;
	gboolean result;
	main_window_init_backend (self);
	_tmp0_ = self->priv->overlay_split_view;
	adw_overlay_split_view_set_show_sidebar (_tmp0_, TRUE);
	_tmp1_ = self->priv->fake_button;
	gtk_widget_grab_focus ((GtkWidget*) _tmp1_);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
__main_window___lambda952__gsource_func (gpointer self)
{
	gboolean result;
	result = _main_window___lambda952_ ((MainWindow*) self);
	return result;
}

static void
_main_window_valid_view_removed_services_store_project_deleted (ServicesStore* _sender,
                                                                ObjectsProject* project,
                                                                gpointer self)
{
	main_window_valid_view_removed ((MainWindow*) self, project);
}

static void
_main_window_valid_view_removed_services_store_project_archived (ServicesStore* _sender,
                                                                 ObjectsProject* project,
                                                                 gpointer self)
{
	main_window_valid_view_removed ((MainWindow*) self, project);
}

static void
__lambda963_ (MainWindow* self,
              const gchar* id)
{
	ObjectsItem* item = NULL;
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	ObjectsItem* _tmp2_;
	ObjectsItem* _tmp3_;
	GeeArrayList* reminders = NULL;
	ServicesDatabase* _tmp4_;
	ServicesDatabase* _tmp5_;
	GeeArrayList* _tmp6_;
	GeeArrayList* _tmp7_;
	ServicesStore* _tmp8_;
	ObjectsItem* _tmp9_;
	g_return_if_fail (id != NULL);
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_database_get_item_by_id (_tmp1_, id);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	item = _tmp3_;
	_tmp4_ = services_database_get_default ();
	_tmp5_ = _tmp4_;
	_tmp6_ = services_database_get_reminders_by_item_id (_tmp5_, id);
	_tmp7_ = _tmp6_;
	_g_object_unref0 (_tmp5_);
	reminders = _tmp7_;
	_tmp8_ = services_store_instance ();
	_tmp9_ = item;
	services_store_insert_item (_tmp8_, _tmp9_, TRUE, FALSE);
	{
		GeeArrayList* _reminder_list = NULL;
		GeeArrayList* _tmp10_;
		gint _reminder_size = 0;
		GeeArrayList* _tmp11_;
		gint _tmp12_;
		gint _tmp13_;
		gint _reminder_index = 0;
		_tmp10_ = reminders;
		_reminder_list = _tmp10_;
		_tmp11_ = _reminder_list;
		_tmp12_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp11_);
		_tmp13_ = _tmp12_;
		_reminder_size = _tmp13_;
		_reminder_index = -1;
		while (TRUE) {
			gint _tmp14_;
			gint _tmp15_;
			ObjectsReminder* reminder = NULL;
			GeeArrayList* _tmp16_;
			gpointer _tmp17_;
			ObjectsItem* _tmp18_;
			ObjectsReminder* _tmp19_;
			_reminder_index = _reminder_index + 1;
			_tmp14_ = _reminder_index;
			_tmp15_ = _reminder_size;
			if (!(_tmp14_ < _tmp15_)) {
				break;
			}
			_tmp16_ = _reminder_list;
			_tmp17_ = gee_abstract_list_get ((GeeAbstractList*) _tmp16_, _reminder_index);
			reminder = (ObjectsReminder*) _tmp17_;
			_tmp18_ = item;
			_tmp19_ = reminder;
			objects_item_add_reminder_events (_tmp18_, _tmp19_);
			_g_object_unref0 (reminder);
		}
	}
	_g_object_unref0 (reminders);
	_g_object_unref0 (item);
}

static void
___lambda963__services_dbus_server_item_added (ServicesDBusServer* _sender,
                                               const gchar* id,
                                               gpointer self)
{
	__lambda963_ ((MainWindow*) self, id);
}

static gboolean
__lambda964_ (MainWindow* self)
{
	gboolean result;
	g_debug ("MainWindow.vala:211: Starting startup sync\n");
	{
		GeeArrayList* _source_list = NULL;
		ServicesStore* _tmp0_;
		GeeArrayList* _tmp1_;
		GeeArrayList* _tmp2_;
		gint _source_size = 0;
		GeeArrayList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _source_index = 0;
		_tmp0_ = services_store_instance ();
		_tmp1_ = services_store_get_sources (_tmp0_);
		_tmp2_ = _tmp1_;
		_source_list = _tmp2_;
		_tmp3_ = _source_list;
		_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_source_size = _tmp5_;
		_source_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			ObjectsSource* source = NULL;
			GeeArrayList* _tmp8_;
			gpointer _tmp9_;
			ObjectsSource* _tmp10_;
			_source_index = _source_index + 1;
			_tmp6_ = _source_index;
			_tmp7_ = _source_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _source_list;
			_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _source_index);
			source = (ObjectsSource*) _tmp9_;
			_tmp10_ = source;
			objects_source_run_server (_tmp10_, FALSE);
			_g_object_unref0 (source);
		}
	}
	self->priv->_did_startup_sync = TRUE;
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda964__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda964_ ((MainWindow*) self);
	return result;
}

static void
__lambda965_ (MainWindow* self,
              ObjectsSource* source)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (source != NULL);
	_tmp0_ = objects_source_get_sync_server (source);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		objects_source_run_server (source, TRUE);
	}
}

static void
___lambda965__services_store_source_added (ServicesStore* _sender,
                                           ObjectsSource* source,
                                           gpointer self)
{
	__lambda965_ ((MainWindow*) self, source);
}

static void
_main_window___lambda953_ (MainWindow* self)
{
	ServicesDatabase* _tmp0_;
	ServicesDatabase* _tmp1_;
	gboolean _tmp2_;
	AdwViewStack* _tmp5_;
	AdwOverlaySplitView* _tmp6_;
	ServicesStore* _tmp7_;
	ServicesStore* _tmp12_;
	LayoutsSidebar* _tmp21_;
	ServicesNotification* _tmp22_;
	ServicesNotification* _tmp23_;
	ServicesTimeMonitor* _tmp24_;
	ServicesTimeMonitor* _tmp25_;
	ServicesBackupManager* _tmp26_;
	ServicesBackupManager* _tmp27_;
	ServicesStore* _tmp28_;
	ServicesStore* _tmp29_;
	ServicesDBusServer* _tmp30_;
	gboolean did_startup_sync = FALSE;
	ServicesStore* _tmp31_;
	ServicesStore* _tmp32_;
	_tmp0_ = services_database_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = !services_database_verify_integrity (_tmp1_);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		AdwViewStack* _tmp3_;
		GtkWidget* _tmp4_;
		_tmp3_ = self->priv->view_stack;
		_tmp4_ = self->priv->error_db_page;
		adw_view_stack_set_visible_child (_tmp3_, _tmp4_);
		return;
	}
	_tmp5_ = self->priv->view_stack;
	_tmp6_ = self->priv->overlay_split_view;
	adw_view_stack_set_visible_child (_tmp5_, (GtkWidget*) _tmp6_);
	_tmp7_ = services_store_instance ();
	if (services_store_is_sources_empty (_tmp7_)) {
		Util* _tmp8_;
		Util* _tmp9_;
		ObjectsSource* _tmp10_;
		ObjectsSource* _tmp11_;
		_tmp8_ = util_get_default ();
		_tmp9_ = _tmp8_;
		_tmp10_ = util_create_local_source (_tmp9_);
		_tmp11_ = _tmp10_;
		_g_object_unref0 (_tmp11_);
		_g_object_unref0 (_tmp9_);
	}
	_tmp12_ = services_store_instance ();
	if (services_store_is_database_empty (_tmp12_)) {
		Util* _tmp13_;
		Util* _tmp14_;
		ObjectsProject* _tmp15_;
		ObjectsProject* _tmp16_;
		Util* _tmp17_;
		Util* _tmp18_;
		Util* _tmp19_;
		Util* _tmp20_;
		_tmp13_ = util_get_default ();
		_tmp14_ = _tmp13_;
		_tmp15_ = util_create_inbox_project (_tmp14_);
		_tmp16_ = _tmp15_;
		_g_object_unref0 (_tmp16_);
		_g_object_unref0 (_tmp14_);
		_tmp17_ = util_get_default ();
		_tmp18_ = _tmp17_;
		util_create_tutorial_project (_tmp18_);
		_g_object_unref0 (_tmp18_);
		_tmp19_ = util_get_default ();
		_tmp20_ = _tmp19_;
		util_create_default_labels (_tmp20_);
		_g_object_unref0 (_tmp20_);
	}
	_tmp21_ = self->priv->sidebar;
	layouts_sidebar_init (_tmp21_);
	_tmp22_ = services_notification_get_default ();
	_tmp23_ = _tmp22_;
	_g_object_unref0 (_tmp23_);
	_tmp24_ = services_time_monitor_get_default ();
	_tmp25_ = _tmp24_;
	services_time_monitor_init_timeout (_tmp25_);
	_g_object_unref0 (_tmp25_);
	_tmp26_ = services_backup_manager_get_default ();
	_tmp27_ = _tmp26_;
	services_backup_manager_init_auto_backup (_tmp27_);
	_g_object_unref0 (_tmp27_);
	main_window_go_homepage (self);
	_tmp28_ = services_store_instance ();
	g_signal_connect_object (_tmp28_, "project-deleted", (GCallback) _main_window_valid_view_removed_services_store_project_deleted, self, 0);
	_tmp29_ = services_store_instance ();
	g_signal_connect_object (_tmp29_, "project-archived", (GCallback) _main_window_valid_view_removed_services_store_project_archived, self, 0);
	main_window_check_archived (self);
	_tmp30_ = services_dbus_server_get_default ();
	g_signal_connect_object (_tmp30_, "item-added", (GCallback) ___lambda963__services_dbus_server_item_added, self, 0);
	did_startup_sync = FALSE;
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) CONSTANTS_STARTUP_SYNC_TIMEOUT, ___lambda964__gsource_func, g_object_ref (self), g_object_unref);
	_tmp31_ = services_store_instance ();
	g_signal_connect_object (_tmp31_, "source-added", (GCallback) ___lambda965__services_store_source_added, self, 0);
	main_window_setup_network_monitor (self);
	_tmp32_ = services_store_instance ();
	services_store_setup_calendar_events (_tmp32_);
}

static void
__main_window___lambda953__services_database_opened (ServicesDatabase* _sender,
                                                     gpointer self)
{
	_main_window___lambda953_ ((MainWindow*) self);
}

static void
_main_window___lambda966_ (Block8Data* _data8_)
{
	MainWindow* self;
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gboolean _tmp3_;
	self = _data8_->self;
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_boolean (_tmp2_, "system-appearance");
	_g_object_unref0 (_tmp1_);
	if (_tmp3_) {
		ServicesSettings* _tmp4_;
		ServicesSettings* _tmp5_;
		GSettings* _tmp6_;
		ColorSchemeSettingsSettings* _tmp7_;
		ColorSchemeSettingsSettingsColorScheme _tmp8_;
		ColorSchemeSettingsSettingsColorScheme _tmp9_;
		Util* _tmp10_;
		Util* _tmp11_;
		_tmp4_ = services_settings_get_default ();
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_->settings;
		_tmp7_ = _data8_->color_scheme_settings;
		_tmp8_ = color_scheme_settings_settings_get_prefers_color_scheme (_tmp7_);
		_tmp9_ = _tmp8_;
		g_settings_set_boolean (_tmp6_, "dark-mode", _tmp9_ == COLOR_SCHEME_SETTINGS_SETTINGS_COLOR_SCHEME_DARK);
		_g_object_unref0 (_tmp5_);
		_tmp10_ = util_get_default ();
		_tmp11_ = _tmp10_;
		util_update_theme (_tmp11_);
		_g_object_unref0 (_tmp11_);
	}
}

static void
__main_window___lambda966__g_object_notify (GObject* _sender,
                                            GParamSpec* pspec,
                                            gpointer self)
{
	_main_window___lambda966_ (self);
}

static void
_main_window___lambda967_ (MainWindow* self)
{
	Util* _tmp0_;
	Util* _tmp1_;
	_tmp0_ = util_get_default ();
	_tmp1_ = _tmp0_;
	util_update_theme (_tmp1_);
	_g_object_unref0 (_tmp1_);
}

static void
__main_window___lambda967__g_object_notify (GObject* _sender,
                                            GParamSpec* pspec,
                                            gpointer self)
{
	_main_window___lambda967_ ((MainWindow*) self);
}

static void
_main_window___lambda968_ (Block8Data* _data8_)
{
	MainWindow* self;
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	ColorSchemeSettingsSettings* _tmp3_;
	ColorSchemeSettingsSettingsColorScheme _tmp4_;
	ColorSchemeSettingsSettingsColorScheme _tmp5_;
	Util* _tmp6_;
	Util* _tmp7_;
	self = _data8_->self;
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = _data8_->color_scheme_settings;
	_tmp4_ = color_scheme_settings_settings_get_prefers_color_scheme (_tmp3_);
	_tmp5_ = _tmp4_;
	g_settings_set_boolean (_tmp2_, "dark-mode", _tmp5_ == COLOR_SCHEME_SETTINGS_SETTINGS_COLOR_SCHEME_DARK);
	_g_object_unref0 (_tmp1_);
	_tmp6_ = util_get_default ();
	_tmp7_ = _tmp6_;
	util_update_theme (_tmp7_);
	_g_object_unref0 (_tmp7_);
}

static void
__main_window___lambda968__g_settings_changed (GSettings* _sender,
                                               const gchar* key,
                                               gpointer self)
{
	_main_window___lambda968_ (self);
}

static void
_util_update_theme_g_settings_changed (GSettings* _sender,
                                       const gchar* key,
                                       gpointer self)
{
	util_update_theme ((Util*) self);
}

static void
_main_window___lambda969_ (MainWindow* self)
{
	main_window_update_autostart (self);
}

static void
__main_window___lambda969__g_settings_changed (GSettings* _sender,
                                               const gchar* key,
                                               gpointer self)
{
	_main_window___lambda969_ ((MainWindow*) self);
}

static void
_main_window___lambda970_ (MainWindow* self)
{
	gboolean run_on_startup = FALSE;
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gboolean _tmp3_;
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_boolean (_tmp2_, "run-on-startup");
	_g_object_unref0 (_tmp1_);
	run_on_startup = _tmp3_;
	if (run_on_startup) {
		main_window_update_autostart (self);
	}
}

static void
__main_window___lambda970__g_settings_changed (GSettings* _sender,
                                               const gchar* key,
                                               gpointer self)
{
	_main_window___lambda970_ ((MainWindow*) self);
}

static void
_main_window___lambda971_ (MainWindow* self)
{
	ServicesEventBus* _tmp0_;
	ServicesEventBus* _tmp1_;
	ServicesSettings* _tmp2_;
	ServicesSettings* _tmp3_;
	GSettings* _tmp4_;
	_tmp0_ = services_event_bus_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = services_settings_get_default ();
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_->settings;
	services_event_bus_set_mobile_mode (_tmp1_, g_settings_get_boolean (_tmp4_, "mobile-mode"));
	_g_object_unref0 (_tmp3_);
	_g_object_unref0 (_tmp1_);
}

static void
__main_window___lambda971__g_settings_changed (GSettings* _sender,
                                               const gchar* key,
                                               gpointer self)
{
	_main_window___lambda971_ ((MainWindow*) self);
}

static void
_util_update_font_scale_g_settings_changed (GSettings* _sender,
                                            const gchar* key,
                                            gpointer self)
{
	util_update_font_scale ((Util*) self);
}

static void
_main_window___lambda972_ (MainWindow* self,
                           PaneType pane_type,
                           const gchar* id)
{
	ServicesEventBus* _tmp0_;
	ServicesEventBus* _tmp1_;
	gboolean _tmp2_;
	AdwOverlaySplitView* _tmp78_;
	gboolean _tmp79_;
	gboolean _tmp80_;
	ServicesEventBus* _tmp82_;
	ServicesEventBus* _tmp83_;
	ServicesEventBus* _tmp84_;
	ServicesEventBus* _tmp85_;
	g_return_if_fail (id != NULL);
	_tmp0_ = services_event_bus_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->multi_select_enabled;
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		main_window_clear_multi_select (self);
	}
	if (pane_type == PANE_TYPE_PROJECT) {
		ObjectsProject* project = NULL;
		ServicesStore* _tmp3_;
		ObjectsProject* _tmp4_;
		ObjectsProject* _tmp5_;
		_tmp3_ = services_store_instance ();
		_tmp4_ = services_store_get_project (_tmp3_, id);
		project = _tmp4_;
		_tmp5_ = project;
		if (_tmp5_ != NULL) {
			ObjectsProject* _tmp6_;
			ViewsProject* _tmp7_;
			ViewsProject* _tmp8_;
			_tmp6_ = project;
			_tmp7_ = main_window_add_project_view (self, _tmp6_);
			_tmp8_ = _tmp7_;
			_g_object_unref0 (_tmp8_);
		} else {
			main_window_add_inbox_view (self);
		}
		_g_object_unref0 (project);
	} else {
		if (pane_type == PANE_TYPE_FILTER) {
			ObjectsFiltersInbox* _tmp9_;
			ObjectsFiltersInbox* _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			gboolean _tmp13_;
			_tmp9_ = objects_filters_inbox_get_default ();
			_tmp10_ = _tmp9_;
			_tmp11_ = objects_base_object_get_view_id ((ObjectsBaseObject*) _tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = g_strcmp0 (id, _tmp12_) == 0;
			_g_object_unref0 (_tmp10_);
			if (_tmp13_) {
				main_window_add_inbox_view (self);
			} else {
				ObjectsFiltersToday* _tmp14_;
				ObjectsFiltersToday* _tmp15_;
				const gchar* _tmp16_;
				const gchar* _tmp17_;
				gboolean _tmp18_;
				_tmp14_ = objects_filters_today_get_default ();
				_tmp15_ = _tmp14_;
				_tmp16_ = objects_base_object_get_view_id ((ObjectsBaseObject*) _tmp15_);
				_tmp17_ = _tmp16_;
				_tmp18_ = g_strcmp0 (id, _tmp17_) == 0;
				_g_object_unref0 (_tmp15_);
				if (_tmp18_) {
					main_window_add_today_view (self);
				} else {
					ObjectsFiltersScheduled* _tmp19_;
					ObjectsFiltersScheduled* _tmp20_;
					const gchar* _tmp21_;
					const gchar* _tmp22_;
					gboolean _tmp23_;
					_tmp19_ = objects_filters_scheduled_get_default ();
					_tmp20_ = _tmp19_;
					_tmp21_ = objects_base_object_get_view_id ((ObjectsBaseObject*) _tmp20_);
					_tmp22_ = _tmp21_;
					_tmp23_ = g_strcmp0 (id, _tmp22_) == 0;
					_g_object_unref0 (_tmp20_);
					if (_tmp23_) {
						main_window_add_scheduled_view (self);
					} else {
						ObjectsFiltersPinboard* _tmp24_;
						ObjectsFiltersPinboard* _tmp25_;
						const gchar* _tmp26_;
						const gchar* _tmp27_;
						gboolean _tmp28_;
						_tmp24_ = objects_filters_pinboard_get_default ();
						_tmp25_ = _tmp24_;
						_tmp26_ = objects_base_object_get_view_id ((ObjectsBaseObject*) _tmp25_);
						_tmp27_ = _tmp26_;
						_tmp28_ = g_strcmp0 (id, _tmp27_) == 0;
						_g_object_unref0 (_tmp25_);
						if (_tmp28_) {
							ObjectsFiltersPinboard* _tmp29_;
							ObjectsFiltersPinboard* _tmp30_;
							_tmp29_ = objects_filters_pinboard_get_default ();
							_tmp30_ = _tmp29_;
							main_window_add_filter_view (self, (ObjectsBaseObject*) _tmp30_);
							_g_object_unref0 (_tmp30_);
						} else {
							ObjectsFiltersLabels* _tmp31_;
							ObjectsFiltersLabels* _tmp32_;
							const gchar* _tmp33_;
							const gchar* _tmp34_;
							gboolean _tmp35_;
							_tmp31_ = objects_filters_labels_get_default ();
							_tmp32_ = _tmp31_;
							_tmp33_ = objects_base_object_get_view_id ((ObjectsBaseObject*) _tmp32_);
							_tmp34_ = _tmp33_;
							_tmp35_ = g_strcmp0 (id, _tmp34_) == 0;
							_g_object_unref0 (_tmp32_);
							if (_tmp35_) {
								main_window_add_labels_view (self);
							} else {
								if (g_str_has_prefix (id, "priority")) {
									main_window_add_priority_view (self, id);
								} else {
									ObjectsFiltersCompleted* _tmp36_;
									ObjectsFiltersCompleted* _tmp37_;
									const gchar* _tmp38_;
									const gchar* _tmp39_;
									gboolean _tmp40_;
									_tmp36_ = objects_filters_completed_get_default ();
									_tmp37_ = _tmp36_;
									_tmp38_ = objects_base_object_get_view_id ((ObjectsBaseObject*) _tmp37_);
									_tmp39_ = _tmp38_;
									_tmp40_ = g_strcmp0 (id, _tmp39_) == 0;
									_g_object_unref0 (_tmp37_);
									if (_tmp40_) {
										ObjectsFiltersCompleted* _tmp41_;
										ObjectsFiltersCompleted* _tmp42_;
										_tmp41_ = objects_filters_completed_get_default ();
										_tmp42_ = _tmp41_;
										main_window_add_filter_view (self, (ObjectsBaseObject*) _tmp42_);
										_g_object_unref0 (_tmp42_);
									} else {
										ObjectsFiltersTomorrow* _tmp43_;
										ObjectsFiltersTomorrow* _tmp44_;
										const gchar* _tmp45_;
										const gchar* _tmp46_;
										gboolean _tmp47_;
										_tmp43_ = objects_filters_tomorrow_get_default ();
										_tmp44_ = _tmp43_;
										_tmp45_ = objects_base_object_get_view_id ((ObjectsBaseObject*) _tmp44_);
										_tmp46_ = _tmp45_;
										_tmp47_ = g_strcmp0 (id, _tmp46_) == 0;
										_g_object_unref0 (_tmp44_);
										if (_tmp47_) {
											ObjectsFiltersTomorrow* _tmp48_;
											ObjectsFiltersTomorrow* _tmp49_;
											_tmp48_ = objects_filters_tomorrow_get_default ();
											_tmp49_ = _tmp48_;
											main_window_add_filter_view (self, (ObjectsBaseObject*) _tmp49_);
											_g_object_unref0 (_tmp49_);
										} else {
											ObjectsFiltersAnytime* _tmp50_;
											ObjectsFiltersAnytime* _tmp51_;
											const gchar* _tmp52_;
											const gchar* _tmp53_;
											gboolean _tmp54_;
											_tmp50_ = objects_filters_anytime_get_default ();
											_tmp51_ = _tmp50_;
											_tmp52_ = objects_base_object_get_view_id ((ObjectsBaseObject*) _tmp51_);
											_tmp53_ = _tmp52_;
											_tmp54_ = g_strcmp0 (id, _tmp53_) == 0;
											_g_object_unref0 (_tmp51_);
											if (_tmp54_) {
												ObjectsFiltersAnytime* _tmp55_;
												ObjectsFiltersAnytime* _tmp56_;
												_tmp55_ = objects_filters_anytime_get_default ();
												_tmp56_ = _tmp55_;
												main_window_add_filter_view (self, (ObjectsBaseObject*) _tmp56_);
												_g_object_unref0 (_tmp56_);
											} else {
												ObjectsFiltersRepeating* _tmp57_;
												ObjectsFiltersRepeating* _tmp58_;
												const gchar* _tmp59_;
												const gchar* _tmp60_;
												gboolean _tmp61_;
												_tmp57_ = objects_filters_repeating_get_default ();
												_tmp58_ = _tmp57_;
												_tmp59_ = objects_base_object_get_view_id ((ObjectsBaseObject*) _tmp58_);
												_tmp60_ = _tmp59_;
												_tmp61_ = g_strcmp0 (id, _tmp60_) == 0;
												_g_object_unref0 (_tmp58_);
												if (_tmp61_) {
													ObjectsFiltersRepeating* _tmp62_;
													ObjectsFiltersRepeating* _tmp63_;
													_tmp62_ = objects_filters_repeating_get_default ();
													_tmp63_ = _tmp62_;
													main_window_add_filter_view (self, (ObjectsBaseObject*) _tmp63_);
													_g_object_unref0 (_tmp63_);
												} else {
													ObjectsFiltersUnlabeled* _tmp64_;
													ObjectsFiltersUnlabeled* _tmp65_;
													const gchar* _tmp66_;
													const gchar* _tmp67_;
													gboolean _tmp68_;
													_tmp64_ = objects_filters_unlabeled_get_default ();
													_tmp65_ = _tmp64_;
													_tmp66_ = objects_base_object_get_view_id ((ObjectsBaseObject*) _tmp65_);
													_tmp67_ = _tmp66_;
													_tmp68_ = g_strcmp0 (id, _tmp67_) == 0;
													_g_object_unref0 (_tmp65_);
													if (_tmp68_) {
														ObjectsFiltersUnlabeled* _tmp69_;
														ObjectsFiltersUnlabeled* _tmp70_;
														_tmp69_ = objects_filters_unlabeled_get_default ();
														_tmp70_ = _tmp69_;
														main_window_add_filter_view (self, (ObjectsBaseObject*) _tmp70_);
														_g_object_unref0 (_tmp70_);
													} else {
														ObjectsFiltersAllItems* _tmp71_;
														ObjectsFiltersAllItems* _tmp72_;
														const gchar* _tmp73_;
														const gchar* _tmp74_;
														gboolean _tmp75_;
														_tmp71_ = objects_filters_all_items_get_default ();
														_tmp72_ = _tmp71_;
														_tmp73_ = objects_base_object_get_view_id ((ObjectsBaseObject*) _tmp72_);
														_tmp74_ = _tmp73_;
														_tmp75_ = g_strcmp0 (id, _tmp74_) == 0;
														_g_object_unref0 (_tmp72_);
														if (_tmp75_) {
															ObjectsFiltersAllItems* _tmp76_;
															ObjectsFiltersAllItems* _tmp77_;
															_tmp76_ = objects_filters_all_items_get_default ();
															_tmp77_ = _tmp76_;
															main_window_add_filter_view (self, (ObjectsBaseObject*) _tmp77_);
															_g_object_unref0 (_tmp77_);
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		} else {
			if (pane_type == PANE_TYPE_LABEL) {
				main_window_add_label_view (self, id);
			} else {
				main_window_add_inbox_view (self);
			}
		}
	}
	_tmp78_ = self->priv->overlay_split_view;
	_tmp79_ = adw_overlay_split_view_get_collapsed (_tmp78_);
	_tmp80_ = _tmp79_;
	if (_tmp80_) {
		AdwOverlaySplitView* _tmp81_;
		_tmp81_ = self->priv->overlay_split_view;
		adw_overlay_split_view_set_show_sidebar (_tmp81_, FALSE);
	}
	_tmp82_ = services_event_bus_get_default ();
	_tmp83_ = _tmp82_;
	_tmp83_->item_edit_active = FALSE;
	_g_object_unref0 (_tmp83_);
	_tmp84_ = services_event_bus_get_default ();
	_tmp85_ = _tmp84_;
	g_signal_emit_by_name (_tmp85_, "dim-content", FALSE, "");
	_g_object_unref0 (_tmp85_);
}

static void
__main_window___lambda972__services_event_bus_pane_selected (ServicesEventBus* _sender,
                                                             PaneType panel_type,
                                                             const gchar* id,
                                                             gpointer self)
{
	_main_window___lambda972_ ((MainWindow*) self, panel_type, id);
}

static void
_main_window___lambda973_ (MainWindow* self,
                           AdwToast* toast)
{
	AdwToastOverlay* _tmp0_;
	AdwToast* _tmp1_;
	g_return_if_fail (toast != NULL);
	_tmp0_ = self->priv->toast_overlay;
	_tmp1_ = _g_object_ref0 (toast);
	adw_toast_overlay_add_toast (_tmp0_, _tmp1_);
}

static void
__main_window___lambda973__services_event_bus_send_toast (ServicesEventBus* _sender,
                                                          AdwToast* toast,
                                                          gpointer self)
{
	_main_window___lambda973_ ((MainWindow*) self, toast);
}

static void
_main_window_send_toast_error_services_event_bus_send_error_toast (ServicesEventBus* _sender,
                                                                   gint error_code,
                                                                   const gchar* error_message,
                                                                   gpointer self)
{
	main_window_send_toast_error ((MainWindow*) self, error_code, error_message);
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		MainWindow* self;
		self = _data9_->self;
		_g_object_unref0 (_data9_->source);
		_g_object_unref0 (self);
		g_slice_free (Block9Data, _data9_);
	}
}

static void
__lambda975_ (Block9Data* _data9_)
{
	MainWindow* self;
	SourceType _tmp0_;
	SourceType _tmp1_;
	self = _data9_->self;
	_tmp0_ = objects_source_get_source_type (_data9_->source);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == SOURCE_TYPE_TODOIST) {
		ServicesTodoist* _tmp2_;
		ServicesTodoist* _tmp3_;
		_tmp2_ = services_todoist_get_default ();
		_tmp3_ = _tmp2_;
		services_todoist_sync (_tmp3_, _data9_->source, NULL, NULL);
		_g_object_unref0 (_tmp3_);
	} else {
		SourceType _tmp4_;
		SourceType _tmp5_;
		_tmp4_ = objects_source_get_source_type (_data9_->source);
		_tmp5_ = _tmp4_;
		if (_tmp5_ == SOURCE_TYPE_CALDAV) {
			ServicesCalDAVCore* _tmp6_;
			ServicesCalDAVCore* _tmp7_;
			_tmp6_ = services_cal_dav_core_get_default ();
			_tmp7_ = _tmp6_;
			services_cal_dav_core_sync (_tmp7_, _data9_->source, NULL, NULL);
			_g_object_unref0 (_tmp7_);
		}
	}
}

static void
___lambda975__adw_toast_button_clicked (AdwToast* _sender,
                                        gpointer self)
{
	__lambda975_ (self);
}

static void
_main_window___lambda974_ (MainWindow* self,
                           ObjectsSource* source)
{
	Block9Data* _data9_;
	ObjectsSource* _tmp0_;
	AdwToast* toast = NULL;
	gchar* _tmp1_;
	AdwToast* _tmp2_ = NULL;
	AdwToast* _tmp3_;
	AdwToastOverlay* _tmp4_;
	AdwToast* _tmp5_;
	AdwToast* _tmp6_;
	g_return_if_fail (source != NULL);
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_data9_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (source);
	_g_object_unref0 (_data9_->source);
	_data9_->source = _tmp0_;
	_tmp1_ = g_strdup (_ ("Sync Now"));
	_tmp2_ = adw_toast_new (_ ("Task was modified on another device"));
	adw_toast_set_timeout (_tmp2_, (guint) 5);
	adw_toast_set_button_label (_tmp2_, _tmp1_);
	_g_free0 (_tmp1_);
	toast = _tmp2_;
	_tmp3_ = toast;
	g_signal_connect_data (_tmp3_, "button-clicked", (GCallback) ___lambda975__adw_toast_button_clicked, block9_data_ref (_data9_), (GClosureNotify) block9_data_unref, 0);
	_tmp4_ = self->priv->toast_overlay;
	_tmp5_ = toast;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	adw_toast_overlay_add_toast (_tmp4_, _tmp6_);
	_g_object_unref0 (toast);
	block9_data_unref (_data9_);
	_data9_ = NULL;
}

static void
__main_window___lambda974__services_event_bus_send_conflict_toast (ServicesEventBus* _sender,
                                                                   ObjectsSource* source,
                                                                   gpointer self)
{
	_main_window___lambda974_ ((MainWindow*) self, source);
}

static void
_main_window_show_task_completed_toast_services_event_bus_send_task_completed_toast (ServicesEventBus* _sender,
                                                                                     const gchar* project_id,
                                                                                     gpointer self)
{
	main_window_show_task_completed_toast ((MainWindow*) self, project_id);
}

static void
_main_window___lambda976_ (MainWindow* self)
{
	DialogsQuickFindQuickFind* _tmp0_;
	DialogsQuickFindQuickFind* _tmp1_;
	Planify* _tmp2_;
	MainWindow* _tmp3_;
	_tmp0_ = dialogs_quick_find_quick_find_new ();
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	_tmp2_ = planify__instance;
	_tmp3_ = _tmp2_->main_window;
	adw_dialog_present ((AdwDialog*) _tmp1_, (GtkWidget*) _tmp3_);
	_g_object_unref0 (_tmp1_);
}

static void
__main_window___lambda976__gtk_button_clicked (GtkButton* _sender,
                                               gpointer self)
{
	_main_window___lambda976_ ((MainWindow*) self);
}

static Block10Data*
block10_data_ref (Block10Data* _data10_)
{
	g_atomic_int_inc (&_data10_->_ref_count_);
	return _data10_;
}

static void
block10_data_unref (void * _userdata_)
{
	Block10Data* _data10_;
	_data10_ = (Block10Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
		MainWindow* self;
		self = _data10_->_data8_->self;
		_g_object_unref0 (_data10_->item);
		block8_data_unref (_data10_->_data8_);
		_data10_->_data8_ = NULL;
		g_slice_free (Block10Data, _data10_);
	}
}

static gboolean
____lambda978_ (Block10Data* _data10_)
{
	Block8Data* _data8_;
	MainWindow* self;
	AdwOverlaySplitView* _tmp0_;
	LayoutsItemSidebarView* _tmp1_;
	gboolean result;
	_data8_ = _data10_->_data8_;
	self = _data8_->self;
	_tmp0_ = _data8_->views_split_view;
	adw_overlay_split_view_set_show_sidebar (_tmp0_, TRUE);
	_tmp1_ = self->priv->item_sidebar_view;
	layouts_item_sidebar_view_present_item (_tmp1_, _data10_->item);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
_____lambda978__gsource_func (gpointer self)
{
	gboolean result;
	result = ____lambda978_ (self);
	return result;
}

static void
_main_window___lambda977_ (Block8Data* _data8_,
                           ObjectsItem* item)
{
	MainWindow* self;
	Block10Data* _data10_;
	ObjectsItem* _tmp0_;
	ServicesSettings* _tmp1_;
	ServicesSettings* _tmp2_;
	GSettings* _tmp3_;
	gboolean _tmp4_;
	self = _data8_->self;
	g_return_if_fail (item != NULL);
	_data10_ = g_slice_new0 (Block10Data);
	_data10_->_ref_count_ = 1;
	_data10_->_data8_ = block8_data_ref (_data8_);
	_tmp0_ = _g_object_ref0 (item);
	_g_object_unref0 (_data10_->item);
	_data10_->item = _tmp0_;
	_tmp1_ = services_settings_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_->settings;
	_tmp4_ = g_settings_get_boolean (_tmp3_, "always-show-details-sidebar");
	_g_object_unref0 (_tmp2_);
	if (_tmp4_) {
		AdwOverlaySplitView* _tmp5_;
		LayoutsItemSidebarView* _tmp6_;
		_tmp5_ = _data8_->views_split_view;
		adw_overlay_split_view_set_show_sidebar (_tmp5_, TRUE);
		_tmp6_ = self->priv->item_sidebar_view;
		layouts_item_sidebar_view_present_item (_tmp6_, _data10_->item);
	} else {
		AdwOverlaySplitView* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp7_ = _data8_->views_split_view;
		_tmp8_ = adw_overlay_split_view_get_show_sidebar (_tmp7_);
		_tmp9_ = _tmp8_;
		if (_tmp9_) {
			AdwOverlaySplitView* _tmp10_;
			_tmp10_ = _data8_->views_split_view;
			adw_overlay_split_view_set_show_sidebar (_tmp10_, FALSE);
			g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 275, _____lambda978__gsource_func, block10_data_ref (_data10_), block10_data_unref);
		} else {
			AdwOverlaySplitView* _tmp11_;
			LayoutsItemSidebarView* _tmp12_;
			_tmp11_ = _data8_->views_split_view;
			adw_overlay_split_view_set_show_sidebar (_tmp11_, TRUE);
			_tmp12_ = self->priv->item_sidebar_view;
			layouts_item_sidebar_view_present_item (_tmp12_, _data10_->item);
		}
	}
	block10_data_unref (_data10_);
	_data10_ = NULL;
}

static void
__main_window___lambda977__services_event_bus_open_item (ServicesEventBus* _sender,
                                                         ObjectsItem* item,
                                                         gpointer self)
{
	_main_window___lambda977_ (self, item);
}

static void
_main_window___lambda979_ (Block8Data* _data8_)
{
	MainWindow* self;
	AdwOverlaySplitView* _tmp0_;
	self = _data8_->self;
	_tmp0_ = _data8_->views_split_view;
	adw_overlay_split_view_set_show_sidebar (_tmp0_, FALSE);
}

static void
__main_window___lambda979__services_event_bus_close_item (ServicesEventBus* _sender,
                                                          gpointer self)
{
	_main_window___lambda979_ (self);
}

static void
_main_window___lambda980_ (Block8Data* _data8_)
{
	MainWindow* self;
	AdwOverlaySplitView* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data8_->self;
	_tmp0_ = _data8_->views_split_view;
	_tmp1_ = adw_overlay_split_view_get_show_sidebar (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		LayoutsItemSidebarView* _tmp3_;
		GtkButton* _tmp4_;
		_tmp3_ = self->priv->item_sidebar_view;
		layouts_item_sidebar_view_clean_up (_tmp3_);
		_tmp4_ = self->priv->fake_button;
		gtk_widget_grab_focus ((GtkWidget*) _tmp4_);
	}
}

static void
__main_window___lambda980__g_object_notify (GObject* _sender,
                                            GParamSpec* pspec,
                                            gpointer self)
{
	_main_window___lambda980_ (self);
}

static void
_main_window_check_archived_services_store_project_archived (ServicesStore* _sender,
                                                             ObjectsProject* project,
                                                             gpointer self)
{
	main_window_check_archived ((MainWindow*) self);
}

static void
_main_window_check_archived_services_store_project_unarchived (ServicesStore* _sender,
                                                               ObjectsProject* project,
                                                               gpointer self)
{
	main_window_check_archived ((MainWindow*) self);
}

static void
_main_window___lambda981_ (Block8Data* _data8_)
{
	MainWindow* self;
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gboolean _tmp3_;
	self = _data8_->self;
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_boolean (_tmp2_, "always-show-details-sidebar");
	_g_object_unref0 (_tmp1_);
	if (_tmp3_) {
		AdwOverlaySplitView* _tmp4_;
		LayoutsItemSidebarView* _tmp5_;
		_tmp4_ = _data8_->views_split_view;
		adw_overlay_split_view_set_collapsed (_tmp4_, FALSE);
		_tmp5_ = self->priv->item_sidebar_view;
		gtk_widget_add_css_class ((GtkWidget*) _tmp5_, "sidebar");
	} else {
		AdwOverlaySplitView* _tmp6_;
		LayoutsItemSidebarView* _tmp7_;
		_tmp6_ = _data8_->views_split_view;
		adw_overlay_split_view_set_collapsed (_tmp6_, TRUE);
		_tmp7_ = self->priv->item_sidebar_view;
		gtk_widget_add_css_class ((GtkWidget*) _tmp7_, "sidebar");
	}
}

static void
__main_window___lambda981__g_settings_changed (GSettings* _sender,
                                               const gchar* key,
                                               gpointer self)
{
	_main_window___lambda981_ (self);
}

static void
_main_window___lambda982_ (MainWindow* self)
{
	Appearance appearance_mode = 0;
	appearance_mode = appearance_get_default ();
	gtk_widget_remove_css_class ((GtkWidget*) self, "theme-dark");
	gtk_widget_remove_css_class ((GtkWidget*) self, "theme-dark-blue");
	if (appearance_mode == APPEARANCE_DARK) {
		gtk_widget_add_css_class ((GtkWidget*) self, "theme-dark");
	} else {
		if (appearance_mode == APPEARANCE_DARK_BLUE) {
			gtk_widget_add_css_class ((GtkWidget*) self, "theme-dark-blue");
		}
	}
}

static void
__main_window___lambda982__services_event_bus_theme_changed (ServicesEventBus* _sender,
                                                             gpointer self)
{
	_main_window___lambda982_ ((MainWindow*) self);
}

static gboolean
_main_window___lambda983_ (MainWindow* self)
{
	gboolean result;
	main_window_cleanup_unused_views (self);
	result = G_SOURCE_CONTINUE;
	return result;
}

static gboolean
__main_window___lambda983__gsource_func (gpointer self)
{
	gboolean result;
	result = _main_window___lambda983_ ((MainWindow*) self);
	return result;
}

static gboolean
_main_window___lambda984_ (Block8Data* _data8_,
                           guint keyval,
                           guint keycode,
                           GdkModifierType state)
{
	MainWindow* self;
	gboolean result;
	self = _data8_->self;
	if (keyval == GDK_KEY_Escape) {
		ServicesEventBus* _tmp0_;
		ServicesEventBus* _tmp1_;
		ServicesEventBus* _tmp2_;
		ServicesEventBus* _tmp3_;
		gboolean _tmp4_;
		ServicesEventBus* _tmp9_;
		ServicesEventBus* _tmp10_;
		gboolean _tmp11_;
		AdwOverlaySplitView* _tmp12_;
		gboolean _tmp13_;
		gboolean _tmp14_;
		_tmp0_ = services_event_bus_get_default ();
		_tmp1_ = _tmp0_;
		g_signal_emit_by_name (_tmp1_, "escape-pressed");
		_g_object_unref0 (_tmp1_);
		_tmp2_ = services_event_bus_get_default ();
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_->item_edit_active;
		_g_object_unref0 (_tmp3_);
		if (_tmp4_) {
			ServicesEventBus* _tmp5_;
			ServicesEventBus* _tmp6_;
			ServicesEventBus* _tmp7_;
			ServicesEventBus* _tmp8_;
			_tmp5_ = services_event_bus_get_default ();
			_tmp6_ = _tmp5_;
			_tmp6_->item_edit_active = FALSE;
			_g_object_unref0 (_tmp6_);
			_tmp7_ = services_event_bus_get_default ();
			_tmp8_ = _tmp7_;
			g_signal_emit_by_name (_tmp8_, "dim-content", FALSE, "");
			_g_object_unref0 (_tmp8_);
			result = TRUE;
			return result;
		}
		_tmp9_ = services_event_bus_get_default ();
		_tmp10_ = _tmp9_;
		_tmp11_ = _tmp10_->multi_select_enabled;
		_g_object_unref0 (_tmp10_);
		if (_tmp11_) {
			main_window_clear_multi_select (self);
			result = TRUE;
			return result;
		}
		_tmp12_ = _data8_->views_split_view;
		_tmp13_ = adw_overlay_split_view_get_show_sidebar (_tmp12_);
		_tmp14_ = _tmp13_;
		if (_tmp14_) {
			AdwOverlaySplitView* _tmp15_;
			_tmp15_ = _data8_->views_split_view;
			adw_overlay_split_view_set_show_sidebar (_tmp15_, FALSE);
			result = TRUE;
			return result;
		}
	}
	result = FALSE;
	return result;
}

static gboolean
__main_window___lambda984__gtk_event_controller_key_key_pressed (GtkEventControllerKey* _sender,
                                                                 guint keyval,
                                                                 guint keycode,
                                                                 GdkModifierType state,
                                                                 gpointer self)
{
	gboolean result;
	result = _main_window___lambda984_ (self, keyval, keycode, state);
	return result;
}

static void
_main_window___lambda985_ (MainWindow* self,
                           gint n_press,
                           gdouble x,
                           gdouble y)
{
	ServicesEventBus* _tmp0_;
	ServicesEventBus* _tmp1_;
	gboolean _tmp2_;
	_tmp0_ = services_event_bus_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->item_edit_active;
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		GtkWidget* target = NULL;
		AdwViewStack* _tmp3_;
		GtkWidget* _tmp4_;
		GtkWidget* _tmp5_;
		gboolean clicked_on_editing_task = FALSE;
		GtkWidget* widget = NULL;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		_tmp3_ = self->priv->view_stack;
		_tmp4_ = gtk_widget_pick ((GtkWidget*) _tmp3_, x, y, GTK_PICK_DEFAULT);
		_tmp5_ = _g_object_ref0 (_tmp4_);
		target = _tmp5_;
		clicked_on_editing_task = FALSE;
		_tmp6_ = target;
		_tmp7_ = _g_object_ref0 (_tmp6_);
		widget = _tmp7_;
		while (TRUE) {
			GtkWidget* _tmp8_;
			GtkWidget* _tmp9_;
			GtkWidget* _tmp10_;
			GtkWidget* _tmp11_;
			GtkWidget* _tmp12_;
			_tmp8_ = widget;
			if (!(_tmp8_ != NULL)) {
				break;
			}
			_tmp9_ = widget;
			if (gtk_widget_has_css_class (_tmp9_, "task-editing")) {
				clicked_on_editing_task = TRUE;
				break;
			}
			_tmp10_ = widget;
			_tmp11_ = gtk_widget_get_parent (_tmp10_);
			_tmp12_ = _g_object_ref0 (_tmp11_);
			_g_object_unref0 (widget);
			widget = _tmp12_;
		}
		if (!clicked_on_editing_task) {
			ServicesEventBus* _tmp13_;
			ServicesEventBus* _tmp14_;
			ServicesEventBus* _tmp15_;
			ServicesEventBus* _tmp16_;
			_tmp13_ = services_event_bus_get_default ();
			_tmp14_ = _tmp13_;
			_tmp14_->item_edit_active = FALSE;
			_g_object_unref0 (_tmp14_);
			_tmp15_ = services_event_bus_get_default ();
			_tmp16_ = _tmp15_;
			g_signal_emit_by_name (_tmp16_, "dim-content", FALSE, "");
			_g_object_unref0 (_tmp16_);
		}
		_g_object_unref0 (widget);
		_g_object_unref0 (target);
	}
}

static void
__main_window___lambda985__gtk_gesture_click_pressed (GtkGestureClick* _sender,
                                                      gint n_press,
                                                      gdouble x,
                                                      gdouble y,
                                                      gpointer self)
{
	_main_window___lambda985_ ((MainWindow*) self, n_press, x, y);
}

static void
_main_window___lambda986_ (MainWindow* self)
{
	main_window_handle_inbox_project_change (self);
}

static void
__main_window___lambda986__g_settings_changed (GSettings* _sender,
                                               const gchar* key,
                                               gpointer self)
{
	_main_window___lambda986_ ((MainWindow*) self);
}

static gboolean
_main_window___lambda987_ (MainWindow* self)
{
	ServicesSettings* _tmp0_;
	ServicesSettings* _tmp1_;
	GSettings* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	_tmp0_ = services_settings_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->settings;
	_tmp3_ = g_settings_get_boolean (_tmp2_, "run-in-background");
	_g_object_unref0 (_tmp1_);
	if (_tmp3_) {
		gtk_widget_hide ((GtkWidget*) self);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
__main_window___lambda987__gtk_window_close_request (GtkWindow* _sender,
                                                     gpointer self)
{
	gboolean result;
	result = _main_window___lambda987_ ((MainWindow*) self);
	return result;
}

static GObject *
main_window_constructor (GType type,
                         guint n_construct_properties,
                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	MainWindow * self;
	Block8Data* _data8_;
	Planify* _tmp0_;
	ServicesActionManager* _tmp1_;
	GtkPopover* settings_popover = NULL;
	GtkPopover* _tmp2_;
	GtkButton* _tmp3_ = NULL;
	gchar* _tmp4_;
	gchar** _tmp5_;
	GtkPopover* _tmp6_;
	GtkPopover* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	GtkMenuButton* _tmp10_ = NULL;
	GtkButton* search_button = NULL;
	Util* _tmp11_;
	Util* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar** _tmp15_;
	GtkButton* _tmp16_ = NULL;
	GtkButton* _tmp17_;
	GtkLabel* title_label = NULL;
	GtkLabel* _tmp18_;
	GtkLabel* _tmp19_;
	AdwHeaderBar* sidebar_header = NULL;
	GtkLabel* _tmp20_;
	GtkWidget* _tmp21_;
	AdwHeaderBar* _tmp22_ = NULL;
	AdwHeaderBar* _tmp23_;
	AdwHeaderBar* _tmp24_;
	GtkButton* _tmp25_;
	AdwHeaderBar* _tmp26_;
	GtkMenuButton* _tmp27_;
	AdwHeaderBar* _tmp28_;
	GtkButton* _tmp29_;
	LayoutsSidebar* _tmp30_;
	AdwToolbarView* sidebar_view = NULL;
	AdwToolbarView* _tmp31_;
	AdwToolbarView* _tmp32_;
	AdwHeaderBar* _tmp33_;
	AdwToolbarView* _tmp34_;
	LayoutsSidebar* _tmp35_;
	AdwViewStack* _tmp36_ = NULL;
	LayoutsItemSidebarView* _tmp37_;
	ServicesSettings* _tmp38_;
	ServicesSettings* _tmp39_;
	GSettings* _tmp40_;
	gboolean _tmp41_;
	ServicesSettings* _tmp43_;
	ServicesSettings* _tmp44_;
	GSettings* _tmp45_;
	AdwViewStack* _tmp46_;
	GtkWidget* _tmp47_;
	LayoutsItemSidebarView* _tmp48_;
	GtkWidget* _tmp49_;
	ServicesSettings* _tmp50_;
	ServicesSettings* _tmp51_;
	GSettings* _tmp52_;
	AdwOverlaySplitView* _tmp53_ = NULL;
	AdwOverlaySplitView* _tmp54_;
	AdwOverlaySplitView* _tmp55_;
	GtkWidget* _tmp56_;
	AdwToastOverlay* _tmp57_ = NULL;
	AdwToastOverlay* _tmp58_;
	GtkWidget* _tmp59_;
	AdwToolbarView* _tmp60_;
	GtkWidget* _tmp61_;
	AdwOverlaySplitView* _tmp62_ = NULL;
	AdwBreakpoint* breakpoint = NULL;
	AdwBreakpointCondition* _tmp63_;
	AdwBreakpoint* _tmp64_;
	AdwBreakpoint* _tmp65_;
	AdwOverlaySplitView* _tmp66_;
	GValue* _tmp67_ = NULL;
	AdwBreakpoint* _tmp68_;
	AdwBreakpoint* _tmp69_;
	GtkWidget* _tmp70_;
	AdwViewStack* _tmp71_ = NULL;
	AdwViewStack* _tmp72_;
	AdwOverlaySplitView* _tmp73_;
	AdwViewStack* _tmp74_;
	GtkWidget* _tmp75_;
	AdwViewStack* _tmp76_;
	ServicesSettings* _tmp77_;
	ServicesSettings* _tmp78_;
	GSettings* _tmp79_;
	AdwOverlaySplitView* _tmp80_;
	ServicesSettings* _tmp81_;
	ServicesSettings* _tmp82_;
	GSettings* _tmp83_;
	AdwOverlaySplitView* _tmp84_;
	ServicesSettings* _tmp85_;
	ServicesSettings* _tmp86_;
	GSettings* _tmp87_;
	AdwOverlaySplitView* _tmp88_;
	ServicesDatabase* _tmp89_;
	ServicesDatabase* _tmp90_;
	ColorSchemeSettingsSettings* _tmp91_;
	ColorSchemeSettingsSettings* _tmp92_;
	ColorSchemeSettingsSettings* _tmp93_;
	AdwStyleManager* _tmp94_;
	ServicesSettings* _tmp95_;
	ServicesSettings* _tmp96_;
	GSettings* _tmp97_;
	ServicesSettings* _tmp98_;
	ServicesSettings* _tmp99_;
	GSettings* _tmp100_;
	Util* _tmp101_;
	Util* _tmp102_;
	ServicesSettings* _tmp103_;
	ServicesSettings* _tmp104_;
	GSettings* _tmp105_;
	Util* _tmp106_;
	Util* _tmp107_;
	ServicesSettings* _tmp108_;
	ServicesSettings* _tmp109_;
	GSettings* _tmp110_;
	ServicesSettings* _tmp111_;
	ServicesSettings* _tmp112_;
	GSettings* _tmp113_;
	ServicesSettings* _tmp114_;
	ServicesSettings* _tmp115_;
	GSettings* _tmp116_;
	ServicesSettings* _tmp117_;
	ServicesSettings* _tmp118_;
	GSettings* _tmp119_;
	Util* _tmp120_;
	Util* _tmp121_;
	ServicesEventBus* _tmp122_;
	ServicesEventBus* _tmp123_;
	ServicesEventBus* _tmp124_;
	ServicesEventBus* _tmp125_;
	ServicesEventBus* _tmp126_;
	ServicesEventBus* _tmp127_;
	ServicesEventBus* _tmp128_;
	ServicesEventBus* _tmp129_;
	ServicesEventBus* _tmp130_;
	ServicesEventBus* _tmp131_;
	GtkButton* _tmp132_;
	ServicesEventBus* _tmp133_;
	ServicesEventBus* _tmp134_;
	ServicesEventBus* _tmp135_;
	ServicesEventBus* _tmp136_;
	AdwOverlaySplitView* _tmp137_;
	ServicesStore* _tmp138_;
	ServicesStore* _tmp139_;
	ServicesSettings* _tmp140_;
	ServicesSettings* _tmp141_;
	GSettings* _tmp142_;
	ServicesEventBus* _tmp143_;
	ServicesEventBus* _tmp144_;
	GtkEventControllerKey* key_controller = NULL;
	GtkEventControllerKey* _tmp145_;
	GtkEventControllerKey* _tmp146_;
	GtkEventController* _tmp147_;
	GtkEventControllerKey* _tmp148_;
	GtkGestureClick* window_gesture = NULL;
	GtkGestureClick* _tmp149_;
	AdwViewStack* _tmp150_;
	GtkGestureClick* _tmp151_;
	GtkEventController* _tmp152_;
	GtkGestureClick* _tmp153_;
	ServicesSettings* _tmp154_;
	ServicesSettings* _tmp155_;
	GSettings* _tmp156_;
	parent_class = G_OBJECT_CLASS (main_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW, MainWindow);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->self = g_object_ref (self);
	if (g_strcmp0 (BUILD_PROFILE, "development") == 0) {
		gtk_widget_add_css_class ((GtkWidget*) self, "devel");
	}
	_tmp0_ = self->priv->_app;
	_tmp1_ = services_action_manager_new (_tmp0_, self);
	_g_object_unref0 (self->action_manager);
	self->action_manager = _tmp1_;
	_tmp2_ = main_window_build_menu_app (self);
	settings_popover = _tmp2_;
	_tmp3_ = (GtkButton*) gtk_button_new ();
	gtk_widget_set_visible ((GtkWidget*) _tmp3_, FALSE);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->fake_button);
	self->priv->fake_button = _tmp3_;
	_tmp4_ = g_strdup ("flat");
	_tmp5_ = g_new0 (gchar*, 1 + 1);
	_tmp5_[0] = _tmp4_;
	_tmp6_ = settings_popover;
	_tmp7_ = _g_object_ref0 (_tmp6_);
	_tmp8_ = g_strdup (_ ("Main Menu"));
	_tmp9_ = g_strdup ("open-menu-symbolic");
	_tmp10_ = (GtkMenuButton*) gtk_menu_button_new ();
	gtk_widget_set_css_classes ((GtkWidget*) _tmp10_, _tmp5_);
	_tmp5_ = (_vala_array_free (_tmp5_, 1, (GDestroyNotify) g_free), NULL);
	gtk_menu_button_set_popover (_tmp10_, _tmp7_);
	_g_object_unref0 (_tmp7_);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp10_, _tmp8_);
	_g_free0 (_tmp8_);
	gtk_menu_button_set_icon_name (_tmp10_, _tmp9_);
	_g_free0 (_tmp9_);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->settings_button);
	self->priv->settings_button = _tmp10_;
	_tmp11_ = util_get_default ();
	_tmp12_ = _tmp11_;
	_tmp13_ = util_markup_accel_tooltip (_tmp12_, _ ("Open Quick Find"), "Ctrl+F");
	_tmp14_ = g_strdup ("flat");
	_tmp15_ = g_new0 (gchar*, 1 + 1);
	_tmp15_[0] = _tmp14_;
	_tmp16_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-find-symbolic");
	gtk_widget_set_tooltip_markup ((GtkWidget*) _tmp16_, _tmp13_);
	_g_free0 (_tmp13_);
	gtk_widget_set_css_classes ((GtkWidget*) _tmp16_, _tmp15_);
	_tmp15_ = (_vala_array_free (_tmp15_, 1, (GDestroyNotify) g_free), NULL);
	g_object_ref_sink (_tmp16_);
	_tmp17_ = _tmp16_;
	_g_object_unref0 (_tmp12_);
	search_button = _tmp17_;
	_tmp18_ = (GtkLabel*) gtk_label_new ("Planify");
	g_object_ref_sink (_tmp18_);
	title_label = _tmp18_;
	_tmp19_ = title_label;
	gtk_widget_add_css_class ((GtkWidget*) _tmp19_, "title");
	_tmp20_ = title_label;
	_tmp21_ = _g_object_ref0 ((GtkWidget*) _tmp20_);
	_tmp22_ = (AdwHeaderBar*) adw_header_bar_new ();
	adw_header_bar_set_title_widget (_tmp22_, _tmp21_);
	_g_object_unref0 (_tmp21_);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp22_, TRUE);
	g_object_ref_sink (_tmp22_);
	sidebar_header = _tmp22_;
	_tmp23_ = sidebar_header;
	gtk_widget_add_css_class ((GtkWidget*) _tmp23_, "flat");
	_tmp24_ = sidebar_header;
	_tmp25_ = search_button;
	adw_header_bar_pack_start (_tmp24_, (GtkWidget*) _tmp25_);
	_tmp26_ = sidebar_header;
	_tmp27_ = self->priv->settings_button;
	adw_header_bar_pack_end (_tmp26_, (GtkWidget*) _tmp27_);
	_tmp28_ = sidebar_header;
	_tmp29_ = self->priv->fake_button;
	adw_header_bar_pack_end (_tmp28_, (GtkWidget*) _tmp29_);
	_tmp30_ = layouts_sidebar_new ();
	g_object_ref_sink (_tmp30_);
	_g_object_unref0 (self->priv->sidebar);
	self->priv->sidebar = _tmp30_;
	_tmp31_ = (AdwToolbarView*) adw_toolbar_view_new ();
	g_object_ref_sink (_tmp31_);
	sidebar_view = _tmp31_;
	_tmp32_ = sidebar_view;
	_tmp33_ = sidebar_header;
	adw_toolbar_view_add_top_bar (_tmp32_, (GtkWidget*) _tmp33_);
	_tmp34_ = sidebar_view;
	_tmp35_ = self->priv->sidebar;
	adw_toolbar_view_set_content (_tmp34_, (GtkWidget*) _tmp35_);
	_tmp36_ = (AdwViewStack*) adw_view_stack_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp36_, TRUE);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp36_, TRUE);
	adw_view_stack_set_vhomogeneous (_tmp36_, FALSE);
	adw_view_stack_set_hhomogeneous (_tmp36_, FALSE);
	g_object_ref_sink (_tmp36_);
	_g_object_unref0 (self->priv->views_stack);
	self->priv->views_stack = _tmp36_;
	_tmp37_ = layouts_item_sidebar_view_new ();
	g_object_ref_sink (_tmp37_);
	_g_object_unref0 (self->priv->item_sidebar_view);
	self->priv->item_sidebar_view = _tmp37_;
	_tmp38_ = services_settings_get_default ();
	_tmp39_ = _tmp38_;
	_tmp40_ = _tmp39_->settings;
	_tmp41_ = g_settings_get_boolean (_tmp40_, "always-show-details-sidebar");
	_g_object_unref0 (_tmp39_);
	if (_tmp41_) {
		LayoutsItemSidebarView* _tmp42_;
		_tmp42_ = self->priv->item_sidebar_view;
		gtk_widget_add_css_class ((GtkWidget*) _tmp42_, "sidebar");
	}
	_tmp43_ = services_settings_get_default ();
	_tmp44_ = _tmp43_;
	_tmp45_ = _tmp44_->settings;
	_tmp46_ = self->priv->views_stack;
	_tmp47_ = _g_object_ref0 ((GtkWidget*) _tmp46_);
	_tmp48_ = self->priv->item_sidebar_view;
	_tmp49_ = _g_object_ref0 ((GtkWidget*) _tmp48_);
	_tmp50_ = services_settings_get_default ();
	_tmp51_ = _tmp50_;
	_tmp52_ = _tmp51_->settings;
	_tmp53_ = (AdwOverlaySplitView*) adw_overlay_split_view_new ();
	adw_overlay_split_view_set_sidebar_position (_tmp53_, GTK_PACK_END);
	adw_overlay_split_view_set_collapsed (_tmp53_, !g_settings_get_boolean (_tmp45_, "always-show-details-sidebar"));
	adw_overlay_split_view_set_max_sidebar_width (_tmp53_, (gdouble) 360);
	adw_overlay_split_view_set_min_sidebar_width (_tmp53_, (gdouble) 360);
	adw_overlay_split_view_set_content (_tmp53_, _tmp47_);
	_g_object_unref0 (_tmp47_);
	adw_overlay_split_view_set_sidebar (_tmp53_, _tmp49_);
	_g_object_unref0 (_tmp49_);
	adw_overlay_split_view_set_show_sidebar (_tmp53_, g_settings_get_boolean (_tmp52_, "always-show-details-sidebar"));
	g_object_ref_sink (_tmp53_);
	_tmp54_ = _tmp53_;
	_g_object_unref0 (_tmp51_);
	_g_object_unref0 (_tmp44_);
	_data8_->views_split_view = _tmp54_;
	_tmp55_ = _data8_->views_split_view;
	_tmp56_ = _g_object_ref0 ((GtkWidget*) _tmp55_);
	_tmp57_ = (AdwToastOverlay*) adw_toast_overlay_new ();
	adw_toast_overlay_set_child (_tmp57_, _tmp56_);
	_g_object_unref0 (_tmp56_);
	g_object_ref_sink (_tmp57_);
	_g_object_unref0 (self->priv->toast_overlay);
	self->priv->toast_overlay = _tmp57_;
	_tmp58_ = self->priv->toast_overlay;
	_tmp59_ = _g_object_ref0 ((GtkWidget*) _tmp58_);
	_tmp60_ = sidebar_view;
	_tmp61_ = _g_object_ref0 ((GtkWidget*) _tmp60_);
	_tmp62_ = (AdwOverlaySplitView*) adw_overlay_split_view_new ();
	adw_overlay_split_view_set_content (_tmp62_, _tmp59_);
	_g_object_unref0 (_tmp59_);
	adw_overlay_split_view_set_sidebar (_tmp62_, _tmp61_);
	_g_object_unref0 (_tmp61_);
	g_object_ref_sink (_tmp62_);
	_g_object_unref0 (self->priv->overlay_split_view);
	self->priv->overlay_split_view = _tmp62_;
	_tmp63_ = adw_breakpoint_condition_parse ("max-width: 675sp");
	_tmp64_ = adw_breakpoint_new (_tmp63_);
	breakpoint = _tmp64_;
	_tmp65_ = breakpoint;
	_tmp66_ = self->priv->overlay_split_view;
	_tmp67_ = g_new0 (GValue, 1);
	g_value_init (_tmp67_, G_TYPE_BOOLEAN);
	g_value_set_boolean (_tmp67_, TRUE);
	adw_breakpoint_add_setter (_tmp65_, (GObject*) _tmp66_, "collapsed", _tmp67_);
	__vala_GValue_free0 (_tmp67_);
	_tmp68_ = breakpoint;
	_tmp69_ = _g_object_ref0 (_tmp68_);
	adw_application_window_add_breakpoint ((AdwApplicationWindow*) self, _tmp69_);
	_tmp70_ = main_window_build_error_db_page (self);
	_g_object_unref0 (self->priv->error_db_page);
	self->priv->error_db_page = _tmp70_;
	_tmp71_ = (AdwViewStack*) adw_view_stack_new ();
	adw_view_stack_set_hhomogeneous (_tmp71_, FALSE);
	adw_view_stack_set_vhomogeneous (_tmp71_, FALSE);
	g_object_ref_sink (_tmp71_);
	_g_object_unref0 (self->priv->view_stack);
	self->priv->view_stack = _tmp71_;
	_tmp72_ = self->priv->view_stack;
	_tmp73_ = self->priv->overlay_split_view;
	adw_view_stack_add (_tmp72_, (GtkWidget*) _tmp73_);
	_tmp74_ = self->priv->view_stack;
	_tmp75_ = self->priv->error_db_page;
	adw_view_stack_add (_tmp74_, _tmp75_);
	_tmp76_ = self->priv->view_stack;
	adw_application_window_set_content ((AdwApplicationWindow*) self, (GtkWidget*) _tmp76_);
	_tmp77_ = services_settings_get_default ();
	_tmp78_ = _tmp77_;
	_tmp79_ = _tmp78_->settings;
	_tmp80_ = self->priv->overlay_split_view;
	g_settings_bind (_tmp79_, "pane-position", (GObject*) _tmp80_, "min_sidebar_width", G_SETTINGS_BIND_DEFAULT);
	_g_object_unref0 (_tmp78_);
	_tmp81_ = services_settings_get_default ();
	_tmp82_ = _tmp81_;
	_tmp83_ = _tmp82_->settings;
	_tmp84_ = self->priv->overlay_split_view;
	g_settings_bind (_tmp83_, "slim-mode", (GObject*) _tmp84_, "show_sidebar", G_SETTINGS_BIND_DEFAULT);
	_g_object_unref0 (_tmp82_);
	_tmp85_ = services_settings_get_default ();
	_tmp86_ = _tmp85_;
	_tmp87_ = _tmp86_->settings;
	_tmp88_ = self->priv->overlay_split_view;
	g_settings_bind (_tmp87_, "mobile-mode", (GObject*) _tmp88_, "collapsed", G_SETTINGS_BIND_DEFAULT);
	_g_object_unref0 (_tmp86_);
	g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 250, __main_window___lambda952__gsource_func, g_object_ref (self), g_object_unref);
	_tmp89_ = services_database_get_default ();
	_tmp90_ = _tmp89_;
	g_signal_connect_object (_tmp90_, "opened", (GCallback) __main_window___lambda953__services_database_opened, self, 0);
	_g_object_unref0 (_tmp90_);
	_tmp91_ = color_scheme_settings_settings_get_default ();
	_tmp92_ = _g_object_ref0 (_tmp91_);
	_data8_->color_scheme_settings = _tmp92_;
	_tmp93_ = _data8_->color_scheme_settings;
	g_signal_connect_data ((GObject*) _tmp93_, "notify::prefers-color-scheme", (GCallback) __main_window___lambda966__g_object_notify, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_tmp94_ = adw_style_manager_get_default ();
	g_signal_connect_object ((GObject*) _tmp94_, "notify::accent-color", (GCallback) __main_window___lambda967__g_object_notify, self, 0);
	_tmp95_ = services_settings_get_default ();
	_tmp96_ = _tmp95_;
	_tmp97_ = _tmp96_->settings;
	g_signal_connect_data (_tmp97_, "changed::system-appearance", (GCallback) __main_window___lambda968__g_settings_changed, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_g_object_unref0 (_tmp96_);
	_tmp98_ = services_settings_get_default ();
	_tmp99_ = _tmp98_;
	_tmp100_ = _tmp99_->settings;
	_tmp101_ = util_get_default ();
	_tmp102_ = _tmp101_;
	g_signal_connect_object (_tmp100_, "changed::appearance", (GCallback) _util_update_theme_g_settings_changed, _tmp102_, 0);
	_g_object_unref0 (_tmp102_);
	_g_object_unref0 (_tmp99_);
	_tmp103_ = services_settings_get_default ();
	_tmp104_ = _tmp103_;
	_tmp105_ = _tmp104_->settings;
	_tmp106_ = util_get_default ();
	_tmp107_ = _tmp106_;
	g_signal_connect_object (_tmp105_, "changed::dark-mode", (GCallback) _util_update_theme_g_settings_changed, _tmp107_, 0);
	_g_object_unref0 (_tmp107_);
	_g_object_unref0 (_tmp104_);
	_tmp108_ = services_settings_get_default ();
	_tmp109_ = _tmp108_;
	_tmp110_ = _tmp109_->settings;
	g_signal_connect_object (_tmp110_, "changed::run-on-startup", (GCallback) __main_window___lambda969__g_settings_changed, self, 0);
	_g_object_unref0 (_tmp109_);
	_tmp111_ = services_settings_get_default ();
	_tmp112_ = _tmp111_;
	_tmp113_ = _tmp112_->settings;
	g_signal_connect_object (_tmp113_, "changed::run-in-background", (GCallback) __main_window___lambda970__g_settings_changed, self, 0);
	_g_object_unref0 (_tmp112_);
	_tmp114_ = services_settings_get_default ();
	_tmp115_ = _tmp114_;
	_tmp116_ = _tmp115_->settings;
	g_signal_connect_object (_tmp116_, "changed::mobile-mode", (GCallback) __main_window___lambda971__g_settings_changed, self, 0);
	_g_object_unref0 (_tmp115_);
	_tmp117_ = services_settings_get_default ();
	_tmp118_ = _tmp117_;
	_tmp119_ = _tmp118_->settings;
	_tmp120_ = util_get_default ();
	_tmp121_ = _tmp120_;
	g_signal_connect_object (_tmp119_, "changed::font-scale", (GCallback) _util_update_font_scale_g_settings_changed, _tmp121_, 0);
	_g_object_unref0 (_tmp121_);
	_g_object_unref0 (_tmp118_);
	_tmp122_ = services_event_bus_get_default ();
	_tmp123_ = _tmp122_;
	g_signal_connect_object (_tmp123_, "pane-selected", (GCallback) __main_window___lambda972__services_event_bus_pane_selected, self, 0);
	_g_object_unref0 (_tmp123_);
	_tmp124_ = services_event_bus_get_default ();
	_tmp125_ = _tmp124_;
	g_signal_connect_object (_tmp125_, "send-toast", (GCallback) __main_window___lambda973__services_event_bus_send_toast, self, 0);
	_g_object_unref0 (_tmp125_);
	_tmp126_ = services_event_bus_get_default ();
	_tmp127_ = _tmp126_;
	g_signal_connect_object (_tmp127_, "send-error-toast", (GCallback) _main_window_send_toast_error_services_event_bus_send_error_toast, self, 0);
	_g_object_unref0 (_tmp127_);
	_tmp128_ = services_event_bus_get_default ();
	_tmp129_ = _tmp128_;
	g_signal_connect_object (_tmp129_, "send-conflict-toast", (GCallback) __main_window___lambda974__services_event_bus_send_conflict_toast, self, 0);
	_g_object_unref0 (_tmp129_);
	_tmp130_ = services_event_bus_get_default ();
	_tmp131_ = _tmp130_;
	g_signal_connect_object (_tmp131_, "send-task-completed-toast", (GCallback) _main_window_show_task_completed_toast_services_event_bus_send_task_completed_toast, self, 0);
	_g_object_unref0 (_tmp131_);
	_tmp132_ = search_button;
	g_signal_connect_object (_tmp132_, "clicked", (GCallback) __main_window___lambda976__gtk_button_clicked, self, 0);
	_tmp133_ = services_event_bus_get_default ();
	_tmp134_ = _tmp133_;
	g_signal_connect_data (_tmp134_, "open-item", (GCallback) __main_window___lambda977__services_event_bus_open_item, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_g_object_unref0 (_tmp134_);
	_tmp135_ = services_event_bus_get_default ();
	_tmp136_ = _tmp135_;
	g_signal_connect_data (_tmp136_, "close-item", (GCallback) __main_window___lambda979__services_event_bus_close_item, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_g_object_unref0 (_tmp136_);
	_tmp137_ = _data8_->views_split_view;
	g_signal_connect_data ((GObject*) _tmp137_, "notify::show-sidebar", (GCallback) __main_window___lambda980__g_object_notify, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_tmp138_ = services_store_instance ();
	g_signal_connect_object (_tmp138_, "project-archived", (GCallback) _main_window_check_archived_services_store_project_archived, self, 0);
	_tmp139_ = services_store_instance ();
	g_signal_connect_object (_tmp139_, "project-unarchived", (GCallback) _main_window_check_archived_services_store_project_unarchived, self, 0);
	_tmp140_ = services_settings_get_default ();
	_tmp141_ = _tmp140_;
	_tmp142_ = _tmp141_->settings;
	g_signal_connect_data (_tmp142_, "changed::always-show-details-sidebar", (GCallback) __main_window___lambda981__g_settings_changed, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_g_object_unref0 (_tmp141_);
	_tmp143_ = services_event_bus_get_default ();
	_tmp144_ = _tmp143_;
	g_signal_connect_object (_tmp144_, "theme-changed", (GCallback) __main_window___lambda982__services_event_bus_theme_changed, self, 0);
	_g_object_unref0 (_tmp144_);
	g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 120, __main_window___lambda983__gsource_func, g_object_ref (self), g_object_unref);
	_tmp145_ = (GtkEventControllerKey*) gtk_event_controller_key_new ();
	key_controller = _tmp145_;
	_tmp146_ = key_controller;
	_tmp147_ = _g_object_ref0 ((GtkEventController*) _tmp146_);
	gtk_widget_add_controller (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget), _tmp147_);
	_tmp148_ = key_controller;
	g_signal_connect_data (_tmp148_, "key-pressed", (GCallback) __main_window___lambda984__gtk_event_controller_key_key_pressed, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_tmp149_ = (GtkGestureClick*) gtk_gesture_click_new ();
	window_gesture = _tmp149_;
	_tmp150_ = self->priv->view_stack;
	_tmp151_ = window_gesture;
	_tmp152_ = _g_object_ref0 ((GtkEventController*) _tmp151_);
	gtk_widget_add_controller ((GtkWidget*) _tmp150_, _tmp152_);
	_tmp153_ = window_gesture;
	g_signal_connect_object (_tmp153_, "pressed", (GCallback) __main_window___lambda985__gtk_gesture_click_pressed, self, 0);
	_tmp154_ = services_settings_get_default ();
	_tmp155_ = _tmp154_;
	_tmp156_ = _tmp155_->settings;
	g_signal_connect_object (_tmp156_, "changed::local-inbox-project-id", (GCallback) __main_window___lambda986__g_settings_changed, self, 0);
	_g_object_unref0 (_tmp155_);
	g_signal_connect_object ((GtkWindow*) self, "close-request", (GCallback) __main_window___lambda987__gtk_window_close_request, self, 0);
	_g_object_unref0 (window_gesture);
	_g_object_unref0 (key_controller);
	_g_object_unref0 (breakpoint);
	_g_object_unref0 (sidebar_view);
	_g_object_unref0 (sidebar_header);
	_g_object_unref0 (title_label);
	_g_object_unref0 (search_button);
	_g_object_unref0 (settings_popover);
	block8_data_unref (_data8_);
	_data8_ = NULL;
	return obj;
}

static void
main_window_class_init (MainWindowClass * klass,
                        gpointer klass_data)
{
	GtkIconTheme* default_theme = NULL;
	GdkDisplay* _tmp0_;
	GtkIconTheme* _tmp1_;
	GtkIconTheme* _tmp2_;
	main_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MainWindow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_main_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_main_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = main_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = main_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), MAIN_WINDOW_APP_PROPERTY, main_window_properties[MAIN_WINDOW_APP_PROPERTY] = g_param_spec_object ("app", "app", "app", TYPE_PLANIFY, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = gtk_icon_theme_get_for_display (_tmp0_);
	default_theme = _tmp1_;
	_tmp2_ = default_theme;
	gtk_icon_theme_add_resource_path (_tmp2_, "/io/github/alainm23/planify/");
}

static void
main_window_instance_init (MainWindow * self,
                           gpointer klass)
{
	gchar* _tmp0_;
	GeeArrayList* _tmp1_;
	self->priv = main_window_get_instance_private (self);
	self->priv->_did_startup_sync = FALSE;
	_tmp0_ = g_strdup ("");
	self->priv->previous_inbox_project_id = _tmp0_;
	_tmp1_ = gee_array_list_new (MAIN_WINDOW_TYPE_VIEW_CACHE_ITEM, (GBoxedCopyFunc) main_window_view_cache_item_ref, (GDestroyNotify) main_window_view_cache_item_unref, NULL, NULL, NULL);
	self->priv->view_cache = _tmp1_;
}

static void
main_window_finalize (GObject * obj)
{
	MainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW, MainWindow);
	g_debug ("MainWindow.vala:57: Destroying - MainWindow\n");
	_g_object_unref0 (self->priv->sidebar);
	_g_object_unref0 (self->priv->views_stack);
	_g_object_unref0 (self->priv->overlay_split_view);
	_g_object_unref0 (self->priv->settings_button);
	_g_object_unref0 (self->priv->item_sidebar_view);
	_g_object_unref0 (self->priv->fake_button);
	_g_object_unref0 (self->priv->archive_item);
	_g_object_unref0 (self->priv->archive_separator);
	_g_object_unref0 (self->priv->toast_overlay);
	_g_object_unref0 (self->priv->view_stack);
	_g_object_unref0 (self->priv->error_db_page);
	_g_free0 (self->priv->previous_inbox_project_id);
	_g_object_unref0 (self->action_manager);
	_g_object_unref0 (self->priv->view_cache);
	G_OBJECT_CLASS (main_window_parent_class)->finalize (obj);
}

static GType
main_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MainWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) main_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MainWindow), 0, (GInstanceInitFunc) main_window_instance_init, NULL };
	GType main_window_type_id;
	main_window_type_id = g_type_register_static (adw_application_window_get_type (), "MainWindow", &g_define_type_info, 0);
	MainWindow_private_offset = g_type_add_instance_private (main_window_type_id, sizeof (MainWindowPrivate));
	return main_window_type_id;
}

GType
main_window_get_type (void)
{
	static volatile gsize main_window_type_id__once = 0;
	if (g_once_init_enter (&main_window_type_id__once)) {
		GType main_window_type_id;
		main_window_type_id = main_window_get_type_once ();
		g_once_init_leave (&main_window_type_id__once, main_window_type_id);
	}
	return main_window_type_id__once;
}

static void
_vala_main_window_get_property (GObject * object,
                                guint property_id,
                                GValue * value,
                                GParamSpec * pspec)
{
	MainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MAIN_WINDOW, MainWindow);
	switch (property_id) {
		case MAIN_WINDOW_APP_PROPERTY:
		g_value_set_object (value, main_window_get_app (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_main_window_set_property (GObject * object,
                                guint property_id,
                                const GValue * value,
                                GParamSpec * pspec)
{
	MainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MAIN_WINDOW, MainWindow);
	switch (property_id) {
		case MAIN_WINDOW_APP_PROPERTY:
		main_window_set_app (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

