/* gitg-diff-view-options.c generated by valac 0.56.19, the Vala compiler
 * generated from gitg-diff-view-options.vala, do not modify */

/*
 * This file is part of gitg
 *
 * Copyright (C) 2014 - Jesse van den Kieboom
 *
 * gitg 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.
 *
 * gitg 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 gitg. If not, see <http://www.gnu.org/licenses/>.
 */

#include "libgitg.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <gee.h>
#include <glib-object.h>
#include <float.h>
#include <math.h>
#include <gobject/gvaluecollector.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

#define GITG_TYPE_DIFF_VIEW_OPTIONS_SPACING (gitg_diff_view_options_spacing_get_type ())
#define GITG_DIFF_VIEW_OPTIONS_SPACING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DIFF_VIEW_OPTIONS_SPACING, GitgDiffViewOptionsSpacing))
#define GITG_DIFF_VIEW_OPTIONS_SPACING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_DIFF_VIEW_OPTIONS_SPACING, GitgDiffViewOptionsSpacingClass))
#define GITG_IS_DIFF_VIEW_OPTIONS_SPACING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DIFF_VIEW_OPTIONS_SPACING))
#define GITG_IS_DIFF_VIEW_OPTIONS_SPACING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_DIFF_VIEW_OPTIONS_SPACING))
#define GITG_DIFF_VIEW_OPTIONS_SPACING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_DIFF_VIEW_OPTIONS_SPACING, GitgDiffViewOptionsSpacingClass))

typedef struct _GitgDiffViewOptionsSpacing GitgDiffViewOptionsSpacing;
typedef struct _GitgDiffViewOptionsSpacingClass GitgDiffViewOptionsSpacingClass;
enum  {
	GITG_DIFF_VIEW_OPTIONS_0_PROPERTY,
	GITG_DIFF_VIEW_OPTIONS_CONTEXT_LINES_PROPERTY,
	GITG_DIFF_VIEW_OPTIONS_VIEW_PROPERTY,
	GITG_DIFF_VIEW_OPTIONS_NUM_PROPERTIES
};
static GParamSpec* gitg_diff_view_options_properties[GITG_DIFF_VIEW_OPTIONS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _GitgDiffViewOptionsSpacingPrivate GitgDiffViewOptionsSpacingPrivate;
enum  {
	GITG_DIFF_VIEW_OPTIONS_SPACING_0_PROPERTY,
	GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_PROPERTY,
	GITG_DIFF_VIEW_OPTIONS_SPACING_WRAP_LINES_PROPERTY,
	GITG_DIFF_VIEW_OPTIONS_SPACING_TAB_WIDTH_PROPERTY,
	GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_VISIBLE_PROPERTY,
	GITG_DIFF_VIEW_OPTIONS_SPACING_NUM_PROPERTIES
};
static GParamSpec* gitg_diff_view_options_spacing_properties[GITG_DIFF_VIEW_OPTIONS_SPACING_NUM_PROPERTIES];

#define GITG_TYPE_TRANSFORMS (gitg_transforms_get_type ())
#define GITG_TRANSFORMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_TRANSFORMS, GitgTransforms))
#define GITG_TRANSFORMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_TRANSFORMS, GitgTransformsClass))
#define GITG_IS_TRANSFORMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_TRANSFORMS))
#define GITG_IS_TRANSFORMS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_TRANSFORMS))
#define GITG_TRANSFORMS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_TRANSFORMS, GitgTransformsClass))

typedef struct _GitgTransforms GitgTransforms;
typedef struct _GitgTransformsClass GitgTransformsClass;
typedef struct _GitgTransformsPrivate GitgTransformsPrivate;
typedef struct _GitgParamSpecTransforms GitgParamSpecTransforms;

struct _GitgDiffViewOptionsPrivate {
	GtkAdjustment* d_adjustment_context;
	GtkToolButton* d_tool_button_spacing;
	gint _context_lines;
	GeeList* d_bindings;
	GitgDiffView* d_view;
	gulong d_notify_commit_id;
	GitgDiffViewOptionsSpacing* d_popover_spacing;
};

struct _GitgDiffViewOptionsSpacing {
	GtkPopover parent_instance;
	GitgDiffViewOptionsSpacingPrivate * priv;
};

struct _GitgDiffViewOptionsSpacingClass {
	GtkPopoverClass parent_class;
};

struct _GitgDiffViewOptionsSpacingPrivate {
	GtkSwitch* d_switch_ignore_whitespace;
	GtkLabel* d_label_ignore_whitespace;
	GtkSwitch* d_switch_wrap_lines;
	GtkAdjustment* d_adjustment_tab_width;
	gboolean _ignore_whitespace;
	gboolean _wrap_lines;
	gint _tab_width;
	gboolean _ignore_whitespace_visible;
};

struct _GitgTransforms {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GitgTransformsPrivate * priv;
};

struct _GitgTransformsClass {
	GTypeClass parent_class;
	void (*finalize) (GitgTransforms *self);
};

struct _GitgParamSpecTransforms {
	GParamSpec parent_instance;
};

static gint GitgDiffViewOptions_private_offset;
static gpointer gitg_diff_view_options_parent_class = NULL;
static gint GitgDiffViewOptionsSpacing_private_offset;
static gpointer gitg_diff_view_options_spacing_parent_class = NULL;
static gpointer gitg_transforms_parent_class = NULL;

VALA_EXTERN GType gitg_diff_view_options_spacing_get_type (void) G_GNUC_CONST ;
static void gitg_diff_view_options_real_dispose (GObject* base);
static void gitg_diff_view_options_view_changed (GitgDiffViewOptions* self,
                                          GitgDiffView* old_view);
static void gitg_diff_view_options_update_commit (GitgDiffViewOptions* self);
static void _gitg_diff_view_options_update_commit_g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self);
VALA_EXTERN void gitg_diff_view_options_spacing_set_ignore_whitespace_visible (GitgDiffViewOptionsSpacing* self,
                                                                   gboolean value);
