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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*-
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: Michael Terry
 */

#include <adwaita.h>
#include <glib-object.h>
#include "deja.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#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 TYPE_SNAPSHOTS_PAGE (snapshots_page_get_type ())
#define SNAPSHOTS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SNAPSHOTS_PAGE, SnapshotsPage))
#define SNAPSHOTS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SNAPSHOTS_PAGE, SnapshotsPageClass))
#define IS_SNAPSHOTS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SNAPSHOTS_PAGE))
#define IS_SNAPSHOTS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SNAPSHOTS_PAGE))
#define SNAPSHOTS_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SNAPSHOTS_PAGE, SnapshotsPageClass))

typedef struct _SnapshotsPage SnapshotsPage;
typedef struct _SnapshotsPageClass SnapshotsPageClass;

#define TYPE_BROWSER_PAGE (browser_page_get_type ())
#define BROWSER_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BROWSER_PAGE, BrowserPage))
#define BROWSER_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BROWSER_PAGE, BrowserPageClass))
#define IS_BROWSER_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BROWSER_PAGE))
#define IS_BROWSER_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BROWSER_PAGE))
#define BROWSER_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BROWSER_PAGE, BrowserPageClass))

typedef struct _BrowserPage BrowserPage;
typedef struct _BrowserPageClass BrowserPageClass;

#define TYPE_OPERATION_WRAPPER (operation_wrapper_get_type ())
#define OPERATION_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_OPERATION_WRAPPER, OperationWrapper))
#define OPERATION_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_OPERATION_WRAPPER, OperationWrapperClass))
#define IS_OPERATION_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_OPERATION_WRAPPER))
#define IS_OPERATION_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_OPERATION_WRAPPER))
#define OPERATION_WRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_OPERATION_WRAPPER, OperationWrapperClass))

typedef struct _OperationWrapper OperationWrapper;
typedef struct _OperationWrapperClass OperationWrapperClass;
enum  {
	MAIN_WINDOW_0_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 TYPE_DEJA_DUP_APP (deja_dup_app_get_type ())
#define DEJA_DUP_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DEJA_DUP_APP, DejaDupApp))
#define DEJA_DUP_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DEJA_DUP_APP, DejaDupAppClass))
#define IS_DEJA_DUP_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DEJA_DUP_APP))
#define IS_DEJA_DUP_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DEJA_DUP_APP))
#define DEJA_DUP_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DEJA_DUP_APP, DejaDupAppClass))

typedef struct _DejaDupApp DejaDupApp;
typedef struct _DejaDupAppClass DejaDupAppClass;

#define TYPE_BASIC_NAVIGATION_PAGE (basic_navigation_page_get_type ())
#define BASIC_NAVIGATION_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BASIC_NAVIGATION_PAGE, BasicNavigationPage))
#define BASIC_NAVIGATION_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BASIC_NAVIGATION_PAGE, BasicNavigationPageClass))
#define IS_BASIC_NAVIGATION_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BASIC_NAVIGATION_PAGE))
#define IS_BASIC_NAVIGATION_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BASIC_NAVIGATION_PAGE))
#define BASIC_NAVIGATION_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BASIC_NAVIGATION_PAGE, BasicNavigationPageClass))

typedef struct _BasicNavigationPage BasicNavigationPage;
typedef struct _BasicNavigationPageClass BasicNavigationPageClass;

#define TYPE_WELCOME_PAGE (welcome_page_get_type ())
#define WELCOME_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_WELCOME_PAGE, WelcomePage))
#define WELCOME_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_WELCOME_PAGE, WelcomePageClass))
#define IS_WELCOME_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_WELCOME_PAGE))
#define IS_WELCOME_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_WELCOME_PAGE))
#define WELCOME_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_WELCOME_PAGE, WelcomePageClass))

typedef struct _WelcomePage WelcomePage;
typedef struct _WelcomePageClass WelcomePageClass;

#define TYPE_OVERVIEW_PAGE (overview_page_get_type ())
#define OVERVIEW_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_OVERVIEW_PAGE, OverviewPage))
#define OVERVIEW_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_OVERVIEW_PAGE, OverviewPageClass))
#define IS_OVERVIEW_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_OVERVIEW_PAGE))
#define IS_OVERVIEW_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_OVERVIEW_PAGE))
#define OVERVIEW_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_OVERVIEW_PAGE, OverviewPageClass))

typedef struct _OverviewPage OverviewPage;
typedef struct _OverviewPageClass OverviewPageClass;

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

struct _MainWindowClass {
	AdwApplicationWindowClass parent_class;
};

struct _MainWindowPrivate {
	AdwToastOverlay* toast_overlay;
	AdwNavigationView* nav_view;
	SnapshotsPage* snapshots_page;
	BrowserPage* browser_page;
	DejaDupFilteredSettings* settings;
	OperationWrapper* wrapper;
};

static gint MainWindow_private_offset;
static gpointer main_window_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 snapshots_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SnapshotsPage, g_object_unref)
VALA_EXTERN GType browser_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BrowserPage, g_object_unref)
VALA_EXTERN GType operation_wrapper_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OperationWrapper, g_object_unref)
VALA_EXTERN void main_window_add_toast (MainWindow* self,
                            const gchar* message);
