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

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

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define ENOTES_TYPE_NOTEBOOK_LIST_DIALOG (enotes_notebook_list_dialog_get_type ())
#define ENOTES_NOTEBOOK_LIST_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_NOTEBOOK_LIST_DIALOG, ENotesNotebookListDialog))
#define ENOTES_NOTEBOOK_LIST_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_NOTEBOOK_LIST_DIALOG, ENotesNotebookListDialogClass))
#define ENOTES_IS_NOTEBOOK_LIST_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_NOTEBOOK_LIST_DIALOG))
#define ENOTES_IS_NOTEBOOK_LIST_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_NOTEBOOK_LIST_DIALOG))
#define ENOTES_NOTEBOOK_LIST_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_NOTEBOOK_LIST_DIALOG, ENotesNotebookListDialogClass))

typedef struct _ENotesNotebookListDialog ENotesNotebookListDialog;
typedef struct _ENotesNotebookListDialogClass ENotesNotebookListDialogClass;
typedef struct _ENotesNotebookListDialogPrivate ENotesNotebookListDialogPrivate;
enum  {
	ENOTES_NOTEBOOK_LIST_DIALOG_0_PROPERTY,
	ENOTES_NOTEBOOK_LIST_DIALOG_NUM_PROPERTIES
};
static GParamSpec* enotes_notebook_list_dialog_properties[ENOTES_NOTEBOOK_LIST_DIALOG_NUM_PROPERTIES];

#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 GRANITE_WIDGETS_TYPE_SOURCE_LIST_PATCH (granite_widgets_source_list_patch_get_type ())
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRANITE_WIDGETS_TYPE_SOURCE_LIST_PATCH, GraniteWidgetsSourceListPatch))
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRANITE_WIDGETS_TYPE_SOURCE_LIST_PATCH, GraniteWidgetsSourceListPatchClass))
#define GRANITE_WIDGETS_IS_SOURCE_LIST_PATCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRANITE_WIDGETS_TYPE_SOURCE_LIST_PATCH))
#define GRANITE_WIDGETS_IS_SOURCE_LIST_PATCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRANITE_WIDGETS_TYPE_SOURCE_LIST_PATCH))
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRANITE_WIDGETS_TYPE_SOURCE_LIST_PATCH, GraniteWidgetsSourceListPatchClass))

typedef struct _GraniteWidgetsSourceListPatch GraniteWidgetsSourceListPatch;
typedef struct _GraniteWidgetsSourceListPatchClass GraniteWidgetsSourceListPatchClass;

#define ENOTES_TYPE_SIDEBAR (enotes_sidebar_get_type ())
#define ENOTES_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_SIDEBAR, ENotesSidebar))
#define ENOTES_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_SIDEBAR, ENotesSidebarClass))
#define ENOTES_IS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_SIDEBAR))
#define ENOTES_IS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_SIDEBAR))
#define ENOTES_SIDEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_SIDEBAR, ENotesSidebarClass))

typedef struct _ENotesSidebar ENotesSidebar;
typedef struct _ENotesSidebarClass ENotesSidebarClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block8Data Block8Data;

#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_ITEM (granite_widgets_source_list_patch_item_get_type ())
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_ITEM, GraniteWidgetsSourceListPatchItem))
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_ITEM, GraniteWidgetsSourceListPatchItemClass))
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_ITEM))
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_ITEM))
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_ITEM, GraniteWidgetsSourceListPatchItemClass))

typedef struct _GraniteWidgetsSourceListPatchItem GraniteWidgetsSourceListPatchItem;
typedef struct _GraniteWidgetsSourceListPatchItemClass GraniteWidgetsSourceListPatchItemClass;

#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_EXPANDABLE_ITEM (granite_widgets_source_list_patch_expandable_item_get_type ())
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_EXPANDABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_EXPANDABLE_ITEM, GraniteWidgetsSourceListPatchExpandableItem))
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_EXPANDABLE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_EXPANDABLE_ITEM, GraniteWidgetsSourceListPatchExpandableItemClass))
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_IS_EXPANDABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_EXPANDABLE_ITEM))
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_IS_EXPANDABLE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_EXPANDABLE_ITEM))
#define GRANITE_WIDGETS_SOURCE_LIST_PATCH_EXPANDABLE_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_EXPANDABLE_ITEM, GraniteWidgetsSourceListPatchExpandableItemClass))