static void gitg_diff_view_options_real_constructed (GObject* base);
VALA_EXTERN gboolean gitg_transforms_int_to_double (GBinding* binding,
                                        GValue* source_value,
                                        GValue* target_value);
static gboolean _gitg_transforms_int_to_double_gbinding_transform_func (GBinding* binding,
                                                                 GValue* from_value,
                                                                 GValue* to_value,
                                                                 gpointer self);
VALA_EXTERN gboolean gitg_transforms_double_to_int (GBinding* binding,
                                        GValue* source_value,
                                        GValue* target_value);
static gboolean _gitg_transforms_double_to_int_gbinding_transform_func (GBinding* binding,
                                                                 GValue* from_value,
                                                                 GValue* to_value,
                                                                 gpointer self);
static void gitg_diff_view_options_clicked_on_tool_button_spacing (GitgDiffViewOptions* self,
                                                            GtkWidget* widget);
static void _gitg_diff_view_options_clicked_on_tool_button_spacing_gtk_tool_button_clicked (GtkToolButton* _sender,
                                                                                     gpointer self);
static GObject * gitg_diff_view_options_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties);
VALA_EXTERN GitgDiffViewOptionsSpacing* gitg_diff_view_options_spacing_new (void);
VALA_EXTERN GitgDiffViewOptionsSpacing* gitg_diff_view_options_spacing_construct (GType object_type);
static void gitg_diff_view_options_finalize (GObject * obj);
static GType gitg_diff_view_options_get_type_once (void);
static void _vala_gitg_diff_view_options_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec);
static void _vala_gitg_diff_view_options_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec);
static void gitg_diff_view_options_spacing_real_constructed (GObject* base);
VALA_EXTERN gboolean gitg_diff_view_options_spacing_get_ignore_whitespace (GitgDiffViewOptionsSpacing* self);
VALA_EXTERN void gitg_diff_view_options_spacing_set_ignore_whitespace (GitgDiffViewOptionsSpacing* self,
                                                           gboolean value);
VALA_EXTERN gboolean gitg_diff_view_options_spacing_get_wrap_lines (GitgDiffViewOptionsSpacing* self);
VALA_EXTERN void gitg_diff_view_options_spacing_set_wrap_lines (GitgDiffViewOptionsSpacing* self,
                                                    gboolean value);
VALA_EXTERN gint gitg_diff_view_options_spacing_get_tab_width (GitgDiffViewOptionsSpacing* self);
VALA_EXTERN void gitg_diff_view_options_spacing_set_tab_width (GitgDiffViewOptionsSpacing* self,
                                                   gint value);
