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

/*
 * Copyright 2026 elementary, Inc. (https://elementary.io)
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Authored by: Leonhard Kargl <leo.kargl@proton.me>
 */

#include <glib-object.h>
#include "gala.h"
#include <gio/gio.h>
#include <meta/window.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <meta/workspace.h>
#include <meta/display.h>
#include <meta/meta-workspace-manager.h>
#include <glib/gi18n-lib.h>
#include <meta/common.h>
#include <clutter/clutter.h>
#include <meta/meta-plugin.h>

#define GALA_WINDOW_MENU_MANAGER_ACTION_PREFIX "window-menu."
#define GALA_WINDOW_MENU_MANAGER_ACTION_SCREENSHOT "screenshot"
#define GALA_WINDOW_MENU_MANAGER_ACTION_ALWAYS_ON_TOP "always-on-top"
#define GALA_WINDOW_MENU_MANAGER_ACTION_ALWAYS_ON_VISIBLE_WORKSPACE "always-on-visible-workspace"
#define GALA_WINDOW_MENU_MANAGER_ACTION_MOVE_LEFT "move-left"
#define GALA_WINDOW_MENU_MANAGER_ACTION_MOVE_RIGHT "move-right"
#define GALA_WINDOW_MENU_MANAGER_ACTION_MOVE "move"
#define GALA_WINDOW_MENU_MANAGER_ACTION_RESIZE "resize"
#define GALA_WINDOW_MENU_MANAGER_ACTION_MAXIMIZE "maximize"
#define GALA_WINDOW_MENU_MANAGER_ACTION_HIDE "hide"
#define GALA_WINDOW_MENU_MANAGER_ACTION_CLOSE "close"
#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 GALA_TYPE_WINDOW_MENU_MANAGER (gala_window_menu_manager_get_type ())
#define GALA_WINDOW_MENU_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_WINDOW_MENU_MANAGER, GalaWindowMenuManager))
#define GALA_WINDOW_MENU_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_TYPE_WINDOW_MENU_MANAGER, GalaWindowMenuManagerClass))
#define GALA_IS_WINDOW_MENU_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_WINDOW_MENU_MANAGER))
#define GALA_IS_WINDOW_MENU_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_TYPE_WINDOW_MENU_MANAGER))
#define GALA_WINDOW_MENU_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_TYPE_WINDOW_MENU_MANAGER, GalaWindowMenuManagerClass))

typedef struct _GalaWindowMenuManager GalaWindowMenuManager;
typedef struct _GalaWindowMenuManagerClass GalaWindowMenuManagerClass;
typedef struct _GalaWindowMenuManagerPrivate GalaWindowMenuManagerPrivate;

#define GALA_TYPE_DAEMON_MANAGER (gala_daemon_manager_get_type ())
#define GALA_DAEMON_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_DAEMON_MANAGER, GalaDaemonManager))
#define GALA_DAEMON_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_TYPE_DAEMON_MANAGER, GalaDaemonManagerClass))
#define GALA_IS_DAEMON_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_DAEMON_MANAGER))
#define GALA_IS_DAEMON_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_TYPE_DAEMON_MANAGER))
#define GALA_DAEMON_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_TYPE_DAEMON_MANAGER, GalaDaemonManagerClass))

typedef struct _GalaDaemonManager GalaDaemonManager;
typedef struct _GalaDaemonManagerClass GalaDaemonManagerClass;
enum  {
	GALA_WINDOW_MENU_MANAGER_0_PROPERTY,
	GALA_WINDOW_MENU_MANAGER_WM_PROPERTY,
	GALA_WINDOW_MENU_MANAGER_DAEMON_MANAGER_PROPERTY,
	GALA_WINDOW_MENU_MANAGER_NUM_PROPERTIES
};
static GParamSpec* gala_window_menu_manager_properties[GALA_WINDOW_MENU_MANAGER_NUM_PROPERTIES];
typedef void (*GSimpleActionActivateCallback) (GSimpleAction* action, GVariant* parameter, gpointer user_data);
#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)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GalaWindowMenuManager {
	GObject parent_instance;
	GalaWindowMenuManagerPrivate * priv;
};

struct _GalaWindowMenuManagerClass {
	GObjectClass parent_class;
};

struct _GalaWindowMenuManagerPrivate {
	GalaWindowManager* _wm;
	GalaDaemonManager* _daemon_manager;
	GSimpleActionGroup* action_group;
	GMenu* menu;
	MetaWindow* current_window;
};

static gint GalaWindowMenuManager_private_offset;
static gpointer gala_window_menu_manager_parent_class = NULL;
static GSettings* gala_window_menu_manager_gala_keybind_settings;
static GSettings* gala_window_menu_manager_gala_keybind_settings = NULL;
static GSettings* gala_window_menu_manager_keybind_settings;
static GSettings* gala_window_menu_manager_keybind_settings = NULL;

VALA_EXTERN GType gala_window_menu_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaWindowMenuManager, g_object_unref)
VALA_EXTERN GType gala_daemon_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemonManager, g_object_unref)
static void gala_window_menu_manager_on_screenshot (GalaWindowMenuManager* self,
                                             GSimpleAction* action,
                                             GVariant* parameters);
static void _gala_window_menu_manager_on_screenshot_gsimple_action_activate_callback (GSimpleAction* action,
                                                                               GVariant* parameter,
                                                                               gpointer self);
static void gala_window_menu_manager_on_always_on_top (GalaWindowMenuManager* self,
                                                GSimpleAction* action,
                                                GVariant* parameters);
static void _gala_window_menu_manager_on_always_on_top_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                  GVariant* parameter,
                                                                                  gpointer self);
static void gala_window_menu_manager_on_always_on_visible_workspace (GalaWindowMenuManager* self,
                                                              GSimpleAction* action,
                                                              GVariant* parameters);
static void _gala_window_menu_manager_on_always_on_visible_workspace_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                                GVariant* parameter,
                                                                                                gpointer self);
