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

/*
    PreferencesDialog.vala
    Copyright (C) 2010 Maia Kozheva <sikon@ubuntu.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 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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 STEADYFLOW_UI_TYPE_IGTK_BUILDER_CONTAINER (steadyflow_ui_igtk_builder_container_get_type ())
#define STEADYFLOW_UI_IGTK_BUILDER_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STEADYFLOW_UI_TYPE_IGTK_BUILDER_CONTAINER, SteadyflowUIIGtkBuilderContainer))
#define STEADYFLOW_UI_IS_IGTK_BUILDER_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STEADYFLOW_UI_TYPE_IGTK_BUILDER_CONTAINER))
#define STEADYFLOW_UI_IGTK_BUILDER_CONTAINER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), STEADYFLOW_UI_TYPE_IGTK_BUILDER_CONTAINER, SteadyflowUIIGtkBuilderContainerIface))

typedef struct _SteadyflowUIIGtkBuilderContainer SteadyflowUIIGtkBuilderContainer;
typedef struct _SteadyflowUIIGtkBuilderContainerIface SteadyflowUIIGtkBuilderContainerIface;

#define STEADYFLOW_UI_TYPE_GTK_BUILDER_DIALOG (steadyflow_ui_gtk_builder_dialog_get_type ())
#define STEADYFLOW_UI_GTK_BUILDER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STEADYFLOW_UI_TYPE_GTK_BUILDER_DIALOG, SteadyflowUIGtkBuilderDialog))
#define STEADYFLOW_UI_GTK_BUILDER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STEADYFLOW_UI_TYPE_GTK_BUILDER_DIALOG, SteadyflowUIGtkBuilderDialogClass))
#define STEADYFLOW_UI_IS_GTK_BUILDER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STEADYFLOW_UI_TYPE_GTK_BUILDER_DIALOG))
#define STEADYFLOW_UI_IS_GTK_BUILDER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STEADYFLOW_UI_TYPE_GTK_BUILDER_DIALOG))
#define STEADYFLOW_UI_GTK_BUILDER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STEADYFLOW_UI_TYPE_GTK_BUILDER_DIALOG, SteadyflowUIGtkBuilderDialogClass))

typedef struct _SteadyflowUIGtkBuilderDialog SteadyflowUIGtkBuilderDialog;
typedef struct _SteadyflowUIGtkBuilderDialogClass SteadyflowUIGtkBuilderDialogClass;
typedef struct _SteadyflowUIGtkBuilderDialogPrivate SteadyflowUIGtkBuilderDialogPrivate;

#define STEADYFLOW_TYPE_PREFERENCES_DIALOG (steadyflow_preferences_dialog_get_type ())
#define STEADYFLOW_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STEADYFLOW_TYPE_PREFERENCES_DIALOG, SteadyflowPreferencesDialog))
#define STEADYFLOW_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STEADYFLOW_TYPE_PREFERENCES_DIALOG, SteadyflowPreferencesDialogClass))
#define STEADYFLOW_IS_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STEADYFLOW_TYPE_PREFERENCES_DIALOG))
#define STEADYFLOW_IS_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STEADYFLOW_TYPE_PREFERENCES_DIALOG))
#define STEADYFLOW_PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STEADYFLOW_TYPE_PREFERENCES_DIALOG, SteadyflowPreferencesDialogClass))

typedef struct _SteadyflowPreferencesDialog SteadyflowPreferencesDialog;
typedef struct _SteadyflowPreferencesDialogClass SteadyflowPreferencesDialogClass;
typedef struct _SteadyflowPreferencesDialogPrivate SteadyflowPreferencesDialogPrivate;
typedef enum  {
	STEADYFLOW_CORE_IDOWNLOAD_FILE_FINISH_ACTION_DO_NOTHING = 0,
	STEADYFLOW_CORE_IDOWNLOAD_FILE_FINISH_ACTION_OPEN_FILE,
	STEADYFLOW_CORE_IDOWNLOAD_FILE_FINISH_ACTION_OPEN_FOLDER,
	STEADYFLOW_CORE_IDOWNLOAD_FILE_FINISH_ACTION_RUN_COMMAND
} SteadyflowCoreIDownloadFileFinishAction;

#define STEADYFLOW_CORE_IDOWNLOAD_FILE_TYPE_FINISH_ACTION (steadyflow_core_idownload_file_finish_action_get_type ())
enum  {
	STEADYFLOW_PREFERENCES_DIALOG_0_PROPERTY,
	STEADYFLOW_PREFERENCES_DIALOG_NUM_PROPERTIES
};
static GParamSpec* steadyflow_preferences_dialog_properties[STEADYFLOW_PREFERENCES_DIALOG_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 STEADYFLOW_CORE_TYPE_ISETTINGS_SERVICE (steadyflow_core_isettings_service_get_type ())
#define STEADYFLOW_CORE_ISETTINGS_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STEADYFLOW_CORE_TYPE_ISETTINGS_SERVICE, SteadyflowCoreISettingsService))
#define STEADYFLOW_CORE_IS_ISETTINGS_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STEADYFLOW_CORE_TYPE_ISETTINGS_SERVICE))
#define STEADYFLOW_CORE_ISETTINGS_SERVICE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), STEADYFLOW_CORE_TYPE_ISETTINGS_SERVICE, SteadyflowCoreISettingsServiceIface))

typedef struct _SteadyflowCoreISettingsService SteadyflowCoreISettingsService;
typedef struct _SteadyflowCoreISettingsServiceIface SteadyflowCoreISettingsServiceIface;

struct _SteadyflowUIIGtkBuilderContainerIface {
	GTypeInterface parent_iface;
	GtkBuilder* (*get_builder) (SteadyflowUIIGtkBuilderContainer* self);
};

struct _SteadyflowUIGtkBuilderDialog {
	GtkDialog parent_instance;
	SteadyflowUIGtkBuilderDialogPrivate * priv;
};

struct _SteadyflowUIGtkBuilderDialogClass {
	GtkDialogClass parent_class;
};

struct _SteadyflowPreferencesDialog {
	SteadyflowUIGtkBuilderDialog parent_instance;
	SteadyflowPreferencesDialogPrivate * priv;
};

struct _SteadyflowPreferencesDialogClass {
	SteadyflowUIGtkBuilderDialogClass parent_class;
};

struct _SteadyflowPreferencesDialogPrivate {
	GeeMap* checkbutton_map;
	GeeMap* finish_action_map;
	GtkFileChooserButton* default_folder;
	GtkCheckButton* c_show_indicator;
	GtkCheckButton* c_show_notifications;
	GtkCheckButton* c_minimize_to_indicator;
	GtkCheckButton* c_start_minimized;
};

struct _SteadyflowCoreISettingsServiceIface {
	GTypeInterface parent_iface;
	gboolean (*get_boolean) (SteadyflowCoreISettingsService* self, const gchar* key);
	gint (*get_int) (SteadyflowCoreISettingsService* self, const gchar* key);
	gint (*get_enum) (SteadyflowCoreISettingsService* self, const gchar* key);
	gchar* (*get_string) (SteadyflowCoreISettingsService* self, const gchar* key);
	void (*set_boolean) (SteadyflowCoreISettingsService* self, const gchar* key, gboolean value);
	void (*set_int) (SteadyflowCoreISettingsService* self, const gchar* key, gint value);
	void (*set_enum) (SteadyflowCoreISettingsService* self, const gchar* key, gint value);
	void (*set_string) (SteadyflowCoreISettingsService* self, const gchar* key, const gchar* value);
	void (*save) (SteadyflowCoreISettingsService* self);
};

static gint SteadyflowPreferencesDialog_private_offset;
static gpointer steadyflow_preferences_dialog_parent_class = NULL;

VALA_EXTERN GType steadyflow_ui_igtk_builder_container_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType steadyflow_ui_gtk_builder_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SteadyflowUIGtkBuilderDialog, g_object_unref)
VALA_EXTERN GType steadyflow_preferences_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SteadyflowPreferencesDialog, g_object_unref)
VALA_EXTERN GType steadyflow_core_idownload_file_finish_action_get_type (void) G_GNUC_CONST ;
VALA_EXTERN SteadyflowPreferencesDialog* steadyflow_preferences_dialog_new (GtkWindow* parent);
VALA_EXTERN SteadyflowPreferencesDialog* steadyflow_preferences_dialog_construct (GType object_type,
                                                                      GtkWindow* parent);
VALA_EXTERN SteadyflowUIGtkBuilderDialog* steadyflow_ui_gtk_builder_dialog_construct (GType object_type,
                                                                          const gchar* file_id,
                                                                          GtkWindow* parent,
                                                                          gboolean modal);
VALA_EXTERN GObject* steadyflow_ui_igtk_builder_container_get_object (SteadyflowUIIGtkBuilderContainer* self,
                                                          const gchar* id);
static void steadyflow_preferences_dialog_load_settings (SteadyflowPreferencesDialog* self);
VALA_EXTERN void steadyflow_ui_igtk_builder_container_autoconnect (SteadyflowUIIGtkBuilderContainer* self);
VALA_EXTERN gchar* steadyflow_services_get_default_download_folder (void);
VALA_EXTERN GType steadyflow_core_isettings_service_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SteadyflowCoreISettingsService, g_object_unref)
VALA_EXTERN SteadyflowCoreISettingsService* steadyflow_services_get_settings (void);
VALA_EXTERN gboolean steadyflow_core_isettings_service_get_boolean (SteadyflowCoreISettingsService* self,
                                                        const gchar* key);
VALA_EXTERN void steadyflow_preferences_dialog_on_show_indicator_toggled (GtkCheckButton* sender,
                                                              SteadyflowPreferencesDialog* self);
static void steadyflow_preferences_dialog_register_finish_action (SteadyflowPreferencesDialog* self,
                                                           GtkRadioButton* button,
                                                           SteadyflowCoreIDownloadFileFinishAction action);
VALA_EXTERN gint steadyflow_core_isettings_service_get_enum (SteadyflowCoreISettingsService* self,
                                                 const gchar* key);
VALA_EXTERN void steadyflow_preferences_dialog_on_default_folder_changed (GtkFileChooserButton* sender,
                                                              SteadyflowPreferencesDialog* self);
VALA_EXTERN void steadyflow_core_isettings_service_set_string (SteadyflowCoreISettingsService* self,
                                                   const gchar* key,
                                                   const gchar* value);
VALA_EXTERN void steadyflow_preferences_dialog_on_checkbox_toggled (GtkCheckButton* sender,
                                                        SteadyflowPreferencesDialog* self);
VALA_EXTERN void steadyflow_core_isettings_service_set_boolean (SteadyflowCoreISettingsService* self,
                                                    const gchar* key,
                                                    gboolean value);
VALA_EXTERN void steadyflow_preferences_dialog_on_finish_action_toggled (GtkRadioButton* sender,
                                                             SteadyflowPreferencesDialog* self);
VALA_EXTERN void steadyflow_core_isettings_service_set_enum (SteadyflowCoreISettingsService* self,
                                                 const gchar* key,
                                                 gint value);
static void steadyflow_preferences_dialog_finalize (GObject * obj);
static GType steadyflow_preferences_dialog_get_type_once (void);

static inline gpointer
steadyflow_preferences_dialog_get_instance_private (SteadyflowPreferencesDialog* self)
{
	return G_STRUCT_MEMBER_P (self, SteadyflowPreferencesDialog_private_offset);
}

SteadyflowPreferencesDialog*
steadyflow_preferences_dialog_construct (GType object_type,
                                         GtkWindow* parent)
{
	SteadyflowPreferencesDialog * self = NULL;
	GtkBox* _tmp0_;
	GObject* _tmp1_;
	GeeHashMap* _tmp2_;
	GeeMap* _tmp3_;
	GObject* _tmp4_;
	GtkCheckButton* _tmp5_;
	GeeMap* _tmp6_;
	GObject* _tmp7_;
	GtkCheckButton* _tmp8_;
	GeeMap* _tmp9_;
	GObject* _tmp10_;
	GtkCheckButton* _tmp11_;
	GeeMap* _tmp12_;
	GObject* _tmp13_;
	GtkCheckButton* _tmp14_;
	GeeHashMap* _tmp15_;
	g_return_val_if_fail (parent != NULL, NULL);
	self = (SteadyflowPreferencesDialog*) steadyflow_ui_gtk_builder_dialog_construct (object_type, "PreferencesDialog", parent, TRUE);
	gtk_window_set_title ((GtkWindow*) self, _ ("Steadyflow Preferences"));
	gtk_container_set_border_width ((GtkContainer*) self, (guint) 5);
	gtk_window_set_resizable ((GtkWindow*) self, FALSE);
	_tmp0_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	gtk_box_set_spacing (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_box_get_type ()) ? ((GtkBox*) _tmp0_) : NULL, 2);
	_tmp1_ = steadyflow_ui_igtk_builder_container_get_object ((SteadyflowUIIGtkBuilderContainer*) self, "default_folder");
	_g_object_unref0 (self->priv->default_folder);
	self->priv->default_folder = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_file_chooser_button_get_type (), GtkFileChooserButton);
	_tmp2_ = gee_hash_map_new (gtk_check_button_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->checkbutton_map);
	self->priv->checkbutton_map = (GeeMap*) _tmp2_;
	_tmp3_ = self->priv->checkbutton_map;
	_tmp4_ = steadyflow_ui_igtk_builder_container_get_object ((SteadyflowUIIGtkBuilderContainer*) self, "c_show_indicator");
	_g_object_unref0 (self->priv->c_show_indicator);
	self->priv->c_show_indicator = G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, gtk_check_button_get_type (), GtkCheckButton);
	_tmp5_ = self->priv->c_show_indicator;
	gee_map_set (_tmp3_, _tmp5_, "show-indicator");
	_tmp6_ = self->priv->checkbutton_map;
	_tmp7_ = steadyflow_ui_igtk_builder_container_get_object ((SteadyflowUIIGtkBuilderContainer*) self, "c_show_notifications");
	_g_object_unref0 (self->priv->c_show_notifications);
	self->priv->c_show_notifications = G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, gtk_check_button_get_type (), GtkCheckButton);
	_tmp8_ = self->priv->c_show_notifications;
	gee_map_set (_tmp6_, _tmp8_, "show-notifications");
	_tmp9_ = self->priv->checkbutton_map;
	_tmp10_ = steadyflow_ui_igtk_builder_container_get_object ((SteadyflowUIIGtkBuilderContainer*) self, "c_minimize_to_indicator");
	_g_object_unref0 (self->priv->c_minimize_to_indicator);
	self->priv->c_minimize_to_indicator = G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, gtk_check_button_get_type (), GtkCheckButton);
	_tmp11_ = self->priv->c_minimize_to_indicator;
	gee_map_set (_tmp9_, _tmp11_, "minimize-to-indicator");
	_tmp12_ = self->priv->checkbutton_map;
	_tmp13_ = steadyflow_ui_igtk_builder_container_get_object ((SteadyflowUIIGtkBuilderContainer*) self, "c_start_minimized");
	_g_object_unref0 (self->priv->c_start_minimized);
	self->priv->c_start_minimized = G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, gtk_check_button_get_type (), GtkCheckButton);
	_tmp14_ = self->priv->c_start_minimized;
	gee_map_set (_tmp12_, _tmp14_, "start-minimized");
	_tmp15_ = gee_hash_map_new (gtk_radio_button_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, STEADYFLOW_CORE_IDOWNLOAD_FILE_TYPE_FINISH_ACTION, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->finish_action_map);
	self->priv->finish_action_map = (GeeMap*) _tmp15_;
	steadyflow_preferences_dialog_load_settings (self);
	gtk_dialog_add_button ((GtkDialog*) self, GTK_STOCK_CLOSE, (gint) GTK_RESPONSE_CLOSE);
	steadyflow_ui_igtk_builder_container_autoconnect ((SteadyflowUIIGtkBuilderContainer*) self);
	return self;
}

SteadyflowPreferencesDialog*
steadyflow_preferences_dialog_new (GtkWindow* parent)
{
	return steadyflow_preferences_dialog_construct (STEADYFLOW_TYPE_PREFERENCES_DIALOG, parent);
}

static void
steadyflow_preferences_dialog_load_settings (SteadyflowPreferencesDialog* self)
{
	GtkFileChooserButton* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GtkCheckButton* _tmp19_;
	GObject* _tmp20_;
	GtkRadioButton* _tmp21_;
	GObject* _tmp22_;
	GtkRadioButton* _tmp23_;
	GObject* _tmp24_;
	GtkRadioButton* _tmp25_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->default_folder;
	_tmp1_ = steadyflow_services_get_default_download_folder ();
	_tmp2_ = _tmp1_;
	gtk_file_chooser_set_current_folder ((GtkFileChooser*) _tmp0_, _tmp2_);
	_g_free0 (_tmp2_);
	{
		GeeIterator* _cb_it = NULL;
		GeeMap* _tmp3_;
		GeeSet* _tmp4_;
		GeeSet* _tmp5_;
		GeeSet* _tmp6_;
		GeeIterator* _tmp7_;
		GeeIterator* _tmp8_;
		_tmp3_ = self->priv->checkbutton_map;
		_tmp4_ = gee_map_get_keys (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_;
		_tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_);
		_tmp8_ = _tmp7_;
		_g_object_unref0 (_tmp6_);
		_cb_it = _tmp8_;
		while (TRUE) {
			GeeIterator* _tmp9_;
			GtkCheckButton* cb = NULL;
			GeeIterator* _tmp10_;
			gpointer _tmp11_;
			GtkCheckButton* _tmp12_;
			SteadyflowCoreISettingsService* _tmp13_;
			SteadyflowCoreISettingsService* _tmp14_;
			GeeMap* _tmp15_;
			GtkCheckButton* _tmp16_;
			gpointer _tmp17_;
			gchar* _tmp18_;
			_tmp9_ = _cb_it;
			if (!gee_iterator_next (_tmp9_)) {
				break;
			}
			_tmp10_ = _cb_it;
			_tmp11_ = gee_iterator_get (_tmp10_);
			cb = (GtkCheckButton*) _tmp11_;
			_tmp12_ = cb;
			_tmp13_ = steadyflow_services_get_settings ();
			_tmp14_ = _tmp13_;
			_tmp15_ = self->priv->checkbutton_map;
			_tmp16_ = cb;
			_tmp17_ = gee_map_get (_tmp15_, _tmp16_);
			_tmp18_ = (gchar*) _tmp17_;
			gtk_toggle_button_set_active ((GtkToggleButton*) _tmp12_, steadyflow_core_isettings_service_get_boolean (_tmp14_, _tmp18_));
			_g_free0 (_tmp18_);
			_g_object_unref0 (cb);
		}
		_g_object_unref0 (_cb_it);
	}
	_tmp19_ = self->priv->c_show_indicator;
	steadyflow_preferences_dialog_on_show_indicator_toggled (_tmp19_, self);
	_tmp20_ = steadyflow_ui_igtk_builder_container_get_object ((SteadyflowUIIGtkBuilderContainer*) self, "r_donothing");
	_tmp21_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, gtk_radio_button_get_type (), GtkRadioButton);
	steadyflow_preferences_dialog_register_finish_action (self, _tmp21_, STEADYFLOW_CORE_IDOWNLOAD_FILE_FINISH_ACTION_DO_NOTHING);
	_g_object_unref0 (_tmp21_);
	_tmp22_ = steadyflow_ui_igtk_builder_container_get_object ((SteadyflowUIIGtkBuilderContainer*) self, "r_openfile");
	_tmp23_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, gtk_radio_button_get_type (), GtkRadioButton);
	steadyflow_preferences_dialog_register_finish_action (self, _tmp23_, STEADYFLOW_CORE_IDOWNLOAD_FILE_FINISH_ACTION_OPEN_FILE);
	_g_object_unref0 (_tmp23_);
	_tmp24_ = steadyflow_ui_igtk_builder_container_get_object ((SteadyflowUIIGtkBuilderContainer*) self, "r_openfolder");
	_tmp25_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, gtk_radio_button_get_type (), GtkRadioButton);
	steadyflow_preferences_dialog_register_finish_action (self, _tmp25_, STEADYFLOW_CORE_IDOWNLOAD_FILE_FINISH_ACTION_OPEN_FOLDER);
	_g_object_unref0 (_tmp25_);
}

static void
steadyflow_preferences_dialog_register_finish_action (SteadyflowPreferencesDialog* self,
                                                      GtkRadioButton* button,
                                                      SteadyflowCoreIDownloadFileFinishAction action)
{
	GeeMap* _tmp0_;
	SteadyflowCoreISettingsService* _tmp1_;
	SteadyflowCoreISettingsService* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = self->priv->finish_action_map;
	gee_map_set (_tmp0_, button, (gpointer) ((gintptr) action));
	_tmp1_ = steadyflow_services_get_settings ();
	_tmp2_ = _tmp1_;
	if (steadyflow_core_isettings_service_get_enum (_tmp2_, "default-post-download-action") == ((gint) action)) {
		gtk_toggle_button_set_active ((GtkToggleButton*) button, TRUE);
	}
}

void
steadyflow_preferences_dialog_on_default_folder_changed (GtkFileChooserButton* sender,
                                                         SteadyflowPreferencesDialog* self)
{
	SteadyflowCoreISettingsService* _tmp0_;
	SteadyflowCoreISettingsService* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sender != NULL);
	_tmp0_ = steadyflow_services_get_settings ();
	_tmp1_ = _tmp0_;
	_tmp2_ = gtk_file_chooser_get_current_folder ((GtkFileChooser*) sender);
	_tmp3_ = _tmp2_;
	steadyflow_core_isettings_service_set_string (_tmp1_, "default-download-folder", _tmp3_);
	_g_free0 (_tmp3_);
}

void
steadyflow_preferences_dialog_on_checkbox_toggled (GtkCheckButton* sender,
                                                   SteadyflowPreferencesDialog* self)
{
	SteadyflowCoreISettingsService* _tmp0_;
	SteadyflowCoreISettingsService* _tmp1_;
	GeeMap* _tmp2_;
	gpointer _tmp3_;
	gchar* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sender != NULL);
	_tmp0_ = steadyflow_services_get_settings ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->checkbutton_map;
	_tmp3_ = gee_map_get (_tmp2_, sender);
	_tmp4_ = (gchar*) _tmp3_;
	_tmp5_ = gtk_toggle_button_get_active ((GtkToggleButton*) sender);
	_tmp6_ = _tmp5_;
	steadyflow_core_isettings_service_set_boolean (_tmp1_, _tmp4_, _tmp6_);
	_g_free0 (_tmp4_);
}

void
steadyflow_preferences_dialog_on_finish_action_toggled (GtkRadioButton* sender,
                                                        SteadyflowPreferencesDialog* self)
{
	SteadyflowCoreISettingsService* _tmp0_;
	SteadyflowCoreISettingsService* _tmp1_;
	GeeMap* _tmp2_;
	gpointer _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sender != NULL);
	_tmp0_ = steadyflow_services_get_settings ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->finish_action_map;
	_tmp3_ = gee_map_get (_tmp2_, sender);
	steadyflow_core_isettings_service_set_enum (_tmp1_, "default-post-download-action", (gint) ((SteadyflowCoreIDownloadFileFinishAction) ((gintptr) _tmp3_)));
}

void
steadyflow_preferences_dialog_on_show_indicator_toggled (GtkCheckButton* sender,
                                                         SteadyflowPreferencesDialog* self)
{
	gboolean active = FALSE;
	gboolean _tmp0_;
	gboolean _tmp1_;
	SteadyflowCoreISettingsService* _tmp2_;
	SteadyflowCoreISettingsService* _tmp3_;
	GtkCheckButton* _tmp4_;
	GtkCheckButton* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sender != NULL);
	_tmp0_ = gtk_toggle_button_get_active ((GtkToggleButton*) sender);
	_tmp1_ = _tmp0_;
	active = _tmp1_;
	_tmp2_ = steadyflow_services_get_settings ();
	_tmp3_ = _tmp2_;
	steadyflow_core_isettings_service_set_boolean (_tmp3_, "show-indicator", active);
	_tmp4_ = self->priv->c_minimize_to_indicator;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, active);
	_tmp5_ = self->priv->c_start_minimized;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp5_, active);
}

static void
steadyflow_preferences_dialog_class_init (SteadyflowPreferencesDialogClass * klass,
                                          gpointer klass_data)
{
	steadyflow_preferences_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SteadyflowPreferencesDialog_private_offset);
	G_OBJECT_CLASS (klass)->finalize = steadyflow_preferences_dialog_finalize;
}

static void
steadyflow_preferences_dialog_instance_init (SteadyflowPreferencesDialog * self,
                                             gpointer klass)
{
	self->priv = steadyflow_preferences_dialog_get_instance_private (self);
}

static void
steadyflow_preferences_dialog_finalize (GObject * obj)
{
	SteadyflowPreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, STEADYFLOW_TYPE_PREFERENCES_DIALOG, SteadyflowPreferencesDialog);
	_g_object_unref0 (self->priv->checkbutton_map);
	_g_object_unref0 (self->priv->finish_action_map);
	_g_object_unref0 (self->priv->default_folder);
	_g_object_unref0 (self->priv->c_show_indicator);
	_g_object_unref0 (self->priv->c_show_notifications);
	_g_object_unref0 (self->priv->c_minimize_to_indicator);
	_g_object_unref0 (self->priv->c_start_minimized);
	G_OBJECT_CLASS (steadyflow_preferences_dialog_parent_class)->finalize (obj);
}

static GType
steadyflow_preferences_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SteadyflowPreferencesDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) steadyflow_preferences_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SteadyflowPreferencesDialog), 0, (GInstanceInitFunc) steadyflow_preferences_dialog_instance_init, NULL };
	GType steadyflow_preferences_dialog_type_id;
	steadyflow_preferences_dialog_type_id = g_type_register_static (STEADYFLOW_UI_TYPE_GTK_BUILDER_DIALOG, "SteadyflowPreferencesDialog", &g_define_type_info, 0);
	SteadyflowPreferencesDialog_private_offset = g_type_add_instance_private (steadyflow_preferences_dialog_type_id, sizeof (SteadyflowPreferencesDialogPrivate));
	return steadyflow_preferences_dialog_type_id;
}

GType
steadyflow_preferences_dialog_get_type (void)
{
	static volatile gsize steadyflow_preferences_dialog_type_id__once = 0;
	if (g_once_init_enter (&steadyflow_preferences_dialog_type_id__once)) {
		GType steadyflow_preferences_dialog_type_id;
		steadyflow_preferences_dialog_type_id = steadyflow_preferences_dialog_get_type_once ();
		g_once_init_leave (&steadyflow_preferences_dialog_type_id__once, steadyflow_preferences_dialog_type_id);
	}
	return steadyflow_preferences_dialog_type_id__once;
}