VALA_EXTERN gboolean gitg_diff_view_options_spacing_get_ignore_whitespace_visible (GitgDiffViewOptionsSpacing* self);
static void gitg_diff_view_options_spacing_finalize (GObject * obj);
static GType gitg_diff_view_options_spacing_get_type_once (void);
static void _vala_gitg_diff_view_options_spacing_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec);
static void _vala_gitg_diff_view_options_spacing_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec);
VALA_EXTERN gpointer gitg_transforms_ref (gpointer instance);
VALA_EXTERN void gitg_transforms_unref (gpointer instance);
VALA_EXTERN GParamSpec* gitg_param_spec_transforms (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void gitg_value_set_transforms (GValue* value,
                                gpointer v_object);
VALA_EXTERN void gitg_value_take_transforms (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer gitg_value_get_transforms (const GValue* value);
VALA_EXTERN GType gitg_transforms_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GitgTransforms* gitg_transforms_new (void);
VALA_EXTERN GitgTransforms* gitg_transforms_construct (GType object_type);
static void gitg_transforms_finalize (GitgTransforms * obj);
static GType gitg_transforms_get_type_once (void);

static inline gpointer
gitg_diff_view_options_get_instance_private (GitgDiffViewOptions* self)
{
	return G_STRUCT_MEMBER_P (self, GitgDiffViewOptions_private_offset);
}

GitgDiffViewOptions*
gitg_diff_view_options_construct (GType object_type,
                                  GitgDiffView* view)
{
	GitgDiffViewOptions * self = NULL;
	self = (GitgDiffViewOptions*) g_object_new (object_type, "view", view, NULL);
	return self;
}

GitgDiffViewOptions*
gitg_diff_view_options_new (GitgDiffView* view)
{
	return gitg_diff_view_options_construct (GITG_TYPE_DIFF_VIEW_OPTIONS, view);
}

static void
gitg_diff_view_options_real_dispose (GObject* base)
{
	GitgDiffViewOptions * self;
	self = (GitgDiffViewOptions*) base;
	gitg_diff_view_options_set_view (self, NULL);
	G_OBJECT_CLASS (gitg_diff_view_options_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_toolbar_get_type (), GtkToolbar));
}

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

static void
_gitg_diff_view_options_update_commit_g_object_notify (GObject* _sender,
                                                       GParamSpec* pspec,
                                                       gpointer self)
{
	gitg_diff_view_options_update_commit ((GitgDiffViewOptions*) self);
}

static void
gitg_diff_view_options_view_changed (GitgDiffViewOptions* self,
                                     GitgDiffView* old_view)
{
	GeeList* _tmp10_;
	GitgDiffView* _tmp11_;
	GeeList* _tmp12_;
	GitgDiffView* _tmp13_;
	GitgDiffViewOptionsSpacing* _tmp14_;
	GBinding* _tmp15_;
	GeeList* _tmp16_;
	GitgDiffView* _tmp17_;
	GitgDiffViewOptionsSpacing* _tmp18_;
	GBinding* _tmp19_;
	GeeList* _tmp20_;
	GitgDiffView* _tmp21_;
	GitgDiffViewOptionsSpacing* _tmp22_;
	GBinding* _tmp23_;
	GeeList* _tmp24_;
	GitgDiffView* _tmp25_;
	GBinding* _tmp26_;
	GitgDiffView* _tmp27_;
	gulong _tmp28_;
	g_return_if_fail (self != NULL);
	{
		GeeList* _binding_list = NULL;
		GeeList* _tmp0_;
		gint _binding_size = 0;
		GeeList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _binding_index = 0;
		_tmp0_ = self->priv->d_bindings;
		_binding_list = _tmp0_;
		_tmp1_ = _binding_list;
		_tmp2_ = gee_collection_get_size ((GeeCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_binding_size = _tmp3_;
		_binding_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			GBinding* binding = NULL;
			GeeList* _tmp6_;
			gpointer _tmp7_;
			GBinding* _tmp8_;
			GBinding* _tmp9_;
			_binding_index = _binding_index + 1;
			_tmp4_ = _binding_index;
			_tmp5_ = _binding_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _binding_list;
			_tmp7_ = gee_list_get (_tmp6_, _binding_index);
			binding = (GBinding*) _tmp7_;
			_tmp8_ = binding;
			_tmp9_ = _g_object_ref0 (_tmp8_);
			g_binding_unbind (_tmp9_);
			_g_object_unref0 (binding);
		}
	}
	_tmp10_ = self->priv->d_bindings;
	gee_collection_clear ((GeeCollection*) _tmp10_);
	if (self->priv->d_notify_commit_id != ((gulong) 0)) {
		g_signal_handler_disconnect ((GObject*) old_view, self->priv->d_notify_commit_id);
		self->priv->d_notify_commit_id = (gulong) 0;
	}
	_tmp11_ = self->priv->d_view;
	if (_tmp11_ == NULL) {
		gitg_diff_view_options_update_commit (self);
		return;
	}
	_tmp12_ = self->priv->d_bindings;
	_tmp13_ = self->priv->d_view;
	_tmp14_ = self->priv->d_popover_spacing;
	_tmp15_ = g_object_bind_property_with_closures ((GObject*) _tmp13_, "ignore-whitespace", (GObject*) _tmp14_, "ignore-whitespace", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	gee_collection_add ((GeeCollection*) _tmp12_, _tmp15_);
	_tmp16_ = self->priv->d_bindings;
	_tmp17_ = self->priv->d_view;
	_tmp18_ = self->priv->d_popover_spacing;
	_tmp19_ = g_object_bind_property_with_closures ((GObject*) _tmp17_, "wrap-lines", (GObject*) _tmp18_, "wrap-lines", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	gee_collection_add ((GeeCollection*) _tmp16_, _tmp19_);
	_tmp20_ = self->priv->d_bindings;
	_tmp21_ = self->priv->d_view;
	_tmp22_ = self->priv->d_popover_spacing;
	_tmp23_ = g_object_bind_property_with_closures ((GObject*) _tmp21_, "tab-width", (GObject*) _tmp22_, "tab-width", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	gee_collection_add ((GeeCollection*) _tmp20_, _tmp23_);
	_tmp24_ = self->priv->d_bindings;
	_tmp25_ = self->priv->d_view;
	_tmp26_ = g_object_bind_property_with_closures ((GObject*) _tmp25_, "context-lines", (GObject*) self, "context-lines", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	gee_collection_add ((GeeCollection*) _tmp24_, _tmp26_);
	_tmp27_ = self->priv->d_view;
	_tmp28_ = g_signal_connect_object ((GObject*) _tmp27_, "notify::commit", (GCallback) _gitg_diff_view_options_update_commit_g_object_notify, self, 0);
	self->priv->d_notify_commit_id = _tmp28_;
	gitg_diff_view_options_update_commit (self);
}

static void
gitg_diff_view_options_update_commit (GitgDiffViewOptions* self)
{
	gboolean _tmp0_ = FALSE;
	GitgDiffView* _tmp1_;
	gboolean iscommit = FALSE;
	GitgDiffViewOptionsSpacing* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->d_view;
	if (_tmp1_ != NULL) {
		GitgDiffView* _tmp2_;
		GitgCommit* _tmp3_;
		GitgCommit* _tmp4_;
		_tmp2_ = self->priv->d_view;
		_tmp3_ = gitg_diff_view_get_commit (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	iscommit = _tmp0_;
	_tmp5_ = self->priv->d_popover_spacing;
	gitg_diff_view_options_spacing_set_ignore_whitespace_visible (_tmp5_, iscommit);
}

static gboolean
_gitg_transforms_int_to_double_gbinding_transform_func (GBinding* binding,
                                                        GValue* from_value,
                                                        GValue* to_value,
                                                        gpointer self)
{
	gboolean result;
	result = gitg_transforms_int_to_double (binding, from_value, to_value);
	return result;
}

static gboolean
_gitg_transforms_double_to_int_gbinding_transform_func (GBinding* binding,
                                                        GValue* from_value,
                                                        GValue* to_value,
                                                        gpointer self)
{
	gboolean result;
	result = gitg_transforms_double_to_int (binding, from_value, to_value);
	return result;
}

static void
gitg_diff_view_options_real_constructed (GObject* base)
{
	GitgDiffViewOptions * self;
	GtkAdjustment* _tmp0_;
	self = (GitgDiffViewOptions*) base;
	_tmp0_ = self->priv->d_adjustment_context;
	g_object_bind_property_with_closures ((GObject*) self, "context-lines", (GObject*) _tmp0_, "value", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) g_cclosure_new ((GCallback) _gitg_transforms_int_to_double_gbinding_transform_func, NULL, (GClosureNotify) NULL), (GClosure*) g_cclosure_new ((GCallback) _gitg_transforms_double_to_int_gbinding_transform_func, NULL, (GClosureNotify) NULL));
}

static void
gitg_diff_view_options_clicked_on_tool_button_spacing (GitgDiffViewOptions* self,
                                                       GtkWidget* widget)
{
	GitgDiffViewOptionsSpacing* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->d_popover_spacing;
	gtk_widget_show ((GtkWidget*) _tmp0_);
}

static void
_gitg_diff_view_options_clicked_on_tool_button_spacing_gtk_tool_button_clicked (GtkToolButton* _sender,
                                                                                gpointer self)
{
	gitg_diff_view_options_clicked_on_tool_button_spacing ((GitgDiffViewOptions*) self, _sender);
}

gint
gitg_diff_view_options_get_context_lines (GitgDiffViewOptions* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_context_lines;
	return result;
}

void
gitg_diff_view_options_set_context_lines (GitgDiffViewOptions* self,
                                          gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = gitg_diff_view_options_get_context_lines (self);
	if (old_value != value) {
		self->priv->_context_lines = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_options_properties[GITG_DIFF_VIEW_OPTIONS_CONTEXT_LINES_PROPERTY]);
	}
}

GitgDiffView*
gitg_diff_view_options_get_view (GitgDiffViewOptions* self)
{
	GitgDiffView* result;
	GitgDiffView* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->d_view;
	result = _tmp0_;
	return result;
}

void
gitg_diff_view_options_set_view (GitgDiffViewOptions* self,
                                 GitgDiffView* value)
{
	GitgDiffView* _tmp0_;
	GitgDiffView* old_view = NULL;
	GitgDiffView* _tmp1_;
	GitgDiffView* _tmp2_;
	GitgDiffView* _tmp3_;
	GitgDiffView* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_view;
	if (_tmp0_ == value) {
		return;
	}
	_tmp1_ = self->priv->d_view;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	old_view = _tmp2_;
	_tmp3_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->d_view);
	self->priv->d_view = _tmp3_;
	_tmp4_ = old_view;
	gitg_diff_view_options_view_changed (self, _tmp4_);
	_g_object_unref0 (old_view);
	g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_options_properties[GITG_DIFF_VIEW_OPTIONS_VIEW_PROPERTY]);
}

static GObject *
gitg_diff_view_options_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GitgDiffViewOptions * self;
	GeeLinkedList* _tmp0_;
	GitgDiffViewOptionsSpacing* _tmp1_;
	GitgDiffViewOptionsSpacing* _tmp2_;
	GtkToolButton* _tmp3_;
	parent_class = G_OBJECT_CLASS (gitg_diff_view_options_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_DIFF_VIEW_OPTIONS, GitgDiffViewOptions);
	_tmp0_ = gee_linked_list_new (G_TYPE_BINDING, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->d_bindings);
	self->priv->d_bindings = (GeeList*) _tmp0_;
	_tmp1_ = gitg_diff_view_options_spacing_new ();
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->d_popover_spacing);
	self->priv->d_popover_spacing = _tmp1_;
	_tmp2_ = self->priv->d_popover_spacing;
	_tmp3_ = self->priv->d_tool_button_spacing;
	gtk_popover_set_relative_to ((GtkPopover*) _tmp2_, (GtkWidget*) _tmp3_);
	return obj;
}

static void
gitg_diff_view_options_class_init (GitgDiffViewOptionsClass * klass,
                                   gpointer klass_data)
{
	gitg_diff_view_options_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GitgDiffViewOptions_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) gitg_diff_view_options_real_dispose;
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) gitg_diff_view_options_real_constructed;
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_diff_view_options_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gitg_diff_view_options_set_property;
	G_OBJECT_CLASS (klass)->constructor = gitg_diff_view_options_constructor;
	G_OBJECT_CLASS (klass)->finalize = gitg_diff_view_options_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_OPTIONS_CONTEXT_LINES_PROPERTY, gitg_diff_view_options_properties[GITG_DIFF_VIEW_OPTIONS_CONTEXT_LINES_PROPERTY] = g_param_spec_int ("context-lines", "context-lines", "context-lines", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_OPTIONS_VIEW_PROPERTY, gitg_diff_view_options_properties[GITG_DIFF_VIEW_OPTIONS_VIEW_PROPERTY] = g_param_spec_object ("view", "view", "view", GITG_TYPE_DIFF_VIEW, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/gitg/ui/gitg-diff-view-options.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "adjustment_context", FALSE, GitgDiffViewOptions_private_offset + G_STRUCT_OFFSET (GitgDiffViewOptionsPrivate, d_adjustment_context));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "tool_button_spacing", FALSE, GitgDiffViewOptions_private_offset + G_STRUCT_OFFSET (GitgDiffViewOptionsPrivate, d_tool_button_spacing));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "clicked_on_tool_button_spacing", G_CALLBACK(_gitg_diff_view_options_clicked_on_tool_button_spacing_gtk_tool_button_clicked));
}