typedef struct _GraniteWidgetsSourceListPatchExpandableItem GraniteWidgetsSourceListPatchExpandableItem;
typedef struct _GraniteWidgetsSourceListPatchExpandableItemClass GraniteWidgetsSourceListPatchExpandableItemClass;

#define ENOTES_TYPE_SIDEBAR_ITEM (enotes_sidebar_item_get_type ())
#define ENOTES_SIDEBAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_SIDEBAR_ITEM, ENotesSidebarItem))
#define ENOTES_SIDEBAR_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_SIDEBAR_ITEM, ENotesSidebarItemClass))
#define ENOTES_IS_SIDEBAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_SIDEBAR_ITEM))
#define ENOTES_IS_SIDEBAR_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_SIDEBAR_ITEM))
#define ENOTES_SIDEBAR_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_SIDEBAR_ITEM, ENotesSidebarItemClass))

typedef struct _ENotesSidebarItem ENotesSidebarItem;
typedef struct _ENotesSidebarItemClass ENotesSidebarItemClass;

#define ENOTES_TYPE_NOTEBOOK_ITEM (enotes_notebook_item_get_type ())
#define ENOTES_NOTEBOOK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_NOTEBOOK_ITEM, ENotesNotebookItem))
#define ENOTES_NOTEBOOK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_NOTEBOOK_ITEM, ENotesNotebookItemClass))
#define ENOTES_IS_NOTEBOOK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_NOTEBOOK_ITEM))
#define ENOTES_IS_NOTEBOOK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_NOTEBOOK_ITEM))
#define ENOTES_NOTEBOOK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_NOTEBOOK_ITEM, ENotesNotebookItemClass))

typedef struct _ENotesNotebookItem ENotesNotebookItem;
typedef struct _ENotesNotebookItemClass ENotesNotebookItemClass;

#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_NOTEBOOK_TABLE (enotes_notebook_table_get_type ())
#define ENOTES_NOTEBOOK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_NOTEBOOK_TABLE, ENotesNotebookTable))
#define ENOTES_NOTEBOOK_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_NOTEBOOK_TABLE, ENotesNotebookTableClass))
#define ENOTES_IS_NOTEBOOK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_NOTEBOOK_TABLE))
#define ENOTES_IS_NOTEBOOK_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_NOTEBOOK_TABLE))
#define ENOTES_NOTEBOOK_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_NOTEBOOK_TABLE, ENotesNotebookTableClass))

typedef struct _ENotesNotebookTable ENotesNotebookTable;
typedef struct _ENotesNotebookTableClass ENotesNotebookTableClass;
#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_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;
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;

#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 _Block9Data Block9Data;
typedef struct _ENotesNotebookPrivate ENotesNotebookPrivate;

#define ENOTES_TYPE_PAGE_TABLE (enotes_page_table_get_type ())
#define ENOTES_PAGE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_PAGE_TABLE, ENotesPageTable))
#define ENOTES_PAGE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_PAGE_TABLE, ENotesPageTableClass))
#define ENOTES_IS_PAGE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_PAGE_TABLE))
#define ENOTES_IS_PAGE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_PAGE_TABLE))
#define ENOTES_PAGE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_PAGE_TABLE, ENotesPageTableClass))

typedef struct _ENotesPageTable ENotesPageTable;
typedef struct _ENotesPageTableClass ENotesPageTableClass;
typedef struct _ENotesPagePrivate ENotesPagePrivate;

#define ENOTES_TYPE_WINDOW (enotes_window_get_type ())
#define ENOTES_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_WINDOW, ENotesWindow))
#define ENOTES_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_WINDOW, ENotesWindowClass))
#define ENOTES_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_WINDOW))
#define ENOTES_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_WINDOW))
#define ENOTES_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_WINDOW, ENotesWindowClass))

typedef struct _ENotesWindow ENotesWindow;
typedef struct _ENotesWindowClass ENotesWindowClass;

struct _ENotesNotebookListDialog {
	GtkDialog parent_instance;
	ENotesNotebookListDialogPrivate * priv;
};

struct _ENotesNotebookListDialogClass {
	GtkDialogClass parent_class;
};

struct _Block8Data {
	int _ref_count_;
	ENotesNotebookListDialog* self;
	ENotesSidebar* notebook_list;
	ENotesNotebook* notebook;
};

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

