/* gnome-shell-screencast.c generated by valac 0.56.17, the Vala compiler
 * generated from gnome-shell-screencast.vala, do not modify */

/* Generated by vala-dbus-binding-tool 1.0-aa2fb. Do not modify! */
/* Generated with: vala-dbus-binding-tool --api-path=./org.gnome.Shell.Screencast.xml --directory=./ --strip-namespace=org --rename-namespace=gnome:Gnome --no-synced */

#include "../../application.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.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

typedef GDBusProxy GnomeShellScreencastProxy;
typedef GDBusProxyClass GnomeShellScreencastProxyClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))

static GType gnome_shell_screencast_get_type_once (void);
static void gnome_shell_screencast_proxy_g_signal (GDBusProxy* proxy,
                                            const gchar* sender_name,
                                            const gchar* signal_name,
                                            GVariant* parameters);
static void gnome_shell_screencast_proxy_screencast (GnomeShellScreencast* self,
                                              const gchar* file_template,
                                              GHashTable* options,
                                              gboolean* success,
                                              gchar** filename_used,
                                              GError** error);
static void gnome_shell_screencast_proxy_screencast_area (GnomeShellScreencast* self,
                                                   gint x,
                                                   gint y,
                                                   gint width,
                                                   gint height,
                                                   const gchar* file_template,
                                                   GHashTable* options,
                                                   gboolean* success,
                                                   gchar** filename_used,
                                                   GError** error);
static gboolean gnome_shell_screencast_proxy_stop_screencast (GnomeShellScreencast* self,
                                                       GError** error);
static void gnome_shell_screencast_proxy_gnome_shell_screencast_interface_init (GnomeShellScreencastIface* iface);
static void _dbus_gnome_shell_screencast_screencast (GnomeShellScreencast* self,
                                              GVariant* _parameters_,
                                              GDBusMethodInvocation* invocation);
static void _dbus_gnome_shell_screencast_screencast_area (GnomeShellScreencast* self,
                                                   GVariant* _parameters_,
                                                   GDBusMethodInvocation* invocation);
static void _dbus_gnome_shell_screencast_stop_screencast (GnomeShellScreencast* self,
                                                   GVariant* _parameters_,
                                                   GDBusMethodInvocation* invocation);