static void
gitg_diff_view_options_instance_init (GitgDiffViewOptions * self,
                                      gpointer klass)
{
	self->priv = gitg_diff_view_options_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
gitg_diff_view_options_finalize (GObject * obj)
{
	GitgDiffViewOptions * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_DIFF_VIEW_OPTIONS, GitgDiffViewOptions);
	_g_object_unref0 (self->priv->d_bindings);
	_g_object_unref0 (self->priv->d_view);
	_g_object_unref0 (self->priv->d_popover_spacing);
	G_OBJECT_CLASS (gitg_diff_view_options_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gitg_diff_view_options_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgDiffViewOptionsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_diff_view_options_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgDiffViewOptions), 0, (GInstanceInitFunc) gitg_diff_view_options_instance_init, NULL };
	GType gitg_diff_view_options_type_id;
	gitg_diff_view_options_type_id = g_type_register_static (gtk_toolbar_get_type (), "GitgDiffViewOptions", &g_define_type_info, 0);
	GitgDiffViewOptions_private_offset = g_type_add_instance_private (gitg_diff_view_options_type_id, sizeof (GitgDiffViewOptionsPrivate));
	return gitg_diff_view_options_type_id;
}

GType
gitg_diff_view_options_get_type (void)
{
	static gsize gitg_diff_view_options_type_id__once = 0;
	if (g_once_init_enter (&gitg_diff_view_options_type_id__once)) {
		GType gitg_diff_view_options_type_id;
		gitg_diff_view_options_type_id = gitg_diff_view_options_get_type_once ();
		g_once_init_leave (&gitg_diff_view_options_type_id__once, gitg_diff_view_options_type_id);
	}
	return gitg_diff_view_options_type_id__once;
}