struct _ENotesApplicationClass {
	GraniteApplicationClass parent_class;
};

struct _Block9Data {
	int _ref_count_;
	ENotesNotebookListDialog* self;
	ENotesSidebar* notebook_list;
	ENotesPage* page_to_move;
};

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

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

static gpointer enotes_notebook_list_dialog_parent_class = NULL;
VALA_EXTERN ENotesApplication* enotes_app;

VALA_EXTERN GType enotes_notebook_list_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesNotebookListDialog, 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 ENotesNotebookListDialog* enotes_notebook_list_dialog_new (ENotesNotebook* notebook);
VALA_EXTERN ENotesNotebookListDialog* enotes_notebook_list_dialog_construct (GType object_type,
                                                                 ENotesNotebook* notebook);
VALA_EXTERN GType granite_widgets_source_list_patch_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GraniteWidgetsSourceListPatch, g_object_unref)
VALA_EXTERN GType enotes_sidebar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesSidebar, g_object_unref)
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
VALA_EXTERN ENotesSidebar* enotes_sidebar_new_notebook_list (ENotesNotebook* to_ignore);
VALA_EXTERN ENotesSidebar* enotes_sidebar_construct_notebook_list (GType object_type,
                                                       ENotesNotebook* to_ignore);
static void __lambda64_ (Block8Data* _data8_,
                  gint ID);
VALA_EXTERN GType granite_widgets_source_list_patch_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GraniteWidgetsSourceListPatchItem, g_object_unref)
VALA_EXTERN GType granite_widgets_source_list_patch_expandable_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GraniteWidgetsSourceListPatchExpandableItem, g_object_unref)
VALA_EXTERN GType enotes_sidebar_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesSidebarItem, g_object_unref)
VALA_EXTERN GType enotes_notebook_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesNotebookItem, g_object_unref)
VALA_EXTERN GraniteWidgetsSourceListPatchItem* granite_widgets_source_list_patch_get_selected (GraniteWidgetsSourceListPatch* self);
VALA_EXTERN ENotesNotebook* enotes_notebook_item_get_notebook (ENotesNotebookItem* 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_notebook_table_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesNotebookTable, database_table_unref)
VALA_EXTERN ENotesNotebookTable* enotes_notebook_table_get_instance (void);
VALA_EXTERN void enotes_notebook_table_move_notebook (ENotesNotebookTable* self,
                                          ENotesNotebook* notebook,
                                          ENotesNotebook* parent_notebook);
VALA_EXTERN GType enotes_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesApplication, g_object_unref)
VALA_EXTERN GType enotes_application_state_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesApplicationState, g_object_unref)
static void ___lambda64__gtk_dialog_response (GtkDialog* _sender,
                                       gint response_id,
                                       gpointer self);
VALA_EXTERN GType enotes_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesPage, g_object_unref)
VALA_EXTERN ENotesNotebookListDialog* enotes_notebook_list_dialog_new_to_move_page (ENotesPage* page_to_move);
VALA_EXTERN ENotesNotebookListDialog* enotes_notebook_list_dialog_construct_to_move_page (GType object_type,
                                                                              ENotesPage* page_to_move);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static void __lambda65_ (Block9Data* _data9_,
                  gint ID);
VALA_EXTERN GType enotes_page_table_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesPageTable, database_table_unref)
VALA_EXTERN ENotesPageTable* enotes_page_table_get_instance (void);
VALA_EXTERN void enotes_page_table_move_to_notebook (ENotesPageTable* self,
                                         ENotesPage* page,
                                         gint64 notebook);
VALA_EXTERN void enotes_application_state_open_page (ENotesApplicationState* self,
                                         gint64 page_id);
static void ___lambda65__gtk_dialog_response (GtkDialog* _sender,
                                       gint response_id,
                                       gpointer self);
static GObject * enotes_notebook_list_dialog_constructor (GType type,
                                                   guint n_construct_properties,
                                                   GObjectConstructParam * construct_properties);
VALA_EXTERN GType enotes_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesWindow, g_object_unref)
VALA_EXTERN ENotesWindow* enotes_application_get_app_window (ENotesApplication* self);
static GType enotes_notebook_list_dialog_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