static void gala_window_menu_manager_on_move_left (GalaWindowMenuManager* self,
                                            GSimpleAction* action,
                                            GVariant* parameters);
static void _gala_window_menu_manager_on_move_left_gsimple_action_activate_callback (GSimpleAction* action,
                                                                              GVariant* parameter,
                                                                              gpointer self);
static void gala_window_menu_manager_on_move_right (GalaWindowMenuManager* self,
                                             GSimpleAction* action,
                                             GVariant* parameters);
static void _gala_window_menu_manager_on_move_right_gsimple_action_activate_callback (GSimpleAction* action,
                                                                               GVariant* parameter,
                                                                               gpointer self);
static void gala_window_menu_manager_on_move (GalaWindowMenuManager* self,
                                       GSimpleAction* action,
                                       GVariant* parameters);
static void _gala_window_menu_manager_on_move_gsimple_action_activate_callback (GSimpleAction* action,
                                                                         GVariant* parameter,
                                                                         gpointer self);
static void gala_window_menu_manager_on_resize (GalaWindowMenuManager* self,
                                         GSimpleAction* action,
                                         GVariant* parameters);
static void _gala_window_menu_manager_on_resize_gsimple_action_activate_callback (GSimpleAction* action,
                                                                           GVariant* parameter,
                                                                           gpointer self);
static void gala_window_menu_manager_on_maximize (GalaWindowMenuManager* self,
                                           GSimpleAction* action,
                                           GVariant* parameters);
static void _gala_window_menu_manager_on_maximize_gsimple_action_activate_callback (GSimpleAction* action,
                                                                             GVariant* parameter,
                                                                             gpointer self);
static void gala_window_menu_manager_on_hide (GalaWindowMenuManager* self,
                                       GSimpleAction* action,
                                       GVariant* parameters);
static void _gala_window_menu_manager_on_hide_gsimple_action_activate_callback (GSimpleAction* action,
                                                                         GVariant* parameter,
                                                                         gpointer self);
static void gala_window_menu_manager_on_close (GalaWindowMenuManager* self,
                                        GSimpleAction* action,
                                        GVariant* parameters);
static void _gala_window_menu_manager_on_close_gsimple_action_activate_callback (GSimpleAction* action,
                                                                          GVariant* parameter,
                                                                          gpointer self);
VALA_EXTERN GalaWindowMenuManager* gala_window_menu_manager_new (GalaWindowManager* wm,
                                                     GalaDaemonManager* daemon_manager);
VALA_EXTERN GalaWindowMenuManager* gala_window_menu_manager_construct (GType object_type,
                                                           GalaWindowManager* wm,
                                                           GalaDaemonManager* daemon_manager);
static void gala_window_menu_manager_on_name_acquired (GalaWindowMenuManager* self,
                                                GDBusConnection* connection,
                                                const gchar* name);
VALA_EXTERN void gala_window_menu_manager_show_window_menu (GalaWindowMenuManager* self,
                                                MetaWindow* window,
                                                gint x,
                                                gint y);
static GVariant* _variant_new6 (gboolean value);
static GVariant* _variant_new7 (gboolean value);
static void gala_window_menu_manager_set_accel_attribute (GMenuItem* item,
                                                   GSettings* settings,
                                                   const gchar* key);
static GalaDaemonManager* gala_window_menu_manager_get_daemon_manager (GalaWindowMenuManager* self);
VALA_EXTERN void gala_daemon_manager_show_window_menu (GalaDaemonManager* self,
                                           gint x,
                                           gint y,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
VALA_EXTERN void gala_daemon_manager_show_window_menu_finish (GalaDaemonManager* self,
                                                  GAsyncResult* _res_);
static GalaWindowManager* gala_window_menu_manager_get_wm (GalaWindowMenuManager* self);
static void gala_window_menu_manager_begin_grab_op (GalaWindowMenuManager* self,
                                             MetaGrabOp op);
static void gala_window_menu_manager_set_wm (GalaWindowMenuManager* self,
                                      GalaWindowManager* value);
static void gala_window_menu_manager_set_daemon_manager (GalaWindowMenuManager* self,
                                                  GalaDaemonManager* value);
static GObject * gala_window_menu_manager_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void _gala_window_menu_manager_on_name_acquired_gbus_name_acquired_callback (GDBusConnection* connection,
                                                                             const gchar* name,
                                                                             gpointer self);
static void gala_window_menu_manager_finalize (GObject * obj);
static GType gala_window_menu_manager_get_type_once (void);
static void _vala_gala_window_menu_manager_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_gala_window_menu_manager_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static const GActionEntry GALA_WINDOW_MENU_MANAGER_ACTION_ENTRIES[10] = {{GALA_WINDOW_MENU_MANAGER_ACTION_SCREENSHOT, _gala_window_menu_manager_on_screenshot_gsimple_action_activate_callback}, {GALA_WINDOW_MENU_MANAGER_ACTION_ALWAYS_ON_TOP, _gala_window_menu_manager_on_always_on_top_gsimple_action_activate_callback, NULL, "false"}, {GALA_WINDOW_MENU_MANAGER_ACTION_ALWAYS_ON_VISIBLE_WORKSPACE, _gala_window_menu_manager_on_always_on_visible_workspace_gsimple_action_activate_callback, NULL, "false"}, {GALA_WINDOW_MENU_MANAGER_ACTION_MOVE_LEFT, _gala_window_menu_manager_on_move_left_gsimple_action_activate_callback}, {GALA_WINDOW_MENU_MANAGER_ACTION_MOVE_RIGHT, _gala_window_menu_manager_on_move_right_gsimple_action_activate_callback}, {GALA_WINDOW_MENU_MANAGER_ACTION_MOVE, _gala_window_menu_manager_on_move_gsimple_action_activate_callback}, {GALA_WINDOW_MENU_MANAGER_ACTION_RESIZE, _gala_window_menu_manager_on_resize_gsimple_action_activate_callback}, {GALA_WINDOW_MENU_MANAGER_ACTION_MAXIMIZE, _gala_window_menu_manager_on_maximize_gsimple_action_activate_callback}, {GALA_WINDOW_MENU_MANAGER_ACTION_HIDE, _gala_window_menu_manager_on_hide_gsimple_action_activate_callback}, {GALA_WINDOW_MENU_MANAGER_ACTION_CLOSE, _gala_window_menu_manager_on_close_gsimple_action_activate_callback}};

static inline gpointer
gala_window_menu_manager_get_instance_private (GalaWindowMenuManager* self)
{
	return G_STRUCT_MEMBER_P (self, GalaWindowMenuManager_private_offset);
}

static void
_gala_window_menu_manager_on_screenshot_gsimple_action_activate_callback (GSimpleAction* action,
                                                                          GVariant* parameter,
                                                                          gpointer self)
{
	gala_window_menu_manager_on_screenshot ((GalaWindowMenuManager*) self, action, parameter);
}

static void
_gala_window_menu_manager_on_always_on_top_gsimple_action_activate_callback (GSimpleAction* action,
                                                                             GVariant* parameter,
                                                                             gpointer self)
{
	gala_window_menu_manager_on_always_on_top ((GalaWindowMenuManager*) self, action, parameter);
}

static void
_gala_window_menu_manager_on_always_on_visible_workspace_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                           GVariant* parameter,
                                                                                           gpointer self)
{
	gala_window_menu_manager_on_always_on_visible_workspace ((GalaWindowMenuManager*) self, action, parameter);
}

