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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 4 -*-
 * -*- coding: utf-8 -*-
 *
 * Copyright (C) 2011 ~ 2018 Deepin, Inc.
 *               2011 ~ 2018 Wang Yong
 *
 * Author:     Wang Yong <wangyong@deepin.com>
 * Maintainer: Wang Yong <wangyong@deepin.com>
 *
 * 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
 * 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/>.
 */

#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>
#include <json-glib/json-glib.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 MENU_TYPE_MENU_MANAGER_INTERFACE (menu_menu_manager_interface_get_type ())
#define MENU_MENU_MANAGER_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MENU_TYPE_MENU_MANAGER_INTERFACE, MenuMenuManagerInterface))
#define MENU_IS_MENU_MANAGER_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MENU_TYPE_MENU_MANAGER_INTERFACE))
#define MENU_MENU_MANAGER_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MENU_TYPE_MENU_MANAGER_INTERFACE, MenuMenuManagerInterfaceIface))

typedef struct _MenuMenuManagerInterface MenuMenuManagerInterface;
typedef struct _MenuMenuManagerInterfaceIface MenuMenuManagerInterfaceIface;

#define MENU_TYPE_MENU_MANAGER_INTERFACE_PROXY (menu_menu_manager_interface_proxy_get_type ())
typedef GDBusProxy MenuMenuManagerInterfaceProxy;
typedef GDBusProxyClass MenuMenuManagerInterfaceProxyClass;
#define _g_free0(var) (var = (g_free (var), NULL))

#define MENU_TYPE_MENU_INTERFACE (menu_menu_interface_get_type ())
#define MENU_MENU_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MENU_TYPE_MENU_INTERFACE, MenuMenuInterface))
#define MENU_IS_MENU_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MENU_TYPE_MENU_INTERFACE))
#define MENU_MENU_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MENU_TYPE_MENU_INTERFACE, MenuMenuInterfaceIface))

typedef struct _MenuMenuInterface MenuMenuInterface;
typedef struct _MenuMenuInterfaceIface MenuMenuInterfaceIface;

#define MENU_TYPE_MENU_INTERFACE_PROXY (menu_menu_interface_proxy_get_type ())
enum  {
	MENU_MENU_INTERFACE_ITEM_INVOKED_SIGNAL,
	MENU_MENU_INTERFACE_MENU_UNREGISTERED_SIGNAL,
	MENU_MENU_INTERFACE_NUM_SIGNALS
};
static guint menu_menu_interface_signals[MENU_MENU_INTERFACE_NUM_SIGNALS] = {0};
typedef GDBusProxy MenuMenuInterfaceProxy;
typedef GDBusProxyClass MenuMenuInterfaceProxyClass;

#define MENU_TYPE_MENU_ITEM (menu_menu_item_get_type ())
#define MENU_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MENU_TYPE_MENU_ITEM, MenuMenuItem))
#define MENU_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MENU_TYPE_MENU_ITEM, MenuMenuItemClass))
#define MENU_IS_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MENU_TYPE_MENU_ITEM))
#define MENU_IS_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MENU_TYPE_MENU_ITEM))
#define MENU_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MENU_TYPE_MENU_ITEM, MenuMenuItemClass))

typedef struct _MenuMenuItem MenuMenuItem;
typedef struct _MenuMenuItemClass MenuMenuItemClass;
typedef struct _MenuMenuItemPrivate MenuMenuItemPrivate;
enum  {
	MENU_MENU_ITEM_0_PROPERTY,
	MENU_MENU_ITEM_NUM_PROPERTIES
};
static GParamSpec* menu_menu_item_properties[MENU_MENU_ITEM_NUM_PROPERTIES];

#define MENU_TYPE_MENU (menu_menu_get_type ())
#define MENU_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MENU_TYPE_MENU, MenuMenu))
#define MENU_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MENU_TYPE_MENU, MenuMenuClass))
#define MENU_IS_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MENU_TYPE_MENU))
#define MENU_IS_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MENU_TYPE_MENU))
#define MENU_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MENU_TYPE_MENU, MenuMenuClass))

typedef struct _MenuMenu MenuMenu;
typedef struct _MenuMenuClass MenuMenuClass;
typedef struct _MenuMenuPrivate MenuMenuPrivate;
enum  {
	MENU_MENU_0_PROPERTY,
	MENU_MENU_NUM_PROPERTIES
};
static GParamSpec* menu_menu_properties[MENU_MENU_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block3Data Block3Data;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
enum  {
	MENU_MENU_CLICK_ITEM_SIGNAL,
	MENU_MENU_DESTROY_SIGNAL,
	MENU_MENU_NUM_SIGNALS
};
static guint menu_menu_signals[MENU_MENU_NUM_SIGNALS] = {0};

struct _MenuMenuManagerInterfaceIface {
	GTypeInterface parent_iface;
	gchar* (*RegisterMenu) (MenuMenuManagerInterface* self, GError** error);
	void (*UnregisterMenu) (MenuMenuManagerInterface* self, const gchar* object_path, GError** error);
};

struct _MenuMenuInterfaceIface {
	GTypeInterface parent_iface;
	void (*ShowMenu) (MenuMenuInterface* self, const gchar* menu_json_content, GError** error);
};

struct _MenuMenuItem {
	GObject parent_instance;
	MenuMenuItemPrivate * priv;
	gchar* menu_item_id;
	gchar* menu_item_text;
	GList* menu_item_submenu;
};

struct _MenuMenuItemClass {
	GObjectClass parent_class;
};

struct _MenuMenu {
	GObject parent_instance;
	MenuMenuPrivate * priv;
};

struct _MenuMenuClass {
	GObjectClass parent_class;
};

struct _MenuMenuPrivate {
	MenuMenuManagerInterface* menu_manager_interface;
	MenuMenuInterface* menu_interface;
	gboolean prefer_deepin_menu;
	gboolean inited;
};

struct _Block3Data {
	int _ref_count_;
	MenuMenu* self;
	gchar* item_id;
};

static gpointer menu_menu_item_parent_class = NULL;
static gint MenuMenu_private_offset;
static gpointer menu_menu_parent_class = NULL;
static gchar* menu_menu_menu_object_path;
static gchar* menu_menu_menu_object_path = NULL;

VALA_EXTERN GType menu_menu_manager_interface_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint menu_menu_manager_interface_register_object (void* object,
                                                   GDBusConnection* connection,
                                                   const gchar* path,
                                                   GError** error);
VALA_EXTERN GType menu_menu_manager_interface_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MenuMenuManagerInterface, g_object_unref)
VALA_EXTERN gchar* menu_menu_manager_interface_RegisterMenu (MenuMenuManagerInterface* self,
                                                 GError** error);
VALA_EXTERN void menu_menu_manager_interface_UnregisterMenu (MenuMenuManagerInterface* self,
                                                 const gchar* object_path,
                                                 GError** error);
static GType menu_menu_manager_interface_get_type_once (void);
static void menu_menu_manager_interface_proxy_g_signal (GDBusProxy* proxy,
                                                 const gchar* sender_name,
                                                 const gchar* signal_name,
                                                 GVariant* parameters);
static gchar* menu_menu_manager_interface_proxy_RegisterMenu (MenuMenuManagerInterface* self,
                                                       GError** error);
static void menu_menu_manager_interface_proxy_UnregisterMenu (MenuMenuManagerInterface* self,
                                                       const gchar* object_path,
                                                       GError** error);
static void menu_menu_manager_interface_proxy_menu_menu_manager_interface_interface_init (MenuMenuManagerInterfaceIface* iface);
static void _dbus_menu_menu_manager_interface_RegisterMenu (MenuMenuManagerInterface* self,
                                                     GVariant* _parameters_,
                                                     GDBusMethodInvocation* invocation);
static void _dbus_menu_menu_manager_interface_UnregisterMenu (MenuMenuManagerInterface* self,
                                                       GVariant* _parameters_,
                                                       GDBusMethodInvocation* invocation);
