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

/*
 * Copyright 2011-2018 elementary, Inc. (https://elementary.io)
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 *
 * Authored by: Maxwell Barvian
 *              Corentin Noël <corentin@elementaryos.org>
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <libecal/libecal.h>
#include <glib.h>
#include <gio/gio.h>
#include <libedataserver/libedataserver.h>
#include <granite.h>
#include "elementary-calendar.h"
#include <glib/gi18n-lib.h>
#include <handy.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 MAYA_TYPE_EVENT_MENU (maya_event_menu_get_type ())
#define MAYA_EVENT_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAYA_TYPE_EVENT_MENU, MayaEventMenu))
#define MAYA_EVENT_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAYA_TYPE_EVENT_MENU, MayaEventMenuClass))
#define MAYA_IS_EVENT_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAYA_TYPE_EVENT_MENU))
#define MAYA_IS_EVENT_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAYA_TYPE_EVENT_MENU))
#define MAYA_EVENT_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAYA_TYPE_EVENT_MENU, MayaEventMenuClass))

typedef struct _MayaEventMenu MayaEventMenu;
typedef struct _MayaEventMenuClass MayaEventMenuClass;
typedef struct _MayaEventMenuPrivate MayaEventMenuPrivate;
enum  {
	MAYA_EVENT_MENU_0_PROPERTY,
	MAYA_EVENT_MENU_COMP_PROPERTY,
	MAYA_EVENT_MENU_NUM_PROPERTIES
};
static GParamSpec* maya_event_menu_properties[MAYA_EVENT_MENU_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define CALENDAR_TYPE_DELETE_EVENT_DIALOG (calendar_delete_event_dialog_get_type ())
#define CALENDAR_DELETE_EVENT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALENDAR_TYPE_DELETE_EVENT_DIALOG, CalendarDeleteEventDialog))
#define CALENDAR_DELETE_EVENT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALENDAR_TYPE_DELETE_EVENT_DIALOG, CalendarDeleteEventDialogClass))
#define CALENDAR_IS_DELETE_EVENT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALENDAR_TYPE_DELETE_EVENT_DIALOG))
#define CALENDAR_IS_DELETE_EVENT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALENDAR_TYPE_DELETE_EVENT_DIALOG))
#define CALENDAR_DELETE_EVENT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALENDAR_TYPE_DELETE_EVENT_DIALOG, CalendarDeleteEventDialogClass))

typedef struct _CalendarDeleteEventDialog CalendarDeleteEventDialog;
typedef struct _CalendarDeleteEventDialogClass CalendarDeleteEventDialogClass;

#define MAYA_TYPE_APPLICATION (maya_application_get_type ())
#define MAYA_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAYA_TYPE_APPLICATION, MayaApplication))
#define MAYA_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAYA_TYPE_APPLICATION, MayaApplicationClass))
#define MAYA_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAYA_TYPE_APPLICATION))
#define MAYA_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAYA_TYPE_APPLICATION))
#define MAYA_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAYA_TYPE_APPLICATION, MayaApplicationClass))

typedef struct _MayaApplication MayaApplication;
typedef struct _MayaApplicationClass MayaApplicationClass;
typedef struct _MayaApplicationPrivate MayaApplicationPrivate;

#define MAYA_TYPE_MAIN_WINDOW (maya_main_window_get_type ())
#define MAYA_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAYA_TYPE_MAIN_WINDOW, MayaMainWindow))
#define MAYA_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAYA_TYPE_MAIN_WINDOW, MayaMainWindowClass))
#define MAYA_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAYA_TYPE_MAIN_WINDOW))
#define MAYA_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAYA_TYPE_MAIN_WINDOW))
#define MAYA_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAYA_TYPE_MAIN_WINDOW, MayaMainWindowClass))

typedef struct _MayaMainWindow MayaMainWindow;
typedef struct _MayaMainWindowClass MayaMainWindowClass;

struct _MayaEventMenu {
	GtkMenu parent_instance;
	MayaEventMenuPrivate * priv;
};

struct _MayaEventMenuClass {
	GtkMenuClass parent_class;
};

struct _MayaEventMenuPrivate {
	ECalComponent* _comp;
};

struct _MayaApplication {
	GtkApplication parent_instance;
	MayaApplicationPrivate * priv;
	MayaMainWindow* window;
};

struct _MayaApplicationClass {
	GtkApplicationClass parent_class;
};

static gint MayaEventMenu_private_offset;
static gpointer maya_event_menu_parent_class = NULL;

VALA_EXTERN GType maya_event_menu_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MayaEventMenu, g_object_unref)
VALA_EXTERN MayaEventMenu* maya_event_menu_new (ECalComponent* comp);
VALA_EXTERN MayaEventMenu* maya_event_menu_construct (GType object_type,
                                          ECalComponent* comp);
static void maya_event_menu_remove_event (MayaEventMenu* self);
VALA_EXTERN ECalComponent* maya_event_menu_get_comp (MayaEventMenu* self);
VALA_EXTERN GType calendar_delete_event_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CalendarDeleteEventDialog, g_object_unref)
VALA_EXTERN CalendarDeleteEventDialog* calendar_delete_event_dialog_new (ESource* source,
                                                             ECalComponent* ecal_event,
                                                             ECalObjModType mod_type_prop);
VALA_EXTERN CalendarDeleteEventDialog* calendar_delete_event_dialog_construct (GType object_type,
                                                                   ESource* source,
                                                                   ECalComponent* ecal_event,
                                                                   ECalObjModType mod_type_prop);
VALA_EXTERN GtkResponseType calendar_delete_event_dialog_run_dialog (CalendarDeleteEventDialog* self);
static void maya_event_menu_add_exception (MayaEventMenu* self);
VALA_EXTERN void maya_event_menu_set_comp (MayaEventMenu* self,
                               ECalComponent* value);
static GObject * maya_event_menu_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties);
static void _maya_event_menu_add_exception_gtk_menu_item_activate (GtkMenuItem* _sender,
                                                            gpointer self);
static void _maya_event_menu_remove_event_gtk_menu_item_activate (GtkMenuItem* _sender,
                                                           gpointer self);
static void _maya_event_menu___lambda4_ (MayaEventMenu* self);
VALA_EXTERN GType maya_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MayaApplication, g_object_unref)
VALA_EXTERN GType maya_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MayaMainWindow, g_object_unref)
VALA_EXTERN void maya_main_window_on_modified (MayaMainWindow* self,
                                   ECalComponent* comp);
static void __maya_event_menu___lambda4__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                          gpointer self);
static void _maya_event_menu___lambda194_ (MayaEventMenu* self);
VALA_EXTERN void maya_main_window_on_duplicated (MayaMainWindow* self,
                                     ECalComponent* comp);
static void __maya_event_menu___lambda194__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                            gpointer self);
static void maya_event_menu_finalize (GObject * obj);
static GType maya_event_menu_get_type_once (void);
static void _vala_maya_event_menu_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static void _vala_maya_event_menu_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);

static inline gpointer
maya_event_menu_get_instance_private (MayaEventMenu* self)
{
	return G_STRUCT_MEMBER_P (self, MayaEventMenu_private_offset);
}

MayaEventMenu*
maya_event_menu_construct (GType object_type,
                           ECalComponent* comp)
{
	MayaEventMenu * self = NULL;
	g_return_val_if_fail (comp != NULL, NULL);
	self = (MayaEventMenu*) g_object_new (object_type, "comp", comp, NULL);
	return self;
}

MayaEventMenu*
maya_event_menu_new (ECalComponent* comp)
{
	return maya_event_menu_construct (MAYA_TYPE_EVENT_MENU, comp);
}

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

static void
maya_event_menu_remove_event (MayaEventMenu* self)
{
	GtkApplication* application = NULL;
	GApplication* _tmp0_;
	GtkApplication* _tmp1_;
	ESource* source = NULL;
	ECalComponent* _tmp2_;
	gconstpointer _tmp3_;
	ESource* _tmp4_;
	CalendarDeleteEventDialog* delete_dialog = NULL;
	ECalComponent* _tmp5_;
	GtkWindow* _tmp6_;
	GtkWindow* _tmp7_;
	GtkWindow* _tmp8_;
	CalendarDeleteEventDialog* _tmp9_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_application_get_default ();
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_application_get_type (), GtkApplication));
	application = _tmp1_;
	_tmp2_ = self->priv->_comp;
	_tmp3_ = g_object_get_data ((GObject*) _tmp2_, "source");
	_tmp4_ = _g_object_ref0 ((ESource*) _tmp3_);
	source = _tmp4_;
	_tmp5_ = self->priv->_comp;
	_tmp6_ = gtk_application_get_active_window (application);
	_tmp7_ = _tmp6_;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	_tmp9_ = calendar_delete_event_dialog_new (source, _tmp5_, E_CAL_OBJ_MOD_ALL);
	gtk_window_set_transient_for ((GtkWindow*) _tmp9_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	delete_dialog = _tmp9_;
	calendar_delete_event_dialog_run_dialog (delete_dialog);
	_g_object_unref0 (delete_dialog);
	_g_object_unref0 (source);
	_g_object_unref0 (application);
}

static void
maya_event_menu_add_exception (MayaEventMenu* self)
{
	GtkApplication* application = NULL;
	GApplication* _tmp0_;
	GtkApplication* _tmp1_;
	ESource* source = NULL;
	ECalComponent* _tmp2_;
	gconstpointer _tmp3_;
	ESource* _tmp4_;
	CalendarDeleteEventDialog* delete_dialog = NULL;
	ECalComponent* _tmp5_;
	GtkWindow* _tmp6_;
	GtkWindow* _tmp7_;
	GtkWindow* _tmp8_;
	CalendarDeleteEventDialog* _tmp9_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_application_get_default ();
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_application_get_type (), GtkApplication));
	application = _tmp1_;
	_tmp2_ = self->priv->_comp;
	_tmp3_ = g_object_get_data ((GObject*) _tmp2_, "source");
	_tmp4_ = _g_object_ref0 ((ESource*) _tmp3_);
	source = _tmp4_;
	_tmp5_ = self->priv->_comp;
	_tmp6_ = gtk_application_get_active_window (application);
	_tmp7_ = _tmp6_;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	_tmp9_ = calendar_delete_event_dialog_new (source, _tmp5_, E_CAL_OBJ_MOD_THIS);
	gtk_window_set_transient_for ((GtkWindow*) _tmp9_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	g_object_ref_sink (_tmp9_);
	delete_dialog = _tmp9_;
	calendar_delete_event_dialog_run_dialog (delete_dialog);
	_g_object_unref0 (delete_dialog);
	_g_object_unref0 (source);
	_g_object_unref0 (application);
}

ECalComponent*
maya_event_menu_get_comp (MayaEventMenu* self)
{
	ECalComponent* result;
	ECalComponent* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_comp;
	result = _tmp0_;
	return result;
}

void
maya_event_menu_set_comp (MayaEventMenu* self,
                          ECalComponent* value)
{
	ECalComponent* old_value;
	g_return_if_fail (self != NULL);
	old_value = maya_event_menu_get_comp (self);
	if (old_value != value) {
		ECalComponent* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_comp);
		self->priv->_comp = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, maya_event_menu_properties[MAYA_EVENT_MENU_COMP_PROPERTY]);
	}
}

static void
_maya_event_menu_add_exception_gtk_menu_item_activate (GtkMenuItem* _sender,
                                                       gpointer self)
{
	maya_event_menu_add_exception ((MayaEventMenu*) self);
}

static void
_maya_event_menu_remove_event_gtk_menu_item_activate (GtkMenuItem* _sender,
                                                      gpointer self)
{
	maya_event_menu_remove_event ((MayaEventMenu*) self);
}

static void
_maya_event_menu___lambda4_ (MayaEventMenu* self)
{
	GApplication* _tmp0_;
	MayaMainWindow* _tmp1_;
	ECalComponent* _tmp2_;
	_tmp0_ = g_application_get_default ();
	_tmp1_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, MAYA_TYPE_APPLICATION, MayaApplication)->window;
	_tmp2_ = self->priv->_comp;
	maya_main_window_on_modified (_tmp1_, _tmp2_);
}

static void
__maya_event_menu___lambda4__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                     gpointer self)
{
	_maya_event_menu___lambda4_ ((MayaEventMenu*) self);
}

static void
_maya_event_menu___lambda194_ (MayaEventMenu* self)
{
	GApplication* _tmp0_;
	MayaMainWindow* _tmp1_;
	ECalComponent* _tmp2_;
	_tmp0_ = g_application_get_default ();
	_tmp1_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, MAYA_TYPE_APPLICATION, MayaApplication)->window;
	_tmp2_ = self->priv->_comp;
	maya_main_window_on_duplicated (_tmp1_, _tmp2_);
}

static void
__maya_event_menu___lambda194__gtk_menu_item_activate (GtkMenuItem* _sender,
                                                       gpointer self)
{
	_maya_event_menu___lambda194_ ((MayaEventMenu*) self);
}

static GObject *
maya_event_menu_constructor (GType type,
                             guint n_construct_properties,
                             GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	MayaEventMenu * self;
	ESource* src = NULL;
	ECalComponent* _tmp0_;
	gconstpointer _tmp1_;
	ESource* _tmp2_;
	gboolean _tmp3_ = FALSE;
	ESource* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	gboolean sensitive = FALSE;
	GtkMenuItem* edit_item = NULL;
	GtkMenuItem* _tmp10_;
	GtkMenuItem* _tmp11_;
	GtkMenuItem* duplicate_item = NULL;
	GtkMenuItem* _tmp12_;
	GtkMenuItem* _tmp13_;
	GtkMenuItem* remove_item = NULL;
	ECalComponent* _tmp14_;
	GtkMenuItem* _tmp21_;
	GtkMenuItem* _tmp22_;
	GtkMenuItem* _tmp23_;
	GtkMenuItem* _tmp24_;
	GtkMenuItem* _tmp25_;
	GtkMenuItem* _tmp26_;
	GtkMenuItem* _tmp27_;
	parent_class = G_OBJECT_CLASS (maya_event_menu_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAYA_TYPE_EVENT_MENU, MayaEventMenu);
	_tmp0_ = self->priv->_comp;
	_tmp1_ = g_object_get_data ((GObject*) _tmp0_, "source");
	_tmp2_ = _g_object_ref0 ((ESource*) _tmp1_);
	src = _tmp2_;
	_tmp4_ = src;
	_tmp5_ = e_source_get_writable (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_ == TRUE) {
		CalendarEventStore* _tmp7_;
		CalendarEventStore* _tmp8_;
		ESource* _tmp9_;
		_tmp7_ = calendar_event_store_get_default ();
		_tmp8_ = _tmp7_;
		_tmp9_ = src;
		_tmp3_ = calendar_event_store_calclient_is_readonly (_tmp8_, _tmp9_) == FALSE;
		_g_object_unref0 (_tmp8_);
	} else {
		_tmp3_ = FALSE;
	}
	sensitive = _tmp3_;
	_tmp10_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("Edit…"));
	g_object_ref_sink (_tmp10_);
	edit_item = _tmp10_;
	_tmp11_ = edit_item;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp11_, sensitive);
	_tmp12_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("Duplicate…"));
	g_object_ref_sink (_tmp12_);
	duplicate_item = _tmp12_;
	_tmp13_ = duplicate_item;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp13_, sensitive);
	_tmp14_ = self->priv->_comp;
	if (e_cal_component_has_recurrences (_tmp14_)) {
		GtkMenuItem* _tmp15_;
		GtkMenuItem* exception_item = NULL;
		GtkMenuItem* _tmp16_;
		GtkMenuItem* _tmp17_;
		GtkMenuItem* _tmp18_;
		GtkMenuItem* _tmp19_;
		_tmp15_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("Remove Event"));
		g_object_ref_sink (_tmp15_);
		_g_object_unref0 (remove_item);
		remove_item = _tmp15_;
		_tmp16_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("Remove Occurrence"));
		g_object_ref_sink (_tmp16_);
		exception_item = _tmp16_;
		_tmp17_ = exception_item;
		g_signal_connect_object (_tmp17_, "activate", (GCallback) _maya_event_menu_add_exception_gtk_menu_item_activate, self, 0);
		_tmp18_ = exception_item;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp18_, sensitive);
		_tmp19_ = exception_item;
		gtk_menu_shell_append ((GtkMenuShell*) self, _tmp19_);
		_g_object_unref0 (exception_item);
	} else {
		GtkMenuItem* _tmp20_;
		_tmp20_ = (GtkMenuItem*) gtk_menu_item_new_with_label (_ ("Remove"));
		g_object_ref_sink (_tmp20_);
		_g_object_unref0 (remove_item);
		remove_item = _tmp20_;
	}
	_tmp21_ = remove_item;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp21_, sensitive);
	_tmp22_ = remove_item;
	g_signal_connect_object (_tmp22_, "activate", (GCallback) _maya_event_menu_remove_event_gtk_menu_item_activate, self, 0);
	_tmp23_ = remove_item;
	gtk_menu_shell_append ((GtkMenuShell*) self, _tmp23_);
	_tmp24_ = edit_item;
	gtk_menu_shell_append ((GtkMenuShell*) self, _tmp24_);
	_tmp25_ = duplicate_item;
	gtk_menu_shell_append ((GtkMenuShell*) self, _tmp25_);
	_tmp26_ = edit_item;
	g_signal_connect_object (_tmp26_, "activate", (GCallback) __maya_event_menu___lambda4__gtk_menu_item_activate, self, 0);
	_tmp27_ = duplicate_item;
	g_signal_connect_object (_tmp27_, "activate", (GCallback) __maya_event_menu___lambda194__gtk_menu_item_activate, self, 0);
	gtk_widget_show_all ((GtkWidget*) self);
	_g_object_unref0 (remove_item);
	_g_object_unref0 (duplicate_item);
	_g_object_unref0 (edit_item);
	_g_object_unref0 (src);
	return obj;
}

static void
maya_event_menu_class_init (MayaEventMenuClass * klass,
                            gpointer klass_data)
{
	maya_event_menu_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MayaEventMenu_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_maya_event_menu_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_maya_event_menu_set_property;
	G_OBJECT_CLASS (klass)->constructor = maya_event_menu_constructor;
	G_OBJECT_CLASS (klass)->finalize = maya_event_menu_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), MAYA_EVENT_MENU_COMP_PROPERTY, maya_event_menu_properties[MAYA_EVENT_MENU_COMP_PROPERTY] = g_param_spec_object ("comp", "comp", "comp", e_cal_component_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
maya_event_menu_instance_init (MayaEventMenu * self,
                               gpointer klass)
{
	self->priv = maya_event_menu_get_instance_private (self);
}

static void
maya_event_menu_finalize (GObject * obj)
{
	MayaEventMenu * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAYA_TYPE_EVENT_MENU, MayaEventMenu);
	_g_object_unref0 (self->priv->_comp);
	G_OBJECT_CLASS (maya_event_menu_parent_class)->finalize (obj);
}

static GType
maya_event_menu_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MayaEventMenuClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) maya_event_menu_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MayaEventMenu), 0, (GInstanceInitFunc) maya_event_menu_instance_init, NULL };
	GType maya_event_menu_type_id;
	maya_event_menu_type_id = g_type_register_static (gtk_menu_get_type (), "MayaEventMenu", &g_define_type_info, 0);
	MayaEventMenu_private_offset = g_type_add_instance_private (maya_event_menu_type_id, sizeof (MayaEventMenuPrivate));
	return maya_event_menu_type_id;
}

GType
maya_event_menu_get_type (void)
{
	static volatile gsize maya_event_menu_type_id__once = 0;
	if (g_once_init_enter (&maya_event_menu_type_id__once)) {
		GType maya_event_menu_type_id;
		maya_event_menu_type_id = maya_event_menu_get_type_once ();
		g_once_init_leave (&maya_event_menu_type_id__once, maya_event_menu_type_id);
	}
	return maya_event_menu_type_id__once;
}

static void
_vala_maya_event_menu_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	MayaEventMenu * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MAYA_TYPE_EVENT_MENU, MayaEventMenu);
	switch (property_id) {
		case MAYA_EVENT_MENU_COMP_PROPERTY:
		g_value_set_object (value, maya_event_menu_get_comp (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_maya_event_menu_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	MayaEventMenu * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, MAYA_TYPE_EVENT_MENU, MayaEventMenu);
	switch (property_id) {
		case MAYA_EVENT_MENU_COMP_PROPERTY:
		maya_event_menu_set_comp (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

