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

/*
* BudgieExtrasDaemon
* Author: David Mohammed
* Copyright © 2019 Ubuntu Budgie Developers
* Website=https://ubuntubudgie.org
* 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
* <https://www.gnu.org/licenses/>.
*/

#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdio.h>

#define BUDGIE_EXTRAS_EXTRAS_DBUS_NAME "org.UbuntuBudgie.ExtrasDaemon"
#define BUDGIE_EXTRAS_EXTRAS_DBUS_OBJECT_PATH "/org/ubuntubudgie/extrasdaemon"
#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 BUDGIE_EXTRAS_TYPE_DBUS_MANAGER (budgie_extras_dbus_manager_get_type ())
#define BUDGIE_EXTRAS_DBUS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUDGIE_EXTRAS_TYPE_DBUS_MANAGER, BudgieExtrasDbusManager))
#define BUDGIE_EXTRAS_DBUS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUDGIE_EXTRAS_TYPE_DBUS_MANAGER, BudgieExtrasDbusManagerClass))
#define BUDGIE_EXTRAS_IS_DBUS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUDGIE_EXTRAS_TYPE_DBUS_MANAGER))
#define BUDGIE_EXTRAS_IS_DBUS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BUDGIE_EXTRAS_TYPE_DBUS_MANAGER))
#define BUDGIE_EXTRAS_DBUS_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BUDGIE_EXTRAS_TYPE_DBUS_MANAGER, BudgieExtrasDbusManagerClass))

typedef struct _BudgieExtrasDbusManager BudgieExtrasDbusManager;
typedef struct _BudgieExtrasDbusManagerClass BudgieExtrasDbusManagerClass;
typedef struct _BudgieExtrasDbusManagerPrivate BudgieExtrasDbusManagerPrivate;

#define LAYOUTS_TYPE_LAYOUTS_MANAGER (layouts_layouts_manager_get_type ())
#define LAYOUTS_LAYOUTS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LAYOUTS_TYPE_LAYOUTS_MANAGER, LayoutsLayoutsManager))
#define LAYOUTS_LAYOUTS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LAYOUTS_TYPE_LAYOUTS_MANAGER, LayoutsLayoutsManagerClass))
#define LAYOUTS_IS_LAYOUTS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LAYOUTS_TYPE_LAYOUTS_MANAGER))
#define LAYOUTS_IS_LAYOUTS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LAYOUTS_TYPE_LAYOUTS_MANAGER))
#define LAYOUTS_LAYOUTS_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LAYOUTS_TYPE_LAYOUTS_MANAGER, LayoutsLayoutsManagerClass))

typedef struct _LayoutsLayoutsManager LayoutsLayoutsManager;
typedef struct _LayoutsLayoutsManagerClass LayoutsLayoutsManagerClass;
enum  {
	BUDGIE_EXTRAS_DBUS_MANAGER_0_PROPERTY,
	BUDGIE_EXTRAS_DBUS_MANAGER_NUM_PROPERTIES
};
static GParamSpec* budgie_extras_dbus_manager_properties[BUDGIE_EXTRAS_DBUS_MANAGER_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)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _BudgieExtrasDbusManager {
	GObject parent_instance;
	BudgieExtrasDbusManagerPrivate * priv;
};

struct _BudgieExtrasDbusManagerClass {
	GObjectClass parent_class;
};

struct _BudgieExtrasDbusManagerPrivate {
	LayoutsLayoutsManager* layoutmanager;
};

static gint BudgieExtrasDbusManager_private_offset;
static gpointer budgie_extras_dbus_manager_parent_class = NULL;
VALA_EXTERN gboolean budgie_extras_setup;

VALA_EXTERN GType budgie_extras_dbus_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BudgieExtrasDbusManager, g_object_unref)
VALA_EXTERN guint budgie_extras_dbus_manager_register_object (void* object,
                                                  GDBusConnection* connection,
                                                  const gchar* path,
                                                  GError** error);