static Block8Data*
block8_data_ref (Block8Data* _data8_)
{
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		ENotesNotebookListDialog* self;
		self = _data8_->self;
		_g_object_unref0 (_data8_->notebook_list);
		_g_object_unref0 (_data8_->notebook);
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

static void
__lambda64_ (Block8Data* _data8_,
             gint ID)
{
	ENotesNotebookListDialog* self;
	self = _data8_->self;
	switch (ID) {
		case 1:
		{
			break;
		}
		case 2:
		{
			ENotesNotebookItem* item = NULL;
			GraniteWidgetsSourceListPatchItem* _tmp0_;
			GraniteWidgetsSourceListPatchItem* _tmp1_;
			ENotesNotebookItem* _tmp2_;
			ENotesNotebook* parent_notebook = NULL;
			ENotesNotebookItem* _tmp3_;
			ENotesNotebookTable* _tmp8_;
			ENotesNotebookTable* _tmp9_;
			ENotesNotebook* _tmp10_;
			ENotesApplication* _tmp11_;
			ENotesApplicationState* _tmp12_;
			_tmp0_ = granite_widgets_source_list_patch_get_selected ((GraniteWidgetsSourceListPatch*) _data8_->notebook_list);
			_tmp1_ = _tmp0_;
			_tmp2_ = _g_object_ref0 (ENOTES_IS_NOTEBOOK_ITEM (_tmp1_) ? ((ENotesNotebookItem*) _tmp1_) : NULL);
			item = _tmp2_;
			parent_notebook = NULL;
			_tmp3_ = item;
			if (_tmp3_ != NULL) {
				ENotesNotebookItem* _tmp4_;
				ENotesNotebook* _tmp5_;
				ENotesNotebook* _tmp6_;
				ENotesNotebook* _tmp7_;
				_tmp4_ = item;
				_tmp5_ = enotes_notebook_item_get_notebook (_tmp4_);
				_tmp6_ = _tmp5_;
				_tmp7_ = _g_object_ref0 (_tmp6_);
				_g_object_unref0 (parent_notebook);
				parent_notebook = _tmp7_;
			}
			_tmp8_ = enotes_notebook_table_get_instance ();
			_tmp9_ = _tmp8_;
			_tmp10_ = parent_notebook;
			enotes_notebook_table_move_notebook (_tmp9_, _data8_->notebook, _tmp10_);
			_database_table_unref0 (_tmp9_);
			_tmp11_ = enotes_app;
			_tmp12_ = _tmp11_->state;
			g_signal_emit_by_name (_tmp12_, "opened-notebook-updated");
			_g_object_unref0 (parent_notebook);
			_g_object_unref0 (item);
			break;
		}
		default:
		break;
	}
	g_signal_emit_by_name ((GtkDialog*) self, "close");
}

static void
___lambda64__gtk_dialog_response (GtkDialog* _sender,
                                  gint response_id,
                                  gpointer self)
{
	__lambda64_ (self, response_id);
}

ENotesNotebookListDialog*
enotes_notebook_list_dialog_construct (GType object_type,
                                       ENotesNotebook* notebook)
{
	ENotesNotebookListDialog * self = NULL;
	Block8Data* _data8_;
	ENotesNotebook* _tmp0_;
	ENotesSidebar* _tmp1_;
	GtkBox* _tmp2_;
	GtkButton* move = NULL;
	GtkWidget* _tmp3_;
	GtkButton* _tmp4_;
	GtkStyleContext* _tmp5_;
	g_return_val_if_fail (notebook != NULL, NULL);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (notebook);
	_g_object_unref0 (_data8_->notebook);
	_data8_->notebook = _tmp0_;
	self = (ENotesNotebookListDialog*) g_object_new (object_type, NULL);
	_data8_->self = g_object_ref (self);
	gtk_window_set_title ((GtkWindow*) self, _ ("Move Notebook"));
	_tmp1_ = enotes_sidebar_new_notebook_list (_data8_->notebook);
	g_object_ref_sink (_tmp1_);
	_data8_->notebook_list = _tmp1_;
	g_object_set ((GtkWidget*) _data8_->notebook_list, "margin", 12, NULL);
	_tmp2_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	gtk_container_add ((GtkContainer*) _tmp2_, (GtkWidget*) _data8_->notebook_list);
	gtk_widget_show_all ((GtkWidget*) self);
	gtk_widget_show ((GtkWidget*) self);
	gtk_dialog_add_button ((GtkDialog*) self, _ ("Cancel"), 1);
	_tmp3_ = gtk_dialog_add_button ((GtkDialog*) self, _ ("Move"), 2);
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_button_get_type (), GtkButton));
	move = _tmp4_;
	_tmp5_ = gtk_widget_get_style_context ((GtkWidget*) move);
	gtk_style_context_add_class (_tmp5_, "suggested-action");
	g_signal_connect_data ((GtkDialog*) self, "response", (GCallback) ___lambda64__gtk_dialog_response, block8_data_ref (_data8_), (GClosureNotify) block8_data_unref, 0);
	_g_object_unref0 (move);
	block8_data_unref (_data8_);
	_data8_ = NULL;
	return self;
}

