/* OverviewPage.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from OverviewPage.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 <gtk/gtk.h>
#include "deja.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.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_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;
typedef struct _BasicNavigationPagePrivate BasicNavigationPagePrivate;

#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;
typedef struct _OverviewPagePrivate OverviewPagePrivate;

#define TYPE_HELP_BUTTON (help_button_get_type ())
#define HELP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HELP_BUTTON, HelpButton))
#define HELP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HELP_BUTTON, HelpButtonClass))
#define IS_HELP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HELP_BUTTON))
#define IS_HELP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HELP_BUTTON))
#define HELP_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HELP_BUTTON, HelpButtonClass))

typedef struct _HelpButton HelpButton;
typedef struct _HelpButtonClass HelpButtonClass;
enum  {
	OVERVIEW_PAGE_0_PROPERTY,
	OVERVIEW_PAGE_NUM_PROPERTIES
};
static GParamSpec* overview_page_properties[OVERVIEW_PAGE_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))
typedef struct _OverviewPageUpdateFoldersRowAsyncData OverviewPageUpdateFoldersRowAsyncData;
enum  {
	OVERVIEW_PAGE_BROWSE_SIGNAL,
	OVERVIEW_PAGE_SHOW_SCHEDULE_SIGNAL,
	OVERVIEW_PAGE_SHOW_FOLDERS_SIGNAL,
	OVERVIEW_PAGE_SHOW_STORAGE_SIGNAL,
	OVERVIEW_PAGE_NUM_SIGNALS
};
static guint overview_page_signals[OVERVIEW_PAGE_NUM_SIGNALS] = {0};

struct _BasicNavigationPage {
	AdwNavigationPage parent_instance;
	BasicNavigationPagePrivate * priv;
};

struct _BasicNavigationPageClass {
	AdwNavigationPageClass parent_class;
};

struct _OverviewPage {
	BasicNavigationPage parent_instance;
	OverviewPagePrivate * priv;
};

struct _OverviewPageClass {
	BasicNavigationPageClass parent_class;
};

struct _OverviewPagePrivate {
	AdwActionRow* schedule_row;
	AdwActionRow* folders_row;
	AdwActionRow* storage_row;
	HelpButton* storage_warning_button;
	GtkLabel* storage_warning_label;
	DejaDupFilteredSettings* settings;
	guint timeout_id;
};

struct _OverviewPageUpdateFoldersRowAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	OverviewPage* self;
	GFile** include_list;
	DejaDupFilteredSettings* _tmp0_;
	gint _tmp1_;
	GFile** _tmp2_;
	gint include_list_length1;
	gint _include_list_size_;
	gchar** nicknames;
	gchar** _tmp3_;
	gint nicknames_length1;
	gint _nicknames_size_;
	GFile** _tmp4_;
	gint _tmp4__length1;
	GFile** include_collection;
	gint include_collection_length1;
	gint _include_collection_size_;
	gint include_it;
	GFile* _tmp5_;
	GFile* include;
	GFile* _tmp6_;
	gchar* _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	AdwActionRow* _tmp9_;
	gchar** _tmp10_;
	gint _tmp10__length1;
	gchar* _tmp11_;
	gchar* _tmp12_;
	AdwActionRow* _tmp13_;
	AdwActionRow* _tmp14_;
	AdwActionRow* _tmp15_;
};

static gint OverviewPage_private_offset;
static gpointer overview_page_parent_class = NULL;

VALA_EXTERN GType basic_navigation_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BasicNavigationPage, g_object_unref)
VALA_EXTERN GType overview_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OverviewPage, g_object_unref)
VALA_EXTERN GType help_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (HelpButton, g_object_unref)
static void overview_page_update_storage_row (OverviewPage* self);
static void overview_page_on_browse_all_activated (OverviewPage* self);
static void _overview_page_on_browse_all_activated_adw_button_row_activated (AdwButtonRow* _sender,
                                                                      gpointer self);
static void overview_page_on_schedule_activated (OverviewPage* self);
static void _overview_page_on_schedule_activated_adw_action_row_activated (AdwActionRow* _sender,
                                                                    gpointer self);
static void overview_page_on_folders_activated (OverviewPage* self);
static void _overview_page_on_folders_activated_adw_action_row_activated (AdwActionRow* _sender,
                                                                   gpointer self);
static void overview_page_on_storage_activated (OverviewPage* self);
static void _overview_page_on_storage_activated_adw_action_row_activated (AdwActionRow* _sender,
                                                                   gpointer self);
static gboolean overview_page_update_schedule_row_timer (OverviewPage* self);
static void overview_page_update_schedule_row (OverviewPage* self);
VALA_EXTERN gchar* config_auto_backup_row_get_next_backup_desc (void);
static void overview_page_update_folders_row (OverviewPage* self);
static void overview_page_update_folders_row_async (OverviewPage* self,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static void overview_page_update_folders_row_finish (OverviewPage* self,
                                              GAsyncResult* _res_);
static void overview_page_update_folders_row_async_data_free (gpointer _data);
static gboolean overview_page_update_folders_row_async_co (OverviewPageUpdateFoldersRowAsyncData* _data_);
static void overview_page_update_folders_row_async_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
static void _vala_array_add4 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
VALA_EXTERN OverviewPage* overview_page_new (void);
VALA_EXTERN OverviewPage* overview_page_construct (GType object_type);
VALA_EXTERN BasicNavigationPage* basic_navigation_page_new (void);
VALA_EXTERN BasicNavigationPage* basic_navigation_page_construct (GType object_type);
static GObject * overview_page_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties);
static void _overview_page_update_storage_row_deja_dup_backend_watcher_changed (DejaDupBackendWatcher* _sender,
                                                                         gpointer self);
static void _overview_page_update_folders_row_g_settings_changed (GSettings* _sender,
                                                           const gchar* key,
                                                           gpointer self);
static void _overview_page_update_schedule_row_g_settings_changed (GSettings* _sender,
                                                            const gchar* key,
                                                            gpointer self);
static gboolean _overview_page_update_schedule_row_timer_gsource_func (gpointer self);
static void overview_page_finalize (GObject * obj);
static GType overview_page_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
overview_page_get_instance_private (OverviewPage* self)
{
	return G_STRUCT_MEMBER_P (self, OverviewPage_private_offset);
}

static void
overview_page_update_storage_row (OverviewPage* self)
{
	DejaDupBackend* backend = NULL;
	DejaDupBackend* _tmp0_;
	AdwActionRow* _tmp1_;
	DejaDupBackend* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* reason = NULL;
	DejaDupBackend* _tmp5_;
	gchar* _tmp6_ = NULL;
	gboolean _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = deja_dup_backend_get_default ();
	backend = _tmp0_;
	_tmp1_ = self->priv->storage_row;
	_tmp2_ = backend;
	_tmp3_ = deja_dup_backend_get_location_pretty (_tmp2_);
	_tmp4_ = _tmp3_;
	adw_action_row_set_subtitle (_tmp1_, _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = backend;
	_tmp7_ = deja_dup_backend_is_acceptable (_tmp5_, &_tmp6_);
	_g_free0 (reason);
	reason = _tmp6_;
	if (_tmp7_) {
		HelpButton* _tmp8_;
		AdwActionRow* _tmp9_;
		_tmp8_ = self->priv->storage_warning_button;
		gtk_widget_set_visible ((GtkWidget*) _tmp8_, FALSE);
		_tmp9_ = self->priv->storage_row;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp9_, "error");
	} else {
		HelpButton* _tmp10_;
		GtkLabel* _tmp11_;
		const gchar* _tmp12_;
		AdwActionRow* _tmp13_;
		_tmp10_ = self->priv->storage_warning_button;
		gtk_widget_set_visible ((GtkWidget*) _tmp10_, TRUE);
		_tmp11_ = self->priv->storage_warning_label;
		_tmp12_ = reason;
		gtk_label_set_label (_tmp11_, _tmp12_);
		_tmp13_ = self->priv->storage_row;
		gtk_widget_add_css_class ((GtkWidget*) _tmp13_, "error");
	}
	_g_free0 (reason);
	_g_object_unref0 (backend);
}

static void
overview_page_on_browse_all_activated (OverviewPage* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, overview_page_signals[OVERVIEW_PAGE_BROWSE_SIGNAL], 0, TRUE);
}

static void
_overview_page_on_browse_all_activated_adw_button_row_activated (AdwButtonRow* _sender,
                                                                 gpointer self)
{
	overview_page_on_browse_all_activated ((OverviewPage*) self);
}

static void
overview_page_on_schedule_activated (OverviewPage* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, overview_page_signals[OVERVIEW_PAGE_SHOW_SCHEDULE_SIGNAL], 0);
}

static void
_overview_page_on_schedule_activated_adw_action_row_activated (AdwActionRow* _sender,
                                                               gpointer self)
{
	overview_page_on_schedule_activated ((OverviewPage*) self);
}

static void
overview_page_on_folders_activated (OverviewPage* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, overview_page_signals[OVERVIEW_PAGE_SHOW_FOLDERS_SIGNAL], 0);
}

static void
_overview_page_on_folders_activated_adw_action_row_activated (AdwActionRow* _sender,
                                                              gpointer self)
{
	overview_page_on_folders_activated ((OverviewPage*) self);
}

static void
overview_page_on_storage_activated (OverviewPage* self)
{
	g_return_if_fail (self != NULL);
	g_signal_emit (self, overview_page_signals[OVERVIEW_PAGE_SHOW_STORAGE_SIGNAL], 0);
}

static void
_overview_page_on_storage_activated_adw_action_row_activated (AdwActionRow* _sender,
                                                              gpointer self)
{
	overview_page_on_storage_activated ((OverviewPage*) self);
}

static gboolean
overview_page_update_schedule_row_timer (OverviewPage* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	overview_page_update_schedule_row (self);
	result = G_SOURCE_CONTINUE;
	return result;
}

static void
overview_page_update_schedule_row (OverviewPage* self)
{
	DejaDupFilteredSettings* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	if (g_settings_get_boolean ((GSettings*) _tmp0_, DEJA_DUP_PERIODIC_KEY)) {
		AdwActionRow* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		AdwActionRow* _tmp4_;
		_tmp1_ = self->priv->schedule_row;
		_tmp2_ = config_auto_backup_row_get_next_backup_desc ();
		_tmp3_ = _tmp2_;
		adw_action_row_set_subtitle (_tmp1_, _tmp3_);
		_g_free0 (_tmp3_);
		_tmp4_ = self->priv->schedule_row;
		gtk_widget_remove_css_class ((GtkWidget*) _tmp4_, "warning");
	} else {
		AdwActionRow* _tmp5_;
		AdwActionRow* _tmp6_;
		_tmp5_ = self->priv->schedule_row;
		adw_action_row_set_subtitle (_tmp5_, _ ("Automatic backups disabled"));
		_tmp6_ = self->priv->schedule_row;
		gtk_widget_add_css_class ((GtkWidget*) _tmp6_, "warning");
	}
}

static void
overview_page_update_folders_row (OverviewPage* self)
{
	g_return_if_fail (self != NULL);
	overview_page_update_folders_row_async (self, NULL, NULL);
}

static void
overview_page_update_folders_row_async_data_free (gpointer _data)
{
	OverviewPageUpdateFoldersRowAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (OverviewPageUpdateFoldersRowAsyncData, _data_);
}

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

static void
overview_page_update_folders_row_async (OverviewPage* self,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	OverviewPageUpdateFoldersRowAsyncData* _data_;
	OverviewPage* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (OverviewPageUpdateFoldersRowAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, overview_page_update_folders_row_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	overview_page_update_folders_row_async_co (_data_);
}

static void
overview_page_update_folders_row_finish (OverviewPage* self,
                                         GAsyncResult* _res_)
{
	OverviewPageUpdateFoldersRowAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
overview_page_update_folders_row_async_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	OverviewPageUpdateFoldersRowAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	overview_page_update_folders_row_async_co (_data_);
}

static void
_vala_array_add4 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

static gboolean
overview_page_update_folders_row_async_co (OverviewPageUpdateFoldersRowAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->settings;
	_data_->_tmp1_ = 0;
	_data_->_tmp2_ = deja_dup_filtered_settings_get_file_list (_data_->_tmp0_, DEJA_DUP_INCLUDE_LIST_KEY, &_data_->_tmp1_);
	_data_->include_list = _data_->_tmp2_;
	_data_->include_list_length1 = _data_->_tmp1_;
	_data_->_include_list_size_ = _data_->include_list_length1;
	_data_->_tmp3_ = g_new0 (gchar*, 0 + 1);
	_data_->nicknames = _data_->_tmp3_;
	_data_->nicknames_length1 = 0;
	_data_->_nicknames_size_ = _data_->nicknames_length1;
	_data_->_tmp4_ = _data_->include_list;
	_data_->_tmp4__length1 = _data_->include_list_length1;
	{
		_data_->include_collection_length1 = 0;
		_data_->_include_collection_size_ = 0;
		_data_->include_collection = _data_->_tmp4_;
		_data_->include_collection_length1 = _data_->_tmp4__length1;
		for (_data_->include_it = 0; _data_->include_it < _data_->include_collection_length1; _data_->include_it = _data_->include_it + 1) {
			_data_->_tmp5_ = _g_object_ref0 (_data_->include_collection[_data_->include_it]);
			_data_->include = _data_->_tmp5_;
			{
				_data_->_tmp6_ = _data_->include;
				_data_->_state_ = 1;
				deja_dup_get_nickname (_data_->_tmp6_, overview_page_update_folders_row_async_ready, _data_);
				return FALSE;
				_state_1:
				_data_->_tmp7_ = deja_dup_get_nickname_finish (_data_->_res_);
				_vala_array_add4 (&_data_->nicknames, &_data_->nicknames_length1, &_data_->_nicknames_size_, _data_->_tmp7_);
				_g_object_unref0 (_data_->include);
			}
		}
	}
	_data_->_tmp8_ = _data_->nicknames;
	_data_->_tmp8__length1 = _data_->nicknames_length1;
	if (_data_->_tmp8__length1 > 0) {
		_data_->_tmp9_ = _data_->self->priv->folders_row;
		_data_->_tmp10_ = _data_->nicknames;
		_data_->_tmp10__length1 = _data_->nicknames_length1;
		_data_->_tmp11_ = _vala_g_strjoinv (", ", _data_->_tmp10_, (gint) _data_->_tmp10__length1);
		_data_->_tmp12_ = _data_->_tmp11_;
		adw_action_row_set_subtitle (_data_->_tmp9_, _data_->_tmp12_);
		_g_free0 (_data_->_tmp12_);
		_data_->_tmp13_ = _data_->self->priv->folders_row;
		gtk_widget_remove_css_class ((GtkWidget*) _data_->_tmp13_, "warning");
	} else {
		_data_->_tmp14_ = _data_->self->priv->folders_row;
		adw_action_row_set_subtitle (_data_->_tmp14_, _ ("None"));
		_data_->_tmp15_ = _data_->self->priv->folders_row;
		gtk_widget_add_css_class ((GtkWidget*) _data_->_tmp15_, "warning");
	}
	_data_->nicknames = (_vala_array_free (_data_->nicknames, _data_->nicknames_length1, (GDestroyNotify) g_free), NULL);
	_data_->include_list = (_vala_array_free (_data_->include_list, _data_->include_list_length1, (GDestroyNotify) g_object_unref), NULL);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

OverviewPage*
overview_page_construct (GType object_type)
{
	OverviewPage * self = NULL;
	self = (OverviewPage*) basic_navigation_page_construct (object_type);
	return self;
}

OverviewPage*
overview_page_new (void)
{
	return overview_page_construct (TYPE_OVERVIEW_PAGE);
}

static void
_overview_page_update_storage_row_deja_dup_backend_watcher_changed (DejaDupBackendWatcher* _sender,
                                                                    gpointer self)
{
	overview_page_update_storage_row ((OverviewPage*) self);
}

static void
_overview_page_update_folders_row_g_settings_changed (GSettings* _sender,
                                                      const gchar* key,
                                                      gpointer self)
{
	overview_page_update_folders_row ((OverviewPage*) self);
}

static void
_overview_page_update_schedule_row_g_settings_changed (GSettings* _sender,
                                                       const gchar* key,
                                                       gpointer self)
{
	overview_page_update_schedule_row ((OverviewPage*) self);
}

static gboolean
_overview_page_update_schedule_row_timer_gsource_func (gpointer self)
{
	gboolean result;
	result = overview_page_update_schedule_row_timer ((OverviewPage*) self);
	return result;
}

static GObject *
overview_page_constructor (GType type,
                           guint n_construct_properties,
                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	OverviewPage * self;
	DejaDupBackendWatcher* backend_watcher = NULL;
	DejaDupBackendWatcher* _tmp0_;
	DejaDupBackendWatcher* _tmp1_;
	DejaDupFilteredSettings* _tmp2_;
	DejaDupFilteredSettings* _tmp3_;
	gchar* _tmp4_;
	DejaDupFilteredSettings* _tmp5_;
	gchar* _tmp6_;
	DejaDupFilteredSettings* _tmp7_;
	gchar* _tmp8_;
	DejaDupFilteredSettings* _tmp9_;
	gchar* _tmp10_;
	parent_class = G_OBJECT_CLASS (overview_page_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_OVERVIEW_PAGE, OverviewPage);
	_tmp0_ = deja_dup_backend_watcher_get_instance ();
	backend_watcher = _tmp0_;
	_tmp1_ = backend_watcher;
	g_signal_connect_object (_tmp1_, "changed", (GCallback) _overview_page_update_storage_row_deja_dup_backend_watcher_changed, self, 0);
	overview_page_update_storage_row (self);
	_tmp2_ = deja_dup_get_settings (NULL);
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp2_;
	_tmp3_ = self->priv->settings;
	_tmp4_ = g_strconcat ("changed::", DEJA_DUP_INCLUDE_LIST_KEY, NULL);
	g_signal_connect_object ((GSettings*) _tmp3_, _tmp4_, (GCallback) _overview_page_update_folders_row_g_settings_changed, self, 0);
	_g_free0 (_tmp4_);
	overview_page_update_folders_row (self);
	_tmp5_ = self->priv->settings;
	_tmp6_ = g_strconcat ("changed::", DEJA_DUP_PERIODIC_KEY, NULL);
	g_signal_connect_object ((GSettings*) _tmp5_, _tmp6_, (GCallback) _overview_page_update_schedule_row_g_settings_changed, self, 0);
	_g_free0 (_tmp6_);
	_tmp7_ = self->priv->settings;
	_tmp8_ = g_strconcat ("changed::", DEJA_DUP_PERIODIC_PERIOD_KEY, NULL);
	g_signal_connect_object ((GSettings*) _tmp7_, _tmp8_, (GCallback) _overview_page_update_schedule_row_g_settings_changed, self, 0);
	_g_free0 (_tmp8_);
	_tmp9_ = self->priv->settings;
	_tmp10_ = g_strconcat ("changed::", DEJA_DUP_LAST_BACKUP_KEY, NULL);
	g_signal_connect_object ((GSettings*) _tmp9_, _tmp10_, (GCallback) _overview_page_update_schedule_row_g_settings_changed, self, 0);
	_g_free0 (_tmp10_);
	overview_page_update_schedule_row (self);
	self->priv->timeout_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) (60 * 60), _overview_page_update_schedule_row_timer_gsource_func, g_object_ref (self), g_object_unref);
	_g_object_unref0 (backend_watcher);
	return obj;
}

static void
overview_page_class_init (OverviewPageClass * klass,
                          gpointer klass_data)
{
	overview_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &OverviewPage_private_offset);
	G_OBJECT_CLASS (klass)->constructor = overview_page_constructor;
	G_OBJECT_CLASS (klass)->finalize = overview_page_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/DejaDup/OverviewPage.ui");
	overview_page_signals[OVERVIEW_PAGE_BROWSE_SIGNAL] = g_signal_new ("browse", TYPE_OVERVIEW_PAGE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
	overview_page_signals[OVERVIEW_PAGE_SHOW_SCHEDULE_SIGNAL] = g_signal_new ("show-schedule", TYPE_OVERVIEW_PAGE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	overview_page_signals[OVERVIEW_PAGE_SHOW_FOLDERS_SIGNAL] = g_signal_new ("show-folders", TYPE_OVERVIEW_PAGE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	overview_page_signals[OVERVIEW_PAGE_SHOW_STORAGE_SIGNAL] = g_signal_new ("show-storage", TYPE_OVERVIEW_PAGE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "schedule_row", FALSE, OverviewPage_private_offset + G_STRUCT_OFFSET (OverviewPagePrivate, schedule_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "folders_row", FALSE, OverviewPage_private_offset + G_STRUCT_OFFSET (OverviewPagePrivate, folders_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "storage_row", FALSE, OverviewPage_private_offset + G_STRUCT_OFFSET (OverviewPagePrivate, storage_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "storage_warning_button", FALSE, OverviewPage_private_offset + G_STRUCT_OFFSET (OverviewPagePrivate, storage_warning_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "storage_warning_label", FALSE, OverviewPage_private_offset + G_STRUCT_OFFSET (OverviewPagePrivate, storage_warning_label));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_browse_all_activated", G_CALLBACK(_overview_page_on_browse_all_activated_adw_button_row_activated));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_schedule_activated", G_CALLBACK(_overview_page_on_schedule_activated_adw_action_row_activated));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_folders_activated", G_CALLBACK(_overview_page_on_folders_activated_adw_action_row_activated));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_storage_activated", G_CALLBACK(_overview_page_on_storage_activated_adw_action_row_activated));
}

static void
overview_page_instance_init (OverviewPage * self,
                             gpointer klass)
{
	self->priv = overview_page_get_instance_private (self);
	g_type_ensure (TYPE_HELP_BUTTON);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
overview_page_finalize (GObject * obj)
{
	OverviewPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_OVERVIEW_PAGE, OverviewPage);
	g_source_remove (self->priv->timeout_id);
	_g_object_unref0 (self->priv->settings);
	G_OBJECT_CLASS (overview_page_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
overview_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (OverviewPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) overview_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (OverviewPage), 0, (GInstanceInitFunc) overview_page_instance_init, NULL };
	GType overview_page_type_id;
	overview_page_type_id = g_type_register_static (TYPE_BASIC_NAVIGATION_PAGE, "OverviewPage", &g_define_type_info, 0);
	OverviewPage_private_offset = g_type_add_instance_private (overview_page_type_id, sizeof (OverviewPagePrivate));
	return overview_page_type_id;
}

GType
overview_page_get_type (void)
{
	static gsize overview_page_type_id__once = 0;
	if (g_once_init_enter (&overview_page_type_id__once)) {
		GType overview_page_type_id;
		overview_page_type_id = overview_page_get_type_once ();
		g_once_init_leave (&overview_page_type_id__once, overview_page_type_id);
	}
	return overview_page_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);
}