static void
_gala_window_menu_manager_on_move_left_gsimple_action_activate_callback (GSimpleAction* action,
                                                                         GVariant* parameter,
                                                                         gpointer self)
{
	gala_window_menu_manager_on_move_left ((GalaWindowMenuManager*) self, action, parameter);
}

static void
_gala_window_menu_manager_on_move_right_gsimple_action_activate_callback (GSimpleAction* action,
                                                                          GVariant* parameter,
                                                                          gpointer self)
{
	gala_window_menu_manager_on_move_right ((GalaWindowMenuManager*) self, action, parameter);
}

static void
_gala_window_menu_manager_on_move_gsimple_action_activate_callback (GSimpleAction* action,
                                                                    GVariant* parameter,
                                                                    gpointer self)
{
	gala_window_menu_manager_on_move ((GalaWindowMenuManager*) self, action, parameter);
}

static void
_gala_window_menu_manager_on_resize_gsimple_action_activate_callback (GSimpleAction* action,
                                                                      GVariant* parameter,
                                                                      gpointer self)
{
	gala_window_menu_manager_on_resize ((GalaWindowMenuManager*) self, action, parameter);
}

static void
_gala_window_menu_manager_on_maximize_gsimple_action_activate_callback (GSimpleAction* action,
                                                                        GVariant* parameter,
                                                                        gpointer self)
{
	gala_window_menu_manager_on_maximize ((GalaWindowMenuManager*) self, action, parameter);
}

static void
_gala_window_menu_manager_on_hide_gsimple_action_activate_callback (GSimpleAction* action,
                                                                    GVariant* parameter,
                                                                    gpointer self)
{
	gala_window_menu_manager_on_hide ((GalaWindowMenuManager*) self, action, parameter);
}

static void
_gala_window_menu_manager_on_close_gsimple_action_activate_callback (GSimpleAction* action,
                                                                     GVariant* parameter,
                                                                     gpointer self)
{
	gala_window_menu_manager_on_close ((GalaWindowMenuManager*) self, action, parameter);
}

GalaWindowMenuManager*
gala_window_menu_manager_construct (GType object_type,
                                    GalaWindowManager* wm,
                                    GalaDaemonManager* daemon_manager)
{
	GalaWindowMenuManager * self = NULL;
	g_return_val_if_fail (wm != NULL, NULL);
	g_return_val_if_fail (daemon_manager != NULL, NULL);
	self = (GalaWindowMenuManager*) g_object_new (object_type, "wm", wm, "daemon-manager", daemon_manager, NULL);
	return self;
}

GalaWindowMenuManager*
gala_window_menu_manager_new (GalaWindowManager* wm,
                              GalaDaemonManager* daemon_manager)
{
	return gala_window_menu_manager_construct (GALA_TYPE_WINDOW_MENU_MANAGER, wm, daemon_manager);
}