VALA_EXTERN GType layouts_layouts_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LayoutsLayoutsManager, g_object_unref)
VALA_EXTERN BudgieExtrasDbusManager* budgie_extras_dbus_manager_new (void);
VALA_EXTERN BudgieExtrasDbusManager* budgie_extras_dbus_manager_construct (GType object_type);
VALA_EXTERN LayoutsLayoutsManager* layouts_layouts_manager_new (void);
VALA_EXTERN LayoutsLayoutsManager* layouts_layouts_manager_construct (GType object_type);
VALA_EXTERN void budgie_extras_dbus_manager_setup_dbus (BudgieExtrasDbusManager* self,
                                            gboolean replace);
static void budgie_extras_dbus_manager_on_bus_acquired (BudgieExtrasDbusManager* self,
                                                 GDBusConnection* conn);
static void _budgie_extras_dbus_manager_on_bus_acquired_gbus_acquired_callback (GDBusConnection* connection,
                                                                         const gchar* name,
                                                                         gpointer self);
static void __lambda6_ (BudgieExtrasDbusManager* self);
static void ___lambda6__gbus_name_acquired_callback (GDBusConnection* connection,
                                              const gchar* name,
                                              gpointer self);
VALA_EXTERN void budgie_extras_DaemonNameLost (GDBusConnection* conn,
                                   const gchar* name);
static void _budgie_extras_DaemonNameLost_gbus_name_lost_callback (GDBusConnection* connection,
                                                            const gchar* name,
                                                            gpointer self);
VALA_EXTERN void budgie_extras_dbus_manager_ResetLayout (BudgieExtrasDbusManager* self,
                                             const gchar* layout_name,
                                             GError** error);
VALA_EXTERN void layouts_layouts_manager_reset (LayoutsLayoutsManager* self,
                                    const gchar* layout_name);
VALA_EXTERN gboolean budgie_extras_dbus_manager_ReloadShortcuts (BudgieExtrasDbusManager* self,
                                                     GError** error);
VALA_EXTERN gchar* budgie_extras_dbus_manager_GetShortcut (BudgieExtrasDbusManager* self,
                                               const gchar* key_name,
                                               GError** error);
static void budgie_extras_dbus_manager_finalize (GObject * obj);
static GType budgie_extras_dbus_manager_get_type_once (void);
static void _dbus_budgie_extras_dbus_manager_ResetLayout (BudgieExtrasDbusManager* self,
                                                   GVariant* _parameters_,
                                                   GDBusMethodInvocation* invocation);
static void _dbus_budgie_extras_dbus_manager_ReloadShortcuts (BudgieExtrasDbusManager* self,
                                                       GVariant* _parameters_,
                                                       GDBusMethodInvocation* invocation);
static void _dbus_budgie_extras_dbus_manager_GetShortcut (BudgieExtrasDbusManager* self,
                                                   GVariant* _parameters_,
                                                   GDBusMethodInvocation* invocation);
static void budgie_extras_dbus_manager_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* budgie_extras_dbus_manager_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 budgie_extras_dbus_manager_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 _budgie_extras_dbus_manager_unregister_object (gpointer user_data);

