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

/*
* Copyright (c) 2020 Felipe Escoto (https://github.com/Philip-Scott/Notes-up)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authored by: Felipe Escoto <felescoto95@hotmail.com>
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <granite.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <pango/pango.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 ENOTES_TYPE_NOTEBOOK_PICKER (enotes_notebook_picker_get_type ())
#define ENOTES_NOTEBOOK_PICKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_NOTEBOOK_PICKER, ENotesNotebookPicker))
#define ENOTES_NOTEBOOK_PICKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_NOTEBOOK_PICKER, ENotesNotebookPickerClass))
#define ENOTES_IS_NOTEBOOK_PICKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_NOTEBOOK_PICKER))
#define ENOTES_IS_NOTEBOOK_PICKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_NOTEBOOK_PICKER))
#define ENOTES_NOTEBOOK_PICKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_NOTEBOOK_PICKER, ENotesNotebookPickerClass))

typedef struct _ENotesNotebookPicker ENotesNotebookPicker;
typedef struct _ENotesNotebookPickerClass ENotesNotebookPickerClass;
typedef struct _ENotesNotebookPickerPrivate ENotesNotebookPickerPrivate;
enum  {
	ENOTES_NOTEBOOK_PICKER_0_PROPERTY,
	ENOTES_NOTEBOOK_PICKER_NUM_PROPERTIES
};
static GParamSpec* enotes_notebook_picker_properties[ENOTES_NOTEBOOK_PICKER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define ENOTES_SERVICES_TYPE_SETTINGS (enotes_services_settings_get_type ())
#define ENOTES_SERVICES_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_SERVICES_TYPE_SETTINGS, ENotesServicesSettings))
#define ENOTES_SERVICES_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_SERVICES_TYPE_SETTINGS, ENotesServicesSettingsClass))
#define ENOTES_SERVICES_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_SERVICES_TYPE_SETTINGS))
#define ENOTES_SERVICES_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_SERVICES_TYPE_SETTINGS))
#define ENOTES_SERVICES_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_SERVICES_TYPE_SETTINGS, ENotesServicesSettingsClass))

typedef struct _ENotesServicesSettings ENotesServicesSettings;
typedef struct _ENotesServicesSettingsClass ENotesServicesSettingsClass;

#define ENOTES_NOTEBOOK_PICKER_TYPE_NOTEBOOK_ELEMENT (enotes_notebook_picker_notebook_element_get_type ())
#define ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_NOTEBOOK_PICKER_TYPE_NOTEBOOK_ELEMENT, ENotesNotebookPickerNotebookElement))
#define ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_NOTEBOOK_PICKER_TYPE_NOTEBOOK_ELEMENT, ENotesNotebookPickerNotebookElementClass))
#define ENOTES_NOTEBOOK_PICKER_IS_NOTEBOOK_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_NOTEBOOK_PICKER_TYPE_NOTEBOOK_ELEMENT))
#define ENOTES_NOTEBOOK_PICKER_IS_NOTEBOOK_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_NOTEBOOK_PICKER_TYPE_NOTEBOOK_ELEMENT))
#define ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_NOTEBOOK_PICKER_TYPE_NOTEBOOK_ELEMENT, ENotesNotebookPickerNotebookElementClass))

typedef struct _ENotesNotebookPickerNotebookElement ENotesNotebookPickerNotebookElement;
typedef struct _ENotesNotebookPickerNotebookElementClass ENotesNotebookPickerNotebookElementClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _ENotesNotebookPickerNotebookElementPrivate ENotesNotebookPickerNotebookElementPrivate;
enum  {
	ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_0_PROPERTY,
	ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_FILE_PROPERTY,
	ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_FILE_PATH_PROPERTY,
	ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_NUM_PROPERTIES
};
static GParamSpec* enotes_notebook_picker_notebook_element_properties[ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_NUM_PROPERTIES];

#define ENOTES_TYPE_APPLICATION (enotes_application_get_type ())
#define ENOTES_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_APPLICATION, ENotesApplication))
#define ENOTES_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_APPLICATION, ENotesApplicationClass))
#define ENOTES_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_APPLICATION))
#define ENOTES_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_APPLICATION))
#define ENOTES_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_APPLICATION, ENotesApplicationClass))

typedef struct _ENotesApplication ENotesApplication;
typedef struct _ENotesApplicationClass ENotesApplicationClass;
typedef struct _ENotesApplicationPrivate ENotesApplicationPrivate;

#define ENOTES_APPLICATION_TYPE_STATE (enotes_application_state_get_type ())
#define ENOTES_APPLICATION_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_APPLICATION_TYPE_STATE, ENotesApplicationState))
#define ENOTES_APPLICATION_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_APPLICATION_TYPE_STATE, ENotesApplicationStateClass))
#define ENOTES_APPLICATION_IS_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_APPLICATION_TYPE_STATE))
#define ENOTES_APPLICATION_IS_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_APPLICATION_TYPE_STATE))
#define ENOTES_APPLICATION_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_APPLICATION_TYPE_STATE, ENotesApplicationStateClass))

typedef struct _ENotesApplicationState ENotesApplicationState;
typedef struct _ENotesApplicationStateClass ENotesApplicationStateClass;

struct _ENotesNotebookPicker {
	GtkGrid parent_instance;
	ENotesNotebookPickerPrivate * priv;
};

struct _ENotesNotebookPickerClass {
	GtkGridClass parent_class;
};

struct _ENotesNotebookPickerPrivate {
	GtkListBox* notebook_list;
};

struct _ENotesNotebookPickerNotebookElement {
	GtkListBoxRow parent_instance;
	ENotesNotebookPickerNotebookElementPrivate * priv;
};

struct _ENotesNotebookPickerNotebookElementClass {
	GtkListBoxRowClass parent_class;
};

struct _ENotesNotebookPickerNotebookElementPrivate {
	GFile* _file;
};

struct _ENotesApplication {
	GraniteApplication parent_instance;
	ENotesApplicationPrivate * priv;
	gboolean running;
	ENotesApplicationState* state;
};

struct _ENotesApplicationClass {
	GraniteApplicationClass parent_class;
};

static gint ENotesNotebookPicker_private_offset;
static gpointer enotes_notebook_picker_parent_class = NULL;
VALA_EXTERN ENotesServicesSettings* enotes_settings;
static gint ENotesNotebookPickerNotebookElement_private_offset;
static gpointer enotes_notebook_picker_notebook_element_parent_class = NULL;
VALA_EXTERN ENotesApplication* enotes_app;

VALA_EXTERN GType enotes_notebook_picker_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesNotebookPicker, g_object_unref)
VALA_EXTERN ENotesNotebookPicker* enotes_notebook_picker_new (void);
VALA_EXTERN ENotesNotebookPicker* enotes_notebook_picker_construct (GType object_type);
static void enotes_notebook_picker_reload (ENotesNotebookPicker* self);
VALA_EXTERN GType enotes_services_settings_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesServicesSettings, g_object_unref)
VALA_EXTERN gchar** enotes_services_settings_get_recent_files (ENotesServicesSettings* self,
                                                   gint* result_length1);
static GType enotes_notebook_picker_notebook_element_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesNotebookPickerNotebookElement, g_object_unref)
static ENotesNotebookPickerNotebookElement* enotes_notebook_picker_notebook_element_new (const gchar* _file);
static ENotesNotebookPickerNotebookElement* enotes_notebook_picker_notebook_element_construct (GType object_type,
                                                                                        const gchar* _file);
static GFile* enotes_notebook_picker_notebook_element_get_file (ENotesNotebookPickerNotebookElement* self);
static void enotes_notebook_picker_notebook_element_set_file (ENotesNotebookPickerNotebookElement* self,
                                                       GFile* value);
static gchar* enotes_notebook_picker_notebook_element_get_file_path (ENotesNotebookPickerNotebookElement* self);
static GObject * enotes_notebook_picker_notebook_element_constructor (GType type,
                                                               guint n_construct_properties,
                                                               GObjectConstructParam * construct_properties);
static void enotes_notebook_picker_notebook_element_finalize (GObject * obj);
static GType enotes_notebook_picker_notebook_element_get_type_once (void);
static void _vala_enotes_notebook_picker_notebook_element_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec);
static void _vala_enotes_notebook_picker_notebook_element_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec);
static GObject * enotes_notebook_picker_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties);
VALA_EXTERN GType enotes_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesApplication, g_object_unref)
VALA_EXTERN GType enotes_application_state_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesApplicationState, g_object_unref)
static void _enotes_notebook_picker___lambda127_ (ENotesNotebookPicker* self);
VALA_EXTERN const gchar* enotes_application_state_get_db (ENotesApplicationState* self);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
static void __enotes_notebook_picker___lambda127__g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self);
static void _enotes_notebook_picker___lambda128_ (ENotesNotebookPicker* self,
                                           GtkListBoxRow* row);
VALA_EXTERN void enotes_application_state_set_database (ENotesApplicationState* self,
                                            const gchar* _db);
static void __enotes_notebook_picker___lambda128__gtk_list_box_row_activated (GtkListBox* _sender,
                                                                       GtkListBoxRow* row,
                                                                       gpointer self);
static void _enotes_notebook_picker___lambda129_ (ENotesNotebookPicker* self);
VALA_EXTERN GFile* enotes_file_manager_get_file_from_user (const gchar* filetype,
                                               GtkFileChooserAction* chooser_action);
static void __enotes_notebook_picker___lambda129__gtk_button_clicked (GtkButton* _sender,
                                                               gpointer self);
static void enotes_notebook_picker_finalize (GObject * obj);
static GType enotes_notebook_picker_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
enotes_notebook_picker_get_instance_private (ENotesNotebookPicker* self)
{
	return G_STRUCT_MEMBER_P (self, ENotesNotebookPicker_private_offset);
}

ENotesNotebookPicker*
enotes_notebook_picker_construct (GType object_type)
{
	ENotesNotebookPicker * self = NULL;
	self = (ENotesNotebookPicker*) g_object_new (object_type, NULL);
	return self;
}

ENotesNotebookPicker*
enotes_notebook_picker_new (void)
{
	return enotes_notebook_picker_construct (ENOTES_TYPE_NOTEBOOK_PICKER);
}

static void
enotes_notebook_picker_reload (ENotesNotebookPicker* self)
{
	ENotesServicesSettings* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gint _tmp2_ = 0;
	gchar** _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = enotes_settings;
	_tmp1_ = enotes_services_settings_get_recent_files (_tmp0_, &_tmp2_);
	_tmp1__length1 = _tmp2_;
	_tmp3_ = _tmp1_;
	_tmp3__length1 = _tmp1__length1;
	{
		gchar** path_collection = NULL;
		gint path_collection_length1 = 0;
		gint _path_collection_size_ = 0;
		gint path_it = 0;
		path_collection = _tmp3_;
		path_collection_length1 = _tmp3__length1;
		for (path_it = 0; path_it < path_collection_length1; path_it = path_it + 1) {
			gchar* _tmp4_;
			gchar* path = NULL;
			_tmp4_ = g_strdup (path_collection[path_it]);
			path = _tmp4_;
			{
				ENotesNotebookPickerNotebookElement* element = NULL;
				const gchar* _tmp5_;
				ENotesNotebookPickerNotebookElement* _tmp6_;
				GtkListBox* _tmp7_;
				ENotesNotebookPickerNotebookElement* _tmp8_;
				_tmp5_ = path;
				_tmp6_ = enotes_notebook_picker_notebook_element_new (_tmp5_);
				g_object_ref_sink (_tmp6_);
				element = _tmp6_;
				_tmp7_ = self->priv->notebook_list;
				_tmp8_ = element;
				gtk_container_add ((GtkContainer*) _tmp7_, (GtkWidget*) _tmp8_);
				_g_object_unref0 (element);
				_g_free0 (path);
			}
		}
	}
}

static inline gpointer
enotes_notebook_picker_notebook_element_get_instance_private (ENotesNotebookPickerNotebookElement* self)
{
	return G_STRUCT_MEMBER_P (self, ENotesNotebookPickerNotebookElement_private_offset);
}

static ENotesNotebookPickerNotebookElement*
enotes_notebook_picker_notebook_element_construct (GType object_type,
                                                   const gchar* _file)
{
	ENotesNotebookPickerNotebookElement * self = NULL;
	GFile* _tmp0_;
	GFile* _tmp1_;
	g_return_val_if_fail (_file != NULL, NULL);
	_tmp0_ = g_file_new_for_path (_file);
	_tmp1_ = _tmp0_;
	self = (ENotesNotebookPickerNotebookElement*) g_object_new (object_type, "file", _tmp1_, NULL);
	_g_object_unref0 (_tmp1_);
	return self;
}

static ENotesNotebookPickerNotebookElement*
enotes_notebook_picker_notebook_element_new (const gchar* _file)
{
	return enotes_notebook_picker_notebook_element_construct (ENOTES_NOTEBOOK_PICKER_TYPE_NOTEBOOK_ELEMENT, _file);
}

static GFile*
enotes_notebook_picker_notebook_element_get_file (ENotesNotebookPickerNotebookElement* self)
{
	GFile* result;
	GFile* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file;
	result = _tmp0_;
	return result;
}

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

static void
enotes_notebook_picker_notebook_element_set_file (ENotesNotebookPickerNotebookElement* self,
                                                  GFile* value)
{
	GFile* old_value;
	g_return_if_fail (self != NULL);
	old_value = enotes_notebook_picker_notebook_element_get_file (self);
	if (old_value != value) {
		GFile* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_file);
		self->priv->_file = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, enotes_notebook_picker_notebook_element_properties[ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_FILE_PROPERTY]);
	}
}

static gchar*
enotes_notebook_picker_notebook_element_get_file_path (ENotesNotebookPickerNotebookElement* self)
{
	gchar* result;
	GFile* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file;
	_tmp1_ = g_file_get_path (_tmp0_);
	result = _tmp1_;
	return result;
}

static gint
string_last_index_of_char (const gchar* self,
                           gunichar c,
                           gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = g_utf8_strrchr (((gchar*) self) + start_index, (gssize) -1, c);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static GObject *
enotes_notebook_picker_notebook_element_constructor (GType type,
                                                     guint n_construct_properties,
                                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ENotesNotebookPickerNotebookElement * self;
	GtkStyleContext* _tmp0_;
	GtkStyleContext* _tmp1_;
	GFile* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* file_name = NULL;
	GFile* _tmp5_;
	gchar* _tmp6_;
	gint last_index = 0;
	const gchar* _tmp7_;
	GtkLabel* label = NULL;
	const gchar* _tmp10_;
	GtkLabel* _tmp11_;
	GtkLabel* _tmp12_;
	GtkStyleContext* _tmp13_;
	GtkLabel* _tmp14_;
	GtkLabel* _tmp15_;
	GtkImage* icon = NULL;
	GtkImage* _tmp16_;
	GtkBox* box = NULL;
	GtkBox* _tmp17_;
	GtkBox* _tmp18_;
	GtkBox* _tmp19_;
	GtkImage* _tmp20_;
	GtkBox* _tmp21_;
	GtkLabel* _tmp22_;
	GtkBox* _tmp23_;
	parent_class = G_OBJECT_CLASS (enotes_notebook_picker_notebook_element_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_NOTEBOOK_PICKER_TYPE_NOTEBOOK_ELEMENT, ENotesNotebookPickerNotebookElement);
	_tmp0_ = gtk_widget_get_style_context ((GtkWidget*) self);
	gtk_style_context_add_class (_tmp0_, "button");
	_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
	gtk_style_context_add_class (_tmp1_, "flat");
	_tmp2_ = self->priv->_file;
	_tmp3_ = g_file_get_path (_tmp2_);
	_tmp4_ = _tmp3_;
	gtk_widget_set_tooltip_text ((GtkWidget*) self, _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = self->priv->_file;
	_tmp6_ = g_file_get_basename (_tmp5_);
	file_name = _tmp6_;
	_tmp7_ = file_name;
	last_index = string_last_index_of_char (_tmp7_, (gunichar) '.', 0);
	if (last_index != -1) {
		const gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp8_ = file_name;
		_tmp9_ = string_slice (_tmp8_, (glong) 0, (glong) last_index);
		_g_free0 (file_name);
		file_name = _tmp9_;
	}
	_tmp10_ = file_name;
	_tmp11_ = (GtkLabel*) gtk_label_new (_tmp10_);
	g_object_ref_sink (_tmp11_);
	label = _tmp11_;
	_tmp12_ = label;
	_tmp13_ = gtk_widget_get_style_context ((GtkWidget*) _tmp12_);
	gtk_style_context_add_class (_tmp13_, "h3");
	_tmp14_ = label;
	gtk_label_set_ellipsize (_tmp14_, PANGO_ELLIPSIZE_END);
	_tmp15_ = label;
	gtk_widget_set_halign ((GtkWidget*) _tmp15_, GTK_ALIGN_START);
	_tmp16_ = (GtkImage*) gtk_image_new_from_icon_name ("notebook-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp16_);
	icon = _tmp16_;
	_tmp17_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	g_object_ref_sink (_tmp17_);
	box = _tmp17_;
	_tmp18_ = box;
	g_object_set ((GtkWidget*) _tmp18_, "margin", 0, NULL);
	_tmp19_ = box;
	_tmp20_ = icon;
	gtk_container_add ((GtkContainer*) _tmp19_, (GtkWidget*) _tmp20_);
	_tmp21_ = box;
	_tmp22_ = label;
	gtk_container_add ((GtkContainer*) _tmp21_, (GtkWidget*) _tmp22_);
	_tmp23_ = box;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp23_);
	_g_object_unref0 (box);
	_g_object_unref0 (icon);
	_g_object_unref0 (label);
	_g_free0 (file_name);
	return obj;
}

static void
enotes_notebook_picker_notebook_element_class_init (ENotesNotebookPickerNotebookElementClass * klass,
                                                    gpointer klass_data)
{
	enotes_notebook_picker_notebook_element_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ENotesNotebookPickerNotebookElement_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_enotes_notebook_picker_notebook_element_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_enotes_notebook_picker_notebook_element_set_property;
	G_OBJECT_CLASS (klass)->constructor = enotes_notebook_picker_notebook_element_constructor;
	G_OBJECT_CLASS (klass)->finalize = enotes_notebook_picker_notebook_element_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_FILE_PROPERTY, enotes_notebook_picker_notebook_element_properties[ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_FILE_PROPERTY] = g_param_spec_object ("file", "file", "file", g_file_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_FILE_PATH_PROPERTY, enotes_notebook_picker_notebook_element_properties[ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_FILE_PATH_PROPERTY] = g_param_spec_string ("file-path", "file-path", "file-path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
enotes_notebook_picker_notebook_element_instance_init (ENotesNotebookPickerNotebookElement * self,
                                                       gpointer klass)
{
	self->priv = enotes_notebook_picker_notebook_element_get_instance_private (self);
}

static void
enotes_notebook_picker_notebook_element_finalize (GObject * obj)
{
	ENotesNotebookPickerNotebookElement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_NOTEBOOK_PICKER_TYPE_NOTEBOOK_ELEMENT, ENotesNotebookPickerNotebookElement);
	_g_object_unref0 (self->priv->_file);
	G_OBJECT_CLASS (enotes_notebook_picker_notebook_element_parent_class)->finalize (obj);
}

static GType
enotes_notebook_picker_notebook_element_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ENotesNotebookPickerNotebookElementClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) enotes_notebook_picker_notebook_element_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ENotesNotebookPickerNotebookElement), 0, (GInstanceInitFunc) enotes_notebook_picker_notebook_element_instance_init, NULL };
	GType enotes_notebook_picker_notebook_element_type_id;
	enotes_notebook_picker_notebook_element_type_id = g_type_register_static (gtk_list_box_row_get_type (), "ENotesNotebookPickerNotebookElement", &g_define_type_info, 0);
	ENotesNotebookPickerNotebookElement_private_offset = g_type_add_instance_private (enotes_notebook_picker_notebook_element_type_id, sizeof (ENotesNotebookPickerNotebookElementPrivate));
	return enotes_notebook_picker_notebook_element_type_id;
}

static GType
enotes_notebook_picker_notebook_element_get_type (void)
{
	static volatile gsize enotes_notebook_picker_notebook_element_type_id__once = 0;
	if (g_once_init_enter (&enotes_notebook_picker_notebook_element_type_id__once)) {
		GType enotes_notebook_picker_notebook_element_type_id;
		enotes_notebook_picker_notebook_element_type_id = enotes_notebook_picker_notebook_element_get_type_once ();
		g_once_init_leave (&enotes_notebook_picker_notebook_element_type_id__once, enotes_notebook_picker_notebook_element_type_id);
	}
	return enotes_notebook_picker_notebook_element_type_id__once;
}

static void
_vala_enotes_notebook_picker_notebook_element_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec)
{
	ENotesNotebookPickerNotebookElement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, ENOTES_NOTEBOOK_PICKER_TYPE_NOTEBOOK_ELEMENT, ENotesNotebookPickerNotebookElement);
	switch (property_id) {
		case ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_FILE_PROPERTY:
		g_value_set_object (value, enotes_notebook_picker_notebook_element_get_file (self));
		break;
		case ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_FILE_PATH_PROPERTY:
		g_value_take_string (value, enotes_notebook_picker_notebook_element_get_file_path (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_enotes_notebook_picker_notebook_element_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec)
{
	ENotesNotebookPickerNotebookElement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, ENOTES_NOTEBOOK_PICKER_TYPE_NOTEBOOK_ELEMENT, ENotesNotebookPickerNotebookElement);
	switch (property_id) {
		case ENOTES_NOTEBOOK_PICKER_NOTEBOOK_ELEMENT_FILE_PROPERTY:
		enotes_notebook_picker_notebook_element_set_file (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

static void
_enotes_notebook_picker___lambda127_ (ENotesNotebookPicker* self)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	ENotesServicesSettings* _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gint _tmp6_ = 0;
	gchar** _tmp7_;
	gint _tmp7__length1;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	_tmp2_ = enotes_application_state_get_db (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = enotes_settings;
	_tmp5_ = enotes_services_settings_get_recent_files (_tmp4_, &_tmp6_);
	_tmp5__length1 = _tmp6_;
	_tmp7_ = _tmp5_;
	_tmp7__length1 = _tmp5__length1;
	if (_vala_string_array_contains (_tmp7_, _tmp7__length1, _tmp3_)) {
		GtkListBox* _tmp8_;
		GList* _tmp9_;
		_tmp8_ = self->priv->notebook_list;
		_tmp9_ = gtk_list_box_get_selected_rows (_tmp8_);
		{
			GList* element_collection = NULL;
			GList* element_it = NULL;
			element_collection = _tmp9_;
			for (element_it = element_collection; element_it != NULL; element_it = element_it->next) {
				GtkListBoxRow* element = NULL;
				element = (GtkListBoxRow*) element_it->data;
				{
					ENotesNotebookPickerNotebookElement* notebook_element = NULL;
					GtkListBoxRow* _tmp10_;
					ENotesNotebookPickerNotebookElement* _tmp11_;
					gboolean _tmp12_ = FALSE;
					ENotesNotebookPickerNotebookElement* _tmp13_;
					_tmp10_ = element;
					_tmp11_ = _g_object_ref0 (ENOTES_NOTEBOOK_PICKER_IS_NOTEBOOK_ELEMENT (_tmp10_) ? ((ENotesNotebookPickerNotebookElement*) _tmp10_) : NULL);
					notebook_element = _tmp11_;
					_tmp13_ = notebook_element;
					if (_tmp13_ != NULL) {
						ENotesNotebookPickerNotebookElement* _tmp14_;
						gchar* _tmp15_;
						gchar* _tmp16_;
						gchar* _tmp17_;
						ENotesApplication* _tmp18_;
						ENotesApplicationState* _tmp19_;
						const gchar* _tmp20_;
						const gchar* _tmp21_;
						_tmp14_ = notebook_element;
						_tmp15_ = enotes_notebook_picker_notebook_element_get_file_path (_tmp14_);
						_tmp16_ = _tmp15_;
						_tmp17_ = _tmp16_;
						_tmp18_ = enotes_app;
						_tmp19_ = _tmp18_->state;
						_tmp20_ = enotes_application_state_get_db (_tmp19_);
						_tmp21_ = _tmp20_;
						_tmp12_ = g_strcmp0 (_tmp17_, _tmp21_) == 0;
						_g_free0 (_tmp17_);
					} else {
						_tmp12_ = FALSE;
					}
					if (_tmp12_) {
						GtkListBox* _tmp22_;
						ENotesNotebookPickerNotebookElement* _tmp23_;
						_tmp22_ = self->priv->notebook_list;
						_tmp23_ = notebook_element;
						gtk_list_box_select_row (_tmp22_, (GtkListBoxRow*) _tmp23_);
					}
					_g_object_unref0 (notebook_element);
				}
			}
			(element_collection == NULL) ? NULL : (element_collection = (g_list_free (element_collection), NULL));
		}
	} else {
		ENotesNotebookPickerNotebookElement* element = NULL;
		ENotesApplication* _tmp24_;
		ENotesApplicationState* _tmp25_;
		const gchar* _tmp26_;
		const gchar* _tmp27_;
		ENotesNotebookPickerNotebookElement* _tmp28_;
		GtkListBox* _tmp29_;
		ENotesNotebookPickerNotebookElement* _tmp30_;
		GtkListBox* _tmp31_;
		GtkListBox* _tmp32_;
		ENotesNotebookPickerNotebookElement* _tmp33_;
		_tmp24_ = enotes_app;
		_tmp25_ = _tmp24_->state;
		_tmp26_ = enotes_application_state_get_db (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = enotes_notebook_picker_notebook_element_new (_tmp27_);
		g_object_ref_sink (_tmp28_);
		element = _tmp28_;
		_tmp29_ = self->priv->notebook_list;
		_tmp30_ = element;
		gtk_container_add ((GtkContainer*) _tmp29_, (GtkWidget*) _tmp30_);
		_tmp31_ = self->priv->notebook_list;
		gtk_widget_show_all ((GtkWidget*) _tmp31_);
		_tmp32_ = self->priv->notebook_list;
		_tmp33_ = element;
		gtk_list_box_select_row (_tmp32_, (GtkListBoxRow*) _tmp33_);
		_g_object_unref0 (element);
	}
}

static void
__enotes_notebook_picker___lambda127__g_object_notify (GObject* _sender,
                                                       GParamSpec* pspec,
                                                       gpointer self)
{
	_enotes_notebook_picker___lambda127_ ((ENotesNotebookPicker*) self);
}

static void
_enotes_notebook_picker___lambda128_ (ENotesNotebookPicker* self,
                                      GtkListBoxRow* row)
{
	ENotesNotebookPickerNotebookElement* element = NULL;
	ENotesNotebookPickerNotebookElement* _tmp0_;
	ENotesNotebookPickerNotebookElement* _tmp1_;
	g_return_if_fail (row != NULL);
	_tmp0_ = _g_object_ref0 (ENOTES_NOTEBOOK_PICKER_IS_NOTEBOOK_ELEMENT (row) ? ((ENotesNotebookPickerNotebookElement*) row) : NULL);
	element = _tmp0_;
	_tmp1_ = element;
	if (_tmp1_ != NULL) {
		ENotesApplication* _tmp2_;
		ENotesApplicationState* _tmp3_;
		ENotesNotebookPickerNotebookElement* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp2_ = enotes_app;
		_tmp3_ = _tmp2_->state;
		_tmp4_ = element;
		_tmp5_ = enotes_notebook_picker_notebook_element_get_file_path (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_;
		enotes_application_state_set_database (_tmp3_, _tmp7_);
		_g_free0 (_tmp7_);
	}
	_g_object_unref0 (element);
}

static void
__enotes_notebook_picker___lambda128__gtk_list_box_row_activated (GtkListBox* _sender,
                                                                  GtkListBoxRow* row,
                                                                  gpointer self)
{
	_enotes_notebook_picker___lambda128_ ((ENotesNotebookPicker*) self, row);
}

static void
_enotes_notebook_picker___lambda129_ (ENotesNotebookPicker* self)
{
	GFile* file = NULL;
	GFile* _tmp0_;
	gchar* basename = NULL;
	GFile* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_ = FALSE;
	const gchar* _tmp7_;
	GFile* _tmp15_;
	_tmp0_ = enotes_file_manager_get_file_from_user ("ndb", NULL);
	file = _tmp0_;
	_tmp1_ = file;
	_tmp2_ = g_file_get_basename (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_utf8_strdown (_tmp3_, (gssize) -1);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	basename = _tmp5_;
	_tmp7_ = basename;
	if (g_str_has_suffix (_tmp7_, ".ndb")) {
		_tmp6_ = TRUE;
	} else {
		const gchar* _tmp8_;
		_tmp8_ = basename;
		_tmp6_ = g_str_has_suffix (_tmp8_, ".db");
	}
	if (!_tmp6_) {
		GFile* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		GFile* _tmp14_;
		_tmp9_ = file;
		_tmp10_ = g_file_get_path (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = g_strconcat (_tmp11_, ".ndb", NULL);
		_tmp13_ = _tmp12_;
		_tmp14_ = g_file_new_for_path (_tmp13_);
		_g_object_unref0 (file);
		file = _tmp14_;
		_g_free0 (_tmp13_);
		_g_free0 (_tmp11_);
	}
	_tmp15_ = file;
	if (_tmp15_ != NULL) {
		ENotesApplication* _tmp16_;
		ENotesApplicationState* _tmp17_;
		GFile* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		_tmp16_ = enotes_app;
		_tmp17_ = _tmp16_->state;
		_tmp18_ = file;
		_tmp19_ = g_file_get_path (_tmp18_);
		_tmp20_ = _tmp19_;
		enotes_application_state_set_database (_tmp17_, _tmp20_);
		_g_free0 (_tmp20_);
	}
	_g_free0 (basename);
	_g_object_unref0 (file);
}

static void
__enotes_notebook_picker___lambda129__gtk_button_clicked (GtkButton* _sender,
                                                          gpointer self)
{
	_enotes_notebook_picker___lambda129_ ((ENotesNotebookPicker*) self);
}

static GObject *
enotes_notebook_picker_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ENotesNotebookPicker * self;
	GtkStyleContext* _tmp0_;
	GtkStyleContext* _tmp1_;
	GtkStyleContext* _tmp2_;
	GtkListBox* _tmp3_;
	GtkListBox* _tmp4_;
	GtkListBox* _tmp5_;
	GtkListBox* _tmp6_;
	GtkListBox* _tmp7_;
	GtkStyleContext* _tmp8_;
	GtkListBox* _tmp9_;
	GtkStyleContext* _tmp10_;
	GtkListBox* _tmp11_;
	GtkStyleContext* _tmp12_;
	GtkButton* more_button = NULL;
	GtkButton* _tmp13_;
	GtkButton* _tmp14_;
	GtkButton* _tmp15_;
	GtkStyleContext* _tmp16_;
	GtkButton* _tmp17_;
	GtkStyleContext* _tmp18_;
	GtkLabel* more_button_label = NULL;
	GtkLabel* _tmp19_;
	GtkLabel* _tmp20_;
	GtkLabel* _tmp21_;
	GtkButton* _tmp22_;
	GtkLabel* _tmp23_;
	GtkListBox* _tmp24_;
	GtkButton* _tmp25_;
	ENotesApplication* _tmp26_;
	ENotesApplicationState* _tmp27_;
	GtkListBox* _tmp28_;
	GtkButton* _tmp29_;
	parent_class = G_OBJECT_CLASS (enotes_notebook_picker_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_NOTEBOOK_PICKER, ENotesNotebookPicker);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	_tmp0_ = gtk_widget_get_style_context ((GtkWidget*) self);
	gtk_style_context_add_class (_tmp0_, "view");
	_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
	gtk_style_context_add_class (_tmp1_, "source-list");
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) self);
	gtk_style_context_add_class (_tmp2_, "notebook-list");
	_tmp3_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->notebook_list);
	self->priv->notebook_list = _tmp3_;
	_tmp4_ = self->priv->notebook_list;
	gtk_list_box_set_selection_mode (_tmp4_, GTK_SELECTION_BROWSE);
	_tmp5_ = self->priv->notebook_list;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp5_, TRUE);
	_tmp6_ = self->priv->notebook_list;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp6_, FALSE);
	_tmp7_ = self->priv->notebook_list;
	_tmp8_ = gtk_widget_get_style_context ((GtkWidget*) _tmp7_);
	gtk_style_context_add_class (_tmp8_, "view");
	_tmp9_ = self->priv->notebook_list;
	_tmp10_ = gtk_widget_get_style_context ((GtkWidget*) _tmp9_);
	gtk_style_context_add_class (_tmp10_, "source-list");
	_tmp11_ = self->priv->notebook_list;
	_tmp12_ = gtk_widget_get_style_context ((GtkWidget*) _tmp11_);
	gtk_style_context_add_class (_tmp12_, "notebook-list");
	_tmp13_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp13_);
	more_button = _tmp13_;
	_tmp14_ = more_button;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp14_, TRUE);
	_tmp15_ = more_button;
	_tmp16_ = gtk_widget_get_style_context ((GtkWidget*) _tmp15_);
	gtk_style_context_add_class (_tmp16_, "flat");
	_tmp17_ = more_button;
	_tmp18_ = gtk_widget_get_style_context ((GtkWidget*) _tmp17_);
	gtk_style_context_add_class (_tmp18_, "h4");
	_tmp19_ = (GtkLabel*) gtk_label_new (_ ("More Notebooks…"));
	g_object_ref_sink (_tmp19_);
	more_button_label = _tmp19_;
	_tmp20_ = more_button_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp20_, GTK_ALIGN_START);
	_tmp21_ = more_button_label;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp21_, 18);
	_tmp22_ = more_button;
	_tmp23_ = more_button_label;
	gtk_container_add ((GtkContainer*) _tmp22_, (GtkWidget*) _tmp23_);
	_tmp24_ = self->priv->notebook_list;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp24_);
	_tmp25_ = more_button;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp25_);
	enotes_notebook_picker_reload (self);
	_tmp26_ = enotes_app;
	_tmp27_ = _tmp26_->state;
	g_signal_connect_object ((GObject*) _tmp27_, "notify::db", (GCallback) __enotes_notebook_picker___lambda127__g_object_notify, self, 0);
	_tmp28_ = self->priv->notebook_list;
	g_signal_connect_object (_tmp28_, "row-activated", (GCallback) __enotes_notebook_picker___lambda128__gtk_list_box_row_activated, self, 0);
	_tmp29_ = more_button;
	g_signal_connect_object (_tmp29_, "clicked", (GCallback) __enotes_notebook_picker___lambda129__gtk_button_clicked, self, 0);
	_g_object_unref0 (more_button_label);
	_g_object_unref0 (more_button);
	return obj;
}

static void
enotes_notebook_picker_class_init (ENotesNotebookPickerClass * klass,
                                   gpointer klass_data)
{
	enotes_notebook_picker_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ENotesNotebookPicker_private_offset);
	G_OBJECT_CLASS (klass)->constructor = enotes_notebook_picker_constructor;
	G_OBJECT_CLASS (klass)->finalize = enotes_notebook_picker_finalize;
}

static void
enotes_notebook_picker_instance_init (ENotesNotebookPicker * self,
                                      gpointer klass)
{
	self->priv = enotes_notebook_picker_get_instance_private (self);
}

static void
enotes_notebook_picker_finalize (GObject * obj)
{
	ENotesNotebookPicker * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_NOTEBOOK_PICKER, ENotesNotebookPicker);
	_g_object_unref0 (self->priv->notebook_list);
	G_OBJECT_CLASS (enotes_notebook_picker_parent_class)->finalize (obj);
}

static GType
enotes_notebook_picker_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ENotesNotebookPickerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) enotes_notebook_picker_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ENotesNotebookPicker), 0, (GInstanceInitFunc) enotes_notebook_picker_instance_init, NULL };
	GType enotes_notebook_picker_type_id;
	enotes_notebook_picker_type_id = g_type_register_static (gtk_grid_get_type (), "ENotesNotebookPicker", &g_define_type_info, 0);
	ENotesNotebookPicker_private_offset = g_type_add_instance_private (enotes_notebook_picker_type_id, sizeof (ENotesNotebookPickerPrivate));
	return enotes_notebook_picker_type_id;
}

GType
enotes_notebook_picker_get_type (void)
{
	static volatile gsize enotes_notebook_picker_type_id__once = 0;
	if (g_once_init_enter (&enotes_notebook_picker_type_id__once)) {
		GType enotes_notebook_picker_type_id;
		enotes_notebook_picker_type_id = enotes_notebook_picker_get_type_once ();
		g_once_init_leave (&enotes_notebook_picker_type_id__once, enotes_notebook_picker_type_id);
	}
	return enotes_notebook_picker_type_id__once;
}

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;
}