static void
_vala_gitg_diff_view_options_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec)
{
	GitgDiffViewOptions * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_DIFF_VIEW_OPTIONS, GitgDiffViewOptions);
	switch (property_id) {
		case GITG_DIFF_VIEW_OPTIONS_CONTEXT_LINES_PROPERTY:
		g_value_set_int (value, gitg_diff_view_options_get_context_lines (self));
		break;
		case GITG_DIFF_VIEW_OPTIONS_VIEW_PROPERTY:
		g_value_set_object (value, gitg_diff_view_options_get_view (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gitg_diff_view_options_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec)
{
	GitgDiffViewOptions * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_DIFF_VIEW_OPTIONS, GitgDiffViewOptions);
	switch (property_id) {
		case GITG_DIFF_VIEW_OPTIONS_CONTEXT_LINES_PROPERTY:
		gitg_diff_view_options_set_context_lines (self, g_value_get_int (value));
		break;
		case GITG_DIFF_VIEW_OPTIONS_VIEW_PROPERTY:
		gitg_diff_view_options_set_view (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
gitg_diff_view_options_spacing_get_instance_private (GitgDiffViewOptionsSpacing* self)
{
	return G_STRUCT_MEMBER_P (self, GitgDiffViewOptionsSpacing_private_offset);
}

static void
gitg_diff_view_options_spacing_real_constructed (GObject* base)
{
	GitgDiffViewOptionsSpacing * self;
	GtkSwitch* _tmp0_;
	GtkSwitch* _tmp1_;
	GtkAdjustment* _tmp2_;
	GtkSwitch* _tmp3_;
	GtkLabel* _tmp4_;
	self = (GitgDiffViewOptionsSpacing*) base;
	_tmp0_ = self->priv->d_switch_ignore_whitespace;
	g_object_bind_property_with_closures ((GObject*) self, "ignore-whitespace", (GObject*) _tmp0_, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp1_ = self->priv->d_switch_wrap_lines;
	g_object_bind_property_with_closures ((GObject*) self, "wrap-lines", (GObject*) _tmp1_, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp2_ = self->priv->d_adjustment_tab_width;
	g_object_bind_property_with_closures ((GObject*) self, "tab-width", (GObject*) _tmp2_, "value", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) g_cclosure_new ((GCallback) _gitg_transforms_int_to_double_gbinding_transform_func, NULL, (GClosureNotify) NULL), (GClosure*) g_cclosure_new ((GCallback) _gitg_transforms_double_to_int_gbinding_transform_func, NULL, (GClosureNotify) NULL));
	_tmp3_ = self->priv->d_switch_ignore_whitespace;
	g_object_bind_property_with_closures ((GObject*) self, "ignore-whitespace-visible", (GObject*) _tmp3_, "visible", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp4_ = self->priv->d_label_ignore_whitespace;
	g_object_bind_property_with_closures ((GObject*) self, "ignore-whitespace-visible", (GObject*) _tmp4_, "visible", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
}

GitgDiffViewOptionsSpacing*
gitg_diff_view_options_spacing_construct (GType object_type)
{
	GitgDiffViewOptionsSpacing * self = NULL;
	self = (GitgDiffViewOptionsSpacing*) g_object_new (object_type, NULL);
	return self;
}

GitgDiffViewOptionsSpacing*
gitg_diff_view_options_spacing_new (void)
{
	return gitg_diff_view_options_spacing_construct (GITG_TYPE_DIFF_VIEW_OPTIONS_SPACING);
}

gboolean
gitg_diff_view_options_spacing_get_ignore_whitespace (GitgDiffViewOptionsSpacing* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_ignore_whitespace;
	return result;
}

void
gitg_diff_view_options_spacing_set_ignore_whitespace (GitgDiffViewOptionsSpacing* self,
                                                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = gitg_diff_view_options_spacing_get_ignore_whitespace (self);
	if (old_value != value) {
		self->priv->_ignore_whitespace = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_options_spacing_properties[GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_PROPERTY]);
	}
}

gboolean
gitg_diff_view_options_spacing_get_wrap_lines (GitgDiffViewOptionsSpacing* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_wrap_lines;
	return result;
}

void
gitg_diff_view_options_spacing_set_wrap_lines (GitgDiffViewOptionsSpacing* self,
                                               gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = gitg_diff_view_options_spacing_get_wrap_lines (self);
	if (old_value != value) {
		self->priv->_wrap_lines = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_options_spacing_properties[GITG_DIFF_VIEW_OPTIONS_SPACING_WRAP_LINES_PROPERTY]);
	}
}

gint
gitg_diff_view_options_spacing_get_tab_width (GitgDiffViewOptionsSpacing* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_tab_width;
	return result;
}

void
gitg_diff_view_options_spacing_set_tab_width (GitgDiffViewOptionsSpacing* self,
                                              gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = gitg_diff_view_options_spacing_get_tab_width (self);
	if (old_value != value) {
		self->priv->_tab_width = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_options_spacing_properties[GITG_DIFF_VIEW_OPTIONS_SPACING_TAB_WIDTH_PROPERTY]);
	}
}

gboolean
gitg_diff_view_options_spacing_get_ignore_whitespace_visible (GitgDiffViewOptionsSpacing* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_ignore_whitespace_visible;
	return result;
}

void
gitg_diff_view_options_spacing_set_ignore_whitespace_visible (GitgDiffViewOptionsSpacing* self,
                                                              gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = gitg_diff_view_options_spacing_get_ignore_whitespace_visible (self);
	if (old_value != value) {
		self->priv->_ignore_whitespace_visible = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_diff_view_options_spacing_properties[GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_VISIBLE_PROPERTY]);
	}
}

static void
gitg_diff_view_options_spacing_class_init (GitgDiffViewOptionsSpacingClass * klass,
                                           gpointer klass_data)
{
	gitg_diff_view_options_spacing_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GitgDiffViewOptionsSpacing_private_offset);
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) gitg_diff_view_options_spacing_real_constructed;
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_diff_view_options_spacing_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gitg_diff_view_options_spacing_set_property;
	G_OBJECT_CLASS (klass)->finalize = gitg_diff_view_options_spacing_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_PROPERTY, gitg_diff_view_options_spacing_properties[GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_PROPERTY] = g_param_spec_boolean ("ignore-whitespace", "ignore-whitespace", "ignore-whitespace", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_OPTIONS_SPACING_WRAP_LINES_PROPERTY, gitg_diff_view_options_spacing_properties[GITG_DIFF_VIEW_OPTIONS_SPACING_WRAP_LINES_PROPERTY] = g_param_spec_boolean ("wrap-lines", "wrap-lines", "wrap-lines", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_OPTIONS_SPACING_TAB_WIDTH_PROPERTY, gitg_diff_view_options_spacing_properties[GITG_DIFF_VIEW_OPTIONS_SPACING_TAB_WIDTH_PROPERTY] = g_param_spec_int ("tab-width", "tab-width", "tab-width", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_VISIBLE_PROPERTY, gitg_diff_view_options_spacing_properties[GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_VISIBLE_PROPERTY] = g_param_spec_boolean ("ignore-whitespace-visible", "ignore-whitespace-visible", "ignore-whitespace-visible", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/gitg/ui/gitg-diff-view-options-spacing.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "switch_ignore_whitespace", FALSE, GitgDiffViewOptionsSpacing_private_offset + G_STRUCT_OFFSET (GitgDiffViewOptionsSpacingPrivate, d_switch_ignore_whitespace));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "label_ignore_whitespace", FALSE, GitgDiffViewOptionsSpacing_private_offset + G_STRUCT_OFFSET (GitgDiffViewOptionsSpacingPrivate, d_label_ignore_whitespace));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "switch_wrap_lines", FALSE, GitgDiffViewOptionsSpacing_private_offset + G_STRUCT_OFFSET (GitgDiffViewOptionsSpacingPrivate, d_switch_wrap_lines));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "adjustment_tab_width", FALSE, GitgDiffViewOptionsSpacing_private_offset + G_STRUCT_OFFSET (GitgDiffViewOptionsSpacingPrivate, d_adjustment_tab_width));
}

static void
gitg_diff_view_options_spacing_instance_init (GitgDiffViewOptionsSpacing * self,
                                              gpointer klass)
{
	self->priv = gitg_diff_view_options_spacing_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
gitg_diff_view_options_spacing_finalize (GObject * obj)
{
	GitgDiffViewOptionsSpacing * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_DIFF_VIEW_OPTIONS_SPACING, GitgDiffViewOptionsSpacing);
	G_OBJECT_CLASS (gitg_diff_view_options_spacing_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gitg_diff_view_options_spacing_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgDiffViewOptionsSpacingClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_diff_view_options_spacing_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgDiffViewOptionsSpacing), 0, (GInstanceInitFunc) gitg_diff_view_options_spacing_instance_init, NULL };
	GType gitg_diff_view_options_spacing_type_id;
	gitg_diff_view_options_spacing_type_id = g_type_register_static (gtk_popover_get_type (), "GitgDiffViewOptionsSpacing", &g_define_type_info, 0);
	GitgDiffViewOptionsSpacing_private_offset = g_type_add_instance_private (gitg_diff_view_options_spacing_type_id, sizeof (GitgDiffViewOptionsSpacingPrivate));
	return gitg_diff_view_options_spacing_type_id;
}