static void gnome_shell_screencast_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* gnome_shell_screencast_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 gnome_shell_screencast_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 _gnome_shell_screencast_unregister_object (gpointer user_data);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_file_template = {-1, "file_template", "s", NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_options = {-1, "options", "a{sv}", NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_success = {-1, "success", "b", NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_filename_used = {-1, "filename_used", "s", NULL};
static const GDBusArgInfo * const _gnome_shell_screencast_dbus_arg_info_screencast_in[] = {&_gnome_shell_screencast_dbus_arg_info_screencast_file_template, &_gnome_shell_screencast_dbus_arg_info_screencast_options, NULL};
static const GDBusArgInfo * const _gnome_shell_screencast_dbus_arg_info_screencast_out[] = {&_gnome_shell_screencast_dbus_arg_info_screencast_success, &_gnome_shell_screencast_dbus_arg_info_screencast_filename_used, NULL};
static const GDBusMethodInfo _gnome_shell_screencast_dbus_method_info_screencast = {-1, "Screencast", (GDBusArgInfo **) (&_gnome_shell_screencast_dbus_arg_info_screencast_in), (GDBusArgInfo **) (&_gnome_shell_screencast_dbus_arg_info_screencast_out), NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_area_x = {-1, "x", "i", NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_area_y = {-1, "y", "i", NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_area_width = {-1, "width", "i", NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_area_height = {-1, "height", "i", NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_area_file_template = {-1, "file_template", "s", NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_area_options = {-1, "options", "a{sv}", NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_area_success = {-1, "success", "b", NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_screencast_area_filename_used = {-1, "filename_used", "s", NULL};
static const GDBusArgInfo * const _gnome_shell_screencast_dbus_arg_info_screencast_area_in[] = {&_gnome_shell_screencast_dbus_arg_info_screencast_area_x, &_gnome_shell_screencast_dbus_arg_info_screencast_area_y, &_gnome_shell_screencast_dbus_arg_info_screencast_area_width, &_gnome_shell_screencast_dbus_arg_info_screencast_area_height, &_gnome_shell_screencast_dbus_arg_info_screencast_area_file_template, &_gnome_shell_screencast_dbus_arg_info_screencast_area_options, NULL};
static const GDBusArgInfo * const _gnome_shell_screencast_dbus_arg_info_screencast_area_out[] = {&_gnome_shell_screencast_dbus_arg_info_screencast_area_success, &_gnome_shell_screencast_dbus_arg_info_screencast_area_filename_used, NULL};
static const GDBusMethodInfo _gnome_shell_screencast_dbus_method_info_screencast_area = {-1, "ScreencastArea", (GDBusArgInfo **) (&_gnome_shell_screencast_dbus_arg_info_screencast_area_in), (GDBusArgInfo **) (&_gnome_shell_screencast_dbus_arg_info_screencast_area_out), NULL};
static const GDBusArgInfo _gnome_shell_screencast_dbus_arg_info_stop_screencast_result = {-1, "result", "b", NULL};
static const GDBusArgInfo * const _gnome_shell_screencast_dbus_arg_info_stop_screencast_in[] = {NULL};
static const GDBusArgInfo * const _gnome_shell_screencast_dbus_arg_info_stop_screencast_out[] = {&_gnome_shell_screencast_dbus_arg_info_stop_screencast_result, NULL};
static const GDBusMethodInfo _gnome_shell_screencast_dbus_method_info_stop_screencast = {-1, "StopScreencast", (GDBusArgInfo **) (&_gnome_shell_screencast_dbus_arg_info_stop_screencast_in), (GDBusArgInfo **) (&_gnome_shell_screencast_dbus_arg_info_stop_screencast_out), NULL};
static const GDBusMethodInfo * const _gnome_shell_screencast_dbus_method_info[] = {&_gnome_shell_screencast_dbus_method_info_screencast, &_gnome_shell_screencast_dbus_method_info_screencast_area, &_gnome_shell_screencast_dbus_method_info_stop_screencast, NULL};
static const GDBusSignalInfo * const _gnome_shell_screencast_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _gnome_shell_screencast_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _gnome_shell_screencast_dbus_interface_info = {-1, "org.gnome.Shell.Screencast", (GDBusMethodInfo **) (&_gnome_shell_screencast_dbus_method_info), (GDBusSignalInfo **) (&_gnome_shell_screencast_dbus_signal_info), (GDBusPropertyInfo **) (&_gnome_shell_screencast_dbus_property_info), NULL};
static const GDBusInterfaceVTable _gnome_shell_screencast_dbus_interface_vtable = {gnome_shell_screencast_dbus_interface_method_call, gnome_shell_screencast_dbus_interface_get_property, gnome_shell_screencast_dbus_interface_set_property};

void
gnome_shell_screencast_screencast (GnomeShellScreencast* self,
                                   const gchar* file_template,
                                   GHashTable* options,
                                   gboolean* success,
                                   gchar** filename_used,
                                   GError** error)
{
	GnomeShellScreencastIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GNOME_SHELL_SCREENCAST_GET_INTERFACE (self);
	if (_iface_->screencast) {
		_iface_->screencast (self, file_template, options, success, filename_used, error);
	}
}

void
gnome_shell_screencast_screencast_area (GnomeShellScreencast* self,
                                        gint x,
                                        gint y,
                                        gint width,
                                        gint height,
                                        const gchar* file_template,
                                        GHashTable* options,
                                        gboolean* success,
                                        gchar** filename_used,
                                        GError** error)
{
	GnomeShellScreencastIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GNOME_SHELL_SCREENCAST_GET_INTERFACE (self);
	if (_iface_->screencast_area) {
		_iface_->screencast_area (self, x, y, width, height, file_template, options, success, filename_used, error);
	}
}

gboolean
gnome_shell_screencast_stop_screencast (GnomeShellScreencast* self,
                                        GError** error)
{
	GnomeShellScreencastIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GNOME_SHELL_SCREENCAST_GET_INTERFACE (self);
	if (_iface_->stop_screencast) {
		return _iface_->stop_screencast (self, error);
	}
	return FALSE;
}

static void
gnome_shell_screencast_default_init (GnomeShellScreencastIface * iface,
                                     gpointer iface_data)
{
}

static GType
gnome_shell_screencast_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GnomeShellScreencastIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gnome_shell_screencast_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gnome_shell_screencast_type_id;
	gnome_shell_screencast_type_id = g_type_register_static (G_TYPE_INTERFACE, "GnomeShellScreencast", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gnome_shell_screencast_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (gnome_shell_screencast_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) gnome_shell_screencast_proxy_get_type);
	g_type_set_qdata (gnome_shell_screencast_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.gnome.Shell.Screencast");
	g_type_set_qdata (gnome_shell_screencast_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_gnome_shell_screencast_dbus_interface_info));
	g_type_set_qdata (gnome_shell_screencast_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) gnome_shell_screencast_register_object);
	return gnome_shell_screencast_type_id;
}

GType
gnome_shell_screencast_get_type (void)
{
	static volatile gsize gnome_shell_screencast_type_id__once = 0;
	if (g_once_init_enter (&gnome_shell_screencast_type_id__once)) {
		GType gnome_shell_screencast_type_id;
		gnome_shell_screencast_type_id = gnome_shell_screencast_get_type_once ();
		g_once_init_leave (&gnome_shell_screencast_type_id__once, gnome_shell_screencast_type_id);
	}
	return gnome_shell_screencast_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (GnomeShellScreencastProxy, gnome_shell_screencast_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (GNOME_SHELL_TYPE_SCREENCAST, gnome_shell_screencast_proxy_gnome_shell_screencast_interface_init) )
static void
gnome_shell_screencast_proxy_class_init (GnomeShellScreencastProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = gnome_shell_screencast_proxy_g_signal;
}

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

static void
gnome_shell_screencast_proxy_init (GnomeShellScreencastProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_gnome_shell_screencast_dbus_interface_info));
}

static void
gnome_shell_screencast_proxy_screencast (GnomeShellScreencast* self,
                                         const gchar* file_template,
                                         GHashTable* options,
                                         gboolean* success,
                                         gchar** filename_used,
                                         GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GVariantBuilder _tmp122_;
	GHashTableIter _tmp123_;
	gpointer _tmp124_;
	gpointer _tmp125_;
	GDBusMessage *_reply_message;
	GVariant *_reply;
	GVariantIter _reply_iter;
	gboolean _vala_success = FALSE;
	GVariant* _tmp126_;
	gchar* _vala_filename_used = NULL;
	GVariant* _tmp127_;
	G_DBUS_ERROR;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.gnome.Shell.Screencast", "Screencast");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (file_template));
	g_hash_table_iter_init (&_tmp123_, options);
	g_variant_builder_init (&_tmp122_, G_VARIANT_TYPE ("a{sv}"));
	while (g_hash_table_iter_next (&_tmp123_, &_tmp124_, &_tmp125_)) {
		gchar* _key;
		GVariant* _value;
		_key = (gchar*) _tmp124_;
		_value = (GVariant*) _tmp125_;
		g_variant_builder_add (&_tmp122_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
	}
	g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp122_));
	_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;
	}
	_reply = g_dbus_message_get_body (_reply_message);
	g_variant_iter_init (&_reply_iter, _reply);
	_tmp126_ = g_variant_iter_next_value (&_reply_iter);
	_vala_success = g_variant_get_boolean (_tmp126_);
	g_variant_unref (_tmp126_);
	*success = _vala_success;
	_tmp127_ = g_variant_iter_next_value (&_reply_iter);
	_vala_filename_used = g_variant_dup_string (_tmp127_, NULL);
	g_variant_unref (_tmp127_);
	*filename_used = _vala_filename_used;
	g_object_unref (_reply_message);
}

static void
gnome_shell_screencast_proxy_screencast_area (GnomeShellScreencast* self,
                                              gint x,
                                              gint y,
                                              gint width,
                                              gint height,
                                              const gchar* file_template,
                                              GHashTable* options,
                                              gboolean* success,
                                              gchar** filename_used,
                                              GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GVariantBuilder _tmp128_;
	GHashTableIter _tmp129_;
	gpointer _tmp130_;
	gpointer _tmp131_;
	GDBusMessage *_reply_message;
	GVariant *_reply;
	GVariantIter _reply_iter;
	gboolean _vala_success = FALSE;
	GVariant* _tmp132_;
	gchar* _vala_filename_used = NULL;
	GVariant* _tmp133_;
	G_DBUS_ERROR;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.gnome.Shell.Screencast", "ScreencastArea");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (x));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (y));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (width));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (height));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (file_template));
	g_hash_table_iter_init (&_tmp129_, options);
	g_variant_builder_init (&_tmp128_, G_VARIANT_TYPE ("a{sv}"));
	while (g_hash_table_iter_next (&_tmp129_, &_tmp130_, &_tmp131_)) {
		gchar* _key;
		GVariant* _value;
		_key = (gchar*) _tmp130_;
		_value = (GVariant*) _tmp131_;
		g_variant_builder_add (&_tmp128_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
	}
	g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp128_));
	_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;
	}
	_reply = g_dbus_message_get_body (_reply_message);
	g_variant_iter_init (&_reply_iter, _reply);
	_tmp132_ = g_variant_iter_next_value (&_reply_iter);
	_vala_success = g_variant_get_boolean (_tmp132_);
	g_variant_unref (_tmp132_);
	*success = _vala_success;
	_tmp133_ = g_variant_iter_next_value (&_reply_iter);
	_vala_filename_used = g_variant_dup_string (_tmp133_, NULL);
	g_variant_unref (_tmp133_);
	*filename_used = _vala_filename_used;
	g_object_unref (_reply_message);
}

static gboolean
gnome_shell_screencast_proxy_stop_screencast (GnomeShellScreencast* self,
                                              GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	GVariant *_reply;
	GVariantIter _reply_iter;
	gboolean _result = FALSE;
	GVariant* _tmp136_;
	G_DBUS_ERROR;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.gnome.Shell.Screencast", "StopScreencast");
	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) {
		gboolean _tmp134_ = FALSE;
		return _tmp134_;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		gboolean _tmp135_ = FALSE;
		g_object_unref (_reply_message);
		return _tmp135_;
	}
	_reply = g_dbus_message_get_body (_reply_message);
	g_variant_iter_init (&_reply_iter, _reply);
	_tmp136_ = g_variant_iter_next_value (&_reply_iter);
	_result = g_variant_get_boolean (_tmp136_);
	g_variant_unref (_tmp136_);
	g_object_unref (_reply_message);
	return _result;
}

static void
gnome_shell_screencast_proxy_gnome_shell_screencast_interface_init (GnomeShellScreencastIface* iface)
{
	iface->screencast = gnome_shell_screencast_proxy_screencast;
	iface->screencast_area = gnome_shell_screencast_proxy_screencast_area;
	iface->stop_screencast = gnome_shell_screencast_proxy_stop_screencast;
}

static void
_dbus_gnome_shell_screencast_screencast (GnomeShellScreencast* self,
                                         GVariant* _parameters_,
                                         GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar* file_template = NULL;
	GVariant* _tmp137_;
	GHashTable* options = NULL;
	GVariant* _tmp138_;
	GHashTable* _tmp139_;
	GVariantIter _tmp140_;
	GVariant* _tmp141_;
	GVariant* _tmp142_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gboolean success = FALSE;
	gchar* filename_used = NULL;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp137_ = g_variant_iter_next_value (&_arguments_iter);
	file_template = g_variant_dup_string (_tmp137_, NULL);
	g_variant_unref (_tmp137_);
	_tmp138_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp139_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
	g_variant_iter_init (&_tmp140_, _tmp138_);
	while (g_variant_iter_loop (&_tmp140_, "{?*}", &_tmp141_, &_tmp142_)) {
		g_hash_table_insert (_tmp139_, g_variant_dup_string (_tmp141_, NULL), g_variant_get_variant (_tmp142_));
	}
	options = _tmp139_;
	g_variant_unref (_tmp138_);
	gnome_shell_screencast_screencast (self, file_template, options, &success, &filename_used, &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_boolean (success));
	g_variant_builder_add_value (&_reply_builder, g_variant_new_string (filename_used));
	_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 (file_template);
	_g_hash_table_unref0 (options);
	_g_free0 (filename_used);
	;
}

static void
_dbus_gnome_shell_screencast_screencast_area (GnomeShellScreencast* self,
                                              GVariant* _parameters_,
                                              GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gint x = 0;
	GVariant* _tmp143_;
	gint y = 0;
	GVariant* _tmp144_;
	gint width = 0;
	GVariant* _tmp145_;
	gint height = 0;
	GVariant* _tmp146_;
	gchar* file_template = NULL;
	GVariant* _tmp147_;
	GHashTable* options = NULL;
	GVariant* _tmp148_;
	GHashTable* _tmp149_;
	GVariantIter _tmp150_;
	GVariant* _tmp151_;
	GVariant* _tmp152_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gboolean success = FALSE;
	gchar* filename_used = NULL;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp143_ = g_variant_iter_next_value (&_arguments_iter);
	x = g_variant_get_int32 (_tmp143_);
	g_variant_unref (_tmp143_);
	_tmp144_ = g_variant_iter_next_value (&_arguments_iter);
	y = g_variant_get_int32 (_tmp144_);
	g_variant_unref (_tmp144_);
	_tmp145_ = g_variant_iter_next_value (&_arguments_iter);
	width = g_variant_get_int32 (_tmp145_);
	g_variant_unref (_tmp145_);
	_tmp146_ = g_variant_iter_next_value (&_arguments_iter);
	height = g_variant_get_int32 (_tmp146_);
	g_variant_unref (_tmp146_);
	_tmp147_ = g_variant_iter_next_value (&_arguments_iter);
	file_template = g_variant_dup_string (_tmp147_, NULL);
	g_variant_unref (_tmp147_);
	_tmp148_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp149_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
	g_variant_iter_init (&_tmp150_, _tmp148_);
	while (g_variant_iter_loop (&_tmp150_, "{?*}", &_tmp151_, &_tmp152_)) {
		g_hash_table_insert (_tmp149_, g_variant_dup_string (_tmp151_, NULL), g_variant_get_variant (_tmp152_));
	}
	options = _tmp149_;
	g_variant_unref (_tmp148_);
	gnome_shell_screencast_screencast_area (self, x, y, width, height, file_template, options, &success, &filename_used, &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_boolean (success));
	g_variant_builder_add_value (&_reply_builder, g_variant_new_string (filename_used));
	_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 (file_template);
	_g_hash_table_unref0 (options);
	_g_free0 (filename_used);
	;
}

static void
_dbus_gnome_shell_screencast_stop_screencast (GnomeShellScreencast* 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 = gnome_shell_screencast_stop_screencast (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
gnome_shell_screencast_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, "Screencast") == 0) {
		_dbus_gnome_shell_screencast_screencast (object, parameters, invocation);
	} else if (strcmp (method_name, "ScreencastArea") == 0) {
		_dbus_gnome_shell_screencast_screencast_area (object, parameters, invocation);
	} else if (strcmp (method_name, "StopScreencast") == 0) {
		_dbus_gnome_shell_screencast_stop_screencast (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
gnome_shell_screencast_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
gnome_shell_screencast_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
gnome_shell_screencast_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 *) (&_gnome_shell_screencast_dbus_interface_info), &_gnome_shell_screencast_dbus_interface_vtable, data, _gnome_shell_screencast_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

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

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