static const GDBusArgInfo _budgie_extras_dbus_manager_dbus_arg_info_ResetLayout_layout_name = {-1, "layout_name", "s", NULL};
static const GDBusArgInfo * const _budgie_extras_dbus_manager_dbus_arg_info_ResetLayout_in[] = {&_budgie_extras_dbus_manager_dbus_arg_info_ResetLayout_layout_name, NULL};
static const GDBusArgInfo * const _budgie_extras_dbus_manager_dbus_arg_info_ResetLayout_out[] = {NULL};
static const GDBusMethodInfo _budgie_extras_dbus_manager_dbus_method_info_ResetLayout = {-1, "ResetLayout", (GDBusArgInfo **) (&_budgie_extras_dbus_manager_dbus_arg_info_ResetLayout_in), (GDBusArgInfo **) (&_budgie_extras_dbus_manager_dbus_arg_info_ResetLayout_out), NULL};
static const GDBusArgInfo _budgie_extras_dbus_manager_dbus_arg_info_ReloadShortcuts_result = {-1, "result", "b", NULL};
static const GDBusArgInfo * const _budgie_extras_dbus_manager_dbus_arg_info_ReloadShortcuts_in[] = {NULL};
static const GDBusArgInfo * const _budgie_extras_dbus_manager_dbus_arg_info_ReloadShortcuts_out[] = {&_budgie_extras_dbus_manager_dbus_arg_info_ReloadShortcuts_result, NULL};
static const GDBusMethodInfo _budgie_extras_dbus_manager_dbus_method_info_ReloadShortcuts = {-1, "ReloadShortcuts", (GDBusArgInfo **) (&_budgie_extras_dbus_manager_dbus_arg_info_ReloadShortcuts_in), (GDBusArgInfo **) (&_budgie_extras_dbus_manager_dbus_arg_info_ReloadShortcuts_out), NULL};
static const GDBusArgInfo _budgie_extras_dbus_manager_dbus_arg_info_GetShortcut_key_name = {-1, "key_name", "s", NULL};
static const GDBusArgInfo _budgie_extras_dbus_manager_dbus_arg_info_GetShortcut_result = {-1, "result", "s", NULL};
static const GDBusArgInfo * const _budgie_extras_dbus_manager_dbus_arg_info_GetShortcut_in[] = {&_budgie_extras_dbus_manager_dbus_arg_info_GetShortcut_key_name, NULL};
static const GDBusArgInfo * const _budgie_extras_dbus_manager_dbus_arg_info_GetShortcut_out[] = {&_budgie_extras_dbus_manager_dbus_arg_info_GetShortcut_result, NULL};
static const GDBusMethodInfo _budgie_extras_dbus_manager_dbus_method_info_GetShortcut = {-1, "GetShortcut", (GDBusArgInfo **) (&_budgie_extras_dbus_manager_dbus_arg_info_GetShortcut_in), (GDBusArgInfo **) (&_budgie_extras_dbus_manager_dbus_arg_info_GetShortcut_out), NULL};
static const GDBusMethodInfo * const _budgie_extras_dbus_manager_dbus_method_info[] = {&_budgie_extras_dbus_manager_dbus_method_info_ResetLayout, &_budgie_extras_dbus_manager_dbus_method_info_ReloadShortcuts, &_budgie_extras_dbus_manager_dbus_method_info_GetShortcut, NULL};
static const GDBusSignalInfo * const _budgie_extras_dbus_manager_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _budgie_extras_dbus_manager_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _budgie_extras_dbus_manager_dbus_interface_info = {-1, "org.UbuntuBudgie.ExtrasDaemon", (GDBusMethodInfo **) (&_budgie_extras_dbus_manager_dbus_method_info), (GDBusSignalInfo **) (&_budgie_extras_dbus_manager_dbus_signal_info), (GDBusPropertyInfo **) (&_budgie_extras_dbus_manager_dbus_property_info), NULL};
static const GDBusInterfaceVTable _budgie_extras_dbus_manager_dbus_interface_vtable = {budgie_extras_dbus_manager_dbus_interface_method_call, budgie_extras_dbus_manager_dbus_interface_get_property, budgie_extras_dbus_manager_dbus_interface_set_property};

static inline gpointer
budgie_extras_dbus_manager_get_instance_private (BudgieExtrasDbusManager* self)
{
	return G_STRUCT_MEMBER_P (self, BudgieExtrasDbusManager_private_offset);
}

BudgieExtrasDbusManager*
budgie_extras_dbus_manager_construct (GType object_type)
{
	BudgieExtrasDbusManager * self = NULL;
	LayoutsLayoutsManager* _tmp0_;
	self = (BudgieExtrasDbusManager*) g_object_new (object_type, NULL);
	_tmp0_ = layouts_layouts_manager_new ();
	_g_object_unref0 (self->priv->layoutmanager);
	self->priv->layoutmanager = _tmp0_;
	return self;
}

BudgieExtrasDbusManager*
budgie_extras_dbus_manager_new (void)
{
	return budgie_extras_dbus_manager_construct (BUDGIE_EXTRAS_TYPE_DBUS_MANAGER);
}

/**
     * Own the DBUS_NAME
     */