ENotesNotebookListDialog*
enotes_notebook_list_dialog_new (ENotesNotebook* notebook)
{
	return enotes_notebook_list_dialog_construct (ENOTES_TYPE_NOTEBOOK_LIST_DIALOG, notebook);
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		ENotesNotebookListDialog* self;
		self = _data9_->self;
		_g_object_unref0 (_data9_->notebook_list);
		_g_object_unref0 (_data9_->page_to_move);
		_g_object_unref0 (self);
		g_slice_free (Block9Data, _data9_);
	}
}

static void
__lambda65_ (Block9Data* _data9_,
             gint ID)
{
	ENotesNotebookListDialog* self;
	self = _data9_->self;
	switch (ID) {
		case 1:
		{
			break;
		}
		case 2:
		{
			ENotesNotebookItem* item = NULL;
			GraniteWidgetsSourceListPatchItem* _tmp0_;
			GraniteWidgetsSourceListPatchItem* _tmp1_;
			ENotesNotebookItem* _tmp2_;
			gint64 notebook_id = 0LL;
			ENotesNotebookItem* _tmp3_;
			ENotesPageTable* _tmp7_;
			ENotesPageTable* _tmp8_;
			ENotesApplication* _tmp9_;
			ENotesApplicationState* _tmp10_;
			ENotesApplication* _tmp11_;
			ENotesApplicationState* _tmp12_;
			_tmp0_ = granite_widgets_source_list_patch_get_selected ((GraniteWidgetsSourceListPatch*) _data9_->notebook_list);
			_tmp1_ = _tmp0_;
			_tmp2_ = _g_object_ref0 (ENOTES_IS_NOTEBOOK_ITEM (_tmp1_) ? ((ENotesNotebookItem*) _tmp1_) : NULL);
			item = _tmp2_;
			notebook_id = (gint64) 0;
			_tmp3_ = item;
			if (_tmp3_ != NULL) {
				ENotesNotebookItem* _tmp4_;
				ENotesNotebook* _tmp5_;
				ENotesNotebook* _tmp6_;
				_tmp4_ = item;
				_tmp5_ = enotes_notebook_item_get_notebook (_tmp4_);
				_tmp6_ = _tmp5_;
				notebook_id = _tmp6_->id;
			}
			_tmp7_ = enotes_page_table_get_instance ();
			_tmp8_ = _tmp7_;
			enotes_page_table_move_to_notebook (_tmp8_, _data9_->page_to_move, notebook_id);
			_database_table_unref0 (_tmp8_);
			_tmp9_ = enotes_app;
			_tmp10_ = _tmp9_->state;
			enotes_application_state_open_page (_tmp10_, _data9_->page_to_move->id);
			_tmp11_ = enotes_app;
			_tmp12_ = _tmp11_->state;
			g_signal_emit_by_name (_tmp12_, "notebook-contents-changed");
			_g_object_unref0 (item);
			break;
		}
		default:
		break;
	}
	g_signal_emit_by_name ((GtkDialog*) self, "close");
}

static void
___lambda65__gtk_dialog_response (GtkDialog* _sender,
                                  gint response_id,
                                  gpointer self)
{
	__lambda65_ (self, response_id);
}

