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

/*
* Copyright (c) 2011-2018 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: Darshak Parikh <darshak@protonmail.com>
*/

#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n-lib.h>

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

#define 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_NOTEBOOK_LIST (enotes_notebook_list_get_type ())
#define ENOTES_NOTEBOOK_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ENOTES_TYPE_NOTEBOOK_LIST, ENotesNotebookList))
#define ENOTES_NOTEBOOK_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ENOTES_TYPE_NOTEBOOK_LIST, ENotesNotebookListClass))
#define ENOTES_IS_NOTEBOOK_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ENOTES_TYPE_NOTEBOOK_LIST))
#define ENOTES_IS_NOTEBOOK_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ENOTES_TYPE_NOTEBOOK_LIST))
#define ENOTES_NOTEBOOK_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ENOTES_TYPE_NOTEBOOK_LIST, ENotesNotebookListClass))

typedef struct _ENotesNotebookList ENotesNotebookList;
typedef struct _ENotesNotebookListClass ENotesNotebookListClass;
typedef struct _ENotesNotebookListPrivate ENotesNotebookListPrivate;
enum  {
	ENOTES_NOTEBOOK_LIST_0_PROPERTY,
	ENOTES_NOTEBOOK_LIST_NUM_PROPERTIES
};
static GParamSpec* enotes_notebook_list_properties[ENOTES_NOTEBOOK_LIST_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_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;

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 _ENotesNotebookList {
	GraniteWidgetsSourceListPatchExpandableItem parent_instance;
	ENotesNotebookListPrivate * priv;
};

struct _ENotesNotebookListClass {
	GraniteWidgetsSourceListPatchExpandableItemClass parent_class;
};

struct _ENotesNotebookListPrivate {
	GtkMenu* menu;
	GtkMenuItem* new_notebook_item;
};

static gint ENotesNotebookList_private_offset;
static gpointer enotes_notebook_list_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_notebook_list_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ENotesNotebookList, g_object_unref)
VALA_EXTERN GtkMenu* granite_widgets_source_list_patch_item_get_context_menu (GraniteWidgetsSourceListPatchItem* self);
VALA_EXTERN ENotesNotebookList* enotes_notebook_list_new (const gchar* name);
VALA_EXTERN ENotesNotebookList* enotes_notebook_list_construct (GType object_type,
                                                    const gchar* name);
static GtkMenu* enotes_notebook_list_real_get_context_menu (GraniteWidgetsSourceListPatchItem* base);
static GObject * enotes_notebook_list_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties);
static void _enotes_notebook_list___lambda56_ (ENotesNotebookList* 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 __enotes_notebook_list___lambda56__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                                gpointer self);
static void enotes_notebook_list_finalize (GObject * obj);
static GType enotes_notebook_list_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
enotes_notebook_list_get_instance_private (ENotesNotebookList* self)
{
	return G_STRUCT_MEMBER_P (self, ENotesNotebookList_private_offset);
}

ENotesNotebookList*
enotes_notebook_list_construct (GType object_type,
                                const gchar* name)
{
	ENotesNotebookList * self = NULL;
	g_return_val_if_fail (name != NULL, NULL);
	self = (ENotesNotebookList*) g_object_new (object_type, "name", name, NULL);
	return self;
}

ENotesNotebookList*
enotes_notebook_list_new (const gchar* name)
{
	return enotes_notebook_list_construct (ENOTES_TYPE_NOTEBOOK_LIST, name);
}

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

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

static void
_enotes_notebook_list___lambda56_ (ENotesNotebookList* self)
{
	ENotesNotebookDialog* dialog = NULL;
	ENotesNotebookDialog* _tmp0_;
	ENotesNotebookDialog* _tmp1_;
	_tmp0_ = enotes_notebook_dialog_new (NULL);
	g_object_ref_sink (_tmp0_);
	dialog = _tmp0_;
	_tmp1_ = dialog;
	gtk_dialog_run ((GtkDialog*) _tmp1_);
	_g_object_unref0 (dialog);
}

static void
__enotes_notebook_list___lambda56__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                           gpointer self)
{
	_enotes_notebook_list___lambda56_ ((ENotesNotebookList*) self);
}

static GObject *
enotes_notebook_list_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ENotesNotebookList * self;
	GtkMenu* _tmp0_;
	GtkMenuItem* _tmp1_;
	GtkMenu* _tmp2_;
	GtkMenuItem* _tmp3_;
	GtkMenu* _tmp4_;
	GtkMenuItem* _tmp5_;
	parent_class = G_OBJECT_CLASS (enotes_notebook_list_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_NOTEBOOK_LIST, ENotesNotebookList);
	_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 (_ ("New Section"));
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->new_notebook_item);
	self->priv->new_notebook_item = _tmp1_;
	_tmp2_ = self->priv->menu;
	_tmp3_ = self->priv->new_notebook_item;
	gtk_container_add ((GtkContainer*) _tmp2_, (GtkWidget*) _tmp3_);
	_tmp4_ = self->priv->menu;
	gtk_widget_show_all ((GtkWidget*) _tmp4_);
	_tmp5_ = self->priv->new_notebook_item;
	g_signal_connect_object (_tmp5_, "activate", (GCallback) __enotes_notebook_list___lambda56__gtk_menu_item_activate, self, 0);
	return obj;
}

static void
enotes_notebook_list_class_init (ENotesNotebookListClass * klass,
                                 gpointer klass_data)
{
	enotes_notebook_list_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ENotesNotebookList_private_offset);
	((GraniteWidgetsSourceListPatchItemClass *) klass)->get_context_menu = (GtkMenu* (*) (GraniteWidgetsSourceListPatchItem*)) enotes_notebook_list_real_get_context_menu;
	G_OBJECT_CLASS (klass)->constructor = enotes_notebook_list_constructor;
	G_OBJECT_CLASS (klass)->finalize = enotes_notebook_list_finalize;
}

static void
enotes_notebook_list_instance_init (ENotesNotebookList * self,
                                    gpointer klass)
{
	self->priv = enotes_notebook_list_get_instance_private (self);
}

static void
enotes_notebook_list_finalize (GObject * obj)
{
	ENotesNotebookList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ENOTES_TYPE_NOTEBOOK_LIST, ENotesNotebookList);
	_g_object_unref0 (self->priv->menu);
	_g_object_unref0 (self->priv->new_notebook_item);
	G_OBJECT_CLASS (enotes_notebook_list_parent_class)->finalize (obj);
}

static GType
enotes_notebook_list_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ENotesNotebookListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) enotes_notebook_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ENotesNotebookList), 0, (GInstanceInitFunc) enotes_notebook_list_instance_init, NULL };
	GType enotes_notebook_list_type_id;
	enotes_notebook_list_type_id = g_type_register_static (GRANITE_WIDGETS_SOURCE_LIST_PATCH_TYPE_EXPANDABLE_ITEM, "ENotesNotebookList", &g_define_type_info, 0);
	ENotesNotebookList_private_offset = g_type_add_instance_private (enotes_notebook_list_type_id, sizeof (ENotesNotebookListPrivate));
	return enotes_notebook_list_type_id;
}

GType
enotes_notebook_list_get_type (void)
{
	static volatile gsize enotes_notebook_list_type_id__once = 0;
	if (g_once_init_enter (&enotes_notebook_list_type_id__once)) {
		GType enotes_notebook_list_type_id;
		enotes_notebook_list_type_id = enotes_notebook_list_get_type_once ();
		g_once_init_leave (&enotes_notebook_list_type_id__once, enotes_notebook_list_type_id);
	}
	return enotes_notebook_list_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;
}

