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

/*
  This file is part of Dconf Editor

  Dconf Editor 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.

  Dconf Editor 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 Dconf Editor.  If not, see <https://www.gnu.org/licenses/>.
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.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 TYPE_BROWSABLE_VIEW (browsable_view_get_type ())
#define BROWSABLE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BROWSABLE_VIEW, BrowsableView))
#define IS_BROWSABLE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BROWSABLE_VIEW))
#define BROWSABLE_VIEW_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_BROWSABLE_VIEW, BrowsableViewIface))

typedef struct _BrowsableView BrowsableView;
typedef struct _BrowsableViewIface BrowsableViewIface;

#define TYPE_ADAPTATIVE_WIDGET (adaptative_widget_get_type ())
#define ADAPTATIVE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ADAPTATIVE_WIDGET, AdaptativeWidget))
#define IS_ADAPTATIVE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ADAPTATIVE_WIDGET))
#define ADAPTATIVE_WIDGET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_ADAPTATIVE_WIDGET, AdaptativeWidgetIface))

typedef struct _AdaptativeWidget AdaptativeWidget;
typedef struct _AdaptativeWidgetIface AdaptativeWidgetIface;
typedef enum  {
	ADAPTATIVE_WIDGET_WINDOW_SIZE_START_SIZE,
	ADAPTATIVE_WIDGET_WINDOW_SIZE_USUAL_SIZE,
	ADAPTATIVE_WIDGET_WINDOW_SIZE_QUITE_THIN,
	ADAPTATIVE_WIDGET_WINDOW_SIZE_PHONE_VERT,
	ADAPTATIVE_WIDGET_WINDOW_SIZE_PHONE_HZTL,
	ADAPTATIVE_WIDGET_WINDOW_SIZE_PHONE_BOTH,
	ADAPTATIVE_WIDGET_WINDOW_SIZE_EXTRA_THIN,
	ADAPTATIVE_WIDGET_WINDOW_SIZE_EXTRA_FLAT
} AdaptativeWidgetWindowSize;

#define ADAPTATIVE_WIDGET_TYPE_WINDOW_SIZE (adaptative_widget_window_size_get_type ())

#define TYPE_REGISTRY_LIST (registry_list_get_type ())
#define REGISTRY_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_REGISTRY_LIST, RegistryList))
#define REGISTRY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_REGISTRY_LIST, RegistryListClass))
#define IS_REGISTRY_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_REGISTRY_LIST))
#define IS_REGISTRY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_REGISTRY_LIST))
#define REGISTRY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_REGISTRY_LIST, RegistryListClass))

typedef struct _RegistryList RegistryList;
typedef struct _RegistryListClass RegistryListClass;
typedef struct _RegistryListPrivate RegistryListPrivate;

#define TYPE_REGISTRY_VIEW (registry_view_get_type ())
#define REGISTRY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_REGISTRY_VIEW, RegistryView))
#define REGISTRY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_REGISTRY_VIEW, RegistryViewClass))
#define IS_REGISTRY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_REGISTRY_VIEW))
#define IS_REGISTRY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_REGISTRY_VIEW))
#define REGISTRY_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_REGISTRY_VIEW, RegistryViewClass))

typedef struct _RegistryView RegistryView;
typedef struct _RegistryViewClass RegistryViewClass;
typedef struct _RegistryViewPrivate RegistryViewPrivate;
enum  {
	REGISTRY_VIEW_0_PROPERTY,
	REGISTRY_VIEW_PLACEHOLDER_LABEL_PROPERTY,
	REGISTRY_VIEW_NUM_PROPERTIES
};
static GParamSpec* registry_view_properties[REGISTRY_VIEW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_MODIFICATIONS_HANDLER (modifications_handler_get_type ())
#define MODIFICATIONS_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MODIFICATIONS_HANDLER, ModificationsHandler))
#define MODIFICATIONS_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MODIFICATIONS_HANDLER, ModificationsHandlerClass))
#define IS_MODIFICATIONS_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MODIFICATIONS_HANDLER))
#define IS_MODIFICATIONS_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MODIFICATIONS_HANDLER))
#define MODIFICATIONS_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MODIFICATIONS_HANDLER, ModificationsHandlerClass))

typedef struct _ModificationsHandler ModificationsHandler;
typedef struct _ModificationsHandlerClass ModificationsHandlerClass;

#define TYPE_SETTINGS_MODEL_CORE (settings_model_core_get_type ())
#define SETTINGS_MODEL_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS_MODEL_CORE, SettingsModelCore))
#define SETTINGS_MODEL_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SETTINGS_MODEL_CORE, SettingsModelCoreClass))
#define IS_SETTINGS_MODEL_CORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SETTINGS_MODEL_CORE))
#define IS_SETTINGS_MODEL_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SETTINGS_MODEL_CORE))
#define SETTINGS_MODEL_CORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SETTINGS_MODEL_CORE, SettingsModelCoreClass))

typedef struct _SettingsModelCore SettingsModelCore;
typedef struct _SettingsModelCoreClass SettingsModelCoreClass;

#define TYPE_SETTINGS_MODEL (settings_model_get_type ())
#define SETTINGS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SETTINGS_MODEL, SettingsModel))
#define SETTINGS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SETTINGS_MODEL, SettingsModelClass))
#define IS_SETTINGS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SETTINGS_MODEL))
#define IS_SETTINGS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SETTINGS_MODEL))
#define SETTINGS_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SETTINGS_MODEL, SettingsModelClass))

typedef struct _SettingsModel SettingsModel;
typedef struct _SettingsModelClass SettingsModelClass;
#define _g_variant_iter_free0(var) ((var == NULL) ? NULL : (var = (g_variant_iter_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_SIMPLE_SETTING_OBJECT (simple_setting_object_get_type ())
#define SIMPLE_SETTING_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SIMPLE_SETTING_OBJECT, SimpleSettingObject))
#define SIMPLE_SETTING_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SIMPLE_SETTING_OBJECT, SimpleSettingObjectClass))
#define IS_SIMPLE_SETTING_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SIMPLE_SETTING_OBJECT))
#define IS_SIMPLE_SETTING_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SIMPLE_SETTING_OBJECT))
#define SIMPLE_SETTING_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SIMPLE_SETTING_OBJECT, SimpleSettingObjectClass))

typedef struct _SimpleSettingObject SimpleSettingObject;
typedef struct _SimpleSettingObjectClass SimpleSettingObjectClass;

struct _BrowsableViewIface {
	GTypeInterface parent_iface;
	gboolean (*handle_copy_text) (BrowsableView* self, gchar** copy_text);
};

struct _AdaptativeWidgetIface {
	GTypeInterface parent_iface;
	void (*set_window_size) (AdaptativeWidget* self, AdaptativeWidgetWindowSize new_size);
};

struct _RegistryList {
	GtkGrid parent_instance;
	RegistryListPrivate * priv;
	GtkListBox* key_list_box;
	gchar* current_path_if_search_mode;
	gboolean search_is_path_search;
	GListStore* list_model;
};

struct _RegistryListClass {
	GtkGridClass parent_class;
	void (*select_first_row) (RegistryList* self);
	const gchar* (*get_placeholder_label) (RegistryList* self);
};

struct _RegistryView {
	RegistryList parent_instance;
	RegistryViewPrivate * priv;
};

struct _RegistryViewClass {
	RegistryListClass parent_class;
};

static gpointer registry_view_parent_class = NULL;

VALA_EXTERN GType browsable_view_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType adaptative_widget_window_size_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType adaptative_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AdaptativeWidget, g_object_unref)
VALA_EXTERN GType registry_list_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RegistryList, g_object_unref)
VALA_EXTERN GType registry_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RegistryView, g_object_unref)
VALA_EXTERN void registry_list_select_first_row (RegistryList* self);
VALA_EXTERN const gchar* registry_list_get_placeholder_label (RegistryList* self);
VALA_EXTERN void registry_view_set_key_model (RegistryView* self,
                                  GListStore* key_model);
VALA_EXTERN GtkWidget* registry_list_new_list_box_row (RegistryList* self,
                                           GObject* item);
static GtkWidget* _registry_list_new_list_box_row_gtk_list_box_create_widget_func (GObject* item,
                                                                            gpointer self);
VALA_EXTERN GType modifications_handler_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ModificationsHandler, g_object_unref)
VALA_EXTERN ModificationsHandler* registry_list_get_modifications_handler (RegistryList* self);
VALA_EXTERN GType settings_model_core_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SettingsModelCore, g_object_unref)
VALA_EXTERN GType settings_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SettingsModel, g_object_unref)
VALA_EXTERN SettingsModel* modifications_handler_get_model (ModificationsHandler* self);
VALA_EXTERN void settings_model_keys_value_push (SettingsModel* self);
VALA_EXTERN gboolean registry_view_check_reload (RegistryView* self,
                                     GVariant* fresh_key_model);
VALA_EXTERN GType simple_setting_object_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SimpleSettingObject, g_object_unref)
VALA_EXTERN guint16 simple_setting_object_get_context_id (SimpleSettingObject* self);
VALA_EXTERN const gchar* simple_setting_object_get_name (SimpleSettingObject* self);
static void registry_view_real_select_first_row (RegistryList* base);
static void registry_view_update_row_header (RegistryView* self,
                                      GtkListBoxRow* row,
                                      GtkListBoxRow* before);
VALA_EXTERN gboolean registry_list_is_first_row (gint row_index,
                                     GtkListBoxRow* before);
VALA_EXTERN void registry_list_update_row_header_with_context (GtkListBoxRow* row,
                                                   GtkListBoxRow* before,
                                                   SettingsModel* model,
                                                   gboolean local_search_header);
VALA_EXTERN RegistryView* registry_view_new (void);
VALA_EXTERN RegistryView* registry_view_construct (GType object_type);
VALA_EXTERN RegistryList* registry_list_construct (GType object_type);
static GObject * registry_view_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties);
VALA_EXTERN void registry_list_set_search_mode (RegistryList* self,
                                    gboolean value);
static void _registry_view_update_row_header_gtk_list_box_update_header_func (GtkListBoxRow* row,
                                                                       GtkListBoxRow* before,
                                                                       gpointer self);
static GType registry_view_get_type_once (void);
static void _vala_registry_view_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

static GtkWidget*
_registry_list_new_list_box_row_gtk_list_box_create_widget_func (GObject* item,
                                                                 gpointer self)
{
	GtkWidget* result;
	result = registry_list_new_list_box_row ((RegistryList*) self, item);
	return result;
}

void
registry_view_set_key_model (RegistryView* self,
                             GListStore* key_model)
{
	GListStore* _tmp0_;
	GtkListBox* _tmp1_;
	GListStore* _tmp2_;
	ModificationsHandler* _tmp3_;
	ModificationsHandler* _tmp4_;
	SettingsModel* _tmp5_;
	SettingsModel* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key_model != NULL);
	_tmp0_ = _g_object_ref0 (key_model);
	_g_object_unref0 (((RegistryList*) self)->list_model);
	((RegistryList*) self)->list_model = _tmp0_;
	_tmp1_ = ((RegistryList*) self)->key_list_box;
	_tmp2_ = ((RegistryList*) self)->list_model;
	gtk_list_box_bind_model (_tmp1_, (GListModel*) _tmp2_, _registry_list_new_list_box_row_gtk_list_box_create_widget_func, g_object_ref ((RegistryList*) self), g_object_unref);
	_tmp3_ = registry_list_get_modifications_handler ((RegistryList*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = modifications_handler_get_model (_tmp4_);
	_tmp6_ = _tmp5_;
	settings_model_keys_value_push (_tmp6_);
}

gboolean
registry_view_check_reload (RegistryView* self,
                            GVariant* fresh_key_model)
{
	GVariantIter* iter = NULL;
	GVariantIter* _tmp0_;
	guint n_items = 0U;
	GVariantIter* _tmp1_;
	GListStore* _tmp2_;
	gboolean* skip = NULL;
	gboolean* _tmp3_;
	gint skip_length1;
	gint _skip_size_;
	guint16 context_id = 0U;
	gchar* name = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (fresh_key_model == NULL) {
		result = TRUE;
		return result;
	}
	_tmp0_ = g_variant_iter_new ((GVariant*) fresh_key_model);
	iter = _tmp0_;
	_tmp1_ = iter;
	n_items = (guint) g_variant_iter_n_children (_tmp1_);
	_tmp2_ = ((RegistryList*) self)->list_model;
	if (g_list_model_get_n_items ((GListModel*) _tmp2_) != n_items) {
		result = TRUE;
		_g_variant_iter_free0 (iter);
		return result;
	}
	_tmp3_ = g_new0 (gboolean, n_items);
	skip = _tmp3_;
	skip_length1 = n_items;
	_skip_size_ = skip_length1;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean* _tmp6_;
				gint _tmp6__length1;
				if (!_tmp4_) {
					guint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (!(i < n_items)) {
					break;
				}
				_tmp6_ = skip;
				_tmp6__length1 = skip_length1;
				_tmp6_[i] = FALSE;
			}
		}
	}
	while (TRUE) {
		GVariantIter* _tmp7_;
		guint16 _tmp8_ = 0U;
		gchar* _tmp9_ = NULL;
		gboolean _tmp10_;
		gboolean found = FALSE;
		_tmp7_ = iter;
		_tmp10_ = g_variant_iter_next (_tmp7_, "(qs)", &_tmp8_, &_tmp9_, NULL);
		context_id = _tmp8_;
		_g_free0 (name);
		name = _tmp9_;
		if (!_tmp10_) {
			break;
		}
		found = FALSE;
		{
			guint i = 0U;
			i = (guint) 0;
			{
				gboolean _tmp11_ = FALSE;
				_tmp11_ = TRUE;
				while (TRUE) {
					GListStore* _tmp13_;
					gboolean* _tmp14_;
					gint _tmp14__length1;
					gboolean _tmp15_;
					SimpleSettingObject* setting_object = NULL;
					GListStore* _tmp16_;
					GObject* _tmp17_;
					SimpleSettingObject* _tmp18_;
					SimpleSettingObject* _tmp19_;
					guint16 _tmp20_;
					guint16 _tmp21_;
					SimpleSettingObject* _tmp22_;
					const gchar* _tmp23_;
					const gchar* _tmp24_;
					const gchar* _tmp25_;
					gboolean* _tmp26_;
					gint _tmp26__length1;
					if (!_tmp11_) {
						guint _tmp12_;
						_tmp12_ = i;
						i = _tmp12_ + 1;
					}
					_tmp11_ = FALSE;
					_tmp13_ = ((RegistryList*) self)->list_model;
					if (!(i < g_list_model_get_n_items ((GListModel*) _tmp13_))) {
						break;
					}
					_tmp14_ = skip;
					_tmp14__length1 = skip_length1;
					_tmp15_ = _tmp14_[i];
					if (_tmp15_ == TRUE) {
						continue;
					}
					_tmp16_ = ((RegistryList*) self)->list_model;
					_tmp17_ = g_list_model_get_item ((GListModel*) _tmp16_, i);
					setting_object = G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, TYPE_SIMPLE_SETTING_OBJECT, SimpleSettingObject);
					_tmp18_ = setting_object;
					if (_tmp18_ == NULL) {
						g_assert_not_reached ();
					}
					_tmp19_ = setting_object;
					_tmp20_ = simple_setting_object_get_context_id (G_TYPE_CHECK_INSTANCE_CAST (_tmp19_, TYPE_SIMPLE_SETTING_OBJECT, SimpleSettingObject));
					_tmp21_ = _tmp20_;
					if (_tmp21_ != context_id) {
						_g_object_unref0 (setting_object);
						continue;
					}
					_tmp22_ = setting_object;
					_tmp23_ = simple_setting_object_get_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, TYPE_SIMPLE_SETTING_OBJECT, SimpleSettingObject));
					_tmp24_ = _tmp23_;
					_tmp25_ = name;
					if (g_strcmp0 (_tmp24_, _tmp25_) != 0) {
						_g_object_unref0 (setting_object);
						continue;
					}
					found = TRUE;
					_tmp26_ = skip;
					_tmp26__length1 = skip_length1;
					_tmp26_[i] = TRUE;
					_g_object_unref0 (setting_object);
					break;
				}
			}
		}
		if (!found) {
			result = TRUE;
			_g_free0 (name);
			skip = (g_free (skip), NULL);
			_g_variant_iter_free0 (iter);
			return result;
		}
	}
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp27_ = FALSE;
			_tmp27_ = TRUE;
			while (TRUE) {
				gboolean* _tmp29_;
				gint _tmp29__length1;
				gboolean _tmp30_;
				if (!_tmp27_) {
					guint _tmp28_;
					_tmp28_ = i;
					i = _tmp28_ + 1;
				}
				_tmp27_ = FALSE;
				if (!(i < n_items)) {
					break;
				}
				_tmp29_ = skip;
				_tmp29__length1 = skip_length1;
				_tmp30_ = _tmp29_[i];
				if (_tmp30_ == FALSE) {
					result = TRUE;
					_g_free0 (name);
					skip = (g_free (skip), NULL);
					_g_variant_iter_free0 (iter);
					return result;
				}
			}
		}
	}
	result = FALSE;
	_g_free0 (name);
	skip = (g_free (skip), NULL);
	_g_variant_iter_free0 (iter);
	return result;
}

static void
registry_view_real_select_first_row (RegistryList* base)
{
	RegistryView * self;
	guint n_items = 0U;
	GListStore* _tmp0_;
	GtkListBoxRow* row = NULL;
	GtkListBoxRow* _tmp7_;
	GtkListBox* _tmp8_;
	GtkListBoxRow* _tmp9_;
	GtkListBoxRow* _tmp10_;
	self = (RegistryView*) base;
	_tmp0_ = ((RegistryList*) self)->list_model;
	n_items = g_list_model_get_n_items ((GListModel*) _tmp0_);
	if (n_items == ((guint) 0)) {
		g_assert_not_reached ();
	}
	if (n_items == ((guint) 2)) {
		GtkListBox* _tmp1_;
		GtkListBoxRow* _tmp2_;
		GtkListBoxRow* _tmp3_;
		_tmp1_ = ((RegistryList*) self)->key_list_box;
		_tmp2_ = gtk_list_box_get_row_at_index (_tmp1_, 1);
		_tmp3_ = _g_object_ref0 (_tmp2_);
		_g_object_unref0 (row);
		row = _tmp3_;
	} else {
		GtkListBox* _tmp4_;
		GtkListBoxRow* _tmp5_;
		GtkListBoxRow* _tmp6_;
		_tmp4_ = ((RegistryList*) self)->key_list_box;
		_tmp5_ = gtk_list_box_get_row_at_index (_tmp4_, 0);
		_tmp6_ = _g_object_ref0 (_tmp5_);
		_g_object_unref0 (row);
		row = _tmp6_;
	}
	_tmp7_ = row;
	if (_tmp7_ == NULL) {
		g_assert_not_reached ();
	}
	_tmp8_ = ((RegistryList*) self)->key_list_box;
	_tmp9_ = row;
	gtk_list_box_select_row (_tmp8_, G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, gtk_list_box_row_get_type (), GtkListBoxRow));
	_tmp10_ = row;
	gtk_widget_grab_focus ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, gtk_list_box_row_get_type (), GtkListBoxRow));
	_g_object_unref0 (row);
}

static void
registry_view_update_row_header (RegistryView* self,
                                 GtkListBoxRow* row,
                                 GtkListBoxRow* before)
{
	ModificationsHandler* _tmp0_;
	ModificationsHandler* _tmp1_;
	SettingsModel* _tmp2_;
	SettingsModel* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (row != NULL);
	if (registry_list_is_first_row (gtk_list_box_row_get_index (row), before)) {
		return;
	}
	_tmp0_ = registry_list_get_modifications_handler ((RegistryList*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = modifications_handler_get_model (_tmp1_);
	_tmp3_ = _tmp2_;
	registry_list_update_row_header_with_context (row, G_TYPE_CHECK_INSTANCE_CAST (before, gtk_list_box_row_get_type (), GtkListBoxRow), _tmp3_, FALSE);
}

RegistryView*
registry_view_construct (GType object_type)
{
	RegistryView * self = NULL;
	self = (RegistryView*) registry_list_construct (object_type);
	return self;
}

RegistryView*
registry_view_new (void)
{
	return registry_view_construct (TYPE_REGISTRY_VIEW);
}

static const gchar*
registry_view_real_get_placeholder_label (RegistryList* base)
{
	const gchar* result;
	RegistryView* self;
	self = (RegistryView*) base;
	result = _ ("No keys in this path");
	return result;
}

static void
_registry_view_update_row_header_gtk_list_box_update_header_func (GtkListBoxRow* row,
                                                                  GtkListBoxRow* before,
                                                                  gpointer self)
{
	registry_view_update_row_header ((RegistryView*) self, row, before);
}

static GObject *
registry_view_constructor (GType type,
                           guint n_construct_properties,
                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	RegistryView * self;
	GtkListBox* _tmp0_;
	parent_class = G_OBJECT_CLASS (registry_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_REGISTRY_VIEW, RegistryView);
	registry_list_set_search_mode ((RegistryList*) self, FALSE);
	_tmp0_ = ((RegistryList*) self)->key_list_box;
	gtk_list_box_set_header_func (_tmp0_, _registry_view_update_row_header_gtk_list_box_update_header_func, g_object_ref (self), g_object_unref);
	return obj;
}

static void
registry_view_class_init (RegistryViewClass * klass,
                          gpointer klass_data)
{
	registry_view_parent_class = g_type_class_peek_parent (klass);
	((RegistryListClass *) klass)->select_first_row = (void (*) (RegistryList*)) registry_view_real_select_first_row;
	REGISTRY_LIST_CLASS (klass)->get_placeholder_label = (const gchar* (*) (RegistryList*)) registry_view_real_get_placeholder_label;
	G_OBJECT_CLASS (klass)->get_property = _vala_registry_view_get_property;
	G_OBJECT_CLASS (klass)->constructor = registry_view_constructor;
	g_object_class_install_property (G_OBJECT_CLASS (klass), REGISTRY_VIEW_PLACEHOLDER_LABEL_PROPERTY, registry_view_properties[REGISTRY_VIEW_PLACEHOLDER_LABEL_PROPERTY] = g_param_spec_string ("placeholder-label", "placeholder-label", "placeholder-label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
}

static void
registry_view_instance_init (RegistryView * self,
                             gpointer klass)
{
}

static GType
registry_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RegistryViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) registry_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RegistryView), 0, (GInstanceInitFunc) registry_view_instance_init, NULL };
	GType registry_view_type_id;
	registry_view_type_id = g_type_register_static (TYPE_REGISTRY_LIST, "RegistryView", &g_define_type_info, 0);
	return registry_view_type_id;
}

GType
registry_view_get_type (void)
{
	static volatile gsize registry_view_type_id__once = 0;
	if (g_once_init_enter (&registry_view_type_id__once)) {
		GType registry_view_type_id;
		registry_view_type_id = registry_view_get_type_once ();
		g_once_init_leave (&registry_view_type_id__once, registry_view_type_id);
	}
	return registry_view_type_id__once;
}

static void
_vala_registry_view_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	RegistryView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_REGISTRY_VIEW, RegistryView);
	switch (property_id) {
		case REGISTRY_VIEW_PLACEHOLDER_LABEL_PROPERTY:
		g_value_set_string (value, registry_list_get_placeholder_label ((RegistryList*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

