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

/*
* Copyright (c) 2011-2016 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 <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <glib/gi18n-lib.h>
#include <granite.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 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;
typedef struct _GraniteWidgetsSourceListPatchItemPrivate GraniteWidgetsSourceListPatchItemPrivate;

#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;
typedef struct _GraniteWidgetsSourceListPatchExpandableItemPrivate GraniteWidgetsSourceListPatchExpandableItemPrivate;

#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;
typedef struct _ENotesSidebarItemPrivate ENotesSidebarItemPrivate;

#define ENOTES_TYPE_BOOKMARK_ITEM (enotes_bookmark_item_get_type ())
#define ENOTES_BOOKMARK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_BOOKMARK_ITEM, ENotesBookmarkItem))
#define ENOTES_BOOKMARK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_BOOKMARK_ITEM, ENotesBookmarkItemClass))
#define ENOTES_IS_BOOKMARK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_BOOKMARK_ITEM))
#define ENOTES_IS_BOOKMARK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_BOOKMARK_ITEM))
#define ENOTES_BOOKMARK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_BOOKMARK_ITEM, ENotesBookmarkItemClass))

typedef struct _ENotesBookmarkItem ENotesBookmarkItem;
typedef struct _ENotesBookmarkItemClass ENotesBookmarkItemClass;
typedef struct _ENotesBookmarkItemPrivate ENotesBookmarkItemPrivate;

#define ENOTES_TYPE_BOOKMARK (enotes_bookmark_get_type ())
#define ENOTES_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_BOOKMARK, ENotesBookmark))
#define ENOTES_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_BOOKMARK, ENotesBookmarkClass))
#define ENOTES_IS_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_BOOKMARK))
#define ENOTES_IS_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_BOOKMARK))
#define ENOTES_BOOKMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_BOOKMARK, ENotesBookmarkClass))

typedef struct _ENotesBookmark ENotesBookmark;
typedef struct _ENotesBookmarkClass ENotesBookmarkClass;
enum  {
	ENOTES_BOOKMARK_ITEM_0_PROPERTY,
	ENOTES_BOOKMARK_ITEM_PARENT_NOTEBOOK_PROPERTY,
	ENOTES_BOOKMARK_ITEM_NUM_PROPERTIES
};
static GParamSpec* enotes_bookmark_item_properties[ENOTES_BOOKMARK_ITEM_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ENotesBookmarkPrivate ENotesBookmarkPrivate;

#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_BOOKMARK_TABLE (enotes_bookmark_table_get_type ())
#define ENOTES_BOOKMARK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_BOOKMARK_TABLE, ENotesBookmarkTable))
#define ENOTES_BOOKMARK_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_BOOKMARK_TABLE, ENotesBookmarkTableClass))
#define ENOTES_IS_BOOKMARK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_BOOKMARK_TABLE))
#define ENOTES_IS_BOOKMARK_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_BOOKMARK_TABLE))
#define ENOTES_BOOKMARK_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_BOOKMARK_TABLE, ENotesBookmarkTableClass))

typedef struct _ENotesBookmarkTable ENotesBookmarkTable;
typedef struct _ENotesBookmarkTableClass ENotesBookmarkTableClass;
#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_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;

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

#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;
typedef struct _ENotesPagePrivate ENotesPagePrivate;

struct _GraniteWidgetsSourceListPatchItem {
	GObject parent_instance;
	GraniteWidgetsSourceListPatchItemPrivate * priv;
	gboolean use_pango_style;
	gboolean force_visible;
};

struct _GraniteWidgetsSourceListPatchItemClass {
	GObjectClass parent_class;
	GtkMenu* (*get_context_menu) (GraniteWidgetsSourceListPatchItem* self);
	void (*edited) (GraniteWidgetsSourceListPatchItem* self, const gchar* new_name);
	void (*action_activated) (GraniteWidgetsSourceListPatchItem* self);
	void (*activated) (GraniteWidgetsSourceListPatchItem* self);
};

struct _GraniteWidgetsSourceListPatchExpandableItem {
	GraniteWidgetsSourceListPatchItem parent_instance;
	GraniteWidgetsSourceListPatchExpandableItemPrivate * priv;
};

struct _GraniteWidgetsSourceListPatchExpandableItemClass {
	GraniteWidgetsSourceListPatchItemClass parent_class;
	void (*toggled) (GraniteWidgetsSourceListPatchExpandableItem* self);
};

struct _ENotesSidebarItem {
	GraniteWidgetsSourceListPatchExpandableItem parent_instance;
	ENotesSidebarItemPrivate * priv;
};

struct _ENotesSidebarItemClass {
	GraniteWidgetsSourceListPatchExpandableItemClass parent_class;
};

struct _ENotesBookmarkItem {
	ENotesSidebarItem parent_instance;
	ENotesBookmarkItemPrivate * priv;
};

struct _ENotesBookmarkItemClass {
	ENotesSidebarItemClass parent_class;
};

struct _ENotesBookmarkItemPrivate {
	ENotesBookmark* bookmark;
	GtkMenu* menu;
	GtkMenuItem* remove_item;
};

struct _ENotesBookmark {
	GObject parent_instance;
	ENotesBookmarkPrivate * priv;
	gint64 page_id;
	gchar* name;
	GdkRGBA color;
};

struct _ENotesBookmarkClass {
	GObjectClass parent_class;
};

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

struct _ENotesApplicationClass {
	GraniteApplicationClass 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 gint ENotesBookmarkItem_private_offset;
static gpointer enotes_bookmark_item_parent_class = NULL;
VALA_EXTERN ENotesApplication* enotes_app;

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_bookmark_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesBookmarkItem, g_object_unref)
VALA_EXTERN GType enotes_bookmark_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesBookmark, g_object_unref)
VALA_EXTERN GtkMenu* granite_widgets_source_list_patch_item_get_context_menu (GraniteWidgetsSourceListPatchItem* self);
VALA_EXTERN ENotesBookmarkItem* enotes_bookmark_item_new (ENotesBookmark* bookmark);
VALA_EXTERN ENotesBookmarkItem* enotes_bookmark_item_construct (GType object_type,
                                                    ENotesBookmark* bookmark);
VALA_EXTERN ENotesSidebarItem* enotes_sidebar_item_new (void);
VALA_EXTERN ENotesSidebarItem* enotes_sidebar_item_construct (GType object_type);
VALA_EXTERN void granite_widgets_source_list_patch_item_set_name (GraniteWidgetsSourceListPatchItem* self,
                                                      const gchar* value);
VALA_EXTERN void granite_widgets_source_list_patch_item_set_editable (GraniteWidgetsSourceListPatchItem* self,
                                                          gboolean value);
VALA_EXTERN void enotes_sidebar_item_set_color (ENotesSidebarItem* self,
                                    GdkRGBA* rgba);
static void enotes_bookmark_item_setup_menu (ENotesBookmarkItem* self);
static void __lambda70_ (ENotesBookmarkItem* self,
                  const gchar* new_name);
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_bookmark_table_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesBookmarkTable, database_table_unref)
VALA_EXTERN ENotesBookmarkTable* enotes_bookmark_table_get_instance (void);
VALA_EXTERN void enotes_bookmark_table_rename (ENotesBookmarkTable* self,
                                   gint64 id,
                                   const gchar* text);
static void ___lambda70__granite_widgets_source_list_patch_item_edited (GraniteWidgetsSourceListPatchItem* _sender,
                                                                 const gchar* new_name,
                                                                 gpointer 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_bookmark_item_get_page (ENotesBookmarkItem* self);
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 ENotesPage* enotes_page_table_get_page (ENotesPageTable* self,
                                        gint64 page_id);
static void __lambda69_ (ENotesBookmarkItem* self);
VALA_EXTERN void enotes_bookmark_table_remove (ENotesBookmarkTable* self,
                                   gint64 page_id);
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)
VALA_EXTERN void granite_widgets_source_list_patch_item_set_visible (GraniteWidgetsSourceListPatchItem* self,
                                                         gboolean value);
static void ___lambda69__gtk_menu_item_activate (GtkMenuItem* _sender,
                                          gpointer self);
static GtkMenu* enotes_bookmark_item_real_get_context_menu (GraniteWidgetsSourceListPatchItem* base);
VALA_EXTERN gint64 enotes_bookmark_item_get_parent_notebook (ENotesBookmarkItem* self);
static void enotes_bookmark_item_finalize (GObject * obj);
static GType enotes_bookmark_item_get_type_once (void);
static void _vala_enotes_bookmark_item_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
enotes_bookmark_item_get_instance_private (ENotesBookmarkItem* self)
{
	return G_STRUCT_MEMBER_P (self, ENotesBookmarkItem_private_offset);
}

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

static void
__lambda70_ (ENotesBookmarkItem* self,
             const gchar* new_name)
{
	ENotesBookmarkTable* _tmp0_;
	ENotesBookmarkTable* _tmp1_;
	ENotesBookmark* _tmp2_;
	g_return_if_fail (new_name != NULL);
	_tmp0_ = enotes_bookmark_table_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->bookmark;
	enotes_bookmark_table_rename (_tmp1_, _tmp2_->page_id, new_name);
	_database_table_unref0 (_tmp1_);
}

static void
___lambda70__granite_widgets_source_list_patch_item_edited (GraniteWidgetsSourceListPatchItem* _sender,
                                                            const gchar* new_name,
                                                            gpointer self)
{
	__lambda70_ ((ENotesBookmarkItem*) self, new_name);
}

ENotesBookmarkItem*
enotes_bookmark_item_construct (GType object_type,
                                ENotesBookmark* bookmark)
{
	ENotesBookmarkItem * self = NULL;
	ENotesBookmark* _tmp0_;
	const gchar* _tmp1_;
	GdkRGBA _tmp2_;
	g_return_val_if_fail (bookmark != NULL, NULL);
	self = (ENotesBookmarkItem*) enotes_sidebar_item_construct (object_type);
	_tmp0_ = _g_object_ref0 (bookmark);
	_g_object_unref0 (self->priv->bookmark);
	self->priv->bookmark = _tmp0_;
	_tmp1_ = bookmark->name;
	granite_widgets_source_list_patch_item_set_name ((GraniteWidgetsSourceListPatchItem*) self, _tmp1_);
	granite_widgets_source_list_patch_item_set_editable ((GraniteWidgetsSourceListPatchItem*) self, TRUE);
	_tmp2_ = bookmark->color;
	enotes_sidebar_item_set_color ((ENotesSidebarItem*) self, &_tmp2_);
	enotes_bookmark_item_setup_menu (self);
	g_signal_connect_object ((GraniteWidgetsSourceListPatchItem*) self, "edited", (GCallback) ___lambda70__granite_widgets_source_list_patch_item_edited, self, 0);
	return self;
}

ENotesBookmarkItem*
enotes_bookmark_item_new (ENotesBookmark* bookmark)
{
	return enotes_bookmark_item_construct (ENOTES_TYPE_BOOKMARK_ITEM, bookmark);
}

ENotesPage*
enotes_bookmark_item_get_page (ENotesBookmarkItem* self)
{
	ENotesPageTable* _tmp0_;
	ENotesPageTable* _tmp1_;
	ENotesBookmark* _tmp2_;
	ENotesPage* _tmp3_;
	ENotesPage* _tmp4_;
	ENotesPage* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = enotes_page_table_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->bookmark;
	_tmp3_ = enotes_page_table_get_page (_tmp1_, _tmp2_->page_id);
	_tmp4_ = _tmp3_;
	_database_table_unref0 (_tmp1_);
	result = _tmp4_;
	return result;
}

static void
__lambda69_ (ENotesBookmarkItem* self)
{
	ENotesBookmarkTable* _tmp0_;
	ENotesBookmarkTable* _tmp1_;
	ENotesBookmark* _tmp2_;
	ENotesApplication* _tmp3_;
	ENotesApplicationState* _tmp4_;
	_tmp0_ = enotes_bookmark_table_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->bookmark;
	enotes_bookmark_table_remove (_tmp1_, _tmp2_->page_id);
	_database_table_unref0 (_tmp1_);
	_tmp3_ = enotes_app;
	_tmp4_ = _tmp3_->state;
	g_signal_emit_by_name (_tmp4_, "bookmark-changed");
	granite_widgets_source_list_patch_item_set_visible ((GraniteWidgetsSourceListPatchItem*) self, FALSE);
}

static void
___lambda69__gtk_menu_item_activate (GtkMenuItem* _sender,
                                     gpointer self)
{
	__lambda69_ ((ENotesBookmarkItem*) self);
}

static void
enotes_bookmark_item_setup_menu (ENotesBookmarkItem* self)
{
	GtkMenu* _tmp0_;
	GtkMenuItem* _tmp1_;
	GtkMenuItem* _tmp2_;
	GtkMenu* _tmp3_;
	GtkMenuItem* _tmp4_;
	GtkMenu* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkMenu*) gtk_menu_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->menu);
	self->priv->menu = _tmp0_;
	_tmp1_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("Remove"));
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->remove_item);
	self->priv->remove_item = _tmp1_;
	_tmp2_ = self->priv->remove_item;
	g_signal_connect_object (_tmp2_, "activate", (GCallback) ___lambda69__gtk_menu_item_activate, self, 0);
	_tmp3_ = self->priv->menu;
	_tmp4_ = self->priv->remove_item;
	gtk_container_add ((GtkContainer*) _tmp3_, (GtkWidget*) _tmp4_);
	_tmp5_ = self->priv->menu;
	gtk_widget_show_all ((GtkWidget*) _tmp5_);
}

static GtkMenu*
enotes_bookmark_item_real_get_context_menu (GraniteWidgetsSourceListPatchItem* base)
{
	ENotesBookmarkItem * self;
	GtkMenu* _tmp0_;
	GtkMenu* _tmp1_;
	GtkMenu* result;
	self = (ENotesBookmarkItem*) base;
	_tmp0_ = self->priv->menu;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

gint64
enotes_bookmark_item_get_parent_notebook (ENotesBookmarkItem* self)
{
	gint64 result;
	ENotesPage* _tmp0_;
	ENotesPage* _tmp1_;
	gint64 _tmp2_;
	g_return_val_if_fail (self != NULL, -1LL);
	_tmp0_ = enotes_bookmark_item_get_page (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->notebook_id;
	_g_object_unref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

static void
enotes_bookmark_item_class_init (ENotesBookmarkItemClass * klass,
                                 gpointer klass_data)
{
	enotes_bookmark_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ENotesBookmarkItem_private_offset);
	((GraniteWidgetsSourceListPatchItemClass *) klass)->get_context_menu = (GtkMenu* (*) (GraniteWidgetsSourceListPatchItem*)) enotes_bookmark_item_real_get_context_menu;
	G_OBJECT_CLASS (klass)->get_property = _vala_enotes_bookmark_item_get_property;
	G_OBJECT_CLASS (klass)->finalize = enotes_bookmark_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), ENOTES_BOOKMARK_ITEM_PARENT_NOTEBOOK_PROPERTY, enotes_bookmark_item_properties[ENOTES_BOOKMARK_ITEM_PARENT_NOTEBOOK_PROPERTY] = g_param_spec_int64 ("parent-notebook", "parent-notebook", "parent-notebook", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
enotes_bookmark_item_instance_init (ENotesBookmarkItem * self,
                                    gpointer klass)
{
	self->priv = enotes_bookmark_item_get_instance_private (self);
}

static void
enotes_bookmark_item_finalize (GObject * obj)
{
	ENotesBookmarkItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_BOOKMARK_ITEM, ENotesBookmarkItem);
	_g_object_unref0 (self->priv->bookmark);
	_g_object_unref0 (self->priv->menu);
	_g_object_unref0 (self->priv->remove_item);
	G_OBJECT_CLASS (enotes_bookmark_item_parent_class)->finalize (obj);
}

static GType
enotes_bookmark_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ENotesBookmarkItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) enotes_bookmark_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ENotesBookmarkItem), 0, (GInstanceInitFunc) enotes_bookmark_item_instance_init, NULL };
	GType enotes_bookmark_item_type_id;
	enotes_bookmark_item_type_id = g_type_register_static (ENOTES_TYPE_SIDEBAR_ITEM, "ENotesBookmarkItem", &g_define_type_info, 0);
	ENotesBookmarkItem_private_offset = g_type_add_instance_private (enotes_bookmark_item_type_id, sizeof (ENotesBookmarkItemPrivate));
	return enotes_bookmark_item_type_id;
}

GType
enotes_bookmark_item_get_type (void)
{
	static volatile gsize enotes_bookmark_item_type_id__once = 0;
	if (g_once_init_enter (&enotes_bookmark_item_type_id__once)) {
		GType enotes_bookmark_item_type_id;
		enotes_bookmark_item_type_id = enotes_bookmark_item_get_type_once ();
		g_once_init_leave (&enotes_bookmark_item_type_id__once, enotes_bookmark_item_type_id);
	}
	return enotes_bookmark_item_type_id__once;
}

static void
_vala_enotes_bookmark_item_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	ENotesBookmarkItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, ENOTES_TYPE_BOOKMARK_ITEM, ENotesBookmarkItem);
	switch (property_id) {
		case ENOTES_BOOKMARK_ITEM_PARENT_NOTEBOOK_PROPERTY:
		g_value_set_int64 (value, enotes_bookmark_item_get_parent_notebook (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