GType
gitg_diff_view_options_spacing_get_type (void)
{
	static gsize gitg_diff_view_options_spacing_type_id__once = 0;
	if (g_once_init_enter (&gitg_diff_view_options_spacing_type_id__once)) {
		GType gitg_diff_view_options_spacing_type_id;
		gitg_diff_view_options_spacing_type_id = gitg_diff_view_options_spacing_get_type_once ();
		g_once_init_leave (&gitg_diff_view_options_spacing_type_id__once, gitg_diff_view_options_spacing_type_id);
	}
	return gitg_diff_view_options_spacing_type_id__once;
}

static void
_vala_gitg_diff_view_options_spacing_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec)
{
	GitgDiffViewOptionsSpacing * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_DIFF_VIEW_OPTIONS_SPACING, GitgDiffViewOptionsSpacing);
	switch (property_id) {
		case GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_PROPERTY:
		g_value_set_boolean (value, gitg_diff_view_options_spacing_get_ignore_whitespace (self));
		break;
		case GITG_DIFF_VIEW_OPTIONS_SPACING_WRAP_LINES_PROPERTY:
		g_value_set_boolean (value, gitg_diff_view_options_spacing_get_wrap_lines (self));
		break;
		case GITG_DIFF_VIEW_OPTIONS_SPACING_TAB_WIDTH_PROPERTY:
		g_value_set_int (value, gitg_diff_view_options_spacing_get_tab_width (self));
		break;
		case GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_VISIBLE_PROPERTY:
		g_value_set_boolean (value, gitg_diff_view_options_spacing_get_ignore_whitespace_visible (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gitg_diff_view_options_spacing_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec)
{
	GitgDiffViewOptionsSpacing * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_DIFF_VIEW_OPTIONS_SPACING, GitgDiffViewOptionsSpacing);
	switch (property_id) {
		case GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_PROPERTY:
		gitg_diff_view_options_spacing_set_ignore_whitespace (self, g_value_get_boolean (value));
		break;
		case GITG_DIFF_VIEW_OPTIONS_SPACING_WRAP_LINES_PROPERTY:
		gitg_diff_view_options_spacing_set_wrap_lines (self, g_value_get_boolean (value));
		break;
		case GITG_DIFF_VIEW_OPTIONS_SPACING_TAB_WIDTH_PROPERTY:
		gitg_diff_view_options_spacing_set_tab_width (self, g_value_get_int (value));
		break;
		case GITG_DIFF_VIEW_OPTIONS_SPACING_IGNORE_WHITESPACE_VISIBLE_PROPERTY:
		gitg_diff_view_options_spacing_set_ignore_whitespace_visible (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

gboolean
gitg_transforms_double_to_int (GBinding* binding,
                               GValue* source_value,
                               GValue* target_value)
{
	gboolean result;
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (source_value != NULL, FALSE);
	g_return_val_if_fail (target_value != NULL, FALSE);
	g_value_set_int (target_value, (gint) g_value_get_double (source_value));
	result = TRUE;
	return result;
}

gboolean
gitg_transforms_int_to_double (GBinding* binding,
                               GValue* source_value,
                               GValue* target_value)
{
	gboolean result;
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (source_value != NULL, FALSE);
	g_return_val_if_fail (target_value != NULL, FALSE);
	g_value_set_double (target_value, (gdouble) g_value_get_int (source_value));
	result = TRUE;
	return result;
}

GitgTransforms*
gitg_transforms_construct (GType object_type)
{
	GitgTransforms* self = NULL;
	self = (GitgTransforms*) g_type_create_instance (object_type);
	return self;
}

GitgTransforms*
gitg_transforms_new (void)
{
	return gitg_transforms_construct (GITG_TYPE_TRANSFORMS);
}

static void
gitg_value_transforms_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
gitg_value_transforms_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		gitg_transforms_unref (value->data[0].v_pointer);
	}
}

static void
gitg_value_transforms_copy_value (const GValue* src_value,
                                  GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = gitg_transforms_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
gitg_value_transforms_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
gitg_value_transforms_collect_value (GValue* value,
                                     guint n_collect_values,
                                     GTypeCValue* collect_values,
                                     guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		GitgTransforms * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = gitg_transforms_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
gitg_value_transforms_lcopy_value (const GValue* value,
                                   guint n_collect_values,
                                   GTypeCValue* collect_values,
                                   guint collect_flags)
{
	GitgTransforms ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = gitg_transforms_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
gitg_param_spec_transforms (const gchar* name,
                            const gchar* nick,
                            const gchar* blurb,
                            GType object_type,
                            GParamFlags flags)
{
	GitgParamSpecTransforms* spec;
	g_return_val_if_fail (g_type_is_a (object_type, GITG_TYPE_TRANSFORMS), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
gitg_value_get_transforms (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GITG_TYPE_TRANSFORMS), NULL);
	return value->data[0].v_pointer;
}

void
gitg_value_set_transforms (GValue* value,
                           gpointer v_object)
{
	GitgTransforms * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GITG_TYPE_TRANSFORMS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GITG_TYPE_TRANSFORMS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		gitg_transforms_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		gitg_transforms_unref (old);
	}
}

void
gitg_value_take_transforms (GValue* value,
                            gpointer v_object)
{
	GitgTransforms * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GITG_TYPE_TRANSFORMS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GITG_TYPE_TRANSFORMS));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		gitg_transforms_unref (old);
	}
}

static void
gitg_transforms_class_init (GitgTransformsClass * klass,
                            gpointer klass_data)
{
	gitg_transforms_parent_class = g_type_class_peek_parent (klass);
	((GitgTransformsClass *) klass)->finalize = gitg_transforms_finalize;
}

static void
gitg_transforms_instance_init (GitgTransforms * self,
                               gpointer klass)
{
	self->ref_count = 1;
}

static void
gitg_transforms_finalize (GitgTransforms * obj)
{
	GitgTransforms * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_TRANSFORMS, GitgTransforms);
	g_signal_handlers_destroy (self);
}

 G_GNUC_NO_INLINE static GType
gitg_transforms_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { gitg_value_transforms_init, gitg_value_transforms_free_value, gitg_value_transforms_copy_value, gitg_value_transforms_peek_pointer, "p", gitg_value_transforms_collect_value, "p", gitg_value_transforms_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (GitgTransformsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_transforms_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgTransforms), 0, (GInstanceInitFunc) gitg_transforms_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType gitg_transforms_type_id;
	gitg_transforms_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GitgTransforms", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return gitg_transforms_type_id;
}

GType
gitg_transforms_get_type (void)
{
	static gsize gitg_transforms_type_id__once = 0;
	if (g_once_init_enter (&gitg_transforms_type_id__once)) {
		GType gitg_transforms_type_id;
		gitg_transforms_type_id = gitg_transforms_get_type_once ();
		g_once_init_leave (&gitg_transforms_type_id__once, gitg_transforms_type_id);
	}
	return gitg_transforms_type_id__once;
}

gpointer
gitg_transforms_ref (gpointer instance)
{
	GitgTransforms * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
gitg_transforms_unref (gpointer instance)
{
	GitgTransforms * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		GITG_TRANSFORMS_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

