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

/*
 * MiscBox.vala
 *
 * Copyright 2012-2018 Tony George <teejeetech@gmail.com>
 *
 * 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 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 *
 *
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <float.h>
#include <math.h>
#include <gee.h>
#include <gdk/gdk.h>

#define MAIN_date_format_default "%Y-%m-%d %H:%M:%S"
#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_MISC_BOX (misc_box_get_type ())
#define MISC_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MISC_BOX, MiscBox))
#define MISC_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MISC_BOX, MiscBoxClass))
#define IS_MISC_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MISC_BOX))
#define IS_MISC_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MISC_BOX))
#define MISC_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MISC_BOX, MiscBoxClass))

typedef struct _MiscBox MiscBox;
typedef struct _MiscBoxClass MiscBoxClass;
typedef struct _MiscBoxPrivate MiscBoxPrivate;
enum  {
	MISC_BOX_0_PROPERTY,
	MISC_BOX_NUM_PROPERTIES
};
static GParamSpec* misc_box_properties[MISC_BOX_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block6Data Block6Data;
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_MAIN (main_get_type ())
#define MAIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN, Main))
#define MAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN, MainClass))
#define IS_MAIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN))
#define IS_MAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN))
#define MAIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN, MainClass))

typedef struct _Main Main;
typedef struct _MainClass MainClass;
typedef struct _MainPrivate MainPrivate;

#define TYPE_DEVICE (device_get_type ())
#define DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DEVICE, Device))
#define DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DEVICE, DeviceClass))
#define IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DEVICE))
#define IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DEVICE))
#define DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DEVICE, DeviceClass))

typedef struct _Device Device;
typedef struct _DeviceClass DeviceClass;

#define TYPE_APP_EXCLUDE_ENTRY (app_exclude_entry_get_type ())
#define APP_EXCLUDE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_APP_EXCLUDE_ENTRY, AppExcludeEntry))
#define APP_EXCLUDE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_APP_EXCLUDE_ENTRY, AppExcludeEntryClass))
#define IS_APP_EXCLUDE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_APP_EXCLUDE_ENTRY))
#define IS_APP_EXCLUDE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_APP_EXCLUDE_ENTRY))
#define APP_EXCLUDE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_APP_EXCLUDE_ENTRY, AppExcludeEntryClass))

typedef struct _AppExcludeEntry AppExcludeEntry;
typedef struct _AppExcludeEntryClass AppExcludeEntryClass;

#define TYPE_MOUNT_ENTRY (mount_entry_get_type ())
#define MOUNT_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MOUNT_ENTRY, MountEntry))
#define MOUNT_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MOUNT_ENTRY, MountEntryClass))
#define IS_MOUNT_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MOUNT_ENTRY))
#define IS_MOUNT_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MOUNT_ENTRY))
#define MOUNT_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MOUNT_ENTRY, MountEntryClass))

typedef struct _MountEntry MountEntry;
typedef struct _MountEntryClass MountEntryClass;

#define TYPE_SNAPSHOT_REPO (snapshot_repo_get_type ())
#define SNAPSHOT_REPO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SNAPSHOT_REPO, SnapshotRepo))
#define SNAPSHOT_REPO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SNAPSHOT_REPO, SnapshotRepoClass))
#define IS_SNAPSHOT_REPO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SNAPSHOT_REPO))
#define IS_SNAPSHOT_REPO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SNAPSHOT_REPO))
#define SNAPSHOT_REPO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SNAPSHOT_REPO, SnapshotRepoClass))

typedef struct _SnapshotRepo SnapshotRepo;
typedef struct _SnapshotRepoClass SnapshotRepoClass;

#define TYPE_SUBVOLUME (subvolume_get_type ())
#define SUBVOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SUBVOLUME, Subvolume))
#define SUBVOLUME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SUBVOLUME, SubvolumeClass))
#define IS_SUBVOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SUBVOLUME))
#define IS_SUBVOLUME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SUBVOLUME))
#define SUBVOLUME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SUBVOLUME, SubvolumeClass))

typedef struct _Subvolume Subvolume;
typedef struct _SubvolumeClass SubvolumeClass;

#define TYPE_LINUX_DISTRO (linux_distro_get_type ())
#define LINUX_DISTRO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LINUX_DISTRO, LinuxDistro))
#define LINUX_DISTRO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LINUX_DISTRO, LinuxDistroClass))
#define IS_LINUX_DISTRO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LINUX_DISTRO))
#define IS_LINUX_DISTRO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LINUX_DISTRO))
#define LINUX_DISTRO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LINUX_DISTRO, LinuxDistroClass))

typedef struct _LinuxDistro LinuxDistro;
typedef struct _LinuxDistroClass LinuxDistroClass;

#define TYPE_APP_LOCK (app_lock_get_type ())
#define APP_LOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_APP_LOCK, AppLock))
#define APP_LOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_APP_LOCK, AppLockClass))
#define IS_APP_LOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_APP_LOCK))
#define IS_APP_LOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_APP_LOCK))
#define APP_LOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_APP_LOCK, AppLockClass))

typedef struct _AppLock AppLock;
typedef struct _AppLockClass AppLockClass;

#define TYPE_SNAPSHOT (snapshot_get_type ())
#define SNAPSHOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SNAPSHOT, Snapshot))
#define SNAPSHOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SNAPSHOT, SnapshotClass))
#define IS_SNAPSHOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SNAPSHOT))
#define IS_SNAPSHOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SNAPSHOT))
#define SNAPSHOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SNAPSHOT, SnapshotClass))

typedef struct _Snapshot Snapshot;
typedef struct _SnapshotClass SnapshotClass;

#define TYPE_ASYNC_TASK (async_task_get_type ())
#define ASYNC_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ASYNC_TASK, AsyncTask))
#define ASYNC_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ASYNC_TASK, AsyncTaskClass))
#define IS_ASYNC_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ASYNC_TASK))
#define IS_ASYNC_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ASYNC_TASK))
#define ASYNC_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ASYNC_TASK, AsyncTaskClass))

typedef struct _AsyncTask AsyncTask;
typedef struct _AsyncTaskClass AsyncTaskClass;

#define TYPE_RSYNC_TASK (rsync_task_get_type ())
#define RSYNC_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RSYNC_TASK, RsyncTask))
#define RSYNC_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RSYNC_TASK, RsyncTaskClass))
#define IS_RSYNC_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RSYNC_TASK))
#define IS_RSYNC_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RSYNC_TASK))
#define RSYNC_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RSYNC_TASK, RsyncTaskClass))

typedef struct _RsyncTask RsyncTask;
typedef struct _RsyncTaskClass RsyncTaskClass;

#define TYPE_DELETE_FILE_TASK (delete_file_task_get_type ())
#define DELETE_FILE_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DELETE_FILE_TASK, DeleteFileTask))
#define DELETE_FILE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DELETE_FILE_TASK, DeleteFileTaskClass))
#define IS_DELETE_FILE_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DELETE_FILE_TASK))
#define IS_DELETE_FILE_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DELETE_FILE_TASK))
#define DELETE_FILE_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DELETE_FILE_TASK, DeleteFileTaskClass))

typedef struct _DeleteFileTask DeleteFileTask;
typedef struct _DeleteFileTaskClass DeleteFileTaskClass;

#define TYPE_RSYNC_SPACE_CHECK_TASK (rsync_space_check_task_get_type ())
#define RSYNC_SPACE_CHECK_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RSYNC_SPACE_CHECK_TASK, RsyncSpaceCheckTask))
#define RSYNC_SPACE_CHECK_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RSYNC_SPACE_CHECK_TASK, RsyncSpaceCheckTaskClass))
#define IS_RSYNC_SPACE_CHECK_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RSYNC_SPACE_CHECK_TASK))
#define IS_RSYNC_SPACE_CHECK_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RSYNC_SPACE_CHECK_TASK))
#define RSYNC_SPACE_CHECK_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RSYNC_SPACE_CHECK_TASK, RsyncSpaceCheckTaskClass))

typedef struct _RsyncSpaceCheckTask RsyncSpaceCheckTask;
typedef struct _RsyncSpaceCheckTaskClass RsyncSpaceCheckTaskClass;

#define TYPE_SYSTEM_USER (system_user_get_type ())
#define SYSTEM_USER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SYSTEM_USER, SystemUser))
#define SYSTEM_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SYSTEM_USER, SystemUserClass))
#define IS_SYSTEM_USER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SYSTEM_USER))
#define IS_SYSTEM_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SYSTEM_USER))
#define SYSTEM_USER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SYSTEM_USER, SystemUserClass))

typedef struct _SystemUser SystemUser;
typedef struct _SystemUserClass SystemUserClass;

struct _MiscBox {
	GtkBox parent_instance;
	MiscBoxPrivate * priv;
};

struct _MiscBoxClass {
	GtkBoxClass parent_class;
};

struct _MiscBoxPrivate {
	GtkWindow* parent_window;
	gboolean restore_mode;
};

struct _Block6Data {
	int _ref_count_;
	MiscBox* self;
	GtkComboBox* combo;
	GtkEntry* entry;
	GDateTime* now;
	GtkListStore* model;
};

struct _Main {
	GObject parent_instance;
	MainPrivate * priv;
	gchar* app_path;
	gchar* share_folder;
	gchar* rsnapshot_conf_path;
	gchar* app_conf_path;
	gchar* app_conf_path_old;
	gchar* app_conf_path_default;
	gboolean first_run;
	gchar* backup_uuid;
	gchar* backup_parent_uuid;
	gboolean btrfs_mode;
	gboolean include_btrfs_home_for_backup;
	gboolean include_btrfs_home_for_restore;
	gboolean stop_cron_emails;
	GeeArrayList* partitions;
	GeeArrayList* exclude_list_user;
	GeeArrayList* exclude_list_default;
	GeeArrayList* exclude_list_default_extra;
	GeeArrayList* exclude_list_home;
	GeeArrayList* exclude_list_restore;
	GeeArrayList* exclude_list_apps;
	GeeArrayList* mount_list;
	GeeArrayList* exclude_app_names;
	SnapshotRepo* repo;
	Device* sys_root;
	Device* sys_boot;
	Device* sys_efi;
	Device* sys_home;
	GeeHashMap* sys_subvolumes;
	gchar* mount_point_restore;
	gchar* mount_point_app;
	LinuxDistro* current_distro;
	gboolean mirror_system;
	gboolean schedule_monthly;
	gboolean schedule_weekly;
	gboolean schedule_daily;
	gboolean schedule_hourly;
	gboolean schedule_boot;
	gint count_monthly;
	gint count_weekly;
	gint count_daily;
	gint count_hourly;
	gint count_boot;
	gchar* app_mode;
	gboolean dry_run;
	gboolean thr_success;
	gboolean thread_restore_running;
	gboolean thread_restore_success;
	gboolean thread_delete_running;
	gboolean thread_delete_success;
	gboolean thread_subvol_info_running;
	gboolean thread_subvol_info_success;
	gint thr_retval;
	gchar* thr_arg1;
	gboolean thr_timeout_active;
	gchar* thr_timeout_cmd;
	gint startup_delay_interval_mins;
	gint retain_snapshots_max_days;
	gchar* log_dir;
	gchar* log_file;
	AppLock* app_lock;
	gchar* date_format;
	GeeArrayList* delete_list;
	Snapshot* snapshot_to_delete;
	Snapshot* snapshot_to_restore;
	gboolean reinstall_grub2;
	gboolean update_initramfs;
	gboolean update_grub;
	gchar* grub_device;
	gboolean use_option_raw;
	gboolean cmd_skip_grub;
	gchar* cmd_grub_device;
	gchar* cmd_target_device;
	gchar* cmd_backup_device;
	gchar* cmd_snapshot;
	gboolean cmd_confirm;
	gboolean cmd_verbose;
	gboolean cmd_scripted;
	gchar* cmd_comments;
	gchar* cmd_tags;
	gboolean* cmd_btrfs_mode;
	gchar* progress_text;
	GtkWindow* parent_window;
	RsyncTask* task;
	DeleteFileTask* delete_file_task;
	RsyncSpaceCheckTask* space_check_task;
	GeeHashMap* current_system_users;
	gchar* users_with_encrypted_home;
	gchar* encrypted_home_dirs;
	gboolean encrypted_home_warning_shown;
	gchar* encrypted_private_dirs;
	gboolean encrypted_private_warning_shown;
};

struct _MainClass {
	GObjectClass parent_class;
};

static gint MiscBox_private_offset;
static gpointer misc_box_parent_class = NULL;
VALA_EXTERN Main* App;

VALA_EXTERN GType misc_box_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MiscBox, g_object_unref)
VALA_EXTERN MiscBox* misc_box_new (GtkWindow* _parent_window,
                       gboolean _restore_mode);
VALA_EXTERN MiscBox* misc_box_construct (GType object_type,
                             GtkWindow* _parent_window,
                             gboolean _restore_mode);
VALA_EXTERN void tee_jee_logging_log_debug (const gchar* message);
static void misc_box_init_date_format_option (MiscBox* self,
                                       GtkBox* box);
VALA_EXTERN void misc_box_refresh (MiscBox* self);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
VALA_EXTERN GtkLabel* tee_jee_gtk_helper_add_label_header (GtkBox* box,
                                               const gchar* text,
                                               gboolean large_heading);
static void __lambda136_ (Block6Data* _data6_,
                   GtkCellLayout* cell_layout,
                   GtkCellRenderer* cell,
                   GtkTreeModel* model,
                   GtkTreeIter* iter);
static void ___lambda136__gtk_cell_layout_data_func (GtkCellLayout* cell_layout,
                                              GtkCellRenderer* cell,
                                              GtkTreeModel* tree_model,
                                              GtkTreeIter* iter,
                                              gpointer self);
VALA_EXTERN GType main_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Main, g_object_unref)
VALA_EXTERN GType device_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Device, g_object_unref)
VALA_EXTERN GType app_exclude_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AppExcludeEntry, g_object_unref)
VALA_EXTERN GType mount_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MountEntry, g_object_unref)
VALA_EXTERN GType snapshot_repo_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SnapshotRepo, g_object_unref)
VALA_EXTERN GType subvolume_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Subvolume, g_object_unref)
VALA_EXTERN GType linux_distro_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LinuxDistro, g_object_unref)
VALA_EXTERN GType app_lock_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AppLock, g_object_unref)
VALA_EXTERN GType snapshot_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Snapshot, g_object_unref)
VALA_EXTERN GType async_task_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AsyncTask, g_object_unref)
VALA_EXTERN GType rsync_task_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RsyncTask, g_object_unref)
VALA_EXTERN GType delete_file_task_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DeleteFileTask, g_object_unref)
VALA_EXTERN GType rsync_space_check_task_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RsyncSpaceCheckTask, g_object_unref)
VALA_EXTERN GType system_user_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SystemUser, g_object_unref)
static void __lambda137_ (Block6Data* _data6_,
                   GtkComboBox* path);
static void ___lambda137__gtk_combo_box_changed (GtkComboBox* _sender,
                                          gpointer self);
static gboolean __lambda138_ (Block6Data* _data6_,
                       GtkWidget* entry1,
                       GdkEventFocus* event1);
static gboolean ___lambda138__gtk_widget_focus_out_event (GtkWidget* _sender,
                                                   GdkEventFocus* event,
                                                   gpointer self);
static void misc_box_finalize (GObject * obj);
static GType misc_box_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
misc_box_get_instance_private (MiscBox* self)
{
	return G_STRUCT_MEMBER_P (self, MiscBox_private_offset);
}

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

MiscBox*
misc_box_construct (GType object_type,
                    GtkWindow* _parent_window,
                    gboolean _restore_mode)
{
	MiscBox * self = NULL;
	GtkWindow* _tmp0_;
	GtkBox* vbox = NULL;
	GtkBox* _tmp1_;
	g_return_val_if_fail (_parent_window != NULL, NULL);
	tee_jee_logging_log_debug ("MiscBox: MiscBox()");
	self = (MiscBox*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 6, NULL);
	_tmp0_ = _g_object_ref0 (_parent_window);
	_g_object_unref0 (self->priv->parent_window);
	self->priv->parent_window = _tmp0_;
	g_object_set ((GtkWidget*) self, "margin", 12, NULL);
	self->priv->restore_mode = _restore_mode;
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	g_object_ref_sink (_tmp1_);
	vbox = _tmp1_;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) vbox);
	misc_box_init_date_format_option (self, vbox);
	misc_box_refresh (self);
	tee_jee_logging_log_debug ("MiscBox: MiscBox(): exit");
	_g_object_unref0 (vbox);
	return self;
}

MiscBox*
misc_box_new (GtkWindow* _parent_window,
              gboolean _restore_mode)
{
	return misc_box_construct (TYPE_MISC_BOX, _parent_window, _restore_mode);
}

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_)) {
		MiscBox* self;
		self = _data6_->self;
		_g_object_unref0 (_data6_->model);
		_g_date_time_unref0 (_data6_->now);
		_g_object_unref0 (_data6_->entry);
		_g_object_unref0 (_data6_->combo);
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static void
__lambda136_ (Block6Data* _data6_,
              GtkCellLayout* cell_layout,
              GtkCellRenderer* cell,
              GtkTreeModel* model,
              GtkTreeIter* iter)
{
	MiscBox* self;
	gchar* txt = NULL;
	GtkTreeIter _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	const gchar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	self = _data6_->self;
	g_return_if_fail (cell_layout != NULL);
	g_return_if_fail (cell != NULL);
	g_return_if_fail (model != NULL);
	g_return_if_fail (iter != NULL);
	_tmp0_ = *iter;
	gtk_tree_model_get (model, &_tmp0_, 0, &_tmp1_, -1, -1);
	_g_free0 (txt);
	txt = _tmp1_;
	_tmp3_ = txt;
	_tmp4_ = strlen (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == 0) {
		gchar* _tmp6_;
		_tmp6_ = g_strdup (_ ("Custom"));
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp6_;
	} else {
		GDateTime* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp7_ = _data6_->now;
		_tmp8_ = txt;
		_tmp9_ = g_date_time_format (_tmp7_, _tmp8_);
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp9_;
	}
	g_object_set (G_TYPE_CHECK_INSTANCE_CAST (cell, gtk_cell_renderer_text_get_type (), GtkCellRendererText), "text", _tmp2_, NULL);
	_g_free0 (_tmp2_);
	_g_free0 (txt);
}

static void
___lambda136__gtk_cell_layout_data_func (GtkCellLayout* cell_layout,
                                         GtkCellRenderer* cell,
                                         GtkTreeModel* tree_model,
                                         GtkTreeIter* iter,
                                         gpointer self)
{
	__lambda136_ (self, cell_layout, cell, tree_model, iter);
}

static void
__lambda137_ (Block6Data* _data6_,
              GtkComboBox* path)
{
	MiscBox* self;
	GtkTreeIter iter_active = {0};
	gboolean selected = FALSE;
	GtkComboBox* _tmp0_;
	GtkTreeIter _tmp1_ = {0};
	gboolean _tmp2_;
	gchar* txt = NULL;
	GtkListStore* _tmp3_;
	GtkTreeIter _tmp4_;
	gchar* _tmp5_ = NULL;
	gchar* fmt = NULL;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	GtkEntry* _tmp12_;
	const gchar* _tmp13_;
	GtkEntry* _tmp14_;
	const gchar* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	Main* _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	self = _data6_->self;
	g_return_if_fail (path != NULL);
	_tmp0_ = _data6_->combo;
	_tmp2_ = gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
	iter_active = _tmp1_;
	selected = _tmp2_;
	if (!selected) {
		return;
	}
	_tmp3_ = _data6_->model;
	_tmp4_ = iter_active;
	gtk_tree_model_get ((GtkTreeModel*) _tmp3_, &_tmp4_, 0, &_tmp5_, -1, -1);
	_g_free0 (txt);
	txt = _tmp5_;
	_tmp6_ = g_strdup (MAIN_date_format_default);
	fmt = _tmp6_;
	_tmp7_ = txt;
	_tmp8_ = strlen (_tmp7_);
	_tmp9_ = _tmp8_;
	if (_tmp9_ > 0) {
		const gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp10_ = txt;
		_tmp11_ = g_strdup (_tmp10_);
		_g_free0 (fmt);
		fmt = _tmp11_;
	}
	_tmp12_ = _data6_->entry;
	_tmp13_ = fmt;
	gtk_entry_set_text (_tmp12_, _tmp13_);
	_tmp14_ = _data6_->entry;
	_tmp15_ = txt;
	_tmp16_ = strlen (_tmp15_);
	_tmp17_ = _tmp16_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp14_, _tmp17_ == 0);
	_tmp18_ = App;
	_tmp19_ = fmt;
	_tmp20_ = g_strdup (_tmp19_);
	_g_free0 (_tmp18_->date_format);
	_tmp18_->date_format = _tmp20_;
	_g_free0 (fmt);
	_g_free0 (txt);
}

static void
___lambda137__gtk_combo_box_changed (GtkComboBox* _sender,
                                     gpointer self)
{
	__lambda137_ (self, _sender);
}

static gboolean
__lambda138_ (Block6Data* _data6_,
              GtkWidget* entry1,
              GdkEventFocus* event1)
{
	MiscBox* self;
	Main* _tmp0_;
	GtkEntry* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	Main* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gboolean result;
	self = _data6_->self;
	g_return_val_if_fail (entry1 != NULL, FALSE);
	g_return_val_if_fail (event1 != NULL, FALSE);
	_tmp0_ = App;
	_tmp1_ = _data6_->entry;
	_tmp2_ = gtk_entry_get_text (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup (_tmp3_);
	_g_free0 (_tmp0_->date_format);
	_tmp0_->date_format = _tmp4_;
	_tmp5_ = App;
	_tmp6_ = _tmp5_->date_format;
	_tmp7_ = g_strdup_printf ("saved date_format: %s", _tmp6_);
	_tmp8_ = _tmp7_;
	tee_jee_logging_log_debug (_tmp8_);
	_g_free0 (_tmp8_);
	result = FALSE;
	return result;
}

static gboolean
___lambda138__gtk_widget_focus_out_event (GtkWidget* _sender,
                                          GdkEventFocus* event,
                                          gpointer self)
{
	gboolean result;
	result = __lambda138_ (self, _sender, event);
	return result;
}

static void
misc_box_init_date_format_option (MiscBox* self,
                                  GtkBox* box)
{
	Block6Data* _data6_;
	GtkLabel* _tmp0_;
	GtkLabel* _tmp1_;
	GtkBox* hbox = NULL;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkComboBox* _tmp4_;
	GtkComboBox* _tmp5_;
	GtkBox* _tmp6_;
	GtkComboBox* _tmp7_;
	GtkEntry* _tmp8_;
	GtkEntry* _tmp9_;
	GtkBox* _tmp10_;
	GtkEntry* _tmp11_;
	GtkCellRendererPixbuf* cell_pix = NULL;
	GtkCellRendererPixbuf* _tmp12_;
	GtkComboBox* _tmp13_;
	GtkCellRendererPixbuf* _tmp14_;
	GtkCellRendererText* cell_text = NULL;
	GtkCellRendererText* _tmp15_;
	GtkCellRendererText* _tmp16_;
	GtkComboBox* _tmp17_;
	GtkCellRendererText* _tmp18_;
	GDateTime* _tmp19_;
	GtkComboBox* _tmp20_;
	GtkCellRendererText* _tmp21_;
	GtkListStore* _tmp22_;
	GtkComboBox* _tmp23_;
	GtkListStore* _tmp24_;
	gint active = 0;
	gint index = 0;
	GtkTreeIter iter = {0};
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar** _tmp31_;
	GtkComboBox* _tmp42_;
	GtkComboBox* _tmp43_;
	GtkEntry* _tmp44_;
	Main* _tmp45_;
	const gchar* _tmp46_;
	GtkEntry* _tmp47_;
	GtkComboBox* _tmp48_;
	gint _tmp49_;
	gint _tmp50_;
	GtkEntry* _tmp51_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (box != NULL);
	_data6_ = g_slice_new0 (Block6Data);
	_data6_->_ref_count_ = 1;
	_data6_->self = g_object_ref (self);
	tee_jee_logging_log_debug ("MiscBox: init_date_format_option()");
	_tmp0_ = tee_jee_gtk_helper_add_label_header (box, _ ("Date Format"), FALSE);
	_tmp1_ = _tmp0_;
	_g_object_unref0 (_tmp1_);
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	g_object_ref_sink (_tmp2_);
	hbox = _tmp2_;
	_tmp3_ = hbox;
	gtk_container_add ((GtkContainer*) box, (GtkWidget*) _tmp3_);
	_tmp4_ = (GtkComboBox*) gtk_combo_box_new ();
	g_object_ref_sink (_tmp4_);
	_data6_->combo = _tmp4_;
	_tmp5_ = _data6_->combo;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp5_, TRUE);
	_tmp6_ = hbox;
	_tmp7_ = _data6_->combo;
	gtk_container_add ((GtkContainer*) _tmp6_, (GtkWidget*) _tmp7_);
	_tmp8_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp8_);
	_data6_->entry = _tmp8_;
	_tmp9_ = _data6_->entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp9_, TRUE);
	_tmp10_ = hbox;
	_tmp11_ = _data6_->entry;
	gtk_container_add ((GtkContainer*) _tmp10_, (GtkWidget*) _tmp11_);
	_tmp12_ = (GtkCellRendererPixbuf*) gtk_cell_renderer_pixbuf_new ();
	g_object_ref_sink (_tmp12_);
	cell_pix = _tmp12_;
	_tmp13_ = _data6_->combo;
	_tmp14_ = cell_pix;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp13_, (GtkCellRenderer*) _tmp14_, FALSE);
	_tmp15_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp15_);
	cell_text = _tmp15_;
	_tmp16_ = cell_text;
	g_object_set ((GtkCellRenderer*) _tmp16_, "xalign", (gfloat) 0.0, NULL);
	_tmp17_ = _data6_->combo;
	_tmp18_ = cell_text;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp17_, (GtkCellRenderer*) _tmp18_, FALSE);
	_tmp19_ = g_date_time_new_local (2019, 8, 11, 20, 25, (gdouble) 43);
	_data6_->now = _tmp19_;
	_tmp20_ = _data6_->combo;
	_tmp21_ = cell_text;
	gtk_cell_layout_set_cell_data_func ((GtkCellLayout*) _tmp20_, (GtkCellRenderer*) _tmp21_, ___lambda136__gtk_cell_layout_data_func, block6_data_ref (_data6_), block6_data_unref);
	_tmp22_ = gtk_list_store_new (1, G_TYPE_STRING, -1);
	_data6_->model = _tmp22_;
	_tmp23_ = _data6_->combo;
	_tmp24_ = _data6_->model;
	gtk_combo_box_set_model (_tmp23_, (GtkTreeModel*) _tmp24_);
	active = -1;
	index = -1;
	_tmp25_ = g_strdup ("");
	_tmp26_ = g_strdup ("%Y-%m-%d %H:%M:%S");
	_tmp27_ = g_strdup ("%Y-%m-%d %I:%M %p");
	_tmp28_ = g_strdup ("%d %b %Y %I:%M %p");
	_tmp29_ = g_strdup ("%Y %b %d, %I:%M %p");
	_tmp30_ = g_strdup ("%c");
	_tmp31_ = g_new0 (gchar*, 6 + 1);
	_tmp31_[0] = _tmp25_;
	_tmp31_[1] = _tmp26_;
	_tmp31_[2] = _tmp27_;
	_tmp31_[3] = _tmp28_;
	_tmp31_[4] = _tmp29_;
	_tmp31_[5] = _tmp30_;
	{
		gchar** fmt_collection = NULL;
		gint fmt_collection_length1 = 0;
		gint _fmt_collection_size_ = 0;
		gint fmt_it = 0;
		fmt_collection = _tmp31_;
		fmt_collection_length1 = 6;
		for (fmt_it = 0; fmt_it < fmt_collection_length1; fmt_it = fmt_it + 1) {
			gchar* _tmp32_;
			gchar* fmt = NULL;
			_tmp32_ = g_strdup (fmt_collection[fmt_it]);
			fmt = _tmp32_;
			{
				gint _tmp33_;
				GtkListStore* _tmp34_;
				GtkTreeIter _tmp35_ = {0};
				GtkListStore* _tmp36_;
				GtkTreeIter _tmp37_;
				const gchar* _tmp38_;
				Main* _tmp39_;
				const gchar* _tmp40_;
				const gchar* _tmp41_;
				_tmp33_ = index;
				index = _tmp33_ + 1;
				_tmp34_ = _data6_->model;
				gtk_list_store_append (_tmp34_, &_tmp35_);
				iter = _tmp35_;
				_tmp36_ = _data6_->model;
				_tmp37_ = iter;
				_tmp38_ = fmt;
				gtk_list_store_set (_tmp36_, &_tmp37_, 0, _tmp38_, -1);
				_tmp39_ = App;
				_tmp40_ = _tmp39_->date_format;
				_tmp41_ = fmt;
				if (g_strcmp0 (_tmp40_, _tmp41_) == 0) {
					active = index;
				}
				_g_free0 (fmt);
			}
		}
		fmt_collection = (_vala_array_free (fmt_collection, fmt_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	if (active < 0) {
		active = 0;
	}
	_tmp42_ = _data6_->combo;
	gtk_combo_box_set_active (_tmp42_, active);
	_tmp43_ = _data6_->combo;
	g_signal_connect_data (_tmp43_, "changed", (GCallback) ___lambda137__gtk_combo_box_changed, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	_tmp44_ = _data6_->entry;
	_tmp45_ = App;
	_tmp46_ = _tmp45_->date_format;
	gtk_entry_set_text (_tmp44_, _tmp46_);
	_tmp47_ = _data6_->entry;
	_tmp48_ = _data6_->combo;
	_tmp49_ = gtk_combo_box_get_active (_tmp48_);
	_tmp50_ = _tmp49_;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp47_, _tmp50_ == 0);
	_tmp51_ = _data6_->entry;
	g_signal_connect_data ((GtkWidget*) _tmp51_, "focus-out-event", (GCallback) ___lambda138__gtk_widget_focus_out_event, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	gtk_widget_show_all ((GtkWidget*) self);
	tee_jee_logging_log_debug ("MiscBox: init_date_format_option(): exit");
	_g_object_unref0 (cell_text);
	_g_object_unref0 (cell_pix);
	_g_object_unref0 (hbox);
	block6_data_unref (_data6_);
	_data6_ = NULL;
}

void
misc_box_refresh (MiscBox* self)
{
	Main* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = App;
	if (_tmp0_->btrfs_mode) {
	} else {
	}
	gtk_widget_show_all ((GtkWidget*) self);
}

static void
misc_box_class_init (MiscBoxClass * klass,
                     gpointer klass_data)
{
	misc_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MiscBox_private_offset);
	G_OBJECT_CLASS (klass)->finalize = misc_box_finalize;
}

static void
misc_box_instance_init (MiscBox * self,
                        gpointer klass)
{
	self->priv = misc_box_get_instance_private (self);
	self->priv->restore_mode = FALSE;
}

static void
misc_box_finalize (GObject * obj)
{
	MiscBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MISC_BOX, MiscBox);
	_g_object_unref0 (self->priv->parent_window);
	G_OBJECT_CLASS (misc_box_parent_class)->finalize (obj);
}

static GType
misc_box_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MiscBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) misc_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MiscBox), 0, (GInstanceInitFunc) misc_box_instance_init, NULL };
	GType misc_box_type_id;
	misc_box_type_id = g_type_register_static (gtk_box_get_type (), "MiscBox", &g_define_type_info, 0);
	MiscBox_private_offset = g_type_add_instance_private (misc_box_type_id, sizeof (MiscBoxPrivate));
	return misc_box_type_id;
}

GType
misc_box_get_type (void)
{
	static volatile gsize misc_box_type_id__once = 0;
	if (g_once_init_enter (&misc_box_type_id__once)) {
		GType misc_box_type_id;
		misc_box_type_id = misc_box_get_type_once ();
		g_once_init_leave (&misc_box_type_id__once, misc_box_type_id);
	}
	return misc_box_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);
}