static void menu_menu_manager_interface_dbus_interface_method_call (GDBusConnection* connection,
                                                             const gchar* sender,
                                                             const gchar* object_path,
                                                             const gchar* interface_name,
                                                             const gchar* method_name,
                                                             GVariant* parameters,
                                                             GDBusMethodInvocation* invocation,
                                                             gpointer user_data);
static GVariant* menu_menu_manager_interface_dbus_interface_get_property (GDBusConnection* connection,
                                                                   const gchar* sender,
                                                                   const gchar* object_path,
                                                                   const gchar* interface_name,
                                                                   const gchar* property_name,
                                                                   GError** error,
                                                                   gpointer user_data);
static gboolean menu_menu_manager_interface_dbus_interface_set_property (GDBusConnection* connection,
                                                                  const gchar* sender,
                                                                  const gchar* object_path,
                                                                  const gchar* interface_name,
                                                                  const gchar* property_name,
                                                                  GVariant* value,
                                                                  GError** error,
                                                                  gpointer user_data);
static void _menu_menu_manager_interface_unregister_object (gpointer user_data);
VALA_EXTERN GType menu_menu_interface_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint menu_menu_interface_register_object (void* object,
                                           GDBusConnection* connection,
                                           const gchar* path,
                                           GError** error);
VALA_EXTERN GType menu_menu_interface_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MenuMenuInterface, g_object_unref)
VALA_EXTERN void menu_menu_interface_ShowMenu (MenuMenuInterface* self,
                                   const gchar* menu_json_content,
                                   GError** error);
static void g_cclosure_user_marshal_VOID__STRING_BOOLEAN (GClosure * closure,
                                                   GValue * return_value,
                                                   guint n_param_values,
                                                   const GValue * param_values,
                                                   gpointer invocation_hint,
                                                   gpointer marshal_data);
static GType menu_menu_interface_get_type_once (void);
static void menu_menu_interface_proxy_g_signal (GDBusProxy* proxy,
                                         const gchar* sender_name,
                                         const gchar* signal_name,
                                         GVariant* parameters);
static void _dbus_handle_menu_menu_interface_item_invoked (MenuMenuInterface* self,
                                                    GVariant* parameters);
static void _dbus_handle_menu_menu_interface_menu_unregistered (MenuMenuInterface* self,
                                                         GVariant* parameters);
static void menu_menu_interface_proxy_ShowMenu (MenuMenuInterface* self,
                                         const gchar* menu_json_content,
                                         GError** error);
static void menu_menu_interface_proxy_menu_menu_interface_interface_init (MenuMenuInterfaceIface* iface);
static void _dbus_menu_menu_interface_ShowMenu (MenuMenuInterface* self,
                                         GVariant* _parameters_,
                                         GDBusMethodInvocation* invocation);
static void menu_menu_interface_dbus_interface_method_call (GDBusConnection* connection,
                                                     const gchar* sender,
                                                     const gchar* object_path,
                                                     const gchar* interface_name,
                                                     const gchar* method_name,
                                                     GVariant* parameters,
                                                     GDBusMethodInvocation* invocation,
                                                     gpointer user_data);
static GVariant* menu_menu_interface_dbus_interface_get_property (GDBusConnection* connection,
                                                           const gchar* sender,
                                                           const gchar* object_path,
                                                           const gchar* interface_name,
                                                           const gchar* property_name,
                                                           GError** error,
                                                           gpointer user_data);
static gboolean menu_menu_interface_dbus_interface_set_property (GDBusConnection* connection,
                                                          const gchar* sender,
                                                          const gchar* object_path,
                                                          const gchar* interface_name,
                                                          const gchar* property_name,
                                                          GVariant* value,
                                                          GError** error,
                                                          gpointer user_data);
static void _dbus_menu_menu_interface_item_invoked (GObject* _sender,
                                             const gchar* item_id,
                                             gboolean checked,
                                             gpointer* _data);
static void _dbus_menu_menu_interface_menu_unregistered (GObject* _sender,
                                                  gpointer* _data);
static void _menu_menu_interface_unregister_object (gpointer user_data);
VALA_EXTERN GType menu_menu_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MenuMenuItem, g_object_unref)
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
VALA_EXTERN MenuMenuItem* menu_menu_item_new (const gchar* item_id,
                                  const gchar* item_text);
VALA_EXTERN MenuMenuItem* menu_menu_item_construct (GType object_type,
                                        const gchar* item_id,
                                        const gchar* item_text);
VALA_EXTERN void menu_menu_item_add_submenu_item (MenuMenuItem* self,
                                      MenuMenuItem* item);
static void menu_menu_item_finalize (GObject * obj);
static GType menu_menu_item_get_type_once (void);
VALA_EXTERN GType menu_menu_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MenuMenu, g_object_unref)
VALA_EXTERN MenuMenu* menu_menu_new (void);
VALA_EXTERN MenuMenu* menu_menu_construct (GType object_type);
VALA_EXTERN void menu_menu_set_prefer_deepin_menu (MenuMenu* self,
                                       gboolean _prefer_deepin_menu);
static void menu_menu_init (MenuMenu* self);
static void menu_menu_register_deepin_menu_dbus_if_needed (MenuMenu* self);
static void menu_menu_unregister (MenuMenu* self);
static void ____lambda4_ (MenuMenu* self,
                   const gchar* item_id,
                   gboolean checked);
static void _____lambda4__menu_menu_interface_item_invoked (MenuMenuInterface* _sender,
                                                     const gchar* item_id,
                                                     gboolean checked,
                                                     gpointer self);
static void ____lambda5_ (MenuMenu* self);
static void _____lambda5__menu_menu_interface_menu_unregistered (MenuMenuInterface* _sender,
                                                          gpointer self);
VALA_EXTERN void menu_menu_popup_at_position (MenuMenu* self,
                                  GList* menu_content,
                                  gint x,
                                  gint y);
static void menu_menu_show_deepin_menu (MenuMenu* self,
                                 GList* menu_content,
                                 gint x,
                                 gint y);
static void menu_menu_show_gtk_menu_at_pointer (MenuMenu* self,
                                         GList* menu_content);
static GtkMenu* menu_menu_create_gtk_menu (MenuMenu* self,
                                    GList* menu_content);
VALA_EXTERN gchar* utils_get_menu_css (void);
static GtkMenuItem* menu_menu_create_gtk_menu_item (MenuMenu* self,
                                             const gchar* item_id,
                                             const gchar* item_text);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static void __lambda6_ (Block3Data* _data3_);
static void ___lambda6__gtk_menu_item_activate (GtkMenuItem* _sender,
                                         gpointer self);
VALA_EXTERN gdouble utils_get_default_monitor_scale (void);
VALA_EXTERN gdouble utils_get_dde_scale_ratio (void);
static gchar* menu_menu_get_items_node (MenuMenu* self,
                                 GList* menu_content);
static void _vala_JsonNode_free (JsonNode* self);
static JsonNode* menu_menu_get_item_node (MenuMenu* self,
                                   MenuMenuItem* item);
static void menu_menu_finalize (GObject * obj);
static GType menu_menu_get_type_once (void);