static void main_window_update_visible_child (MainWindow* self);
static void main_window_maybe_destroy (MainWindow* self);
VALA_EXTERN gboolean operation_wrapper_get_active (OperationWrapper* self);
static gboolean main_window_real_close_request (GtkWindow* base);
static void main_window_on_welcome_backup (MainWindow* self);
VALA_EXTERN GType deja_dup_app_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DejaDupApp, g_object_unref)
VALA_EXTERN DejaDupApp* deja_dup_app_get_instance (void);
VALA_EXTERN GType basic_navigation_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BasicNavigationPage, g_object_unref)
VALA_EXTERN GType welcome_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WelcomePage, g_object_unref)
static void _main_window_on_welcome_backup_welcome_page_back_up (WelcomePage* _sender,
                                                          gpointer self);
static void main_window_on_welcome_browse (MainWindow* self,
                                    DejaDupBackend* backend);
VALA_EXTERN void snapshots_page_scan (SnapshotsPage* self,
                          DejaDupBackend* backend);
static void _main_window_on_welcome_browse_welcome_page_browse (WelcomePage* _sender,
                                                         DejaDupBackend* backend,
                                                         gpointer self);
static void main_window_on_browse_snapshots (MainWindow* self,
                                      gboolean all);
VALA_EXTERN void browser_page_scan (BrowserPage* self,
                        const gchar* tag,
                        DejaDupOperationState* state);
VALA_EXTERN GType overview_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OverviewPage, g_object_unref)
static void _main_window_on_browse_snapshots_overview_page_browse (OverviewPage* _sender,
                                                            gboolean all,
                                                            gpointer self);
static void main_window_on_browse_files (MainWindow* self,
                                  DejaDupOperationState* state,
                                  const gchar* tag);
static void _main_window_on_browse_files_snapshots_page_browse (SnapshotsPage* _sender,
                                                         DejaDupOperationState* state,
                                                         const gchar* tag,
                                                         gpointer self);
static void main_window_on_show_schedule (MainWindow* self);
static void _main_window_on_show_schedule_overview_page_show_schedule (OverviewPage* _sender,
                                                                gpointer self);
static void main_window_on_show_folders (MainWindow* self);
static void _main_window_on_show_folders_overview_page_show_folders (OverviewPage* _sender,
                                                              gpointer self);
static void main_window_on_show_storage (MainWindow* self);
static void _main_window_on_show_storage_overview_page_show_storage (OverviewPage* _sender,
                                                              gpointer self);
VALA_EXTERN MainWindow* main_window_new (void);
VALA_EXTERN MainWindow* main_window_construct (GType object_type);
static GObject * main_window_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties);
static void _main_window_update_visible_child_g_settings_changed (GSettings* _sender,
                                                           const gchar* key,
                                                           gpointer self);
VALA_EXTERN OperationWrapper* operation_wrapper_new (DejaDupOperation* operation,
                                         GtkWidget* parent);
VALA_EXTERN OperationWrapper* operation_wrapper_construct (GType object_type,
                                               DejaDupOperation* operation,
                                               GtkWidget* parent);
static void _main_window_maybe_destroy_g_object_notify (GObject* _sender,
                                                 GParamSpec* pspec,
                                                 gpointer self);
static void main_window_finalize (GObject * obj);
static GType main_window_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

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

void
main_window_add_toast (MainWindow* self,
                       const gchar* message)
{
	AdwToastOverlay* _tmp0_;
	AdwToast* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = self->priv->toast_overlay;
	_tmp1_ = adw_toast_new (message);
	adw_toast_overlay_add_toast (_tmp0_, _tmp1_);
}