static void
gala_window_menu_manager_on_name_acquired (GalaWindowMenuManager* self,
                                           GDBusConnection* connection,
                                           const gchar* name)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (connection != NULL);
	g_return_if_fail (name != NULL);
	{
		GSimpleActionGroup* _tmp0_;
		GMenu* _tmp1_;
		_tmp0_ = self->priv->action_group;
		g_dbus_connection_export_action_group (connection, "/io/elementary/gala/WindowMenu", (GActionGroup*) _tmp0_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = self->priv->menu;
		g_dbus_connection_export_menu_model (connection, "/io/elementary/gala/WindowMenu", (GMenuModel*) _tmp1_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp2_;
		const gchar* _tmp3_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = e;
		_tmp3_ = _tmp2_->message;
		g_warning ("WindowMenuManager.vala:65: Failed to export window menu model and acti" \
"on group: %s", _tmp3_);
		_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 gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static GVariant*
_variant_new6 (gboolean value)
{
	return g_variant_ref_sink (g_variant_new_boolean (value));
}

static GVariant*
_variant_new7 (gboolean value)
{
	return g_variant_ref_sink (g_variant_new_boolean (value));
}

void
gala_window_menu_manager_show_window_menu (GalaWindowMenuManager* self,
                                           MetaWindow* window,
                                           gint x,
                                           gint y)
{
	MetaWindow* _tmp0_;
	GSimpleActionGroup* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GVariant* _tmp4_;
	GSimpleActionGroup* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	GVariant* _tmp8_;
	MetaWorkspace* window_ws = NULL;
	MetaWorkspace* _tmp9_;
	MetaWorkspace* _tmp10_;
	gint window_ws_index = 0;
	MetaWorkspace* _tmp11_;
	gint n_ws = 0;
	MetaDisplay* _tmp12_;
	MetaDisplay* _tmp13_;
	MetaWorkspaceManager* _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	gboolean can_move_left = FALSE;
	gboolean _tmp17_ = FALSE;
	gboolean can_move_right = FALSE;
	GSimpleActionGroup* _tmp19_;
	GAction* _tmp20_;
	GSimpleActionGroup* _tmp21_;
	GAction* _tmp22_;
	GMenu* _tmp23_;
	GMenuItem* screenshot_item = NULL;
	GMenuItem* _tmp24_;
	GMenuItem* _tmp25_;
	GSettings* _tmp26_;
	GMenu* screenshot_section = NULL;
	GMenu* _tmp27_;
	GMenu* _tmp28_;
	GMenuItem* _tmp29_;
	GMenuItem* always_on_top_item = NULL;
	GMenuItem* _tmp30_;
	GMenuItem* _tmp31_;
	GSettings* _tmp32_;
	GMenuItem* always_on_visible_workspace_item = NULL;
	GMenuItem* _tmp33_;
	GMenuItem* _tmp34_;
	GSettings* _tmp35_;
	GMenuItem* move_left_item = NULL;
	GMenuItem* _tmp36_;
	GMenuItem* _tmp37_;
	GSettings* _tmp38_;
	GMenuItem* move_right_item = NULL;
	GMenuItem* _tmp39_;
	GMenuItem* _tmp40_;
	GSettings* _tmp41_;
	GMenu* workspace_section = NULL;
	GMenu* _tmp42_;
	GMenu* _tmp43_;
	GMenuItem* _tmp44_;
	GMenu* _tmp45_;
	GMenuItem* _tmp46_;
	GMenu* _tmp47_;
	GMenuItem* _tmp48_;
	GMenu* _tmp49_;
	GMenuItem* _tmp50_;
	GMenu* move_resize_section = NULL;
	GMenu* _tmp51_;
	GMenu* close_section = NULL;
	GMenu* _tmp81_;
	GMenu* _tmp92_;
	GMenu* _tmp93_;
	GMenu* _tmp94_;
	GMenu* _tmp95_;
	GMenu* _tmp96_;
	GMenu* _tmp97_;
	GMenu* _tmp98_;
	GMenu* _tmp99_;
	GalaDaemonManager* _tmp100_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	_tmp0_ = _g_object_ref0 (window);
	_g_object_unref0 (self->priv->current_window);
	self->priv->current_window = _tmp0_;
	_tmp1_ = self->priv->action_group;
	g_object_get (window, "above", &_tmp2_, NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = _variant_new6 (_tmp3_);
	g_action_group_change_action_state ((GActionGroup*) _tmp1_, GALA_WINDOW_MENU_MANAGER_ACTION_ALWAYS_ON_TOP, _tmp4_);
	_g_variant_unref0 (_tmp4_);
	_tmp5_ = self->priv->action_group;
	g_object_get (window, "on-all-workspaces", &_tmp6_, NULL);
	_tmp7_ = _tmp6_;
	_tmp8_ = _variant_new7 (_tmp7_);
	g_action_group_change_action_state ((GActionGroup*) _tmp5_, GALA_WINDOW_MENU_MANAGER_ACTION_ALWAYS_ON_VISIBLE_WORKSPACE, _tmp8_);
	_g_variant_unref0 (_tmp8_);
	_tmp9_ = meta_window_get_workspace (window);
	_tmp10_ = _g_object_ref0 (_tmp9_);
	window_ws = _tmp10_;
	_tmp11_ = window_ws;
	window_ws_index = meta_workspace_index (_tmp11_);
	_tmp12_ = meta_window_get_display (window);
	_tmp13_ = _tmp12_;
	_tmp14_ = meta_display_get_workspace_manager (_tmp13_);
	_tmp15_ = meta_workspace_manager_get_n_workspaces (_tmp14_);
	_tmp16_ = _tmp15_;
	n_ws = _tmp16_;
	can_move_left = window_ws_index != 0;
	if (window_ws_index == (n_ws - 2)) {
		MetaWorkspace* _tmp18_;
		_tmp18_ = window_ws;
		_tmp17_ = gala_utils_get_n_windows (_tmp18_, FALSE, NULL) == ((guint) 1);
	} else {
		_tmp17_ = FALSE;
	}
	can_move_right = !_tmp17_;
	_tmp19_ = self->priv->action_group;
	_tmp20_ = g_action_map_lookup_action ((GActionMap*) _tmp19_, GALA_WINDOW_MENU_MANAGER_ACTION_MOVE_LEFT);
	g_simple_action_set_enabled (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, g_simple_action_get_type (), GSimpleAction), can_move_left);
	_tmp21_ = self->priv->action_group;
	_tmp22_ = g_action_map_lookup_action ((GActionMap*) _tmp21_, GALA_WINDOW_MENU_MANAGER_ACTION_MOVE_RIGHT);
	g_simple_action_set_enabled (G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, g_simple_action_get_type (), GSimpleAction), can_move_right);
	_tmp23_ = self->priv->menu;
	g_menu_remove_all (_tmp23_);
	_tmp24_ = g_menu_item_new (_ ("Take Screenshot"), GALA_WINDOW_MENU_MANAGER_ACTION_PREFIX GALA_WINDOW_MENU_MANAGER_ACTION_SCREENSHOT);
	screenshot_item = _tmp24_;
	_tmp25_ = screenshot_item;
	_tmp26_ = gala_window_menu_manager_gala_keybind_settings;
	gala_window_menu_manager_set_accel_attribute (_tmp25_, _tmp26_, "screenshot");
	_tmp27_ = g_menu_new ();
	screenshot_section = _tmp27_;
	_tmp28_ = screenshot_section;
	_tmp29_ = screenshot_item;
	g_menu_append_item (_tmp28_, _tmp29_);
	_tmp30_ = g_menu_item_new (_ ("Always on Top"), GALA_WINDOW_MENU_MANAGER_ACTION_PREFIX GALA_WINDOW_MENU_MANAGER_ACTION_ALWAYS_ON_TOP);
	always_on_top_item = _tmp30_;
	_tmp31_ = always_on_top_item;
	_tmp32_ = gala_window_menu_manager_keybind_settings;
	gala_window_menu_manager_set_accel_attribute (_tmp31_, _tmp32_, "always-on-top");
	_tmp33_ = g_menu_item_new (_ ("Show on all Workspaces"), GALA_WINDOW_MENU_MANAGER_ACTION_PREFIX GALA_WINDOW_MENU_MANAGER_ACTION_ALWAYS_ON_VISIBLE_WORKSPACE);
	always_on_visible_workspace_item = _tmp33_;
	_tmp34_ = always_on_visible_workspace_item;
	_tmp35_ = gala_window_menu_manager_keybind_settings;
	gala_window_menu_manager_set_accel_attribute (_tmp34_, _tmp35_, "toggle-on-all-workspaces");
	_tmp36_ = g_menu_item_new (_ ("Move to Workspace Left"), GALA_WINDOW_MENU_MANAGER_ACTION_PREFIX GALA_WINDOW_MENU_MANAGER_ACTION_MOVE_LEFT);
	move_left_item = _tmp36_;
	_tmp37_ = move_left_item;
	_tmp38_ = gala_window_menu_manager_keybind_settings;
	gala_window_menu_manager_set_accel_attribute (_tmp37_, _tmp38_, "move-to-workspace-left");
	_tmp39_ = g_menu_item_new (_ ("Move to Workspace Right"), GALA_WINDOW_MENU_MANAGER_ACTION_PREFIX GALA_WINDOW_MENU_MANAGER_ACTION_MOVE_RIGHT);
	move_right_item = _tmp39_;
	_tmp40_ = move_right_item;
	_tmp41_ = gala_window_menu_manager_keybind_settings;
	gala_window_menu_manager_set_accel_attribute (_tmp40_, _tmp41_, "move-to-workspace-right");
	_tmp42_ = g_menu_new ();
	workspace_section = _tmp42_;
	_tmp43_ = workspace_section;
	_tmp44_ = always_on_top_item;
	g_menu_append_item (_tmp43_, _tmp44_);
	_tmp45_ = workspace_section;
	_tmp46_ = always_on_visible_workspace_item;
	g_menu_append_item (_tmp45_, _tmp46_);
	_tmp47_ = workspace_section;
	_tmp48_ = move_left_item;
	g_menu_append_item (_tmp47_, _tmp48_);
	_tmp49_ = workspace_section;
	_tmp50_ = move_right_item;
	g_menu_append_item (_tmp49_, _tmp50_);
	_tmp51_ = g_menu_new ();
	move_resize_section = _tmp51_;
	if (meta_window_allows_move (window)) {
		GMenuItem* move_item = NULL;
		GMenuItem* _tmp52_;
		GMenuItem* _tmp53_;
		GSettings* _tmp54_;
		GMenu* _tmp55_;
		GMenuItem* _tmp56_;
		_tmp52_ = g_menu_item_new (_ ("Move"), GALA_WINDOW_MENU_MANAGER_ACTION_PREFIX GALA_WINDOW_MENU_MANAGER_ACTION_MOVE);
		move_item = _tmp52_;
		_tmp53_ = move_item;
		_tmp54_ = gala_window_menu_manager_keybind_settings;
		gala_window_menu_manager_set_accel_attribute (_tmp53_, _tmp54_, "begin-move");
		_tmp55_ = move_resize_section;
		_tmp56_ = move_item;
		g_menu_append_item (_tmp55_, _tmp56_);
		_g_object_unref0 (move_item);
	}
	if (meta_window_allows_resize (window)) {
		GMenuItem* resize_item = NULL;
		GMenuItem* _tmp57_;
		GMenuItem* _tmp58_;
		GSettings* _tmp59_;
		GMenu* _tmp60_;
		GMenuItem* _tmp61_;
		_tmp57_ = g_menu_item_new (_ ("Resize"), GALA_WINDOW_MENU_MANAGER_ACTION_PREFIX GALA_WINDOW_MENU_MANAGER_ACTION_RESIZE);
		resize_item = _tmp57_;
		_tmp58_ = resize_item;
		_tmp59_ = gala_window_menu_manager_keybind_settings;
		gala_window_menu_manager_set_accel_attribute (_tmp58_, _tmp59_, "begin-resize");
		_tmp60_ = move_resize_section;
		_tmp61_ = resize_item;
		g_menu_append_item (_tmp60_, _tmp61_);
		_g_object_unref0 (resize_item);
	}
	if (meta_window_can_maximize (window)) {
		gchar* maximize_label = NULL;
		gchar* _tmp62_;
		gboolean _tmp63_ = FALSE;
		gboolean _tmp64_;
		gboolean _tmp65_;
		GMenuItem* maximize_item = NULL;
		const gchar* _tmp75_;
		GMenuItem* _tmp76_;
		GMenuItem* _tmp77_;
		GSettings* _tmp78_;
		GMenu* _tmp79_;
		GMenuItem* _tmp80_;
		_tmp62_ = g_strdup (_ ("Maximize"));
		maximize_label = _tmp62_;
		g_object_get (window, "maximized-vertically", &_tmp64_, NULL);
		_tmp65_ = _tmp64_;
		if (_tmp65_) {
			_tmp63_ = TRUE;
		} else {
			gboolean _tmp66_;
			gboolean _tmp67_;
			g_object_get (window, "maximized-horizontally", &_tmp66_, NULL);
			_tmp67_ = _tmp66_;
			_tmp63_ = _tmp67_;
		}
		if (_tmp63_) {
			gboolean _tmp68_ = FALSE;
			gboolean _tmp69_;
			gboolean _tmp70_;
			gboolean is_tiled = FALSE;
			const gchar* _tmp73_ = NULL;
			gchar* _tmp74_;
			g_object_get (window, "maximized-vertically", &_tmp69_, NULL);
			_tmp70_ = _tmp69_;
			if (_tmp70_) {
				gboolean _tmp71_;
				gboolean _tmp72_;
				g_object_get (window, "maximized-horizontally", &_tmp71_, NULL);
				_tmp72_ = _tmp71_;
				_tmp68_ = !_tmp72_;
			} else {
				_tmp68_ = FALSE;
			}
			is_tiled = _tmp68_;
			if (is_tiled) {
				_tmp73_ = _ ("Untile");
			} else {
				_tmp73_ = _ ("Unmaximize");
			}
			_tmp74_ = g_strdup (_tmp73_);
			_g_free0 (maximize_label);
			maximize_label = _tmp74_;
		}
		_tmp75_ = maximize_label;
		_tmp76_ = g_menu_item_new (_tmp75_, GALA_WINDOW_MENU_MANAGER_ACTION_PREFIX GALA_WINDOW_MENU_MANAGER_ACTION_MAXIMIZE);
		maximize_item = _tmp76_;
		_tmp77_ = maximize_item;
		_tmp78_ = gala_window_menu_manager_keybind_settings;
		gala_window_menu_manager_set_accel_attribute (_tmp77_, _tmp78_, "toggle-maximized");
		_tmp79_ = move_resize_section;
		_tmp80_ = maximize_item;
		g_menu_append_item (_tmp79_, _tmp80_);
		_g_object_unref0 (maximize_item);
		_g_free0 (maximize_label);
	}
	_tmp81_ = g_menu_new ();
	close_section = _tmp81_;
	if (meta_window_can_minimize (window)) {
		GMenuItem* minimize_item = NULL;
		GMenuItem* _tmp82_;
		GMenuItem* _tmp83_;
		GSettings* _tmp84_;
		GMenu* _tmp85_;
		GMenuItem* _tmp86_;
		_tmp82_ = g_menu_item_new (_ ("Minimize"), GALA_WINDOW_MENU_MANAGER_ACTION_PREFIX GALA_WINDOW_MENU_MANAGER_ACTION_HIDE);
		minimize_item = _tmp82_;
		_tmp83_ = minimize_item;
		_tmp84_ = gala_window_menu_manager_keybind_settings;
		gala_window_menu_manager_set_accel_attribute (_tmp83_, _tmp84_, "minimize");
		_tmp85_ = close_section;
		_tmp86_ = minimize_item;
		g_menu_append_item (_tmp85_, _tmp86_);
		_g_object_unref0 (minimize_item);
	}
	if (meta_window_can_close (window)) {
		GMenuItem* close_item = NULL;
		GMenuItem* _tmp87_;
		GMenuItem* _tmp88_;
		GSettings* _tmp89_;
		GMenu* _tmp90_;
		GMenuItem* _tmp91_;
		_tmp87_ = g_menu_item_new (_ ("Close"), GALA_WINDOW_MENU_MANAGER_ACTION_PREFIX GALA_WINDOW_MENU_MANAGER_ACTION_CLOSE);
		close_item = _tmp87_;
		_tmp88_ = close_item;
		_tmp89_ = gala_window_menu_manager_keybind_settings;
		gala_window_menu_manager_set_accel_attribute (_tmp88_, _tmp89_, "close");
		_tmp90_ = close_section;
		_tmp91_ = close_item;
		g_menu_append_item (_tmp90_, _tmp91_);
		_g_object_unref0 (close_item);
	}
	_tmp92_ = self->priv->menu;
	_tmp93_ = screenshot_section;
	g_menu_append_section (_tmp92_, NULL, (GMenuModel*) _tmp93_);
	_tmp94_ = self->priv->menu;
	_tmp95_ = workspace_section;
	g_menu_append_section (_tmp94_, NULL, (GMenuModel*) _tmp95_);
	_tmp96_ = self->priv->menu;
	_tmp97_ = move_resize_section;
	g_menu_append_section (_tmp96_, NULL, (GMenuModel*) _tmp97_);
	_tmp98_ = self->priv->menu;
	_tmp99_ = close_section;
	g_menu_append_section (_tmp98_, NULL, (GMenuModel*) _tmp99_);
	_tmp100_ = self->priv->_daemon_manager;
	gala_daemon_manager_show_window_menu (_tmp100_, x, y, NULL, NULL);
	_g_object_unref0 (close_section);
	_g_object_unref0 (move_resize_section);
	_g_object_unref0 (workspace_section);
	_g_object_unref0 (move_right_item);
	_g_object_unref0 (move_left_item);
	_g_object_unref0 (always_on_visible_workspace_item);
	_g_object_unref0 (always_on_top_item);
	_g_object_unref0 (screenshot_section);
	_g_object_unref0 (screenshot_item);
	_g_object_unref0 (window_ws);
}

static void
gala_window_menu_manager_set_accel_attribute (GMenuItem* item,
                                              GSettings* settings,
                                              const gchar* key)
{
	gchar** accels = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint accels_length1;
	gint _accels_size_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	g_return_if_fail (item != NULL);
	g_return_if_fail (settings != NULL);
	g_return_if_fail (key != NULL);
	_tmp1_ = _tmp0_ = g_settings_get_strv (settings, key);
	accels = _tmp1_;
	accels_length1 = _vala_array_length (_tmp0_);
	_accels_size_ = accels_length1;
	_tmp2_ = accels;
	_tmp2__length1 = accels_length1;
	if (_tmp2__length1 > 0) {
		gchar** _tmp3_;
		gint _tmp3__length1;
		const gchar* _tmp4_;
		_tmp3_ = accels;
		_tmp3__length1 = accels_length1;
		_tmp4_ = _tmp3_[0];
		g_menu_item_set_attribute (item, "accel", "s", _tmp4_, NULL);
	}
	accels = (_vala_array_free (accels, accels_length1, (GDestroyNotify) g_free), NULL);
}

static void
gala_window_menu_manager_on_screenshot (GalaWindowMenuManager* self,
                                        GSimpleAction* action,
                                        GVariant* parameters)
{
	GalaWindowManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = self->priv->_wm;
	gala_window_manager_perform_action (_tmp0_, GALA_ACTION_TYPE_SCREENSHOT_CURRENT);
}

static void
gala_window_menu_manager_on_always_on_top (GalaWindowMenuManager* self,
                                           GSimpleAction* action,
                                           GVariant* parameters)
{
	GalaWindowManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = self->priv->_wm;
	gala_window_manager_perform_action (_tmp0_, GALA_ACTION_TYPE_TOGGLE_ALWAYS_ON_TOP_CURRENT);
}

static void
gala_window_menu_manager_on_always_on_visible_workspace (GalaWindowMenuManager* self,
                                                         GSimpleAction* action,
                                                         GVariant* parameters)
{
	GalaWindowManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = self->priv->_wm;
	gala_window_manager_perform_action (_tmp0_, GALA_ACTION_TYPE_TOGGLE_ALWAYS_ON_VISIBLE_WORKSPACE_CURRENT);
}

static void
gala_window_menu_manager_on_move_left (GalaWindowMenuManager* self,
                                       GSimpleAction* action,
                                       GVariant* parameters)
{
	GalaWindowManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = self->priv->_wm;
	gala_window_manager_perform_action (_tmp0_, GALA_ACTION_TYPE_MOVE_CURRENT_WORKSPACE_LEFT);
}

static void
gala_window_menu_manager_on_move_right (GalaWindowMenuManager* self,
                                        GSimpleAction* action,
                                        GVariant* parameters)
{
	GalaWindowManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = self->priv->_wm;
	gala_window_manager_perform_action (_tmp0_, GALA_ACTION_TYPE_MOVE_CURRENT_WORKSPACE_RIGHT);
}

static void
gala_window_menu_manager_on_move (GalaWindowMenuManager* self,
                                  GSimpleAction* action,
                                  GVariant* parameters)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	gala_window_menu_manager_begin_grab_op (self, META_GRAB_OP_KEYBOARD_MOVING);
}

static void
gala_window_menu_manager_on_resize (GalaWindowMenuManager* self,
                                    GSimpleAction* action,
                                    GVariant* parameters)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	gala_window_menu_manager_begin_grab_op (self, META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN);
}