ENotesNotebookListDialog*
enotes_notebook_list_dialog_construct_to_move_page (GType object_type,
                                                    ENotesPage* page_to_move)
{
	ENotesNotebookListDialog * self = NULL;
	Block9Data* _data9_;
	ENotesPage* _tmp0_;
	ENotesSidebar* _tmp1_;
	GtkBox* _tmp2_;
	GtkButton* move = NULL;
	GtkWidget* _tmp3_;
	GtkButton* _tmp4_;
	GtkStyleContext* _tmp5_;
	g_return_val_if_fail (page_to_move != NULL, NULL);
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (page_to_move);
	_g_object_unref0 (_data9_->page_to_move);
	_data9_->page_to_move = _tmp0_;
	self = (ENotesNotebookListDialog*) g_object_new (object_type, NULL);
	_data9_->self = g_object_ref (self);
	gtk_window_set_title ((GtkWindow*) self, _ ("Move Page"));
	_tmp1_ = enotes_sidebar_new_notebook_list (NULL);
	g_object_ref_sink (_tmp1_);
	_data9_->notebook_list = _tmp1_;
	g_object_set ((GtkWidget*) _data9_->notebook_list, "margin", 12, NULL);
	_tmp2_ = gtk_dialog_get_content_area ((GtkDialog*) self);
	gtk_container_add ((GtkContainer*) _tmp2_, (GtkWidget*) _data9_->notebook_list);
	gtk_widget_show_all ((GtkWidget*) self);
	gtk_widget_show ((GtkWidget*) self);
	gtk_dialog_add_button ((GtkDialog*) self, _ ("Cancel"), 1);
	_tmp3_ = gtk_dialog_add_button ((GtkDialog*) self, _ ("Move"), 2);
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_button_get_type (), GtkButton));
	move = _tmp4_;
	_tmp5_ = gtk_widget_get_style_context ((GtkWidget*) move);
	gtk_style_context_add_class (_tmp5_, "suggested-action");
	g_signal_connect_data ((GtkDialog*) self, "response", (GCallback) ___lambda65__gtk_dialog_response, block9_data_ref (_data9_), (GClosureNotify) block9_data_unref, 0);
	_g_object_unref0 (move);
	block9_data_unref (_data9_);
	_data9_ = NULL;
	return self;
}

ENotesNotebookListDialog*
enotes_notebook_list_dialog_new_to_move_page (ENotesPage* page_to_move)
{
	return enotes_notebook_list_dialog_construct_to_move_page (ENOTES_TYPE_NOTEBOOK_LIST_DIALOG, page_to_move);
}

static GObject *
enotes_notebook_list_dialog_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ENotesNotebookListDialog * self;
	ENotesApplication* _tmp0_;
	ENotesWindow* _tmp1_;
	ENotesWindow* _tmp2_;
	parent_class = G_OBJECT_CLASS (enotes_notebook_list_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_NOTEBOOK_LIST_DIALOG, ENotesNotebookListDialog);
	gtk_widget_set_size_request ((GtkWidget*) self, 450, 600);
	_tmp0_ = enotes_app;
	_tmp1_ = enotes_application_get_app_window (_tmp0_);
	_tmp2_ = _tmp1_;
	gtk_window_set_transient_for ((GtkWindow*) self, (GtkWindow*) _tmp2_);
	_g_object_unref0 (_tmp2_);
	gtk_window_set_modal ((GtkWindow*) self, TRUE);
	return obj;
}

static void
enotes_notebook_list_dialog_class_init (ENotesNotebookListDialogClass * klass,
                                        gpointer klass_data)
{
	enotes_notebook_list_dialog_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = enotes_notebook_list_dialog_constructor;
}

static void
enotes_notebook_list_dialog_instance_init (ENotesNotebookListDialog * self,
                                           gpointer klass)
{
}

static GType
enotes_notebook_list_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ENotesNotebookListDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) enotes_notebook_list_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ENotesNotebookListDialog), 0, (GInstanceInitFunc) enotes_notebook_list_dialog_instance_init, NULL };
	GType enotes_notebook_list_dialog_type_id;
	enotes_notebook_list_dialog_type_id = g_type_register_static (gtk_dialog_get_type (), "ENotesNotebookListDialog", &g_define_type_info, 0);
	return enotes_notebook_list_dialog_type_id;
}

GType
enotes_notebook_list_dialog_get_type (void)
{
	static volatile gsize enotes_notebook_list_dialog_type_id__once = 0;
	if (g_once_init_enter (&enotes_notebook_list_dialog_type_id__once)) {
		GType enotes_notebook_list_dialog_type_id;
		enotes_notebook_list_dialog_type_id = enotes_notebook_list_dialog_get_type_once ();
		g_once_init_leave (&enotes_notebook_list_dialog_type_id__once, enotes_notebook_list_dialog_type_id);
	}
	return enotes_notebook_list_dialog_type_id__once;
}

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