static void
main_window_update_visible_child (MainWindow* self)
{
	DejaDupFilteredSettings* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = g_settings_get_string ((GSettings*) _tmp0_, DEJA_DUP_LAST_RUN_KEY);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strcmp0 (_tmp2_, "") == 0;
	_g_free0 (_tmp2_);
	if (_tmp3_) {
		AdwNavigationView* _tmp4_;
		gchar* _tmp5_;
		gchar** _tmp6_;
		gchar** _tmp7_;
		gint _tmp7__length1;
		_tmp4_ = self->priv->nav_view;
		_tmp5_ = g_strdup ("welcome");
		_tmp6_ = g_new0 (gchar*, 1 + 1);
		_tmp6_[0] = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp7__length1 = 1;
		adw_navigation_view_replace_with_tags (_tmp4_, _tmp7_, (gint) 1);
		_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL);
	} else {
		AdwNavigationView* _tmp8_;
		gchar* _tmp9_;
		gchar** _tmp10_;
		gchar** _tmp11_;
		gint _tmp11__length1;
		_tmp8_ = self->priv->nav_view;
		_tmp9_ = g_strdup ("overview");
		_tmp10_ = g_new0 (gchar*, 1 + 1);
		_tmp10_[0] = _tmp9_;
		_tmp11_ = _tmp10_;
		_tmp11__length1 = 1;
		adw_navigation_view_replace_with_tags (_tmp8_, _tmp11_, (gint) 1);
		_tmp11_ = (_vala_array_free (_tmp11_, _tmp11__length1, (GDestroyNotify) g_free), NULL);
	}
}

static void
main_window_maybe_destroy (MainWindow* self)
{
	gboolean open_mounts = FALSE;
	DejaDupMountManager* _tmp0_;
	DejaDupMountManager* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	OperationWrapper* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = deja_dup_mount_manager_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = !deja_dup_mount_manager_has_mounts (_tmp1_);
	_g_object_unref0 (_tmp1_);
	open_mounts = _tmp2_;
	_tmp5_ = self->priv->wrapper;
	_tmp6_ = operation_wrapper_get_active (_tmp5_);
	_tmp7_ = _tmp6_;
	if (!_tmp7_) {
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp8_ = gtk_widget_get_visible ((GtkWidget*) self);
		_tmp9_ = _tmp8_;
		_tmp4_ = !_tmp9_;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		_tmp3_ = !open_mounts;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		gtk_window_destroy ((GtkWindow*) self);
	}
}

