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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*- */
/*
    This file is part of Déjà Dup.
    © 2008,2009 Michael Terry <mike@mterry.name>

    Déjà Dup is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Déjà Dup 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 Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <widgets.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <common.h>
#include <gconf/gconf-client.h>


#define TYPE_PREFERENCES_DIALOG (preferences_dialog_get_type ())
#define PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PREFERENCES_DIALOG, PreferencesDialog))
#define PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PREFERENCES_DIALOG, PreferencesDialogClass))
#define IS_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PREFERENCES_DIALOG))
#define IS_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PREFERENCES_DIALOG))
#define PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PREFERENCES_DIALOG, PreferencesDialogClass))

typedef struct _PreferencesDialog PreferencesDialog;
typedef struct _PreferencesDialogClass PreferencesDialogClass;
typedef struct _PreferencesDialogPrivate PreferencesDialogPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _PreferencesDialog {
	GtkDialog parent_instance;
	PreferencesDialogPrivate * priv;
};

struct _PreferencesDialogClass {
	GtkDialogClass parent_class;
};

struct _PreferencesDialogPrivate {
	GList** backend_widgets;
	gint backend_widgets_length1;
	gint _backend_widgets_size_;
	GtkSizeGroup* label_sizes;
	GtkSizeGroup* button_sizes;
	DejaDupToggleGroup* periodic_toggle;
	GtkHBox* location_hbox;
	DejaDupConfigLabelLocation* location_label_noedit;
	GtkButton* location_label_button;
};


static gpointer preferences_dialog_parent_class = NULL;

GType preferences_dialog_get_type (void);
#define PREFERENCES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PREFERENCES_DIALOG, PreferencesDialogPrivate))
enum  {
	PREFERENCES_DIALOG_DUMMY_PROPERTY
};
static void _g_list_free_g_object_unref (GList* self);
#define PREFERENCES_DIALOG_S3_LIST 0
#define PREFERENCES_DIALOG_NUM_LISTS 1
PreferencesDialog* preferences_dialog_new (GtkWindow* parent);
PreferencesDialog* preferences_dialog_construct (GType object_type, GtkWindow* parent);
static void preferences_dialog_handle_location_changed (PreferencesDialog* self, DejaDupConfigWidget* location);
static void _preferences_dialog_handle_location_changed_deja_dup_config_widget_changed (DejaDupConfigWidget* _sender, gpointer self);
static void preferences_dialog_handle_edit_location (PreferencesDialog* self);
static void preferences_dialog_handle_location_label_changed (PreferencesDialog* self, DejaDupConfigWidget* location);
static void preferences_dialog_handle_response (PreferencesDialog* self, GtkDialog* dlg, gint response);
static void _preferences_dialog_handle_response_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
static void _preferences_dialog_handle_location_label_changed_deja_dup_config_widget_changed (DejaDupConfigWidget* _sender, gpointer self);
static void _preferences_dialog_handle_edit_location_gtk_button_clicked (GtkButton* _sender, gpointer self);
static GObject * preferences_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void preferences_dialog_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static int _vala_strcmp0 (const char * str1, const char * str2);



static void _g_list_free_g_object_unref (GList* self) {
	g_list_foreach (self, (GFunc) g_object_unref, NULL);
	g_list_free (self);
}


PreferencesDialog* preferences_dialog_construct (GType object_type, GtkWindow* parent) {
	GParameter * __params;
	GParameter * __params_it;
	PreferencesDialog * self;
	__params = g_new0 (GParameter, 1);
	__params_it = __params;
	__params_it->name = "transient-for";
	g_value_init (&__params_it->value, GTK_TYPE_WINDOW);
	g_value_set_object (&__params_it->value, parent);
	__params_it++;
	self = g_object_newv (object_type, __params_it - __params, __params);
	while (__params_it > __params) {
		--__params_it;
		g_value_unset (&__params_it->value);
	}
	g_free (__params);
	return self;
}


PreferencesDialog* preferences_dialog_new (GtkWindow* parent) {
	return preferences_dialog_construct (TYPE_PREFERENCES_DIALOG, parent);
}


static void _preferences_dialog_handle_location_changed_deja_dup_config_widget_changed (DejaDupConfigWidget* _sender, gpointer self) {
	preferences_dialog_handle_location_changed (self, _sender);
}


static void preferences_dialog_handle_edit_location (PreferencesDialog* self) {
	DejaDupConfigLocation* location;
	g_return_if_fail (self != NULL);
	if (self->priv->location_label_noedit != NULL) {
		DejaDupConfigLabelLocation* _tmp0_;
		gtk_object_destroy ((GtkObject*) self->priv->location_label_noedit);
		self->priv->location_label_noedit = (_tmp0_ = NULL, _g_object_unref0 (self->priv->location_label_noedit), _tmp0_);
	}
	if (self->priv->location_label_button != NULL) {
		GtkButton* _tmp1_;
		gtk_object_destroy ((GtkObject*) self->priv->location_label_button);
		self->priv->location_label_button = (_tmp1_ = NULL, _g_object_unref0 (self->priv->location_label_button), _tmp1_);
	}
	location = g_object_ref_sink (deja_dup_config_location_new ());
	gtk_widget_show_all ((GtkWidget*) location);
	g_signal_connect_object ((DejaDupConfigWidget*) location, "changed", (GCallback) _preferences_dialog_handle_location_changed_deja_dup_config_widget_changed, self, 0);
	gtk_container_add ((GtkContainer*) self->priv->location_hbox, (GtkWidget*) location);
	preferences_dialog_handle_location_changed (self, (DejaDupConfigWidget*) location);
	_g_object_unref0 (location);
}


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


static void preferences_dialog_handle_location_label_changed (PreferencesDialog* self, DejaDupConfigWidget* location) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (location != NULL);
	{
		gint i;
		i = 0;
		{
			gboolean _tmp0_;
			_tmp0_ = TRUE;
			while (TRUE) {
				gboolean show;
				gboolean _tmp1_ = FALSE;
				if (!_tmp0_) {
					i = i + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < PREFERENCES_DIALOG_NUM_LISTS)) {
					break;
				}
				show = FALSE;
				if (i == PREFERENCES_DIALOG_S3_LIST) {
					_tmp1_ = deja_dup_config_label_location_get_is_s3 (DEJA_DUP_CONFIG_LABEL_LOCATION (location));
				} else {
					_tmp1_ = FALSE;
				}
				if (_tmp1_) {
					show = TRUE;
				}
				{
					GList* w_collection;
					GList* w_it;
					w_collection = self->priv->backend_widgets[i];
					for (w_it = w_collection; w_it != NULL; w_it = w_it->next) {
						GtkWidget* w;
						w = _g_object_ref0 ((GtkWidget*) w_it->data);
						{
							gtk_widget_set_no_show_all (w, !show);
							if (show) {
								gtk_widget_show_all (w);
							} else {
								gtk_widget_hide (w);
							}
							_g_object_unref0 (w);
						}
					}
				}
			}
		}
	}
}


static void preferences_dialog_handle_location_changed (PreferencesDialog* self, DejaDupConfigWidget* location) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (location != NULL);
	{
		gint i;
		i = 0;
		{
			gboolean _tmp0_;
			_tmp0_ = TRUE;
			while (TRUE) {
				gboolean show;
				gboolean _tmp1_ = FALSE;
				if (!_tmp0_) {
					i = i + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < PREFERENCES_DIALOG_NUM_LISTS)) {
					break;
				}
				show = FALSE;
				if (i == PREFERENCES_DIALOG_S3_LIST) {
					_tmp1_ = deja_dup_config_location_get_is_s3 (DEJA_DUP_CONFIG_LOCATION (location));
				} else {
					_tmp1_ = FALSE;
				}
				if (_tmp1_) {
					show = TRUE;
				}
				{
					GList* w_collection;
					GList* w_it;
					w_collection = self->priv->backend_widgets[i];
					for (w_it = w_collection; w_it != NULL; w_it = w_it->next) {
						GtkWidget* w;
						w = _g_object_ref0 ((GtkWidget*) w_it->data);
						{
							gtk_widget_set_no_show_all (w, !show);
							if (show) {
								gtk_widget_show_all (w);
							} else {
								gtk_widget_hide (w);
							}
							_g_object_unref0 (w);
						}
					}
				}
			}
		}
	}
}


static void preferences_dialog_handle_response (PreferencesDialog* self, GtkDialog* dlg, gint response) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (dlg != NULL);
	switch (response) {
		case GTK_RESPONSE_HELP:
		{
			deja_dup_show_uri ((GtkWindow*) dlg, "ghelp:deja-dup#deja-dup-prefs");
			break;
		}
		default:
		{
			gtk_main_quit ();
			break;
		}
	}
}


static void _preferences_dialog_handle_response_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
	preferences_dialog_handle_response (self, _sender, response_id);
}


static void _preferences_dialog_handle_location_label_changed_deja_dup_config_widget_changed (DejaDupConfigWidget* _sender, gpointer self) {
	preferences_dialog_handle_location_label_changed (self, _sender);
}


static void _preferences_dialog_handle_edit_location_gtk_button_clicked (GtkButton* _sender, gpointer self) {
	preferences_dialog_handle_edit_location (self);
}


static GObject * preferences_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	PreferencesDialog * self;
	GError * _inner_error_;
	parent_class = G_OBJECT_CLASS (preferences_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = PREFERENCES_DIALOG (obj);
	_inner_error_ = NULL;
	{
		GtkTable* table;
		gint row;
		GtkWidget* w;
		GtkLabel* label;
		GList** _tmp0_;
		GtkSizeGroup* _tmp1_;
		GtkSizeGroup* _tmp2_;
		char* last_run;
		GtkHBox* _tmp5_;
		gboolean _tmp6_ = FALSE;
		GtkLabel* _tmp9_;
		GtkTable* s3_table;
		GtkWidget* _tmp10_;
		GtkLabel* _tmp12_;
		char* _tmp11_;
		GtkWidget* _tmp13_;
		GtkLabel* _tmp15_;
		char* _tmp14_;
		GtkWidget* _tmp16_;
		GtkLabel* _tmp17_;
		GtkWidget* _tmp18_;
		GtkLabel* _tmp19_;
		GtkWidget* _tmp20_;
		DejaDupConfigBool* periodic_check;
		GtkWidget* _tmp21_;
		GtkLabel* _tmp23_;
		char* _tmp22_;
		DejaDupToggleGroup* _tmp24_;
		GtkWidget* _tmp25_;
		GtkLabel* _tmp27_;
		char* _tmp26_;
		g_object_set ((GObject*) self, "title", _ ("Déjà Dup Preferences"), "has-separator", FALSE, NULL);
		gtk_dialog_add_buttons ((GtkDialog*) self, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, GTK_STOCK_HELP, GTK_RESPONSE_HELP, NULL);
		g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) _preferences_dialog_handle_response_gtk_dialog_response, self, 0);
		table = g_object_ref_sink ((GtkTable*) gtk_table_new ((guint) 0, (guint) 3, FALSE));
		g_object_set ((GObject*) table, "border-width", 3, NULL);
		row = 0;
		w = NULL;
		label = NULL;
		self->priv->backend_widgets = (_tmp0_ = g_new0 (GList*, PREFERENCES_DIALOG_NUM_LISTS + 1), self->priv->backend_widgets = (_vala_array_free (self->priv->backend_widgets, self->priv->backend_widgets_length1, (GDestroyNotify) _g_list_free_g_object_unref), NULL), self->priv->backend_widgets_length1 = PREFERENCES_DIALOG_NUM_LISTS, self->priv->_backend_widgets_size_ = self->priv->backend_widgets_length1, _tmp0_);
		self->priv->label_sizes = (_tmp1_ = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL), _g_object_unref0 (self->priv->label_sizes), _tmp1_);
		self->priv->button_sizes = (_tmp2_ = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL), _g_object_unref0 (self->priv->button_sizes), _tmp2_);
		last_run = NULL;
		{
			GConfClient* client;
			char* _tmp3_;
			char* _tmp4_;
			client = deja_dup_get_gconf_client ();
			_tmp3_ = gconf_client_get_string (client, DEJA_DUP_LAST_RUN_KEY, &_inner_error_);
			if (_inner_error_ != NULL) {
				_g_object_unref0 (client);
				goto __catch0_g_error;
			}
			last_run = (_tmp4_ = _tmp3_, _g_free0 (last_run), _tmp4_);
			_g_object_unref0 (client);
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError * e;
			e = _inner_error_;
			_inner_error_ = NULL;
			{
				g_warning ("PreferencesDialog.vala:69: %s\n", e->message);
				_g_error_free0 (e);
			}
		}
		__finally0:
		if (_inner_error_ != NULL) {
			_g_object_unref0 (table);
			_g_object_unref0 (w);
			_g_object_unref0 (label);
			_g_free0 (last_run);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
		}
		self->priv->location_hbox = (_tmp5_ = g_object_ref_sink ((GtkHBox*) gtk_hbox_new (FALSE, 6)), _g_object_unref0 (self->priv->location_hbox), _tmp5_);
		g_object_set ((GObject*) self->priv->location_hbox, "border-width", 0, NULL);
		if (last_run != NULL) {
			_tmp6_ = _vala_strcmp0 (last_run, "") != 0;
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			DejaDupConfigLabelLocation* _tmp7_;
			GtkButton* _tmp8_;
			self->priv->location_label_noedit = (_tmp7_ = g_object_ref_sink (deja_dup_config_label_location_new ()), _g_object_unref0 (self->priv->location_label_noedit), _tmp7_);
			g_signal_connect_object ((DejaDupConfigWidget*) self->priv->location_label_noedit, "changed", (GCallback) _preferences_dialog_handle_location_label_changed_deja_dup_config_widget_changed, self, 0);
			self->priv->location_label_button = (_tmp8_ = g_object_ref_sink ((GtkButton*) gtk_button_new_from_stock (GTK_STOCK_EDIT)), _g_object_unref0 (self->priv->location_label_button), _tmp8_);
			g_signal_connect_object (self->priv->location_label_button, "clicked", (GCallback) _preferences_dialog_handle_edit_location_gtk_button_clicked, self, 0);
			gtk_size_group_add_widget (self->priv->button_sizes, (GtkWidget*) self->priv->location_label_button);
			gtk_box_pack_start ((GtkBox*) self->priv->location_hbox, (GtkWidget*) self->priv->location_label_noedit, TRUE, TRUE, (guint) 0);
			gtk_box_pack_start ((GtkBox*) self->priv->location_hbox, (GtkWidget*) self->priv->location_label_button, FALSE, FALSE, (guint) 0);
		}
		label = (_tmp9_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("_Backup location:"))), _g_object_unref0 (label), _tmp9_);
		g_object_set ((GObject*) label, "mnemonic-widget", self->priv->location_hbox, "use-underline", TRUE, "xalign", 0.0f, NULL);
		gtk_size_group_add_widget (self->priv->label_sizes, (GtkWidget*) label);
		gtk_table_attach (table, (GtkWidget*) label, (guint) 0, (guint) 1, (guint) row, (guint) (row + 1), 0, GTK_FILL, (guint) 3, (guint) 3);
		gtk_table_attach (table, (GtkWidget*) self->priv->location_hbox, (guint) 1, (guint) 2, (guint) row, (guint) (row + 1), GTK_FILL | GTK_EXPAND, GTK_FILL, (guint) 3, (guint) 3);
		row = row + 1;
		s3_table = g_object_ref_sink ((GtkTable*) gtk_table_new ((guint) 1, (guint) 3, FALSE));
		w = (_tmp10_ = (GtkWidget*) g_object_ref_sink (deja_dup_config_entry_new (DEJA_DUP_S3_ID_KEY)), _g_object_unref0 (w), _tmp10_);
		label = (_tmp12_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_tmp11_ = g_strdup_printf ("    %s", _ ("S3 Access Key I_D:")))), _g_object_unref0 (label), _tmp12_);
		_g_free0 (_tmp11_);
		g_object_set ((GObject*) label, "mnemonic-widget", w, "use-underline", TRUE, "xalign", 0.0f, NULL);
		gtk_size_group_add_widget (self->priv->label_sizes, (GtkWidget*) label);
		gtk_table_attach (s3_table, (GtkWidget*) label, (guint) 0, (guint) 1, (guint) 0, (guint) 1, 0, GTK_FILL, (guint) 3, (guint) 3);
		gtk_table_attach (s3_table, w, (guint) 1, (guint) 3, (guint) 0, (guint) 1, GTK_FILL | GTK_EXPAND, GTK_FILL, (guint) 3, (guint) 3);
		w = (_tmp13_ = (GtkWidget*) g_object_ref_sink (deja_dup_config_entry_new (DEJA_DUP_S3_FOLDER_KEY)), _g_object_unref0 (w), _tmp13_);
		label = (_tmp15_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_tmp14_ = g_strdup_printf ("    %s", _ ("_Folder:")))), _g_object_unref0 (label), _tmp15_);
		_g_free0 (_tmp14_);
		g_object_set ((GObject*) label, "mnemonic-widget", w, "use-underline", TRUE, "xalign", 0.0f, NULL);
		gtk_size_group_add_widget (self->priv->label_sizes, (GtkWidget*) label);
		gtk_table_attach (s3_table, (GtkWidget*) label, (guint) 0, (guint) 1, (guint) 1, (guint) 2, 0, GTK_FILL, (guint) 3, (guint) 3);
		gtk_table_attach (s3_table, w, (guint) 1, (guint) 3, (guint) 1, (guint) 2, GTK_FILL | GTK_EXPAND, GTK_FILL, (guint) 3, (guint) 3);
		gtk_table_attach (table, (GtkWidget*) s3_table, (guint) 0, (guint) 3, (guint) row, (guint) (row + 1), GTK_FILL, GTK_FILL, (guint) 0, (guint) 0);
		self->priv->backend_widgets[PREFERENCES_DIALOG_S3_LIST] = g_list_append (self->priv->backend_widgets[PREFERENCES_DIALOG_S3_LIST], _g_object_ref0 ((GtkWidget*) s3_table));
		row = row + 1;
		w = (_tmp16_ = (GtkWidget*) g_object_ref_sink (deja_dup_config_list_new (DEJA_DUP_INCLUDE_LIST_KEY, self->priv->button_sizes)), _g_object_unref0 (w), _tmp16_);
		gtk_widget_set_size_request (w, 250, 80);
		label = (_tmp17_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("I_nclude files in folders:"))), _g_object_unref0 (label), _tmp17_);
		g_object_set ((GObject*) label, "mnemonic-widget", w, "use-underline", TRUE, "wrap", TRUE, "width-request", 150, "xalign", 0.0f, "yalign", 0.0f, NULL);
		gtk_size_group_add_widget (self->priv->label_sizes, (GtkWidget*) label);
		gtk_table_attach (table, (GtkWidget*) label, (guint) 0, (guint) 1, (guint) row, (guint) (row + 1), GTK_FILL, GTK_FILL, (guint) 3, (guint) 3);
		gtk_table_attach (table, w, (guint) 1, (guint) 3, (guint) row, (guint) (row + 1), GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, (guint) 3, (guint) 3);
		row = row + 1;
		w = (_tmp18_ = (GtkWidget*) g_object_ref_sink (deja_dup_config_list_new (DEJA_DUP_EXCLUDE_LIST_KEY, self->priv->button_sizes)), _g_object_unref0 (w), _tmp18_);
		gtk_widget_set_size_request (w, 250, 120);
		label = (_tmp19_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_ ("E_xcept files in folders:"))), _g_object_unref0 (label), _tmp19_);
		g_object_set ((GObject*) label, "mnemonic-widget", w, "use-underline", TRUE, "wrap", TRUE, "width-request", 150, "xalign", 0.0f, "yalign", 0.0f, NULL);
		gtk_size_group_add_widget (self->priv->label_sizes, (GtkWidget*) label);
		gtk_table_attach (table, (GtkWidget*) label, (guint) 0, (guint) 1, (guint) row, (guint) (row + 1), GTK_FILL, GTK_FILL, (guint) 3, (guint) 3);
		gtk_table_attach (table, w, (guint) 1, (guint) 3, (guint) row, (guint) (row + 1), GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, (guint) 3, (guint) 3);
		row = row + 1;
		w = (_tmp20_ = (GtkWidget*) g_object_ref_sink (deja_dup_config_bool_new (DEJA_DUP_ENCRYPT_KEY, _ ("_Encrypt backup files"))), _g_object_unref0 (w), _tmp20_);
		gtk_table_attach (table, w, (guint) 0, (guint) 3, (guint) row, (guint) (row + 1), GTK_FILL | GTK_EXPAND, GTK_FILL, (guint) 3, (guint) 3);
		row = row + 1;
		periodic_check = g_object_ref_sink (deja_dup_config_bool_new (DEJA_DUP_PERIODIC_KEY, _ ("_Automatically backup on a regular schedule")));
		gtk_table_attach (table, (GtkWidget*) periodic_check, (guint) 0, (guint) 3, (guint) row, (guint) (row + 1), GTK_FILL | GTK_EXPAND, GTK_FILL, (guint) 3, (guint) 3);
		row = row + 1;
		w = (_tmp21_ = (GtkWidget*) g_object_ref_sink (deja_dup_config_period_new (DEJA_DUP_PERIODIC_PERIOD_KEY)), _g_object_unref0 (w), _tmp21_);
		label = (_tmp23_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_tmp22_ = g_strdup_printf ("    %s", _ ("How _often to backup:")))), _g_object_unref0 (label), _tmp23_);
		_g_free0 (_tmp22_);
		g_object_set ((GObject*) label, "mnemonic-widget", w, "use-underline", TRUE, "xalign", 0.0f, NULL);
		gtk_size_group_add_widget (self->priv->label_sizes, (GtkWidget*) label);
		gtk_table_attach (table, (GtkWidget*) label, (guint) 0, (guint) 1, (guint) row, (guint) (row + 1), 0, GTK_FILL, (guint) 3, (guint) 3);
		gtk_table_attach (table, w, (guint) 1, (guint) 3, (guint) row, (guint) (row + 1), GTK_FILL | GTK_EXPAND, GTK_FILL, (guint) 3, (guint) 3);
		self->priv->periodic_toggle = (_tmp24_ = deja_dup_toggle_group_new ((DejaDupTogglable*) periodic_check), _g_object_unref0 (self->priv->periodic_toggle), _tmp24_);
		deja_dup_toggle_group_add_dependent (self->priv->periodic_toggle, (GtkWidget*) label);
		deja_dup_toggle_group_add_dependent (self->priv->periodic_toggle, w);
		deja_dup_toggle_group_check (self->priv->periodic_toggle);
		row = row + 1;
		w = (_tmp25_ = (GtkWidget*) g_object_ref_sink (deja_dup_config_delete_new (DEJA_DUP_DELETE_AFTER_KEY)), _g_object_unref0 (w), _tmp25_);
		label = (_tmp27_ = g_object_ref_sink ((GtkLabel*) gtk_label_new (_tmp26_ = g_strdup_printf ("%s", _ ("_Keep backups:")))), _g_object_unref0 (label), _tmp27_);
		_g_free0 (_tmp26_);
		g_object_set ((GObject*) label, "mnemonic-widget", w, "use-underline", TRUE, "xalign", 0.0f, NULL);
		gtk_size_group_add_widget (self->priv->label_sizes, (GtkWidget*) label);
		gtk_table_attach (table, (GtkWidget*) label, (guint) 0, (guint) 1, (guint) row, (guint) (row + 1), 0, GTK_FILL, (guint) 3, (guint) 3);
		gtk_table_attach (table, w, (guint) 1, (guint) 3, (guint) row, (guint) (row + 1), GTK_FILL | GTK_EXPAND, GTK_FILL, (guint) 3, (guint) 3);
		row = row + 1;
		if (self->priv->location_label_noedit != NULL) {
			preferences_dialog_handle_location_label_changed (self, (DejaDupConfigWidget*) self->priv->location_label_noedit);
		} else {
			preferences_dialog_handle_edit_location (self);
		}
		gtk_container_add ((GtkContainer*) ((GtkDialog*) self)->vbox, (GtkWidget*) table);
		_g_object_unref0 (table);
		_g_object_unref0 (w);
		_g_object_unref0 (label);
		_g_free0 (last_run);
		_g_object_unref0 (s3_table);
		_g_object_unref0 (periodic_check);
	}
	return obj;
}


static void preferences_dialog_class_init (PreferencesDialogClass * klass) {
	preferences_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (PreferencesDialogPrivate));
	G_OBJECT_CLASS (klass)->constructor = preferences_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = preferences_dialog_finalize;
}


static void preferences_dialog_instance_init (PreferencesDialog * self) {
	self->priv = PREFERENCES_DIALOG_GET_PRIVATE (self);
}


static void preferences_dialog_finalize (GObject* obj) {
	PreferencesDialog * self;
	self = PREFERENCES_DIALOG (obj);
	self->priv->backend_widgets = (_vala_array_free (self->priv->backend_widgets, self->priv->backend_widgets_length1, (GDestroyNotify) _g_list_free_g_object_unref), NULL);
	_g_object_unref0 (self->priv->label_sizes);
	_g_object_unref0 (self->priv->button_sizes);
	_g_object_unref0 (self->priv->periodic_toggle);
	_g_object_unref0 (self->priv->location_hbox);
	_g_object_unref0 (self->priv->location_label_noedit);
	_g_object_unref0 (self->priv->location_label_button);
	G_OBJECT_CLASS (preferences_dialog_parent_class)->finalize (obj);
}


GType preferences_dialog_get_type (void) {
	static volatile gsize preferences_dialog_type_id__volatile = 0;
	if (g_once_init_enter (&preferences_dialog_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (PreferencesDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) preferences_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PreferencesDialog), 0, (GInstanceInitFunc) preferences_dialog_instance_init, NULL };
		GType preferences_dialog_type_id;
		preferences_dialog_type_id = g_type_register_static (GTK_TYPE_DIALOG, "PreferencesDialog", &g_define_type_info, 0);
		g_once_init_leave (&preferences_dialog_type_id__volatile, preferences_dialog_type_id);
	}
	return preferences_dialog_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int 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, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static int _vala_strcmp0 (const char * str1, const char * str2) {
	if (str1 == NULL) {
		return -(str1 != str2);
	}
	if (str2 == NULL) {
		return str1 != str2;
	}
	return strcmp (str1, str2);
}




