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

/*
* Copyright (c) 2019 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 <stdlib.h>
#include <string.h>
#include <granite.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>
#include <pango/pango.h>
#include <gio/gio.h>

#define ENOTES_FEATURE_FLAGS_SHOW_NOTEBOOK_PANE FALSE
#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_BUTTON_ENTRY (enotes_button_entry_get_type ())
#define ENOTES_BUTTON_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_BUTTON_ENTRY, ENotesButtonEntry))
#define ENOTES_BUTTON_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_BUTTON_ENTRY, ENotesButtonEntryClass))
#define ENOTES_IS_BUTTON_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_BUTTON_ENTRY))
#define ENOTES_IS_BUTTON_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_BUTTON_ENTRY))
#define ENOTES_BUTTON_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_BUTTON_ENTRY, ENotesButtonEntryClass))

typedef struct _ENotesButtonEntry ENotesButtonEntry;
typedef struct _ENotesButtonEntryClass ENotesButtonEntryClass;
typedef struct _ENotesButtonEntryPrivate ENotesButtonEntryPrivate;
enum  {
	ENOTES_BUTTON_ENTRY_0_PROPERTY,
	ENOTES_BUTTON_ENTRY_ENTRY_PROPERTY,
	ENOTES_BUTTON_ENTRY_TEXT_PROPERTY,
	ENOTES_BUTTON_ENTRY_NUM_PROPERTIES
};
static GParamSpec* enotes_button_entry_properties[ENOTES_BUTTON_ENTRY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#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;
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	ENOTES_BUTTON_ENTRY_CHANGED_SIGNAL,
	ENOTES_BUTTON_ENTRY_ACTIVATED_SIGNAL,
	ENOTES_BUTTON_ENTRY_NUM_SIGNALS
};
static guint enotes_button_entry_signals[ENOTES_BUTTON_ENTRY_NUM_SIGNALS] = {0};

#define ENOTES_TYPE_HEADERBAR (enotes_headerbar_get_type ())
#define ENOTES_HEADERBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_HEADERBAR, ENotesHeaderbar))
#define ENOTES_HEADERBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_HEADERBAR, ENotesHeaderbarClass))
#define ENOTES_IS_HEADERBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_HEADERBAR))
#define ENOTES_IS_HEADERBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_HEADERBAR))
#define ENOTES_HEADERBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_HEADERBAR, ENotesHeaderbarClass))

typedef struct _ENotesHeaderbar ENotesHeaderbar;
typedef struct _ENotesHeaderbarClass ENotesHeaderbarClass;
typedef struct _ENotesHeaderbarPrivate ENotesHeaderbarPrivate;

#define ENOTES_TYPE_BOOKMARK_BUTTON (enotes_bookmark_button_get_type ())
#define ENOTES_BOOKMARK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_BOOKMARK_BUTTON, ENotesBookmarkButton))
#define ENOTES_BOOKMARK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_BOOKMARK_BUTTON, ENotesBookmarkButtonClass))
#define ENOTES_IS_BOOKMARK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_BOOKMARK_BUTTON))
#define ENOTES_IS_BOOKMARK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_BOOKMARK_BUTTON))
#define ENOTES_BOOKMARK_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_BOOKMARK_BUTTON, ENotesBookmarkButtonClass))

typedef struct _ENotesBookmarkButton ENotesBookmarkButton;
typedef struct _ENotesBookmarkButtonClass ENotesBookmarkButtonClass;
enum  {
	ENOTES_HEADERBAR_0_PROPERTY,
	ENOTES_HEADERBAR_NUM_PROPERTIES
};
static GParamSpec* enotes_headerbar_properties[ENOTES_HEADERBAR_NUM_PROPERTIES];

#define ENOTES_TYPE_PAGE_INFO_EDITOR (enotes_page_info_editor_get_type ())
#define ENOTES_PAGE_INFO_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_PAGE_INFO_EDITOR, ENotesPageInfoEditor))
#define ENOTES_PAGE_INFO_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_PAGE_INFO_EDITOR, ENotesPageInfoEditorClass))
#define ENOTES_IS_PAGE_INFO_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_PAGE_INFO_EDITOR))
#define ENOTES_IS_PAGE_INFO_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_PAGE_INFO_EDITOR))
#define ENOTES_PAGE_INFO_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_PAGE_INFO_EDITOR, ENotesPageInfoEditorClass))

typedef struct _ENotesPageInfoEditor ENotesPageInfoEditor;
typedef struct _ENotesPageInfoEditorClass ENotesPageInfoEditorClass;

#define TYPE_DATABASE_TABLE (database_table_get_type ())
#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable))
#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass))
#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE))
#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE))
#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass))

typedef struct _DatabaseTable DatabaseTable;
typedef struct _DatabaseTableClass DatabaseTableClass;

#define ENOTES_TYPE_FILE_DATA_TABLE (enotes_file_data_table_get_type ())
#define ENOTES_FILE_DATA_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_FILE_DATA_TABLE, ENotesFileDataTable))
#define ENOTES_FILE_DATA_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_FILE_DATA_TABLE, ENotesFileDataTableClass))
#define ENOTES_IS_FILE_DATA_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_FILE_DATA_TABLE))
#define ENOTES_IS_FILE_DATA_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_FILE_DATA_TABLE))
#define ENOTES_FILE_DATA_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_FILE_DATA_TABLE, ENotesFileDataTableClass))

typedef struct _ENotesFileDataTable ENotesFileDataTable;
typedef struct _ENotesFileDataTableClass ENotesFileDataTableClass;
typedef enum  {
	FILE_DATA_TYPE_FILE_NAME = 0,
	FILE_DATA_TYPE_LAST_NOTEBOOK = 10,
	FILE_DATA_TYPE_LAST_PAGE = 11,
	FILE_DATA_TYPE_STYLESHEET = 21,
	FILE_DATA_TYPE_CUSTOM_CSS = 22
} FileDataType;

#define TYPE_FILE_DATA_TYPE (file_data_type_get_type ())
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;
typedef struct _Block4Data Block4Data;

#define ENOTES_TYPE_NOTEBOOK_DIALOG (enotes_notebook_dialog_get_type ())
#define ENOTES_NOTEBOOK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_NOTEBOOK_DIALOG, ENotesNotebookDialog))
#define ENOTES_NOTEBOOK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_NOTEBOOK_DIALOG, ENotesNotebookDialogClass))
#define ENOTES_IS_NOTEBOOK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_NOTEBOOK_DIALOG))
#define ENOTES_IS_NOTEBOOK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_NOTEBOOK_DIALOG))
#define ENOTES_NOTEBOOK_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_NOTEBOOK_DIALOG, ENotesNotebookDialogClass))

typedef struct _ENotesNotebookDialog ENotesNotebookDialog;
typedef struct _ENotesNotebookDialogClass ENotesNotebookDialogClass;

#define ENOTES_TYPE_NOTEBOOK (enotes_notebook_get_type ())
#define ENOTES_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_NOTEBOOK, ENotesNotebook))
#define ENOTES_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_NOTEBOOK, ENotesNotebookClass))
#define ENOTES_IS_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_NOTEBOOK))
#define ENOTES_IS_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_NOTEBOOK))
#define ENOTES_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_NOTEBOOK, ENotesNotebookClass))

typedef struct _ENotesNotebook ENotesNotebook;
typedef struct _ENotesNotebookClass ENotesNotebookClass;

#define ENOTES_TYPE_PREFERENCES_DIALOG (enotes_preferences_dialog_get_type ())
#define ENOTES_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_PREFERENCES_DIALOG, ENotesPreferencesDialog))
#define ENOTES_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_PREFERENCES_DIALOG, ENotesPreferencesDialogClass))
#define ENOTES_IS_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_PREFERENCES_DIALOG))
#define ENOTES_IS_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_PREFERENCES_DIALOG))
#define ENOTES_PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_PREFERENCES_DIALOG, ENotesPreferencesDialogClass))

typedef struct _ENotesPreferencesDialog ENotesPreferencesDialog;
typedef struct _ENotesPreferencesDialogClass ENotesPreferencesDialogClass;
typedef enum  {
	ENOTES_MODE_NONE = -1,
	ENOTES_MODE_VIEW = 0,
	ENOTES_MODE_EDIT = 1,
	ENOTES_MODE_BOTH = 2
} ENotesMode;

#define ENOTES_TYPE_MODE (enotes_mode_get_type ())
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

#define ENOTES_TYPE_PAGE (enotes_page_get_type ())
#define ENOTES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_PAGE, ENotesPage))
#define ENOTES_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_PAGE, ENotesPageClass))
#define ENOTES_IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_PAGE))
#define ENOTES_IS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_PAGE))
#define ENOTES_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_PAGE, ENotesPageClass))

typedef struct _ENotesPage ENotesPage;
typedef struct _ENotesPageClass ENotesPageClass;
typedef struct _ENotesPagePrivate ENotesPagePrivate;
typedef struct _ENotesNotebookPrivate ENotesNotebookPrivate;

struct _ENotesButtonEntry {
	GtkGrid parent_instance;
	ENotesButtonEntryPrivate * priv;
};

struct _ENotesButtonEntryClass {
	GtkGridClass parent_class;
};

struct _ENotesButtonEntryPrivate {
	GtkEntry* _entry;
	GtkRevealer* entry_revealer;
	GtkRevealer* button_revealer;
	GtkButton* button;
	gboolean hide_if_contains_text;
	gboolean always_shown_when_revealed;
	gboolean setting;
	GtkLabel* label;
};

struct _ENotesHeaderbar {
	GtkHeaderBar parent_instance;
	ENotesHeaderbarPrivate * priv;
	ENotesBookmarkButton* bookmark_button;
	GtkGestureSwipe* gesture;
};

struct _ENotesHeaderbarClass {
	GtkHeaderBarClass parent_class;
};

struct _ENotesHeaderbarPrivate {
	GraniteWidgetsModeButton* mode_button;
	GtkMenuButton* app_menu;
	GtkMenuButton* panel_picker_menu;
	ENotesButtonEntry* search_entry;
};

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

struct _ENotesApplicationClass {
	GraniteApplicationClass parent_class;
};

struct _Block4Data {
	int _ref_count_;
	ENotesHeaderbar* self;
	GtkRadioButton* color_button_white;
	GtkRadioButton* color_button_light;
	GtkRadioButton* color_button_dark;
};

struct _ENotesPage {
	GObject parent_instance;
	ENotesPagePrivate * priv;
	gint64 id;
	gint64 notebook_id;
	gchar* name;
	gchar* data;
	gchar* subtitle;
	gchar* html_cache;
	gint64 creation_date;
	gint64 modification_date;
	gboolean new_page;
	gboolean cache_changed;
	gchar* full_path;
};

struct _ENotesPageClass {
	GObjectClass parent_class;
};

struct _ENotesNotebook {
	GObject parent_instance;
	ENotesNotebookPrivate * priv;
	gint64 id;
	gint64* parent_id;
	GdkRGBA rgb;
	gchar* name;
	gchar* css;
	gchar* stylesheet;
};

struct _ENotesNotebookClass {
	GObjectClass parent_class;
};

static gint ENotesButtonEntry_private_offset;
static gpointer enotes_button_entry_parent_class = NULL;
VALA_EXTERN ENotesApplication* enotes_app;
static gint ENotesHeaderbar_private_offset;
static gpointer enotes_headerbar_parent_class = NULL;

VALA_EXTERN GType enotes_button_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesButtonEntry, g_object_unref)
VALA_EXTERN ENotesButtonEntry* enotes_button_entry_new_search_entry (void);
VALA_EXTERN ENotesButtonEntry* enotes_button_entry_construct_search_entry (GType object_type);
VALA_EXTERN GtkEntry* enotes_button_entry_get_entry (ENotesButtonEntry* self);
static void __lambda83_ (ENotesButtonEntry* self);
static void ___lambda83__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                                   gpointer self);
VALA_EXTERN GType enotes_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesApplication, g_object_unref)
VALA_EXTERN void enotes_button_entry_show_entry (ENotesButtonEntry* self);
static void _enotes_button_entry_show_entry_gtk_button_clicked (GtkButton* _sender,
                                                         gpointer self);
static void __lambda84_ (ENotesButtonEntry* self,
                  GtkEntryIconPosition p0,
                  GdkEvent* p1);
VALA_EXTERN void enotes_button_entry_hide_entry (ENotesButtonEntry* self);
static void ___lambda84__gtk_entry_icon_release (GtkEntry* _sender,
                                          GtkEntryIconPosition icon_pos,
                                          GdkEvent* event,
                                          gpointer self);
VALA_EXTERN ENotesButtonEntry* enotes_button_entry_new_for_tags (const gchar* tag_text);
VALA_EXTERN ENotesButtonEntry* enotes_button_entry_construct_for_tags (GType object_type,
                                                           const gchar* tag_text);
VALA_EXTERN ENotesButtonEntry* enotes_button_entry_new_for_page_title (void);
VALA_EXTERN ENotesButtonEntry* enotes_button_entry_construct_for_page_title (GType object_type);
VALA_EXTERN ENotesButtonEntry* enotes_button_entry_new (void);
VALA_EXTERN ENotesButtonEntry* enotes_button_entry_construct (GType object_type);
static void enotes_button_entry_set_entry (ENotesButtonEntry* self,
                                    GtkEntry* value);
VALA_EXTERN const gchar* enotes_button_entry_get_text (ENotesButtonEntry* self);
VALA_EXTERN void enotes_button_entry_set_text (ENotesButtonEntry* self,
                                   const gchar* value);
static GObject * enotes_button_entry_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties);
static void _enotes_button_entry___lambda85_ (ENotesButtonEntry* self);
static void __enotes_button_entry___lambda85__gtk_entry_activate (GtkEntry* _sender,
                                                           gpointer self);
static gboolean _enotes_button_entry___lambda86_ (ENotesButtonEntry* self);
static gboolean __enotes_button_entry___lambda86__gtk_widget_focus_out_event (GtkWidget* _sender,
                                                                       GdkEventFocus* event,
                                                                       gpointer self);
static void enotes_button_entry_finalize (GObject * obj);
static GType enotes_button_entry_get_type_once (void);
static void _vala_enotes_button_entry_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_enotes_button_entry_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
VALA_EXTERN GType enotes_headerbar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesHeaderbar, g_object_unref)
VALA_EXTERN GType enotes_bookmark_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesBookmarkButton, g_object_unref)
VALA_EXTERN GType enotes_page_info_editor_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesPageInfoEditor, g_object_unref)
VALA_EXTERN ENotesHeaderbar* enotes_headerbar_new (ENotesPageInfoEditor* page_info);
VALA_EXTERN ENotesHeaderbar* enotes_headerbar_construct (GType object_type,
                                             ENotesPageInfoEditor* page_info);
static void enotes_headerbar_create_menu (ENotesHeaderbar* self);
static void enotes_headerbar_make_panel_picker_menu (ENotesHeaderbar* self);
VALA_EXTERN gpointer database_table_ref (gpointer instance);
VALA_EXTERN void database_table_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_database_table (const gchar* name,
                                       const gchar* nick,
                                       const gchar* blurb,
                                       GType object_type,
                                       GParamFlags flags);
VALA_EXTERN void value_set_database_table (GValue* value,
                               gpointer v_object);
VALA_EXTERN void value_take_database_table (GValue* value,
                                gpointer v_object);
VALA_EXTERN gpointer value_get_database_table (const GValue* value);
VALA_EXTERN GType database_table_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DatabaseTable, database_table_unref)
VALA_EXTERN GType enotes_file_data_table_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesFileDataTable, database_table_unref)
VALA_EXTERN ENotesFileDataTable* enotes_file_data_table_get_instance (void);
VALA_EXTERN GType file_data_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gchar* enotes_file_data_table_get_value (ENotesFileDataTable* self,
                                         FileDataType type);
VALA_EXTERN ENotesBookmarkButton* enotes_bookmark_button_new (void);
VALA_EXTERN ENotesBookmarkButton* enotes_bookmark_button_construct (GType object_type);
static void enotes_headerbar_set_title_from_data (ENotesHeaderbar* self,
                                           const gchar* page_title,
                                           const gchar* notebook_title);
VALA_EXTERN GtkToggleButton* enotes_page_info_editor_get_toggle_button (ENotesPageInfoEditor* self);
static void enotes_headerbar_connect_signals (ENotesHeaderbar* self);
static GtkModelButton* enotes_headerbar_model_button_entry (ENotesHeaderbar* self,
                                                     const gchar* text,
                                                     const gchar* icon_name);
static void ___lambda116_ (ENotesHeaderbar* self);
VALA_EXTERN GType enotes_application_state_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesApplicationState, g_object_unref)
VALA_EXTERN void enotes_application_state_set_panes_visible (ENotesApplicationState* self,
                                                 gint value);
static void ____lambda116__gtk_button_clicked (GtkButton* _sender,
                                        gpointer self);
static void __lambda117_ (ENotesHeaderbar* self);
static void ___lambda117__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda118_ (ENotesHeaderbar* self);
static void ___lambda118__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda119_ (ENotesHeaderbar* self);
static void ___lambda119__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda120_ (ENotesHeaderbar* self);
VALA_EXTERN gint enotes_application_state_get_panes_visible (ENotesApplicationState* self);
static void ___lambda120__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static void __lambda101_ (Block4Data* _data4_);
VALA_EXTERN const gchar* enotes_application_state_get_style_scheme (ENotesApplicationState* self);
static void ___lambda101__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda102_ (ENotesHeaderbar* self,
                   FileDataType type,
                   const gchar* value);
static void ___lambda102__enotes_application_state_file_data_changed (ENotesApplicationState* _sender,
                                                               FileDataType type,
                                                               const gchar* value,
                                                               gpointer self);
static void __lambda103_ (ENotesHeaderbar* self);
VALA_EXTERN void enotes_application_state_set_style (ENotesApplicationState* self,
                                         const gchar* style);
static void ___lambda103__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda104_ (ENotesHeaderbar* self);
static void ___lambda104__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda105_ (ENotesHeaderbar* self);
static void ___lambda105__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda106_ (ENotesHeaderbar* self);
VALA_EXTERN GFile* enotes_file_manager_export_pdf_action (const gchar* file_path);
static void ___lambda106__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda107_ (ENotesHeaderbar* self);
VALA_EXTERN GFile* enotes_file_manager_export_markdown_action (const gchar* file_path);
static void ___lambda107__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda108_ (ENotesHeaderbar* self);
VALA_EXTERN GType enotes_notebook_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesNotebookDialog, g_object_unref)
VALA_EXTERN GType enotes_notebook_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesNotebook, g_object_unref)
VALA_EXTERN ENotesNotebookDialog* enotes_notebook_dialog_new (ENotesNotebook* notebook);
VALA_EXTERN ENotesNotebookDialog* enotes_notebook_dialog_construct (GType object_type,
                                                        ENotesNotebook* notebook);
static void ___lambda108__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void __lambda109_ (ENotesHeaderbar* self);
VALA_EXTERN GType enotes_preferences_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesPreferencesDialog, g_object_unref)
VALA_EXTERN ENotesPreferencesDialog* enotes_preferences_dialog_new (void);
VALA_EXTERN ENotesPreferencesDialog* enotes_preferences_dialog_construct (GType object_type);
static void ___lambda109__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
VALA_EXTERN GType enotes_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void enotes_headerbar_set_mode (ENotesHeaderbar* self,
                                ENotesMode mode);
VALA_EXTERN void enotes_application_state_set_mode (ENotesApplicationState* self,
                                        ENotesMode value);
static void __lambda121_ (ENotesHeaderbar* self,
                   GtkWidget* widget);
static void ___lambda121__granite_widgets_mode_button_mode_changed (GraniteWidgetsModeButton* _sender,
                                                             GtkWidget* widget,
                                                             gpointer self);
static void __lambda122_ (ENotesHeaderbar* self);
static void ___lambda122__enotes_button_entry_activated (ENotesButtonEntry* _sender,
                                                  gpointer self);
static void __lambda123_ (ENotesHeaderbar* self,
                   const gchar* text);
VALA_EXTERN void enotes_application_state_set_search_field (ENotesApplicationState* self,
                                                const gchar* value);
static void ___lambda123__enotes_button_entry_changed (ENotesButtonEntry* _sender,
                                                const gchar* text,
                                                gpointer self);
static void __lambda124_ (ENotesHeaderbar* self);
VALA_EXTERN ENotesMode enotes_application_state_get_mode (ENotesApplicationState* self);
static void ___lambda124__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void __lambda125_ (ENotesHeaderbar* self);
VALA_EXTERN ENotesNotebook* enotes_application_state_get_opened_page_notebook (ENotesApplicationState* self);
VALA_EXTERN GType enotes_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesPage, g_object_unref)
VALA_EXTERN ENotesPage* enotes_application_state_get_opened_page (ENotesApplicationState* self);
static void ___lambda125__enotes_application_state_update_page_title (ENotesApplicationState* _sender,
                                                               gpointer self);
static void __lambda126_ (ENotesHeaderbar* self);
static void ___lambda126__enotes_application_state_page_deleted (ENotesApplicationState* _sender,
                                                          gpointer self);
VALA_EXTERN void enotes_headerbar_show_search (ENotesHeaderbar* self);
static void enotes_headerbar_finalize (GObject * obj);
static GType enotes_headerbar_get_type_once (void);
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 _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
enotes_button_entry_get_instance_private (ENotesButtonEntry* self)
{
	return G_STRUCT_MEMBER_P (self, ENotesButtonEntry_private_offset);
}

static void
__lambda83_ (ENotesButtonEntry* self)
{
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	_tmp0_ = self->priv->_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	g_signal_emit (self, enotes_button_entry_signals[ENOTES_BUTTON_ENTRY_CHANGED_SIGNAL], 0, _tmp1_);
}

static void
___lambda83__gtk_search_entry_search_changed (GtkSearchEntry* _sender,
                                              gpointer self)
{
	__lambda83_ ((ENotesButtonEntry*) self);
}

static void
_enotes_button_entry_show_entry_gtk_button_clicked (GtkButton* _sender,
                                                    gpointer self)
{
	enotes_button_entry_show_entry ((ENotesButtonEntry*) self);
}

static void
__lambda84_ (ENotesButtonEntry* self,
             GtkEntryIconPosition p0,
             GdkEvent* p1)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (p1 != NULL);
	g_object_get ((GtkWidget*) self, "has-focus", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		enotes_button_entry_hide_entry (self);
	}
}

static void
___lambda84__gtk_entry_icon_release (GtkEntry* _sender,
                                     GtkEntryIconPosition icon_pos,
                                     GdkEvent* event,
                                     gpointer self)
{
	__lambda84_ ((ENotesButtonEntry*) self, icon_pos, event);
}

ENotesButtonEntry*
enotes_button_entry_construct_search_entry (GType object_type)
{
	ENotesButtonEntry * self = NULL;
	GtkSearchEntry* _tmp0_;
	GtkSearchEntry* _tmp1_;
	GtkEntry* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	ENotesApplication* _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GtkRevealer* _tmp11_;
	GtkButton* _tmp12_;
	GtkButton* _tmp13_;
	GtkRevealer* _tmp14_;
	GtkRevealer* _tmp15_;
	GtkRevealer* _tmp16_;
	GtkRevealer* _tmp17_;
	GtkEntry* _tmp18_;
	_tmp0_ = (GtkSearchEntry*) gtk_search_entry_new ();
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	self = (ENotesButtonEntry*) g_object_new (object_type, "entry", _tmp1_, NULL);
	_g_object_unref0 (_tmp1_);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_HORIZONTAL);
	gtk_widget_set_halign ((GtkWidget*) self, GTK_ALIGN_END);
	_tmp2_ = self->priv->_entry;
	g_signal_connect_object (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, gtk_search_entry_get_type ()) ? ((GtkSearchEntry*) _tmp2_) : NULL, "search-changed", (GCallback) ___lambda83__gtk_search_entry_search_changed, self, 0);
	_tmp3_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-find-symbolic", (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->button);
	self->priv->button = _tmp3_;
	_tmp4_ = self->priv->button;
	_tmp5_ = enotes_app;
	_tmp7_ = _tmp6_ = gtk_application_get_accels_for_action ((GtkApplication*) _tmp5_, "win.find-action");
	_tmp8_ = _tmp7_;
	_tmp8__length1 = _vala_array_length (_tmp6_);
	_tmp9_ = granite_markup_accel_tooltip (_tmp8_, (gint) _vala_array_length (_tmp6_), _ ("Search your current notebook"));
	_tmp10_ = _tmp9_;
	gtk_widget_set_tooltip_markup ((GtkWidget*) _tmp4_, _tmp10_);
	_g_free0 (_tmp10_);
	_tmp8_ = (_vala_array_free (_tmp8_, _tmp8__length1, (GDestroyNotify) g_free), NULL);
	_tmp11_ = self->priv->button_revealer;
	_tmp12_ = self->priv->button;
	gtk_container_add ((GtkContainer*) _tmp11_, (GtkWidget*) _tmp12_);
	_tmp13_ = self->priv->button;
	g_signal_connect_object (_tmp13_, "clicked", (GCallback) _enotes_button_entry_show_entry_gtk_button_clicked, self, 0);
	_tmp14_ = self->priv->entry_revealer;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp14_);
	_tmp15_ = self->priv->button_revealer;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp15_);
	_tmp16_ = self->priv->entry_revealer;
	gtk_revealer_set_transition_type (_tmp16_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
	_tmp17_ = self->priv->button_revealer;
	gtk_revealer_set_transition_type (_tmp17_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
	_tmp18_ = self->priv->_entry;
	g_signal_connect_object (_tmp18_, "icon-release", (GCallback) ___lambda84__gtk_entry_icon_release, self, 0);
	return self;
}

ENotesButtonEntry*
enotes_button_entry_new_search_entry (void)
{
	return enotes_button_entry_construct_search_entry (ENOTES_TYPE_BUTTON_ENTRY);
}

ENotesButtonEntry*
enotes_button_entry_construct_for_tags (GType object_type,
                                        const gchar* tag_text)
{
	ENotesButtonEntry * self = NULL;
	GtkEntry* _tmp0_;
	GtkEntry* _tmp1_;
	GtkButton* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	GtkButton* _tmp5_;
	GtkStyleContext* _tmp6_;
	GtkLabel* _tmp7_;
	GtkEntry* _tmp8_;
	GtkEntry* _tmp9_;
	GtkEntry* _tmp10_;
	GtkEntry* _tmp11_;
	GtkEntry* _tmp12_;
	GtkButton* _tmp13_;
	GtkLabel* _tmp14_;
	GtkRevealer* _tmp15_;
	GtkButton* _tmp16_;
	GtkRevealer* _tmp17_;
	GtkRevealer* _tmp18_;
	GtkRevealer* _tmp19_;
	GtkRevealer* _tmp20_;
	g_return_val_if_fail (tag_text != NULL, NULL);
	_tmp0_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	self = (ENotesButtonEntry*) g_object_new (object_type, "entry", _tmp1_, NULL);
	_g_object_unref0 (_tmp1_);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	self->priv->always_shown_when_revealed = TRUE;
	gtk_widget_set_halign ((GtkWidget*) self, GTK_ALIGN_START);
	gtk_widget_set_valign ((GtkWidget*) self, GTK_ALIGN_CENTER);
	gtk_widget_set_vexpand ((GtkWidget*) self, FALSE);
	_tmp2_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->button);
	self->priv->button = _tmp2_;
	_tmp3_ = self->priv->button;
	gtk_widget_set_tooltip_markup ((GtkWidget*) _tmp3_, _ ("Add Tag"));
	_tmp4_ = self->priv->button;
	g_signal_connect_object (_tmp4_, "clicked", (GCallback) _enotes_button_entry_show_entry_gtk_button_clicked, self, 0);
	_tmp5_ = self->priv->button;
	_tmp6_ = gtk_widget_get_style_context ((GtkWidget*) _tmp5_);
	gtk_style_context_add_class (_tmp6_, "flat");
	_tmp7_ = (GtkLabel*) gtk_label_new (tag_text);
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->label);
	self->priv->label = _tmp7_;
	_tmp8_ = self->priv->_entry;
	gtk_widget_set_halign ((GtkWidget*) _tmp8_, GTK_ALIGN_FILL);
	_tmp9_ = self->priv->_entry;
	g_object_set (_tmp9_, "show-emoji-icon", TRUE, NULL);
	_tmp10_ = self->priv->_entry;
	gtk_entry_set_max_width_chars (_tmp10_, 3);
	_tmp11_ = self->priv->_entry;
	gtk_entry_set_width_chars (_tmp11_, 1);
	_tmp12_ = self->priv->_entry;
	g_object_set ((GtkWidget*) _tmp12_, "margin", 0, NULL);
	_tmp13_ = self->priv->button;
	_tmp14_ = self->priv->label;
	gtk_container_add ((GtkContainer*) _tmp13_, (GtkWidget*) _tmp14_);
	_tmp15_ = self->priv->button_revealer;
	_tmp16_ = self->priv->button;
	gtk_container_add ((GtkContainer*) _tmp15_, (GtkWidget*) _tmp16_);
	_tmp17_ = self->priv->entry_revealer;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp17_);
	_tmp18_ = self->priv->button_revealer;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp18_);
	_tmp19_ = self->priv->entry_revealer;
	gtk_revealer_set_transition_type (_tmp19_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	_tmp20_ = self->priv->button_revealer;
	gtk_revealer_set_transition_type (_tmp20_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	return self;
}

ENotesButtonEntry*
enotes_button_entry_new_for_tags (const gchar* tag_text)
{
	return enotes_button_entry_construct_for_tags (ENOTES_TYPE_BUTTON_ENTRY, tag_text);
}

ENotesButtonEntry*
enotes_button_entry_construct_for_page_title (GType object_type)
{
	ENotesButtonEntry * self = NULL;
	GtkEntry* _tmp0_;
	GtkEntry* _tmp1_;
	GtkButton* _tmp2_;
	GtkButton* _tmp3_;
	GtkLabel* _tmp4_;
	GtkLabel* _tmp5_;
	GtkGrid* button_grid = NULL;
	GtkGrid* _tmp6_;
	GtkImage* _tmp7_;
	GtkImage* _tmp8_;
	GtkLabel* _tmp9_;
	GtkButton* _tmp10_;
	GtkButton* _tmp11_;
	GtkStyleContext* _tmp12_;
	GtkEntry* _tmp13_;
	GtkEntry* _tmp14_;
	GtkEntry* _tmp15_;
	GtkEntry* _tmp16_;
	GtkButton* _tmp17_;
	GtkRevealer* _tmp18_;
	GtkButton* _tmp19_;
	GtkRevealer* _tmp20_;
	GtkRevealer* _tmp21_;
	GtkRevealer* _tmp22_;
	GtkRevealer* _tmp23_;
	_tmp0_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	self = (ENotesButtonEntry*) g_object_new (object_type, "entry", _tmp1_, NULL);
	_g_object_unref0 (_tmp1_);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	self->priv->hide_if_contains_text = TRUE;
	gtk_widget_set_halign ((GtkWidget*) self, GTK_ALIGN_START);
	gtk_widget_set_vexpand ((GtkWidget*) self, FALSE);
	_tmp2_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->button);
	self->priv->button = _tmp2_;
	_tmp3_ = self->priv->button;
	gtk_widget_set_tooltip_markup ((GtkWidget*) _tmp3_, _ ("Edit Page Title"));
	_tmp4_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->label);
	self->priv->label = _tmp4_;
	_tmp5_ = self->priv->label;
	gtk_label_set_ellipsize (_tmp5_, PANGO_ELLIPSIZE_END);
	_tmp6_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp6_);
	button_grid = _tmp6_;
	gtk_orientable_set_orientation ((GtkOrientable*) button_grid, GTK_ORIENTATION_HORIZONTAL);
	_tmp7_ = (GtkImage*) gtk_image_new_from_icon_name ("folder-documents-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp7_);
	_tmp8_ = _tmp7_;
	gtk_container_add ((GtkContainer*) button_grid, (GtkWidget*) _tmp8_);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = self->priv->label;
	gtk_container_add ((GtkContainer*) button_grid, (GtkWidget*) _tmp9_);
	_tmp10_ = self->priv->button;
	g_signal_connect_object (_tmp10_, "clicked", (GCallback) _enotes_button_entry_show_entry_gtk_button_clicked, self, 0);
	_tmp11_ = self->priv->button;
	_tmp12_ = gtk_widget_get_style_context ((GtkWidget*) _tmp11_);
	gtk_style_context_add_class (_tmp12_, "flat");
	_tmp13_ = self->priv->_entry;
	gtk_widget_set_halign ((GtkWidget*) _tmp13_, GTK_ALIGN_FILL);
	_tmp14_ = self->priv->_entry;
	gtk_entry_set_max_width_chars (_tmp14_, 3);
	_tmp15_ = self->priv->_entry;
	gtk_entry_set_width_chars (_tmp15_, 1);
	_tmp16_ = self->priv->_entry;
	g_object_set ((GtkWidget*) _tmp16_, "margin", 2, NULL);
	_tmp17_ = self->priv->button;
	gtk_container_add ((GtkContainer*) _tmp17_, (GtkWidget*) button_grid);
	_tmp18_ = self->priv->button_revealer;
	_tmp19_ = self->priv->button;
	gtk_container_add ((GtkContainer*) _tmp18_, (GtkWidget*) _tmp19_);
	_tmp20_ = self->priv->entry_revealer;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp20_);
	_tmp21_ = self->priv->button_revealer;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp21_);
	_tmp22_ = self->priv->entry_revealer;
	gtk_revealer_set_transition_type (_tmp22_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	_tmp23_ = self->priv->button_revealer;
	gtk_revealer_set_transition_type (_tmp23_, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	_g_object_unref0 (button_grid);
	return self;
}

ENotesButtonEntry*
enotes_button_entry_new_for_page_title (void)
{
	return enotes_button_entry_construct_for_page_title (ENOTES_TYPE_BUTTON_ENTRY);
}

void
enotes_button_entry_show_entry (ENotesButtonEntry* self)
{
	GtkRevealer* _tmp0_;
	GtkRevealer* _tmp1_;
	GtkEntry* _tmp2_;
	GtkEntry* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->button_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, FALSE);
	_tmp1_ = self->priv->entry_revealer;
	gtk_revealer_set_reveal_child (_tmp1_, TRUE);
	gtk_widget_show_all ((GtkWidget*) self);
	_tmp2_ = self->priv->_entry;
	gtk_widget_set_can_focus ((GtkWidget*) _tmp2_, TRUE);
	_tmp3_ = self->priv->_entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp3_);
}

void
enotes_button_entry_hide_entry (ENotesButtonEntry* self)
{
	GtkRevealer* _tmp0_;
	GtkRevealer* _tmp1_;
	GtkEntry* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entry_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, FALSE);
	_tmp1_ = self->priv->button_revealer;
	gtk_revealer_set_reveal_child (_tmp1_, TRUE);
	_tmp2_ = self->priv->_entry;
	gtk_widget_set_can_focus ((GtkWidget*) _tmp2_, FALSE);
	gtk_widget_show_all ((GtkWidget*) self);
}

ENotesButtonEntry*
enotes_button_entry_construct (GType object_type)
{
	ENotesButtonEntry * self = NULL;
	self = (ENotesButtonEntry*) g_object_new (object_type, NULL);
	return self;
}

ENotesButtonEntry*
enotes_button_entry_new (void)
{
	return enotes_button_entry_construct (ENOTES_TYPE_BUTTON_ENTRY);
}

GtkEntry*
enotes_button_entry_get_entry (ENotesButtonEntry* self)
{
	GtkEntry* result;
	GtkEntry* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_entry;
	result = _tmp0_;
	return result;
}

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

static void
enotes_button_entry_set_entry (ENotesButtonEntry* self,
                               GtkEntry* value)
{
	GtkEntry* old_value;
	g_return_if_fail (self != NULL);
	old_value = enotes_button_entry_get_entry (self);
	if (old_value != value) {
		GtkEntry* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_entry);
		self->priv->_entry = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, enotes_button_entry_properties[ENOTES_BUTTON_ENTRY_ENTRY_PROPERTY]);
	}
}

const gchar*
enotes_button_entry_get_text (ENotesButtonEntry* self)
{
	const gchar* result;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
enotes_button_entry_set_text (ENotesButtonEntry* self,
                              const gchar* value)
{
	GtkLabel* _tmp0_;
	GtkEntry* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->setting = TRUE;
	_tmp0_ = self->priv->label;
	gtk_label_set_label (_tmp0_, value);
	_tmp1_ = self->priv->_entry;
	gtk_entry_set_text (_tmp1_, value);
	self->priv->setting = FALSE;
	g_object_notify_by_pspec ((GObject *) self, enotes_button_entry_properties[ENOTES_BUTTON_ENTRY_TEXT_PROPERTY]);
}

static void
_enotes_button_entry___lambda85_ (ENotesButtonEntry* self)
{
	g_signal_emit (self, enotes_button_entry_signals[ENOTES_BUTTON_ENTRY_ACTIVATED_SIGNAL], 0);
}

static void
__enotes_button_entry___lambda85__gtk_entry_activate (GtkEntry* _sender,
                                                      gpointer self)
{
	_enotes_button_entry___lambda85_ ((ENotesButtonEntry*) self);
}

static gboolean
_enotes_button_entry___lambda86_ (ENotesButtonEntry* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	if (!self->priv->always_shown_when_revealed) {
		gboolean _tmp1_ = FALSE;
		if (self->priv->hide_if_contains_text) {
			_tmp1_ = TRUE;
		} else {
			GtkEntry* _tmp2_;
			const gchar* _tmp3_;
			_tmp2_ = self->priv->_entry;
			_tmp3_ = gtk_entry_get_text (_tmp2_);
			_tmp1_ = g_strcmp0 (_tmp3_, "") == 0;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		enotes_button_entry_hide_entry (self);
	}
	result = FALSE;
	return result;
}

static gboolean
__enotes_button_entry___lambda86__gtk_widget_focus_out_event (GtkWidget* _sender,
                                                              GdkEventFocus* event,
                                                              gpointer self)
{
	gboolean result;
	result = _enotes_button_entry___lambda86_ ((ENotesButtonEntry*) self);
	return result;
}

static GObject *
enotes_button_entry_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ENotesButtonEntry * self;
	GtkEntry* _tmp0_;
	GtkEntry* _tmp1_;
	GtkEntry* _tmp2_;
	GtkEntry* _tmp3_;
	GtkEntry* _tmp4_;
	GtkRevealer* _tmp5_;
	GtkRevealer* _tmp6_;
	GtkRevealer* _tmp7_;
	GtkEntry* _tmp8_;
	GtkRevealer* _tmp9_;
	GtkRevealer* _tmp10_;
	GtkRevealer* _tmp11_;
	GtkEntry* _tmp12_;
	GtkEntry* _tmp13_;
	parent_class = G_OBJECT_CLASS (enotes_button_entry_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_BUTTON_ENTRY, ENotesButtonEntry);
	gtk_widget_set_valign ((GtkWidget*) self, GTK_ALIGN_CENTER);
	_tmp0_ = self->priv->_entry;
	g_object_set (_tmp0_, "editable", TRUE, NULL);
	_tmp1_ = self->priv->_entry;
	gtk_entry_set_visibility (_tmp1_, TRUE);
	_tmp2_ = self->priv->_entry;
	g_object_set ((GtkWidget*) _tmp2_, "expand", FALSE, NULL);
	_tmp3_ = self->priv->_entry;
	gtk_entry_set_max_width_chars (_tmp3_, 30);
	_tmp4_ = self->priv->_entry;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp4_, 12);
	_tmp5_ = (GtkRevealer*) gtk_revealer_new ();
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->entry_revealer);
	self->priv->entry_revealer = _tmp5_;
	_tmp6_ = self->priv->entry_revealer;
	gtk_widget_set_valign ((GtkWidget*) _tmp6_, GTK_ALIGN_CENTER);
	_tmp7_ = self->priv->entry_revealer;
	_tmp8_ = self->priv->_entry;
	gtk_container_add ((GtkContainer*) _tmp7_, (GtkWidget*) _tmp8_);
	_tmp9_ = self->priv->entry_revealer;
	gtk_revealer_set_reveal_child (_tmp9_, FALSE);
	_tmp10_ = (GtkRevealer*) gtk_revealer_new ();
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->button_revealer);
	self->priv->button_revealer = _tmp10_;
	_tmp11_ = self->priv->button_revealer;
	gtk_revealer_set_reveal_child (_tmp11_, TRUE);
	_tmp12_ = self->priv->_entry;
	g_signal_connect_object (_tmp12_, "activate", (GCallback) __enotes_button_entry___lambda85__gtk_entry_activate, self, 0);
	_tmp13_ = self->priv->_entry;
	g_signal_connect_object ((GtkWidget*) _tmp13_, "focus-out-event", (GCallback) __enotes_button_entry___lambda86__gtk_widget_focus_out_event, self, 0);
	return obj;
}

static void
enotes_button_entry_class_init (ENotesButtonEntryClass * klass,
                                gpointer klass_data)
{
	enotes_button_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ENotesButtonEntry_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_enotes_button_entry_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_enotes_button_entry_set_property;
	G_OBJECT_CLASS (klass)->constructor = enotes_button_entry_constructor;
	G_OBJECT_CLASS (klass)->finalize = enotes_button_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), ENOTES_BUTTON_ENTRY_ENTRY_PROPERTY, enotes_button_entry_properties[ENOTES_BUTTON_ENTRY_ENTRY_PROPERTY] = g_param_spec_object ("entry", "entry", "entry", gtk_entry_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), ENOTES_BUTTON_ENTRY_TEXT_PROPERTY, enotes_button_entry_properties[ENOTES_BUTTON_ENTRY_TEXT_PROPERTY] = g_param_spec_string ("text", "text", "text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	enotes_button_entry_signals[ENOTES_BUTTON_ENTRY_CHANGED_SIGNAL] = g_signal_new ("changed", ENOTES_TYPE_BUTTON_ENTRY, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	enotes_button_entry_signals[ENOTES_BUTTON_ENTRY_ACTIVATED_SIGNAL] = g_signal_new ("activated", ENOTES_TYPE_BUTTON_ENTRY, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
enotes_button_entry_instance_init (ENotesButtonEntry * self,
                                   gpointer klass)
{
	self->priv = enotes_button_entry_get_instance_private (self);
	self->priv->hide_if_contains_text = FALSE;
	self->priv->always_shown_when_revealed = FALSE;
	self->priv->setting = FALSE;
}

static void
enotes_button_entry_finalize (GObject * obj)
{
	ENotesButtonEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_BUTTON_ENTRY, ENotesButtonEntry);
	_g_object_unref0 (self->priv->_entry);
	_g_object_unref0 (self->priv->entry_revealer);
	_g_object_unref0 (self->priv->button_revealer);
	_g_object_unref0 (self->priv->button);
	_g_object_unref0 (self->priv->label);
	G_OBJECT_CLASS (enotes_button_entry_parent_class)->finalize (obj);
}

static GType
enotes_button_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ENotesButtonEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) enotes_button_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ENotesButtonEntry), 0, (GInstanceInitFunc) enotes_button_entry_instance_init, NULL };
	GType enotes_button_entry_type_id;
	enotes_button_entry_type_id = g_type_register_static (gtk_grid_get_type (), "ENotesButtonEntry", &g_define_type_info, 0);
	ENotesButtonEntry_private_offset = g_type_add_instance_private (enotes_button_entry_type_id, sizeof (ENotesButtonEntryPrivate));
	return enotes_button_entry_type_id;
}

GType
enotes_button_entry_get_type (void)
{
	static volatile gsize enotes_button_entry_type_id__once = 0;
	if (g_once_init_enter (&enotes_button_entry_type_id__once)) {
		GType enotes_button_entry_type_id;
		enotes_button_entry_type_id = enotes_button_entry_get_type_once ();
		g_once_init_leave (&enotes_button_entry_type_id__once, enotes_button_entry_type_id);
	}
	return enotes_button_entry_type_id__once;
}

static void
_vala_enotes_button_entry_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	ENotesButtonEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, ENOTES_TYPE_BUTTON_ENTRY, ENotesButtonEntry);
	switch (property_id) {
		case ENOTES_BUTTON_ENTRY_ENTRY_PROPERTY:
		g_value_set_object (value, enotes_button_entry_get_entry (self));
		break;
		case ENOTES_BUTTON_ENTRY_TEXT_PROPERTY:
		g_value_set_string (value, enotes_button_entry_get_text (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_enotes_button_entry_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	ENotesButtonEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, ENOTES_TYPE_BUTTON_ENTRY, ENotesButtonEntry);
	switch (property_id) {
		case ENOTES_BUTTON_ENTRY_ENTRY_PROPERTY:
		enotes_button_entry_set_entry (self, g_value_get_object (value));
		break;
		case ENOTES_BUTTON_ENTRY_TEXT_PROPERTY:
		enotes_button_entry_set_text (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
enotes_headerbar_get_instance_private (ENotesHeaderbar* self)
{
	return G_STRUCT_MEMBER_P (self, ENotesHeaderbar_private_offset);
}

ENotesHeaderbar*
enotes_headerbar_construct (GType object_type,
                            ENotesPageInfoEditor* page_info)
{
	ENotesHeaderbar * self = NULL;
	GraniteWidgetsModeButton* _tmp0_;
	GraniteWidgetsModeButton* _tmp1_;
	GraniteWidgetsModeButton* _tmp2_;
	GraniteWidgetsModeButton* _tmp3_;
	GraniteWidgetsModeButton* _tmp4_;
	GraniteWidgetsModeButton* _tmp5_;
	ENotesApplication* _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	gchar** _tmp9_;
	gint _tmp9__length1;
	gchar* _tmp10_;
	gchar* _tmp11_;
	ENotesButtonEntry* _tmp12_;
	ENotesFileDataTable* _tmp13_;
	ENotesFileDataTable* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	ENotesBookmarkButton* _tmp17_;
	GtkMenuButton* _tmp18_;
	GraniteWidgetsModeButton* _tmp19_;
	GtkMenuButton* _tmp20_;
	GtkToggleButton* _tmp21_;
	GtkToggleButton* _tmp22_;
	ENotesBookmarkButton* _tmp23_;
	ENotesButtonEntry* _tmp24_;
	g_return_val_if_fail (page_info != NULL, NULL);
	self = (ENotesHeaderbar*) g_object_new (object_type, NULL);
	_tmp0_ = granite_widgets_mode_button_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->mode_button);
	self->priv->mode_button = _tmp0_;
	_tmp1_ = self->priv->mode_button;
	granite_widgets_mode_button_append_text (_tmp1_, _ ("View"));
	_tmp2_ = self->priv->mode_button;
	granite_widgets_mode_button_append_icon (_tmp2_, "view-dual-symbolic", GTK_ICON_SIZE_MENU);
	_tmp3_ = self->priv->mode_button;
	granite_widgets_mode_button_append_text (_tmp3_, _ ("Edit"));
	_tmp4_ = self->priv->mode_button;
	gtk_widget_set_valign ((GtkWidget*) _tmp4_, GTK_ALIGN_CENTER);
	_tmp5_ = self->priv->mode_button;
	_tmp6_ = enotes_app;
	_tmp8_ = _tmp7_ = gtk_application_get_accels_for_action ((GtkApplication*) _tmp6_, "win.change-mode");
	_tmp9_ = _tmp8_;
	_tmp9__length1 = _vala_array_length (_tmp7_);
	_tmp10_ = granite_markup_accel_tooltip (_tmp9_, (gint) _vala_array_length (_tmp7_), _ ("Change mode"));
	_tmp11_ = _tmp10_;
	gtk_widget_set_tooltip_markup ((GtkWidget*) _tmp5_, _tmp11_);
	_g_free0 (_tmp11_);
	_tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL);
	enotes_headerbar_create_menu (self);
	enotes_headerbar_make_panel_picker_menu (self);
	_tmp12_ = enotes_button_entry_new_search_entry ();
	g_object_ref_sink (_tmp12_);
	_g_object_unref0 (self->priv->search_entry);
	self->priv->search_entry = _tmp12_;
	_tmp13_ = enotes_file_data_table_get_instance ();
	_tmp14_ = _tmp13_;
	_tmp15_ = enotes_file_data_table_get_value (_tmp14_, FILE_DATA_TYPE_FILE_NAME);
	_tmp16_ = _tmp15_;
	gtk_header_bar_set_subtitle ((GtkHeaderBar*) self, _tmp16_);
	_g_free0 (_tmp16_);
	_tmp17_ = enotes_bookmark_button_new ();
	g_object_ref_sink (_tmp17_);
	_g_object_unref0 (self->bookmark_button);
	self->bookmark_button = _tmp17_;
	enotes_headerbar_set_title_from_data (self, NULL, NULL);
	gtk_header_bar_set_show_close_button ((GtkHeaderBar*) self, TRUE);
	_tmp18_ = self->priv->panel_picker_menu;
	gtk_header_bar_pack_start ((GtkHeaderBar*) self, (GtkWidget*) _tmp18_);
	_tmp19_ = self->priv->mode_button;
	gtk_header_bar_pack_start ((GtkHeaderBar*) self, (GtkWidget*) _tmp19_);
	_tmp20_ = self->priv->app_menu;
	gtk_header_bar_pack_end ((GtkHeaderBar*) self, (GtkWidget*) _tmp20_);
	_tmp21_ = enotes_page_info_editor_get_toggle_button (page_info);
	_tmp22_ = _tmp21_;
	gtk_header_bar_pack_end ((GtkHeaderBar*) self, (GtkWidget*) _tmp22_);
	_g_object_unref0 (_tmp22_);
	_tmp23_ = self->bookmark_button;
	gtk_header_bar_pack_end ((GtkHeaderBar*) self, (GtkWidget*) _tmp23_);
	_tmp24_ = self->priv->search_entry;
	gtk_header_bar_pack_end ((GtkHeaderBar*) self, (GtkWidget*) _tmp24_);
	gtk_widget_show_all ((GtkWidget*) self);
	enotes_headerbar_connect_signals (self);
	return self;
}

ENotesHeaderbar*
enotes_headerbar_new (ENotesPageInfoEditor* page_info)
{
	return enotes_headerbar_construct (ENOTES_TYPE_HEADERBAR, page_info);
}

static void
___lambda116_ (ENotesHeaderbar* self)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	enotes_application_state_set_panes_visible (_tmp1_, 3);
}

static void
____lambda116__gtk_button_clicked (GtkButton* _sender,
                                   gpointer self)
{
	___lambda116_ ((ENotesHeaderbar*) self);
}

static void
__lambda117_ (ENotesHeaderbar* self)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	enotes_application_state_set_panes_visible (_tmp1_, 2);
}

static void
___lambda117__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda117_ ((ENotesHeaderbar*) self);
}

static void
__lambda118_ (ENotesHeaderbar* self)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	enotes_application_state_set_panes_visible (_tmp1_, 1);
}

static void
___lambda118__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda118_ ((ENotesHeaderbar*) self);
}

static void
__lambda119_ (ENotesHeaderbar* self)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	enotes_application_state_set_panes_visible (_tmp1_, 0);
}

static void
___lambda119__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda119_ ((ENotesHeaderbar*) self);
}

static void
__lambda120_ (ENotesHeaderbar* self)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	_tmp2_ = enotes_application_state_get_panes_visible (_tmp1_);
	_tmp3_ = _tmp2_;
	switch (_tmp3_) {
		case 0:
		{
			GtkMenuButton* _tmp4_;
			GtkImage* _tmp5_;
			GtkImage* _tmp6_;
			_tmp4_ = self->priv->panel_picker_menu;
			_tmp5_ = (GtkImage*) gtk_image_new_from_icon_name ("panes-none-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
			g_object_ref_sink (_tmp5_);
			_tmp6_ = _tmp5_;
			gtk_button_set_image ((GtkButton*) _tmp4_, (GtkWidget*) _tmp6_);
			_g_object_unref0 (_tmp6_);
			break;
		}
		case 1:
		{
			GtkMenuButton* _tmp7_;
			GtkImage* _tmp8_;
			GtkImage* _tmp9_;
			_tmp7_ = self->priv->panel_picker_menu;
			_tmp8_ = (GtkImage*) gtk_image_new_from_icon_name ("panes-one-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
			g_object_ref_sink (_tmp8_);
			_tmp9_ = _tmp8_;
			gtk_button_set_image ((GtkButton*) _tmp7_, (GtkWidget*) _tmp9_);
			_g_object_unref0 (_tmp9_);
			break;
		}
		case 2:
		{
			GtkMenuButton* _tmp10_;
			GtkImage* _tmp11_;
			GtkImage* _tmp12_;
			_tmp10_ = self->priv->panel_picker_menu;
			_tmp11_ = (GtkImage*) gtk_image_new_from_icon_name ("panes-two-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
			g_object_ref_sink (_tmp11_);
			_tmp12_ = _tmp11_;
			gtk_button_set_image ((GtkButton*) _tmp10_, (GtkWidget*) _tmp12_);
			_g_object_unref0 (_tmp12_);
			break;
		}
		case 3:
		{
			GtkMenuButton* _tmp13_;
			GtkImage* _tmp14_;
			GtkImage* _tmp15_;
			_tmp13_ = self->priv->panel_picker_menu;
			_tmp14_ = (GtkImage*) gtk_image_new_from_icon_name ("panes-all-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
			g_object_ref_sink (_tmp14_);
			_tmp15_ = _tmp14_;
			gtk_button_set_image ((GtkButton*) _tmp13_, (GtkWidget*) _tmp15_);
			_g_object_unref0 (_tmp15_);
			break;
		}
		default:
		break;
	}
}

static void
___lambda120__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda120_ ((ENotesHeaderbar*) self);
}

static void
enotes_headerbar_make_panel_picker_menu (ENotesHeaderbar* self)
{
	GtkModelButton* panes_two_item = NULL;
	GtkModelButton* _tmp0_;
	GtkModelButton* panes_one_item = NULL;
	GtkModelButton* _tmp1_;
	GtkModelButton* show_none_item = NULL;
	GtkModelButton* _tmp2_;
	GtkGrid* menu_grid = NULL;
	GtkGrid* _tmp3_;
	GtkGrid* _tmp4_;
	GtkGrid* _tmp5_;
	GtkGrid* _tmp6_;
	GtkGrid* _tmp11_;
	GtkModelButton* _tmp12_;
	GtkGrid* _tmp13_;
	GtkModelButton* _tmp14_;
	GtkGrid* _tmp15_;
	GtkSeparator* _tmp16_;
	GtkSeparator* _tmp17_;
	GtkGrid* _tmp18_;
	GtkModelButton* _tmp19_;
	GtkPopover* menu = NULL;
	GtkPopover* _tmp20_;
	GtkGrid* _tmp21_;
	GtkGrid* _tmp22_;
	GtkGrid* _tmp23_;
	GtkMenuButton* _tmp24_;
	GtkMenuButton* _tmp25_;
	GtkImage* _tmp26_;
	GtkImage* _tmp27_;
	GtkMenuButton* _tmp28_;
	GtkMenuButton* _tmp29_;
	GtkMenuButton* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar** _tmp33_;
	gchar** _tmp34_;
	gint _tmp34__length1;
	gchar* _tmp35_;
	gchar* _tmp36_;
	GtkModelButton* _tmp37_;
	GtkModelButton* _tmp38_;
	GtkModelButton* _tmp39_;
	ENotesApplication* _tmp40_;
	ENotesApplicationState* _tmp41_;
	g_return_if_fail (self != NULL);
	_tmp0_ = enotes_headerbar_model_button_entry (self, _ ("Show Sections and Pages"), "panes-two-symbolic");
	panes_two_item = _tmp0_;
	_tmp1_ = enotes_headerbar_model_button_entry (self, _ ("Show Only Pages"), "panes-one-symbolic");
	panes_one_item = _tmp1_;
	_tmp2_ = enotes_headerbar_model_button_entry (self, _ ("Hide All"), "panes-none-symbolic");
	show_none_item = _tmp2_;
	_tmp3_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp3_);
	menu_grid = _tmp3_;
	_tmp4_ = menu_grid;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp4_, 3);
	_tmp5_ = menu_grid;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp5_, 3);
	_tmp6_ = menu_grid;
	gtk_orientable_set_orientation ((GtkOrientable*) _tmp6_, GTK_ORIENTATION_VERTICAL);
	if (ENOTES_FEATURE_FLAGS_SHOW_NOTEBOOK_PANE) {
		GtkModelButton* show_all_item = NULL;
		GtkModelButton* _tmp7_;
		GtkGrid* _tmp8_;
		GtkModelButton* _tmp9_;
		GtkModelButton* _tmp10_;
		_tmp7_ = enotes_headerbar_model_button_entry (self, _ ("Show All"), "panes-all-symbolic");
		show_all_item = _tmp7_;
		_tmp8_ = menu_grid;
		_tmp9_ = show_all_item;
		gtk_container_add ((GtkContainer*) _tmp8_, (GtkWidget*) _tmp9_);
		_tmp10_ = show_all_item;
		g_signal_connect_object ((GtkButton*) _tmp10_, "clicked", (GCallback) ____lambda116__gtk_button_clicked, self, 0);
		_g_object_unref0 (show_all_item);
	}
	_tmp11_ = menu_grid;
	_tmp12_ = panes_two_item;
	gtk_container_add ((GtkContainer*) _tmp11_, (GtkWidget*) _tmp12_);
	_tmp13_ = menu_grid;
	_tmp14_ = panes_one_item;
	gtk_container_add ((GtkContainer*) _tmp13_, (GtkWidget*) _tmp14_);
	_tmp15_ = menu_grid;
	_tmp16_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp16_);
	_tmp17_ = _tmp16_;
	gtk_container_add ((GtkContainer*) _tmp15_, (GtkWidget*) _tmp17_);
	_g_object_unref0 (_tmp17_);
	_tmp18_ = menu_grid;
	_tmp19_ = show_none_item;
	gtk_container_add ((GtkContainer*) _tmp18_, (GtkWidget*) _tmp19_);
	_tmp20_ = (GtkPopover*) gtk_popover_new (NULL);
	g_object_ref_sink (_tmp20_);
	menu = _tmp20_;
	_tmp21_ = menu_grid;
	gtk_container_add ((GtkContainer*) menu, (GtkWidget*) _tmp21_);
	_tmp22_ = menu_grid;
	gtk_widget_show_all ((GtkWidget*) _tmp22_);
	_tmp23_ = menu_grid;
	g_object_set ((GtkWidget*) _tmp23_, "expand", TRUE, NULL);
	_tmp24_ = (GtkMenuButton*) gtk_menu_button_new ();
	g_object_ref_sink (_tmp24_);
	_g_object_unref0 (self->priv->panel_picker_menu);
	self->priv->panel_picker_menu = _tmp24_;
	_tmp25_ = self->priv->panel_picker_menu;
	_tmp26_ = (GtkImage*) gtk_image_new_from_icon_name ("panes-all-symbolic", (GtkIconSize) GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp26_);
	_tmp27_ = _tmp26_;
	gtk_button_set_image ((GtkButton*) _tmp25_, (GtkWidget*) _tmp27_);
	_g_object_unref0 (_tmp27_);
	_tmp28_ = self->priv->panel_picker_menu;
	gtk_menu_button_set_popover (_tmp28_, menu);
	_tmp29_ = self->priv->panel_picker_menu;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp29_, 3);
	_tmp30_ = self->priv->panel_picker_menu;
	_tmp31_ = g_strdup ("<Ctrl>P");
	_tmp32_ = g_strdup ("<Ctrl><Shift>P");
	_tmp33_ = g_new0 (gchar*, 2 + 1);
	_tmp33_[0] = _tmp31_;
	_tmp33_[1] = _tmp32_;
	_tmp34_ = _tmp33_;
	_tmp34__length1 = 2;
	_tmp35_ = granite_markup_accel_tooltip (_tmp34_, (gint) 2, _ ("Panel Options"));
	_tmp36_ = _tmp35_;
	gtk_widget_set_tooltip_markup ((GtkWidget*) _tmp30_, _tmp36_);
	_g_free0 (_tmp36_);
	_tmp34_ = (_vala_array_free (_tmp34_, _tmp34__length1, (GDestroyNotify) g_free), NULL);
	_tmp37_ = panes_two_item;
	g_signal_connect_object ((GtkButton*) _tmp37_, "clicked", (GCallback) ___lambda117__gtk_button_clicked, self, 0);
	_tmp38_ = panes_one_item;
	g_signal_connect_object ((GtkButton*) _tmp38_, "clicked", (GCallback) ___lambda118__gtk_button_clicked, self, 0);
	_tmp39_ = show_none_item;
	g_signal_connect_object ((GtkButton*) _tmp39_, "clicked", (GCallback) ___lambda119__gtk_button_clicked, self, 0);
	_tmp40_ = enotes_app;
	_tmp41_ = _tmp40_->state;
	g_signal_connect_object ((GObject*) _tmp41_, "notify::panes-visible", (GCallback) ___lambda120__g_object_notify, self, 0);
	_g_object_unref0 (menu);
	_g_object_unref0 (menu_grid);
	_g_object_unref0 (show_none_item);
	_g_object_unref0 (panes_one_item);
	_g_object_unref0 (panes_two_item);
}

static GtkModelButton*
enotes_headerbar_model_button_entry (ENotesHeaderbar* self,
                                     const gchar* text,
                                     const gchar* icon_name)
{
	GtkModelButton* button = NULL;
	GtkModelButton* _tmp0_;
	GtkModelButton* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = (GtkModelButton*) gtk_model_button_new ();
	g_object_ref_sink (_tmp0_);
	button = _tmp0_;
	if (icon_name != NULL) {
		GtkBox* box = NULL;
		GtkBox* _tmp1_;
		GtkImage* icon = NULL;
		GtkImage* _tmp2_;
		GtkLabel* label = NULL;
		GtkLabel* _tmp3_;
		GtkBox* _tmp4_;
		GtkImage* _tmp5_;
		GtkBox* _tmp6_;
		GtkLabel* _tmp7_;
		GtkModelButton* _tmp8_;
		GtkWidget* _tmp9_;
		GtkModelButton* _tmp10_;
		GtkBox* _tmp11_;
		GtkModelButton* _tmp12_;
		_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
		g_object_ref_sink (_tmp1_);
		box = _tmp1_;
		_tmp2_ = (GtkImage*) gtk_image_new_from_icon_name (icon_name, (GtkIconSize) GTK_ICON_SIZE_MENU);
		g_object_ref_sink (_tmp2_);
		icon = _tmp2_;
		_tmp3_ = (GtkLabel*) gtk_label_new (text);
		g_object_ref_sink (_tmp3_);
		label = _tmp3_;
		_tmp4_ = box;
		_tmp5_ = icon;
		gtk_container_add ((GtkContainer*) _tmp4_, (GtkWidget*) _tmp5_);
		_tmp6_ = box;
		_tmp7_ = label;
		gtk_container_add ((GtkContainer*) _tmp6_, (GtkWidget*) _tmp7_);
		_tmp8_ = button;
		_tmp9_ = gtk_bin_get_child ((GtkBin*) _tmp8_);
		gtk_widget_destroy (_tmp9_);
		_tmp10_ = button;
		_tmp11_ = box;
		gtk_container_add ((GtkContainer*) _tmp10_, (GtkWidget*) _tmp11_);
		_tmp12_ = button;
		gtk_widget_show_all ((GtkWidget*) _tmp12_);
		_g_object_unref0 (label);
		_g_object_unref0 (icon);
		_g_object_unref0 (box);
	} else {
		GtkModelButton* _tmp13_;
		_tmp13_ = button;
		g_object_set (_tmp13_, "text", text, NULL);
	}
	result = button;
	return result;
}

static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		ENotesHeaderbar* self;
		self = _data4_->self;
		_g_object_unref0 (_data4_->color_button_dark);
		_g_object_unref0 (_data4_->color_button_light);
		_g_object_unref0 (_data4_->color_button_white);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static void
__lambda101_ (Block4Data* _data4_)
{
	ENotesHeaderbar* self;
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GQuark _tmp6_ = 0U;
	static GQuark _tmp5_label0 = 0;
	static GQuark _tmp5_label1 = 0;
	static GQuark _tmp5_label2 = 0;
	self = _data4_->self;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	_tmp2_ = enotes_application_state_get_style_scheme (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp6_ = (NULL == _tmp4_) ? 0 : g_quark_from_string (_tmp4_);
	if (_tmp6_ == ((0 != _tmp5_label0) ? _tmp5_label0 : (_tmp5_label0 = g_quark_from_static_string ("high-contrast")))) {
		switch (0) {
			default:
			{
				gtk_toggle_button_set_active ((GtkToggleButton*) _data4_->color_button_white, TRUE);
				break;
			}
		}
	} else if (_tmp6_ == ((0 != _tmp5_label1) ? _tmp5_label1 : (_tmp5_label1 = g_quark_from_static_string ("solarized-light")))) {
		switch (0) {
			default:
			{
				gtk_toggle_button_set_active ((GtkToggleButton*) _data4_->color_button_light, TRUE);
				break;
			}
		}
	} else if (_tmp6_ == ((0 != _tmp5_label2) ? _tmp5_label2 : (_tmp5_label2 = g_quark_from_static_string ("solarized-dark")))) {
		switch (0) {
			default:
			{
				gtk_toggle_button_set_active ((GtkToggleButton*) _data4_->color_button_dark, TRUE);
				break;
			}
		}
	}
}

static void
___lambda101__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda101_ (self);
}

static void
__lambda102_ (ENotesHeaderbar* self,
              FileDataType type,
              const gchar* value)
{
	g_return_if_fail (value != NULL);
	if (type == FILE_DATA_TYPE_FILE_NAME) {
		gtk_header_bar_set_subtitle ((GtkHeaderBar*) self, value);
	}
}

static void
___lambda102__enotes_application_state_file_data_changed (ENotesApplicationState* _sender,
                                                          FileDataType type,
                                                          const gchar* value,
                                                          gpointer self)
{
	__lambda102_ ((ENotesHeaderbar*) self, type, value);
}

static void
__lambda103_ (ENotesHeaderbar* self)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	enotes_application_state_set_style (_tmp1_, "solarized-dark");
}

static void
___lambda103__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda103_ ((ENotesHeaderbar*) self);
}

static void
__lambda104_ (ENotesHeaderbar* self)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	enotes_application_state_set_style (_tmp1_, "solarized-light");
}

static void
___lambda104__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda104_ ((ENotesHeaderbar*) self);
}

static void
__lambda105_ (ENotesHeaderbar* self)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	enotes_application_state_set_style (_tmp1_, "high-contrast");
}

static void
___lambda105__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda105_ ((ENotesHeaderbar*) self);
}

static void
__lambda106_ (ENotesHeaderbar* self)
{
	GFile* _tmp0_;
	GFile* _tmp1_;
	_tmp0_ = enotes_file_manager_export_pdf_action (NULL);
	_tmp1_ = _tmp0_;
	_g_object_unref0 (_tmp1_);
}

static void
___lambda106__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda106_ ((ENotesHeaderbar*) self);
}

static void
__lambda107_ (ENotesHeaderbar* self)
{
	GFile* _tmp0_;
	GFile* _tmp1_;
	_tmp0_ = enotes_file_manager_export_markdown_action (NULL);
	_tmp1_ = _tmp0_;
	_g_object_unref0 (_tmp1_);
}

static void
___lambda107__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda107_ ((ENotesHeaderbar*) self);
}

static void
__lambda108_ (ENotesHeaderbar* self)
{
	ENotesNotebookDialog* dialog = NULL;
	ENotesNotebookDialog* _tmp0_;
	_tmp0_ = enotes_notebook_dialog_new (NULL);
	g_object_ref_sink (_tmp0_);
	dialog = _tmp0_;
	gtk_dialog_run ((GtkDialog*) dialog);
	_g_object_unref0 (dialog);
}

static void
___lambda108__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda108_ ((ENotesHeaderbar*) self);
}

static void
__lambda109_ (ENotesHeaderbar* self)
{
	ENotesPreferencesDialog* dialog = NULL;
	ENotesPreferencesDialog* _tmp0_;
	_tmp0_ = enotes_preferences_dialog_new ();
	g_object_ref_sink (_tmp0_);
	dialog = _tmp0_;
	gtk_dialog_run ((GtkDialog*) dialog);
	_g_object_unref0 (dialog);
}

static void
___lambda109__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda109_ ((ENotesHeaderbar*) self);
}

static void
enotes_headerbar_create_menu (ENotesHeaderbar* self)
{
	Block4Data* _data4_;
	GtkRadioButton* _tmp0_;
	GtkStyleContext* color_button_white_context = NULL;
	GtkStyleContext* _tmp1_;
	GtkStyleContext* _tmp2_;
	GtkRadioButton* _tmp3_;
	GtkStyleContext* color_button_light_context = NULL;
	GtkStyleContext* _tmp4_;
	GtkStyleContext* _tmp5_;
	GtkRadioButton* _tmp6_;
	GtkStyleContext* color_button_dark_context = NULL;
	GtkStyleContext* _tmp7_;
	GtkStyleContext* _tmp8_;
	GtkSeparator* menu_separator = NULL;
	GtkSeparator* _tmp9_;
	GtkSeparator* menu_separator_2 = NULL;
	GtkSeparator* _tmp10_;
	GtkModelButton* notebook_new_menu_item = NULL;
	GtkModelButton* _tmp11_;
	GtkModelButton* preferences_menu_item = NULL;
	GtkModelButton* _tmp12_;
	GtkModelButton* export_pdf_menu_item = NULL;
	GtkModelButton* _tmp13_;
	GtkModelButton* export_markdown_menu_item = NULL;
	GtkModelButton* _tmp14_;
	GtkGrid* menu_grid = NULL;
	GtkGrid* _tmp15_;
	GtkPopover* menu = NULL;
	GtkPopover* _tmp16_;
	GtkMenuButton* _tmp17_;
	GtkMenuButton* _tmp18_;
	GtkImage* _tmp19_;
	GtkImage* _tmp20_;
	GtkMenuButton* _tmp21_;
	GtkMenuButton* _tmp22_;
	ENotesApplication* _tmp23_;
	ENotesApplicationState* _tmp24_;
	ENotesApplication* _tmp25_;
	ENotesApplicationState* _tmp26_;
	g_return_if_fail (self != NULL);
	_data4_ = g_slice_new0 (Block4Data);
	_data4_->_ref_count_ = 1;
	_data4_->self = g_object_ref (self);
	_tmp0_ = (GtkRadioButton*) gtk_radio_button_new (NULL);
	g_object_ref_sink (_tmp0_);
	_data4_->color_button_white = _tmp0_;
	gtk_widget_set_halign ((GtkWidget*) _data4_->color_button_white, GTK_ALIGN_CENTER);
	gtk_widget_set_tooltip_text ((GtkWidget*) _data4_->color_button_white, _ ("High Contrast"));
	_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) _data4_->color_button_white);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	color_button_white_context = _tmp2_;
	gtk_style_context_add_class (color_button_white_context, "color-button");
	gtk_style_context_add_class (color_button_white_context, "color-white");
	_tmp3_ = (GtkRadioButton*) gtk_radio_button_new_from_widget (_data4_->color_button_white);
	g_object_ref_sink (_tmp3_);
	_data4_->color_button_light = _tmp3_;
	gtk_widget_set_halign ((GtkWidget*) _data4_->color_button_light, GTK_ALIGN_CENTER);
	gtk_widget_set_tooltip_text ((GtkWidget*) _data4_->color_button_light, _ ("Solarized Light"));
	_tmp4_ = gtk_widget_get_style_context ((GtkWidget*) _data4_->color_button_light);
	_tmp5_ = _g_object_ref0 (_tmp4_);
	color_button_light_context = _tmp5_;
	gtk_style_context_add_class (color_button_light_context, "color-button");
	gtk_style_context_add_class (color_button_light_context, "color-light");
	_tmp6_ = (GtkRadioButton*) gtk_radio_button_new_from_widget (_data4_->color_button_white);
	g_object_ref_sink (_tmp6_);
	_data4_->color_button_dark = _tmp6_;
	gtk_widget_set_halign ((GtkWidget*) _data4_->color_button_dark, GTK_ALIGN_CENTER);
	gtk_widget_set_tooltip_text ((GtkWidget*) _data4_->color_button_dark, _ ("Solarized Dark"));
	_tmp7_ = gtk_widget_get_style_context ((GtkWidget*) _data4_->color_button_dark);
	_tmp8_ = _g_object_ref0 (_tmp7_);
	color_button_dark_context = _tmp8_;
	gtk_style_context_add_class (color_button_dark_context, "color-button");
	gtk_style_context_add_class (color_button_dark_context, "color-dark");
	_tmp9_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp9_);
	menu_separator = _tmp9_;
	gtk_widget_set_margin_top ((GtkWidget*) menu_separator, 12);
	_tmp10_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp10_);
	menu_separator_2 = _tmp10_;
	_tmp11_ = enotes_headerbar_model_button_entry (self, _ ("New Section"), NULL);
	notebook_new_menu_item = _tmp11_;
	_tmp12_ = enotes_headerbar_model_button_entry (self, _ ("Preferences"), NULL);
	preferences_menu_item = _tmp12_;
	_tmp13_ = enotes_headerbar_model_button_entry (self, _ ("Export as PDF"), NULL);
	export_pdf_menu_item = _tmp13_;
	_tmp14_ = enotes_headerbar_model_button_entry (self, _ ("Export as Markdown"), NULL);
	export_markdown_menu_item = _tmp14_;
	_tmp15_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp15_);
	menu_grid = _tmp15_;
	gtk_widget_set_margin_top ((GtkWidget*) menu_grid, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) menu_grid, 3);
	gtk_orientable_set_orientation ((GtkOrientable*) menu_grid, GTK_ORIENTATION_VERTICAL);
	gtk_grid_attach (menu_grid, (GtkWidget*) _data4_->color_button_white, 0, 1, 1, 1);
	gtk_grid_attach (menu_grid, (GtkWidget*) _data4_->color_button_light, 1, 1, 1, 1);
	gtk_grid_attach (menu_grid, (GtkWidget*) _data4_->color_button_dark, 2, 1, 1, 1);
	gtk_grid_attach (menu_grid, (GtkWidget*) menu_separator, 0, 2, 3, 1);
	gtk_grid_attach (menu_grid, (GtkWidget*) notebook_new_menu_item, 0, 3, 3, 1);
	gtk_grid_attach (menu_grid, (GtkWidget*) preferences_menu_item, 0, 4, 3, 1);
	gtk_grid_attach (menu_grid, (GtkWidget*) menu_separator_2, 0, 5, 3, 1);
	gtk_grid_attach (menu_grid, (GtkWidget*) export_pdf_menu_item, 0, 6, 3, 1);
	gtk_grid_attach (menu_grid, (GtkWidget*) export_markdown_menu_item, 0, 7, 3, 1);
	gtk_widget_show_all ((GtkWidget*) menu_grid);
	g_object_set ((GtkWidget*) menu_grid, "expand", TRUE, NULL);
	_tmp16_ = (GtkPopover*) gtk_popover_new (NULL);
	g_object_ref_sink (_tmp16_);
	menu = _tmp16_;
	gtk_container_add ((GtkContainer*) menu, (GtkWidget*) menu_grid);
	_tmp17_ = (GtkMenuButton*) gtk_menu_button_new ();
	g_object_ref_sink (_tmp17_);
	_g_object_unref0 (self->priv->app_menu);
	self->priv->app_menu = _tmp17_;
	_tmp18_ = self->priv->app_menu;
	_tmp19_ = (GtkImage*) gtk_image_new_from_icon_name ("open-menu", (GtkIconSize) GTK_ICON_SIZE_LARGE_TOOLBAR);
	g_object_ref_sink (_tmp19_);
	_tmp20_ = _tmp19_;
	gtk_button_set_image ((GtkButton*) _tmp18_, (GtkWidget*) _tmp20_);
	_g_object_unref0 (_tmp20_);
	_tmp21_ = self->priv->app_menu;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp21_, _ ("Menu"));
	_tmp22_ = self->priv->app_menu;
	gtk_menu_button_set_popover (_tmp22_, menu);
	_tmp23_ = enotes_app;
	_tmp24_ = _tmp23_->state;
	g_signal_connect_data ((GObject*) _tmp24_, "notify::style-scheme", (GCallback) ___lambda101__g_object_notify, block4_data_ref (_data4_), (GClosureNotify) block4_data_unref, 0);
	_tmp25_ = enotes_app;
	_tmp26_ = _tmp25_->state;
	g_signal_connect_object (_tmp26_, "file-data-changed", (GCallback) ___lambda102__enotes_application_state_file_data_changed, self, 0);
	g_signal_connect_object ((GtkButton*) _data4_->color_button_dark, "clicked", (GCallback) ___lambda103__gtk_button_clicked, self, 0);
	g_signal_connect_object ((GtkButton*) _data4_->color_button_light, "clicked", (GCallback) ___lambda104__gtk_button_clicked, self, 0);
	g_signal_connect_object ((GtkButton*) _data4_->color_button_white, "clicked", (GCallback) ___lambda105__gtk_button_clicked, self, 0);
	g_signal_connect_object ((GtkButton*) export_pdf_menu_item, "clicked", (GCallback) ___lambda106__gtk_button_clicked, self, 0);
	g_signal_connect_object ((GtkButton*) export_markdown_menu_item, "clicked", (GCallback) ___lambda107__gtk_button_clicked, self, 0);
	g_signal_connect_object ((GtkButton*) notebook_new_menu_item, "clicked", (GCallback) ___lambda108__gtk_button_clicked, self, 0);
	g_signal_connect_object ((GtkButton*) preferences_menu_item, "clicked", (GCallback) ___lambda109__gtk_button_clicked, self, 0);
	_g_object_unref0 (menu);
	_g_object_unref0 (menu_grid);
	_g_object_unref0 (export_markdown_menu_item);
	_g_object_unref0 (export_pdf_menu_item);
	_g_object_unref0 (preferences_menu_item);
	_g_object_unref0 (notebook_new_menu_item);
	_g_object_unref0 (menu_separator_2);
	_g_object_unref0 (menu_separator);
	_g_object_unref0 (color_button_dark_context);
	_g_object_unref0 (color_button_light_context);
	_g_object_unref0 (color_button_white_context);
	block4_data_unref (_data4_);
	_data4_ = NULL;
}

void
enotes_headerbar_set_mode (ENotesHeaderbar* self,
                           ENotesMode mode)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	GraniteWidgetsModeButton* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	enotes_application_state_set_mode (_tmp1_, mode);
	_tmp2_ = self->priv->mode_button;
	granite_widgets_mode_button_set_active (_tmp2_, (gint) mode);
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static void
enotes_headerbar_set_title_from_data (ENotesHeaderbar* self,
                                      const gchar* page_title,
                                      const gchar* notebook_title)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	g_return_if_fail (self != NULL);
	if (page_title != NULL) {
		_tmp0_ = notebook_title != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp1_ = g_strconcat (page_title, " - ", NULL);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_strconcat (_tmp2_, notebook_title, NULL);
		_tmp4_ = _tmp3_;
		gtk_header_bar_set_title ((GtkHeaderBar*) self, _tmp4_);
		_g_free0 (_tmp4_);
		_g_free0 (_tmp2_);
	} else {
		if (page_title != NULL) {
			gtk_header_bar_set_title ((GtkHeaderBar*) self, page_title);
		} else {
			if (notebook_title != NULL) {
				gtk_header_bar_set_title ((GtkHeaderBar*) self, notebook_title);
			} else {
				gtk_header_bar_set_title ((GtkHeaderBar*) self, NULL);
			}
		}
	}
	_tmp5_ = gtk_header_bar_get_title ((GtkHeaderBar*) self);
	_tmp6_ = _tmp5_;
	_tmp7_ = string_replace (_tmp6_, "&amp;", "&");
	_tmp8_ = _tmp7_;
	gtk_header_bar_set_title ((GtkHeaderBar*) self, _tmp8_);
	_g_free0 (_tmp8_);
}

static void
__lambda121_ (ENotesHeaderbar* self,
              GtkWidget* widget)
{
	GraniteWidgetsModeButton* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->mode_button;
	_tmp1_ = granite_widgets_mode_button_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == 0) {
		ENotesApplication* _tmp3_;
		ENotesApplicationState* _tmp4_;
		_tmp3_ = enotes_app;
		_tmp4_ = _tmp3_->state;
		enotes_application_state_set_mode (_tmp4_, ENOTES_MODE_VIEW);
	} else {
		GraniteWidgetsModeButton* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		_tmp5_ = self->priv->mode_button;
		_tmp6_ = granite_widgets_mode_button_get_selected (_tmp5_);
		_tmp7_ = _tmp6_;
		if (_tmp7_ == 1) {
			ENotesApplication* _tmp8_;
			ENotesApplicationState* _tmp9_;
			_tmp8_ = enotes_app;
			_tmp9_ = _tmp8_->state;
			enotes_application_state_set_mode (_tmp9_, ENOTES_MODE_BOTH);
		} else {
			ENotesApplication* _tmp10_;
			ENotesApplicationState* _tmp11_;
			_tmp10_ = enotes_app;
			_tmp11_ = _tmp10_->state;
			enotes_application_state_set_mode (_tmp11_, ENOTES_MODE_EDIT);
		}
	}
}

static void
___lambda121__granite_widgets_mode_button_mode_changed (GraniteWidgetsModeButton* _sender,
                                                        GtkWidget* widget,
                                                        gpointer self)
{
	__lambda121_ ((ENotesHeaderbar*) self, widget);
}

static void
__lambda122_ (ENotesHeaderbar* self)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	g_signal_emit_by_name (_tmp1_, "search-selected");
}

static void
___lambda122__enotes_button_entry_activated (ENotesButtonEntry* _sender,
                                             gpointer self)
{
	__lambda122_ ((ENotesHeaderbar*) self);
}

static void
__lambda123_ (ENotesHeaderbar* self,
              const gchar* text)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	g_return_if_fail (text != NULL);
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	enotes_application_state_set_search_field (_tmp1_, text);
}

static void
___lambda123__enotes_button_entry_changed (ENotesButtonEntry* _sender,
                                           const gchar* text,
                                           gpointer self)
{
	__lambda123_ ((ENotesHeaderbar*) self, text);
}

static void
__lambda124_ (ENotesHeaderbar* self)
{
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	ENotesMode _tmp2_;
	ENotesMode _tmp3_;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	_tmp2_ = enotes_application_state_get_mode (_tmp1_);
	_tmp3_ = _tmp2_;
	switch (_tmp3_) {
		case ENOTES_MODE_VIEW:
		{
			GraniteWidgetsModeButton* _tmp4_;
			_tmp4_ = self->priv->mode_button;
			granite_widgets_mode_button_set_active (_tmp4_, 0);
			return;
		}
		case ENOTES_MODE_BOTH:
		{
			GraniteWidgetsModeButton* _tmp5_;
			_tmp5_ = self->priv->mode_button;
			granite_widgets_mode_button_set_active (_tmp5_, 1);
			return;
		}
		case ENOTES_MODE_EDIT:
		{
			GraniteWidgetsModeButton* _tmp6_;
			_tmp6_ = self->priv->mode_button;
			granite_widgets_mode_button_set_active (_tmp6_, 2);
			return;
		}
		default:
		break;
	}
}

static void
___lambda124__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	__lambda124_ ((ENotesHeaderbar*) self);
}

static void
__lambda125_ (ENotesHeaderbar* self)
{
	ENotesNotebook* notebook = NULL;
	ENotesApplication* _tmp0_;
	ENotesApplicationState* _tmp1_;
	ENotesNotebook* _tmp2_;
	ENotesNotebook* _tmp3_;
	ENotesNotebook* _tmp4_;
	ENotesPage* page = NULL;
	ENotesApplication* _tmp5_;
	ENotesApplicationState* _tmp6_;
	ENotesPage* _tmp7_;
	ENotesPage* _tmp8_;
	ENotesPage* _tmp9_;
	const gchar* _tmp10_ = NULL;
	ENotesPage* _tmp11_;
	const gchar* _tmp14_ = NULL;
	ENotesNotebook* _tmp15_;
	_tmp0_ = enotes_app;
	_tmp1_ = _tmp0_->state;
	_tmp2_ = enotes_application_state_get_opened_page_notebook (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	notebook = _tmp4_;
	_tmp5_ = enotes_app;
	_tmp6_ = _tmp5_->state;
	_tmp7_ = enotes_application_state_get_opened_page (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _g_object_ref0 (_tmp8_);
	page = _tmp9_;
	_tmp11_ = page;
	if (_tmp11_ != NULL) {
		ENotesPage* _tmp12_;
		const gchar* _tmp13_;
		_tmp12_ = page;
		_tmp13_ = _tmp12_->name;
		_tmp10_ = _tmp13_;
	} else {
		_tmp10_ = NULL;
	}
	_tmp15_ = notebook;
	if (_tmp15_ != NULL) {
		ENotesNotebook* _tmp16_;
		const gchar* _tmp17_;
		_tmp16_ = notebook;
		_tmp17_ = _tmp16_->name;
		_tmp14_ = _tmp17_;
	} else {
		_tmp14_ = NULL;
	}
	enotes_headerbar_set_title_from_data (self, _tmp10_, _tmp14_);
	_g_object_unref0 (page);
	_g_object_unref0 (notebook);
}

static void
___lambda125__enotes_application_state_update_page_title (ENotesApplicationState* _sender,
                                                          gpointer self)
{
	__lambda125_ ((ENotesHeaderbar*) self);
}

static void
__lambda126_ (ENotesHeaderbar* self)
{
	enotes_headerbar_set_title_from_data (self, NULL, NULL);
}

static void
___lambda126__enotes_application_state_page_deleted (ENotesApplicationState* _sender,
                                                     gpointer self)
{
	__lambda126_ ((ENotesHeaderbar*) self);
}

static void
enotes_headerbar_connect_signals (ENotesHeaderbar* self)
{
	GraniteWidgetsModeButton* _tmp0_;
	ENotesButtonEntry* _tmp1_;
	ENotesButtonEntry* _tmp2_;
	ENotesApplication* _tmp3_;
	ENotesApplicationState* _tmp4_;
	ENotesApplication* _tmp5_;
	ENotesApplicationState* _tmp6_;
	ENotesApplication* _tmp7_;
	ENotesApplicationState* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->mode_button;
	g_signal_connect_object (_tmp0_, "mode-changed", (GCallback) ___lambda121__granite_widgets_mode_button_mode_changed, self, 0);
	_tmp1_ = self->priv->search_entry;
	g_signal_connect_object (_tmp1_, "activated", (GCallback) ___lambda122__enotes_button_entry_activated, self, 0);
	_tmp2_ = self->priv->search_entry;
	g_signal_connect_object (_tmp2_, "changed", (GCallback) ___lambda123__enotes_button_entry_changed, self, 0);
	_tmp3_ = enotes_app;
	_tmp4_ = _tmp3_->state;
	g_signal_connect_object ((GObject*) _tmp4_, "notify::mode", (GCallback) ___lambda124__g_object_notify, self, 0);
	_tmp5_ = enotes_app;
	_tmp6_ = _tmp5_->state;
	g_signal_connect_object (_tmp6_, "update-page-title", (GCallback) ___lambda125__enotes_application_state_update_page_title, self, 0);
	_tmp7_ = enotes_app;
	_tmp8_ = _tmp7_->state;
	g_signal_connect_object (_tmp8_, "page-deleted", (GCallback) ___lambda126__enotes_application_state_page_deleted, self, 0);
}

void
enotes_headerbar_show_search (ENotesHeaderbar* self)
{
	ENotesButtonEntry* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->search_entry;
	enotes_button_entry_show_entry (_tmp0_);
}

static void
enotes_headerbar_class_init (ENotesHeaderbarClass * klass,
                             gpointer klass_data)
{
	enotes_headerbar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ENotesHeaderbar_private_offset);
	G_OBJECT_CLASS (klass)->finalize = enotes_headerbar_finalize;
}

static void
enotes_headerbar_instance_init (ENotesHeaderbar * self,
                                gpointer klass)
{
	self->priv = enotes_headerbar_get_instance_private (self);
}

static void
enotes_headerbar_finalize (GObject * obj)
{
	ENotesHeaderbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_HEADERBAR, ENotesHeaderbar);
	_g_object_unref0 (self->bookmark_button);
	_g_object_unref0 (self->priv->mode_button);
	_g_object_unref0 (self->priv->app_menu);
	_g_object_unref0 (self->priv->panel_picker_menu);
	_g_object_unref0 (self->priv->search_entry);
	_g_object_unref0 (self->gesture);
	G_OBJECT_CLASS (enotes_headerbar_parent_class)->finalize (obj);
}

static GType
enotes_headerbar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ENotesHeaderbarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) enotes_headerbar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ENotesHeaderbar), 0, (GInstanceInitFunc) enotes_headerbar_instance_init, NULL };
	GType enotes_headerbar_type_id;
	enotes_headerbar_type_id = g_type_register_static (gtk_header_bar_get_type (), "ENotesHeaderbar", &g_define_type_info, 0);
	ENotesHeaderbar_private_offset = g_type_add_instance_private (enotes_headerbar_type_id, sizeof (ENotesHeaderbarPrivate));
	return enotes_headerbar_type_id;
}

GType
enotes_headerbar_get_type (void)
{
	static volatile gsize enotes_headerbar_type_id__once = 0;
	if (g_once_init_enter (&enotes_headerbar_type_id__once)) {
		GType enotes_headerbar_type_id;
		enotes_headerbar_type_id = enotes_headerbar_get_type_once ();
		g_once_init_leave (&enotes_headerbar_type_id__once, enotes_headerbar_type_id);
	}
	return enotes_headerbar_type_id__once;
}

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

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