static gboolean
main_window_real_close_request (GtkWindow* base)
{
	MainWindow * self;
	DejaDupMountManager* _tmp0_;
	DejaDupMountManager* _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	self = (MainWindow*) base;
	_tmp0_ = deja_dup_mount_manager_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = !deja_dup_mount_manager_unmount_all (_tmp1_);
	_g_object_unref0 (_tmp1_);
	if (_tmp2_) {
		gtk_widget_hide ((GtkWidget*) self);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static void
main_window_on_welcome_backup (MainWindow* self)
{
	DejaDupApp* _tmp0_;
	DejaDupApp* _tmp1_;
	GAction* _tmp2_;
	AdwNavigationView* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_;
	gchar** _tmp6_;
	gint _tmp6__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = deja_dup_app_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = g_action_map_lookup_action ((GActionMap*) _tmp1_, "backup");
	g_action_activate (_tmp2_, NULL);
	_g_object_unref0 (_tmp1_);
	_tmp3_ = self->priv->nav_view;
	_tmp4_ = g_strdup ("overview");
	_tmp5_ = g_new0 (gchar*, 1 + 1);
	_tmp5_[0] = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp6__length1 = 1;
	adw_navigation_view_replace_with_tags (_tmp3_, _tmp6_, (gint) 1);
	_tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
}

static void
_main_window_on_welcome_backup_welcome_page_back_up (WelcomePage* _sender,
                                                     gpointer self)
{
	main_window_on_welcome_backup ((MainWindow*) self);
}

static void
main_window_on_welcome_browse (MainWindow* self,
                               DejaDupBackend* backend)
{
	SnapshotsPage* _tmp0_;
	AdwNavigationView* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (backend != NULL);
	_tmp0_ = self->priv->snapshots_page;
	snapshots_page_scan (_tmp0_, backend);
	_tmp1_ = self->priv->nav_view;
	adw_navigation_view_push_by_tag (_tmp1_, "snapshots");
}

static void
_main_window_on_welcome_browse_welcome_page_browse (WelcomePage* _sender,
                                                    DejaDupBackend* backend,
                                                    gpointer self)
{
	main_window_on_welcome_browse ((MainWindow*) self, backend);
}

static void
main_window_on_browse_snapshots (MainWindow* self,
                                 gboolean all)
{
	g_return_if_fail (self != NULL);
	if (all) {
		SnapshotsPage* _tmp0_;
		AdwNavigationView* _tmp1_;
		_tmp0_ = self->priv->snapshots_page;
		snapshots_page_scan (_tmp0_, NULL);
		_tmp1_ = self->priv->nav_view;
		adw_navigation_view_push_by_tag (_tmp1_, "snapshots");
	} else {
		BrowserPage* _tmp2_;
		AdwNavigationView* _tmp3_;
		_tmp2_ = self->priv->browser_page;
		browser_page_scan (_tmp2_, "", NULL);
		_tmp3_ = self->priv->nav_view;
		adw_navigation_view_push_by_tag (_tmp3_, "browser");
	}
}

static void
_main_window_on_browse_snapshots_overview_page_browse (OverviewPage* _sender,
                                                       gboolean all,
                                                       gpointer self)
{
	main_window_on_browse_snapshots ((MainWindow*) self, all);
}

static void
main_window_on_browse_files (MainWindow* self,
                             DejaDupOperationState* state,
                             const gchar* tag)
{
	BrowserPage* _tmp0_;
	AdwNavigationView* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (state != NULL);
	g_return_if_fail (tag != NULL);
	_tmp0_ = self->priv->browser_page;
	browser_page_scan (_tmp0_, tag, state);
	_tmp1_ = self->priv->nav_view;
	adw_navigation_view_push_by_tag (_tmp1_, "browser");
}

static void
_main_window_on_browse_files_snapshots_page_browse (SnapshotsPage* _sender,
                                                    DejaDupOperationState* state,
                                                    const gchar* tag,
                                                    gpointer self)
{
	main_window_on_browse_files ((MainWindow*) self, state, tag);
}

static void
main_window_on_show_schedule (MainWindow* self)
{
	AdwNavigationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->nav_view;
	adw_navigation_view_push_by_tag (_tmp0_, "schedule");
}

static void
_main_window_on_show_schedule_overview_page_show_schedule (OverviewPage* _sender,
                                                           gpointer self)
{
	main_window_on_show_schedule ((MainWindow*) self);
}

static void
main_window_on_show_folders (MainWindow* self)
{
	AdwNavigationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->nav_view;
	adw_navigation_view_push_by_tag (_tmp0_, "folders");
}

static void
_main_window_on_show_folders_overview_page_show_folders (OverviewPage* _sender,
                                                         gpointer self)
{
	main_window_on_show_folders ((MainWindow*) self);
}

static void
main_window_on_show_storage (MainWindow* self)
{
	AdwNavigationView* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->nav_view;
	adw_navigation_view_push_by_tag (_tmp0_, "storage");
}

static void
_main_window_on_show_storage_overview_page_show_storage (OverviewPage* _sender,
                                                         gpointer self)
{
	main_window_on_show_storage ((MainWindow*) self);
}

MainWindow*
main_window_construct (GType object_type)
{
	MainWindow * self = NULL;
	self = (MainWindow*) g_object_new (object_type, NULL);
	return self;
}

MainWindow*
main_window_new (void)
{
	return main_window_construct (TYPE_MAIN_WINDOW);
}

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

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

static GObject *
main_window_constructor (GType type,
                         guint n_construct_properties,
                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	MainWindow * self;
	DejaDupFilteredSettings* _tmp0_;
	DejaDupFilteredSettings* _tmp1_;
	DejaDupFilteredSettings* _tmp2_;
	DejaDupFilteredSettings* _tmp3_;
	DejaDupFilteredSettings* _tmp4_;
	DejaDupFilteredSettings* _tmp5_;
	gchar* _tmp6_;
	DejaDupOperationWatcher* watcher = NULL;
	DejaDupOperationWatcher* _tmp7_;
	DejaDupOperationWatcher* _tmp8_;
	DejaDupOperationWatcher* _tmp9_;
	OperationWrapper* _tmp10_;
	OperationWrapper* _tmp11_;
	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);
	if (g_strcmp0 (PROFILE, "Devel") == 0) {
		gtk_widget_add_css_class ((GtkWidget*) self, "devel");
	}
	_tmp0_ = deja_dup_get_settings (NULL);
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp0_;
	_tmp1_ = self->priv->settings;
	g_settings_bind ((GSettings*) _tmp1_, DEJA_DUP_WINDOW_WIDTH_KEY, (GObject*) self, "default-width", G_SETTINGS_BIND_DEFAULT);
	_tmp2_ = self->priv->settings;
	g_settings_bind ((GSettings*) _tmp2_, DEJA_DUP_WINDOW_HEIGHT_KEY, (GObject*) self, "default-height", G_SETTINGS_BIND_DEFAULT);
	_tmp3_ = self->priv->settings;
	g_settings_bind ((GSettings*) _tmp3_, DEJA_DUP_WINDOW_MAXIMIZED_KEY, (GObject*) self, "maximized", G_SETTINGS_BIND_DEFAULT);
	_tmp4_ = self->priv->settings;
	g_settings_bind ((GSettings*) _tmp4_, DEJA_DUP_WINDOW_FULLSCREENED_KEY, (GObject*) self, "fullscreened", G_SETTINGS_BIND_DEFAULT);
	_tmp5_ = self->priv->settings;
	_tmp6_ = g_strconcat ("changed::", DEJA_DUP_LAST_RUN_KEY, NULL);
	g_signal_connect_object ((GSettings*) _tmp5_, _tmp6_, (GCallback) _main_window_update_visible_child_g_settings_changed, self, 0);
	_g_free0 (_tmp6_);
	main_window_update_visible_child (self);
	_tmp7_ = deja_dup_operation_watcher_get_instance ();
	watcher = _tmp7_;
	_tmp8_ = watcher;
	g_object_bind_property_with_closures ((GObject*) _tmp8_, "active", (GObject*) self, "hide-on-close", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp9_ = watcher;
	_tmp10_ = operation_wrapper_new ((DejaDupOperation*) _tmp9_, (GtkWidget*) self);
	_g_object_unref0 (self->priv->wrapper);
	self->priv->wrapper = _tmp10_;
	_tmp11_ = self->priv->wrapper;
	g_signal_connect_object ((GObject*) _tmp11_, "notify::active", (GCallback) _main_window_maybe_destroy_g_object_notify, self, 0);
	_g_object_unref0 (watcher);
	return obj;
}

static void
main_window_class_init (MainWindowClass * klass,
                        gpointer klass_data)
{
	main_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MainWindow_private_offset);
	((GtkWindowClass *) klass)->close_request = (gboolean (*) (GtkWindow*)) main_window_real_close_request;
	G_OBJECT_CLASS (klass)->constructor = main_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = main_window_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/DejaDup/MainWindow.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "toast_overlay", FALSE, MainWindow_private_offset + G_STRUCT_OFFSET (MainWindowPrivate, toast_overlay));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "nav_view", FALSE, MainWindow_private_offset + G_STRUCT_OFFSET (MainWindowPrivate, nav_view));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "snapshots_page", FALSE, MainWindow_private_offset + G_STRUCT_OFFSET (MainWindowPrivate, snapshots_page));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "browser_page", FALSE, MainWindow_private_offset + G_STRUCT_OFFSET (MainWindowPrivate, browser_page));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_welcome_backup", G_CALLBACK(_main_window_on_welcome_backup_welcome_page_back_up));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_welcome_browse", G_CALLBACK(_main_window_on_welcome_browse_welcome_page_browse));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_browse_snapshots", G_CALLBACK(_main_window_on_browse_snapshots_overview_page_browse));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_browse_files", G_CALLBACK(_main_window_on_browse_files_snapshots_page_browse));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_show_schedule", G_CALLBACK(_main_window_on_show_schedule_overview_page_show_schedule));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_show_folders", G_CALLBACK(_main_window_on_show_folders_overview_page_show_folders));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_show_storage", G_CALLBACK(_main_window_on_show_storage_overview_page_show_storage));
}

static void
main_window_instance_init (MainWindow * self,
                           gpointer klass)
{
	self->priv = main_window_get_instance_private (self);
	g_type_ensure (TYPE_SNAPSHOTS_PAGE);
	g_type_ensure (TYPE_BROWSER_PAGE);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
main_window_finalize (GObject * obj)
{
	MainWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW, MainWindow);
	g_debug ("MainWindow.vala:54: Finalizing MainWindow\n");
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->wrapper);
	G_OBJECT_CLASS (main_window_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE 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 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_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);
}