static const GDBusArgInfo _menu_menu_manager_interface_dbus_arg_info_RegisterMenu_result = {-1, "result", "s", NULL};
static const GDBusArgInfo * const _menu_menu_manager_interface_dbus_arg_info_RegisterMenu_in[] = {NULL};
static const GDBusArgInfo * const _menu_menu_manager_interface_dbus_arg_info_RegisterMenu_out[] = {&_menu_menu_manager_interface_dbus_arg_info_RegisterMenu_result, NULL};
static const GDBusMethodInfo _menu_menu_manager_interface_dbus_method_info_RegisterMenu = {-1, "RegisterMenu", (GDBusArgInfo **) (&_menu_menu_manager_interface_dbus_arg_info_RegisterMenu_in), (GDBusArgInfo **) (&_menu_menu_manager_interface_dbus_arg_info_RegisterMenu_out), NULL};
static const GDBusArgInfo _menu_menu_manager_interface_dbus_arg_info_UnregisterMenu_object_path = {-1, "object_path", "s", NULL};
static const GDBusArgInfo * const _menu_menu_manager_interface_dbus_arg_info_UnregisterMenu_in[] = {&_menu_menu_manager_interface_dbus_arg_info_UnregisterMenu_object_path, NULL};
static const GDBusArgInfo * const _menu_menu_manager_interface_dbus_arg_info_UnregisterMenu_out[] = {NULL};
static const GDBusMethodInfo _menu_menu_manager_interface_dbus_method_info_UnregisterMenu = {-1, "UnregisterMenu", (GDBusArgInfo **) (&_menu_menu_manager_interface_dbus_arg_info_UnregisterMenu_in), (GDBusArgInfo **) (&_menu_menu_manager_interface_dbus_arg_info_UnregisterMenu_out), NULL};
static const GDBusMethodInfo * const _menu_menu_manager_interface_dbus_method_info[] = {&_menu_menu_manager_interface_dbus_method_info_RegisterMenu, &_menu_menu_manager_interface_dbus_method_info_UnregisterMenu, NULL};
static const GDBusSignalInfo * const _menu_menu_manager_interface_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _menu_menu_manager_interface_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _menu_menu_manager_interface_dbus_interface_info = {-1, "com.deepin.menu.Manager", (GDBusMethodInfo **) (&_menu_menu_manager_interface_dbus_method_info), (GDBusSignalInfo **) (&_menu_menu_manager_interface_dbus_signal_info), (GDBusPropertyInfo **) (&_menu_menu_manager_interface_dbus_property_info), NULL};
static const GDBusInterfaceVTable _menu_menu_manager_interface_dbus_interface_vtable = {menu_menu_manager_interface_dbus_interface_method_call, menu_menu_manager_interface_dbus_interface_get_property, menu_menu_manager_interface_dbus_interface_set_property};
static const GDBusArgInfo _menu_menu_interface_dbus_arg_info_ShowMenu_menu_json_content = {-1, "menu_json_content", "s", NULL};
static const GDBusArgInfo * const _menu_menu_interface_dbus_arg_info_ShowMenu_in[] = {&_menu_menu_interface_dbus_arg_info_ShowMenu_menu_json_content, NULL};
static const GDBusArgInfo * const _menu_menu_interface_dbus_arg_info_ShowMenu_out[] = {NULL};
static const GDBusMethodInfo _menu_menu_interface_dbus_method_info_ShowMenu = {-1, "ShowMenu", (GDBusArgInfo **) (&_menu_menu_interface_dbus_arg_info_ShowMenu_in), (GDBusArgInfo **) (&_menu_menu_interface_dbus_arg_info_ShowMenu_out), NULL};
static const GDBusMethodInfo * const _menu_menu_interface_dbus_method_info[] = {&_menu_menu_interface_dbus_method_info_ShowMenu, NULL};
static const GDBusArgInfo _menu_menu_interface_dbus_arg_info_item_invoked_item_id = {-1, "item_id", "s", NULL};
static const GDBusArgInfo _menu_menu_interface_dbus_arg_info_item_invoked_checked = {-1, "checked", "b", NULL};
static const GDBusArgInfo * const _menu_menu_interface_dbus_arg_info_item_invoked[] = {&_menu_menu_interface_dbus_arg_info_item_invoked_item_id, &_menu_menu_interface_dbus_arg_info_item_invoked_checked, NULL};
static const GDBusSignalInfo _menu_menu_interface_dbus_signal_info_item_invoked = {-1, "ItemInvoked", (GDBusArgInfo **) (&_menu_menu_interface_dbus_arg_info_item_invoked), NULL};
static const GDBusArgInfo * const _menu_menu_interface_dbus_arg_info_menu_unregistered[] = {NULL};
static const GDBusSignalInfo _menu_menu_interface_dbus_signal_info_menu_unregistered = {-1, "MenuUnregistered", (GDBusArgInfo **) (&_menu_menu_interface_dbus_arg_info_menu_unregistered), NULL};
static const GDBusSignalInfo * const _menu_menu_interface_dbus_signal_info[] = {&_menu_menu_interface_dbus_signal_info_item_invoked, &_menu_menu_interface_dbus_signal_info_menu_unregistered, NULL};
static const GDBusPropertyInfo * const _menu_menu_interface_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _menu_menu_interface_dbus_interface_info = {-1, "com.deepin.menu.Menu", (GDBusMethodInfo **) (&_menu_menu_interface_dbus_method_info), (GDBusSignalInfo **) (&_menu_menu_interface_dbus_signal_info), (GDBusPropertyInfo **) (&_menu_menu_interface_dbus_property_info), NULL};
static const GDBusInterfaceVTable _menu_menu_interface_dbus_interface_vtable = {menu_menu_interface_dbus_interface_method_call, menu_menu_interface_dbus_interface_get_property, menu_menu_interface_dbus_interface_set_property};

gchar*
menu_menu_manager_interface_RegisterMenu (MenuMenuManagerInterface* self,
                                          GError** error)
{
	MenuMenuManagerInterfaceIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = MENU_MENU_MANAGER_INTERFACE_GET_INTERFACE (self);
	if (_iface_->RegisterMenu) {
		return _iface_->RegisterMenu (self, error);
	}
	return NULL;
}

void
menu_menu_manager_interface_UnregisterMenu (MenuMenuManagerInterface* self,
                                            const gchar* object_path,
                                            GError** error)
{
	MenuMenuManagerInterfaceIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = MENU_MENU_MANAGER_INTERFACE_GET_INTERFACE (self);
	if (_iface_->UnregisterMenu) {
		_iface_->UnregisterMenu (self, object_path, error);
	}
}

static void
menu_menu_manager_interface_default_init (MenuMenuManagerInterfaceIface * iface,
                                          gpointer iface_data)
{
}

static GType
menu_menu_manager_interface_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MenuMenuManagerInterfaceIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) menu_menu_manager_interface_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType menu_menu_manager_interface_type_id;
	menu_menu_manager_interface_type_id = g_type_register_static (G_TYPE_INTERFACE, "MenuMenuManagerInterface", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (menu_menu_manager_interface_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (menu_menu_manager_interface_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) menu_menu_manager_interface_proxy_get_type);
	g_type_set_qdata (menu_menu_manager_interface_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "com.deepin.menu.Manager");
	g_type_set_qdata (menu_menu_manager_interface_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_menu_menu_manager_interface_dbus_interface_info));
	g_type_set_qdata (menu_menu_manager_interface_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) menu_menu_manager_interface_register_object);
	return menu_menu_manager_interface_type_id;
}

GType
menu_menu_manager_interface_get_type (void)
{
	static volatile gsize menu_menu_manager_interface_type_id__once = 0;
	if (g_once_init_enter (&menu_menu_manager_interface_type_id__once)) {
		GType menu_menu_manager_interface_type_id;
		menu_menu_manager_interface_type_id = menu_menu_manager_interface_get_type_once ();
		g_once_init_leave (&menu_menu_manager_interface_type_id__once, menu_menu_manager_interface_type_id);
	}
	return menu_menu_manager_interface_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (MenuMenuManagerInterfaceProxy, menu_menu_manager_interface_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (MENU_TYPE_MENU_MANAGER_INTERFACE, menu_menu_manager_interface_proxy_menu_menu_manager_interface_interface_init) )
static void
menu_menu_manager_interface_proxy_class_init (MenuMenuManagerInterfaceProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = menu_menu_manager_interface_proxy_g_signal;
}

static void
menu_menu_manager_interface_proxy_g_signal (GDBusProxy* proxy,
                                            const gchar* sender_name,
                                            const gchar* signal_name,
                                            GVariant* parameters)
{
}

static void
menu_menu_manager_interface_proxy_init (MenuMenuManagerInterfaceProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_menu_menu_manager_interface_dbus_interface_info));
}

