/* NotebookItem.c generated by valac 0.56.19, the Vala compiler
 * generated from NotebookItem.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 <glib/gi18n-lib.h>
#include <gdk/gdk.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_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;
typedef struct _ENotesNotebookItemPrivate ENotesNotebookItemPrivate;

#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;
enum  {
	ENOTES_NOTEBOOK_ITEM_0_PROPERTY,
	ENOTES_NOTEBOOK_ITEM_NOTEBOOK_PROPERTY,
	ENOTES_NOTEBOOK_ITEM_NUM_PROPERTIES
};
static GParamSpec* enotes_notebook_item_properties[ENOTES_NOTEBOOK_ITEM_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#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_TRASH (enotes_trash_get_type ())
#define ENOTES_TRASH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_TRASH, ENotesTrash))
#define ENOTES_TRASH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_TRASH, ENotesTrashClass))
#define ENOTES_IS_TRASH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_TRASH))
#define ENOTES_IS_TRASH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_TRASH))
#define ENOTES_TRASH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_TRASH, ENotesTrashClass))

typedef struct _ENotesTrash ENotesTrash;
typedef struct _ENotesTrashClass ENotesTrashClass;

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

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 _ENotesNotebookItem {
	ENotesSidebarItem parent_instance;
	ENotesNotebookItemPrivate * priv;
};

struct _ENotesNotebookItemClass {
	ENotesSidebarItemClass parent_class;
};

struct _ENotesNotebookItemPrivate {
	GtkMenu* menu;
	GtkMenuItem* remove_item;
	GtkMenuItem* edit_item;
	GtkMenuItem* new_item;
	GtkMenuItem* move_item;
	ENotesNotebook* _notebook;
};

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 ENotesNotebookItem_private_offset;
static gpointer enotes_notebook_item_parent_class = NULL;

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 GType enotes_notebook_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesNotebook, g_object_unref)
VALA_EXTERN GtkMenu* granite_widgets_source_list_patch_item_get_context_menu (GraniteWidgetsSourceListPatchItem* self);
VALA_EXTERN ENotesNotebookItem* enotes_notebook_item_new (ENotesNotebook* notebook,
                                              gboolean add_menu);
VALA_EXTERN ENotesNotebookItem* enotes_notebook_item_construct (GType object_type,
                                                    ENotesNotebook* notebook,
                                                    gboolean add_menu);
VALA_EXTERN ENotesSidebarItem* enotes_sidebar_item_new (void);
VALA_EXTERN ENotesSidebarItem* enotes_sidebar_item_construct (GType object_type);
VALA_EXTERN void enotes_notebook_item_set_notebook (ENotesNotebookItem* self,
                                        ENotesNotebook* value);
static void enotes_notebook_item_setup_menu (ENotesNotebookItem* self);
static void __lambda60_ (ENotesNotebookItem* self);
VALA_EXTERN ENotesNotebook* enotes_notebook_item_get_notebook (ENotesNotebookItem* self);
VALA_EXTERN ENotesNotebookDialog* enotes_notebook_dialog_new (ENotesNotebook* notebook);
VALA_EXTERN ENotesNotebookDialog* enotes_notebook_dialog_construct (GType object_type,
                                                        ENotesNotebook* notebook);
VALA_EXTERN GType enotes_notebook_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesNotebookDialog, g_object_unref)
static void ___lambda60__gtk_menu_item_activate (GtkMenuItem* _sender,
                                          gpointer self);
static void __lambda61_ (ENotesNotebookItem* self);
VALA_EXTERN ENotesNotebookDialog* enotes_notebook_dialog_new_new_subnotebook (ENotesNotebook* parent);
VALA_EXTERN ENotesNotebookDialog* enotes_notebook_dialog_construct_new_subnotebook (GType object_type,
                                                                        ENotesNotebook* parent);
static void ___lambda61__gtk_menu_item_activate (GtkMenuItem* _sender,
                                          gpointer self);
static void __lambda62_ (ENotesNotebookItem* self);
VALA_EXTERN GType enotes_trash_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesTrash, g_object_unref)
VALA_EXTERN ENotesTrash* enotes_trash_get_instance (void);
VALA_EXTERN void enotes_trash_trash_notebook (ENotesTrash* self,
                                  ENotesNotebook* notebook);
static void ___lambda62__gtk_menu_item_activate (GtkMenuItem* _sender,
                                          gpointer self);
static void __lambda63_ (ENotesNotebookItem* self);
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 enotes_notebook_list_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesNotebookListDialog, g_object_unref)
static void ___lambda63__gtk_menu_item_activate (GtkMenuItem* _sender,
                                          gpointer self);
static void __lambda66_ (ENotesNotebookItem* self);
VALA_EXTERN void granite_widgets_source_list_patch_item_set_visible (GraniteWidgetsSourceListPatchItem* self,
                                                         gboolean value);
static void ___lambda66__enotes_notebook_destroy (ENotesNotebook* _sender,
                                           gpointer self);
static GtkMenu* enotes_notebook_item_real_get_context_menu (GraniteWidgetsSourceListPatchItem* base);
VALA_EXTERN void enotes_sidebar_item_set_color (ENotesSidebarItem* self,
                                    GdkRGBA* rgba);
VALA_EXTERN void granite_widgets_source_list_patch_item_set_name (GraniteWidgetsSourceListPatchItem* self,
                                                      const gchar* value);
static void enotes_notebook_item_finalize (GObject * obj);
static GType enotes_notebook_item_get_type_once (void);
static void _vala_enotes_notebook_item_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_enotes_notebook_item_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
enotes_notebook_item_get_instance_private (ENotesNotebookItem* self)
{
	return G_STRUCT_MEMBER_P (self, ENotesNotebookItem_private_offset);
}

ENotesNotebookItem*
enotes_notebook_item_construct (GType object_type,
                                ENotesNotebook* notebook,
                                gboolean add_menu)
{
	ENotesNotebookItem * self = NULL;
	g_return_val_if_fail (notebook != NULL, NULL);
	self = (ENotesNotebookItem*) enotes_sidebar_item_construct (object_type);
	enotes_notebook_item_set_notebook (self, notebook);
	((GraniteWidgetsSourceListPatchItem*) self)->use_pango_style = FALSE;
	((GraniteWidgetsSourceListPatchItem*) self)->force_visible = TRUE;
	if (add_menu) {
		enotes_notebook_item_setup_menu (self);
	}
	return self;
}

ENotesNotebookItem*
enotes_notebook_item_new (ENotesNotebook* notebook,
                          gboolean add_menu)
{
	return enotes_notebook_item_construct (ENOTES_TYPE_NOTEBOOK_ITEM, notebook, add_menu);
}

static void
__lambda60_ (ENotesNotebookItem* self)
{
	ENotesNotebook* _tmp0_;
	ENotesNotebook* _tmp1_;
	ENotesNotebookDialog* _tmp2_;
	ENotesNotebookDialog* _tmp3_;
	_tmp0_ = enotes_notebook_item_get_notebook (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = enotes_notebook_dialog_new (_tmp1_);
	g_object_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp3_);
}

static void
___lambda60__gtk_menu_item_activate (GtkMenuItem* _sender,
                                     gpointer self)
{
	__lambda60_ ((ENotesNotebookItem*) self);
}

static void
__lambda61_ (ENotesNotebookItem* self)
{
	ENotesNotebook* _tmp0_;
	ENotesNotebook* _tmp1_;
	ENotesNotebookDialog* _tmp2_;
	ENotesNotebookDialog* _tmp3_;
	_tmp0_ = enotes_notebook_item_get_notebook (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = enotes_notebook_dialog_new_new_subnotebook (_tmp1_);
	g_object_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp3_);
}

static void
___lambda61__gtk_menu_item_activate (GtkMenuItem* _sender,
                                     gpointer self)
{
	__lambda61_ ((ENotesNotebookItem*) self);
}

static void
__lambda62_ (ENotesNotebookItem* self)
{
	ENotesTrash* _tmp0_;
	ENotesTrash* _tmp1_;
	ENotesNotebook* _tmp2_;
	ENotesNotebook* _tmp3_;
	_tmp0_ = enotes_trash_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = enotes_notebook_item_get_notebook (self);
	_tmp3_ = _tmp2_;
	enotes_trash_trash_notebook (_tmp1_, _tmp3_);
	_g_object_unref0 (_tmp1_);
}

static void
___lambda62__gtk_menu_item_activate (GtkMenuItem* _sender,
                                     gpointer self)
{
	__lambda62_ ((ENotesNotebookItem*) self);
}

static void
__lambda63_ (ENotesNotebookItem* self)
{
	ENotesNotebook* _tmp0_;
	ENotesNotebook* _tmp1_;
	ENotesNotebookListDialog* _tmp2_;
	ENotesNotebookListDialog* _tmp3_;
	_tmp0_ = enotes_notebook_item_get_notebook (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = enotes_notebook_list_dialog_new (_tmp1_);
	g_object_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp3_);
}

static void
___lambda63__gtk_menu_item_activate (GtkMenuItem* _sender,
                                     gpointer self)
{
	__lambda63_ ((ENotesNotebookItem*) self);
}

static void
__lambda66_ (ENotesNotebookItem* self)
{
	granite_widgets_source_list_patch_item_set_visible ((GraniteWidgetsSourceListPatchItem*) self, FALSE);
}

static void
___lambda66__enotes_notebook_destroy (ENotesNotebook* _sender,
                                      gpointer self)
{
	__lambda66_ ((ENotesNotebookItem*) self);
}

static void
enotes_notebook_item_setup_menu (ENotesNotebookItem* self)
{
	GtkMenu* _tmp0_;
	GtkMenuItem* _tmp1_;
	GtkMenuItem* _tmp2_;
	GtkMenuItem* _tmp3_;
	GtkMenuItem* _tmp4_;
	GtkMenu* _tmp5_;
	GtkMenuItem* _tmp6_;
	GtkMenu* _tmp7_;
	GtkMenuItem* _tmp8_;
	GtkMenu* _tmp9_;
	GtkMenuItem* _tmp10_;
	GtkMenu* _tmp11_;
	GtkMenuItem* _tmp12_;
	GtkMenu* _tmp13_;
	GtkMenuItem* _tmp14_;
	GtkMenuItem* _tmp15_;
	GtkMenuItem* _tmp16_;
	GtkMenuItem* _tmp17_;
	ENotesNotebook* _tmp18_;
	ENotesNotebook* _tmp19_;
	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 (_ ("Edit Section"));
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->edit_item);
	self->priv->edit_item = _tmp1_;
	_tmp2_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("New Section"));
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->new_item);
	self->priv->new_item = _tmp2_;
	_tmp3_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("Delete Section"));
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->remove_item);
	self->priv->remove_item = _tmp3_;
	_tmp4_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("Move Section"));
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->move_item);
	self->priv->move_item = _tmp4_;
	_tmp5_ = self->priv->menu;
	_tmp6_ = self->priv->edit_item;
	gtk_container_add ((GtkContainer*) _tmp5_, (GtkWidget*) _tmp6_);
	_tmp7_ = self->priv->menu;
	_tmp8_ = self->priv->new_item;
	gtk_container_add ((GtkContainer*) _tmp7_, (GtkWidget*) _tmp8_);
	_tmp9_ = self->priv->menu;
	_tmp10_ = self->priv->move_item;
	gtk_container_add ((GtkContainer*) _tmp9_, (GtkWidget*) _tmp10_);
	_tmp11_ = self->priv->menu;
	_tmp12_ = self->priv->remove_item;
	gtk_container_add ((GtkContainer*) _tmp11_, (GtkWidget*) _tmp12_);
	_tmp13_ = self->priv->menu;
	gtk_widget_show_all ((GtkWidget*) _tmp13_);
	_tmp14_ = self->priv->edit_item;
	g_signal_connect_object (_tmp14_, "activate", (GCallback) ___lambda60__gtk_menu_item_activate, self, 0);
	_tmp15_ = self->priv->new_item;
	g_signal_connect_object (_tmp15_, "activate", (GCallback) ___lambda61__gtk_menu_item_activate, self, 0);
	_tmp16_ = self->priv->remove_item;
	g_signal_connect_object (_tmp16_, "activate", (GCallback) ___lambda62__gtk_menu_item_activate, self, 0);
	_tmp17_ = self->priv->move_item;
	g_signal_connect_object (_tmp17_, "activate", (GCallback) ___lambda63__gtk_menu_item_activate, self, 0);
	_tmp18_ = enotes_notebook_item_get_notebook (self);
	_tmp19_ = _tmp18_;
	g_signal_connect_object (_tmp19_, "destroy", (GCallback) ___lambda66__enotes_notebook_destroy, self, 0);
}

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

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

ENotesNotebook*
enotes_notebook_item_get_notebook (ENotesNotebookItem* self)
{
	ENotesNotebook* result;
	ENotesNotebook* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_notebook;
	result = _tmp0_;
	return result;
}

void
enotes_notebook_item_set_notebook (ENotesNotebookItem* self,
                                   ENotesNotebook* value)
{
	ENotesNotebook* _tmp0_;
	GdkRGBA _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_notebook);
	self->priv->_notebook = _tmp0_;
	_tmp1_ = value->rgb;
	enotes_sidebar_item_set_color ((ENotesSidebarItem*) self, &_tmp1_);
	_tmp2_ = value->name;
	granite_widgets_source_list_patch_item_set_name ((GraniteWidgetsSourceListPatchItem*) self, _tmp2_);
	g_object_notify_by_pspec ((GObject *) self, enotes_notebook_item_properties[ENOTES_NOTEBOOK_ITEM_NOTEBOOK_PROPERTY]);
}

static void
enotes_notebook_item_class_init (ENotesNotebookItemClass * klass,
                                 gpointer klass_data)
{
	enotes_notebook_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ENotesNotebookItem_private_offset);
	((GraniteWidgetsSourceListPatchItemClass *) klass)->get_context_menu = (GtkMenu* (*) (GraniteWidgetsSourceListPatchItem*)) enotes_notebook_item_real_get_context_menu;
	G_OBJECT_CLASS (klass)->get_property = _vala_enotes_notebook_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_enotes_notebook_item_set_property;
	G_OBJECT_CLASS (klass)->finalize = enotes_notebook_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), ENOTES_NOTEBOOK_ITEM_NOTEBOOK_PROPERTY, enotes_notebook_item_properties[ENOTES_NOTEBOOK_ITEM_NOTEBOOK_PROPERTY] = g_param_spec_object ("notebook", "notebook", "notebook", ENOTES_TYPE_NOTEBOOK, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
enotes_notebook_item_instance_init (ENotesNotebookItem * self,
                                    gpointer klass)
{
	self->priv = enotes_notebook_item_get_instance_private (self);
}

static void
enotes_notebook_item_finalize (GObject * obj)
{
	ENotesNotebookItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_NOTEBOOK_ITEM, ENotesNotebookItem);
	_g_object_unref0 (self->priv->menu);
	_g_object_unref0 (self->priv->remove_item);
	_g_object_unref0 (self->priv->edit_item);
	_g_object_unref0 (self->priv->new_item);
	_g_object_unref0 (self->priv->move_item);
	_g_object_unref0 (self->priv->_notebook);
	G_OBJECT_CLASS (enotes_notebook_item_parent_class)->finalize (obj);
}

static GType
enotes_notebook_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ENotesNotebookItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) enotes_notebook_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ENotesNotebookItem), 0, (GInstanceInitFunc) enotes_notebook_item_instance_init, NULL };
	GType enotes_notebook_item_type_id;
	enotes_notebook_item_type_id = g_type_register_static (ENOTES_TYPE_SIDEBAR_ITEM, "ENotesNotebookItem", &g_define_type_info, 0);
	ENotesNotebookItem_private_offset = g_type_add_instance_private (enotes_notebook_item_type_id, sizeof (ENotesNotebookItemPrivate));
	return enotes_notebook_item_type_id;
}

GType
enotes_notebook_item_get_type (void)
{
	static volatile gsize enotes_notebook_item_type_id__once = 0;
	if (g_once_init_enter (&enotes_notebook_item_type_id__once)) {
		GType enotes_notebook_item_type_id;
		enotes_notebook_item_type_id = enotes_notebook_item_get_type_once ();
		g_once_init_leave (&enotes_notebook_item_type_id__once, enotes_notebook_item_type_id);
	}
	return enotes_notebook_item_type_id__once;
}

static void
_vala_enotes_notebook_item_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	ENotesNotebookItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, ENOTES_TYPE_NOTEBOOK_ITEM, ENotesNotebookItem);
	switch (property_id) {
		case ENOTES_NOTEBOOK_ITEM_NOTEBOOK_PROPERTY:
		g_value_set_object (value, enotes_notebook_item_get_notebook (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_enotes_notebook_item_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	ENotesNotebookItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, ENOTES_TYPE_NOTEBOOK_ITEM, ENotesNotebookItem);
	switch (property_id) {
		case ENOTES_NOTEBOOK_ITEM_NOTEBOOK_PROPERTY:
		enotes_notebook_item_set_notebook (self, g_value_get_object (value));
		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;
}