static void
_budgie_extras_dbus_manager_on_bus_acquired_gbus_acquired_callback (GDBusConnection* connection,
                                                                    const gchar* name,
                                                                    gpointer self)
{
	budgie_extras_dbus_manager_on_bus_acquired ((BudgieExtrasDbusManager*) self, connection);
}

static void
__lambda6_ (BudgieExtrasDbusManager* self)
{
}

static void
___lambda6__gbus_name_acquired_callback (GDBusConnection* connection,
                                         const gchar* name,
                                         gpointer self)
{
	__lambda6_ ((BudgieExtrasDbusManager*) self);
}

static void
_budgie_extras_DaemonNameLost_gbus_name_lost_callback (GDBusConnection* connection,
                                                       const gchar* name,
                                                       gpointer self)
{
	budgie_extras_DaemonNameLost (connection, name);
}

void
budgie_extras_dbus_manager_setup_dbus (BudgieExtrasDbusManager* self,
                                       gboolean replace)
{
	GBusNameOwnerFlags flags = 0U;
	g_return_if_fail (self != NULL);
	flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT;
	if (replace) {
		flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
	}
	g_bus_own_name_with_closures (G_BUS_TYPE_SESSION, BUDGIE_EXTRAS_EXTRAS_DBUS_NAME, flags, (GClosure*) ((_budgie_extras_dbus_manager_on_bus_acquired_gbus_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _budgie_extras_dbus_manager_on_bus_acquired_gbus_acquired_callback, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((___lambda6__gbus_name_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda6__gbus_name_acquired_callback, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) g_cclosure_new ((GCallback) _budgie_extras_DaemonNameLost_gbus_name_lost_callback, NULL, (GClosureNotify) NULL));
}

/**
     * Perform a desktop layout reset
     */
void
budgie_extras_dbus_manager_ResetLayout (BudgieExtrasDbusManager* self,
                                        const gchar* layout_name,
                                        GError** error)
{
	LayoutsLayoutsManager* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (layout_name != NULL);
	g_debug ("dbus.vala:65: layout %s", layout_name);
	_tmp0_ = self->priv->layoutmanager;
	layouts_layouts_manager_reset (_tmp0_, layout_name);
}

/**
     * Perform a desktop layout reset
     */
gboolean
budgie_extras_dbus_manager_ReloadShortcuts (BudgieExtrasDbusManager* self,
                                            GError** error)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = TRUE;
	return result;
}

/**
     * Find the shortcut key string for the bde file name key
     */
gchar*
budgie_extras_dbus_manager_GetShortcut (BudgieExtrasDbusManager* self,
                                        const gchar* key_name,
                                        GError** error)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (key_name != NULL, NULL);
	g_debug ("dbus.vala:82: nothing to return");
	_tmp0_ = g_strdup ("");
	result = _tmp0_;
	return result;
}

/**
     * Acquired EXTRAS_DBUS_NAME, register ourselves on the bus
     */
static void
budgie_extras_dbus_manager_on_bus_acquired (BudgieExtrasDbusManager* self,
                                            GDBusConnection* conn)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (conn != NULL);
	{
		budgie_extras_dbus_manager_register_object (self, conn, BUDGIE_EXTRAS_EXTRAS_DBUS_OBJECT_PATH, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		FILE* _tmp0_;
		GError* _tmp1_;
		const gchar* _tmp2_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = stderr;
		_tmp1_ = e;
		_tmp2_ = _tmp1_->message;
		fprintf (_tmp0_, "Error registering Extras DbusManager: %s\n", _tmp2_);
		_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;
	}
	budgie_extras_setup = TRUE;
}

static void
budgie_extras_dbus_manager_class_init (BudgieExtrasDbusManagerClass * klass,
                                       gpointer klass_data)
{
	budgie_extras_dbus_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BudgieExtrasDbusManager_private_offset);
	G_OBJECT_CLASS (klass)->finalize = budgie_extras_dbus_manager_finalize;
}

static void
budgie_extras_dbus_manager_instance_init (BudgieExtrasDbusManager * self,
                                          gpointer klass)
{
	self->priv = budgie_extras_dbus_manager_get_instance_private (self);
}