static gchar*
menu_menu_manager_interface_proxy_RegisterMenu (MenuMenuManagerInterface* self,
                                                GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	GVariant *_reply;
	GVariantIter _reply_iter;
	gchar* _result = NULL;
	GVariant* _tmp0_;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "com.deepin.menu.Manager", "RegisterMenu");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	_reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
	g_object_unref (_message);
	if (!_reply_message) {
		return NULL;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return NULL;
	}
	_reply = g_dbus_message_get_body (_reply_message);
	g_variant_iter_init (&_reply_iter, _reply);
	_tmp0_ = g_variant_iter_next_value (&_reply_iter);
	_result = g_variant_dup_string (_tmp0_, NULL);
	g_variant_unref (_tmp0_);
	g_object_unref (_reply_message);
	return _result;
}

static void
menu_menu_manager_interface_proxy_UnregisterMenu (MenuMenuManagerInterface* self,
                                                  const gchar* object_path,
                                                  GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "com.deepin.menu.Manager", "UnregisterMenu");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (object_path));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	_reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
	g_object_unref (_message);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}

static void
menu_menu_manager_interface_proxy_menu_menu_manager_interface_interface_init (MenuMenuManagerInterfaceIface* iface)
{
	iface->RegisterMenu = menu_menu_manager_interface_proxy_RegisterMenu;
	iface->UnregisterMenu = menu_menu_manager_interface_proxy_UnregisterMenu;
}

static void
_dbus_menu_menu_manager_interface_RegisterMenu (MenuMenuManagerInterface* self,
                                                GVariant* _parameters_,
                                                GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gchar* result;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	result = menu_menu_manager_interface_RegisterMenu (self, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result));
	_g_free0 (result);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}

static void
_dbus_menu_menu_manager_interface_UnregisterMenu (MenuMenuManagerInterface* self,
                                                  GVariant* _parameters_,
                                                  GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar* object_path = NULL;
	GVariant* _tmp1_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp1_ = g_variant_iter_next_value (&_arguments_iter);
	object_path = g_variant_dup_string (_tmp1_, NULL);
	g_variant_unref (_tmp1_);
	menu_menu_manager_interface_UnregisterMenu (self, object_path, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	_g_free0 (object_path);
	;
}

static void
menu_menu_manager_interface_dbus_interface_method_call (GDBusConnection* connection,
                                                        const gchar* sender,
                                                        const gchar* object_path,
                                                        const gchar* interface_name,
                                                        const gchar* method_name,
                                                        GVariant* parameters,
                                                        GDBusMethodInvocation* invocation,
                                                        gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "RegisterMenu") == 0) {
		_dbus_menu_menu_manager_interface_RegisterMenu (object, parameters, invocation);
	} else if (strcmp (method_name, "UnregisterMenu") == 0) {
		_dbus_menu_menu_manager_interface_UnregisterMenu (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
menu_menu_manager_interface_dbus_interface_get_property (GDBusConnection* connection,
                                                         const gchar* sender,
                                                         const gchar* object_path,
                                                         const gchar* interface_name,
                                                         const gchar* property_name,
                                                         GError** error,
                                                         gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return NULL;
}

static gboolean
menu_menu_manager_interface_dbus_interface_set_property (GDBusConnection* connection,
                                                         const gchar* sender,
                                                         const gchar* object_path,
                                                         const gchar* interface_name,
                                                         const gchar* property_name,
                                                         GVariant* value,
                                                         GError** error,
                                                         gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return FALSE;
}

guint
menu_menu_manager_interface_register_object (gpointer object,
                                             GDBusConnection* connection,
                                             const gchar* path,
                                             GError** error)
{
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_menu_menu_manager_interface_dbus_interface_info), &_menu_menu_manager_interface_dbus_interface_vtable, data, _menu_menu_manager_interface_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

static void
_menu_menu_manager_interface_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

void
menu_menu_interface_ShowMenu (MenuMenuInterface* self,
                              const gchar* menu_json_content,
                              GError** error)
{
	MenuMenuInterfaceIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = MENU_MENU_INTERFACE_GET_INTERFACE (self);
	if (_iface_->ShowMenu) {
		_iface_->ShowMenu (self, menu_json_content, error);
	}
}

static void
g_cclosure_user_marshal_VOID__STRING_BOOLEAN (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_BOOLEAN) (gpointer data1, const char* arg_1, gboolean arg_2, gpointer data2);
	register GMarshalFunc_VOID__STRING_BOOLEAN callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_boolean (param_values + 2), data2);
}

static void
menu_menu_interface_default_init (MenuMenuInterfaceIface * iface,
                                  gpointer iface_data)
{
	menu_menu_interface_signals[MENU_MENU_INTERFACE_ITEM_INVOKED_SIGNAL] = g_signal_new ("item-invoked", MENU_TYPE_MENU_INTERFACE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_BOOLEAN, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN);
	menu_menu_interface_signals[MENU_MENU_INTERFACE_MENU_UNREGISTERED_SIGNAL] = g_signal_new ("menu-unregistered", MENU_TYPE_MENU_INTERFACE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static GType
menu_menu_interface_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MenuMenuInterfaceIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) menu_menu_interface_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType menu_menu_interface_type_id;
	menu_menu_interface_type_id = g_type_register_static (G_TYPE_INTERFACE, "MenuMenuInterface", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (menu_menu_interface_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (menu_menu_interface_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) menu_menu_interface_proxy_get_type);
	g_type_set_qdata (menu_menu_interface_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "com.deepin.menu.Menu");
	g_type_set_qdata (menu_menu_interface_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_menu_menu_interface_dbus_interface_info));
	g_type_set_qdata (menu_menu_interface_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) menu_menu_interface_register_object);
	return menu_menu_interface_type_id;
}

GType
menu_menu_interface_get_type (void)
{
	static volatile gsize menu_menu_interface_type_id__once = 0;
	if (g_once_init_enter (&menu_menu_interface_type_id__once)) {
		GType menu_menu_interface_type_id;
		menu_menu_interface_type_id = menu_menu_interface_get_type_once ();
		g_once_init_leave (&menu_menu_interface_type_id__once, menu_menu_interface_type_id);
	}
	return menu_menu_interface_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (MenuMenuInterfaceProxy, menu_menu_interface_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (MENU_TYPE_MENU_INTERFACE, menu_menu_interface_proxy_menu_menu_interface_interface_init) )
static void
menu_menu_interface_proxy_class_init (MenuMenuInterfaceProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = menu_menu_interface_proxy_g_signal;
}

static void
_dbus_handle_menu_menu_interface_item_invoked (MenuMenuInterface* self,
                                               GVariant* parameters)
{
	GVariantIter _arguments_iter;
	gchar* item_id = NULL;
	GVariant* _tmp2_;
	gboolean checked = FALSE;
	GVariant* _tmp3_;
	g_variant_iter_init (&_arguments_iter, parameters);
	_tmp2_ = g_variant_iter_next_value (&_arguments_iter);
	item_id = g_variant_dup_string (_tmp2_, NULL);
	g_variant_unref (_tmp2_);
	_tmp3_ = g_variant_iter_next_value (&_arguments_iter);
	checked = g_variant_get_boolean (_tmp3_);
	g_variant_unref (_tmp3_);
	g_signal_emit_by_name (self, "item-invoked", item_id, checked);
	_g_free0 (item_id);
}

static void
_dbus_handle_menu_menu_interface_menu_unregistered (MenuMenuInterface* self,
                                                    GVariant* parameters)
{
	GVariantIter _arguments_iter;
	g_variant_iter_init (&_arguments_iter, parameters);
	g_signal_emit_by_name (self, "menu-unregistered");
}

static void
menu_menu_interface_proxy_g_signal (GDBusProxy* proxy,
                                    const gchar* sender_name,
                                    const gchar* signal_name,
                                    GVariant* parameters)
{
	if (strcmp (signal_name, "ItemInvoked") == 0) {
		_dbus_handle_menu_menu_interface_item_invoked ((MenuMenuInterface*) proxy, parameters);
	} else if (strcmp (signal_name, "MenuUnregistered") == 0) {
		_dbus_handle_menu_menu_interface_menu_unregistered ((MenuMenuInterface*) proxy, parameters);
	}
}

static void
menu_menu_interface_proxy_init (MenuMenuInterfaceProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_menu_menu_interface_dbus_interface_info));
}