static void
gala_window_menu_manager_begin_grab_op (GalaWindowMenuManager* self,
                                        MetaGrabOp op)
{
	ClutterSprite* device = NULL;
	ClutterBackend* _tmp0_;
	GalaWindowManager* _tmp1_;
	ClutterStage* _tmp2_;
	ClutterStage* _tmp3_;
	ClutterSprite* _tmp4_;
	ClutterSprite* _tmp5_;
	MetaWindow* _tmp6_;
	GalaWindowManager* _tmp7_;
	MetaDisplay* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = clutter_get_default_backend ();
	_tmp1_ = self->priv->_wm;
	_tmp2_ = gala_window_manager_get_stage (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = clutter_backend_get_pointer_sprite (_tmp0_, _tmp3_);
	_tmp5_ = _g_object_ref0 (_tmp4_);
	device = _tmp5_;
	_tmp6_ = self->priv->current_window;
	_tmp7_ = self->priv->_wm;
	_tmp8_ = meta_plugin_get_display ((MetaPlugin*) _tmp7_);
	meta_window_begin_grab_op (_tmp6_, op, device, meta_display_get_current_time (_tmp8_), NULL);
	_g_object_unref0 (device);
}

static void
gala_window_menu_manager_on_maximize (GalaWindowMenuManager* self,
                                      GSimpleAction* action,
                                      GVariant* parameters)
{
	GalaWindowManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = self->priv->_wm;
	gala_window_manager_perform_action (_tmp0_, GALA_ACTION_TYPE_MAXIMIZE_CURRENT);
}

static void
gala_window_menu_manager_on_hide (GalaWindowMenuManager* self,
                                  GSimpleAction* action,
                                  GVariant* parameters)
{
	GalaWindowManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = self->priv->_wm;
	gala_window_manager_perform_action (_tmp0_, GALA_ACTION_TYPE_HIDE_CURRENT);
}

static void
gala_window_menu_manager_on_close (GalaWindowMenuManager* self,
                                   GSimpleAction* action,
                                   GVariant* parameters)
{
	GalaWindowManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = self->priv->_wm;
	gala_window_manager_perform_action (_tmp0_, GALA_ACTION_TYPE_CLOSE_CURRENT);
}

static GalaWindowManager*
gala_window_menu_manager_get_wm (GalaWindowMenuManager* self)
{
	GalaWindowManager* result;
	GalaWindowManager* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_wm;
	result = _tmp0_;
	return result;
}

static void
gala_window_menu_manager_set_wm (GalaWindowMenuManager* self,
                                 GalaWindowManager* value)
{
	GalaWindowManager* old_value;
	g_return_if_fail (self != NULL);
	old_value = gala_window_menu_manager_get_wm (self);
	if (old_value != value) {
		GalaWindowManager* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_wm);
		self->priv->_wm = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gala_window_menu_manager_properties[GALA_WINDOW_MENU_MANAGER_WM_PROPERTY]);
	}
}