static void
budgie_extras_dbus_manager_finalize (GObject * obj)
{
	BudgieExtrasDbusManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BUDGIE_EXTRAS_TYPE_DBUS_MANAGER, BudgieExtrasDbusManager);
	_g_object_unref0 (self->priv->layoutmanager);
	G_OBJECT_CLASS (budgie_extras_dbus_manager_parent_class)->finalize (obj);
}

/**
 * DbusManager is responsible for managing interaction of budgie extras
 * applets/apps over dbus
 */
static GType
budgie_extras_dbus_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BudgieExtrasDbusManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) budgie_extras_dbus_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BudgieExtrasDbusManager), 0, (GInstanceInitFunc) budgie_extras_dbus_manager_instance_init, NULL };
	GType budgie_extras_dbus_manager_type_id;
	budgie_extras_dbus_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "BudgieExtrasDbusManager", &g_define_type_info, 0);
	g_type_set_qdata (budgie_extras_dbus_manager_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) budgie_extras_dbus_manager_register_object);
	BudgieExtrasDbusManager_private_offset = g_type_add_instance_private (budgie_extras_dbus_manager_type_id, sizeof (BudgieExtrasDbusManagerPrivate));
	return budgie_extras_dbus_manager_type_id;
}

GType
budgie_extras_dbus_manager_get_type (void)
{
	static volatile gsize budgie_extras_dbus_manager_type_id__once = 0;
	if (g_once_init_enter (&budgie_extras_dbus_manager_type_id__once)) {
		GType budgie_extras_dbus_manager_type_id;
		budgie_extras_dbus_manager_type_id = budgie_extras_dbus_manager_get_type_once ();
		g_once_init_leave (&budgie_extras_dbus_manager_type_id__once, budgie_extras_dbus_manager_type_id);
	}
	return budgie_extras_dbus_manager_type_id__once;
}

static void
_dbus_budgie_extras_dbus_manager_ResetLayout (BudgieExtrasDbusManager* self,
                                              GVariant* _parameters_,
                                              GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar* layout_name = NULL;
	GVariant* _tmp0_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp0_ = g_variant_iter_next_value (&_arguments_iter);
	layout_name = g_variant_dup_string (_tmp0_, NULL);
	g_variant_unref (_tmp0_);
	budgie_extras_dbus_manager_ResetLayout (self, layout_name, &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 (layout_name);
	;
}

static void
_dbus_budgie_extras_dbus_manager_ReloadShortcuts (BudgieExtrasDbusManager* self,
                                                  GVariant* _parameters_,
                                                  GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gboolean result;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	result = budgie_extras_dbus_manager_ReloadShortcuts (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_boolean (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_budgie_extras_dbus_manager_GetShortcut (BudgieExtrasDbusManager* self,
                                              GVariant* _parameters_,
                                              GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar* key_name = NULL;
	GVariant* _tmp1_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gchar* result;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp1_ = g_variant_iter_next_value (&_arguments_iter);
	key_name = g_variant_dup_string (_tmp1_, NULL);
	g_variant_unref (_tmp1_);
	result = budgie_extras_dbus_manager_GetShortcut (self, key_name, &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);
	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);
	_error:
	_g_free0 (key_name);
	;
}

static void
budgie_extras_dbus_manager_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, "ResetLayout") == 0) {
		_dbus_budgie_extras_dbus_manager_ResetLayout (object, parameters, invocation);
	} else if (strcmp (method_name, "ReloadShortcuts") == 0) {
		_dbus_budgie_extras_dbus_manager_ReloadShortcuts (object, parameters, invocation);
	} else if (strcmp (method_name, "GetShortcut") == 0) {
		_dbus_budgie_extras_dbus_manager_GetShortcut (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
budgie_extras_dbus_manager_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)
{
	return NULL;
}

static gboolean
budgie_extras_dbus_manager_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)
{
	return FALSE;
}

guint
budgie_extras_dbus_manager_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 *) (&_budgie_extras_dbus_manager_dbus_interface_info), &_budgie_extras_dbus_manager_dbus_interface_vtable, data, _budgie_extras_dbus_manager_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

static void
_budgie_extras_dbus_manager_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);
}