static void
menu_menu_interface_proxy_ShowMenu (MenuMenuInterface* self,
                                    const gchar* menu_json_content,
                                    GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "com.deepin.menu.Menu", "ShowMenu");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (menu_json_content));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	_reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
	g_object_unref (_message);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}

static void
menu_menu_interface_proxy_menu_menu_interface_interface_init (MenuMenuInterfaceIface* iface)
{
	iface->ShowMenu = menu_menu_interface_proxy_ShowMenu;
}

static void
_dbus_menu_menu_interface_ShowMenu (MenuMenuInterface* self,
                                    GVariant* _parameters_,
                                    GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar* menu_json_content = NULL;
	GVariant* _tmp4_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp4_ = g_variant_iter_next_value (&_arguments_iter);
	menu_json_content = g_variant_dup_string (_tmp4_, NULL);
	g_variant_unref (_tmp4_);
	menu_menu_interface_ShowMenu (self, menu_json_content, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	_g_free0 (menu_json_content);
	;
}

static void
menu_menu_interface_dbus_interface_method_call (GDBusConnection* connection,
                                                const gchar* sender,
                                                const gchar* object_path,
                                                const gchar* interface_name,
                                                const gchar* method_name,
                                                GVariant* parameters,
                                                GDBusMethodInvocation* invocation,
                                                gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "ShowMenu") == 0) {
		_dbus_menu_menu_interface_ShowMenu (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
menu_menu_interface_dbus_interface_get_property (GDBusConnection* connection,
                                                 const gchar* sender,
                                                 const gchar* object_path,
                                                 const gchar* interface_name,
                                                 const gchar* property_name,
                                                 GError** error,
                                                 gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return NULL;
}

static gboolean
menu_menu_interface_dbus_interface_set_property (GDBusConnection* connection,
                                                 const gchar* sender,
                                                 const gchar* object_path,
                                                 const gchar* interface_name,
                                                 const gchar* property_name,
                                                 GVariant* value,
                                                 GError** error,
                                                 gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return FALSE;
}

static void
_dbus_menu_menu_interface_item_invoked (GObject* _sender,
                                        const gchar* item_id,
                                        gboolean checked,
                                        gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (item_id));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (checked));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "com.deepin.menu.Menu", "ItemInvoked", _arguments, NULL);
}

static void
_dbus_menu_menu_interface_menu_unregistered (GObject* _sender,
                                             gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "com.deepin.menu.Menu", "MenuUnregistered", _arguments, NULL);
}

guint
menu_menu_interface_register_object (gpointer object,
                                     GDBusConnection* connection,
                                     const gchar* path,
                                     GError** error)
{
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_menu_menu_interface_dbus_interface_info), &_menu_menu_interface_dbus_interface_vtable, data, _menu_menu_interface_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "item-invoked", (GCallback) _dbus_menu_menu_interface_item_invoked, data);
	g_signal_connect (object, "menu-unregistered", (GCallback) _dbus_menu_menu_interface_menu_unregistered, data);
	return result;
}

static void
_menu_menu_interface_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_signal_handlers_disconnect_by_func (data[0], _dbus_menu_menu_interface_item_invoked, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_menu_menu_interface_menu_unregistered, data);
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

MenuMenuItem*
menu_menu_item_construct (GType object_type,
                          const gchar* item_id,
                          const gchar* item_text)
{
	MenuMenuItem * self = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (item_id != NULL, NULL);
	g_return_val_if_fail (item_text != NULL, NULL);
	self = (MenuMenuItem*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (item_id);
	_g_free0 (self->menu_item_id);
	self->menu_item_id = _tmp0_;
	_tmp1_ = g_strdup (item_text);
	_g_free0 (self->menu_item_text);
	self->menu_item_text = _tmp1_;
	(self->menu_item_submenu == NULL) ? NULL : (self->menu_item_submenu = (_g_list_free__g_object_unref0_ (self->menu_item_submenu), NULL));
	self->menu_item_submenu = NULL;
	return self;
}

MenuMenuItem*
menu_menu_item_new (const gchar* item_id,
                    const gchar* item_text)
{
	return menu_menu_item_construct (MENU_TYPE_MENU_ITEM, item_id, item_text);
}

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

void
menu_menu_item_add_submenu_item (MenuMenuItem* self,
                                 MenuMenuItem* item)
{
	MenuMenuItem* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (item != NULL);
	_tmp0_ = _g_object_ref0 (item);
	self->menu_item_submenu = g_list_append (self->menu_item_submenu, _tmp0_);
}

static void
menu_menu_item_class_init (MenuMenuItemClass * klass,
                           gpointer klass_data)
{
	menu_menu_item_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = menu_menu_item_finalize;
}

static void
menu_menu_item_instance_init (MenuMenuItem * self,
                              gpointer klass)
{
}

static void
menu_menu_item_finalize (GObject * obj)
{
	MenuMenuItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MENU_TYPE_MENU_ITEM, MenuMenuItem);
	_g_free0 (self->menu_item_id);
	_g_free0 (self->menu_item_text);
	(self->menu_item_submenu == NULL) ? NULL : (self->menu_item_submenu = (_g_list_free__g_object_unref0_ (self->menu_item_submenu), NULL));
	G_OBJECT_CLASS (menu_menu_item_parent_class)->finalize (obj);
}

static GType
menu_menu_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MenuMenuItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) menu_menu_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MenuMenuItem), 0, (GInstanceInitFunc) menu_menu_item_instance_init, NULL };
	GType menu_menu_item_type_id;
	menu_menu_item_type_id = g_type_register_static (G_TYPE_OBJECT, "MenuMenuItem", &g_define_type_info, 0);
	return menu_menu_item_type_id;
}

GType
menu_menu_item_get_type (void)
{
	static volatile gsize menu_menu_item_type_id__once = 0;
	if (g_once_init_enter (&menu_menu_item_type_id__once)) {
		GType menu_menu_item_type_id;
		menu_menu_item_type_id = menu_menu_item_get_type_once ();
		g_once_init_leave (&menu_menu_item_type_id__once, menu_menu_item_type_id);
	}
	return menu_menu_item_type_id__once;
}

static inline gpointer
menu_menu_get_instance_private (MenuMenu* self)
{
	return G_STRUCT_MEMBER_P (self, MenuMenu_private_offset);
}

MenuMenu*
menu_menu_construct (GType object_type)
{
	MenuMenu * self = NULL;
	self = (MenuMenu*) g_object_new (object_type, NULL);
	return self;
}

MenuMenu*
menu_menu_new (void)
{
	return menu_menu_construct (MENU_TYPE_MENU);
}

void
menu_menu_set_prefer_deepin_menu (MenuMenu* self,
                                  gboolean _prefer_deepin_menu)
{
	g_return_if_fail (self != NULL);
	self->priv->prefer_deepin_menu = _prefer_deepin_menu;
}

static void
menu_menu_init (MenuMenu* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->inited) {
		return;
	}
	menu_menu_register_deepin_menu_dbus_if_needed (self);
	self->priv->inited = TRUE;
}

static void
____lambda4_ (MenuMenu* self,
              const gchar* item_id,
              gboolean checked)
{
	g_return_if_fail (item_id != NULL);
	g_signal_emit (self, menu_menu_signals[MENU_MENU_CLICK_ITEM_SIGNAL], 0, item_id);
}