static GalaDaemonManager*
gala_window_menu_manager_get_daemon_manager (GalaWindowMenuManager* self)
{
	GalaDaemonManager* result;
	GalaDaemonManager* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_daemon_manager;
	result = _tmp0_;
	return result;
}

static void
gala_window_menu_manager_set_daemon_manager (GalaWindowMenuManager* self,
                                             GalaDaemonManager* value)
{
	GalaDaemonManager* old_value;
	g_return_if_fail (self != NULL);
	old_value = gala_window_menu_manager_get_daemon_manager (self);
	if (old_value != value) {
		GalaDaemonManager* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_daemon_manager);
		self->priv->_daemon_manager = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gala_window_menu_manager_properties[GALA_WINDOW_MENU_MANAGER_DAEMON_MANAGER_PROPERTY]);
	}
}

static void
_gala_window_menu_manager_on_name_acquired_gbus_name_acquired_callback (GDBusConnection* connection,
                                                                        const gchar* name,
                                                                        gpointer self)
{
	gala_window_menu_manager_on_name_acquired ((GalaWindowMenuManager*) self, connection, name);
}

static GObject *
gala_window_menu_manager_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GalaWindowMenuManager * self;
	GSimpleActionGroup* _tmp0_;
	GSimpleActionGroup* _tmp1_;
	GMenu* _tmp2_;
	parent_class = G_OBJECT_CLASS (gala_window_menu_manager_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_TYPE_WINDOW_MENU_MANAGER, GalaWindowMenuManager);
	_tmp0_ = g_simple_action_group_new ();
	_g_object_unref0 (self->priv->action_group);
	self->priv->action_group = _tmp0_;
	_tmp1_ = self->priv->action_group;
	g_action_map_add_action_entries ((GActionMap*) _tmp1_, GALA_WINDOW_MENU_MANAGER_ACTION_ENTRIES, (gint) G_N_ELEMENTS (GALA_WINDOW_MENU_MANAGER_ACTION_ENTRIES), self);
	_tmp2_ = g_menu_new ();
	_g_object_unref0 (self->priv->menu);
	self->priv->menu = _tmp2_;
	g_bus_own_name_with_closures (G_BUS_TYPE_SESSION, "io.elementary.gala.WindowMenu", G_BUS_NAME_OWNER_FLAGS_NONE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((_gala_window_menu_manager_on_name_acquired_gbus_name_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _gala_window_menu_manager_on_name_acquired_gbus_name_acquired_callback, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	return obj;
}

static void
gala_window_menu_manager_class_init (GalaWindowMenuManagerClass * klass,
                                     gpointer klass_data)
{
	GSettings* _tmp0_;
	GSettings* _tmp1_;
	gala_window_menu_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GalaWindowMenuManager_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gala_window_menu_manager_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gala_window_menu_manager_set_property;
	G_OBJECT_CLASS (klass)->constructor = gala_window_menu_manager_constructor;
	G_OBJECT_CLASS (klass)->finalize = gala_window_menu_manager_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_WINDOW_MENU_MANAGER_WM_PROPERTY, gala_window_menu_manager_properties[GALA_WINDOW_MENU_MANAGER_WM_PROPERTY] = g_param_spec_object ("wm", "wm", "wm", GALA_TYPE_WINDOW_MANAGER, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GALA_WINDOW_MENU_MANAGER_DAEMON_MANAGER_PROPERTY, gala_window_menu_manager_properties[GALA_WINDOW_MENU_MANAGER_DAEMON_MANAGER_PROPERTY] = g_param_spec_object ("daemon-manager", "daemon-manager", "daemon-manager", GALA_TYPE_DAEMON_MANAGER, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	_tmp0_ = g_settings_new ("io.elementary.desktop.wm.keybindings");
	gala_window_menu_manager_gala_keybind_settings = _tmp0_;
	_tmp1_ = g_settings_new ("org.gnome.desktop.wm.keybindings");
	gala_window_menu_manager_keybind_settings = _tmp1_;
}

static void
gala_window_menu_manager_instance_init (GalaWindowMenuManager * self,
                                        gpointer klass)
{
	self->priv = gala_window_menu_manager_get_instance_private (self);
}

static void
gala_window_menu_manager_finalize (GObject * obj)
{
	GalaWindowMenuManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_TYPE_WINDOW_MENU_MANAGER, GalaWindowMenuManager);
	_g_object_unref0 (self->priv->_wm);
	_g_object_unref0 (self->priv->_daemon_manager);
	_g_object_unref0 (self->priv->action_group);
	_g_object_unref0 (self->priv->menu);
	_g_object_unref0 (self->priv->current_window);
	G_OBJECT_CLASS (gala_window_menu_manager_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gala_window_menu_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaWindowMenuManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_window_menu_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GalaWindowMenuManager), 0, (GInstanceInitFunc) gala_window_menu_manager_instance_init, NULL };
	GType gala_window_menu_manager_type_id;
	gala_window_menu_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "GalaWindowMenuManager", &g_define_type_info, G_TYPE_FLAG_NONE);
	GalaWindowMenuManager_private_offset = g_type_add_instance_private (gala_window_menu_manager_type_id, sizeof (GalaWindowMenuManagerPrivate));
	return gala_window_menu_manager_type_id;
}

GType
gala_window_menu_manager_get_type (void)
{
	static gsize gala_window_menu_manager_type_id__once = 0;
	if (g_once_init_enter (&gala_window_menu_manager_type_id__once)) {
		GType gala_window_menu_manager_type_id;
		gala_window_menu_manager_type_id = gala_window_menu_manager_get_type_once ();
		g_once_init_leave (&gala_window_menu_manager_type_id__once, gala_window_menu_manager_type_id);
	}
	return gala_window_menu_manager_type_id__once;
}

static void
_vala_gala_window_menu_manager_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	GalaWindowMenuManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GALA_TYPE_WINDOW_MENU_MANAGER, GalaWindowMenuManager);
	switch (property_id) {
		case GALA_WINDOW_MENU_MANAGER_WM_PROPERTY:
		g_value_set_object (value, gala_window_menu_manager_get_wm (self));
		break;
		case GALA_WINDOW_MENU_MANAGER_DAEMON_MANAGER_PROPERTY:
		g_value_set_object (value, gala_window_menu_manager_get_daemon_manager (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gala_window_menu_manager_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	GalaWindowMenuManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GALA_TYPE_WINDOW_MENU_MANAGER, GalaWindowMenuManager);
	switch (property_id) {
		case GALA_WINDOW_MENU_MANAGER_WM_PROPERTY:
		gala_window_menu_manager_set_wm (self, g_value_get_object (value));
		break;
		case GALA_WINDOW_MENU_MANAGER_DAEMON_MANAGER_PROPERTY:
		gala_window_menu_manager_set_daemon_manager (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

