/* gitg-preferences-general.c generated by valac 0.56.19, the Vala compiler
 * generated from gitg-preferences-general.vala, do not modify */

/*
 * This file is part of gitg
 *
 * Copyright (C) 2062 - Alberto Fanjul
 *
 * 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 <gtk/gtk.h>
#include "libgitg-ext.h"
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "config.h"
#include "libgitg.h"
#include <glib/gi18n-lib.h>

#define GITG_PREFERENCES_GENERAL_version VERSION
#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 GITG_TYPE_PREFERENCES_GENERAL (gitg_preferences_general_get_type ())
#define GITG_PREFERENCES_GENERAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_PREFERENCES_GENERAL, GitgPreferencesGeneral))
#define GITG_PREFERENCES_GENERAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_PREFERENCES_GENERAL, GitgPreferencesGeneralClass))
#define GITG_IS_PREFERENCES_GENERAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_PREFERENCES_GENERAL))
#define GITG_IS_PREFERENCES_GENERAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_PREFERENCES_GENERAL))
#define GITG_PREFERENCES_GENERAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_PREFERENCES_GENERAL, GitgPreferencesGeneralClass))

typedef struct _GitgPreferencesGeneral GitgPreferencesGeneral;
typedef struct _GitgPreferencesGeneralClass GitgPreferencesGeneralClass;
typedef struct _GitgPreferencesGeneralPrivate GitgPreferencesGeneralPrivate;
enum  {
	GITG_PREFERENCES_GENERAL_0_PROPERTY,
	GITG_PREFERENCES_GENERAL_WIDGET_PROPERTY,
	GITG_PREFERENCES_GENERAL_ID_PROPERTY,
	GITG_PREFERENCES_GENERAL_DISPLAY_NAME_PROPERTY,
	GITG_PREFERENCES_GENERAL_NUM_PROPERTIES
};
static GParamSpec* gitg_preferences_general_properties[GITG_PREFERENCES_GENERAL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GITG_TYPE_DRAG_LIST_BOX (gitg_drag_list_box_get_type ())
#define GITG_DRAG_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_DRAG_LIST_BOX, GitgDragListBox))
#define GITG_DRAG_LIST_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_DRAG_LIST_BOX, GitgDragListBoxClass))
#define GITG_IS_DRAG_LIST_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_DRAG_LIST_BOX))
#define GITG_IS_DRAG_LIST_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_DRAG_LIST_BOX))
#define GITG_DRAG_LIST_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_DRAG_LIST_BOX, GitgDragListBoxClass))

typedef struct _GitgDragListBox GitgDragListBox;
typedef struct _GitgDragListBoxClass GitgDragListBoxClass;
#define _g_type_class_unref0(var) ((var == NULL) ? NULL : (var = (g_type_class_unref (var), NULL)))

struct _GitgPreferencesGeneral {
	GtkGrid parent_instance;
	GitgPreferencesGeneralPrivate * priv;
};

struct _GitgPreferencesGeneralClass {
	GtkGridClass parent_class;
};

struct _GitgPreferencesGeneralPrivate {
	GtkCheckButton* smart_push;
	GtkGrid* visible_columns_grid;
	GtkGrid* show_column_headers_grid;
	GSettings* settings;
	GtkTreeView* treeview;
};

static gint GitgPreferencesGeneral_private_offset;
static gpointer gitg_preferences_general_parent_class = NULL;
static GitgExtPreferencesIface * gitg_preferences_general_gitg_ext_preferences_parent_iface = NULL;

VALA_EXTERN GType gitg_preferences_general_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GitgPreferencesGeneral, g_object_unref)
VALA_EXTERN GitgPreferencesGeneral* gitg_preferences_general_new (GitgCommitListView* commit_list_view);
VALA_EXTERN GitgPreferencesGeneral* gitg_preferences_general_construct (GType object_type,
                                                            GitgCommitListView* commit_list_view);
VALA_EXTERN GType gitg_drag_list_box_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GitgDragListBox, g_object_unref)
VALA_EXTERN GitgDragListBox* gitg_ui_utils_build_listbox_visible_columns (GtkTreeView* treeview);
static void __lambda164_ (GitgPreferencesGeneral* self);
VALA_EXTERN void gitg_ui_utils_store_visible_columns_on_gsettings (GtkTreeView* treeview);
static void ___lambda164__gtk_tree_view_columns_changed (GtkTreeView* _sender,
                                                  gpointer self);
static void __lambda165_ (GitgPreferencesGeneral* self,
                   gint from,
                   gint to);
static void ___lambda165__gitg_drag_list_box_row_reorder (GitgDragListBox* _sender,
                                                   gint from,
                                                   gint to,
                                                   gpointer self);
VALA_EXTERN void gitg_drag_list_box_set_vadjustment (GitgDragListBox* self,
                                         GtkAdjustment* value);
VALA_EXTERN GtkBox* gitg_ui_utils_build_switch_show_headers (GtkTreeView* treeview);
static GObject * gitg_preferences_general_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void _gitg_preferences_general___lambda167_ (GitgPreferencesGeneral* self,
                                             const gchar* k);
static void _vala_array_add22 (GitgCommitModelColumns* * array,
                        gint* length,
                        gint* size,
                        GitgCommitModelColumns value);
static gboolean _vala_gitg_commit_model_columns_array_contains (GitgCommitModelColumns * stack,
                                                         gssize stack_length,
                                                         const GitgCommitModelColumns needle);
static void __gitg_preferences_general___lambda167__g_settings_changed (GSettings* _sender,
                                                                 const gchar* key,
                                                                 gpointer self);
static void gitg_preferences_general_finalize (GObject * obj);
static GType gitg_preferences_general_get_type_once (void);
static void _vala_gitg_preferences_general_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
gitg_preferences_general_get_instance_private (GitgPreferencesGeneral* self)
{
	return G_STRUCT_MEMBER_P (self, GitgPreferencesGeneral_private_offset);
}

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

static void
__lambda164_ (GitgPreferencesGeneral* self)
{
	GtkTreeView* _tmp0_;
	_tmp0_ = self->priv->treeview;
	gitg_ui_utils_store_visible_columns_on_gsettings (_tmp0_);
}

static void
___lambda164__gtk_tree_view_columns_changed (GtkTreeView* _sender,
                                             gpointer self)
{
	__lambda164_ ((GitgPreferencesGeneral*) self);
}

static void
__lambda165_ (GitgPreferencesGeneral* self,
              gint from,
              gint to)
{
	GtkTreeView* _tmp0_;
	_tmp0_ = self->priv->treeview;
	gitg_ui_utils_store_visible_columns_on_gsettings (_tmp0_);
}

static void
___lambda165__gitg_drag_list_box_row_reorder (GitgDragListBox* _sender,
                                              gint from,
                                              gint to,
                                              gpointer self)
{
	__lambda165_ ((GitgPreferencesGeneral*) self, from, to);
}

GitgPreferencesGeneral*
gitg_preferences_general_construct (GType object_type,
                                    GitgCommitListView* commit_list_view)
{
	GitgPreferencesGeneral * self = NULL;
	GtkTreeView* _tmp0_;
	gchar** visible_columns = NULL;
	GSettings* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint visible_columns_length1;
	gint _visible_columns_size_;
	GitgDragListBox* listbox = NULL;
	GtkTreeView* _tmp4_;
	GitgDragListBox* _tmp5_;
	GtkTreeView* _tmp6_;
	GtkScrolledWindow* sw = NULL;
	GtkScrolledWindow* _tmp7_;
	GtkAdjustment* _tmp8_;
	GtkAdjustment* _tmp9_;
	GtkGrid* _tmp10_;
	GtkBox* switch_box = NULL;
	GtkTreeView* _tmp11_;
	GtkBox* _tmp12_;
	GtkGrid* _tmp13_;
	g_return_val_if_fail (commit_list_view != NULL, NULL);
	self = (GitgPreferencesGeneral*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 ((GtkTreeView*) commit_list_view);
	_g_object_unref0 (self->priv->treeview);
	self->priv->treeview = _tmp0_;
	_tmp1_ = self->priv->settings;
	_tmp3_ = _tmp2_ = g_settings_get_strv (_tmp1_, "visible-columns");
	visible_columns = _tmp3_;
	visible_columns_length1 = _vala_array_length (_tmp2_);
	_visible_columns_size_ = visible_columns_length1;
	_tmp4_ = self->priv->treeview;
	_tmp5_ = gitg_ui_utils_build_listbox_visible_columns (_tmp4_);
	listbox = _tmp5_;
	_tmp6_ = self->priv->treeview;
	g_signal_connect_object (_tmp6_, "columns-changed", (GCallback) ___lambda164__gtk_tree_view_columns_changed, self, 0);
	g_signal_connect_object (listbox, "row-reorder", (GCallback) ___lambda165__gitg_drag_list_box_row_reorder, self, 0);
	_tmp7_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp7_);
	sw = _tmp7_;
	gtk_widget_set_size_request ((GtkWidget*) sw, -1, 350);
	gtk_widget_set_hexpand ((GtkWidget*) sw, TRUE);
	gtk_scrolled_window_set_policy (sw, GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
	_tmp8_ = gtk_scrolled_window_get_vadjustment (sw);
	_tmp9_ = _tmp8_;
	gitg_drag_list_box_set_vadjustment (listbox, _tmp9_);
	gtk_container_add ((GtkContainer*) sw, (GtkWidget*) listbox);
	gtk_widget_show_all ((GtkWidget*) sw);
	_tmp10_ = self->priv->visible_columns_grid;
	gtk_grid_attach (_tmp10_, (GtkWidget*) sw, 0, 0, 1, 1);
	_tmp11_ = self->priv->treeview;
	_tmp12_ = gitg_ui_utils_build_switch_show_headers (_tmp11_);
	switch_box = _tmp12_;
	gtk_widget_show_all ((GtkWidget*) switch_box);
	_tmp13_ = self->priv->show_column_headers_grid;
	gtk_grid_attach (_tmp13_, (GtkWidget*) switch_box, 0, 0, 1, 1);
	_g_object_unref0 (switch_box);
	_g_object_unref0 (sw);
	_g_object_unref0 (listbox);
	visible_columns = (_vala_array_free (visible_columns, visible_columns_length1, (GDestroyNotify) g_free), NULL);
	return self;
}

GitgPreferencesGeneral*
gitg_preferences_general_new (GitgCommitListView* commit_list_view)
{
	return gitg_preferences_general_construct (GITG_TYPE_PREFERENCES_GENERAL, commit_list_view);
}

static GtkWidget*
gitg_preferences_general_real_get_widget (GitgExtPreferences* base)
{
	GtkWidget* result;
	GitgPreferencesGeneral* self;
	GtkWidget* _tmp0_;
	self = (GitgPreferencesGeneral*) base;
	_tmp0_ = _g_object_ref0 ((GtkWidget*) self);
	result = _tmp0_;
	return result;
}

static gchar*
gitg_preferences_general_real_get_id (GitgExtPreferences* base)
{
	gchar* result;
	GitgPreferencesGeneral* self;
	gchar* _tmp0_;
	self = (GitgPreferencesGeneral*) base;
	_tmp0_ = g_strdup ("/org/gnome/gitg/Preferences/General");
	result = _tmp0_;
	return result;
}

static gchar*
gitg_preferences_general_real_get_display_name (GitgExtPreferences* base)
{
	gchar* result;
	GitgPreferencesGeneral* self;
	gchar* _tmp0_;
	self = (GitgPreferencesGeneral*) base;
	_tmp0_ = g_strdup (_ ("General"));
	result = _tmp0_;
	return result;
}

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

static gboolean
_vala_gitg_commit_model_columns_array_contains (GitgCommitModelColumns * stack,
                                                gssize stack_length,
                                                const GitgCommitModelColumns needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (needle == stack[i]) {
			return TRUE;
		}
	}
	return FALSE;
}

static void
_gitg_preferences_general___lambda167_ (GitgPreferencesGeneral* self,
                                        const gchar* k)
{
	gchar** visible_columns = NULL;
	GSettings* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint visible_columns_length1;
	gint _visible_columns_size_;
	GEnumClass* ec = NULL;
	GTypeClass* _tmp3_;
	GitgCommitModelColumns* array_cols = NULL;
	GitgCommitModelColumns* _tmp4_;
	gint array_cols_length1;
	gint _array_cols_size_;
	GtkTreeView* _tmp13_;
	GList* _tmp14_;
	g_return_if_fail (k != NULL);
	_tmp0_ = self->priv->settings;
	_tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "visible-columns");
	visible_columns = _tmp2_;
	visible_columns_length1 = _vala_array_length (_tmp1_);
	_visible_columns_size_ = visible_columns_length1;
	_tmp3_ = g_type_class_ref (GITG_TYPE_COMMIT_MODEL_COLUMNS);
	ec = (GEnumClass*) _tmp3_;
	_tmp4_ = g_new0 (GitgCommitModelColumns, 0);
	array_cols = _tmp4_;
	array_cols_length1 = 0;
	_array_cols_size_ = array_cols_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				gchar** _tmp7_;
				gint _tmp7__length1;
				GEnumValue* ev = NULL;
				GEnumClass* _tmp8_;
				gchar** _tmp9_;
				gint _tmp9__length1;
				const gchar* _tmp10_;
				GEnumValue* _tmp11_;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				_tmp7_ = visible_columns;
				_tmp7__length1 = visible_columns_length1;
				if (!(i < _tmp7__length1)) {
					break;
				}
				_tmp8_ = ec;
				_tmp9_ = visible_columns;
				_tmp9__length1 = visible_columns_length1;
				_tmp10_ = _tmp9_[i];
				ev = g_enum_get_value_by_nick (_tmp8_, _tmp10_);
				_tmp11_ = ev;
				if (_tmp11_ != NULL) {
					GitgCommitModelColumns cmc = 0;
					GEnumValue* _tmp12_;
					_tmp12_ = ev;
					cmc = (GitgCommitModelColumns) (*_tmp12_).value;
					_vala_array_add22 (&array_cols, &array_cols_length1, &_array_cols_size_, cmc);
				}
			}
		}
	}
	_tmp13_ = self->priv->treeview;
	_tmp14_ = gtk_tree_view_get_columns (_tmp13_);
	{
		GList* col_collection = NULL;
		GList* col_it = NULL;
		col_collection = _tmp14_;
		for (col_it = col_collection; col_it != NULL; col_it = col_it->next) {
			GtkTreeViewColumn* col = NULL;
			col = (GtkTreeViewColumn*) col_it->data;
			{
				gboolean visible = FALSE;
				GtkTreeViewColumn* _tmp15_;
				gconstpointer _tmp16_;
				GitgCommitModelColumns* _tmp17_;
				gint _tmp17__length1;
				GtkTreeViewColumn* _tmp18_;
				_tmp15_ = col;
				_tmp16_ = g_object_get_data ((GObject*) _tmp15_, "enum");
				_tmp17_ = array_cols;
				_tmp17__length1 = array_cols_length1;
				visible = _vala_gitg_commit_model_columns_array_contains (_tmp17_, _tmp17__length1, (GitgCommitModelColumns) ((gintptr) _tmp16_));
				_tmp18_ = col;
				gtk_tree_view_column_set_visible (_tmp18_, visible);
			}
		}
		(col_collection == NULL) ? NULL : (col_collection = (g_list_free (col_collection), NULL));
	}
	array_cols = (g_free (array_cols), NULL);
	_g_type_class_unref0 (ec);
	visible_columns = (_vala_array_free (visible_columns, visible_columns_length1, (GDestroyNotify) g_free), NULL);
}

static void
__gitg_preferences_general___lambda167__g_settings_changed (GSettings* _sender,
                                                            const gchar* key,
                                                            gpointer self)
{
	_gitg_preferences_general___lambda167_ ((GitgPreferencesGeneral*) self, key);
}

static GObject *
gitg_preferences_general_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GitgPreferencesGeneral * self;
	GSettings* _tmp0_;
	GSettings* _tmp1_;
	GtkCheckButton* _tmp2_;
	GSettings* _tmp3_;
	parent_class = G_OBJECT_CLASS (gitg_preferences_general_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_PREFERENCES_GENERAL, GitgPreferencesGeneral);
	_tmp0_ = g_settings_new (APPLICATION_ID ".preferences.general");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp0_;
	_tmp1_ = self->priv->settings;
	_tmp2_ = self->priv->smart_push;
	g_settings_bind (_tmp1_, "smart-push", (GObject*) _tmp2_, "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
	_tmp3_ = self->priv->settings;
	g_signal_connect_object (_tmp3_, "changed::visible-columns", (GCallback) __gitg_preferences_general___lambda167__g_settings_changed, self, 0);
	return obj;
}

static void
gitg_preferences_general_class_init (GitgPreferencesGeneralClass * klass,
                                     gpointer klass_data)
{
	gitg_preferences_general_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GitgPreferencesGeneral_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_preferences_general_get_property;
	G_OBJECT_CLASS (klass)->constructor = gitg_preferences_general_constructor;
	G_OBJECT_CLASS (klass)->finalize = gitg_preferences_general_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_PREFERENCES_GENERAL_WIDGET_PROPERTY, gitg_preferences_general_properties[GITG_PREFERENCES_GENERAL_WIDGET_PROPERTY] = g_param_spec_object ("widget", "widget", "widget", gtk_widget_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_PREFERENCES_GENERAL_ID_PROPERTY, gitg_preferences_general_properties[GITG_PREFERENCES_GENERAL_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_PREFERENCES_GENERAL_DISPLAY_NAME_PROPERTY, gitg_preferences_general_properties[GITG_PREFERENCES_GENERAL_DISPLAY_NAME_PROPERTY] = g_param_spec_string ("display-name", "display-name", "display-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/gitg/ui/gitg-preferences-general.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "smart_push", FALSE, GitgPreferencesGeneral_private_offset + G_STRUCT_OFFSET (GitgPreferencesGeneralPrivate, smart_push));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "visible_columns_grid", FALSE, GitgPreferencesGeneral_private_offset + G_STRUCT_OFFSET (GitgPreferencesGeneralPrivate, visible_columns_grid));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "show_column_headers_grid", FALSE, GitgPreferencesGeneral_private_offset + G_STRUCT_OFFSET (GitgPreferencesGeneralPrivate, show_column_headers_grid));
}

static void
gitg_preferences_general_gitg_ext_preferences_interface_init (GitgExtPreferencesIface * iface,
                                                              gpointer iface_data)
{
	gitg_preferences_general_gitg_ext_preferences_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_widget = gitg_preferences_general_real_get_widget;
	iface->get_id = gitg_preferences_general_real_get_id;
	iface->get_display_name = gitg_preferences_general_real_get_display_name;
}

static void
gitg_preferences_general_instance_init (GitgPreferencesGeneral * self,
                                        gpointer klass)
{
	self->priv = gitg_preferences_general_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
gitg_preferences_general_finalize (GObject * obj)
{
	GitgPreferencesGeneral * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_PREFERENCES_GENERAL, GitgPreferencesGeneral);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->treeview);
	G_OBJECT_CLASS (gitg_preferences_general_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gitg_preferences_general_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgPreferencesGeneralClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_preferences_general_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgPreferencesGeneral), 0, (GInstanceInitFunc) gitg_preferences_general_instance_init, NULL };
	static const GInterfaceInfo gitg_ext_preferences_info = { (GInterfaceInitFunc) gitg_preferences_general_gitg_ext_preferences_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gitg_preferences_general_type_id;
	gitg_preferences_general_type_id = g_type_register_static (gtk_grid_get_type (), "GitgPreferencesGeneral", &g_define_type_info, 0);
	g_type_add_interface_static (gitg_preferences_general_type_id, GITG_EXT_TYPE_PREFERENCES, &gitg_ext_preferences_info);
	GitgPreferencesGeneral_private_offset = g_type_add_instance_private (gitg_preferences_general_type_id, sizeof (GitgPreferencesGeneralPrivate));
	return gitg_preferences_general_type_id;
}

GType
gitg_preferences_general_get_type (void)
{
	static gsize gitg_preferences_general_type_id__once = 0;
	if (g_once_init_enter (&gitg_preferences_general_type_id__once)) {
		GType gitg_preferences_general_type_id;
		gitg_preferences_general_type_id = gitg_preferences_general_get_type_once ();
		g_once_init_leave (&gitg_preferences_general_type_id__once, gitg_preferences_general_type_id);
	}
	return gitg_preferences_general_type_id__once;
}

static void
_vala_gitg_preferences_general_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	GitgPreferencesGeneral * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_PREFERENCES_GENERAL, GitgPreferencesGeneral);
	switch (property_id) {
		case GITG_PREFERENCES_GENERAL_WIDGET_PROPERTY:
		g_value_take_object (value, gitg_ext_preferences_get_widget ((GitgExtPreferences*) self));
		break;
		case GITG_PREFERENCES_GENERAL_ID_PROPERTY:
		g_value_take_string (value, gitg_ext_preferences_get_id ((GitgExtPreferences*) self));
		break;
		case GITG_PREFERENCES_GENERAL_DISPLAY_NAME_PROPERTY:
		g_value_take_string (value, gitg_ext_preferences_get_display_name ((GitgExtPreferences*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