static void
_____lambda4__menu_menu_interface_item_invoked (MenuMenuInterface* _sender,
                                                const gchar* item_id,
                                                gboolean checked,
                                                gpointer self)
{
	____lambda4_ ((MenuMenu*) self, item_id, checked);
}

static void
____lambda5_ (MenuMenu* self)
{
	_g_free0 (menu_menu_menu_object_path);
	menu_menu_menu_object_path = NULL;
	g_signal_emit (self, menu_menu_signals[MENU_MENU_DESTROY_SIGNAL], 0);
}

static void
_____lambda5__menu_menu_interface_menu_unregistered (MenuMenuInterface* _sender,
                                                     gpointer self)
{
	____lambda5_ ((MenuMenu*) self);
}

static void
menu_menu_register_deepin_menu_dbus_if_needed (MenuMenu* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	if (self->priv->prefer_deepin_menu) {
		{
			MenuMenuManagerInterface* _tmp0_ = NULL;
			MenuMenuManagerInterface* _tmp1_;
			MenuMenuManagerInterface* _tmp2_;
			const gchar* _tmp3_;
			gchar* _tmp4_ = NULL;
			MenuMenuManagerInterface* _tmp5_;
			gchar* _tmp6_;
			gchar* _tmp7_;
			MenuMenuInterface* _tmp8_ = NULL;
			const gchar* _tmp9_;
			MenuMenuInterface* _tmp10_;
			MenuMenuInterface* _tmp11_;
			MenuMenuInterface* _tmp12_;
			MenuMenuInterface* _tmp13_;
			_tmp1_ = (MenuMenuManagerInterface*) g_initable_new (MENU_TYPE_MENU_MANAGER_INTERFACE_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", "com.deepin.menu", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/com/deepin/menu", "g-interface-name", "com.deepin.menu.Manager", NULL);
			_tmp0_ = (MenuMenuManagerInterface*) _tmp1_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_tmp2_ = _tmp0_;
			_tmp0_ = NULL;
			_g_object_unref0 (self->priv->menu_manager_interface);
			self->priv->menu_manager_interface = _tmp2_;
			_tmp3_ = menu_menu_menu_object_path;
			if (_tmp3_ != NULL) {
				menu_menu_unregister (self);
			}
			_tmp5_ = self->priv->menu_manager_interface;
			_tmp6_ = menu_menu_manager_interface_RegisterMenu (_tmp5_, &_inner_error0_);
			_tmp4_ = _tmp6_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (_tmp0_);
				goto __catch0_g_error;
			}
			_tmp7_ = _tmp4_;
			_tmp4_ = NULL;
			_g_free0 (menu_menu_menu_object_path);
			menu_menu_menu_object_path = _tmp7_;
			_tmp9_ = menu_menu_menu_object_path;
			_tmp10_ = (MenuMenuInterface*) g_initable_new (MENU_TYPE_MENU_INTERFACE_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", "com.deepin.menu", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", _tmp9_, "g-interface-name", "com.deepin.menu.Menu", NULL);
			_tmp8_ = (MenuMenuInterface*) _tmp10_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_free0 (_tmp4_);
				_g_object_unref0 (_tmp0_);
				goto __catch0_g_error;
			}
			_tmp11_ = _tmp8_;
			_tmp8_ = NULL;
			_g_object_unref0 (self->priv->menu_interface);
			self->priv->menu_interface = _tmp11_;
			_tmp12_ = self->priv->menu_interface;
			g_signal_connect_object (_tmp12_, "item-invoked", (GCallback) _____lambda4__menu_menu_interface_item_invoked, self, 0);
			_tmp13_ = self->priv->menu_interface;
			g_signal_connect_object (_tmp13_, "menu-unregistered", (GCallback) _____lambda5__menu_menu_interface_menu_unregistered, self, 0);
			_g_object_unref0 (_tmp8_);
			_g_free0 (_tmp4_);
			_g_object_unref0 (_tmp0_);
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			FILE* _tmp14_;
			GError* _tmp15_;
			const gchar* _tmp16_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			self->priv->prefer_deepin_menu = FALSE;
			_tmp14_ = stderr;
			_tmp15_ = e;
			_tmp16_ = _tmp15_->message;
			fprintf (_tmp14_, "%s\n", _tmp16_);
			_g_error_free0 (e);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
}

static void
menu_menu_unregister (MenuMenu* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		MenuMenuManagerInterface* _tmp0_;
		const gchar* _tmp1_;
		_tmp0_ = self->priv->menu_manager_interface;
		_tmp1_ = menu_menu_menu_object_path;
		menu_menu_manager_interface_UnregisterMenu (_tmp0_, _tmp1_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		FILE* _tmp2_;
		GError* _tmp3_;
		const gchar* _tmp4_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = stderr;
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		fprintf (_tmp2_, "%s\n", _tmp4_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_free0 (menu_menu_menu_object_path);
	menu_menu_menu_object_path = NULL;
}

void
menu_menu_popup_at_position (MenuMenu* self,
                             GList* menu_content,
                             gint x,
                             gint y)
{
	g_return_if_fail (self != NULL);
	menu_menu_init (self);
	if (self->priv->prefer_deepin_menu) {
		menu_menu_show_deepin_menu (self, menu_content, x, y);
	} else {
		menu_menu_show_gtk_menu_at_pointer (self, menu_content);
	}
}

static GtkMenu*
menu_menu_create_gtk_menu (MenuMenu* self,
                           GList* menu_content)
{
	GdkScreen* screen = NULL;
	GdkScreen* _tmp0_;
	GdkScreen* _tmp1_;
	GtkCssProvider* provider = NULL;
	GtkCssProvider* _tmp2_;
	GtkMenu* _result_ = NULL;
	GtkMenu* _tmp7_;
	GError* _inner_error0_ = NULL;
	GtkMenu* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gdk_screen_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	screen = _tmp1_;
	_tmp2_ = gtk_css_provider_new ();
	provider = _tmp2_;
	{
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp3_ = utils_get_menu_css ();
		_tmp4_ = _tmp3_;
		gtk_css_provider_load_from_data (provider, _tmp4_, (gssize) -1, &_inner_error0_);
		_g_free0 (_tmp4_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		g_warning ("menu.vala:131: Something bad happened with CSS load %s", _tmp6_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (provider);
		_g_object_unref0 (screen);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	gtk_style_context_add_provider_for_screen (screen, (GtkStyleProvider*) provider, (guint) GTK_STYLE_PROVIDER_PRIORITY_USER);
	_tmp7_ = (GtkMenu*) gtk_menu_new ();
	g_object_ref_sink (_tmp7_);
	_result_ = _tmp7_;
	{
		GList* menu_item_collection = NULL;
		GList* menu_item_it = NULL;
		menu_item_collection = menu_content;
		for (menu_item_it = menu_item_collection; menu_item_it != NULL; menu_item_it = menu_item_it->next) {
			MenuMenuItem* menu_item = NULL;
			menu_item = (MenuMenuItem*) menu_item_it->data;
			{
				GtkMenuItem* item = NULL;
				MenuMenuItem* _tmp8_;
				const gchar* _tmp9_;
				MenuMenuItem* _tmp10_;
				const gchar* _tmp11_;
				GtkMenuItem* _tmp12_;
				MenuMenuItem* _tmp13_;
				GList* _tmp14_;
				GtkMenu* _tmp20_;
				GtkMenuItem* _tmp21_;
				_tmp8_ = menu_item;
				_tmp9_ = _tmp8_->menu_item_id;
				_tmp10_ = menu_item;
				_tmp11_ = _tmp10_->menu_item_text;
				_tmp12_ = menu_menu_create_gtk_menu_item (self, _tmp9_, _tmp11_);
				item = _tmp12_;
				_tmp13_ = menu_item;
				_tmp14_ = _tmp13_->menu_item_submenu;
				if (g_list_length (_tmp14_) > ((guint) 0)) {
					GtkMenu* submenu = NULL;
					MenuMenuItem* _tmp15_;
					GList* _tmp16_;
					GtkMenu* _tmp17_;
					GtkMenuItem* _tmp18_;
					GtkMenu* _tmp19_;
					_tmp15_ = menu_item;
					_tmp16_ = _tmp15_->menu_item_submenu;
					_tmp17_ = menu_menu_create_gtk_menu (self, _tmp16_);
					submenu = _tmp17_;
					_tmp18_ = item;
					_tmp19_ = submenu;
					gtk_menu_item_set_submenu (_tmp18_, _tmp19_);
					_g_object_unref0 (submenu);
				}
				_tmp20_ = _result_;
				_tmp21_ = item;
				gtk_menu_shell_append ((GtkMenuShell*) _tmp20_, _tmp21_);
				_g_object_unref0 (item);
			}
		}
	}
	result = _result_;
	_g_object_unref0 (provider);
	_g_object_unref0 (screen);
	return result;
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		MenuMenu* self;
		self = _data3_->self;
		_g_free0 (_data3_->item_id);
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static void
__lambda6_ (Block3Data* _data3_)
{
	MenuMenu* self;
	self = _data3_->self;
	g_signal_emit (self, menu_menu_signals[MENU_MENU_CLICK_ITEM_SIGNAL], 0, _data3_->item_id);
}

static void
___lambda6__gtk_menu_item_activate (GtkMenuItem* _sender,
                                    gpointer self)
{
	__lambda6_ (self);
}

static GtkMenuItem*
menu_menu_create_gtk_menu_item (MenuMenu* self,
                                const gchar* item_id,
                                const gchar* item_text)
{
	Block3Data* _data3_;
	gchar* _tmp0_;
	GtkMenuItem* _tmp1_ = NULL;
	GtkMenuItem* item = NULL;
	GtkMenuItem* _tmp4_;
	GtkMenuItem* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (item_id != NULL, NULL);
	g_return_val_if_fail (item_text != NULL, NULL);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_data3_->self = g_object_ref (self);
	_tmp0_ = g_strdup (item_id);
	_g_free0 (_data3_->item_id);
	_data3_->item_id = _tmp0_;
	if (g_strcmp0 (item_text, "") == 0) {
		GtkSeparatorMenuItem* _tmp2_;
		_tmp2_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp2_);
		_g_object_unref0 (_tmp1_);
		_tmp1_ = (GtkMenuItem*) _tmp2_;
	} else {
		GtkMenuItem* _tmp3_;
		_tmp3_ = (GtkMenuItem*) gtk_menu_item_new_with_label (item_text);
		g_object_ref_sink (_tmp3_);
		_g_object_unref0 (_tmp1_);
		_tmp1_ = _tmp3_;
	}
	_tmp4_ = _g_object_ref0 (_tmp1_);
	item = _tmp4_;
	g_signal_connect_data (item, "activate", (GCallback) ___lambda6__gtk_menu_item_activate, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0);
	result = item;
	_g_object_unref0 (_tmp1_);
	block3_data_unref (_data3_);
	_data3_ = NULL;
	return result;
}

static void
menu_menu_show_gtk_menu_at_pointer (MenuMenu* self,
                                    GList* menu_content)
{
	GtkMenu* gtk_menu = NULL;
	GtkMenu* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = menu_menu_create_gtk_menu (self, menu_content);
	gtk_menu = _tmp0_;
	gtk_widget_show_all ((GtkWidget*) gtk_menu);
	gtk_menu_popup_at_pointer (gtk_menu, NULL);
	_g_object_unref0 (gtk_menu);
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

static void
menu_menu_show_deepin_menu (MenuMenu* self,
                            GList* menu_content,
                            gint x,
                            gint y)
{
	gdouble scale = 0.0;
	gdouble dde_scale = 0.0;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	scale = utils_get_default_monitor_scale ();
	dde_scale = utils_get_dde_scale_ratio ();
	if (scale != dde_scale) {
		x = (gint) ((x * scale) / dde_scale);
		y = (gint) ((y * scale) / dde_scale);
	}
	{
		JsonBuilder* builder = NULL;
		JsonBuilder* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		JsonGenerator* generator = NULL;
		JsonGenerator* _tmp3_;
		JsonNode* root = NULL;
		JsonNode* _tmp4_;
		gchar* menu_json_content = NULL;
		gchar* _tmp5_;
		MenuMenuInterface* _tmp6_;
		_tmp0_ = json_builder_new ();
		builder = _tmp0_;
		json_builder_begin_object (builder);
		json_builder_set_member_name (builder, "x");
		json_builder_add_int_value (builder, (gint64) x);
		json_builder_set_member_name (builder, "y");
		json_builder_add_int_value (builder, (gint64) y);
		json_builder_set_member_name (builder, "isDockMenu");
		json_builder_add_boolean_value (builder, FALSE);
		json_builder_set_member_name (builder, "menuJsonContent");
		_tmp1_ = menu_menu_get_items_node (self, menu_content);
		_tmp2_ = _tmp1_;
		json_builder_add_string_value (builder, _tmp2_);
		_g_free0 (_tmp2_);
		json_builder_set_member_name (builder, "isScaled");
		json_builder_add_boolean_value (builder, FALSE);
		json_builder_end_object (builder);
		_tmp3_ = json_generator_new ();
		generator = _tmp3_;
		_tmp4_ = json_builder_get_root (builder);
		root = _tmp4_;
		json_generator_set_root (generator, root);
		_tmp5_ = json_generator_to_data (generator, NULL);
		menu_json_content = _tmp5_;
		_tmp6_ = self->priv->menu_interface;
		menu_menu_interface_ShowMenu (_tmp6_, menu_json_content, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (menu_json_content);
			__vala_JsonNode_free0 (root);
			_g_object_unref0 (generator);
			_g_object_unref0 (builder);
			goto __catch0_g_error;
		}
		_g_free0 (menu_json_content);
		__vala_JsonNode_free0 (root);
		_g_object_unref0 (generator);
		_g_object_unref0 (builder);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		FILE* _tmp7_;
		GError* _tmp8_;
		const gchar* _tmp9_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp7_ = stderr;
		_tmp8_ = e;
		_tmp9_ = _tmp8_->message;
		fprintf (_tmp7_, "%s\n", _tmp9_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static gchar*
menu_menu_get_items_node (MenuMenu* self,
                          GList* menu_content)
{
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp2_;
	JsonBuilder* _tmp3_;
	JsonBuilder* _tmp8_;
	JsonBuilder* _tmp9_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp10_;
	JsonBuilder* _tmp11_;
	JsonNode* _tmp12_;
	JsonNode* _tmp13_;
	gchar* _tmp14_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = json_builder_new ();
	builder = _tmp0_;
	_tmp1_ = builder;
	json_builder_begin_object (_tmp1_);
	_tmp2_ = builder;
	json_builder_set_member_name (_tmp2_, "items");
	_tmp3_ = builder;
	json_builder_begin_array (_tmp3_);
	{
		GList* item_collection = NULL;
		GList* item_it = NULL;
		item_collection = menu_content;
		for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
			MenuMenuItem* _tmp4_;
			MenuMenuItem* item = NULL;
			_tmp4_ = _g_object_ref0 ((MenuMenuItem*) item_it->data);
			item = _tmp4_;
			{
				JsonBuilder* _tmp5_;
				MenuMenuItem* _tmp6_;
				JsonNode* _tmp7_;
				_tmp5_ = builder;
				_tmp6_ = item;
				_tmp7_ = menu_menu_get_item_node (self, _tmp6_);
				json_builder_add_value (_tmp5_, _tmp7_);
				_g_object_unref0 (item);
			}
		}
	}
	_tmp8_ = builder;
	json_builder_end_array (_tmp8_);
	_tmp9_ = builder;
	json_builder_end_object (_tmp9_);
	_tmp10_ = json_generator_new ();
	generator = _tmp10_;
	_tmp11_ = builder;
	_tmp12_ = json_builder_get_root (_tmp11_);
	_tmp13_ = _tmp12_;
	json_generator_set_root (generator, _tmp13_);
	__vala_JsonNode_free0 (_tmp13_);
	_tmp14_ = json_generator_to_data (generator, NULL);
	result = _tmp14_;
	_g_object_unref0 (generator);
	_g_object_unref0 (builder);
	return result;
}

static JsonNode*
menu_menu_get_item_node (MenuMenu* self,
                         MenuMenuItem* item)
{
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp2_;
	JsonBuilder* _tmp3_;
	const gchar* _tmp4_;
	JsonBuilder* _tmp5_;
	JsonBuilder* _tmp6_;
	const gchar* _tmp7_;
	JsonBuilder* _tmp8_;
	JsonBuilder* _tmp9_;
	JsonBuilder* _tmp10_;
	JsonBuilder* _tmp11_;
	JsonBuilder* _tmp12_;
	JsonBuilder* _tmp13_;
	JsonBuilder* _tmp14_;
	JsonBuilder* _tmp15_;
	JsonBuilder* _tmp16_;
	JsonBuilder* _tmp17_;
	JsonBuilder* _tmp18_;
	JsonBuilder* _tmp19_;
	JsonBuilder* _tmp20_;
	GList* submenu_items = NULL;
	GList* _tmp21_;
	GList* _tmp22_;
	JsonBuilder* _tmp38_;
	JsonBuilder* _tmp39_;
	JsonNode* _tmp40_;
	JsonNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = json_builder_new ();
	builder = _tmp0_;
	_tmp1_ = builder;
	json_builder_begin_object (_tmp1_);
	_tmp2_ = builder;
	json_builder_set_member_name (_tmp2_, "itemId");
	_tmp3_ = builder;
	_tmp4_ = item->menu_item_id;
	json_builder_add_string_value (_tmp3_, _tmp4_);
	_tmp5_ = builder;
	json_builder_set_member_name (_tmp5_, "itemText");
	_tmp6_ = builder;
	_tmp7_ = item->menu_item_text;
	json_builder_add_string_value (_tmp6_, _tmp7_);
	_tmp8_ = builder;
	json_builder_set_member_name (_tmp8_, "itemIcon");
	_tmp9_ = builder;
	json_builder_add_string_value (_tmp9_, "");
	_tmp10_ = builder;
	json_builder_set_member_name (_tmp10_, "itemIconHover");
	_tmp11_ = builder;
	json_builder_add_string_value (_tmp11_, "");
	_tmp12_ = builder;
	json_builder_set_member_name (_tmp12_, "itemIconInactive");
	_tmp13_ = builder;
	json_builder_add_string_value (_tmp13_, "");
	_tmp14_ = builder;
	json_builder_set_member_name (_tmp14_, "itemExtra");
	_tmp15_ = builder;
	json_builder_add_string_value (_tmp15_, "");
	_tmp16_ = builder;
	json_builder_set_member_name (_tmp16_, "isActive");
	_tmp17_ = builder;
	json_builder_add_boolean_value (_tmp17_, TRUE);
	_tmp18_ = builder;
	json_builder_set_member_name (_tmp18_, "checked");
	_tmp19_ = builder;
	json_builder_add_boolean_value (_tmp19_, FALSE);
	_tmp20_ = builder;
	json_builder_set_member_name (_tmp20_, "itemSubMenu");
	_tmp21_ = item->menu_item_submenu;
	submenu_items = _tmp21_;
	_tmp22_ = submenu_items;
	if (g_list_length (_tmp22_) == ((guint) 0)) {
		JsonBuilder* _tmp23_;
		_tmp23_ = builder;
		json_builder_add_null_value (_tmp23_);
	} else {
		JsonBuilder* _builder = NULL;
		JsonBuilder* _tmp24_;
		JsonBuilder* _tmp25_;
		JsonBuilder* _tmp26_;
		JsonBuilder* _tmp27_;
		GList* _tmp28_;
		JsonBuilder* _tmp33_;
		JsonBuilder* _tmp34_;
		JsonBuilder* _tmp35_;
		JsonBuilder* _tmp36_;
		JsonNode* _tmp37_;
		_tmp24_ = json_builder_new ();
		_builder = _tmp24_;
		_tmp25_ = _builder;
		json_builder_begin_object (_tmp25_);
		_tmp26_ = _builder;
		json_builder_set_member_name (_tmp26_, "items");
		_tmp27_ = _builder;
		json_builder_begin_array (_tmp27_);
		_tmp28_ = submenu_items;
		{
			GList* _item_collection = NULL;
			GList* _item_it = NULL;
			_item_collection = _tmp28_;
			for (_item_it = _item_collection; _item_it != NULL; _item_it = _item_it->next) {
				MenuMenuItem* _tmp29_;
				MenuMenuItem* _item = NULL;
				_tmp29_ = _g_object_ref0 ((MenuMenuItem*) _item_it->data);
				_item = _tmp29_;
				{
					JsonBuilder* _tmp30_;
					MenuMenuItem* _tmp31_;
					JsonNode* _tmp32_;
					_tmp30_ = _builder;
					_tmp31_ = _item;
					_tmp32_ = menu_menu_get_item_node (self, _tmp31_);
					json_builder_add_value (_tmp30_, _tmp32_);
					_g_object_unref0 (_item);
				}
			}
		}
		_tmp33_ = _builder;
		json_builder_end_array (_tmp33_);
		_tmp34_ = _builder;
		json_builder_end_object (_tmp34_);
		_tmp35_ = builder;
		_tmp36_ = _builder;
		_tmp37_ = json_builder_get_root (_tmp36_);
		json_builder_add_value (_tmp35_, _tmp37_);
		_g_object_unref0 (_builder);
	}
	_tmp38_ = builder;
	json_builder_end_object (_tmp38_);
	_tmp39_ = builder;
	_tmp40_ = json_builder_get_root (_tmp39_);
	result = _tmp40_;
	_g_object_unref0 (builder);
	return result;
}

static void
menu_menu_class_init (MenuMenuClass * klass,
                      gpointer klass_data)
{
	menu_menu_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &MenuMenu_private_offset);
	G_OBJECT_CLASS (klass)->finalize = menu_menu_finalize;
	menu_menu_signals[MENU_MENU_CLICK_ITEM_SIGNAL] = g_signal_new ("click-item", MENU_TYPE_MENU, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	menu_menu_signals[MENU_MENU_DESTROY_SIGNAL] = g_signal_new ("destroy", MENU_TYPE_MENU, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
menu_menu_instance_init (MenuMenu * self,
                         gpointer klass)
{
	self->priv = menu_menu_get_instance_private (self);
	self->priv->prefer_deepin_menu = TRUE;
	self->priv->inited = FALSE;
}

static void
menu_menu_finalize (GObject * obj)
{
	MenuMenu * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MENU_TYPE_MENU, MenuMenu);
	_g_object_unref0 (self->priv->menu_manager_interface);
	_g_object_unref0 (self->priv->menu_interface);
	G_OBJECT_CLASS (menu_menu_parent_class)->finalize (obj);
}

static GType
menu_menu_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MenuMenuClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) menu_menu_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MenuMenu), 0, (GInstanceInitFunc) menu_menu_instance_init, NULL };
	GType menu_menu_type_id;
	menu_menu_type_id = g_type_register_static (G_TYPE_OBJECT, "MenuMenu", &g_define_type_info, 0);
	MenuMenu_private_offset = g_type_add_instance_private (menu_menu_type_id, sizeof (MenuMenuPrivate));
	return menu_menu_type_id;
}

GType
menu_menu_get_type (void)
{
	static volatile gsize menu_menu_type_id__once = 0;
	if (g_once_init_enter (&menu_menu_type_id__once)) {
		GType menu_menu_type_id;
		menu_menu_type_id = menu_menu_get_type_once ();
		g_once_init_leave (&menu_menu_type_id__once, menu_menu_type_id);
	}
	return menu_menu_type_id__once;
}

